@agent-play/play-ui 3.7.2 → 3.7.3
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-C510BE1v.js → browserAll-B1YgzNI5.js} +1 -1
- package/dist/assets/index-CP14I4fO.js +336 -0
- package/dist/assets/webworkerAll-Do5vcaXb.js +83 -0
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/index-Dn4VDu4Z.js +0 -336
- package/dist/assets/webworkerAll-C6QOfU5B.js +0 -83
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/browserAll-B1YgzNI5.js","assets/webworkerAll-Do5vcaXb.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var Df=Object.defineProperty;var kl=t=>{throw TypeError(t)};var Nf=(t,e,n)=>e in t?Df(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var K=(t,e,n)=>Nf(t,typeof e!="symbol"?e+"":e,n),$i=(t,e,n)=>e.has(t)||kl("Cannot "+n);var R=(t,e,n)=>($i(t,e,"read from private field"),n?n.call(t):e.get(t)),ae=(t,e,n)=>e.has(t)?kl("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),q=(t,e,n,r)=>($i(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),xt=(t,e,n)=>($i(t,e,"access private method"),n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();const Ff="modulepreload",Lf=function(t){return"/agent-play/"+t},Sl={},Gu=function(e,n,r){let s=Promise.resolve();if(n&&n.length>0){let o=function(c){return Promise.all(c.map(u=>Promise.resolve(u).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=o(n.map(c=>{if(c=Lf(c),c in Sl)return;Sl[c]=!0;const u=c.endsWith(".css"),h=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${h}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":Ff,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((d,m)=>{f.addEventListener("load",d),f.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return e().catch(i)})};var fe=(t=>(t.Application="application",t.WebGLPipes="webgl-pipes",t.WebGLPipesAdaptor="webgl-pipes-adaptor",t.WebGLSystem="webgl-system",t.WebGPUPipes="webgpu-pipes",t.WebGPUPipesAdaptor="webgpu-pipes-adaptor",t.WebGPUSystem="webgpu-system",t.CanvasSystem="canvas-system",t.CanvasPipesAdaptor="canvas-pipes-adaptor",t.CanvasPipes="canvas-pipes",t.Asset="asset",t.LoadParser="load-parser",t.ResolveParser="resolve-parser",t.CacheParser="cache-parser",t.DetectionParser="detection-parser",t.MaskEffect="mask-effect",t.BlendMode="blend-mode",t.TextureSource="texture-source",t.Environment="environment",t.ShapeBuilder="shape-builder",t.Batcher="batcher",t))(fe||{});const Po=t=>{if(typeof t=="function"||typeof t=="object"&&t.extension){if(!t.extension)throw new Error("Extension class must have an extension object");t={...typeof t.extension!="object"?{type:t.extension}:t.extension,ref:t}}if(typeof t=="object")t={...t};else throw new Error("Invalid extension type");return typeof t.type=="string"&&(t.type=[t.type]),t},Ss=(t,e)=>Po(t).priority??e,ct={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...t){return t.map(Po).forEach(e=>{e.type.forEach(n=>{var r,s;return(s=(r=this._removeHandlers)[n])==null?void 0:s.call(r,e)})}),this},add(...t){return t.map(Po).forEach(e=>{e.type.forEach(n=>{var i,o;const r=this._addHandlers,s=this._queue;r[n]?(o=r[n])==null||o.call(r,e):(s[n]=s[n]||[],(i=s[n])==null||i.push(e))})}),this},handle(t,e,n){var o;const r=this._addHandlers,s=this._removeHandlers;if(r[t]||s[t])throw new Error(`Extension type ${t} already has a handler`);r[t]=e,s[t]=n;const i=this._queue;return i[t]&&((o=i[t])==null||o.forEach(a=>e(a)),delete i[t]),this},handleByMap(t,e){return this.handle(t,n=>{n.name&&(e[n.name]=n.ref)},n=>{n.name&&delete e[n.name]})},handleByNamedList(t,e,n=-1){return this.handle(t,r=>{e.findIndex(i=>i.name===r.name)>=0||(e.push({name:r.name,value:r.ref}),e.sort((i,o)=>Ss(o.value,n)-Ss(i.value,n)))},r=>{const s=e.findIndex(i=>i.name===r.name);s!==-1&&e.splice(s,1)})},handleByList(t,e,n=-1){return this.handle(t,r=>{e.includes(r.ref)||(e.push(r.ref),e.sort((s,i)=>Ss(i,n)-Ss(s,n)))},r=>{const s=e.indexOf(r.ref);s!==-1&&e.splice(s,1)})},mixin(t,...e){for(const n of e)Object.defineProperties(t.prototype,Object.getOwnPropertyDescriptors(n))}},Bf={extension:{type:fe.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Gu(()=>import("./browserAll-B1YgzNI5.js"),__vite__mapDeps([0,1]))}},Zf={extension:{type:fe.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Gu(()=>import("./webworkerAll-Do5vcaXb.js"),[])}};class Be{constructor(e,n,r){this._x=n||0,this._y=r||0,this._observer=e}clone(e){return new Be(e??this._observer,this._x,this._y)}set(e=0,n=e){return(this._x!==e||this._y!==n)&&(this._x=e,this._y=n,this._observer._onUpdate(this)),this}copyFrom(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this._observer._onUpdate(this)),this}copyTo(e){return e.set(this._x,this._y),e}equals(e){return e.x===this._x&&e.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(e){this._x!==e&&(this._x=e,this._observer._onUpdate(this))}get y(){return this._y}set y(e){this._y!==e&&(this._y=e,this._observer._onUpdate(this))}}function pa(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Di={exports:{}},Tl;function Uf(){return Tl||(Tl=1,(function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function s(l,c,u){this.fn=l,this.context=c,this.once=u||!1}function i(l,c,u,h,f){if(typeof u!="function")throw new TypeError("The listener must be a function");var d=new s(u,h||l,f),m=n?n+c:c;return l._events[m]?l._events[m].fn?l._events[m]=[l._events[m],d]:l._events[m].push(d):(l._events[m]=d,l._eventsCount++),l}function o(l,c){--l._eventsCount===0?l._events=new r:delete l._events[c]}function a(){this._events=new r,this._eventsCount=0}a.prototype.eventNames=function(){var c=[],u,h;if(this._eventsCount===0)return c;for(h in u=this._events)e.call(u,h)&&c.push(n?h.slice(1):h);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(u)):c},a.prototype.listeners=function(c){var u=n?n+c:c,h=this._events[u];if(!h)return[];if(h.fn)return[h.fn];for(var f=0,d=h.length,m=new Array(d);f<d;f++)m[f]=h[f].fn;return m},a.prototype.listenerCount=function(c){var u=n?n+c:c,h=this._events[u];return h?h.fn?1:h.length:0},a.prototype.emit=function(c,u,h,f,d,m){var _=n?n+c:c;if(!this._events[_])return!1;var g=this._events[_],y=arguments.length,b,w;if(g.fn){switch(g.once&&this.removeListener(c,g.fn,void 0,!0),y){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,u),!0;case 3:return g.fn.call(g.context,u,h),!0;case 4:return g.fn.call(g.context,u,h,f),!0;case 5:return g.fn.call(g.context,u,h,f,d),!0;case 6:return g.fn.call(g.context,u,h,f,d,m),!0}for(w=1,b=new Array(y-1);w<y;w++)b[w-1]=arguments[w];g.fn.apply(g.context,b)}else{var k=g.length,E;for(w=0;w<k;w++)switch(g[w].once&&this.removeListener(c,g[w].fn,void 0,!0),y){case 1:g[w].fn.call(g[w].context);break;case 2:g[w].fn.call(g[w].context,u);break;case 3:g[w].fn.call(g[w].context,u,h);break;case 4:g[w].fn.call(g[w].context,u,h,f);break;default:if(!b)for(E=1,b=new Array(y-1);E<y;E++)b[E-1]=arguments[E];g[w].fn.apply(g[w].context,b)}}return!0},a.prototype.on=function(c,u,h){return i(this,c,u,h,!1)},a.prototype.once=function(c,u,h){return i(this,c,u,h,!0)},a.prototype.removeListener=function(c,u,h,f){var d=n?n+c:c;if(!this._events[d])return this;if(!u)return o(this,d),this;var m=this._events[d];if(m.fn)m.fn===u&&(!f||m.once)&&(!h||m.context===h)&&o(this,d);else{for(var _=0,g=[],y=m.length;_<y;_++)(m[_].fn!==u||f&&!m[_].once||h&&m[_].context!==h)&&g.push(m[_]);g.length?this._events[d]=g.length===1?g[0]:g:o(this,d)}return this},a.prototype.removeAllListeners=function(c){var u;return c?(u=n?n+c:c,this._events[u]&&o(this,u)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,t.exports=a})(Di)),Di.exports}var Gf=Uf();const fn=pa(Gf),jf=Math.PI*2,Vf=180/Math.PI,Hf=Math.PI/180;class Ue{constructor(e=0,n=0){this.x=0,this.y=0,this.x=e,this.y=n}clone(){return new Ue(this.x,this.y)}copyFrom(e){return this.set(e.x,e.y),this}copyTo(e){return e.set(this.x,this.y),e}equals(e){return e.x===this.x&&e.y===this.y}set(e=0,n=e){return this.x=e,this.y=n,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return Ni.x=0,Ni.y=0,Ni}}const Ni=new Ue;class te{constructor(e=1,n=0,r=0,s=1,i=0,o=0){this.array=null,this.a=e,this.b=n,this.c=r,this.d=s,this.tx=i,this.ty=o}fromArray(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]}set(e,n,r,s,i,o){return this.a=e,this.b=n,this.c=r,this.d=s,this.tx=i,this.ty=o,this}toArray(e,n){this.array||(this.array=new Float32Array(9));const r=n||this.array;return e?(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(e,n){n=n||new Ue;const r=e.x,s=e.y;return n.x=this.a*r+this.c*s+this.tx,n.y=this.b*r+this.d*s+this.ty,n}applyInverse(e,n){n=n||new Ue;const r=this.a,s=this.b,i=this.c,o=this.d,a=this.tx,l=this.ty,c=1/(r*o+i*-s),u=e.x,h=e.y;return n.x=o*c*u+-i*c*h+(l*i-a*o)*c,n.y=r*c*h+-s*c*u+(-l*r+a*s)*c,n}translate(e,n){return this.tx+=e,this.ty+=n,this}scale(e,n){return this.a*=e,this.d*=n,this.c*=e,this.b*=n,this.tx*=e,this.ty*=n,this}rotate(e){const n=Math.cos(e),r=Math.sin(e),s=this.a,i=this.c,o=this.tx;return this.a=s*n-this.b*r,this.b=s*r+this.b*n,this.c=i*n-this.d*r,this.d=i*r+this.d*n,this.tx=o*n-this.ty*r,this.ty=o*r+this.ty*n,this}append(e){const n=this.a,r=this.b,s=this.c,i=this.d;return this.a=e.a*n+e.b*s,this.b=e.a*r+e.b*i,this.c=e.c*n+e.d*s,this.d=e.c*r+e.d*i,this.tx=e.tx*n+e.ty*s+this.tx,this.ty=e.tx*r+e.ty*i+this.ty,this}appendFrom(e,n){const r=e.a,s=e.b,i=e.c,o=e.d,a=e.tx,l=e.ty,c=n.a,u=n.b,h=n.c,f=n.d;return this.a=r*c+s*h,this.b=r*u+s*f,this.c=i*c+o*h,this.d=i*u+o*f,this.tx=a*c+l*h+n.tx,this.ty=a*u+l*f+n.ty,this}setTransform(e,n,r,s,i,o,a,l,c){return this.a=Math.cos(a+c)*i,this.b=Math.sin(a+c)*i,this.c=-Math.sin(a-l)*o,this.d=Math.cos(a-l)*o,this.tx=e-(r*this.a+s*this.c),this.ty=n-(r*this.b+s*this.d),this}prepend(e){const n=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){const r=this.a,s=this.c;this.a=r*e.a+this.b*e.c,this.b=r*e.b+this.b*e.d,this.c=s*e.a+this.d*e.c,this.d=s*e.b+this.d*e.d}return this.tx=n*e.a+this.ty*e.c+e.tx,this.ty=n*e.b+this.ty*e.d+e.ty,this}decompose(e){const n=this.a,r=this.b,s=this.c,i=this.d,o=e.pivot,a=-Math.atan2(-s,i),l=Math.atan2(r,n),c=Math.abs(a+l);return c<1e-5||Math.abs(jf-c)<1e-5?(e.rotation=l,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=a,e.skew.y=l),e.scale.x=Math.sqrt(n*n+r*r),e.scale.y=Math.sqrt(s*s+i*i),e.position.x=this.tx+(o.x*n+o.y*s),e.position.y=this.ty+(o.x*r+o.y*i),e}invert(){const e=this.a,n=this.b,r=this.c,s=this.d,i=this.tx,o=e*s-n*r;return this.a=s/o,this.b=-n/o,this.c=-r/o,this.d=e/o,this.tx=(r*this.ty-s*i)/o,this.ty=-(e*this.ty-n*i)/o,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const e=new te;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyTo(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyFrom(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this}equals(e){return e.a===this.a&&e.b===this.b&&e.c===this.c&&e.d===this.d&&e.tx===this.tx&&e.ty===this.ty}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 Yf.identity()}static get shared(){return Wf.identity()}}const Wf=new te,Yf=new te,bn=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],vn=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],wn=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],kn=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Io=[],ju=[],Ts=Math.sign;function qf(){for(let t=0;t<16;t++){const e=[];Io.push(e);for(let n=0;n<16;n++){const r=Ts(bn[t]*bn[n]+wn[t]*vn[n]),s=Ts(vn[t]*bn[n]+kn[t]*vn[n]),i=Ts(bn[t]*wn[n]+wn[t]*kn[n]),o=Ts(vn[t]*wn[n]+kn[t]*kn[n]);for(let a=0;a<16;a++)if(bn[a]===r&&vn[a]===s&&wn[a]===i&&kn[a]===o){e.push(a);break}}}for(let t=0;t<16;t++){const e=new te;e.set(bn[t],vn[t],wn[t],kn[t],0,0),ju.push(e)}}qf();const he={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:t=>bn[t],uY:t=>vn[t],vX:t=>wn[t],vY:t=>kn[t],inv:t=>t&8?t&15:-t&7,add:(t,e)=>Io[t][e],sub:(t,e)=>Io[t][he.inv(e)],rotate180:t=>t^4,isVertical:t=>(t&3)===2,byDirection:(t,e)=>Math.abs(t)*2<=Math.abs(e)?e>=0?he.S:he.N:Math.abs(e)*2<=Math.abs(t)?t>0?he.E:he.W:e>0?t>0?he.SE:he.SW:t>0?he.NE:he.NW,matrixAppendRotationInv:(t,e,n=0,r=0,s=0,i=0)=>{const o=ju[he.inv(e)],a=o.a,l=o.b,c=o.c,u=o.d,h=n-Math.min(0,a*s,c*i,a*s+c*i),f=r-Math.min(0,l*s,u*i,l*s+u*i),d=t.a,m=t.b,_=t.c,g=t.d;t.a=a*d+l*_,t.b=a*m+l*g,t.c=c*d+u*_,t.d=c*m+u*g,t.tx=h*d+f*_+t.tx,t.ty=h*m+f*g+t.ty},transformRectCoords:(t,e,n,r)=>{const{x:s,y:i,width:o,height:a}=t,{x:l,y:c,width:u,height:h}=e;return n===he.E?(r.set(s+l,i+c,o,a),r):n===he.S?r.set(u-i-a+l,s+c,a,o):n===he.W?r.set(u-s-o+l,h-i-a+c,o,a):n===he.N?r.set(i+l,h-s-o+c,a,o):r.set(s+l,i+c,o,a)}},As=[new Ue,new Ue,new Ue,new Ue];class Oe{constructor(e=0,n=0,r=0,s=0){this.type="rectangle",this.x=Number(e),this.y=Number(n),this.width=Number(r),this.height=Number(s)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new Oe(0,0,0,0)}clone(){return new Oe(this.x,this.y,this.width,this.height)}copyFromBounds(e){return this.x=e.minX,this.y=e.minY,this.width=e.maxX-e.minX,this.height=e.maxY-e.minY,this}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.copyFrom(this),e}contains(e,n){return this.width<=0||this.height<=0?!1:e>=this.x&&e<this.x+this.width&&n>=this.y&&n<this.y+this.height}strokeContains(e,n,r,s=.5){const{width:i,height:o}=this;if(i<=0||o<=0)return!1;const a=this.x,l=this.y,c=r*(1-s),u=r-c,h=a-c,f=a+i+c,d=l-c,m=l+o+c,_=a+u,g=a+i-u,y=l+u,b=l+o-u;return e>=h&&e<=f&&n>=d&&n<=m&&!(e>_&&e<g&&n>y&&n<b)}intersects(e,n){if(!n){const j=this.x<e.x?e.x:this.x;if((this.right>e.right?e.right:this.right)<=j)return!1;const O=this.y<e.y?e.y:this.y;return(this.bottom>e.bottom?e.bottom:this.bottom)>O}const r=this.left,s=this.right,i=this.top,o=this.bottom;if(s<=r||o<=i)return!1;const a=As[0].set(e.left,e.top),l=As[1].set(e.left,e.bottom),c=As[2].set(e.right,e.top),u=As[3].set(e.right,e.bottom);if(c.x<=a.x||l.y<=a.y)return!1;const h=Math.sign(n.a*n.d-n.b*n.c);if(h===0||(n.apply(a,a),n.apply(l,l),n.apply(c,c),n.apply(u,u),Math.max(a.x,l.x,c.x,u.x)<=r||Math.min(a.x,l.x,c.x,u.x)>=s||Math.max(a.y,l.y,c.y,u.y)<=i||Math.min(a.y,l.y,c.y,u.y)>=o))return!1;const f=h*(l.y-a.y),d=h*(a.x-l.x),m=f*r+d*i,_=f*s+d*i,g=f*r+d*o,y=f*s+d*o;if(Math.max(m,_,g,y)<=f*a.x+d*a.y||Math.min(m,_,g,y)>=f*u.x+d*u.y)return!1;const b=h*(a.y-c.y),w=h*(c.x-a.x),k=b*r+w*i,E=b*s+w*i,A=b*r+w*o,C=b*s+w*o;return!(Math.max(k,E,A,C)<=b*a.x+w*a.y||Math.min(k,E,A,C)>=b*u.x+w*u.y)}pad(e=0,n=e){return this.x-=e,this.y-=n,this.width+=e*2,this.height+=n*2,this}fit(e){const n=Math.max(this.x,e.x),r=Math.min(this.x+this.width,e.x+e.width),s=Math.max(this.y,e.y),i=Math.min(this.y+this.height,e.y+e.height);return this.x=n,this.width=Math.max(r-n,0),this.y=s,this.height=Math.max(i-s,0),this}ceil(e=1,n=.001){const r=Math.ceil((this.x+this.width-n)*e)/e,s=Math.ceil((this.y+this.height-n)*e)/e;return this.x=Math.floor((this.x+n)*e)/e,this.y=Math.floor((this.y+n)*e)/e,this.width=r-this.x,this.height=s-this.y,this}scale(e,n=e){return this.x*=e,this.y*=n,this.width*=e,this.height*=n,this}enlarge(e){const n=Math.min(this.x,e.x),r=Math.max(this.x+this.width,e.x+e.width),s=Math.min(this.y,e.y),i=Math.max(this.y+this.height,e.y+e.height);return this.x=n,this.width=r-n,this.y=s,this.height=i-s,this}getBounds(e){return e||(e=new Oe),e.copyFrom(this),e}containsRect(e){if(this.width<=0||this.height<=0)return!1;const n=e.x,r=e.y,s=e.x+e.width,i=e.y+e.height;return n>=this.x&&n<this.x+this.width&&r>=this.y&&r<this.y+this.height&&s>=this.x&&s<this.x+this.width&&i>=this.y&&i<this.y+this.height}set(e,n,r,s){return this.x=e,this.y=n,this.width=r,this.height=s,this}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}const Fi={default:-1};function Ie(t="default"){return Fi[t]===void 0&&(Fi[t]=-1),++Fi[t]}const Al=new Set,Ze="8.0.0",Xf="8.3.4",Hn={quiet:!1,noColor:!1},ge=((t,e,n=3)=>{if(Hn.quiet||Al.has(e))return;let r=new Error().stack;const s=`${e}
|
|
3
|
+
Deprecated since v${t}`,i=typeof console.groupCollapsed=="function"&&!Hn.noColor;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",s):(r=r.split(`
|
|
4
|
+
`).splice(n).join(`
|
|
5
|
+
`),i?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",s),console.warn(r),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",s),console.warn(r))),Al.add(e)});Object.defineProperties(ge,{quiet:{get:()=>Hn.quiet,set:t=>{Hn.quiet=t},enumerable:!0,configurable:!1},noColor:{get:()=>Hn.noColor,set:t=>{Hn.noColor=t},enumerable:!0,configurable:!1}});const Vu=()=>{};function Cl(t){return t+=t===0?1:0,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t+1}function El(t){return!(t&t-1)&&!!t}function Hu(t){const e={};for(const n in t)t[n]!==void 0&&(e[n]=t[n]);return e}const Pl=Object.create(null);function Jf(t){const e=Pl[t];return e===void 0&&(Pl[t]=Ie("resource")),e}const Wu=class Yu extends fn{constructor(e={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,e={...Yu.defaultOptions,...e},this.addressMode=e.addressMode,this.addressModeU=e.addressModeU??this.addressModeU,this.addressModeV=e.addressModeV??this.addressModeV,this.addressModeW=e.addressModeW??this.addressModeW,this.scaleMode=e.scaleMode,this.magFilter=e.magFilter??this.magFilter,this.minFilter=e.minFilter??this.minFilter,this.mipmapFilter=e.mipmapFilter??this.mipmapFilter,this.lodMinClamp=e.lodMinClamp,this.lodMaxClamp=e.lodMaxClamp,this.compare=e.compare,this.maxAnisotropy=e.maxAnisotropy??1}set addressMode(e){this.addressModeU=e,this.addressModeV=e,this.addressModeW=e}get addressMode(){return this.addressModeU}set wrapMode(e){ge(Ze,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=e}get wrapMode(){return this.addressMode}set scaleMode(e){this.magFilter=e,this.minFilter=e,this.mipmapFilter=e}get scaleMode(){return this.magFilter}set maxAnisotropy(e){this._maxAnisotropy=Math.min(e,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 e=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=Jf(e),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};Wu.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};let qu=Wu;const Xu=class Ju extends fn{constructor(e={}){super(),this.options=e,this._gpuData=Object.create(null),this._gcLastUsed=-1,this.uid=Ie("textureSource"),this._resourceType="textureSource",this._resourceId=Ie("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,e={...Ju.defaultOptions,...e},this.label=e.label??"",this.resource=e.resource,this.autoGarbageCollect=e.autoGarbageCollect,this._resolution=e.resolution,e.width?this.pixelWidth=e.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,e.height?this.pixelHeight=e.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=e.format,this.dimension=e.dimensions,this.viewDimension=e.viewDimension??e.dimensions,this.arrayLayerCount=e.arrayLayerCount,this.mipLevelCount=e.mipLevelCount,this.autoGenerateMipmaps=e.autoGenerateMipmaps,this.sampleCount=e.sampleCount,this.antialias=e.antialias,this.alphaMode=e.alphaMode,this.style=new qu(Hu(e)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(e){var n,r;this.style!==e&&((n=this._style)==null||n.off("change",this._onStyleChange,this),this._style=e,(r=this._style)==null||r.on("change",this._onStyleChange,this),this._onStyleChange())}set maxAnisotropy(e){this._style.maxAnisotropy=e}get maxAnisotropy(){return this._style.maxAnisotropy}get addressMode(){return this._style.addressMode}set addressMode(e){this._style.addressMode=e}get repeatMode(){return this._style.addressMode}set repeatMode(e){this._style.addressMode=e}get magFilter(){return this._style.magFilter}set magFilter(e){this._style.magFilter=e}get minFilter(){return this._style.minFilter}set minFilter(e){this._style.minFilter=e}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(e){this._style.mipmapFilter=e}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(e){this._style.lodMinClamp=e}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(e){this._style.lodMaxClamp=e}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){const e=this._resolution;if(this.resize(this.resourceWidth/e,this.resourceHeight/e))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 e,n;this._resourceId=Ie("resource"),this.emit("change",this),this.emit("unload",this);for(const r in this._gpuData)(n=(e=this._gpuData[r])==null?void 0:e.destroy)==null||n.call(e);this._gpuData=Object.create(null)}get resourceWidth(){const{resource:e}=this;return e.naturalWidth||e.videoWidth||e.displayWidth||e.width}get resourceHeight(){const{resource:e}=this;return e.naturalHeight||e.videoHeight||e.displayHeight||e.height}get resolution(){return this._resolution}set resolution(e){this._resolution!==e&&(this._resolution=e,this.width=this.pixelWidth/e,this.height=this.pixelHeight/e)}resize(e,n,r){r||(r=this._resolution),e||(e=this.width),n||(n=this.height);const s=Math.round(e*r),i=Math.round(n*r);return this.width=s/r,this.height=i/r,this._resolution=r,this.pixelWidth===s&&this.pixelHeight===i?!1:(this._refreshPOT(),this.pixelWidth=s,this.pixelHeight=i,this.emit("resize",this),this._resourceId=Ie("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(e){this._style.wrapMode=e}get wrapMode(){return this._style.wrapMode}set scaleMode(e){this._style.scaleMode=e}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=El(this.pixelWidth)&&El(this.pixelHeight)}static test(e){throw new Error("Unimplemented")}};Xu.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 At=Xu;class ma extends At{constructor(e){const n=e.resource||new Float32Array(e.width*e.height*4);let r=e.format;r||(n instanceof Float32Array?r="rgba32float":n instanceof Int32Array||n instanceof Uint32Array?r="rgba32uint":n instanceof Int16Array||n instanceof Uint16Array?r="rgba16uint":(n instanceof Int8Array,r="bgra8unorm")),super({...e,resource:n,format:r}),this.uploadMethodId="buffer"}static test(e){return e instanceof Int8Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array}}ma.extension=fe.TextureSource;const Il=new te;class Kf{constructor(e,n){this.mapCoord=new te,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof n>"u"?this.clampMargin=e.width<10?0:.5:this.clampMargin=n,this.isSimple=!1,this.texture=e}get texture(){return this._texture}set texture(e){var n;this.texture!==e&&((n=this._texture)==null||n.removeListener("update",this.update,this),this._texture=e,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(e,n){n===void 0&&(n=e);const r=this.mapCoord;for(let s=0;s<e.length;s+=2){const i=e[s],o=e[s+1];n[s]=i*r.a+o*r.c+r.tx,n[s+1]=i*r.b+o*r.d+r.ty}return n}update(){const e=this._texture;this._updateID++;const n=e.uvs;this.mapCoord.set(n.x1-n.x0,n.y1-n.y0,n.x3-n.x0,n.y3-n.y0,n.x0,n.y0);const r=e.orig,s=e.trim;s&&(Il.set(r.width/s.width,0,0,r.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(Il));const i=e.source,o=this.uClampFrame,a=this.clampMargin/i._resolution,l=this.clampOffset/i._resolution;return o[0]=(e.frame.x+a+l)/i.width,o[1]=(e.frame.y+a+l)/i.height,o[2]=(e.frame.x+e.frame.width-a+l)/i.width,o[3]=(e.frame.y+e.frame.height-a+l)/i.height,this.uClampOffset[0]=this.clampOffset/i.pixelWidth,this.uClampOffset[1]=this.clampOffset/i.pixelHeight,this.isSimple=e.frame.width===i.width&&e.frame.height===i.height&&e.rotate===0,!0}}class de extends fn{constructor({source:e,label:n,frame:r,orig:s,trim:i,defaultAnchor:o,defaultBorders:a,rotate:l,dynamic:c}={}){if(super(),this.uid=Ie("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new Oe,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=n,this.source=(e==null?void 0:e.source)??new At,this.noFrame=!r,r)this.frame.copyFrom(r);else{const{width:u,height:h}=this._source;this.frame.width=u,this.frame.height=h}this.orig=s||this.frame,this.trim=i,this.rotate=l??0,this.defaultAnchor=o,this.defaultBorders=a,this.destroyed=!1,this.dynamic=c||!1,this.updateUvs()}set source(e){this._source&&this._source.off("resize",this.update,this),this._source=e,e.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new Kf(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){const{uvs:e,frame:n}=this,{width:r,height:s}=this._source,i=n.x/r,o=n.y/s,a=n.width/r,l=n.height/s;let c=this.rotate;if(c){const u=a/2,h=l/2,f=i+u,d=o+h;c=he.add(c,he.NW),e.x0=f+u*he.uX(c),e.y0=d+h*he.uY(c),c=he.add(c,2),e.x1=f+u*he.uX(c),e.y1=d+h*he.uY(c),c=he.add(c,2),e.x2=f+u*he.uX(c),e.y2=d+h*he.uY(c),c=he.add(c,2),e.x3=f+u*he.uX(c),e.y3=d+h*he.uY(c)}else e.x0=i,e.y0=o,e.x1=i+a,e.y1=o,e.x2=i+a,e.y2=o+l,e.x3=i,e.y3=o+l}destroy(e=!1){this._source&&(this._source.off("resize",this.update,this),e&&(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 ge(Ze,"Texture.baseTexture is now Texture.source"),this._source}}de.EMPTY=new de({label:"EMPTY",source:new At({label:"EMPTY"})});de.EMPTY.destroy=Vu;de.WHITE=new de({source:new ma({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});de.WHITE.destroy=Vu;function Qf(t,e,n){const{width:r,height:s}=n.orig,i=n.trim;if(i){const o=i.width,a=i.height;t.minX=i.x-e._x*r,t.maxX=t.minX+o,t.minY=i.y-e._y*s,t.maxY=t.minY+a}else t.minX=-e._x*r,t.maxX=t.minX+r,t.minY=-e._y*s,t.maxY=t.minY+s}const Ml=new te;class St{constructor(e=1/0,n=1/0,r=-1/0,s=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Ml,this.minX=e,this.minY=n,this.maxX=r,this.maxY=s}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new Oe);const e=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(e.x=0,e.y=0,e.width=0,e.height=0):e.copyFromBounds(this),e}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Ml,this}set(e,n,r,s){this.minX=e,this.minY=n,this.maxX=r,this.maxY=s}addFrame(e,n,r,s,i){i||(i=this.matrix);const o=i.a,a=i.b,l=i.c,c=i.d,u=i.tx,h=i.ty;let f=this.minX,d=this.minY,m=this.maxX,_=this.maxY,g=o*e+l*n+u,y=a*e+c*n+h;g<f&&(f=g),y<d&&(d=y),g>m&&(m=g),y>_&&(_=y),g=o*r+l*n+u,y=a*r+c*n+h,g<f&&(f=g),y<d&&(d=y),g>m&&(m=g),y>_&&(_=y),g=o*e+l*s+u,y=a*e+c*s+h,g<f&&(f=g),y<d&&(d=y),g>m&&(m=g),y>_&&(_=y),g=o*r+l*s+u,y=a*r+c*s+h,g<f&&(f=g),y<d&&(d=y),g>m&&(m=g),y>_&&(_=y),this.minX=f,this.minY=d,this.maxX=m,this.maxY=_}addRect(e,n){this.addFrame(e.x,e.y,e.x+e.width,e.y+e.height,n)}addBounds(e,n){this.addFrame(e.minX,e.minY,e.maxX,e.maxY,n)}addBoundsMask(e){this.minX=this.minX>e.minX?this.minX:e.minX,this.minY=this.minY>e.minY?this.minY:e.minY,this.maxX=this.maxX<e.maxX?this.maxX:e.maxX,this.maxY=this.maxY<e.maxY?this.maxY:e.maxY}applyMatrix(e){const n=this.minX,r=this.minY,s=this.maxX,i=this.maxY,{a:o,b:a,c:l,d:c,tx:u,ty:h}=e;let f=o*n+l*r+u,d=a*n+c*r+h;this.minX=f,this.minY=d,this.maxX=f,this.maxY=d,f=o*s+l*r+u,d=a*s+c*r+h,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=o*n+l*i+u,d=a*n+c*i+h,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=o*s+l*i+u,d=a*s+c*i+h,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(e){return this.minX<e.left&&(this.minX=e.left),this.maxX>e.right&&(this.maxX=e.right),this.minY<e.top&&(this.minY=e.top),this.maxY>e.bottom&&(this.maxY=e.bottom),this}fitBounds(e,n,r,s){return this.minX<e&&(this.minX=e),this.maxX>n&&(this.maxX=n),this.minY<r&&(this.minY=r),this.maxY>s&&(this.maxY=s),this}pad(e,n=e){return this.minX-=e,this.maxX+=e,this.minY-=n,this.maxY+=n,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 St(this.minX,this.minY,this.maxX,this.maxY)}scale(e,n=e){return this.minX*=e,this.minY*=n,this.maxX*=e,this.maxY*=n,this}get x(){return this.minX}set x(e){const n=this.maxX-this.minX;this.minX=e,this.maxX=e+n}get y(){return this.minY}set y(e){const n=this.maxY-this.minY;this.minY=e,this.maxY=e+n}get width(){return this.maxX-this.minX}set width(e){this.maxX=this.minX+e}get height(){return this.maxY-this.minY}set height(e){this.maxY=this.minY+e}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(e,n,r,s){let i=this.minX,o=this.minY,a=this.maxX,l=this.maxY;s||(s=this.matrix);const c=s.a,u=s.b,h=s.c,f=s.d,d=s.tx,m=s.ty;for(let _=n;_<r;_+=2){const g=e[_],y=e[_+1],b=c*g+h*y+d,w=u*g+f*y+m;i=b<i?b:i,o=w<o?w:o,a=b>a?b:a,l=w>l?w:l}this.minX=i,this.minY=o,this.maxX=a,this.maxY=l}containsPoint(e,n){return this.minX<=e&&this.minY<=n&&this.maxX>=e&&this.maxY>=n}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(e){return this.minX=e.minX,this.minY=e.minY,this.maxX=e.maxX,this.maxY=e.maxY,this}}var ep={grad:.9,turn:360,rad:360/(2*Math.PI)},Ft=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},ze=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n+0},dt=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t>e?t:e},Ku=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},Rl=function(t){return{r:dt(t.r,0,255),g:dt(t.g,0,255),b:dt(t.b,0,255),a:dt(t.a)}},Li=function(t){return{r:ze(t.r),g:ze(t.g),b:ze(t.b),a:ze(t.a,3)}},tp=/^#([0-9a-f]{3,8})$/i,Cs=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},Qu=function(t){var e=t.r,n=t.g,r=t.b,s=t.a,i=Math.max(e,n,r),o=i-Math.min(e,n,r),a=o?i===e?(n-r)/o:i===n?2+(r-e)/o:4+(e-n)/o:0;return{h:60*(a<0?a+6:a),s:i?o/i*100:0,v:i/255*100,a:s}},eh=function(t){var e=t.h,n=t.s,r=t.v,s=t.a;e=e/360*6,n/=100,r/=100;var i=Math.floor(e),o=r*(1-n),a=r*(1-(e-i)*n),l=r*(1-(1-e+i)*n),c=i%6;return{r:255*[r,a,o,o,l,r][c],g:255*[l,r,r,a,o,o][c],b:255*[o,o,l,r,r,a][c],a:s}},zl=function(t){return{h:Ku(t.h),s:dt(t.s,0,100),l:dt(t.l,0,100),a:dt(t.a)}},Ol=function(t){return{h:ze(t.h),s:ze(t.s),l:ze(t.l),a:ze(t.a,3)}},$l=function(t){return eh((n=(e=t).s,{h:e.h,s:(n*=((r=e.l)<50?r:100-r)/100)>0?2*n/(r+n)*100:0,v:r+n,a:e.a}));var e,n,r},Br=function(t){return{h:(e=Qu(t)).h,s:(s=(200-(n=e.s))*(r=e.v)/100)>0&&s<200?n*r/100/(s<=100?s:200-s)*100:0,l:s/2,a:e.a};var e,n,r,s},np=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,rp=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,sp=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ip=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Mo={string:[[function(t){var e=tp.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?ze(parseInt(t[3]+t[3],16)/255,2):1}:t.length===6||t.length===8?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:t.length===8?ze(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=sp.exec(t)||ip.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:Rl({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e=np.exec(t)||rp.exec(t);if(!e)return null;var n,r,s=zl({h:(n=e[1],r=e[2],r===void 0&&(r="deg"),Number(n)*(ep[r]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return $l(s)},"hsl"]],object:[[function(t){var e=t.r,n=t.g,r=t.b,s=t.a,i=s===void 0?1:s;return Ft(e)&&Ft(n)&&Ft(r)?Rl({r:Number(e),g:Number(n),b:Number(r),a:Number(i)}):null},"rgb"],[function(t){var e=t.h,n=t.s,r=t.l,s=t.a,i=s===void 0?1:s;if(!Ft(e)||!Ft(n)||!Ft(r))return null;var o=zl({h:Number(e),s:Number(n),l:Number(r),a:Number(i)});return $l(o)},"hsl"],[function(t){var e=t.h,n=t.s,r=t.v,s=t.a,i=s===void 0?1:s;if(!Ft(e)||!Ft(n)||!Ft(r))return null;var o=(function(a){return{h:Ku(a.h),s:dt(a.s,0,100),v:dt(a.v,0,100),a:dt(a.a)}})({h:Number(e),s:Number(n),v:Number(r),a:Number(i)});return eh(o)},"hsv"]]},Dl=function(t,e){for(var n=0;n<e.length;n++){var r=e[n][0](t);if(r)return[r,e[n][1]]}return[null,void 0]},op=function(t){return typeof t=="string"?Dl(t.trim(),Mo.string):typeof t=="object"&&t!==null?Dl(t,Mo.object):[null,void 0]},Bi=function(t,e){var n=Br(t);return{h:n.h,s:dt(n.s+100*e,0,100),l:n.l,a:n.a}},Zi=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},Nl=function(t,e){var n=Br(t);return{h:n.h,s:n.s,l:dt(n.l+100*e,0,100),a:n.a}},Ro=(function(){function t(e){this.parsed=op(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return t.prototype.isValid=function(){return this.parsed!==null},t.prototype.brightness=function(){return ze(Zi(this.rgba),2)},t.prototype.isDark=function(){return Zi(this.rgba)<.5},t.prototype.isLight=function(){return Zi(this.rgba)>=.5},t.prototype.toHex=function(){return e=Li(this.rgba),n=e.r,r=e.g,s=e.b,o=(i=e.a)<1?Cs(ze(255*i)):"","#"+Cs(n)+Cs(r)+Cs(s)+o;var e,n,r,s,i,o},t.prototype.toRgb=function(){return Li(this.rgba)},t.prototype.toRgbString=function(){return e=Li(this.rgba),n=e.r,r=e.g,s=e.b,(i=e.a)<1?"rgba("+n+", "+r+", "+s+", "+i+")":"rgb("+n+", "+r+", "+s+")";var e,n,r,s,i},t.prototype.toHsl=function(){return Ol(Br(this.rgba))},t.prototype.toHslString=function(){return e=Ol(Br(this.rgba)),n=e.h,r=e.s,s=e.l,(i=e.a)<1?"hsla("+n+", "+r+"%, "+s+"%, "+i+")":"hsl("+n+", "+r+"%, "+s+"%)";var e,n,r,s,i},t.prototype.toHsv=function(){return e=Qu(this.rgba),{h:ze(e.h),s:ze(e.s),v:ze(e.v),a:ze(e.a,3)};var e},t.prototype.invert=function(){return It({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},t.prototype.saturate=function(e){return e===void 0&&(e=.1),It(Bi(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),It(Bi(this.rgba,-e))},t.prototype.grayscale=function(){return It(Bi(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),It(Nl(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),It(Nl(this.rgba,-e))},t.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},t.prototype.alpha=function(e){return typeof e=="number"?It({r:(n=this.rgba).r,g:n.g,b:n.b,a:e}):ze(this.rgba.a,3);var n},t.prototype.hue=function(e){var n=Br(this.rgba);return typeof e=="number"?It({h:e,s:n.s,l:n.l,a:n.a}):ze(n.h)},t.prototype.isEqual=function(e){return this.toHex()===It(e).toHex()},t})(),It=function(t){return t instanceof Ro?t:new Ro(t)},Fl=[],ap=function(t){t.forEach(function(e){Fl.indexOf(e)<0&&(e(Ro,Mo),Fl.push(e))})};function lp(t,e){var n={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var s in n)r[n[s]]=s;var i={};t.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,c=r[this.toHex()];if(c)return c;if(o!=null&&o.closest){var u=this.toRgb(),h=1/0,f="black";if(!i.length)for(var d in n)i[d]=new t(n[d]).toRgb();for(var m in n){var _=(a=u,l=i[m],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));_<h&&(h=_,f=m)}return f}},e.string.push([function(o){var a=o.toLowerCase(),l=a==="transparent"?"#0000":n[a];return l?new t(l).toRgb():null},"name"])}ap([lp]);const nr=class Rr{constructor(e=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=e}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(e){return this.value=e,this}set value(e){if(e instanceof Rr)this._value=this._cloneSource(e._value),this._int=e._int,this._components.set(e._components);else{if(e===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,e))&&(this._value=this._cloneSource(e),this._normalize(this._value))}}get value(){return this._value}_cloneSource(e){return typeof e=="string"||typeof e=="number"||e instanceof Number||e===null?e:Array.isArray(e)||ArrayBuffer.isView(e)?e.slice(0):typeof e=="object"&&e!==null?{...e}:e}_isSourceEqual(e,n){const r=typeof e;if(r!==typeof n)return!1;if(r==="number"||r==="string"||e instanceof Number)return e===n;if(Array.isArray(e)&&Array.isArray(n)||ArrayBuffer.isView(e)&&ArrayBuffer.isView(n))return e.length!==n.length?!1:e.every((i,o)=>i===n[o]);if(e!==null&&n!==null){const i=Object.keys(e),o=Object.keys(n);return i.length!==o.length?!1:i.every(a=>e[a]===n[a])}return e===n}toRgba(){const[e,n,r,s]=this._components;return{r:e,g:n,b:r,a:s}}toRgb(){const[e,n,r]=this._components;return{r:e,g:n,b:r}}toRgbaString(){const[e,n,r]=this.toUint8RgbArray();return`rgba(${e},${n},${r},${this.alpha})`}toUint8RgbArray(e){const[n,r,s]=this._components;return this._arrayRgb||(this._arrayRgb=[]),e||(e=this._arrayRgb),e[0]=Math.round(n*255),e[1]=Math.round(r*255),e[2]=Math.round(s*255),e}toArray(e){this._arrayRgba||(this._arrayRgba=[]),e||(e=this._arrayRgba);const[n,r,s,i]=this._components;return e[0]=n,e[1]=r,e[2]=s,e[3]=i,e}toRgbArray(e){this._arrayRgb||(this._arrayRgb=[]),e||(e=this._arrayRgb);const[n,r,s]=this._components;return e[0]=n,e[1]=r,e[2]=s,e}toNumber(){return this._int}toBgrNumber(){const[e,n,r]=this.toUint8RgbArray();return(r<<16)+(n<<8)+e}toLittleEndianNumber(){const e=this._int;return(e>>16)+(e&65280)+((e&255)<<16)}multiply(e){const[n,r,s,i]=Rr._temp.setValue(e)._components;return this._components[0]*=n,this._components[1]*=r,this._components[2]*=s,this._components[3]*=i,this._refreshInt(),this._value=null,this}premultiply(e,n=!0){return n&&(this._components[0]*=e,this._components[1]*=e,this._components[2]*=e),this._components[3]=e,this._refreshInt(),this._value=null,this}toPremultiplied(e,n=!0){if(e===1)return(255<<24)+this._int;if(e===0)return n?0:this._int;let r=this._int>>16&255,s=this._int>>8&255,i=this._int&255;return n&&(r=r*e+.5|0,s=s*e+.5|0,i=i*e+.5|0),(e*255<<24)+(r<<16)+(s<<8)+i}toHex(){const e=this._int.toString(16);return`#${"000000".substring(0,6-e.length)+e}`}toHexa(){const n=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-n.length)+n}setAlpha(e){return this._components[3]=this._clamp(e),this._value=null,this}_normalize(e){let n,r,s,i;if((typeof e=="number"||e instanceof Number)&&e>=0&&e<=16777215){const o=e;n=(o>>16&255)/255,r=(o>>8&255)/255,s=(o&255)/255,i=1}else if((Array.isArray(e)||e instanceof Float32Array)&&e.length>=3&&e.length<=4)e=this._clamp(e),[n,r,s,i=1]=e;else if((e instanceof Uint8Array||e instanceof Uint8ClampedArray)&&e.length>=3&&e.length<=4)e=this._clamp(e,0,255),[n,r,s,i=255]=e,n/=255,r/=255,s/=255,i/=255;else if(typeof e=="string"||typeof e=="object"){if(typeof e=="string"){const a=Rr.HEX_PATTERN.exec(e);a&&(e=`#${a[2]}`)}const o=It(e);o.isValid()&&({r:n,g:r,b:s,a:i}=o.rgba,n/=255,r/=255,s/=255)}if(n!==void 0)this._components[0]=n,this._components[1]=r,this._components[2]=s,this._components[3]=i,this._refreshInt();else throw new Error(`Unable to convert color ${e}`)}_refreshInt(){this._clamp(this._components);const[e,n,r]=this._components;this._int=(e*255<<16)+(n*255<<8)+(r*255|0)}_clamp(e,n=0,r=1){return typeof e=="number"?Math.min(Math.max(e,n),r):(e.forEach((s,i)=>{e[i]=Math.min(Math.max(s,n),r)}),e)}static isColorLike(e){return typeof e=="number"||typeof e=="string"||e instanceof Number||e instanceof Rr||Array.isArray(e)||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Float32Array||e.r!==void 0&&e.g!==void 0&&e.b!==void 0||e.r!==void 0&&e.g!==void 0&&e.b!==void 0&&e.a!==void 0||e.h!==void 0&&e.s!==void 0&&e.l!==void 0||e.h!==void 0&&e.s!==void 0&&e.l!==void 0&&e.a!==void 0||e.h!==void 0&&e.s!==void 0&&e.v!==void 0||e.h!==void 0&&e.s!==void 0&&e.v!==void 0&&e.a!==void 0}};nr.shared=new nr;nr._temp=new nr;nr.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Vt=nr;const cp={cullArea:null,cullable:!1,cullableChildren:!0};let Ui=0;const Ll=500;function lt(...t){Ui!==Ll&&(Ui++,Ui===Ll?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...t))}const ga={_registeredResources:new Set,register(t){this._registeredResources.add(t)},unregister(t){this._registeredResources.delete(t)},release(){this._registeredResources.forEach(t=>t.clear())},get registeredCount(){return this._registeredResources.size},isRegistered(t){return this._registeredResources.has(t)},reset(){this._registeredResources.clear()}};class up{constructor(e,n){this._pool=[],this._count=0,this._index=0,this._classType=e,n&&this.prepopulate(n)}prepopulate(e){for(let n=0;n<e;n++)this._pool[this._index++]=new this._classType;this._count+=e}get(e){var r;let n;return this._index>0?n=this._pool[--this._index]:(n=new this._classType,this._count++),(r=n.init)==null||r.call(n,e),n}return(e){var n;(n=e.reset)==null||n.call(e),this._pool[this._index++]=e}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 e=0;e<this._index;e++)this._pool[e].destroy();this._pool.length=0,this._count=0,this._index=0}}class hp{constructor(){this._poolsByClass=new Map}prepopulate(e,n){this.getPool(e).prepopulate(n)}get(e,n){return this.getPool(e).get(n)}return(e){this.getPool(e.constructor).return(e)}getPool(e){return this._poolsByClass.has(e)||this._poolsByClass.set(e,new up(e)),this._poolsByClass.get(e)}stats(){const e={};return this._poolsByClass.forEach(n=>{const r=e[n._classType.name]?n._classType.name+n._classType.ID:n._classType.name;e[r]={free:n.totalFree,used:n.totalUsed,size:n.totalSize}}),e}clear(){this._poolsByClass.forEach(e=>e.clear()),this._poolsByClass.clear()}}const nt=new hp;ga.register(nt);const dp={get isCachedAsTexture(){var t;return!!((t=this.renderGroup)!=null&&t.isCachedAsTexture)},cacheAsTexture(t){typeof t=="boolean"&&t===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(t===!0?{}:t))},updateCacheTexture(){var t;(t=this.renderGroup)==null||t.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(t){ge("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(t)}};function fp(t,e,n){const r=t.length;let s;if(e>=r||n===0)return;n=e+n>r?r-e:n;const i=r-n;for(s=e;s<i;++s)t[s]=t[s+n];t.length=i}const pp={allowChildren:!0,removeChildren(t=0,e){var i;const n=e??this.children.length,r=n-t,s=[];if(r>0&&r<=n){for(let a=n-1;a>=t;a--){const l=this.children[a];l&&(s.push(l),l.parent=null)}fp(this.children,t,n);const o=this.renderGroup||this.parentRenderGroup;o&&o.removeChildren(s);for(let a=0;a<s.length;++a){const l=s[a];(i=l.parentRenderLayer)==null||i.detach(l),this.emit("childRemoved",l,this,a),s[a].emit("removed",this)}return s.length>0&&this._didViewChangeTick++,s}else if(r===0&&this.children.length===0)return s;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(t){const e=this.getChildAt(t);return this.removeChild(e)},getChildAt(t){if(t<0||t>=this.children.length)throw new Error(`getChildAt: Index (${t}) does not exist.`);return this.children[t]},setChildIndex(t,e){if(e<0||e>=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);this.getChildIndex(t),this.addChildAt(t,e)},getChildIndex(t){const e=this.children.indexOf(t);if(e===-1)throw new Error("The supplied Container must be a child of the caller");return e},addChildAt(t,e){this.allowChildren||ge(Ze,"addChildAt: Only Containers will be allowed to add children in v8.0.0");const{children:n}=this;if(e<0||e>n.length)throw new Error(`${t}addChildAt: The index ${e} supplied is out of bounds ${n.length}`);const r=t.parent===this;if(t.parent){const i=t.parent.children.indexOf(t);if(r){if(i===e)return t;t.parent.children.splice(i,1)}else t.removeFromParent()}e===n.length?n.push(t):n.splice(e,0,t),t.parent=this,t.didChange=!0,t._updateFlags=15;const s=this.renderGroup||this.parentRenderGroup;return s&&s.addChild(t),this.sortableChildren&&(this.sortDirty=!0),r||(this.emit("childAdded",t,this,e),t.emit("added",this)),t},swapChildren(t,e){if(t===e)return;const n=this.getChildIndex(t),r=this.getChildIndex(e);this.children[n]=e,this.children[r]=t;const s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){var t;(t=this.parent)==null||t.removeChild(this)},reparentChild(...t){return t.length===1?this.reparentChildAt(t[0],this.children.length):(t.forEach(e=>this.reparentChildAt(e,this.children.length)),t[0])},reparentChildAt(t,e){if(t.parent===this)return this.setChildIndex(t,e),t;const n=t.worldTransform.clone();t.removeFromParent(),this.addChildAt(t,e);const r=this.worldTransform.clone();return r.invert(),n.prepend(r),t.setFromMatrix(n),t},replaceChild(t,e){t.updateLocalTransform(),this.addChildAt(e,this.getChildIndex(t)),e.setFromMatrix(t.localTransform),e.updateLocalTransform(),this.removeChild(t)}},mp={collectRenderables(t,e,n){this.parentRenderLayer&&this.parentRenderLayer!==n||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(t,e,n):this.renderGroup?e.renderPipes.renderGroup.addRenderGroup(this.renderGroup,t):this.collectRenderablesWithEffects(t,e,n))},collectRenderablesSimple(t,e,n){const r=this.children,s=r.length;for(let i=0;i<s;i++)r[i].collectRenderables(t,e,n)},collectRenderablesWithEffects(t,e,n){const{renderPipes:r}=e;for(let s=0;s<this.effects.length;s++){const i=this.effects[s];r[i.pipe].push(i,this,t)}this.collectRenderablesSimple(t,e,n);for(let s=this.effects.length-1;s>=0;s--){const i=this.effects[s];r[i.pipe].pop(i,this,t)}}};class Bl{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let e=0;e<this.filters.length;e++)this.filters[e].destroy();this.filters=null,this.filterArea=null}}class gp{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(e=>{this.add({test:e.test,maskClass:e})}))}add(e){this._tests.push(e)}getMaskEffect(e){this._initialized||this.init();for(let n=0;n<this._tests.length;n++){const r=this._tests[n];if(r.test(e))return nt.get(r.maskClass,e)}return e}returnMaskEffect(e){nt.return(e)}}const zo=new gp;ct.handleByList(fe.MaskEffect,zo._effectClasses);const _p={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){const t=this.renderGroup||this.parentRenderGroup;t&&(t.structureDidChange=!0)},addEffect(t){this.effects.indexOf(t)===-1&&(this.effects.push(t),this.effects.sort((n,r)=>n.priority-r.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(t){const e=this.effects.indexOf(t);e!==-1&&(this.effects.splice(e,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(t){const e=this._maskEffect;(e==null?void 0:e.mask)!==t&&(e&&(this.removeEffect(e),zo.returnMaskEffect(e),this._maskEffect=null),t!=null&&(this._maskEffect=zo.getMaskEffect(t),this.addEffect(this._maskEffect)))},get mask(){var t;return(t=this._maskEffect)==null?void 0:t.mask},setMask(t){this._maskOptions={...this._maskOptions,...t},t.mask&&(this.mask=t.mask),this._markStructureAsChanged()},set filters(t){var i;!Array.isArray(t)&&t&&(t=[t]);const e=this._filterEffect||(this._filterEffect=new Bl);t=t;const n=(t==null?void 0:t.length)>0,r=((i=e.filters)==null?void 0:i.length)>0,s=n!==r;t=Array.isArray(t)?t.slice(0):t,e.filters=Object.freeze(t),s&&(n?this.addEffect(e):(this.removeEffect(e),e.filters=t??null))},get filters(){var t;return(t=this._filterEffect)==null?void 0:t.filters},set filterArea(t){this._filterEffect||(this._filterEffect=new Bl),this._filterEffect.filterArea=t},get filterArea(){var t;return(t=this._filterEffect)==null?void 0:t.filterArea}},yp={label:null,get name(){return ge(Ze,"Container.name property has been removed, use Container.label instead"),this.label},set name(t){ge(Ze,"Container.name property has been removed, use Container.label instead"),this.label=t},getChildByName(t,e=!1){return this.getChildByLabel(t,e)},getChildByLabel(t,e=!1){const n=this.children;for(let r=0;r<n.length;r++){const s=n[r];if(s.label===t||t instanceof RegExp&&t.test(s.label))return s}if(e)for(let r=0;r<n.length;r++){const i=n[r].getChildByLabel(t,!0);if(i)return i}return null},getChildrenByLabel(t,e=!1,n=[]){const r=this.children;for(let s=0;s<r.length;s++){const i=r[s];(i.label===t||t instanceof RegExp&&t.test(i.label))&&n.push(i)}if(e)for(let s=0;s<r.length;s++)r[s].getChildrenByLabel(t,!0,n);return n}},He=nt.getPool(te),Gt=nt.getPool(St),xp=new te,bp={getFastGlobalBounds(t,e){e||(e=new St),e.clear(),this._getGlobalBoundsRecursive(!!t,e,this.parentRenderLayer),e.isValid||e.set(0,0,0,0);const n=this.renderGroup||this.parentRenderGroup;return e.applyMatrix(n.worldTransform),e},_getGlobalBoundsRecursive(t,e,n){let r=e;if(t&&this.parentRenderLayer&&this.parentRenderLayer!==n||this.localDisplayStatus!==7||!this.measurable)return;const s=!!this.effects.length;if((this.renderGroup||s)&&(r=Gt.get().clear()),this.boundsArea)e.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){const o=this.bounds;r.addFrame(o.minX,o.minY,o.maxX,o.maxY,this.groupTransform)}const i=this.children;for(let o=0;o<i.length;o++)i[o]._getGlobalBoundsRecursive(t,r,n)}if(s){let i=!1;const o=this.renderGroup||this.parentRenderGroup;for(let a=0;a<this.effects.length;a++)this.effects[a].addBounds&&(i||(i=!0,r.applyMatrix(o.worldTransform)),this.effects[a].addBounds(r,!0));i&&r.applyMatrix(o.worldTransform.copyTo(xp).invert()),e.addBounds(r),Gt.return(r)}else this.renderGroup&&(e.addBounds(r,this.relativeGroupTransform),Gt.return(r))}};function th(t,e,n){n.clear();let r,s;return t.parent?e?r=t.parent.worldTransform:(s=He.get().identity(),r=_a(t,s)):r=te.IDENTITY,nh(t,n,r,e),s&&He.return(s),n.isValid||n.set(0,0,0,0),n}function nh(t,e,n,r){var a,l;if(!t.visible||!t.measurable)return;let s;r?s=t.worldTransform:(t.updateLocalTransform(),s=He.get(),s.appendFrom(t.localTransform,n));const i=e,o=!!t.effects.length;if(o&&(e=Gt.get().clear()),t.boundsArea)e.addRect(t.boundsArea,s);else{const c=t.bounds;c&&!c.isEmpty()&&(e.matrix=s,e.addBounds(c));for(let u=0;u<t.children.length;u++)nh(t.children[u],e,s,r)}if(o){for(let c=0;c<t.effects.length;c++)(l=(a=t.effects[c]).addBounds)==null||l.call(a,e);i.addBounds(e,te.IDENTITY),Gt.return(e)}r||He.return(s)}function _a(t,e){const n=t.parent;return n&&(_a(n,e),n.updateLocalTransform(),e.append(n.localTransform)),e}function rh(t,e){if(t===16777215||!e)return e;if(e===16777215||!t)return t;const n=t>>16&255,r=t>>8&255,s=t&255,i=e>>16&255,o=e>>8&255,a=e&255,l=n*i/255|0,c=r*o/255|0,u=s*a/255|0;return(l<<16)+(c<<8)+u}const Zl=16777215;function Ul(t,e){return t===Zl?e:e===Zl?t:rh(t,e)}function Vs(t){return((t&255)<<16)+(t&65280)+(t>>16&255)}const vp={getGlobalAlpha(t){if(t)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let e=this.alpha,n=this.parent;for(;n;)e*=n.alpha,n=n.parent;return e},getGlobalTransform(t=new te,e){if(e)return t.copyFrom(this.worldTransform);this.updateLocalTransform();const n=_a(this,He.get().identity());return t.appendFrom(this.localTransform,n),He.return(n),t},getGlobalTint(t){if(t)return this.renderGroup?Vs(this.renderGroup.worldColor):this.parentRenderGroup?Vs(Ul(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let e=this.localColor,n=this.parent;for(;n;)e=Ul(e,n.localColor),n=n.parent;return Vs(e)}};function sh(t,e,n){return e.clear(),n||(n=te.IDENTITY),ih(t,e,n,t,!0),e.isValid||e.set(0,0,0,0),e}function ih(t,e,n,r,s){var l,c;let i;if(s)i=He.get(),i=n.copyTo(i);else{if(!t.visible||!t.measurable)return;t.updateLocalTransform();const u=t.localTransform;i=He.get(),i.appendFrom(u,n)}const o=e,a=!!t.effects.length;if(a&&(e=Gt.get().clear()),t.boundsArea)e.addRect(t.boundsArea,i);else{t.renderPipeId&&(e.matrix=i,e.addBounds(t.bounds));const u=t.children;for(let h=0;h<u.length;h++)ih(u[h],e,i,r,!1)}if(a){for(let u=0;u<t.effects.length;u++)(c=(l=t.effects[u]).addLocalBounds)==null||c.call(l,e,r);o.addBounds(e,te.IDENTITY),Gt.return(e)}He.return(i)}function oh(t,e){const n=t.children;for(let r=0;r<n.length;r++){const s=n[r],i=s.uid,o=(s._didViewChangeTick&65535)<<16|s._didContainerChangeTick&65535,a=e.index;(e.data[a]!==i||e.data[a+1]!==o)&&(e.data[e.index]=i,e.data[e.index+1]=o,e.didChange=!0),e.index=a+2,s.children.length&&oh(s,e)}return e.didChange}const wp=new te,kp={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(t,e){const n=Math.sign(this.scale.x)||1;e!==0?this.scale.x=t/e*n:this.scale.x=n},_setHeight(t,e){const n=Math.sign(this.scale.y)||1;e!==0?this.scale.y=t/e*n:this.scale.y=n},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new St});const t=this._localBoundsCacheData;return t.index=1,t.didChange=!1,t.data[0]!==this._didViewChangeTick&&(t.didChange=!0,t.data[0]=this._didViewChangeTick),oh(this,t),t.didChange&&sh(this,t.localBounds,wp),t.localBounds},getBounds(t,e){return th(this,t,e||new St)}},Sp={_onRender:null,set onRender(t){const e=this.renderGroup||this.parentRenderGroup;if(!t){this._onRender&&(e==null||e.removeOnRender(this)),this._onRender=null;return}this._onRender||e==null||e.addOnRender(this),this._onRender=t},get onRender(){return this._onRender}},Tp={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(t){this._zIndex!==t&&(this._zIndex=t,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(Ap))}};function Ap(t,e){return t._zIndex-e._zIndex}const Cp={getGlobalPosition(t=new Ue,e=!1){return this.parent?this.parent.toGlobal(this._position,t,e):(t.x=this._position.x,t.y=this._position.y),t},toGlobal(t,e,n=!1){const r=this.getGlobalTransform(He.get(),n);return e=r.apply(t,e),He.return(r),e},toLocal(t,e,n,r){e&&(t=e.toGlobal(t,n,r));const s=this.getGlobalTransform(He.get(),r);return n=s.applyInverse(t,n),He.return(s),n}};class ya{constructor(){this.uid=Ie("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(e){this.instructions[this.instructionSize++]=e}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}let Ep=0;class Pp{constructor(e){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1,this.textureStyle=new qu(this.textureOptions)}createTexture(e,n,r,s){const i=new At({...this.textureOptions,width:e,height:n,resolution:1,antialias:r,autoGarbageCollect:!1,autoGenerateMipmaps:s});return new de({source:i,label:`texturePool_${Ep++}`})}getOptimalTexture(e,n,r=1,s,i=!1){let o=Math.ceil(e*r-1e-6),a=Math.ceil(n*r-1e-6);o=Cl(o),a=Cl(a);const l=s?1:0,c=i?1:0,u=(o<<17)+(a<<2)+(c<<1)+l;this._texturePool[u]||(this._texturePool[u]=[]);let h=this._texturePool[u].pop();return h||(h=this.createTexture(o,a,s,i)),h.source._resolution=r,h.source.width=o/r,h.source.height=a/r,h.source.pixelWidth=o,h.source.pixelHeight=a,h.frame.x=0,h.frame.y=0,h.frame.width=e,h.frame.height=n,h.updateUvs(),this._poolKeyHash[h.uid]=u,h}getSameSizeTexture(e,n=!1){const r=e.source;return this.getOptimalTexture(e.width,e.height,r._resolution,n)}returnTexture(e,n=!1){const r=this._poolKeyHash[e.uid];n&&(e.source.style=this.textureStyle),this._texturePool[r].push(e)}clear(e){if(e=e!==!1,e)for(const n in this._texturePool){const r=this._texturePool[n];if(r)for(let s=0;s<r.length;s++)r[s].destroy(!0)}this._texturePool={}}}const ah=new Pp;ga.register(ah);class Ip{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new te,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 ya,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(e){this.root=e,e._onRender&&this.addOnRender(e),e.didChange=!0;const n=e.children;for(let r=0;r<n.length;r++){const s=n[r];s._updateFlags=15,this.addChild(s)}}enableCacheAsTexture(e={}){this.textureOptions=e,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(ah.returnTexture(this.texture,!0),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0;const e=this._parentCacheAsTextureRenderGroup;e&&!e.textureNeedsUpdate&&e.updateCacheTexture()}reset(){this.renderGroupChildren.length=0;for(const e in this.childrenToUpdate){const n=this.childrenToUpdate[e];n.list.fill(null),n.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(e){e.renderGroupParent&&e.renderGroupParent._removeRenderGroupChild(e),e.renderGroupParent=this,this.renderGroupChildren.push(e)}_removeRenderGroupChild(e){const n=this.renderGroupChildren.indexOf(e);n>-1&&this.renderGroupChildren.splice(n,1),e.renderGroupParent=null}addChild(e){if(this.structureDidChange=!0,e.parentRenderGroup=this,e.updateTick=-1,e.parent===this.root?e.relativeRenderGroupDepth=1:e.relativeRenderGroupDepth=e.parent.relativeRenderGroupDepth+1,e.didChange=!0,this.onChildUpdate(e),e.renderGroup){this.addRenderGroupChild(e.renderGroup);return}e._onRender&&this.addOnRender(e);const n=e.children;for(let r=0;r<n.length;r++)this.addChild(n[r])}removeChild(e){if(this.structureDidChange=!0,e._onRender&&(e.renderGroup||this.removeOnRender(e)),e.parentRenderGroup=null,e.renderGroup){this._removeRenderGroupChild(e.renderGroup);return}const n=e.children;for(let r=0;r<n.length;r++)this.removeChild(n[r])}removeChildren(e){for(let n=0;n<e.length;n++)this.removeChild(e[n])}onChildUpdate(e){let n=this.childrenToUpdate[e.relativeRenderGroupDepth];n||(n=this.childrenToUpdate[e.relativeRenderGroupDepth]={index:0,list:[]}),n.list[n.index++]=e}updateRenderable(e){e.globalDisplayStatus<7||(this.instructionSet.renderPipes[e.renderPipeId].updateRenderable(e),e.didViewUpdate=!1)}onChildViewUpdate(e){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=e}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(e){this._onRenderContainers.push(e)}removeOnRender(e){this._onRenderContainers.splice(this._onRenderContainers.indexOf(e),1)}runOnRender(e){for(let n=0;n<this._onRenderContainers.length;n++)this._onRenderContainers[n]._onRender(e)}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(e=[]){const n=this.root.children;for(let r=0;r<n.length;r++)this._getChildren(n[r],e);return e}_getChildren(e,n=[]){if(n.push(e),e.renderGroup)return n;const r=e.children;for(let s=0;s<r.length;s++)this._getChildren(r[s],n);return n}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return(this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new te),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new te),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 e=this._parentCacheAsTextureRenderGroup;return e?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new te),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(e.inverseWorldTransform).translate(-e._textureBounds.x,-e._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this.isCachedAsTexture?this.textureOffsetInverseTransform:this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}}function Mp(t,e,n={}){for(const r in e)!n[r]&&e[r]!==void 0&&(t[r]=e[r])}const Gi=new Be(null),Es=new Be(null),ji=new Be(null,1,1),Ps=new Be(null),Gl=1,Rp=2,Vi=4;class Yt extends fn{constructor(e={}){var n,r;super(),this.uid=Ie("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 te,this.relativeGroupTransform=new te,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new Be(this,0,0),this._scale=ji,this._pivot=Es,this._origin=Ps,this._skew=Gi,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=[],Mp(this,e,{children:!0,parent:!0,effects:!0}),(n=e.children)==null||n.forEach(s=>this.addChild(s)),(r=e.parent)==null||r.addChild(this)}static mixin(e){ge("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),ct.mixin(Yt,e)}set _didChangeId(e){this._didViewChangeTick=e>>12&4095,this._didContainerChangeTick=e&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...e){if(this.allowChildren||ge(Ze,"addChild: Only Containers will be allowed to add children in v8.0.0"),e.length>1){for(let s=0;s<e.length;s++)this.addChild(e[s]);return e[0]}const n=e[0],r=this.renderGroup||this.parentRenderGroup;return n.parent===this?(this.children.splice(this.children.indexOf(n),1),this.children.push(n),r&&(r.structureDidChange=!0),n):(n.parent&&n.parent.removeChild(n),this.children.push(n),this.sortableChildren&&(this.sortDirty=!0),n.parent=this,n.didChange=!0,n._updateFlags=15,r&&r.addChild(n),this.emit("childAdded",n,this,this.children.length-1),n.emit("added",this),this._didViewChangeTick++,n._zIndex!==0&&n.depthOfChildModified(),n)}removeChild(...e){if(e.length>1){for(let s=0;s<e.length;s++)this.removeChild(e[s]);return e[0]}const n=e[0],r=this.children.indexOf(n);return r>-1&&(this._didViewChangeTick++,this.children.splice(r,1),this.renderGroup?this.renderGroup.removeChild(n):this.parentRenderGroup&&this.parentRenderGroup.removeChild(n),n.parentRenderLayer&&n.parentRenderLayer.detach(n),n.parent=null,this.emit("childRemoved",n,this,r),n.emit("removed",this)),n}_onUpdate(e){e&&e===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(e){!!this.renderGroup!==e&&(e?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;const e=this.parentRenderGroup;e==null||e.removeChild(this),this.renderGroup=nt.get(Ip,this),this.groupTransform=te.IDENTITY,e==null||e.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;const e=this.parentRenderGroup;e==null||e.removeChild(this),nt.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,e==null||e.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new te),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(e){this._position.x=e}get y(){return this._position.y}set y(e){this._position.y=e}get position(){return this._position}set position(e){this._position.copyFrom(e)}get rotation(){return this._rotation}set rotation(e){this._rotation!==e&&(this._rotation=e,this._onUpdate(this._skew))}get angle(){return this.rotation*Vf}set angle(e){this.rotation=e*Hf}get pivot(){return this._pivot===Es&&(this._pivot=new Be(this,0,0)),this._pivot}set pivot(e){this._pivot===Es&&(this._pivot=new Be(this,0,0),this._origin!==Ps&<("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),typeof e=="number"?this._pivot.set(e):this._pivot.copyFrom(e)}get skew(){return this._skew===Gi&&(this._skew=new Be(this,0,0)),this._skew}set skew(e){this._skew===Gi&&(this._skew=new Be(this,0,0)),this._skew.copyFrom(e)}get scale(){return this._scale===ji&&(this._scale=new Be(this,1,1)),this._scale}set scale(e){this._scale===ji&&(this._scale=new Be(this,0,0)),typeof e=="string"&&(e=parseFloat(e)),typeof e=="number"?this._scale.set(e):this._scale.copyFrom(e)}get origin(){return this._origin===Ps&&(this._origin=new Be(this,0,0)),this._origin}set origin(e){this._origin===Ps&&(this._origin=new Be(this,0,0),this._pivot!==Es&<("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),typeof e=="number"?this._origin.set(e):this._origin.copyFrom(e)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(e){const n=this.getLocalBounds().width;this._setWidth(e,n)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(e){const n=this.getLocalBounds().height;this._setHeight(e,n)}getSize(e){e||(e={});const n=this.getLocalBounds();return e.width=Math.abs(this.scale.x*n.width),e.height=Math.abs(this.scale.y*n.height),e}setSize(e,n){const r=this.getLocalBounds();typeof e=="object"?(n=e.height??e.width,e=e.width):n??(n=e),e!==void 0&&this._setWidth(e,r.width),n!==void 0&&this._setHeight(n,r.height)}_updateSkew(){const e=this._rotation,n=this._skew;this._cx=Math.cos(e+n._y),this._sx=Math.sin(e+n._y),this._cy=-Math.sin(e-n._x),this._sy=Math.cos(e-n._x)}updateTransform(e){return this.position.set(typeof e.x=="number"?e.x:this.position.x,typeof e.y=="number"?e.y:this.position.y),this.scale.set(typeof e.scaleX=="number"?e.scaleX||1:this.scale.x,typeof e.scaleY=="number"?e.scaleY||1:this.scale.y),this.rotation=typeof e.rotation=="number"?e.rotation:this.rotation,this.skew.set(typeof e.skewX=="number"?e.skewX:this.skew.x,typeof e.skewY=="number"?e.skewY:this.skew.y),this.pivot.set(typeof e.pivotX=="number"?e.pivotX:this.pivot.x,typeof e.pivotY=="number"?e.pivotY:this.pivot.y),this.origin.set(typeof e.originX=="number"?e.originX:this.origin.x,typeof e.originY=="number"?e.originY:this.origin.y),this}setFromMatrix(e){e.decompose(this)}updateLocalTransform(){const e=this._didContainerChangeTick;if(this._didLocalTransformChangeId===e)return;this._didLocalTransformChangeId=e;const n=this.localTransform,r=this._scale,s=this._pivot,i=this._origin,o=this._position,a=r._x,l=r._y,c=s._x,u=s._y,h=-i._x,f=-i._y;n.a=this._cx*a,n.b=this._sx*a,n.c=this._cy*l,n.d=this._sy*l,n.tx=o._x-(c*n.a+u*n.c)+(h*n.a+f*n.c)-h,n.ty=o._y-(c*n.b+u*n.d)+(h*n.b+f*n.d)-f}set alpha(e){e!==this.localAlpha&&(this.localAlpha=e,this._updateFlags|=Gl,this._onUpdate())}get alpha(){return this.localAlpha}set tint(e){const r=Vt.shared.setValue(e??16777215).toBgrNumber();r!==this.localColor&&(this.localColor=r,this._updateFlags|=Gl,this._onUpdate())}get tint(){return Vs(this.localColor)}set blendMode(e){this.localBlendMode!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Rp,this.localBlendMode=e,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(e){const n=e?2:0;(this.localDisplayStatus&2)!==n&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Vi,this.localDisplayStatus^=2,this._onUpdate(),this.emit("visibleChanged",e))}get culled(){return!(this.localDisplayStatus&4)}set culled(e){const n=e?0:4;(this.localDisplayStatus&4)!==n&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Vi,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(e){const n=e?1:0;(this.localDisplayStatus&1)!==n&&(this._updateFlags|=Vi,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(e=!1){var s;if(this.destroyed)return;this.destroyed=!0;let n;if(this.children.length&&(n=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 e=="boolean"?e:e==null?void 0:e.children)&&n)for(let i=0;i<n.length;++i)n[i].destroy(e);(s=this.renderGroup)==null||s.destroy(),this.renderGroup=null}}ct.mixin(Yt,pp,bp,Cp,Sp,kp,_p,yp,Tp,cp,dp,vp,mp);class lh extends Yt{constructor(e){super(e),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 St(0,1,0,0),this._boundsDirty=!0,this.autoGarbageCollect=e.autoGarbageCollect??!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,this._bounds):this._bounds}get roundPixels(){return!!this._roundPixels}set roundPixels(e){this._roundPixels=e?1:0}containsPoint(e){const n=this.bounds,{x:r,y:s}=e;return r>=n.minX&&r<=n.maxX&&s>=n.minY&&s<=n.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const e=this.renderGroup||this.parentRenderGroup;e&&e.onChildViewUpdate(this)}unload(){var e;this.emit("unload",this);for(const n in this._gpuData)(e=this._gpuData[n])==null||e.destroy();this._gpuData=Object.create(null),this.onViewUpdate()}destroy(e){this.unload(),super.destroy(e),this._bounds=null}collectRenderablesSimple(e,n,r){const{renderPipes:s}=n;s.blendMode.pushBlendMode(this,this.groupBlendMode,e);const o=s[this.renderPipeId];o!=null&&o.addRenderable&&o.addRenderable(this,e),this.didViewUpdate=!1;const a=this.children,l=a.length;for(let c=0;c<l;c++)a[c].collectRenderables(e,n,r);s.blendMode.popBlendMode(e)}}class jr extends lh{constructor(e=de.EMPTY){e instanceof de&&(e={texture:e});const{texture:n=de.EMPTY,anchor:r,roundPixels:s,width:i,height:o,...a}=e;super({label:"Sprite",...a}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new Be({_onUpdate:()=>{this.onViewUpdate()}}),r?this.anchor=r:n.defaultAnchor&&(this.anchor=n.defaultAnchor),this.texture=n,this.allowChildren=!1,this.roundPixels=s??!1,i!==void 0&&(this.width=i),o!==void 0&&(this.height=o)}static from(e,n=!1){return e instanceof de?new jr(e):new jr(de.from(e,n))}set texture(e){e||(e=de.EMPTY);const n=this._texture;n!==e&&(n&&n.dynamic&&n.off("update",this.onViewUpdate,this),e.dynamic&&e.on("update",this.onViewUpdate,this),this._texture=e,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 Qf(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return ge("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){const e=this._anchor,n=this._texture,r=this._bounds,{width:s,height:i}=n.orig;r.minX=-e._x*s,r.maxX=r.minX+s,r.minY=-e._y*i,r.maxY=r.minY+i}destroy(e=!1){if(super.destroy(e),typeof e=="boolean"?e:e==null?void 0:e.texture){const r=typeof e=="boolean"?e:e==null?void 0:e.textureSource;this._texture.destroy(r)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(e){typeof e=="number"?this._anchor.set(e):this._anchor.copyFrom(e)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(e){this._setWidth(e,this._texture.orig.width),this._width=e}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(e){this._setHeight(e,this._texture.orig.height),this._height=e}getSize(e){return e||(e={}),e.width=Math.abs(this.scale.x)*this._texture.orig.width,e.height=Math.abs(this.scale.y)*this._texture.orig.height,e}setSize(e,n){typeof e=="object"?(n=e.height??e.width,e=e.width):n??(n=e),e!==void 0&&this._setWidth(e,this._texture.orig.width),n!==void 0&&this._setHeight(n,this._texture.orig.height)}}const zp=new St;function ch(t,e,n){const r=zp;t.measurable=!0,th(t,n,r),e.addBoundsMask(r),t.measurable=!1}function uh(t,e,n){const r=Gt.get();t.measurable=!0;const s=He.get().identity(),i=hh(t,n,s);sh(t,r,i),t.measurable=!1,e.addBoundsMask(r),He.return(s),Gt.return(r)}function hh(t,e,n){return t?(t!==e&&(hh(t.parent,e,n),t.updateLocalTransform(),n.append(t.localTransform)),n):(lt("Mask bounds, renderable is not inside the root container"),n)}class dh{constructor(e){this.priority=0,this.inverse=!1,this.pipe="alphaMask",e!=null&&e.mask&&this.init(e.mask)}init(e){this.mask=e,this.renderMaskToTexture=!(e instanceof jr),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(e,n){this.inverse||ch(this.mask,e,n)}addLocalBounds(e,n){uh(this.mask,e,n)}containsPoint(e,n){const r=this.mask;return n(r,e)}destroy(){this.reset()}static test(e){return e instanceof jr}}dh.extension=fe.MaskEffect;class fh{constructor(e){this.priority=0,this.pipe="colorMask",e!=null&&e.mask&&this.init(e.mask)}init(e){this.mask=e}destroy(){}static test(e){return typeof e=="number"}}fh.extension=fe.MaskEffect;class ph{constructor(e){this.priority=0,this.pipe="stencilMask",e!=null&&e.mask&&this.init(e.mask)}init(e){this.mask=e,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask!==null&&(this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null)}addBounds(e,n){ch(this.mask,e,n)}addLocalBounds(e,n){uh(this.mask,e,n)}containsPoint(e,n){const r=this.mask;return n(r,e)}destroy(){this.reset()}static test(e){return e instanceof Yt}}ph.extension=fe.MaskEffect;const Op={createCanvas:(t,e)=>{const n=document.createElement("canvas");return n.width=t,n.height=e,n},createImage:()=>new Image,getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(t,e)=>fetch(t,e),parseXML:t=>new DOMParser().parseFromString(t,"text/xml")};let jl=Op;const ms={get(){return jl},set(t){jl=t}};class mh extends At{constructor(e){e.resource||(e.resource=ms.get().createCanvas()),e.width||(e.width=e.resource.width,e.autoDensity||(e.width/=e.resolution)),e.height||(e.height=e.resource.height,e.autoDensity||(e.height/=e.resolution)),super(e),this.uploadMethodId="image",this.autoDensity=e.autoDensity,this.resizeCanvas(),this.transparent=!!e.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(e=this.width,n=this.height,r=this._resolution){const s=super.resize(e,n,r);return s&&this.resizeCanvas(),s}static test(e){return globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&e instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}}mh.extension=fe.TextureSource;class Xs extends At{constructor(e){super(e),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(e){return globalThis.HTMLImageElement&&e instanceof HTMLImageElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||globalThis.VideoFrame&&e instanceof VideoFrame}}Xs.extension=fe.TextureSource;var Oo=(t=>(t[t.INTERACTION=50]="INTERACTION",t[t.HIGH=25]="HIGH",t[t.NORMAL=0]="NORMAL",t[t.LOW=-25]="LOW",t[t.UTILITY=-50]="UTILITY",t))(Oo||{});class Hi{constructor(e,n=null,r=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=e,this._context=n,this.priority=r,this._once=s}match(e,n=null){return this._fn===e&&this._context===n}emit(e){this._fn&&(this._context?this._fn.call(this._context,e):this._fn(e));const n=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),n}connect(e){this.previous=e,e.next&&(e.next.previous=this),this.next=e.next,e.next=this}destroy(e=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const n=this.next;return this.next=e?null:n,this.previous=null,n}}const gh=class it{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 Hi(null,null,1/0),this.deltaMS=1/it.targetFPMS,this.elapsedMS=1/it.targetFPMS,this._tick=e=>{this._requestId=null,this.started&&(this.update(e),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(e,n,r=Oo.NORMAL){return this._addListener(new Hi(e,n,r))}addOnce(e,n,r=Oo.NORMAL){return this._addListener(new Hi(e,n,r,!0))}_addListener(e){let n=this._head.next,r=this._head;if(!n)e.connect(r);else{for(;n;){if(e.priority>n.priority){e.connect(r);break}r=n,n=n.next}e.previous||e.connect(r)}return this._startIfPossible(),this}remove(e,n){let r=this._head.next;for(;r;)r.match(e,n)?r=r.destroy():r=r.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let e=0,n=this._head;for(;n=n.next;)e++;return e}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let e=this._head.next;for(;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}}update(e=performance.now()){let n;if(e>this.lastTime){if(n=this.elapsedMS=e-this.lastTime,n>this._maxElapsedMS&&(n=this._maxElapsedMS),n*=this.speed,this._minElapsedMS){const i=e-this._lastFrame|0;if(i<this._minElapsedMS)return;this._lastFrame=e-i%this._minElapsedMS}this.deltaMS=n,this.deltaTime=this.deltaMS*it.targetFPMS;const r=this._head;let s=r.next;for(;s;)s=s.emit(this);r.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=e}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(e){const n=Math.min(Math.max(0,e)/1e3,it.targetFPMS);this._maxElapsedMS=1/n,this._minElapsedMS&&e>this.maxFPS&&(this.maxFPS=e)}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(e){e===0?this._minElapsedMS=0:(e<this.minFPS&&(this.minFPS=e),this._minElapsedMS=1/(e/1e3))}static get shared(){if(!it._shared){const e=it._shared=new it;e.autoStart=!0,e._protected=!0}return it._shared}static get system(){if(!it._system){const e=it._system=new it;e.autoStart=!0,e._protected=!0}return it._system}};gh.targetFPMS=.06;let Is=gh,Wi;async function $p(){return Wi??(Wi=(async()=>{var o;const e=ms.get().createCanvas(1,1).getContext("webgl");if(!e)return"premultiply-alpha-on-upload";const n=await new Promise(a=>{const l=document.createElement("video");l.onloadeddata=()=>a(l),l.onerror=()=>a(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(!n)return"premultiply-alpha-on-upload";const r=e.createTexture();e.bindTexture(e.TEXTURE_2D,r);const s=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,s),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,r,0),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n);const i=new Uint8Array(4);return e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,i),e.deleteFramebuffer(s),e.deleteTexture(r),(o=e.getExtension("WEBGL_lose_context"))==null||o.loseContext(),i[0]<=i[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Wi}const fi=class _h extends At{constructor(e){super(e),this.isReady=!1,this.uploadMethodId="video",e={..._h.defaultOptions,...e},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,this.alphaMode=e.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),e.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){const e=Is.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!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 e=this.resource,n=this.options;return(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),e.addEventListener("play",this._onPlayStart),e.addEventListener("pause",this._onPlayStop),e.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(n.preload||e.addEventListener("canplay",this._onCanPlay),e.addEventListener("canplaythrough",this._onCanPlayThrough),e.addEventListener("error",this._onError,!0)),this.alphaMode=await $p(),this._load=new Promise((r,s)=>{this.isValid?r(this):(this._resolve=r,this._reject=s,n.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${n.preloadTimeoutMs}ms`))})),e.load())}),this._load}_onError(e){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",e),this._reject&&(this._reject(e),this._reject=null,this._resolve=null)}_isSourcePlaying(){const e=this.resource;return!e.paused&&!e.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 e=this.resource;this.isValid&&(this.isReady=!0,this.resize(e.videoWidth,e.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 e=this.resource;e&&(e.removeEventListener("play",this._onPlayStart),e.removeEventListener("pause",this._onPlayStop),e.removeEventListener("seeked",this._onSeeked),e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlayThrough),e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(e){e!==this._updateFPS&&(this._updateFPS=e,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(Is.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||(Is.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Is.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement}};fi.extension=fe.TextureSource;fi.defaultOptions={...At.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};fi.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let Dp=fi;const Un=(t,e,n=!1)=>(Array.isArray(t)||(t=[t]),e?t.map(r=>typeof r=="string"||n?e(r):r):t);class Np{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(e){return this._cache.has(e)}get(e){const n=this._cache.get(e);return n||lt(`[Assets] Asset id ${e} was not found in the Cache`),n}set(e,n){const r=Un(e);let s;for(let l=0;l<this.parsers.length;l++){const c=this.parsers[l];if(c.test(n)){s=c.getCacheableAssets(r,n);break}}const i=new Map(Object.entries(s||{}));s||r.forEach(l=>{i.set(l,n)});const o=[...i.keys()],a={cacheKeys:o,keys:r};r.forEach(l=>{this._cacheMap.set(l,a)}),o.forEach(l=>{const c=s?s[l]:n;this._cache.has(l)&&this._cache.get(l)!==c&<("[Cache] already has key:",l),this._cache.set(l,i.get(l))})}remove(e){if(!this._cacheMap.has(e)){lt(`[Assets] Asset id ${e} was not found in the Cache`);return}const n=this._cacheMap.get(e);n.cacheKeys.forEach(s=>{this._cache.delete(s)}),n.keys.forEach(s=>{this._cacheMap.delete(s)})}get parsers(){return this._parsers}}const Gn=new Np,$o=[];ct.handleByList(fe.TextureSource,$o);function yh(t={}){const e=t&&t.resource,n=e?t.resource:t,r=e?t:{resource:t};for(let s=0;s<$o.length;s++){const i=$o[s];if(i.test(n))return new i(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function Fp(t={},e=!1){const n=t&&t.resource,r=n?t.resource:t,s=n?t:{resource:t};if(!e&&Gn.has(r))return Gn.get(r);const i=new de({source:yh(s)});return i.on("destroy",()=>{Gn.has(r)&&Gn.remove(r)}),e||Gn.set(r,i),i}function Lp(t,e=!1){return typeof t=="string"?Gn.get(t):t instanceof At?new de({source:t}):Fp(t,e)}de.from=Lp;At.from=yh;ct.add(dh,fh,ph,Dp,Xs,mh,ma);var xh=(t=>(t[t.Low=0]="Low",t[t.Normal=1]="Normal",t[t.High=2]="High",t))(xh||{});function bt(t){if(typeof t!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(t)}`)}function yr(t){return t.split("?")[0].split("#")[0]}function Bp(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Zp(t,e,n){return t.replace(new RegExp(Bp(e),"g"),n)}function Up(t,e){let n="",r=0,s=-1,i=0,o=-1;for(let a=0;a<=t.length;++a){if(a<t.length)o=t.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(s===a-1||i===1))if(s!==a-1&&i===2){if(n.length<2||r!==2||n.charCodeAt(n.length-1)!==46||n.charCodeAt(n.length-2)!==46){if(n.length>2){const l=n.lastIndexOf("/");if(l!==n.length-1){l===-1?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),s=a,i=0;continue}}else if(n.length===2||n.length===1){n="",r=0,s=a,i=0;continue}}}else n.length>0?n+=`/${t.slice(s+1,a)}`:n=t.slice(s+1,a),r=a-s-1;s=a,i=0}else o===46&&i!==-1?++i:i=-1}return n}const Vr={toPosix(t){return Zp(t,"\\","/")},isUrl(t){return/^https?:/.test(this.toPosix(t))},isDataUrl(t){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(t)},isBlobUrl(t){return t.startsWith("blob:")},hasProtocol(t){return/^[^/:]+:/.test(this.toPosix(t))},getProtocol(t){bt(t),t=this.toPosix(t);const e=/^file:\/\/\//.exec(t);if(e)return e[0];const n=/^[^/:]+:\/{0,2}/.exec(t);return n?n[0]:""},toAbsolute(t,e,n){if(bt(t),this.isDataUrl(t)||this.isBlobUrl(t))return t;const r=yr(this.toPosix(e??ms.get().getBaseUrl())),s=yr(this.toPosix(n??this.rootname(r)));return t=this.toPosix(t),t.startsWith("/")?Vr.join(s,t.slice(1)):this.isAbsolute(t)?t:this.join(r,t)},normalize(t){if(bt(t),t.length===0)return".";if(this.isDataUrl(t)||this.isBlobUrl(t))return t;t=this.toPosix(t);let e="";const n=t.startsWith("/");this.hasProtocol(t)&&(e=this.rootname(t),t=t.slice(e.length));const r=t.endsWith("/");return t=Up(t),t.length>0&&r&&(t+="/"),n?`/${t}`:e+t},isAbsolute(t){return bt(t),t=this.toPosix(t),this.hasProtocol(t)?!0:t.startsWith("/")},join(...t){if(t.length===0)return".";let e;for(let n=0;n<t.length;++n){const r=t[n];if(bt(r),r.length>0)if(e===void 0)e=r;else{const s=t[n-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?e+=`/../${r}`:e+=`/${r}`}}return e===void 0?".":this.normalize(e)},dirname(t){if(bt(t),t.length===0)return".";t=this.toPosix(t);let e=t.charCodeAt(0);const n=e===47;let r=-1,s=!0;const i=this.getProtocol(t),o=t;t=t.slice(i.length);for(let a=t.length-1;a>=1;--a)if(e=t.charCodeAt(a),e===47){if(!s){r=a;break}}else s=!1;return r===-1?n?"/":this.isUrl(o)?i+t:i:n&&r===1?"//":i+t.slice(0,r)},rootname(t){bt(t),t=this.toPosix(t);let e="";if(t.startsWith("/")?e="/":e=this.getProtocol(t),this.isUrl(t)){const n=t.indexOf("/",e.length);n!==-1?e=t.slice(0,n):e=t,e.endsWith("/")||(e+="/")}return e},basename(t,e){bt(t),e&&bt(e),t=yr(this.toPosix(t));let n=0,r=-1,s=!0,i;if(e!==void 0&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";let o=e.length-1,a=-1;for(i=t.length-1;i>=0;--i){const l=t.charCodeAt(i);if(l===47){if(!s){n=i+1;break}}else a===-1&&(s=!1,a=i+1),o>=0&&(l===e.charCodeAt(o)?--o===-1&&(r=i):(o=-1,r=a))}return n===r?r=a:r===-1&&(r=t.length),t.slice(n,r)}for(i=t.length-1;i>=0;--i)if(t.charCodeAt(i)===47){if(!s){n=i+1;break}}else r===-1&&(s=!1,r=i+1);return r===-1?"":t.slice(n,r)},extname(t){bt(t),t=yr(this.toPosix(t));let e=-1,n=0,r=-1,s=!0,i=0;for(let o=t.length-1;o>=0;--o){const a=t.charCodeAt(o);if(a===47){if(!s){n=o+1;break}continue}r===-1&&(s=!1,r=o+1),a===46?e===-1?e=o:i!==1&&(i=1):e!==-1&&(i=-1)}return e===-1||r===-1||i===0||i===1&&e===r-1&&e===n+1?"":t.slice(e,r)},parse(t){bt(t);const e={root:"",dir:"",base:"",ext:"",name:""};if(t.length===0)return e;t=yr(this.toPosix(t));let n=t.charCodeAt(0);const r=this.isAbsolute(t);let s;e.root=this.rootname(t),r||this.hasProtocol(t)?s=1:s=0;let i=-1,o=0,a=-1,l=!0,c=t.length-1,u=0;for(;c>=s;--c){if(n=t.charCodeAt(c),n===47){if(!l){o=c+1;break}continue}a===-1&&(l=!1,a=c+1),n===46?i===-1?i=c:u!==1&&(u=1):i!==-1&&(u=-1)}return i===-1||a===-1||u===0||u===1&&i===a-1&&i===o+1?a!==-1&&(o===0&&r?e.base=e.name=t.slice(1,a):e.base=e.name=t.slice(o,a)):(o===0&&r?(e.name=t.slice(1,i),e.base=t.slice(1,a)):(e.name=t.slice(o,i),e.base=t.slice(o,a)),e.ext=t.slice(i,a)),e.dir=this.dirname(t),e},sep:"/",delimiter:":",joinExtensions:[".html"]};function bh(t,e,n,r,s){const i=e[n];for(let o=0;o<i.length;o++){const a=i[o];n<e.length-1?bh(t.replace(r[n],a),e,n+1,r,s):s.push(t.replace(r[n],a))}}function Gp(t){const e=/\{(.*?)\}/g,n=t.match(e),r=[];if(n){const s=[];n.forEach(i=>{const o=i.substring(1,i.length-1).split(",");s.push(o)}),bh(t,s,0,n,r)}else r.push(t);return r}const Vl=t=>!Array.isArray(t);class vh{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(e,n)=>`${e}${this._bundleIdConnector}${n}`,extractAssetIdFromBundle:(e,n)=>n.replace(`${e}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(e){if(this._bundleIdConnector=e.connector??this._bundleIdConnector,this._createBundleAssetId=e.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=e.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...e){e.forEach(n=>{this._preferredOrder.push(n),n.priority||(n.priority=Object.keys(n.params))}),this._resolverHash={}}set basePath(e){this._basePath=e}get basePath(){return this._basePath}set rootPath(e){this._rootPath=e}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(e){if(typeof e=="string")this._defaultSearchParams=e;else{const n=e;this._defaultSearchParams=Object.keys(n).map(r=>`${encodeURIComponent(r)}=${encodeURIComponent(n[r])}`).join("&")}}getAlias(e){const{alias:n,src:r}=e;return Un(n||r,i=>typeof i=="string"?i:Array.isArray(i)?i.map(o=>(o==null?void 0:o.src)??o):i!=null&&i.src?i.src:i,!0)}removeAlias(e,n){this._assetMap[e]&&(n&&n!==this._resolverHash[e]||(delete this._resolverHash[e],delete this._assetMap[e]))}addManifest(e){this._manifest&<("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=e,e.bundles.forEach(n=>{this.addBundle(n.name,n.assets)})}addBundle(e,n){const r=[];let s=n;Array.isArray(n)||(s=Object.entries(n).map(([i,o])=>typeof o=="string"||Array.isArray(o)?{alias:i,src:o}:{alias:i,...o})),s.forEach(i=>{const o=i.src,a=i.alias;let l;if(typeof a=="string"){const c=this._createBundleAssetId(e,a);r.push(c),l=[a,c]}else{const c=a.map(u=>this._createBundleAssetId(e,u));r.push(...c),l=[...a,...c]}this.add({...i,alias:l,src:o})}),this._bundles[e]=r}add(e){const n=[];Array.isArray(e)?n.push(...e):n.push(e);let r;r=i=>{this.hasKey(i)&<(`[Resolver] already has key: ${i} overwriting`)},Un(n).forEach(i=>{const{src:o}=i;let{data:a,format:l,loadParser:c,parser:u}=i;const h=Un(o).map(_=>typeof _=="string"?Gp(_):Array.isArray(_)?_:[_]),f=this.getAlias(i);Array.isArray(f)?f.forEach(r):r(f);const d=[],m=_=>{const g=this._parsers.find(y=>y.test(_));return{src:_,...g==null?void 0:g.parse(_)}};h.forEach(_=>{_.forEach(g=>{let y={};if(typeof g!="object"?y=m(g):(a=g.data??a,l=g.format??l,(g.loadParser||g.parser)&&(c=g.loadParser??c,u=g.parser??u),y={...m(g.src),...g}),!f)throw new Error(`[Resolver] alias is undefined for this asset: ${y.src}`);y=this._buildResolvedAsset(y,{aliases:f,data:a,format:l,loadParser:c,parser:u,progressSize:i.progressSize}),d.push(y)})}),f.forEach(_=>{this._assetMap[_]=d})})}resolveBundle(e){const n=Vl(e);e=Un(e);const r={};return e.forEach(s=>{const i=this._bundles[s];if(i){const o=this.resolve(i),a={};for(const l in o){const c=o[l];a[this._extractAssetIdFromBundle(s,l)]=c}r[s]=a}}),n?r[e[0]]:r}resolveUrl(e){const n=this.resolve(e);if(typeof e!="string"){const r={};for(const s in n)r[s]=n[s].src;return r}return n.src}resolve(e){const n=Vl(e);e=Un(e);const r={};return e.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let i=this._assetMap[s];const o=this._getPreferredOrder(i);o==null||o.priority.forEach(a=>{o.params[a].forEach(l=>{const c=i.filter(u=>u[a]?u[a]===l:!1);c.length&&(i=c)})}),this._resolverHash[s]=i[0]}else this._resolverHash[s]=this._buildResolvedAsset({alias:[s],src:s},{});r[s]=this._resolverHash[s]}),n?r[e[0]]:r}hasKey(e){return!!this._assetMap[e]}hasBundle(e){return!!this._bundles[e]}_getPreferredOrder(e){for(let n=0;n<e.length;n++){const r=e[n],s=this._preferredOrder.find(i=>i.params.format.includes(r.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(e){if(!this._defaultSearchParams)return e;const n=/\?/.test(e)?"&":"?";return`${e}${n}${this._defaultSearchParams}`}_buildResolvedAsset(e,n){const{aliases:r,data:s,loadParser:i,parser:o,format:a,progressSize:l}=n;return(this._basePath||this._rootPath)&&(e.src=Vr.toAbsolute(e.src,this._basePath,this._rootPath)),e.alias=r??e.alias??[e.src],e.src=this._appendDefaultSearchParams(e.src),e.data={...s||{},...e.data},e.loadParser=i??e.loadParser,e.parser=o??e.parser,e.format=a??e.format??jp(e.src),l!==void 0&&(e.progressSize=l),e}}vh.RETINA_PREFIX=/@([0-9\.]+)x/;function jp(t){return t.split(".").pop().split("?").shift().split("#").shift()}const Hl=(t,e)=>{const n=e.split("?")[1];return n&&(t+=`?${n}`),t},wh=class zr{constructor(e,n){this.linkedSheets=[];let r=e;(e==null?void 0:e.source)instanceof At&&(r={texture:e,data:n});const{texture:s,data:i,cachePrefix:o=""}=r;this.cachePrefix=o,this._texture=s instanceof de?s:null,this.textureSource=s.source,this.textures={},this.animations={},this.data=i;const a=parseFloat(i.meta.scale);a?(this.resolution=a,s.source.resolution=this.resolution):this.resolution=s.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(e=>{this._callback=e,this._batchIndex=0,this._frameKeys.length<=zr.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}parseSync(){return this._processFrames(0,!0),this._processAnimations(),this.textures}_processFrames(e,n=!1){let r=e;const s=n?1/0:zr.BATCH_SIZE;for(;r-e<s&&r<this._frameKeys.length;){const i=this._frameKeys[r],o=this._frames[i],a=o.frame;if(a){let l=null,c=null;const u=o.trimmed!==!1&&o.sourceSize?o.sourceSize:o.frame,h=new Oe(0,0,Math.floor(u.w)/this.resolution,Math.floor(u.h)/this.resolution);o.rotated?l=new Oe(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.h)/this.resolution,Math.floor(a.w)/this.resolution):l=new Oe(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution),o.trimmed!==!1&&o.spriteSourceSize&&(c=new Oe(Math.floor(o.spriteSourceSize.x)/this.resolution,Math.floor(o.spriteSourceSize.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution)),this.textures[i]=new de({source:this.textureSource,frame:l,orig:h,trim:c,rotate:o.rotated?2:0,defaultAnchor:o.anchor,defaultBorders:o.borders,label:i.toString()})}r++}}_processAnimations(){const e=this.data.animations||{};for(const n in e){this.animations[n]=[];for(let r=0;r<e[n].length;r++){const s=e[n][r];this.animations[n].push(this.textures[s])}}}_parseComplete(){const e=this._callback;this._callback=null,this._batchIndex=0,e.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*zr.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*zr.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(e=!1){var n;for(const r in this.textures)this.textures[r].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,e&&((n=this._texture)==null||n.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};wh.BATCH_SIZE=1e3;let Wl=wh;const Vp=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];function kh(t,e,n){const r={};if(t.forEach(s=>{r[s]=e}),Object.keys(e.textures).forEach(s=>{r[`${e.cachePrefix}${s}`]=e.textures[s]}),!n){const s=Vr.dirname(t[0]);e.linkedSheets.forEach((i,o)=>{const a=kh([`${s}/${e.data.meta.related_multi_packs[o]}`],i,!0);Object.assign(r,a)})}return r}const Hp={extension:fe.Asset,cache:{test:t=>t instanceof Wl,getCacheableAssets:(t,e)=>kh(t,e,!1)},resolver:{extension:{type:fe.ResolveParser,name:"resolveSpritesheet"},test:t=>{const n=t.split("?")[0].split("."),r=n.pop(),s=n.pop();return r==="json"&&Vp.includes(s)},parse:t=>{var n;const e=t.split(".");return{resolution:parseFloat(((n=vh.RETINA_PREFIX.exec(t))==null?void 0:n[1])??"1"),format:e[e.length-2],src:t}}},loader:{name:"spritesheetLoader",id:"spritesheet",extension:{type:fe.LoadParser,priority:xh.Normal,name:"spritesheetLoader"},async testParse(t,e){return Vr.extname(e.src).toLowerCase()===".json"&&!!t.frames},async parse(t,e,n){var h,f;const{texture:r,imageFilename:s,textureOptions:i,cachePrefix:o}=(e==null?void 0:e.data)??{};let a=Vr.dirname(e.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let l;if(r instanceof de)l=r;else{const d=Hl(a+(s??t.meta.image),e.src);l=(await n.load([{src:d,data:i}]))[d]}const c=new Wl({texture:l.source,data:t,cachePrefix:o});await c.parse();const u=(h=t==null?void 0:t.meta)==null?void 0:h.related_multi_packs;if(Array.isArray(u)){const d=[];for(const _ of u){if(typeof _!="string")continue;let g=a+_;(f=e.data)!=null&&f.ignoreMultiPack||(g=Hl(g,e.src),d.push(n.load({src:g,data:{textureOptions:i,ignoreMultiPack:!0}})))}const m=await Promise.all(d);c.linkedSheets=m,m.forEach(_=>{_.linkedSheets=[c].concat(c.linkedSheets.filter(g=>g!==_))})}return c},async unload(t,e,n){await n.unload(t.textureSource._sourceOrigin),t.destroy(!1)}}};ct.add(Hp);const Yi=Object.create(null),Yl=Object.create(null);function xa(t,e){let n=Yl[t];return n===void 0&&(Yi[e]===void 0&&(Yi[e]=1),Yl[t]=n=Yi[e]++),n}let Bn;function Sh(){return(!Bn||Bn!=null&&Bn.isContextLost())&&(Bn=ms.get().createCanvas().getContext("webgl",{})),Bn}let Ms;function Wp(){if(!Ms){Ms="mediump";const t=Sh();t&&t.getShaderPrecisionFormat&&(Ms=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision?"highp":"mediump")}return Ms}function Yp(t,e,n){return e?t:n?(t=t.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
|
+
${t}
|
|
13
|
+
`):`
|
|
14
|
+
|
|
15
|
+
#ifdef GL_ES // This checks if it is WebGL1
|
|
16
|
+
#define in attribute
|
|
17
|
+
#define out varying
|
|
18
|
+
#endif
|
|
19
|
+
${t}
|
|
20
|
+
`}function qp(t,e,n){const r=n?e.maxSupportedFragmentPrecision:e.maxSupportedVertexPrecision;if(t.substring(0,9)!=="precision"){let s=n?e.requestedFragmentPrecision:e.requestedVertexPrecision;return s==="highp"&&r!=="highp"&&(s="mediump"),`precision ${s} float;
|
|
21
|
+
${t}`}else if(r!=="highp"&&t.substring(0,15)==="precision highp")return t.replace("precision highp","precision mediump");return t}function Xp(t,e){return e?`#version 300 es
|
|
22
|
+
${t}`:t}const Jp={},Kp={};function Qp(t,{name:e="pixi-program"},n=!0){e=e.replace(/\s+/g,"-"),e+=n?"-fragment":"-vertex";const r=n?Jp:Kp;return r[e]?(r[e]++,e+=`-${r[e]}`):r[e]=1,t.indexOf("#define SHADER_NAME")!==-1?t:`${`#define SHADER_NAME ${e}`}
|
|
23
|
+
${t}`}function em(t,e){return e?t.replace("#version 300 es",""):t}const qi={stripVersion:em,ensurePrecision:qp,addProgramDefines:Yp,setProgramName:Qp,insertVersion:Xp},xr=Object.create(null),Th=class Do{constructor(e){e={...Do.defaultOptions,...e};const n=e.fragment.indexOf("#version 300 es")!==-1,r={stripVersion:n,ensurePrecision:{requestedFragmentPrecision:e.preferredFragmentPrecision,requestedVertexPrecision:e.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:Wp()},setProgramName:{name:e.name},addProgramDefines:n,insertVersion:n};let s=e.fragment,i=e.vertex;Object.keys(qi).forEach(o=>{const a=r[o];s=qi[o](s,a,!0),i=qi[o](i,a,!1)}),this.fragment=s,this.vertex=i,this.transformFeedbackVaryings=e.transformFeedbackVaryings,this._key=xa(`${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,xr[this._cacheKey]=null}static from(e){const n=`${e.vertex}:${e.fragment}`;return xr[n]||(xr[n]=new Do(e),xr[n]._cacheKey=n),xr[n]}};Th.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let Ah=Th;const ql={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 tm(t){return ql[t]??ql.float32}const nm={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"},Xl=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|\)|$)/g;function Jl(t,e){let n;for(;(n=Xl.exec(t))!==null;){const r=nm[n[3]]??"float32";e[n[2]]={location:parseInt(n[1],10),format:r,stride:tm(r).stride,offset:0,instance:!1,start:0}}Xl.lastIndex=0}function rm(t){return t.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"")}function sm({source:t,entryPoint:e}){const n={},r=rm(t),s=r.indexOf(`fn ${e}(`);if(s===-1)return n;const i=r.indexOf("->",s);if(i===-1)return n;const o=r.substring(s,i);if(Jl(o,n),Object.keys(n).length===0){const a=o.match(/\(\s*\w+\s*:\s*(\w+)/);if(a){const l=a[1],c=new RegExp(`struct\\s+${l}\\s*\\{([^}]+)\\}`,"s"),u=r.match(c);u&&Jl(u[1],n)}}return n}function Xi(t){var h,f;const e=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,n=/@group\((\d+)\)/,r=/@binding\((\d+)\)/,s=/var(<[^>]+>)? (\w+)/,i=/:\s*([\w<>]+)/,o=/struct\s+(\w+)\s*{([^}]+)}/g,a=/(\w+)\s*:\s*([\w\<\>]+)/g,l=/struct\s+(\w+)/,c=(h=t.match(e))==null?void 0:h.map(d=>({group:parseInt(d.match(n)[1],10),binding:parseInt(d.match(r)[1],10),name:d.match(s)[2],isUniform:d.match(s)[1]==="<uniform>",type:d.match(i)[1]}));if(!c)return{groups:[],structs:[]};const u=((f=t.match(o))==null?void 0:f.map(d=>{const m=d.match(l)[1],_=d.match(a).reduce((g,y)=>{const[b,w]=y.split(":");return g[b.trim()]=w.trim(),g},{});return _?{name:m,members:_}:null}).filter(({name:d})=>c.some(m=>m.type===d||m.type.includes(`<${d}>`))))??[];return{groups:c,structs:u}}var Sn=(t=>(t[t.VERTEX=1]="VERTEX",t[t.FRAGMENT=2]="FRAGMENT",t[t.COMPUTE=4]="COMPUTE",t))(Sn||{});function im({groups:t}){const e=[];for(let n=0;n<t.length;n++){const r=t[n];e[r.group]||(e[r.group]=[]),r.isUniform?e[r.group].push({binding:r.binding,visibility:Sn.VERTEX|Sn.FRAGMENT,buffer:{type:"uniform"}}):r.type==="sampler"?e[r.group].push({binding:r.binding,visibility:Sn.FRAGMENT,sampler:{type:"filtering"}}):r.type==="texture_2d"||r.type.startsWith("texture_2d<")?e[r.group].push({binding:r.binding,visibility:Sn.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}}):r.type==="texture_2d_array"||r.type.startsWith("texture_2d_array<")?e[r.group].push({binding:r.binding,visibility:Sn.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d-array",multisampled:!1}}):(r.type==="texture_cube"||r.type.startsWith("texture_cube<"))&&e[r.group].push({binding:r.binding,visibility:Sn.FRAGMENT,texture:{sampleType:"float",viewDimension:"cube",multisampled:!1}})}for(let n=0;n<e.length;n++)e[n]||(e[n]=[]);return e}function om({groups:t}){const e=[];for(let n=0;n<t.length;n++){const r=t[n];e[r.group]||(e[r.group]={}),e[r.group][r.name]=r.binding}return e}function am(t,e){const n=new Set,r=new Set,s=[...t.structs,...e.structs].filter(o=>n.has(o.name)?!1:(n.add(o.name),!0)),i=[...t.groups,...e.groups].filter(o=>{const a=`${o.name}-${o.binding}`;return r.has(a)?!1:(r.add(a),!0)});return{structs:s,groups:i}}const br=Object.create(null);class pi{constructor(e){var a,l;this._layoutKey=0,this._attributeLocationsKey=0;const{fragment:n,vertex:r,layout:s,gpuLayout:i,name:o}=e;if(this.name=o,this.fragment=n,this.vertex=r,n.source===r.source){const c=Xi(n.source);this.structsAndGroups=c}else{const c=Xi(r.source),u=Xi(n.source);this.structsAndGroups=am(c,u)}this.layout=s??om(this.structsAndGroups),this.gpuLayout=i??im(this.structsAndGroups),this.autoAssignGlobalUniforms=((a=this.layout[0])==null?void 0:a.globalUniforms)!==void 0,this.autoAssignLocalUniforms=((l=this.layout[1])==null?void 0:l.localUniforms)!==void 0,this._generateProgramKey()}_generateProgramKey(){const{vertex:e,fragment:n}=this,r=e.source+n.source+e.entryPoint+n.entryPoint;this._layoutKey=xa(r,"program")}get attributeData(){return this._attributeData??(this._attributeData=sm(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null,br[this._cacheKey]=null}static from(e){const n=`${e.vertex.source}:${e.fragment.source}:${e.fragment.entryPoint}:${e.vertex.entryPoint}`;return br[n]||(br[n]=new pi(e),br[n]._cacheKey=n),br[n]}}const Ch=["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>"],lm=Ch.reduce((t,e)=>(t[e]=!0,t),{});function cm(t,e){switch(t){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*e);case"vec3<f32>":return new Float32Array(3*e);case"vec4<f32>":return new Float32Array(4*e);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 Eh=class Ph{constructor(e,n){this._touched=0,this.uid=Ie("uniform"),this._resourceType="uniformGroup",this._resourceId=Ie("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,n={...Ph.defaultOptions,...n},this.uniformStructures=e;const r={};for(const s in e){const i=e[s];if(i.name=s,i.size=i.size??1,!lm[i.type]){const o=i.type.match(/^array<(\w+(?:<\w+>)?),\s*(\d+)>$/);if(o){const[,a,l]=o;throw new Error(`Uniform type ${i.type} is not supported. Use type: '${a}', size: ${l} instead.`)}throw new Error(`Uniform type ${i.type} is not supported. Supported uniform types are: ${Ch.join(", ")}`)}i.value??(i.value=cm(i.type,i.size)),r[s]=i.value}this.uniforms=r,this._dirtyId=1,this.ubo=n.ubo,this.isStatic=n.isStatic,this._signature=xa(Object.keys(r).map(s=>`${s}-${e[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};Eh.defaultOptions={ubo:!1,isStatic:!1};let Ih=Eh;class Hs{constructor(e){this.resources=Object.create(null),this._dirty=!0;let n=0;for(const r in e){const s=e[r];this.setResource(s,n++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;const e=[];let n=0;for(const r in this.resources)e[n++]=this.resources[r]._resourceId;this._key=e.join("|")}setResource(e,n){var s,i;const r=this.resources[n];e!==r&&((s=r==null?void 0:r.off)==null||s.call(r,"change",this.onResourceChange,this),(i=e.on)==null||i.call(e,"change",this.onResourceChange,this),this.resources[n]=e,this._dirty=!0)}getResource(e){return this.resources[e]}_touch(e,n){const r=this.resources;for(const s in r)r[s]._gcLastUsed=e,r[s]._touched=n}destroy(){var n;const e=this.resources;for(const r in e){const s=e[r];(n=s==null?void 0:s.off)==null||n.call(s,"change",this.onResourceChange,this)}this.resources=null}onResourceChange(e){this._dirty=!0,e.destroyed?this.destroy():this._updateKey()}}var No=(t=>(t[t.WEBGL=1]="WEBGL",t[t.WEBGPU=2]="WEBGPU",t[t.CANVAS=4]="CANVAS",t[t.BOTH=3]="BOTH",t))(No||{});class ba extends fn{constructor(e){super(),this.uid=Ie("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[],this._destroyed=!1;let{gpuProgram:n,glProgram:r,groups:s,resources:i,compatibleRenderers:o,groupMap:a}=e;this.gpuProgram=n,this.glProgram=r,o===void 0&&(o=0,n&&(o|=No.WEBGPU),r&&(o|=No.WEBGL)),this.compatibleRenderers=o;const l={};if(!i&&!s&&(i={}),i&&s)throw new Error("[Shader] Cannot have both resources and groups");if(!n&&s&&!a)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!n&&s&&a)for(const c in a)for(const u in a[c]){const h=a[c][u];l[h]={group:c,binding:u,name:h}}else if(n&&s&&!a){const c=n.structsAndGroups.groups;a={},c.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,l[u.name]=u})}else if(i){s={},a={},n&&n.structsAndGroups.groups.forEach(h=>{a[h.group]=a[h.group]||{},a[h.group][h.binding]=h.name,l[h.name]=h});let c=0;for(const u in i)l[u]||(s[99]||(s[99]=new Hs,this._ownedBindGroups.push(s[99])),l[u]={group:99,binding:c,name:u},a[99]=a[99]||{},a[99][c]=u,c++);for(const u in i){const h=u;let f=i[u];!f.source&&!f._resourceType&&(f=new Ih(f));const d=l[h];d&&(s[d.group]||(s[d.group]=new Hs,this._ownedBindGroups.push(s[d.group])),s[d.group].setResource(f,d.binding))}}this.groups=s,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(s,l)}addResource(e,n,r){var s,i;(s=this._uniformBindMap)[n]||(s[n]={}),(i=this._uniformBindMap[n])[r]||(i[r]=e),this.groups[n]||(this.groups[n]=new Hs,this._ownedBindGroups.push(this.groups[n]))}_buildResourceAccessor(e,n){const r={};for(const s in n){const i=n[s];Object.defineProperty(r,i.name,{get(){return e[i.group].getResource(i.binding)},set(o){e[i.group].setResource(o,i.binding)}})}return r}destroy(e=!1){var n,r;this._destroyed||(this._destroyed=!0,this.emit("destroy",this),e&&((n=this.gpuProgram)==null||n.destroy(),(r=this.glProgram)==null||r.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(s=>{s.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null)}static from(e){const{gpu:n,gl:r,...s}=e;let i,o;return n&&(i=pi.from(n)),r&&(o=Ah.from(r)),new ba({gpuProgram:i,glProgram:o,...s})}}const um={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},Ji=0,Ki=1,Qi=2,eo=3,to=4,no=5,Fo=class Mh{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Ji)}set blend(e){!!(this.data&1<<Ji)!==e&&(this.data^=1<<Ji)}get offsets(){return!!(this.data&1<<Ki)}set offsets(e){!!(this.data&1<<Ki)!==e&&(this.data^=1<<Ki)}set cullMode(e){if(e==="none"){this.culling=!1;return}this.culling=!0,this.clockwiseFrontFace=e==="front"}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(this.data&1<<Qi)}set culling(e){!!(this.data&1<<Qi)!==e&&(this.data^=1<<Qi)}get depthTest(){return!!(this.data&1<<eo)}set depthTest(e){!!(this.data&1<<eo)!==e&&(this.data^=1<<eo)}get depthMask(){return!!(this.data&1<<no)}set depthMask(e){!!(this.data&1<<no)!==e&&(this.data^=1<<no)}get clockwiseFrontFace(){return!!(this.data&1<<to)}set clockwiseFrontFace(e){!!(this.data&1<<to)!==e&&(this.data^=1<<to)}get blendMode(){return this._blendMode}set blendMode(e){this.blend=e!=="none",this._blendMode=e,this._blendModeId=um[e]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){this.offsets=!!e,this._polygonOffset=e}toString(){return`[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){const e=new Mh;return e.depthTest=!1,e.blend=!0,e}};Fo.default2d=Fo.for2d();let Rh=Fo;function Kl(t,e,n=2){const r=e&&e.length,s=r?e[0]*n:t.length;let i=zh(t,0,s,n,!0);const o=[];if(!i||i.next===i.prev)return o;let a,l,c;if(r&&(i=mm(t,e,i,n)),t.length>80*n){a=t[0],l=t[1];let u=a,h=l;for(let f=n;f<s;f+=n){const d=t[f],m=t[f+1];d<a&&(a=d),m<l&&(l=m),d>u&&(u=d),m>h&&(h=m)}c=Math.max(u-a,h-l),c=c!==0?32767/c:0}return Hr(i,o,n,a,l,c,0),o}function zh(t,e,n,r,s){let i;if(s===Am(t,e,n,r)>0)for(let o=e;o<n;o+=r)i=Ql(o/r|0,t[o],t[o+1],i);else for(let o=n-r;o>=e;o-=r)i=Ql(o/r|0,t[o],t[o+1],i);return i&&rr(i,i.next)&&(Yr(i),i=i.next),i}function Pn(t,e){if(!t)return t;e||(e=t);let n=t,r;do if(r=!1,!n.steiner&&(rr(n,n.next)||Se(n.prev,n,n.next)===0)){if(Yr(n),n=e=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==e);return e}function Hr(t,e,n,r,s,i,o){if(!t)return;!o&&i&&bm(t,r,s,i);let a=t;for(;t.prev!==t.next;){const l=t.prev,c=t.next;if(i?dm(t,r,s,i):hm(t)){e.push(l.i,t.i,c.i),Yr(t),t=c.next,a=c.next;continue}if(t=c,t===a){o?o===1?(t=fm(Pn(t),e),Hr(t,e,n,r,s,i,2)):o===2&&pm(t,e,n,r,s,i):Hr(Pn(t),e,n,r,s,i,1);break}}}function hm(t){const e=t.prev,n=t,r=t.next;if(Se(e,n,r)>=0)return!1;const s=e.x,i=n.x,o=r.x,a=e.y,l=n.y,c=r.y,u=Math.min(s,i,o),h=Math.min(a,l,c),f=Math.max(s,i,o),d=Math.max(a,l,c);let m=r.next;for(;m!==e;){if(m.x>=u&&m.x<=f&&m.y>=h&&m.y<=d&&Or(s,a,i,l,o,c,m.x,m.y)&&Se(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function dm(t,e,n,r){const s=t.prev,i=t,o=t.next;if(Se(s,i,o)>=0)return!1;const a=s.x,l=i.x,c=o.x,u=s.y,h=i.y,f=o.y,d=Math.min(a,l,c),m=Math.min(u,h,f),_=Math.max(a,l,c),g=Math.max(u,h,f),y=Lo(d,m,e,n,r),b=Lo(_,g,e,n,r);let w=t.prevZ,k=t.nextZ;for(;w&&w.z>=y&&k&&k.z<=b;){if(w.x>=d&&w.x<=_&&w.y>=m&&w.y<=g&&w!==s&&w!==o&&Or(a,u,l,h,c,f,w.x,w.y)&&Se(w.prev,w,w.next)>=0||(w=w.prevZ,k.x>=d&&k.x<=_&&k.y>=m&&k.y<=g&&k!==s&&k!==o&&Or(a,u,l,h,c,f,k.x,k.y)&&Se(k.prev,k,k.next)>=0))return!1;k=k.nextZ}for(;w&&w.z>=y;){if(w.x>=d&&w.x<=_&&w.y>=m&&w.y<=g&&w!==s&&w!==o&&Or(a,u,l,h,c,f,w.x,w.y)&&Se(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;k&&k.z<=b;){if(k.x>=d&&k.x<=_&&k.y>=m&&k.y<=g&&k!==s&&k!==o&&Or(a,u,l,h,c,f,k.x,k.y)&&Se(k.prev,k,k.next)>=0)return!1;k=k.nextZ}return!0}function fm(t,e){let n=t;do{const r=n.prev,s=n.next.next;!rr(r,s)&&$h(r,n,n.next,s)&&Wr(r,s)&&Wr(s,r)&&(e.push(r.i,n.i,s.i),Yr(n),Yr(n.next),n=t=s),n=n.next}while(n!==t);return Pn(n)}function pm(t,e,n,r,s,i){let o=t;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&km(o,a)){let l=Dh(o,a);o=Pn(o,o.next),l=Pn(l,l.next),Hr(o,e,n,r,s,i,0),Hr(l,e,n,r,s,i,0);return}a=a.next}o=o.next}while(o!==t)}function mm(t,e,n,r){const s=[];for(let i=0,o=e.length;i<o;i++){const a=e[i]*r,l=i<o-1?e[i+1]*r:t.length,c=zh(t,a,l,r,!1);c===c.next&&(c.steiner=!0),s.push(wm(c))}s.sort(gm);for(let i=0;i<s.length;i++)n=_m(s[i],n);return n}function gm(t,e){let n=t.x-e.x;if(n===0&&(n=t.y-e.y,n===0)){const r=(t.next.y-t.y)/(t.next.x-t.x),s=(e.next.y-e.y)/(e.next.x-e.x);n=r-s}return n}function _m(t,e){const n=ym(t,e);if(!n)return e;const r=Dh(n,t);return Pn(r,r.next),Pn(n,n.next)}function ym(t,e){let n=e;const r=t.x,s=t.y;let i=-1/0,o;if(rr(t,n))return n;do{if(rr(t,n.next))return n.next;if(s<=n.y&&s>=n.next.y&&n.next.y!==n.y){const h=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(h<=r&&h>i&&(i=h,o=n.x<n.next.x?n:n.next,h===r))return o}n=n.next}while(n!==e);if(!o)return null;const a=o,l=o.x,c=o.y;let u=1/0;n=o;do{if(r>=n.x&&n.x>=l&&r!==n.x&&Oh(s<c?r:i,s,l,c,s<c?i:r,s,n.x,n.y)){const h=Math.abs(s-n.y)/(r-n.x);Wr(n,t)&&(h<u||h===u&&(n.x>o.x||n.x===o.x&&xm(o,n)))&&(o=n,u=h)}n=n.next}while(n!==a);return o}function xm(t,e){return Se(t.prev,t,e.prev)<0&&Se(e.next,t,t.next)<0}function bm(t,e,n,r){let s=t;do s.z===0&&(s.z=Lo(s.x,s.y,e,n,r)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==t);s.prevZ.nextZ=null,s.prevZ=null,vm(s)}function vm(t){let e,n=1;do{let r=t,s;t=null;let i=null;for(e=0;r;){e++;let o=r,a=0;for(let c=0;c<n&&(a++,o=o.nextZ,!!o);c++);let l=n;for(;a>0||l>0&&o;)a!==0&&(l===0||!o||r.z<=o.z)?(s=r,r=r.nextZ,a--):(s=o,o=o.nextZ,l--),i?i.nextZ=s:t=s,s.prevZ=i,i=s;r=o}i.nextZ=null,n*=2}while(e>1);return t}function Lo(t,e,n,r,s){return t=(t-n)*s|0,e=(e-r)*s|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function wm(t){let e=t,n=t;do(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next;while(e!==t);return n}function Oh(t,e,n,r,s,i,o,a){return(s-o)*(e-a)>=(t-o)*(i-a)&&(t-o)*(r-a)>=(n-o)*(e-a)&&(n-o)*(i-a)>=(s-o)*(r-a)}function Or(t,e,n,r,s,i,o,a){return!(t===o&&e===a)&&Oh(t,e,n,r,s,i,o,a)}function km(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!Sm(t,e)&&(Wr(t,e)&&Wr(e,t)&&Tm(t,e)&&(Se(t.prev,t,e.prev)||Se(t,e.prev,e))||rr(t,e)&&Se(t.prev,t,t.next)>0&&Se(e.prev,e,e.next)>0)}function Se(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function rr(t,e){return t.x===e.x&&t.y===e.y}function $h(t,e,n,r){const s=zs(Se(t,e,n)),i=zs(Se(t,e,r)),o=zs(Se(n,r,t)),a=zs(Se(n,r,e));return!!(s!==i&&o!==a||s===0&&Rs(t,n,e)||i===0&&Rs(t,r,e)||o===0&&Rs(n,t,r)||a===0&&Rs(n,e,r))}function Rs(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function zs(t){return t>0?1:t<0?-1:0}function Sm(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&$h(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function Wr(t,e){return Se(t.prev,t,t.next)<0?Se(t,e,t.next)>=0&&Se(t,t.prev,e)>=0:Se(t,e,t.prev)<0||Se(t,t.next,e)<0}function Tm(t,e){let n=t,r=!1;const s=(t.x+e.x)/2,i=(t.y+e.y)/2;do n.y>i!=n.next.y>i&&n.next.y!==n.y&&s<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==t);return r}function Dh(t,e){const n=Bo(t.i,t.x,t.y),r=Bo(e.i,e.x,e.y),s=t.next,i=e.prev;return t.next=e,e.prev=t,n.next=s,s.prev=n,r.next=n,n.prev=r,i.next=r,r.prev=i,r}function Ql(t,e,n,r){const s=Bo(t,e,n);return r?(s.next=r.next,s.prev=r,r.next.prev=s,r.next=s):(s.prev=s,s.next=s),s}function Yr(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Bo(t,e,n){return{i:t,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Am(t,e,n,r){let s=0;for(let i=e,o=n-r;i<n;i+=r)s+=(t[o]-t[i])*(t[i+1]+t[o+1]),o=i;return s}const Cm=Kl.default||Kl;var ro,ec;function Em(){if(ec)return ro;ec=1,ro=n;var t={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},e=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function n(i){var o=[];return i.replace(e,function(a,l,c){var u=l.toLowerCase();for(c=s(c),u=="m"&&c.length>2&&(o.push([l].concat(c.splice(0,2))),u="l",l=l=="m"?"l":"L");;){if(c.length==t[u])return c.unshift(l),o.push(c);if(c.length<t[u])throw new Error("malformed path data");o.push([l].concat(c.splice(0,t[u])))}}),o}var r=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function s(i){var o=i.match(r);return o?o.map(Number):[]}return ro}var Pm=Em();const Im=pa(Pm);function Mm(t,e){const n=Im(t),r=[];let s=null,i=0,o=0;for(let a=0;a<n.length;a++){const l=n[a],c=l[0],u=l;switch(c){case"M":i=u[1],o=u[2],e.moveTo(i,o);break;case"m":i+=u[1],o+=u[2],e.moveTo(i,o);break;case"H":i=u[1],e.lineTo(i,o);break;case"h":i+=u[1],e.lineTo(i,o);break;case"V":o=u[1],e.lineTo(i,o);break;case"v":o+=u[1],e.lineTo(i,o);break;case"L":i=u[1],o=u[2],e.lineTo(i,o);break;case"l":i+=u[1],o+=u[2],e.lineTo(i,o);break;case"C":i=u[5],o=u[6],e.bezierCurveTo(u[1],u[2],u[3],u[4],i,o);break;case"c":e.bezierCurveTo(i+u[1],o+u[2],i+u[3],o+u[4],i+u[5],o+u[6]),i+=u[5],o+=u[6];break;case"S":i=u[3],o=u[4],e.bezierCurveToShort(u[1],u[2],i,o);break;case"s":e.bezierCurveToShort(i+u[1],o+u[2],i+u[3],o+u[4]),i+=u[3],o+=u[4];break;case"Q":i=u[3],o=u[4],e.quadraticCurveTo(u[1],u[2],i,o);break;case"q":e.quadraticCurveTo(i+u[1],o+u[2],i+u[3],o+u[4]),i+=u[3],o+=u[4];break;case"T":i=u[1],o=u[2],e.quadraticCurveToShort(i,o);break;case"t":i+=u[1],o+=u[2],e.quadraticCurveToShort(i,o);break;case"A":i=u[6],o=u[7],e.arcToSvg(u[1],u[2],u[3],u[4],u[5],i,o);break;case"a":i+=u[6],o+=u[7],e.arcToSvg(u[1],u[2],u[3],u[4],u[5],i,o);break;case"Z":case"z":e.closePath(),r.length>0&&(s=r.pop(),s?(i=s.startX,o=s.startY):(i=0,o=0)),s=null;break;default:lt(`Unknown SVG path command: ${c}`)}c!=="Z"&&c!=="z"&&s===null&&(s={startX:i,startY:o},r.push(s))}return e}class va{constructor(e=0,n=0,r=0){this.type="circle",this.x=e,this.y=n,this.radius=r}clone(){return new va(this.x,this.y,this.radius)}contains(e,n){if(this.radius<=0)return!1;const r=this.radius*this.radius;let s=this.x-e,i=this.y-n;return s*=s,i*=i,s+i<=r}strokeContains(e,n,r,s=.5){if(this.radius===0)return!1;const i=this.x-e,o=this.y-n,a=this.radius,l=(1-s)*r,c=Math.sqrt(i*i+o*o);return c<=a+l&&c>a-(r-l)}getBounds(e){return e||(e=new Oe),e.x=this.x-this.radius,e.y=this.y-this.radius,e.width=this.radius*2,e.height=this.radius*2,e}copyFrom(e){return this.x=e.x,this.y=e.y,this.radius=e.radius,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}class wa{constructor(e=0,n=0,r=0,s=0){this.type="ellipse",this.x=e,this.y=n,this.halfWidth=r,this.halfHeight=s}clone(){return new wa(this.x,this.y,this.halfWidth,this.halfHeight)}contains(e,n){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let r=(e-this.x)/this.halfWidth,s=(n-this.y)/this.halfHeight;return r*=r,s*=s,r+s<=1}strokeContains(e,n,r,s=.5){const{halfWidth:i,halfHeight:o}=this;if(i<=0||o<=0)return!1;const a=r*(1-s),l=r-a,c=i-l,u=o-l,h=i+a,f=o+a,d=e-this.x,m=n-this.y,_=d*d/(c*c)+m*m/(u*u),g=d*d/(h*h)+m*m/(f*f);return _>1&&g<=1}getBounds(e){return e||(e=new Oe),e.x=this.x-this.halfWidth,e.y=this.y-this.halfHeight,e.width=this.halfWidth*2,e.height=this.halfHeight*2,e}copyFrom(e){return this.x=e.x,this.y=e.y,this.halfWidth=e.halfWidth,this.halfHeight=e.halfHeight,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}function Rm(t,e,n,r,s,i){const o=t-n,a=e-r,l=s-n,c=i-r,u=o*l+a*c,h=l*l+c*c;let f=-1;h!==0&&(f=u/h);let d,m;f<0?(d=n,m=r):f>1?(d=s,m=i):(d=n+f*l,m=r+f*c);const _=t-d,g=e-m;return _*_+g*g}let zm,Om;class Zr{constructor(...e){this.type="polygon";let n=Array.isArray(e[0])?e[0]:e;if(typeof n[0]!="number"){const r=[];for(let s=0,i=n.length;s<i;s++)r.push(n[s].x,n[s].y);n=r}this.points=n,this.closePath=!0}isClockwise(){let e=0;const n=this.points,r=n.length;for(let s=0;s<r;s+=2){const i=n[s],o=n[s+1],a=n[(s+2)%r],l=n[(s+3)%r];e+=(a-i)*(l+o)}return e<0}containsPolygon(e){const n=this.getBounds(zm),r=e.getBounds(Om);if(!n.containsRect(r))return!1;const s=e.points;for(let i=0;i<s.length;i+=2){const o=s[i],a=s[i+1];if(!this.contains(o,a))return!1}return!0}clone(){const e=this.points.slice(),n=new Zr(e);return n.closePath=this.closePath,n}contains(e,n){let r=!1;const s=this.points.length/2;for(let i=0,o=s-1;i<s;o=i++){const a=this.points[i*2],l=this.points[i*2+1],c=this.points[o*2],u=this.points[o*2+1];l>n!=u>n&&e<(c-a)*((n-l)/(u-l))+a&&(r=!r)}return r}strokeContains(e,n,r,s=.5){const i=r*r,o=i*(1-s),a=i-o,{points:l}=this,c=l.length-(this.closePath?0:2);for(let u=0;u<c;u+=2){const h=l[u],f=l[u+1],d=l[(u+2)%l.length],m=l[(u+3)%l.length],_=Rm(e,n,h,f,d,m),g=Math.sign((d-h)*(n-f)-(m-f)*(e-h));if(_<=(g<0?a:o))return!0}return!1}getBounds(e){e||(e=new Oe);const n=this.points;let r=1/0,s=-1/0,i=1/0,o=-1/0;for(let a=0,l=n.length;a<l;a+=2){const c=n[a],u=n[a+1];r=c<r?c:r,s=c>s?c:s,i=u<i?u:i,o=u>o?u:o}return e.x=r,e.width=s-r,e.y=i,e.height=o-i,e}copyFrom(e){return this.points=e.points.slice(),this.closePath=e.closePath,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((e,n)=>`${e}, ${n}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return ge("8.11.0","Polygon.lastX is deprecated, please use Polygon.lastX instead."),this.points[this.points.length-2]}get y(){return ge("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 Os=(t,e,n,r,s,i,o)=>{const a=t-n,l=e-r,c=Math.sqrt(a*a+l*l);return c>=s-i&&c<=s+o};class ka{constructor(e=0,n=0,r=0,s=0,i=20){this.type="roundedRectangle",this.x=e,this.y=n,this.width=r,this.height=s,this.radius=i}getBounds(e){return e||(e=new Oe),e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e}clone(){return new ka(this.x,this.y,this.width,this.height,this.radius)}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.copyFrom(this),e}contains(e,n){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&n>=this.y&&n<=this.y+this.height){const r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(n>=this.y+r&&n<=this.y+this.height-r||e>=this.x+r&&e<=this.x+this.width-r)return!0;let s=e-(this.x+r),i=n-(this.y+r);const o=r*r;if(s*s+i*i<=o||(s=e-(this.x+this.width-r),s*s+i*i<=o)||(i=n-(this.y+this.height-r),s*s+i*i<=o)||(s=e-(this.x+r),s*s+i*i<=o))return!0}return!1}strokeContains(e,n,r,s=.5){const{x:i,y:o,width:a,height:l,radius:c}=this,u=r*(1-s),h=r-u,f=i+c,d=o+c,m=a-c*2,_=l-c*2,g=i+a,y=o+l;return(e>=i-u&&e<=i+h||e>=g-h&&e<=g+u)&&n>=d&&n<=d+_||(n>=o-u&&n<=o+h||n>=y-h&&n<=y+u)&&e>=f&&e<=f+m?!0:e<f&&n<d&&Os(e,n,f,d,c,h,u)||e>g-c&&n<d&&Os(e,n,g-c,d,c,h,u)||e>g-c&&n>y-c&&Os(e,n,g-c,y-c,c,h,u)||e<f&&n>y-c&&Os(e,n,f,y-c,c,h,u)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}const Nh={};function $m(t,e,n){let r=2166136261;for(let s=0;s<e;s++)r^=t[s].uid,r=Math.imul(r,16777619),r>>>=0;return Nh[r]||Dm(t,e,r,n)}function Dm(t,e,n,r){const s={};let i=0;for(let a=0;a<r;a++){const l=a<e?t[a]:de.EMPTY.source;s[i++]=l.source,s[i++]=l.style}const o=new Hs(s);return Nh[n]=o,o}class tc{constructor(e){typeof e=="number"?this.rawBinaryData=new ArrayBuffer(e):e instanceof Uint8Array?this.rawBinaryData=e.buffer:this.rawBinaryData=e,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(e){return this[`${e}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(e){switch(e){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${e} isn't a valid view type`)}}}function nc(t,e,n,r){if(n??(n=0),r??(r=Math.min(t.byteLength-n,e.byteLength)),!(n&7)&&!(r&7)){const s=r/8;new Float64Array(e,0,s).set(new Float64Array(t,n,s))}else if(!(n&3)&&!(r&3)){const s=r/4;new Float32Array(e,0,s).set(new Float32Array(t,n,s))}else new Uint8Array(e).set(new Uint8Array(t,n,r))}const Nm={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};function rc(t,e){return e.alphaMode==="no-premultiply-alpha"&&Nm[t]||t}const Fm=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
24
|
+
`);function Lm(t){let e="";for(let n=0;n<t;++n)n>0&&(e+=`
|
|
25
|
+
else `),n<t-1&&(e+=`if(test == ${n}.0){}`);return e}function Bm(t,e){if(t===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const n=e.createShader(e.FRAGMENT_SHADER);try{for(;;){const r=Fm.replace(/%forloop%/gi,Lm(t));if(e.shaderSource(n,r),e.compileShader(n),!e.getShaderParameter(n,e.COMPILE_STATUS))t=t/2|0;else break}}finally{e.deleteShader(n)}return t}let Zn=null;function Zm(){var e;if(Zn)return Zn;const t=Sh();return Zn=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),Zn=Bm(Zn,t),(e=t.getExtension("WEBGL_lose_context"))==null||e.loseContext(),Zn}class Um{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let e=0;e<this.count;e++){const n=this.textures[e];this.textures[e]=null,this.ids[n.uid]=null}this.count=0}}class Gm{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new Um,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 Ur=[];let Js=0;ga.register({clear:()=>{if(Ur.length>0)for(const t of Ur)t&&t.destroy();Ur.length=0,Js=0}});function sc(){return Js>0?Ur[--Js]:new Gm}function ic(t){t.elements=null,Ur[Js++]=t}let vr=0;const Fh=class Lh{constructor(e){this.uid=Ie("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],e={...Lh.defaultOptions,...e},e.maxTextures||(ge("v8.8.0","maxTextures is a required option for Batcher now, please pass it in the options"),e.maxTextures=Zm());const{maxTextures:n,attributesInitialSize:r,indicesInitialSize:s}=e;this.attributeBuffer=new tc(r*4),this.indexBuffer=new Uint16Array(s),this.maxTextures=n}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let e=0;e<this.batchIndex;e++)ic(this.batches[e]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(e){this._elements[this.elementSize++]=e,e._indexStart=this.indexSize,e._attributeStart=this.attributeSize,e._batcher=this,this.indexSize+=e.indexSize,this.attributeSize+=e.attributeSize*this.vertexSize}checkAndUpdateTexture(e,n){const r=e._batch.textures.ids[n._source.uid];return!r&&r!==0?!1:(e._textureId=r,e.texture=n,!0)}updateElement(e){this.dirty=!0;const n=this.attributeBuffer;e.packAsQuad?this.packQuadAttributes(e,n.float32View,n.uint32View,e._attributeStart,e._textureId):this.packAttributes(e,n.float32View,n.uint32View,e._attributeStart,e._textureId)}break(e){const n=this._elements;if(!n[this.elementStart])return;let r=sc(),s=r.textures;s.clear();const i=n[this.elementStart];let o=rc(i.blendMode,i.texture._source),a=i.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,c=this.attributeBuffer.uint32View,u=this.indexBuffer;let h=this._batchIndexSize,f=this._batchIndexStart,d="startBatch",m=[];const _=this.maxTextures;for(let g=this.elementStart;g<this.elementSize;++g){const y=n[g];n[g]=null;const w=y.texture._source,k=rc(y.blendMode,w),E=o!==k||a!==y.topology;if(w._batchTick===vr&&!E){y._textureId=w._textureBindLocation,h+=y.indexSize,y.packAsQuad?(this.packQuadAttributes(y,l,c,y._attributeStart,y._textureId),this.packQuadIndex(u,y._indexStart,y._attributeStart/this.vertexSize)):(this.packAttributes(y,l,c,y._attributeStart,y._textureId),this.packIndex(y,u,y._indexStart,y._attributeStart/this.vertexSize)),y._batch=r,m.push(y);continue}w._batchTick=vr,(s.count>=_||E)&&(this._finishBatch(r,f,h-f,s,o,a,e,d,m),d="renderBatch",f=h,o=k,a=y.topology,r=sc(),s=r.textures,s.clear(),m=[],++vr),y._textureId=w._textureBindLocation=s.count,s.ids[w.uid]=s.count,s.textures[s.count++]=w,y._batch=r,m.push(y),h+=y.indexSize,y.packAsQuad?(this.packQuadAttributes(y,l,c,y._attributeStart,y._textureId),this.packQuadIndex(u,y._indexStart,y._attributeStart/this.vertexSize)):(this.packAttributes(y,l,c,y._attributeStart,y._textureId),this.packIndex(y,u,y._indexStart,y._attributeStart/this.vertexSize))}s.count>0&&(this._finishBatch(r,f,h-f,s,o,a,e,d,m),f=h,++vr),this.elementStart=this.elementSize,this._batchIndexStart=f,this._batchIndexSize=h}_finishBatch(e,n,r,s,i,o,a,l,c){e.gpuBindGroup=null,e.bindGroup=null,e.action=l,e.batcher=this,e.textures=s,e.blendMode=i,e.topology=o,e.start=n,e.size=r,e.elements=c,++vr,this.batches[this.batchIndex++]=e,a.add(e)}finish(e){this.break(e)}ensureAttributeBuffer(e){e*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(e*4)}ensureIndexBuffer(e){e<=this.indexBuffer.length||this._resizeIndexBuffer(e)}_resizeAttributeBuffer(e){const n=Math.max(e,this.attributeBuffer.size*2),r=new tc(n);nc(this.attributeBuffer.rawBinaryData,r.rawBinaryData),this.attributeBuffer=r}_resizeIndexBuffer(e){const n=this.indexBuffer;let r=Math.max(e,n.length*1.5);r+=r%2;const s=r>65535?new Uint32Array(r):new Uint16Array(r);if(s.BYTES_PER_ELEMENT!==n.BYTES_PER_ELEMENT)for(let i=0;i<n.length;i++)s[i]=n[i];else nc(n.buffer,s.buffer);this.indexBuffer=s}packQuadIndex(e,n,r){e[n]=r+0,e[n+1]=r+1,e[n+2]=r+2,e[n+3]=r+0,e[n+4]=r+2,e[n+5]=r+3}packIndex(e,n,r,s){const i=e.indices,o=e.indexSize,a=e.indexOffset,l=e.attributeOffset;for(let c=0;c<o;c++)n[r++]=s+i[c+a]-l}destroy(e={}){var n;if(this.batches!==null){for(let r=0;r<this.batchIndex;r++)ic(this.batches[r]);this.batches=null,this.geometry.destroy(!0),this.geometry=null,e.shader&&((n=this.shader)==null||n.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}}};Fh.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};let jm=Fh;var Qe=(t=>(t[t.MAP_READ=1]="MAP_READ",t[t.MAP_WRITE=2]="MAP_WRITE",t[t.COPY_SRC=4]="COPY_SRC",t[t.COPY_DST=8]="COPY_DST",t[t.INDEX=16]="INDEX",t[t.VERTEX=32]="VERTEX",t[t.UNIFORM=64]="UNIFORM",t[t.STORAGE=128]="STORAGE",t[t.INDIRECT=256]="INDIRECT",t[t.QUERY_RESOLVE=512]="QUERY_RESOLVE",t[t.STATIC=1024]="STATIC",t))(Qe||{});class qr extends fn{constructor(e){let{data:n,size:r}=e;const{usage:s,label:i,shrinkToFit:o}=e;super(),this._gpuData=Object.create(null),this._gcLastUsed=-1,this.autoGarbageCollect=!0,this.uid=Ie("buffer"),this._resourceType="buffer",this._resourceId=Ie("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,n instanceof Array&&(n=new Float32Array(n)),this._data=n,r??(r=n==null?void 0:n.byteLength);const a=!!n;this.descriptor={size:r,usage:s,mappedAtCreation:a,label:i},this.shrinkToFit=o??!0}get data(){return this._data}set data(e){this.setDataWithSize(e,e.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&Qe.STATIC)}set static(e){e?this.descriptor.usage|=Qe.STATIC:this.descriptor.usage&=~Qe.STATIC}setDataWithSize(e,n,r){if(this._updateID++,this._updateSize=n*e.BYTES_PER_ELEMENT,this._data===e){r&&this.emit("update",this);return}const s=this._data;if(this._data=e,this._dataInt32=null,!s||s.length!==e.length){!this.shrinkToFit&&s&&e.byteLength<s.byteLength?r&&this.emit("update",this):(this.descriptor.size=e.byteLength,this._resourceId=Ie("resource"),this.emit("change",this));return}r&&this.emit("update",this)}update(e){this._updateSize=e??this._updateSize,this._updateID++,this.emit("update",this)}unload(){var e;this.emit("unload",this);for(const n in this._gpuData)(e=this._gpuData[n])==null||e.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 Bh(t,e){if(!(t instanceof qr)){let n=e?Qe.INDEX:Qe.VERTEX;t instanceof Array&&(e?(t=new Uint32Array(t),n=Qe.INDEX|Qe.COPY_DST):(t=new Float32Array(t),n=Qe.VERTEX|Qe.COPY_DST)),t=new qr({data:t,label:e?"index-mesh-buffer":"vertex-mesh-buffer",usage:n})}return t}function Vm(t,e,n){const r=t.getAttribute(e);if(!r)return n.minX=0,n.minY=0,n.maxX=0,n.maxY=0,n;const s=r.buffer.data;let i=1/0,o=1/0,a=-1/0,l=-1/0;const c=s.BYTES_PER_ELEMENT,u=(r.offset||0)/c,h=(r.stride||8)/c;for(let f=u;f<s.length;f+=h){const d=s[f],m=s[f+1];d>a&&(a=d),m>l&&(l=m),d<i&&(i=d),m<o&&(o=m)}return n.minX=i,n.minY=o,n.maxX=a,n.maxY=l,n}function Hm(t){return(t instanceof qr||Array.isArray(t)||t.BYTES_PER_ELEMENT)&&(t={buffer:t}),t.buffer=Bh(t.buffer,!1),t}class Wm extends fn{constructor(e={}){super(),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=Ie("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new St,this._boundsDirty=!0;const{attributes:n,indexBuffer:r,topology:s}=e;if(this.buffers=[],this.attributes={},n)for(const i in n)this.addAttribute(i,n[i]);this.instanceCount=e.instanceCount??1,r&&this.addIndex(r),this.topology=s||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(e){return this.attributes[e]}getIndex(){return this.indexBuffer}getBuffer(e){return this.getAttribute(e).buffer}getSize(){for(const e in this.attributes){const n=this.attributes[e];return n.buffer.data.length/(n.stride/4||n.size)}return 0}addAttribute(e,n){const r=Hm(n);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[e]=r}addIndex(e){this.indexBuffer=Bh(e,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,Vm(this,"aPosition",this._bounds)):this._bounds}unload(){var e;this.emit("unload",this);for(const n in this._gpuData)(e=this._gpuData[n])==null||e.destroy();this._gpuData=Object.create(null)}destroy(e=!1){var n;this.emit("destroy",this),this.removeAllListeners(),e&&this.buffers.forEach(r=>r.destroy()),this.unload(),(n=this.indexBuffer)==null||n.destroy(),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}const Ym=new Float32Array(1),qm=new Uint32Array(1);class Xm extends Wm{constructor(){const n=new qr({data:Ym,label:"attribute-batch-buffer",usage:Qe.VERTEX|Qe.COPY_DST,shrinkToFit:!1}),r=new qr({data:qm,label:"index-batch-buffer",usage:Qe.INDEX|Qe.COPY_DST,shrinkToFit:!1}),s=24;super({attributes:{aPosition:{buffer:n,format:"float32x2",stride:s,offset:0},aUV:{buffer:n,format:"float32x2",stride:s,offset:8},aColor:{buffer:n,format:"unorm8x4",stride:s,offset:16},aTextureIdAndRound:{buffer:n,format:"uint16x2",stride:s,offset:20}},indexBuffer:r})}}function oc(t,e,n){if(t)for(const r in t){const s=r.toLocaleLowerCase(),i=e[s];if(i){let o=t[r];r==="header"&&(o=o.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),n&&i.push(`//----${n}----//`),i.push(o)}else lt(`${r} placement hook does not exist in shader`)}}const Jm=/\{\{(.*?)\}\}/g;function ac(t){var r;const e={};return(((r=t.match(Jm))==null?void 0:r.map(s=>s.replace(/[{()}]/g,"")))??[]).forEach(s=>{e[s]=[]}),e}function lc(t,e){let n;const r=/@in\s+([^;]+);/g;for(;(n=r.exec(t))!==null;)e.push(n[1])}function cc(t,e,n=!1){const r=[];lc(e,r),t.forEach(a=>{a.header&&lc(a.header,r)});const s=r;n&&s.sort();const i=s.map((a,l)=>` @location(${l}) ${a},`).join(`
|
|
26
|
+
`);let o=e.replace(/@in\s+[^;]+;\s*/g,"");return o=o.replace("{{in}}",`
|
|
27
|
+
${i}
|
|
28
|
+
`),o}function uc(t,e){let n;const r=/@out\s+([^;]+);/g;for(;(n=r.exec(t))!==null;)e.push(n[1])}function Km(t){const n=/\b(\w+)\s*:/g.exec(t);return n?n[1]:""}function Qm(t){const e=/@.*?\s+/g;return t.replace(e,"")}function eg(t,e){const n=[];uc(e,n),t.forEach(l=>{l.header&&uc(l.header,n)});let r=0;const s=n.sort().map(l=>l.indexOf("builtin")>-1?l:`@location(${r++}) ${l}`).join(`,
|
|
29
|
+
`),i=n.sort().map(l=>` var ${Qm(l)};`).join(`
|
|
30
|
+
`),o=`return VSOutput(
|
|
31
|
+
${n.sort().map(l=>` ${Km(l)}`).join(`,
|
|
32
|
+
`)});`;let a=e.replace(/@out\s+[^;]+;\s*/g,"");return a=a.replace("{{struct}}",`
|
|
33
|
+
${s}
|
|
34
|
+
`),a=a.replace("{{start}}",`
|
|
35
|
+
${i}
|
|
36
|
+
`),a=a.replace("{{return}}",`
|
|
37
|
+
${o}
|
|
38
|
+
`),a}function hc(t,e){let n=t;for(const r in e){const s=e[r];s.join(`
|
|
39
|
+
`).length?n=n.replace(`{{${r}}}`,`//-----${r} START-----//
|
|
40
|
+
${s.join(`
|
|
41
|
+
`)}
|
|
42
|
+
//----${r} FINISH----//`):n=n.replace(`{{${r}}}`,"")}return n}const an=Object.create(null),so=new Map;let tg=0;function ng({template:t,bits:e}){const n=Zh(t,e);if(an[n])return an[n];const{vertex:r,fragment:s}=sg(t,e);return an[n]=Uh(r,s,e),an[n]}function rg({template:t,bits:e}){const n=Zh(t,e);return an[n]||(an[n]=Uh(t.vertex,t.fragment,e)),an[n]}function sg(t,e){const n=e.map(o=>o.vertex).filter(o=>!!o),r=e.map(o=>o.fragment).filter(o=>!!o);let s=cc(n,t.vertex,!0);s=eg(n,s);const i=cc(r,t.fragment,!0);return{vertex:s,fragment:i}}function Zh(t,e){return e.map(n=>(so.has(n)||so.set(n,tg++),so.get(n))).sort((n,r)=>n-r).join("-")+t.vertex+t.fragment}function Uh(t,e,n){const r=ac(t),s=ac(e);return n.forEach(i=>{oc(i.vertex,r,i.name),oc(i.fragment,s,i.name)}),{vertex:hc(t,r),fragment:hc(e,s)}}const ig=`
|
|
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
|
+
`,og=`
|
|
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
|
+
`,ag=`
|
|
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
|
+
`,lg=`
|
|
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
|
+
`,cg={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
|
+
`}},ug={name:"global-uniforms-bit",vertex:{header:`
|
|
176
|
+
uniform mat3 uProjectionMatrix;
|
|
177
|
+
uniform mat3 uWorldTransformMatrix;
|
|
178
|
+
uniform vec4 uWorldColorAlpha;
|
|
179
|
+
uniform vec2 uResolution;
|
|
180
|
+
`}};function hg({bits:t,name:e}){const n=ng({template:{fragment:og,vertex:ig},bits:[cg,...t]});return pi.from({name:e,vertex:{source:n.vertex,entryPoint:"main"},fragment:{source:n.fragment,entryPoint:"main"}})}function dg({bits:t,name:e}){return new Ah({name:e,...rg({template:{vertex:ag,fragment:lg},bits:[ug,...t]})})}const fg={name:"color-bit",vertex:{header:`
|
|
181
|
+
@in aColor: vec4<f32>;
|
|
182
|
+
`,main:`
|
|
183
|
+
vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a);
|
|
184
|
+
`}},pg={name:"color-bit",vertex:{header:`
|
|
185
|
+
in vec4 aColor;
|
|
186
|
+
`,main:`
|
|
187
|
+
vColor *= vec4(aColor.rgb * aColor.a, aColor.a);
|
|
188
|
+
`}},io={};function mg(t){const e=[];if(t===1)e.push("@group(1) @binding(0) var textureSource1: texture_2d<f32>;"),e.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let n=0;for(let r=0;r<t;r++)e.push(`@group(1) @binding(${n++}) var textureSource${r+1}: texture_2d<f32>;`),e.push(`@group(1) @binding(${n++}) var textureSampler${r+1}: sampler;`)}return e.join(`
|
|
189
|
+
`)}function gg(t){const e=[];if(t===1)e.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{e.push("switch vTextureId {");for(let n=0;n<t;n++)n===t-1?e.push(" default:{"):e.push(` case ${n}:{`),e.push(` outColor = textureSampleGrad(textureSource${n+1}, textureSampler${n+1}, vUV, uvDx, uvDy);`),e.push(" break;}");e.push("}")}return e.join(`
|
|
190
|
+
`)}function _g(t){return io[t]||(io[t]={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
|
+
${mg(t)}
|
|
204
|
+
`,main:`
|
|
205
|
+
var uvDx = dpdx(vUV);
|
|
206
|
+
var uvDy = dpdy(vUV);
|
|
207
|
+
|
|
208
|
+
${gg(t)}
|
|
209
|
+
`}}),io[t]}const oo={};function yg(t){const e=[];for(let n=0;n<t;n++)n>0&&e.push("else"),n<t-1&&e.push(`if(vTextureId < ${n}.5)`),e.push("{"),e.push(` outColor = texture(uTextures[${n}], vUV);`),e.push("}");return e.join(`
|
|
210
|
+
`)}function xg(t){return oo[t]||(oo[t]={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[${t}];
|
|
225
|
+
|
|
226
|
+
`,main:`
|
|
227
|
+
|
|
228
|
+
${yg(t)}
|
|
229
|
+
`}}),oo[t]}const bg={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
|
+
`}},vg={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
|
+
`}},dc={};function wg(t){let e=dc[t];if(e)return e;const n=new Int32Array(t);for(let r=0;r<t;r++)n[r]=r;return e=dc[t]=new Ih({uTextures:{value:n,type:"i32",size:t}},{isStatic:!0}),e}class fc extends ba{constructor(e){const n=dg({name:"batch",bits:[pg,xg(e),vg]}),r=hg({name:"batch",bits:[fg,_g(e),bg]});super({glProgram:n,gpuProgram:r,resources:{batchSamplers:wg(e)}}),this.maxTextures=e}}let wr=null;const Gh=class jh extends jm{constructor(e){super(e),this.geometry=new Xm,this.name=jh.extension.name,this.vertexSize=6,wr??(wr=new fc(e.maxTextures)),this.shader=wr}packAttributes(e,n,r,s,i){const o=i<<16|e.roundPixels&65535,a=e.transform,l=a.a,c=a.b,u=a.c,h=a.d,f=a.tx,d=a.ty,{positions:m,uvs:_}=e,g=e.color,y=e.attributeOffset,b=y+e.attributeSize;for(let w=y;w<b;w++){const k=w*2,E=m[k],A=m[k+1];n[s++]=l*E+u*A+f,n[s++]=h*A+c*E+d,n[s++]=_[k],n[s++]=_[k+1],r[s++]=g,r[s++]=o}}packQuadAttributes(e,n,r,s,i){const o=e.texture,a=e.transform,l=a.a,c=a.b,u=a.c,h=a.d,f=a.tx,d=a.ty,m=e.bounds,_=m.maxX,g=m.minX,y=m.maxY,b=m.minY,w=o.uvs,k=e.color,E=i<<16|e.roundPixels&65535;n[s+0]=l*g+u*b+f,n[s+1]=h*b+c*g+d,n[s+2]=w.x0,n[s+3]=w.y0,r[s+4]=k,r[s+5]=E,n[s+6]=l*_+u*b+f,n[s+7]=h*b+c*_+d,n[s+8]=w.x1,n[s+9]=w.y1,r[s+10]=k,r[s+11]=E,n[s+12]=l*_+u*y+f,n[s+13]=h*y+c*_+d,n[s+14]=w.x2,n[s+15]=w.y2,r[s+16]=k,r[s+17]=E,n[s+18]=l*g+u*y+f,n[s+19]=h*y+c*g+d,n[s+20]=w.x3,n[s+21]=w.y3,r[s+22]=k,r[s+23]=E}_updateMaxTextures(e){this.shader.maxTextures!==e&&(wr=new fc(e),this.shader=wr)}destroy(){this.shader=null,super.destroy()}};Gh.extension={type:[fe.Batcher],name:"default"};let kg=Gh;class mi{constructor(e){this.items=Object.create(null);const{renderer:n,type:r,onUnload:s,priority:i,name:o}=e;this._renderer=n,n.gc.addResourceHash(this,"items",r,i??0),this._onUnload=s,this.name=o}add(e){return this.items[e.uid]?!1:(this.items[e.uid]=e,e.once("unload",this.remove,this),e._gcLastUsed=this._renderer.gc.now,!0)}remove(e,...n){var s;if(!this.items[e.uid])return;const r=e._gpuData[this._renderer.uid];r&&((s=this._onUnload)==null||s.call(this,e,...n),r.destroy(),e._gpuData[this._renderer.uid]=null,this.items[e.uid]=null)}removeAll(...e){Object.values(this.items).forEach(n=>n&&this.remove(n,...e))}destroy(...e){this.removeAll(...e),this.items=Object.create(null),this._renderer=null,this._onUnload=null}}function Sg(t,e,n,r,s,i,o,a=null){let l=0;n*=e,s*=i;const c=a.a,u=a.b,h=a.c,f=a.d,d=a.tx,m=a.ty;for(;l<o;){const _=t[n],g=t[n+1];r[s]=c*_+h*g+d,r[s+1]=u*_+f*g+m,s+=i,n+=e,l++}}function Tg(t,e,n,r){let s=0;for(e*=n;s<r;)t[e]=0,t[e+1]=0,e+=n,s++}function Vh(t,e,n,r,s){const i=e.a,o=e.b,a=e.c,l=e.d,c=e.tx,u=e.ty;n||(n=0),r||(r=2),s||(s=t.length/r-n);let h=n*r;for(let f=0;f<s;f++){const d=t[h],m=t[h+1];t[h]=i*d+a*m+c,t[h+1]=o*d+l*m+u,h+=r}}const Ag=new te;class Sa{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 e=this.baseColor,n=e>>16|e&65280|(e&255)<<16,r=this.renderable;return r?rh(n,r.groupColor)+(this.alpha*r.groupAlpha*255<<24):n+(this.alpha*255<<24)}get transform(){var e;return((e=this.renderable)==null?void 0:e.groupTransform)||Ag}copyTo(e){e.indexOffset=this.indexOffset,e.indexSize=this.indexSize,e.attributeOffset=this.attributeOffset,e.attributeSize=this.attributeSize,e.baseColor=this.baseColor,e.alpha=this.alpha,e.texture=this.texture,e.geometryData=this.geometryData,e.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 Xr={extension:{type:fe.ShapeBuilder,name:"circle"},build(t,e){let n,r,s,i,o,a;if(t.type==="circle"){const k=t;if(o=a=k.radius,o<=0)return!1;n=k.x,r=k.y,s=i=0}else if(t.type==="ellipse"){const k=t;if(o=k.halfWidth,a=k.halfHeight,o<=0||a<=0)return!1;n=k.x,r=k.y,s=i=0}else{const k=t,E=k.width/2,A=k.height/2;n=k.x+E,r=k.y+A,o=a=Math.max(0,Math.min(k.radius,Math.min(E,A))),s=E-o,i=A-a}if(s<0||i<0)return!1;const l=Math.ceil(2.3*Math.sqrt(o+a)),c=l*8+(s?4:0)+(i?4:0);if(c===0)return!1;if(l===0)return e[0]=e[6]=n+s,e[1]=e[3]=r+i,e[2]=e[4]=n-s,e[5]=e[7]=r-i,!0;let u=0,h=l*4+(s?2:0)+2,f=h,d=c,m=s+o,_=i,g=n+m,y=n-m,b=r+_;if(e[u++]=g,e[u++]=b,e[--h]=b,e[--h]=y,i){const k=r-_;e[f++]=y,e[f++]=k,e[--d]=k,e[--d]=g}for(let k=1;k<l;k++){const E=Math.PI/2*(k/l),A=s+Math.cos(E)*o,C=i+Math.sin(E)*a,j=n+A,W=n-A,O=r+C,z=r-C;e[u++]=j,e[u++]=O,e[--h]=O,e[--h]=W,e[f++]=W,e[f++]=z,e[--d]=z,e[--d]=j}m=s,_=i+a,g=n+m,y=n-m,b=r+_;const w=r-_;return e[u++]=g,e[u++]=b,e[--d]=w,e[--d]=g,s&&(e[u++]=y,e[u++]=b,e[--d]=w,e[--d]=y),!0},triangulate(t,e,n,r,s,i){if(t.length===0)return;let o=0,a=0;for(let u=0;u<t.length;u+=2)o+=t[u],a+=t[u+1];o/=t.length/2,a/=t.length/2;let l=r;e[l*n]=o,e[l*n+1]=a;const c=l++;for(let u=0;u<t.length;u+=2)e[l*n]=t[u],e[l*n+1]=t[u+1],u>0&&(s[i++]=l,s[i++]=c,s[i++]=l-1),l++;s[i++]=c+1,s[i++]=c,s[i++]=l-1}},Cg={...Xr,extension:{...Xr.extension,name:"ellipse"}},Eg={...Xr,extension:{...Xr.extension,name:"roundedRectangle"}},Hh=1e-4,pc=1e-4;function Pg(t){const e=t.length;if(e<6)return 1;let n=0;for(let r=0,s=t[e-2],i=t[e-1];r<e;r+=2){const o=t[r],a=t[r+1];n+=(o-s)*(a+i),s=o,i=a}return n<0?-1:1}function mc(t,e,n,r,s,i,o,a){const l=t-n*s,c=e-r*s,u=t+n*i,h=e+r*i;let f,d;o?(f=r,d=-n):(f=-r,d=n);const m=l+f,_=c+d,g=u+f,y=h+d;return a.push(m,_),a.push(g,y),2}function xn(t,e,n,r,s,i,o,a){const l=n-t,c=r-e;let u=Math.atan2(l,c),h=Math.atan2(s-t,i-e);a&&u<h?u+=Math.PI*2:!a&&u>h&&(h+=Math.PI*2);let f=u;const d=h-u,m=Math.abs(d),_=Math.sqrt(l*l+c*c),g=(15*m*Math.sqrt(_)/Math.PI>>0)+1,y=d/g;if(f+=y,a){o.push(t,e),o.push(n,r);for(let b=1,w=f;b<g;b++,w+=y)o.push(t,e),o.push(t+Math.sin(w)*_,e+Math.cos(w)*_);o.push(t,e),o.push(s,i)}else{o.push(n,r),o.push(t,e);for(let b=1,w=f;b<g;b++,w+=y)o.push(t+Math.sin(w)*_,e+Math.cos(w)*_),o.push(t,e);o.push(s,i),o.push(t,e)}return g*2}function Ig(t,e,n,r,s,i){const o=Hh;if(t.length===0)return;const a=e;let l=a.alignment;if(e.alignment!==.5){let re=Pg(t);l=(l-.5)*re+.5}const c=new Ue(t[0],t[1]),u=new Ue(t[t.length-2],t[t.length-1]),h=r,f=Math.abs(c.x-u.x)<o&&Math.abs(c.y-u.y)<o;if(h){t=t.slice(),f&&(t.pop(),t.pop(),u.set(t[t.length-2],t[t.length-1]));const re=(c.x+u.x)*.5,gt=(u.y+c.y)*.5;t.unshift(re,gt),t.push(re,gt)}const d=s,m=t.length/2;let _=t.length;const g=d.length/2,y=a.width/2,b=y*y,w=a.miterLimit*a.miterLimit;let k=t[0],E=t[1],A=t[2],C=t[3],j=0,W=0,O=-(E-C),z=k-A,ie=0,ce=0,ue=Math.sqrt(O*O+z*z);O/=ue,z/=ue,O*=y,z*=y;const qt=l,N=(1-qt)*2,U=qt*2;h||(a.cap==="round"?_+=xn(k-O*(N-U)*.5,E-z*(N-U)*.5,k-O*N,E-z*N,k+O*U,E+z*U,d,!0)+2:a.cap==="square"&&(_+=mc(k,E,O,z,N,U,!0,d))),d.push(k-O*N,E-z*N),d.push(k+O*U,E+z*U);for(let re=1;re<m-1;++re){k=t[(re-1)*2],E=t[(re-1)*2+1],A=t[re*2],C=t[re*2+1],j=t[(re+1)*2],W=t[(re+1)*2+1],O=-(E-C),z=k-A,ue=Math.sqrt(O*O+z*z),O/=ue,z/=ue,O*=y,z*=y,ie=-(C-W),ce=A-j,ue=Math.sqrt(ie*ie+ce*ce),ie/=ue,ce/=ue,ie*=y,ce*=y;const gt=A-k,be=E-C,Jt=A-j,ke=W-C,fr=gt*Jt+be*ke,pe=be*Jt-ke*gt,_t=pe<0;if(Math.abs(pe)<.001*Math.abs(fr)){d.push(A-O*N,C-z*N),d.push(A+O*U,C+z*U),fr>=0&&(a.join==="round"?_+=xn(A,C,A-O*N,C-z*N,A-ie*N,C-ce*N,d,!1)+4:_+=2,d.push(A-ie*U,C-ce*U),d.push(A+ie*N,C+ce*N));continue}const gn=(-O+k)*(-z+C)-(-O+A)*(-z+E),yt=(-ie+j)*(-ce+C)-(-ie+A)*(-ce+W),_n=(gt*yt-Jt*gn)/pe,Kt=(ke*gn-be*yt)/pe,On=(_n-A)*(_n-A)+(Kt-C)*(Kt-C),Ct=A+(_n-A)*N,Je=C+(Kt-C)*N,ut=A-(_n-A)*U,Ge=C-(Kt-C)*U,pr=Math.min(gt*gt+be*be,Jt*Jt+ke*ke),$n=_t?N:U,Qt=pr+$n*$n*b;On<=Qt?a.join==="bevel"||On/b>w?(_t?(d.push(Ct,Je),d.push(A+O*U,C+z*U),d.push(Ct,Je),d.push(A+ie*U,C+ce*U)):(d.push(A-O*N,C-z*N),d.push(ut,Ge),d.push(A-ie*N,C-ce*N),d.push(ut,Ge)),_+=2):a.join==="round"?_t?(d.push(Ct,Je),d.push(A+O*U,C+z*U),_+=xn(A,C,A+O*U,C+z*U,A+ie*U,C+ce*U,d,!0)+4,d.push(Ct,Je),d.push(A+ie*U,C+ce*U)):(d.push(A-O*N,C-z*N),d.push(ut,Ge),_+=xn(A,C,A-O*N,C-z*N,A-ie*N,C-ce*N,d,!1)+4,d.push(A-ie*N,C-ce*N),d.push(ut,Ge)):(d.push(Ct,Je),d.push(ut,Ge)):(d.push(A-O*N,C-z*N),d.push(A+O*U,C+z*U),a.join==="round"?_t?_+=xn(A,C,A+O*U,C+z*U,A+ie*U,C+ce*U,d,!0)+2:_+=xn(A,C,A-O*N,C-z*N,A-ie*N,C-ce*N,d,!1)+2:a.join==="miter"&&On/b<=w&&(_t?(d.push(ut,Ge),d.push(ut,Ge)):(d.push(Ct,Je),d.push(Ct,Je)),_+=2),d.push(A-ie*N,C-ce*N),d.push(A+ie*U,C+ce*U),_+=2)}k=t[(m-2)*2],E=t[(m-2)*2+1],A=t[(m-1)*2],C=t[(m-1)*2+1],O=-(E-C),z=k-A,ue=Math.sqrt(O*O+z*z),O/=ue,z/=ue,O*=y,z*=y,d.push(A-O*N,C-z*N),d.push(A+O*U,C+z*U),h||(a.cap==="round"?_+=xn(A-O*(N-U)*.5,C-z*(N-U)*.5,A-O*N,C-z*N,A+O*U,C+z*U,d,!1)+2:a.cap==="square"&&(_+=mc(A,C,O,z,N,U,!1,d)));const Xt=pc*pc;for(let re=g;re<_+g-2;++re)k=d[re*2],E=d[re*2+1],A=d[(re+1)*2],C=d[(re+1)*2+1],j=d[(re+2)*2],W=d[(re+2)*2+1],!(Math.abs(k*(C-W)+A*(W-E)+j*(E-C))<Xt)&&i.push(re,re+1,re+2)}function Mg(t,e,n,r){const s=Hh;if(t.length===0)return;const i=t[0],o=t[1],a=t[t.length-2],l=t[t.length-1],c=e||Math.abs(i-a)<s&&Math.abs(o-l)<s,u=n,h=t.length/2,f=u.length/2;for(let d=0;d<h;d++)u.push(t[d*2]),u.push(t[d*2+1]);for(let d=0;d<h-1;d++)r.push(f+d,f+d+1);c&&r.push(f+h-1,f)}function Wh(t,e,n,r,s,i,o){const a=Cm(t,e,2);if(!a)return;for(let c=0;c<a.length;c+=3)i[o++]=a[c]+s,i[o++]=a[c+1]+s,i[o++]=a[c+2]+s;let l=s*r;for(let c=0;c<t.length;c+=2)n[l]=t[c],n[l+1]=t[c+1],l+=r}const Rg=[],zg={extension:{type:fe.ShapeBuilder,name:"polygon"},build(t,e){for(let n=0;n<t.points.length;n++)e[n]=t.points[n];return!0},triangulate(t,e,n,r,s,i){Wh(t,Rg,e,n,r,s,i)}},Og={extension:{type:fe.ShapeBuilder,name:"rectangle"},build(t,e){const n=t,r=n.x,s=n.y,i=n.width,o=n.height;return i>0&&o>0?(e[0]=r,e[1]=s,e[2]=r+i,e[3]=s,e[4]=r+i,e[5]=s+o,e[6]=r,e[7]=s+o,!0):!1},triangulate(t,e,n,r,s,i){let o=0;r*=n,e[r+o]=t[0],e[r+o+1]=t[1],o+=n,e[r+o]=t[2],e[r+o+1]=t[3],o+=n,e[r+o]=t[6],e[r+o+1]=t[7],o+=n,e[r+o]=t[4],e[r+o+1]=t[5],o+=n;const a=r/n;s[i++]=a,s[i++]=a+1,s[i++]=a+2,s[i++]=a+1,s[i++]=a+3,s[i++]=a+2}},$g={extension:{type:fe.ShapeBuilder,name:"triangle"},build(t,e){return e[0]=t.x,e[1]=t.y,e[2]=t.x2,e[3]=t.y2,e[4]=t.x3,e[5]=t.y3,!0},triangulate(t,e,n,r,s,i){let o=0;r*=n,e[r+o]=t[0],e[r+o+1]=t[1],o+=n,e[r+o]=t[2],e[r+o+1]=t[3],o+=n,e[r+o]=t[4],e[r+o+1]=t[5];const a=r/n;s[i++]=a,s[i++]=a+1,s[i++]=a+2}},gc=[{offset:0,color:"white"},{offset:1,color:"black"}],Ta=class Zo{constructor(...e){this.uid=Ie("fillGradient"),this._tick=0,this.type="linear",this.colorStops=[];let n=Dg(e);n={...n.type==="radial"?Zo.defaultRadialOptions:Zo.defaultLinearOptions,...Hu(n)},this._textureSize=n.textureSize,this._wrapMode=n.wrapMode,n.type==="radial"?(this.center=n.center,this.outerCenter=n.outerCenter??this.center,this.innerRadius=n.innerRadius,this.outerRadius=n.outerRadius,this.scale=n.scale,this.rotation=n.rotation):(this.start=n.start,this.end=n.end),this.textureSpace=n.textureSpace,this.type=n.type,n.colorStops.forEach(s=>{this.addColorStop(s.offset,s.color)})}addColorStop(e,n){return this.colorStops.push({offset:e,color:Vt.shared.setValue(n).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:e,y:n}=this.start,{x:r,y:s}=this.end,i=r-e,o=s-n;const a=i<0||o<0;if(this._wrapMode==="clamp-to-edge"){if(i<0){const g=e;e=r,r=g,i*=-1}if(o<0){const g=n;n=s,s=g,o*=-1}}const l=this.colorStops.length?this.colorStops:gc,c=this._textureSize,{canvas:u,context:h}=yc(c,1),f=a?h.createLinearGradient(this._textureSize,0,0,0):h.createLinearGradient(0,0,this._textureSize,0);_c(f,l),h.fillStyle=f,h.fillRect(0,0,c,1),this.texture=new de({source:new Xs({resource:u,addressMode:this._wrapMode})});const d=Math.sqrt(i*i+o*o),m=Math.atan2(o,i),_=new te;_.scale(d/c,1),_.rotate(m),_.translate(e,n),this.textureSpace==="local"&&_.scale(c,c),this.transform=_}buildGradient(){this.texture||this._tick++,this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;const e=this.colorStops.length?this.colorStops:gc,n=this._textureSize,{canvas:r,context:s}=yc(n,n),{x:i,y:o}=this.center,{x:a,y:l}=this.outerCenter,c=this.innerRadius,u=this.outerRadius,h=a-u,f=l-u,d=n/(u*2),m=(i-h)*d,_=(o-f)*d,g=s.createRadialGradient(m,_,c*d,(a-h)*d,(l-f)*d,u*d);_c(g,e),s.fillStyle=e[e.length-1].color,s.fillRect(0,0,n,n),s.fillStyle=g,s.translate(m,_),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-m,-_),s.fillRect(0,0,n,n),this.texture=new de({source:new Xs({resource:r,addressMode:this._wrapMode})});const y=new te;y.scale(1/d,1/d),y.translate(h,f),this.textureSpace==="local"&&y.scale(n,n),this.transform=y}destroy(){var e;(e=this.texture)==null||e.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}`}};Ta.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};Ta.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};let gs=Ta;function _c(t,e){for(let n=0;n<e.length;n++){const r=e[n];t.addColorStop(r.offset,r.color)}}function yc(t,e){const n=ms.get().createCanvas(t,e),r=n.getContext("2d");return{canvas:n,context:r}}function Dg(t){let e=t[0]??{};return(typeof e=="number"||t[1])&&(ge("8.5.2","use options object instead"),e={type:"linear",start:{x:t[0],y:t[1]},end:{x:t[2],y:t[3]},textureSpace:t[4],textureSize:t[5]??gs.defaultLinearOptions.textureSize}),e}const Ng=new te,Fg=new Oe;function Lg(t,e,n,r){const s=e.matrix?t.copyFrom(e.matrix).invert():t.identity();if(e.textureSpace==="local"){const o=n.getBounds(Fg);e.width&&o.pad(e.width);const{x:a,y:l}=o,c=1/o.width,u=1/o.height,h=-a*c,f=-l*u,d=s.a,m=s.b,_=s.c,g=s.d;s.a*=c,s.b*=c,s.c*=u,s.d*=u,s.tx=h*d+f*_+s.tx,s.ty=h*m+f*g+s.ty}else s.translate(e.texture.frame.x,e.texture.frame.y),s.scale(1/e.texture.source.width,1/e.texture.source.height);const i=e.texture.source.style;return!(e.fill instanceof gs)&&i.addressMode==="clamp-to-edge"&&(i.addressMode="repeat",i.update()),r&&s.append(Ng.copyFrom(r).invert()),s}const gi={};ct.handleByMap(fe.ShapeBuilder,gi);ct.add(Og,zg,$g,Xr,Cg,Eg);const Bg=new Oe,Zg=new te;function Ug(t,e){const{geometryData:n,batches:r}=e;r.length=0,n.indices.length=0,n.vertices.length=0,n.uvs.length=0;for(let s=0;s<t.instructions.length;s++){const i=t.instructions[s];if(i.action==="texture")Gg(i.data,r,n);else if(i.action==="fill"||i.action==="stroke"){const o=i.action==="stroke",a=i.data.path.shapePath,l=i.data.style,c=i.data.hole;o&&c&&xc(c.shapePath,l,!0,r,n),c&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=c.shapePath.shapePrimitives),xc(a,l,o,r,n)}}}function Gg(t,e,n){const r=[],s=gi.rectangle,i=Bg;i.x=t.dx,i.y=t.dy,i.width=t.dw,i.height=t.dh;const o=t.transform;if(!s.build(i,r))return;const{vertices:a,uvs:l,indices:c}=n,u=c.length,h=a.length/2;o&&Vh(r,o),s.triangulate(r,a,2,h,c,u);const f=t.image,d=f.uvs;l.push(d.x0,d.y0,d.x1,d.y1,d.x3,d.y3,d.x2,d.y2);const m=nt.get(Sa);m.indexOffset=u,m.indexSize=c.length-u,m.attributeOffset=h,m.attributeSize=a.length/2-h,m.baseColor=t.style,m.alpha=t.alpha,m.texture=f,m.geometryData=n,e.push(m)}function xc(t,e,n,r,s){const{vertices:i,uvs:o,indices:a}=s;t.shapePrimitives.forEach(({shape:l,transform:c,holes:u})=>{const h=[],f=gi[l.type];if(!f.build(l,h))return;const d=a.length,m=i.length/2;let _="triangle-list";if(c&&Vh(h,c),n){const w=l.closePath??!0,k=e;k.pixelLine?(Mg(h,w,i,a),_="line-list"):Ig(h,k,!1,w,i,a)}else if(u){const w=[],k=h.slice();jg(u).forEach(A=>{w.push(k.length/2),k.push(...A)}),Wh(k,w,i,2,m,a,d)}else f.triangulate(h,i,2,m,a,d);const g=o.length/2,y=e.texture;if(y!==de.WHITE){const w=Lg(Zg,e,l,c);Sg(i,2,m,o,g,2,i.length/2-m,w)}else Tg(o,g,2,i.length/2-m);const b=nt.get(Sa);b.indexOffset=d,b.indexSize=a.length-d,b.attributeOffset=m,b.attributeSize=i.length/2-m,b.baseColor=e.color,b.alpha=e.alpha,b.texture=y,b.geometryData=s,b.topology=_,r.push(b)})}function jg(t){const e=[];for(let n=0;n<t.length;n++){const r=t[n].shape,s=[];gi[r.type].build(r,s)&&e.push(s)}return e}class Vg{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}reset(){this.batches&&this.batches.forEach(e=>{nt.return(e)}),this.graphicsData&&nt.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 Hg{constructor(){this.instructions=new ya}init(e){const n=e.maxTextures;this.batcher?this.batcher._updateMaxTextures(n):this.batcher=new kg({maxTextures:n}),this.instructions.reset()}get geometry(){return ge(Xf,"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 Aa=class Uo{constructor(e){this._renderer=e,this._managedContexts=new mi({renderer:e,type:"resource",name:"graphicsContext"})}init(e){Uo.defaultOptions.bezierSmoothness=(e==null?void 0:e.bezierSmoothness)??Uo.defaultOptions.bezierSmoothness}getContextRenderData(e){return e._gpuData[this._renderer.uid].graphicsData||this._initContextRenderData(e)}updateGpuContext(e){const n=!!e._gpuData[this._renderer.uid],r=e._gpuData[this._renderer.uid]||this._initContext(e);if(e.dirty||!n){n&&r.reset(),Ug(e,r);const s=e.batchMode;e.customShader||s==="no-batch"?r.isBatchable=!1:s==="auto"?r.isBatchable=r.geometryData.vertices.length<400:r.isBatchable=!0,e.dirty=!1}return r}getGpuContext(e){return e._gpuData[this._renderer.uid]||this._initContext(e)}_initContextRenderData(e){const n=nt.get(Hg,{maxTextures:this._renderer.limits.maxBatchableTextures}),r=e._gpuData[this._renderer.uid],{batches:s,geometryData:i}=r;r.graphicsData=n;const o=i.vertices.length,a=i.indices.length;for(let h=0;h<s.length;h++)s[h].applyTransform=!1;const l=n.batcher;l.ensureAttributeBuffer(o),l.ensureIndexBuffer(a),l.begin();for(let h=0;h<s.length;h++){const f=s[h];l.add(f)}l.finish(n.instructions);const c=l.geometry;c.indexBuffer.setDataWithSize(l.indexBuffer,l.indexSize,!0),c.buffers[0].setDataWithSize(l.attributeBuffer.float32View,l.attributeSize,!0);const u=l.batches;for(let h=0;h<u.length;h++){const f=u[h];f.bindGroup=$m(f.textures.textures,f.textures.count,this._renderer.limits.maxBatchableTextures)}return n}_initContext(e){const n=new Vg;return n.context=e,e._gpuData[this._renderer.uid]=n,this._managedContexts.add(e),n}destroy(){this._managedContexts.destroy(),this._renderer=null}};Aa.extension={type:[fe.WebGLSystem,fe.WebGPUSystem],name:"graphicsContext"};Aa.defaultOptions={bezierSmoothness:.5};let Ca=Aa;const Wg=8,$s=11920929e-14,Yg=1;function Yh(t,e,n,r,s,i,o,a,l,c){const h=Math.min(.99,Math.max(0,c??Ca.defaultOptions.bezierSmoothness));let f=(Yg-h)/1;return f*=f,qg(e,n,r,s,i,o,a,l,t,f),t}function qg(t,e,n,r,s,i,o,a,l,c){Go(t,e,n,r,s,i,o,a,l,c,0),l.push(o,a)}function Go(t,e,n,r,s,i,o,a,l,c,u){if(u>Wg)return;const h=(t+n)/2,f=(e+r)/2,d=(n+s)/2,m=(r+i)/2,_=(s+o)/2,g=(i+a)/2,y=(h+d)/2,b=(f+m)/2,w=(d+_)/2,k=(m+g)/2,E=(y+w)/2,A=(b+k)/2;if(u>0){let C=o-t,j=a-e;const W=Math.abs((n-o)*j-(r-a)*C),O=Math.abs((s-o)*j-(i-a)*C);if(W>$s&&O>$s){if((W+O)*(W+O)<=c*(C*C+j*j)){l.push(E,A);return}}else if(W>$s){if(W*W<=c*(C*C+j*j)){l.push(E,A);return}}else if(O>$s){if(O*O<=c*(C*C+j*j)){l.push(E,A);return}}else if(C=E-(t+o)/2,j=A-(e+a)/2,C*C+j*j<=c){l.push(E,A);return}}Go(t,e,h,f,y,b,E,A,l,c,u+1),Go(E,A,w,k,_,g,o,a,l,c,u+1)}const Xg=8,Jg=11920929e-14,Kg=1;function Qg(t,e,n,r,s,i,o,a){const c=Math.min(.99,Math.max(0,a??Ca.defaultOptions.bezierSmoothness));let u=(Kg-c)/1;return u*=u,e_(e,n,r,s,i,o,t,u),t}function e_(t,e,n,r,s,i,o,a){jo(o,t,e,n,r,s,i,a,0),o.push(s,i)}function jo(t,e,n,r,s,i,o,a,l){if(l>Xg)return;const c=(e+r)/2,u=(n+s)/2,h=(r+i)/2,f=(s+o)/2,d=(c+h)/2,m=(u+f)/2;let _=i-e,g=o-n;const y=Math.abs((r-i)*g-(s-o)*_);if(y>Jg){if(y*y<=a*(_*_+g*g)){t.push(d,m);return}}else if(_=d-(e+i)/2,g=m-(n+o)/2,_*_+g*g<=a){t.push(d,m);return}jo(t,e,n,c,u,d,m,a,l+1),jo(t,d,m,h,f,i,o,a,l+1)}function qh(t,e,n,r,s,i,o,a){let l=Math.abs(s-i);(!o&&s>i||o&&i>s)&&(l=2*Math.PI-l),a||(a=Math.max(6,Math.floor(6*Math.pow(r,1/3)*(l/Math.PI)))),a=Math.max(a,3);let c=l/a,u=s;c*=o?-1:1;for(let h=0;h<a+1;h++){const f=Math.cos(u),d=Math.sin(u),m=e+f*r,_=n+d*r;t.push(m,_),u+=c}}function t_(t,e,n,r,s,i){const o=t[t.length-2],l=t[t.length-1]-n,c=o-e,u=s-n,h=r-e,f=Math.abs(l*h-c*u);if(f<1e-8||i===0){(t[t.length-2]!==e||t[t.length-1]!==n)&&t.push(e,n);return}const d=l*l+c*c,m=u*u+h*h,_=l*u+c*h,g=i*Math.sqrt(d)/f,y=i*Math.sqrt(m)/f,b=g*_/d,w=y*_/m,k=g*h+y*c,E=g*u+y*l,A=c*(y+b),C=l*(y+b),j=h*(g+w),W=u*(g+w),O=Math.atan2(C-E,A-k),z=Math.atan2(W-E,j-k);qh(t,k+e,E+n,i,O,z,c*u>h*l)}const Gr=Math.PI*2,ao={centerX:0,centerY:0,ang1:0,ang2:0},lo=({x:t,y:e},n,r,s,i,o,a,l)=>{t*=n,e*=r;const c=s*t-i*e,u=i*t+s*e;return l.x=c+o,l.y=u+a,l};function n_(t,e){const n=e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),r=e===1.5707963267948966?.551915024494:n,s=Math.cos(t),i=Math.sin(t),o=Math.cos(t+e),a=Math.sin(t+e);return[{x:s-i*r,y:i+s*r},{x:o+a*r,y:a-o*r},{x:o,y:a}]}const bc=(t,e,n,r)=>{const s=t*r-e*n<0?-1:1;let i=t*n+e*r;return i>1&&(i=1),i<-1&&(i=-1),s*Math.acos(i)},r_=(t,e,n,r,s,i,o,a,l,c,u,h,f)=>{const d=Math.pow(s,2),m=Math.pow(i,2),_=Math.pow(u,2),g=Math.pow(h,2);let y=d*m-d*g-m*_;y<0&&(y=0),y/=d*g+m*_,y=Math.sqrt(y)*(o===a?-1:1);const b=y*s/i*h,w=y*-i/s*u,k=c*b-l*w+(t+n)/2,E=l*b+c*w+(e+r)/2,A=(u-b)/s,C=(h-w)/i,j=(-u-b)/s,W=(-h-w)/i,O=bc(1,0,A,C);let z=bc(A,C,j,W);a===0&&z>0&&(z-=Gr),a===1&&z<0&&(z+=Gr),f.centerX=k,f.centerY=E,f.ang1=O,f.ang2=z};function s_(t,e,n,r,s,i,o,a=0,l=0,c=0){if(i===0||o===0)return;const u=Math.sin(a*Gr/360),h=Math.cos(a*Gr/360),f=h*(e-r)/2+u*(n-s)/2,d=-u*(e-r)/2+h*(n-s)/2;if(f===0&&d===0)return;i=Math.abs(i),o=Math.abs(o);const m=Math.pow(f,2)/Math.pow(i,2)+Math.pow(d,2)/Math.pow(o,2);m>1&&(i*=Math.sqrt(m),o*=Math.sqrt(m)),r_(e,n,r,s,i,o,l,c,u,h,f,d,ao);let{ang1:_,ang2:g}=ao;const{centerX:y,centerY:b}=ao;let w=Math.abs(g)/(Gr/4);Math.abs(1-w)<1e-7&&(w=1);const k=Math.max(Math.ceil(w),1);g/=k;let E=t[t.length-2],A=t[t.length-1];const C={x:0,y:0};for(let j=0;j<k;j++){const W=n_(_,g),{x:O,y:z}=lo(W[0],i,o,h,u,y,b,C),{x:ie,y:ce}=lo(W[1],i,o,h,u,y,b,C),{x:ue,y:qt}=lo(W[2],i,o,h,u,y,b,C);Yh(t,E,A,O,z,ie,ce,ue,qt),E=ue,A=qt,_+=g}}function i_(t,e,n){const r=(o,a)=>{const l=a.x-o.x,c=a.y-o.y,u=Math.sqrt(l*l+c*c),h=l/u,f=c/u;return{len:u,nx:h,ny:f}},s=(o,a)=>{o===0?t.moveTo(a.x,a.y):t.lineTo(a.x,a.y)};let i=e[e.length-1];for(let o=0;o<e.length;o++){const a=e[o%e.length],l=a.radius??n;if(l<=0){s(o,a),i=a;continue}const c=e[(o+1)%e.length],u=r(a,i),h=r(a,c);if(u.len<1e-4||h.len<1e-4){s(o,a),i=a;continue}let f=Math.asin(u.nx*h.ny-u.ny*h.nx),d=1,m=!1;u.nx*h.nx-u.ny*-h.ny<0?f<0?f=Math.PI+f:(f=Math.PI-f,d=-1,m=!0):f>0&&(d=-1,m=!0);const _=f/2;let g,y=Math.abs(Math.cos(_)*l/Math.sin(_));y>Math.min(u.len/2,h.len/2)?(y=Math.min(u.len/2,h.len/2),g=Math.abs(y*Math.sin(_)/Math.cos(_))):g=l;const b=a.x+h.nx*y+-h.ny*g*d,w=a.y+h.ny*y+h.nx*g*d,k=Math.atan2(u.ny,u.nx)+Math.PI/2*d,E=Math.atan2(h.ny,h.nx)-Math.PI/2*d;o===0&&t.moveTo(b+Math.cos(k)*g,w+Math.sin(k)*g),t.arc(b,w,g,k,E,m),i=a}}function o_(t,e,n,r){const s=(a,l)=>Math.sqrt((a.x-l.x)**2+(a.y-l.y)**2),i=(a,l,c)=>({x:a.x+(l.x-a.x)*c,y:a.y+(l.y-a.y)*c}),o=e.length;for(let a=0;a<o;a++){const l=e[(a+1)%o],c=l.radius??n;if(c<=0){a===0?t.moveTo(l.x,l.y):t.lineTo(l.x,l.y);continue}const u=e[a],h=e[(a+2)%o],f=s(u,l);let d;if(f<1e-4)d=l;else{const g=Math.min(f/2,c);d=i(l,u,g/f)}const m=s(h,l);let _;if(m<1e-4)_=l;else{const g=Math.min(m/2,c);_=i(l,h,g/m)}a===0?t.moveTo(d.x,d.y):t.lineTo(d.x,d.y),t.quadraticCurveTo(l.x,l.y,_.x,_.y,r)}}const a_=new Oe;class l_{constructor(e){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new St,this._graphicsPath2D=e,this.signed=e.checkForHoles}moveTo(e,n){return this.startPoly(e,n),this}lineTo(e,n){this._ensurePoly();const r=this._currentPoly.points,s=r[r.length-2],i=r[r.length-1];return(s!==e||i!==n)&&r.push(e,n),this}arc(e,n,r,s,i,o){this._ensurePoly(!1);const a=this._currentPoly.points;return qh(a,e,n,r,s,i,o),this}arcTo(e,n,r,s,i){this._ensurePoly();const o=this._currentPoly.points;return t_(o,e,n,r,s,i),this}arcToSvg(e,n,r,s,i,o,a){const l=this._currentPoly.points;return s_(l,this._currentPoly.lastX,this._currentPoly.lastY,o,a,e,n,r,s,i),this}bezierCurveTo(e,n,r,s,i,o,a){this._ensurePoly();const l=this._currentPoly;return Yh(this._currentPoly.points,l.lastX,l.lastY,e,n,r,s,i,o,a),this}quadraticCurveTo(e,n,r,s,i){this._ensurePoly();const o=this._currentPoly;return Qg(this._currentPoly.points,o.lastX,o.lastY,e,n,r,s,i),this}closePath(){return this.endPoly(!0),this}addPath(e,n){this.endPoly(),n&&!n.isIdentity()&&(e=e.clone(!0),e.transform(n));const r=this.shapePrimitives,s=r.length;for(let i=0;i<e.instructions.length;i++){const o=e.instructions[i];this[o.action](...o.data)}if(e.checkForHoles&&r.length-s>1){let i=null;for(let o=s;o<r.length;o++){const a=r[o];if(a.shape.type==="polygon"){const l=a.shape,c=i==null?void 0:i.shape;c&&c.containsPolygon(l)?(i.holes||(i.holes=[]),i.holes.push(a),r.copyWithin(o,o+1),r.length--,o--):i=a}}}return this}finish(e=!1){this.endPoly(e)}rect(e,n,r,s,i){return this.drawShape(new Oe(e,n,r,s),i),this}circle(e,n,r,s){return this.drawShape(new va(e,n,r),s),this}poly(e,n,r){const s=new Zr(e);return s.closePath=n,this.drawShape(s,r),this}regularPoly(e,n,r,s,i=0,o){s=Math.max(s|0,3);const a=-1*Math.PI/2+i,l=Math.PI*2/s,c=[];for(let u=0;u<s;u++){const h=a-u*l;c.push(e+r*Math.cos(h),n+r*Math.sin(h))}return this.poly(c,!0,o),this}roundPoly(e,n,r,s,i,o=0,a){if(s=Math.max(s|0,3),i<=0)return this.regularPoly(e,n,r,s,o);const l=r*Math.sin(Math.PI/s)-.001;i=Math.min(i,l);const c=-1*Math.PI/2+o,u=Math.PI*2/s,h=(s-2)*Math.PI/s/2;for(let f=0;f<s;f++){const d=f*u+c,m=e+r*Math.cos(d),_=n+r*Math.sin(d),g=d+Math.PI+h,y=d-Math.PI-h,b=m+i*Math.cos(g),w=_+i*Math.sin(g),k=m+i*Math.cos(y),E=_+i*Math.sin(y);f===0?this.moveTo(b,w):this.lineTo(b,w),this.quadraticCurveTo(m,_,k,E,a)}return this.closePath()}roundShape(e,n,r=!1,s){return e.length<3?this:(r?o_(this,e,n,s):i_(this,e,n),this.closePath())}filletRect(e,n,r,s,i){if(i===0)return this.rect(e,n,r,s);const o=Math.min(r,s)/2,a=Math.min(o,Math.max(-o,i)),l=e+r,c=n+s,u=a<0?-a:0,h=Math.abs(a);return this.moveTo(e,n+h).arcTo(e+u,n+u,e+h,n,h).lineTo(l-h,n).arcTo(l-u,n+u,l,n+h,h).lineTo(l,c-h).arcTo(l-u,c-u,e+r-h,c,h).lineTo(e+h,c).arcTo(e+u,c-u,e,c-h,h).closePath()}chamferRect(e,n,r,s,i,o){if(i<=0)return this.rect(e,n,r,s);const a=Math.min(i,Math.min(r,s)/2),l=e+r,c=n+s,u=[e+a,n,l-a,n,l,n+a,l,c-a,l-a,c,e+a,c,e,c-a,e,n+a];for(let h=u.length-1;h>=2;h-=2)u[h]===u[h-2]&&u[h-1]===u[h-3]&&u.splice(h-1,2);return this.poly(u,!0,o)}ellipse(e,n,r,s,i){return this.drawShape(new wa(e,n,r,s),i),this}roundRect(e,n,r,s,i,o){return this.drawShape(new ka(e,n,r,s,i),o),this}drawShape(e,n){return this.endPoly(),this.shapePrimitives.push({shape:e,transform:n}),this}startPoly(e,n){let r=this._currentPoly;return r&&this.endPoly(),r=new Zr,r.points.push(e,n),this._currentPoly=r,this}endPoly(e=!1){const n=this._currentPoly;return n&&n.points.length>2&&(n.closePath=e,this.shapePrimitives.push({shape:n})),this._currentPoly=null,this}_ensurePoly(e=!0){if(!this._currentPoly&&(this._currentPoly=new Zr,e)){const n=this.shapePrimitives[this.shapePrimitives.length-1];if(n){let r=n.shape.x,s=n.shape.y;if(n.transform&&!n.transform.isIdentity()){const i=n.transform,o=r;r=i.a*r+i.c*s+i.tx,s=i.b*o+i.d*s+i.ty}this._currentPoly.points.push(r,s)}else this._currentPoly.points.push(0,0)}}buildPath(){const e=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let n=0;n<e.instructions.length;n++){const r=e.instructions[n];this[r.action](...r.data)}this.finish()}get bounds(){const e=this._bounds;e.clear();const n=this.shapePrimitives;for(let r=0;r<n.length;r++){const s=n[r],i=s.shape.getBounds(a_);s.transform?e.addRect(i,s.transform):e.addRect(i)}return e}}class jt{constructor(e,n=!1){this.instructions=[],this.uid=Ie("graphicsPath"),this._dirty=!0,this.checkForHoles=n,typeof e=="string"?Mm(e,this):this.instructions=(e==null?void 0:e.slice())??[]}get shapePath(){return this._shapePath||(this._shapePath=new l_(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(e,n){return e=e.clone(),this.instructions.push({action:"addPath",data:[e,n]}),this._dirty=!0,this}arc(...e){return this.instructions.push({action:"arc",data:e}),this._dirty=!0,this}arcTo(...e){return this.instructions.push({action:"arcTo",data:e}),this._dirty=!0,this}arcToSvg(...e){return this.instructions.push({action:"arcToSvg",data:e}),this._dirty=!0,this}bezierCurveTo(...e){return this.instructions.push({action:"bezierCurveTo",data:e}),this._dirty=!0,this}bezierCurveToShort(e,n,r,s,i){const o=this.instructions[this.instructions.length-1],a=this.getLastPoint(Ue.shared);let l=0,c=0;if(!o||o.action!=="bezierCurveTo")l=a.x,c=a.y;else{l=o.data[2],c=o.data[3];const u=a.x,h=a.y;l=u+(u-l),c=h+(h-c)}return this.instructions.push({action:"bezierCurveTo",data:[l,c,e,n,r,s,i]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...e){return this.instructions.push({action:"ellipse",data:e}),this._dirty=!0,this}lineTo(...e){return this.instructions.push({action:"lineTo",data:e}),this._dirty=!0,this}moveTo(...e){return this.instructions.push({action:"moveTo",data:e}),this}quadraticCurveTo(...e){return this.instructions.push({action:"quadraticCurveTo",data:e}),this._dirty=!0,this}quadraticCurveToShort(e,n,r){const s=this.instructions[this.instructions.length-1],i=this.getLastPoint(Ue.shared);let o=0,a=0;if(!s||s.action!=="quadraticCurveTo")o=i.x,a=i.y;else{o=s.data[0],a=s.data[1];const l=i.x,c=i.y;o=l+(l-o),a=c+(c-a)}return this.instructions.push({action:"quadraticCurveTo",data:[o,a,e,n,r]}),this._dirty=!0,this}rect(e,n,r,s,i){return this.instructions.push({action:"rect",data:[e,n,r,s,i]}),this._dirty=!0,this}circle(e,n,r,s){return this.instructions.push({action:"circle",data:[e,n,r,s]}),this._dirty=!0,this}roundRect(...e){return this.instructions.push({action:"roundRect",data:e}),this._dirty=!0,this}poly(...e){return this.instructions.push({action:"poly",data:e}),this._dirty=!0,this}regularPoly(...e){return this.instructions.push({action:"regularPoly",data:e}),this._dirty=!0,this}roundPoly(...e){return this.instructions.push({action:"roundPoly",data:e}),this._dirty=!0,this}roundShape(...e){return this.instructions.push({action:"roundShape",data:e}),this._dirty=!0,this}filletRect(...e){return this.instructions.push({action:"filletRect",data:e}),this._dirty=!0,this}chamferRect(...e){return this.instructions.push({action:"chamferRect",data:e}),this._dirty=!0,this}star(e,n,r,s,i,o,a){i||(i=s/2);const l=-1*Math.PI/2+o,c=r*2,u=Math.PI*2/c,h=[];for(let f=0;f<c;f++){const d=f%2?i:s,m=f*u+l;h.push(e+d*Math.cos(m),n+d*Math.sin(m))}return this.poly(h,!0,a),this}clone(e=!1){const n=new jt;if(n.checkForHoles=this.checkForHoles,!e)n.instructions=this.instructions.slice();else for(let r=0;r<this.instructions.length;r++){const s=this.instructions[r];n.instructions.push({action:s.action,data:s.data.slice()})}return n}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(e){if(e.isIdentity())return this;const n=e.a,r=e.b,s=e.c,i=e.d,o=e.tx,a=e.ty;let l=0,c=0,u=0,h=0,f=0,d=0,m=0,_=0;for(let g=0;g<this.instructions.length;g++){const y=this.instructions[g],b=y.data;switch(y.action){case"moveTo":case"lineTo":l=b[0],c=b[1],b[0]=n*l+s*c+o,b[1]=r*l+i*c+a;break;case"bezierCurveTo":u=b[0],h=b[1],f=b[2],d=b[3],l=b[4],c=b[5],b[0]=n*u+s*h+o,b[1]=r*u+i*h+a,b[2]=n*f+s*d+o,b[3]=r*f+i*d+a,b[4]=n*l+s*c+o,b[5]=r*l+i*c+a;break;case"quadraticCurveTo":u=b[0],h=b[1],l=b[2],c=b[3],b[0]=n*u+s*h+o,b[1]=r*u+i*h+a,b[2]=n*l+s*c+o,b[3]=r*l+i*c+a;break;case"arcToSvg":l=b[5],c=b[6],m=b[0],_=b[1],b[0]=n*m+s*_,b[1]=r*m+i*_,b[5]=n*l+s*c+o,b[6]=r*l+i*c+a;break;case"circle":b[4]=kr(b[3],e);break;case"rect":b[4]=kr(b[4],e);break;case"ellipse":b[8]=kr(b[8],e);break;case"roundRect":b[5]=kr(b[5],e);break;case"addPath":b[0].transform(e);break;case"poly":b[2]=kr(b[2],e);break;default:lt("unknown transform action",y.action);break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(e){let n=this.instructions.length-1,r=this.instructions[n];if(!r)return e.x=0,e.y=0,e;for(;r.action==="closePath";){if(n--,n<0)return e.x=0,e.y=0,e;r=this.instructions[n]}switch(r.action){case"moveTo":case"lineTo":e.x=r.data[0],e.y=r.data[1];break;case"quadraticCurveTo":e.x=r.data[2],e.y=r.data[3];break;case"bezierCurveTo":e.x=r.data[4],e.y=r.data[5];break;case"arc":case"arcToSvg":e.x=r.data[5],e.y=r.data[6];break;case"addPath":r.data[0].getLastPoint(e);break}return e}}function kr(t,e){return t?t.prepend(e):e.clone()}function Ae(t,e,n){const r=t.getAttribute(e);return r?Number(r):n}function c_(t,e){const n=t.querySelectorAll("defs");for(let r=0;r<n.length;r++){const s=n[r];for(let i=0;i<s.children.length;i++){const o=s.children[i];switch(o.nodeName.toLowerCase()){case"lineargradient":e.defs[o.id]=u_(o);break;case"radialgradient":e.defs[o.id]=h_();break}}}}function u_(t){const e=Ae(t,"x1",0),n=Ae(t,"y1",0),r=Ae(t,"x2",1),s=Ae(t,"y2",0),i=t.getAttribute("gradientUnits")||"objectBoundingBox",o=new gs(e,n,r,s,i==="objectBoundingBox"?"local":"global");for(let a=0;a<t.children.length;a++){const l=t.children[a],c=Ae(l,"offset",0),u=Vt.shared.setValue(l.getAttribute("stop-color")).toNumber();o.addColorStop(c,u)}return o}function h_(t){return lt("[SVG Parser] Radial gradients are not yet supported"),new gs(0,0,1,0)}function vc(t){const e=t.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return e?e[1]:""}const wc={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 Xh(t,e){const n=t.getAttribute("style"),r={},s={},i={strokeStyle:r,fillStyle:s,useFill:!1,useStroke:!1};for(const o in wc){const a=t.getAttribute(o);a&&kc(e,i,o,a.trim())}if(n){const o=n.split(";");for(let a=0;a<o.length;a++){const l=o[a].trim(),[c,u]=l.split(":");wc[c]&&kc(e,i,c,u.trim())}}return{strokeStyle:i.useStroke?r:null,fillStyle:i.useFill?s:null,useFill:i.useFill,useStroke:i.useStroke}}function kc(t,e,n,r){switch(n){case"stroke":if(r!=="none"){if(r.startsWith("url(")){const s=vc(r);e.strokeStyle.fill=t.defs[s]}else e.strokeStyle.color=Vt.shared.setValue(r).toNumber();e.useStroke=!0}break;case"stroke-width":e.strokeStyle.width=Number(r);break;case"fill":if(r!=="none"){if(r.startsWith("url(")){const s=vc(r);e.fillStyle.fill=t.defs[s]}else e.fillStyle.color=Vt.shared.setValue(r).toNumber();e.useFill=!0}break;case"fill-opacity":e.fillStyle.alpha=Number(r);break;case"stroke-opacity":e.strokeStyle.alpha=Number(r);break;case"opacity":e.fillStyle.alpha=Number(r),e.strokeStyle.alpha=Number(r);break}}function d_(t){if(t.length<=2)return!0;const e=t.map(a=>a.area).sort((a,l)=>l-a),[n,r]=e,s=e[e.length-1],i=n/r,o=r/s;return!(i>3&&o<2)}function f_(t){return t.split(/(?=[Mm])/).filter(r=>r.trim().length>0)}function p_(t){const e=t.match(/[-+]?[0-9]*\.?[0-9]+/g);if(!e||e.length<4)return 0;const n=e.map(Number),r=[],s=[];for(let u=0;u<n.length;u+=2)u+1<n.length&&(r.push(n[u]),s.push(n[u+1]));if(r.length===0||s.length===0)return 0;const i=Math.min(...r),o=Math.max(...r),a=Math.min(...s),l=Math.max(...s);return(o-i)*(l-a)}function Sc(t,e){const n=new jt(t,!1);for(const r of n.instructions)e.instructions.push(r)}function m_(t,e){if(typeof t=="string"){const o=document.createElement("div");o.innerHTML=t.trim(),t=o.querySelector("svg")}const n={context:e,defs:{},path:new jt};c_(t,n);const r=t.children,{fillStyle:s,strokeStyle:i}=Xh(t,n);for(let o=0;o<r.length;o++){const a=r[o];a.nodeName.toLowerCase()!=="defs"&&Jh(a,n,s,i)}return e}function Jh(t,e,n,r){const s=t.children,{fillStyle:i,strokeStyle:o}=Xh(t,e);i&&n?n={...n,...i}:i&&(n=i),o&&r?r={...r,...o}:o&&(r=o);const a=!n&&!r;a&&(n={color:0});let l,c,u,h,f,d,m,_,g,y,b,w,k,E,A,C,j;switch(t.nodeName.toLowerCase()){case"path":{E=t.getAttribute("d");const W=t.getAttribute("fill-rule"),O=f_(E),z=W==="evenodd",ie=O.length>1;if(z&&ie){const ue=O.map(N=>({path:N,area:p_(N)}));if(ue.sort((N,U)=>U.area-N.area),O.length>3||!d_(ue))for(let N=0;N<ue.length;N++){const U=ue[N],Xt=N===0;e.context.beginPath();const re=new jt(void 0,!0);Sc(U.path,re),e.context.path(re),Xt?(n&&e.context.fill(n),r&&e.context.stroke(r)):e.context.cut()}else for(let N=0;N<ue.length;N++){const U=ue[N],Xt=N%2===1;e.context.beginPath();const re=new jt(void 0,!0);Sc(U.path,re),e.context.path(re),Xt?e.context.cut():(n&&e.context.fill(n),r&&e.context.stroke(r))}}else{const ue=W?W==="evenodd":!0;A=new jt(E,ue),e.context.path(A),n&&e.context.fill(n),r&&e.context.stroke(r)}break}case"circle":m=Ae(t,"cx",0),_=Ae(t,"cy",0),g=Ae(t,"r",0),e.context.ellipse(m,_,g,g),n&&e.context.fill(n),r&&e.context.stroke(r);break;case"rect":l=Ae(t,"x",0),c=Ae(t,"y",0),C=Ae(t,"width",0),j=Ae(t,"height",0),y=Ae(t,"rx",0),b=Ae(t,"ry",0),y||b?e.context.roundRect(l,c,C,j,y||b):e.context.rect(l,c,C,j),n&&e.context.fill(n),r&&e.context.stroke(r);break;case"ellipse":m=Ae(t,"cx",0),_=Ae(t,"cy",0),y=Ae(t,"rx",0),b=Ae(t,"ry",0),e.context.beginPath(),e.context.ellipse(m,_,y,b),n&&e.context.fill(n),r&&e.context.stroke(r);break;case"line":u=Ae(t,"x1",0),h=Ae(t,"y1",0),f=Ae(t,"x2",0),d=Ae(t,"y2",0),e.context.beginPath(),e.context.moveTo(u,h),e.context.lineTo(f,d),r&&e.context.stroke(r);break;case"polygon":k=t.getAttribute("points"),w=k.match(/-?\d+/g).map(W=>parseInt(W,10)),e.context.poly(w,!0),n&&e.context.fill(n),r&&e.context.stroke(r);break;case"polyline":k=t.getAttribute("points"),w=k.match(/-?\d+/g).map(W=>parseInt(W,10)),e.context.poly(w,!1),r&&e.context.stroke(r);break;case"g":case"svg":break;default:{lt(`[SVG parser] <${t.nodeName}> elements unsupported`);break}}a&&(n=null);for(let W=0;W<s.length;W++)Jh(s[W],e,n,r)}const Tc={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 g_{constructor(e,n){this.uid=Ie("fillPattern"),this._tick=0,this.transform=new te,this.texture=e,this.transform.scale(1/e.frame.width,1/e.frame.height),n&&(e.source.style.addressModeU=Tc[n].addressModeU,e.source.style.addressModeV=Tc[n].addressModeV)}setTransform(e){const n=this.texture;this.transform.copyFrom(e),this.transform.invert(),this.transform.scale(1/n.frame.width,1/n.frame.height),this._tick++}get texture(){return this._texture}set texture(e){this._texture!==e&&(this._texture=e,this._tick++)}get styleKey(){return`fill-pattern-${this.uid}-${this._tick}`}destroy(){this.texture.destroy(!0),this.texture=null}}function __(t){return Vt.isColorLike(t)}function Ac(t){return t instanceof g_}function Cc(t){return t instanceof gs}function y_(t){return t instanceof de}function x_(t,e,n){const r=Vt.shared.setValue(e??0);return t.color=r.toNumber(),t.alpha=r.alpha===1?n.alpha:r.alpha,t.texture=de.WHITE,{...n,...t}}function b_(t,e,n){return t.texture=e,{...n,...t}}function Ec(t,e,n){return t.fill=e,t.color=16777215,t.texture=e.texture,t.matrix=e.transform,{...n,...t}}function Pc(t,e,n){return e.buildGradient(),t.fill=e,t.color=16777215,t.texture=e.texture,t.matrix=e.transform,t.textureSpace=e.textureSpace,{...n,...t}}function v_(t,e){const n={...e,...t},r=Vt.shared.setValue(n.color);return n.alpha*=r.alpha,n.color=r.toNumber(),n}function $r(t,e){if(t==null)return null;const n={},r=t;return __(t)?x_(n,t,e):y_(t)?b_(n,t,e):Ac(t)?Ec(n,t,e):Cc(t)?Pc(n,t,e):r.fill&&Ac(r.fill)?Ec(r,r.fill,e):r.fill&&Cc(r.fill)?Pc(r,r.fill,e):v_(r,e)}function Ic(t,e){const{width:n,alignment:r,miterLimit:s,cap:i,join:o,pixelLine:a,...l}=e,c=$r(t,l);return c?{width:n,alignment:r,miterLimit:s,cap:i,join:o,pixelLine:a,...c}:null}function w_(t,e){let n=1;const r=t.shapePath.shapePrimitives;for(let s=0;s<r.length;s++){const i=r[s].shape;if(i.type!=="polygon")continue;const o=i.points,a=o.length;if(a<6)continue;const l=i.closePath;for(let c=0;c<a;c+=2){if(!l&&(c===0||c===a-2))continue;const u=(c-2+a)%a,h=(c+2)%a,f=o[u],d=o[u+1],m=o[c],_=o[c+1],g=o[h],y=o[h+1],b=f-m,w=d-_,k=g-m,E=y-_,A=b*b+w*w,C=k*k+E*E;if(A<1e-12||C<1e-12)continue;let O=(b*k+w*E)/Math.sqrt(A*C);O<-1?O=-1:O>1&&(O=1);const z=Math.sqrt((1-O)*.5);if(z<1e-6)continue;const ie=Math.min(1/z,e);ie>n&&(n=ie)}}return n}const k_=new Ue,Mc=new te,Ea=class Mt extends fn{constructor(){super(...arguments),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=Ie("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this.destroyed=!1,this._activePath=new jt,this._transform=new te,this._fillStyle={...Mt.defaultFillStyle},this._strokeStyle={...Mt.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new St,this._boundsDirty=!0}clone(){const e=new Mt;return e.batchMode=this.batchMode,e.instructions=this.instructions.slice(),e._activePath=this._activePath.clone(),e._transform=this._transform.clone(),e._fillStyle={...this._fillStyle},e._strokeStyle={...this._strokeStyle},e._stateStack=this._stateStack.slice(),e._bounds=this._bounds.clone(),e._boundsDirty=!0,e}get fillStyle(){return this._fillStyle}set fillStyle(e){this._fillStyle=$r(e,Mt.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(e){this._strokeStyle=Ic(e,Mt.defaultStrokeStyle)}setFillStyle(e){return this._fillStyle=$r(e,Mt.defaultFillStyle),this}setStrokeStyle(e){return this._strokeStyle=$r(e,Mt.defaultStrokeStyle),this}texture(e,n,r,s,i,o){return this.instructions.push({action:"texture",data:{image:e,dx:r||0,dy:s||0,dw:i||e.frame.width,dh:o||e.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:n||n===0?Vt.shared.setValue(n).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new jt,this}fill(e,n){let r;const s=this.instructions[this.instructions.length-1];return this._tick===0&&(s==null?void 0:s.action)==="stroke"?r=s.data.path:r=this._activePath.clone(),r?(e!=null&&(n!==void 0&&typeof e=="number"&&(ge(Ze,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),e={color:e,alpha:n}),this._fillStyle=$r(e,Mt.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){const{x:e,y:n}=this._activePath.getLastPoint(Ue.shared);this._activePath.clear(),this._activePath.moveTo(e,n)}stroke(e){let n;const r=this.instructions[this.instructions.length-1];return this._tick===0&&(r==null?void 0:r.action)==="fill"?n=r.data.path:n=this._activePath.clone(),n?(e!=null&&(this._strokeStyle=Ic(e,Mt.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:n}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let e=0;e<2;e++){const n=this.instructions[this.instructions.length-1-e],r=this._activePath.clone();if(n&&(n.action==="stroke"||n.action==="fill"))if(n.data.hole)n.data.hole.addPath(r);else{n.data.hole=r;break}}return this._initNextPathLocation(),this}arc(e,n,r,s,i,o){this._tick++;const a=this._transform;return this._activePath.arc(a.a*e+a.c*n+a.tx,a.b*e+a.d*n+a.ty,r,s,i,o),this}arcTo(e,n,r,s,i){this._tick++;const o=this._transform;return this._activePath.arcTo(o.a*e+o.c*n+o.tx,o.b*e+o.d*n+o.ty,o.a*r+o.c*s+o.tx,o.b*r+o.d*s+o.ty,i),this}arcToSvg(e,n,r,s,i,o,a){this._tick++;const l=this._transform;return this._activePath.arcToSvg(e,n,r,s,i,l.a*o+l.c*a+l.tx,l.b*o+l.d*a+l.ty),this}bezierCurveTo(e,n,r,s,i,o,a){this._tick++;const l=this._transform;return this._activePath.bezierCurveTo(l.a*e+l.c*n+l.tx,l.b*e+l.d*n+l.ty,l.a*r+l.c*s+l.tx,l.b*r+l.d*s+l.ty,l.a*i+l.c*o+l.tx,l.b*i+l.d*o+l.ty,a),this}closePath(){var e;return this._tick++,(e=this._activePath)==null||e.closePath(),this}ellipse(e,n,r,s){return this._tick++,this._activePath.ellipse(e,n,r,s,this._transform.clone()),this}circle(e,n,r){return this._tick++,this._activePath.circle(e,n,r,this._transform.clone()),this}path(e){return this._tick++,this._activePath.addPath(e,this._transform.clone()),this}lineTo(e,n){this._tick++;const r=this._transform;return this._activePath.lineTo(r.a*e+r.c*n+r.tx,r.b*e+r.d*n+r.ty),this}moveTo(e,n){this._tick++;const r=this._transform,s=this._activePath.instructions,i=r.a*e+r.c*n+r.tx,o=r.b*e+r.d*n+r.ty;return s.length===1&&s[0].action==="moveTo"?(s[0].data[0]=i,s[0].data[1]=o,this):(this._activePath.moveTo(i,o),this)}quadraticCurveTo(e,n,r,s,i){this._tick++;const o=this._transform;return this._activePath.quadraticCurveTo(o.a*e+o.c*n+o.tx,o.b*e+o.d*n+o.ty,o.a*r+o.c*s+o.tx,o.b*r+o.d*s+o.ty,i),this}rect(e,n,r,s){return this._tick++,this._activePath.rect(e,n,r,s,this._transform.clone()),this}roundRect(e,n,r,s,i){return this._tick++,this._activePath.roundRect(e,n,r,s,i,this._transform.clone()),this}poly(e,n){return this._tick++,this._activePath.poly(e,n,this._transform.clone()),this}regularPoly(e,n,r,s,i=0,o){return this._tick++,this._activePath.regularPoly(e,n,r,s,i,o),this}roundPoly(e,n,r,s,i,o){return this._tick++,this._activePath.roundPoly(e,n,r,s,i,o),this}roundShape(e,n,r,s){return this._tick++,this._activePath.roundShape(e,n,r,s),this}filletRect(e,n,r,s,i){return this._tick++,this._activePath.filletRect(e,n,r,s,i),this}chamferRect(e,n,r,s,i,o){return this._tick++,this._activePath.chamferRect(e,n,r,s,i,o),this}star(e,n,r,s,i=0,o=0){return this._tick++,this._activePath.star(e,n,r,s,i,o,this._transform.clone()),this}svg(e){return this._tick++,m_(e,this),this}restore(){const e=this._stateStack.pop();return e&&(this._transform=e.transform,this._fillStyle=e.fillStyle,this._strokeStyle=e.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(e){return this._transform.rotate(e),this}scale(e,n=e){return this._transform.scale(e,n),this}setTransform(e,n,r,s,i,o){return e instanceof te?(this._transform.set(e.a,e.b,e.c,e.d,e.tx,e.ty),this):(this._transform.set(e,n,r,s,i,o),this)}transform(e,n,r,s,i,o){return e instanceof te?(this._transform.append(e),this):(Mc.set(e,n,r,s,i,o),this._transform.append(Mc),this)}translate(e,n=e){return this._transform.translate(e,n),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 e=this._bounds;e.clear();for(let n=0;n<this.instructions.length;n++){const r=this.instructions[n],s=r.action;if(s==="fill"){const i=r.data;e.addBounds(i.path.bounds)}else if(s==="texture"){const i=r.data;e.addFrame(i.dx,i.dy,i.dx+i.dw,i.dy+i.dh,i.transform)}if(s==="stroke"){const i=r.data,o=i.style.alignment;let a=i.style.width*(1-o);i.style.join==="miter"&&(a*=w_(i.path,i.style.miterLimit));const l=i.path.bounds;e.addFrame(l.minX-a,l.minY-a,l.maxX+a,l.maxY+a)}}return e.isValid||e.set(0,0,0,0),e}containsPoint(e){var s;if(!this.bounds.containsPoint(e.x,e.y))return!1;const n=this.instructions;let r=!1;for(let i=0;i<n.length;i++){const o=n[i],a=o.data,l=a.path;if(!o.action||!l)continue;const c=a.style,u=l.shapePath.shapePrimitives;for(let h=0;h<u.length;h++){const f=u[h].shape;if(!c||!f)continue;const d=u[h].transform,m=d?d.applyInverse(e,k_):e;if(o.action==="fill")r=f.contains(m.x,m.y);else{const g=c;r=f.strokeContains(m.x,m.y,g.width,g.alignment)}const _=a.hole;if(_){const g=(s=_.shapePath)==null?void 0:s.shapePrimitives;if(g)for(let y=0;y<g.length;y++)g[y].shape.contains(m.x,m.y)&&(r=!1)}if(r)return!0}}return r}unload(){var e;this.emit("unload",this);for(const n in this._gpuData)(e=this._gpuData[n])==null||e.destroy();this._gpuData=Object.create(null)}destroy(e=!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 e=="boolean"?e:e==null?void 0:e.texture){const r=typeof e=="boolean"?e:e==null?void 0:e.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}};Ea.defaultFillStyle={color:16777215,alpha:1,texture:de.WHITE,matrix:null,fill:null,textureSpace:"local"};Ea.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:de.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};let Sr=Ea;class S_{constructor(){this.isBatchable=!1}reset(){this.isBatchable=!1,this.context=null,this.graphicsData&&(this.graphicsData.destroy(),this.graphicsData=null)}destroy(){this.reset()}}class T_{constructor(){this.instructions=new ya}init(){this.instructions.reset()}destroy(){this.instructions.destroy(),this.instructions=null}}const Pa=class Vo{constructor(e){this._renderer=e,this._managedContexts=new mi({renderer:e,type:"resource",name:"graphicsContext"})}init(e){Vo.defaultOptions.bezierSmoothness=(e==null?void 0:e.bezierSmoothness)??Vo.defaultOptions.bezierSmoothness}getContextRenderData(e){return this.getGpuContext(e).graphicsData||this._initContextRenderData(e)}updateGpuContext(e){const n=e._gpuData,r=!!n[this._renderer.uid],s=n[this._renderer.uid]||this._initContext(e);return(e.dirty||!r)&&(r&&s.reset(),s.isBatchable=!1,e.dirty=!1),s}getGpuContext(e){return e._gpuData[this._renderer.uid]||this._initContext(e)}_initContextRenderData(e){const n=new T_,r=this.getGpuContext(e);return r.graphicsData=n,n.init(),n}_initContext(e){const n=new S_;return n.context=e,e._gpuData[this._renderer.uid]=n,this._managedContexts.add(e),n}destroy(){this._managedContexts.destroy(),this._renderer=null}};Pa.extension={type:[fe.CanvasSystem],name:"graphicsContext"};Pa.defaultOptions={bezierSmoothness:.5};let A_=Pa;class Kh{constructor(e,n){this.state=Rh.for2d(),this.renderer=e,this._adaptor=n,this.renderer.runners.contextChange.add(this),this._managedGraphics=new mi({renderer:e,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(e){return!1}addRenderable(e,n){this._managedGraphics.add(e),this.renderer.renderPipes.batch.break(n),n.add(e)}updateRenderable(e){}execute(e){e.isRenderable&&this._adaptor.execute(this,e)}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.destroy(),this._adaptor=null}}Kh.extension={type:[fe.CanvasPipes],name:"graphics"};function C_(t,e,n){const r=(t>>24&255)/255;e[n++]=(t&255)/255*r,e[n++]=(t>>8&255)/255*r,e[n++]=(t>>16&255)/255*r,e[n++]=r}class E_{constructor(){this.batches=[],this.batched=!1}destroy(){this.batches.forEach(e=>{nt.return(e)}),this.batches.length=0}}class Qh{constructor(e,n){this.state=Rh.for2d(),this.renderer=e,this._adaptor=n,this.renderer.runners.contextChange.add(this),this._managedGraphics=new mi({renderer:e,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(e){const n=e.context,r=!!e._gpuData,i=this.renderer.graphicsContext.updateGpuContext(n);return!!(i.isBatchable||r!==i.isBatchable)}addRenderable(e,n){const s=this.renderer.graphicsContext.updateGpuContext(e.context);e.didViewUpdate&&this._rebuild(e),s.isBatchable?this._addToBatcher(e,n):(this.renderer.renderPipes.batch.break(n),n.add(e))}updateRenderable(e){const r=this._getGpuDataForRenderable(e).batches;for(let s=0;s<r.length;s++){const i=r[s];i._batcher.updateElement(i)}}execute(e){if(!e.isRenderable)return;const n=this.renderer,r=e.context;if(!n.graphicsContext.getGpuContext(r).batches.length)return;const i=r.customShader||this._adaptor.shader;this.state.blendMode=e.groupBlendMode;const o=i.resources.localUniforms.uniforms;o.uTransformMatrix=e.groupTransform,o.uRound=n._roundPixels|e._roundPixels,C_(e.groupColorAlpha,o.uColor,0),this._adaptor.execute(this,e)}_rebuild(e){const n=this._getGpuDataForRenderable(e),s=this.renderer.graphicsContext.updateGpuContext(e.context);n.destroy(),s.isBatchable&&this._updateBatchesForRenderable(e,n)}_addToBatcher(e,n){const r=this.renderer.renderPipes.batch,s=this._getGpuDataForRenderable(e).batches;for(let i=0;i<s.length;i++){const o=s[i];r.addToBatch(o,n)}}_getGpuDataForRenderable(e){return e._gpuData[this.renderer.uid]||this._initGpuDataForRenderable(e)}_initGpuDataForRenderable(e){const n=new E_;return e._gpuData[this.renderer.uid]=n,this._managedGraphics.add(e),n}_updateBatchesForRenderable(e,n){const r=e.context,i=this.renderer.graphicsContext.getGpuContext(r),o=this.renderer._roundPixels|e._roundPixels;n.batches=i.batches.map(a=>{const l=nt.get(Sa);return a.copyTo(l),l.renderable=e,l.roundPixels=o,l})}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null}}Qh.extension={type:[fe.WebGLPipes,fe.WebGPUPipes],name:"graphics"};ct.add(Kh);ct.add(Qh);ct.add(A_);ct.add(Ca);class Ks extends lh{constructor(e){e instanceof Sr&&(e={context:e});const{context:n,roundPixels:r,...s}=e||{};super({label:"Graphics",...s}),this.renderPipeId="graphics",n?this.context=n:(this.context=this._ownedContext=new Sr,this.context.autoGarbageCollect=this.autoGarbageCollect),this.didViewUpdate=!0,this.allowChildren=!1,this.roundPixels=r??!1}set context(e){e!==this._context&&(this._context&&(this._context.off("update",this.onViewUpdate,this),this._context.off("unload",this.unload,this)),this._context=e,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(e){return this._context.containsPoint(e)}destroy(e){this._ownedContext&&!e?this._ownedContext.destroy(e):(e===!0||(e==null?void 0:e.context)===!0)&&this._context.destroy(e),this._ownedContext=null,this._context=null,super.destroy(e)}_onTouch(e){this._gcLastUsed=e,this._context._gcLastUsed=e}_callContextMethod(e,n){return this.context[e](...n),this}setFillStyle(...e){return this._callContextMethod("setFillStyle",e)}setStrokeStyle(...e){return this._callContextMethod("setStrokeStyle",e)}fill(...e){return this._callContextMethod("fill",e)}stroke(...e){return this._callContextMethod("stroke",e)}texture(...e){return this._callContextMethod("texture",e)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...e){return this._callContextMethod("arc",e)}arcTo(...e){return this._callContextMethod("arcTo",e)}arcToSvg(...e){return this._callContextMethod("arcToSvg",e)}bezierCurveTo(...e){return this._callContextMethod("bezierCurveTo",e)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...e){return this._callContextMethod("ellipse",e)}circle(...e){return this._callContextMethod("circle",e)}path(...e){return this._callContextMethod("path",e)}lineTo(...e){return this._callContextMethod("lineTo",e)}moveTo(...e){return this._callContextMethod("moveTo",e)}quadraticCurveTo(...e){return this._callContextMethod("quadraticCurveTo",e)}rect(...e){return this._callContextMethod("rect",e)}roundRect(...e){return this._callContextMethod("roundRect",e)}poly(...e){return this._callContextMethod("poly",e)}regularPoly(...e){return this._callContextMethod("regularPoly",e)}roundPoly(...e){return this._callContextMethod("roundPoly",e)}roundShape(...e){return this._callContextMethod("roundShape",e)}filletRect(...e){return this._callContextMethod("filletRect",e)}chamferRect(...e){return this._callContextMethod("chamferRect",e)}star(...e){return this._callContextMethod("star",e)}svg(...e){return this._callContextMethod("svg",e)}restore(...e){return this._callContextMethod("restore",e)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...e){return this._callContextMethod("rotate",e)}scaleTransform(...e){return this._callContextMethod("scale",e)}setTransform(...e){return this._callContextMethod("setTransform",e)}transform(...e){return this._callContextMethod("transform",e)}translateTransform(...e){return this._callContextMethod("translate",e)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(e){this._context.fillStyle=e}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(e){this._context.strokeStyle=e}clone(e=!1){return e?new Ks(this._context.clone()):(this._ownedContext=null,new Ks(this._context))}lineStyle(e,n,r){ge(Ze,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");const s={};return e&&(s.width=e),n&&(s.color=n),r&&(s.alpha=r),this.context.strokeStyle=s,this}beginFill(e,n){ge(Ze,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");const r={};return e!==void 0&&(r.color=e),n!==void 0&&(r.alpha=n),this.context.fillStyle=r,this}endFill(){ge(Ze,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();const e=this.context.strokeStyle;return(e.width!==Sr.defaultStrokeStyle.width||e.color!==Sr.defaultStrokeStyle.color||e.alpha!==Sr.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...e){return ge(Ze,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",e)}drawEllipse(...e){return ge(Ze,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",e)}drawPolygon(...e){return ge(Ze,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",e)}drawRect(...e){return ge(Ze,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",e)}drawRoundedRect(...e){return ge(Ze,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",e)}drawStar(...e){return ge(Ze,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",e)}}ct.add(Bf,Zf);function P_(){return["park","new_york","tokyo"]}const I_="agent-play-preview-view-settings-v2",M_="agent-play-deep-logs",R_=["English","Yoruba","Igbo","Hausa","French","Spanish","Portuguese","German","Italian","Arabic","Swahili","Mandarin Chinese","Hindi","Japanese"];function z_(){if(typeof window>"u")return!1;const t=window.location.hostname;return t==="localhost"||t==="127.0.0.1"||t==="::1"||t==="[::1]"}function O_(){if(typeof window>"u")return!1;const t=window.location.hostname.toLowerCase();return t==="localhost"||t==="127.0.0.1"||t==="::1"||t==="[::1]"}function ed(t){const e=t.trim().toLowerCase();if(e==="on"||e==="true"||e==="1")return!0;if(e==="off"||e==="false"||e==="0")return!1}function $_(){if(typeof window>"u")return;const e=new URL(window.location.href).searchParams.get("deepLogs");if(e!==null)return ed(e)}function D_(){if(typeof localStorage>"u")return;const t=localStorage.getItem(M_);if(!(t===null||t.length===0))return ed(t)}function N_(){const t=$_();return t!==void 0?t:D_()}function td(t){return t==="default"||t==="ember"||t==="forest"}function nd(t){return t==="unspecified"||t==="feminine"||t==="masculine"||t==="neutral"}function rd(t){return R_.includes(t)}function Wn(){return{themeId:"park",showChatUi:!0,debugMode:z_(),debugOccupancyQuartiles:!1,debugOccupancyFreeGrids:!1,joystickEnabled:!0,stationaryPanels:!1,p2aEnabled:!1,deepLogsEnabled:O_(),profileAvatarPresetId:"default",profileGender:"unspecified",language:"English"}}function sd(t){return P_().includes(t)}function F_(t){if(t===null||t.length===0)return null;try{const e=JSON.parse(t);if(e===null||typeof e!="object")return null;const n=e,r={};return typeof n.themeId=="string"&&sd(n.themeId)&&(r.themeId=n.themeId),typeof n.showChatUi=="boolean"&&(r.showChatUi=n.showChatUi),typeof n.debugMode=="boolean"&&(r.debugMode=n.debugMode),typeof n.debugOccupancyQuartiles=="boolean"&&(r.debugOccupancyQuartiles=n.debugOccupancyQuartiles),typeof n.debugOccupancyFreeGrids=="boolean"&&(r.debugOccupancyFreeGrids=n.debugOccupancyFreeGrids),typeof n.joystickEnabled=="boolean"&&(r.joystickEnabled=n.joystickEnabled),typeof n.stationaryPanels=="boolean"&&(r.stationaryPanels=n.stationaryPanels),typeof n.p2aEnabled=="boolean"&&(r.p2aEnabled=n.p2aEnabled),typeof n.deepLogsEnabled=="boolean"&&(r.deepLogsEnabled=n.deepLogsEnabled),typeof n.profileAvatarPresetId=="string"&&td(n.profileAvatarPresetId)&&(r.profileAvatarPresetId=n.profileAvatarPresetId),typeof n.profileGender=="string"&&nd(n.profileGender)&&(r.profileGender=n.profileGender),typeof n.language=="string"&&rd(n.language)&&(r.language=n.language),Object.keys(r).length>0?r:null}catch{return null}}let Rc=Wn();function L_(t){const e=sd(t.themeId)?t.themeId:Wn().themeId,n=td(t.profileAvatarPresetId)?t.profileAvatarPresetId:Wn().profileAvatarPresetId,r=nd(t.profileGender)?t.profileGender:Wn().profileGender,s=rd(t.language)?t.language:Wn().language;return{themeId:e,showChatUi:t.showChatUi,debugMode:t.debugMode,debugOccupancyQuartiles:t.debugOccupancyQuartiles,debugOccupancyFreeGrids:t.debugOccupancyFreeGrids,joystickEnabled:t.joystickEnabled,stationaryPanels:t.stationaryPanels,p2aEnabled:t.p2aEnabled,deepLogsEnabled:t.deepLogsEnabled,profileAvatarPresetId:n,profileGender:r,language:s}}function B_(){const t=F_(typeof localStorage<"u"?localStorage.getItem(I_):null),e={...Wn(),...t},n=N_();return Rc=L_({...e,...n!==void 0?{deepLogsEnabled:n}:{}}),{...Rc}}typeof localStorage<"u"&&B_();const Z_={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 U_(t){return{...Z_,...t}}var se;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{const i={};for(const o of s)i[o]=o;return i},t.getValidEnumValues=s=>{const i=t.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),o={};for(const a of i)o[a]=s[a];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(i){return s[i]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},t.find=(s,i)=>{for(const o of s)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(se||(se={}));var zc;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(zc||(zc={}));const D=se.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),tn=t=>{switch(typeof t){case"undefined":return D.undefined;case"string":return D.string;case"number":return Number.isNaN(t)?D.nan:D.number;case"boolean":return D.boolean;case"function":return D.function;case"bigint":return D.bigint;case"symbol":return D.symbol;case"object":return Array.isArray(t)?D.array:t===null?D.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?D.promise:typeof Map<"u"&&t instanceof Map?D.map:typeof Set<"u"&&t instanceof Set?D.set:typeof Date<"u"&&t instanceof Date?D.date:D.object;default:return D.unknown}},P=se.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 Ht extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(i){return i.message},r={_errors:[]},s=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let a=r,l=0;for(;l<o.path.length;){const c=o.path[l];l===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(o))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return s(this),r}static assert(e){if(!(e instanceof Ht))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,se.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const s of this.issues)if(s.path.length>0){const i=s.path[0];n[i]=n[i]||[],n[i].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Ht.create=t=>new Ht(t);const Ho=(t,e)=>{let n;switch(t.code){case P.invalid_type:t.received===D.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case P.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,se.jsonStringifyReplacer)}`;break;case P.unrecognized_keys:n=`Unrecognized key(s) in object: ${se.joinValues(t.keys,", ")}`;break;case P.invalid_union:n="Invalid input";break;case P.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${se.joinValues(t.options)}`;break;case P.invalid_enum_value:n=`Invalid enum value. Expected ${se.joinValues(t.options)}, received '${t.received}'`;break;case P.invalid_arguments:n="Invalid function arguments";break;case P.invalid_return_type:n="Invalid function return type";break;case P.invalid_date:n="Invalid date";break;case P.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:se.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case P.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case P.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case P.custom:n="Invalid input";break;case P.invalid_intersection_types:n="Intersection results could not be merged";break;case P.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case P.not_finite:n="Number must be finite";break;default:n=e.defaultError,se.assertNever(t)}return{message:n}};let G_=Ho;function j_(){return G_}const V_=t=>{const{data:e,path:n,errorMaps:r,issueData:s}=t,i=[...n,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(o,{data:e,defaultError:a}).message;return{...s,path:i,message:a}};function $(t,e){const n=j_(),r=V_({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Ho?void 0:Ho].filter(s=>!!s)});t.common.issues.push(r)}class Ye{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const s of n){if(s.status==="aborted")return H;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const s of n){const i=await s.key,o=await s.value;r.push({key:i,value:o})}return Ye.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const s of n){const{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return H;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[i.value]=o.value)}return{status:e.value,value:r}}}const H=Object.freeze({status:"aborted"}),Dr=t=>({status:"dirty",value:t}),pt=t=>({status:"valid",value:t}),Oc=t=>t.status==="aborted",$c=t=>t.status==="dirty",sr=t=>t.status==="valid",Qs=t=>typeof Promise<"u"&&t instanceof Promise;var L;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(L||(L={}));class Ot{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}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 Dc=(t,e)=>{if(sr(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Ht(t.common.issues);return this._error=n,this._error}}};function X(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,a)=>{const{message:l}=t;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:s}}let ee=class{get description(){return this._def.description}_getType(e){return tn(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:tn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ye,ctx:{common:e.parent.common,data:e.data,parsedType:tn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Qs(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:tn(e)},s=this._parseSync({data:e,path:r.path,parent:r});return Dc(r,s)}"~validate"(e){var r,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:tn(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:n});return sr(i)?{value:i.value}:{issues:n.common.issues}}catch(i){(s=(r=i==null?void 0:i.message)==null?void 0:r.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(i=>sr(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:tn(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(Qs(s)?s:Promise.resolve(s));return Dc(r,i)}refine(e,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,i)=>{const o=e(s),a=()=>i.addIssue({code:P.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new or({schema:this,typeName:V.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,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:n=>this["~validate"](n)}}optional(){return cn.create(this,this._def)}nullable(){return ar.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ir.create(this)}promise(){return si.create(this,this._def)}or(e){return ni.create([this,e],this._def)}and(e){return ri.create(this,e,this._def)}transform(e){return new or({...X(this._def),schema:this,typeName:V.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Qo({...X(this._def),innerType:this,defaultValue:n,typeName:V.ZodDefault})}brand(){return new my({typeName:V.ZodBranded,type:this,...X(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new ea({...X(this._def),innerType:this,catchValue:n,typeName:V.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Ma.create(this,e)}readonly(){return ta.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const H_=/^c[^\s-]{8,}$/i,W_=/^[0-9a-z]+$/,Y_=/^[0-9A-HJKMNP-TV-Z]{26}$/i,q_=/^[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,X_=/^[a-z0-9_-]{21}$/i,J_=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,K_=/^[-+]?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)?)??$/,Q_=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ey="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let co;const ty=/^(?:(?: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])$/,ny=/^(?:(?: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])$/,ry=/^(([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]))$/,sy=/^(([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])$/,iy=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,oy=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,id="((\\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])))",ay=new RegExp(`^${id}$`);function od(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function ly(t){return new RegExp(`^${od(t)}$`)}function cy(t){let e=`${id}T${od(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function uy(t,e){return!!((e==="v4"||!e)&&ty.test(t)||(e==="v6"||!e)&&ry.test(t))}function hy(t,e){if(!J_.test(t))return!1;try{const[n]=t.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function dy(t,e){return!!((e==="v4"||!e)&&ny.test(t)||(e==="v6"||!e)&&sy.test(t))}let ei=class Nr extends ee{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==D.string){const i=this._getOrReturnCtx(e);return $(i,{code:P.invalid_type,expected:D.string,received:i.parsedType}),H}const r=new Ye;let s;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),$(s,{code:P.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),$(s,{code:P.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const o=e.data.length>i.value,a=e.data.length<i.value;(o||a)&&(s=this._getOrReturnCtx(e,s),o?$(s,{code:P.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&$(s,{code:P.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")Q_.test(e.data)||(s=this._getOrReturnCtx(e,s),$(s,{validation:"email",code:P.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")co||(co=new RegExp(ey,"u")),co.test(e.data)||(s=this._getOrReturnCtx(e,s),$(s,{validation:"emoji",code:P.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")q_.test(e.data)||(s=this._getOrReturnCtx(e,s),$(s,{validation:"uuid",code:P.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")X_.test(e.data)||(s=this._getOrReturnCtx(e,s),$(s,{validation:"nanoid",code:P.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")H_.test(e.data)||(s=this._getOrReturnCtx(e,s),$(s,{validation:"cuid",code:P.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")W_.test(e.data)||(s=this._getOrReturnCtx(e,s),$(s,{validation:"cuid2",code:P.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")Y_.test(e.data)||(s=this._getOrReturnCtx(e,s),$(s,{validation:"ulid",code:P.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),$(s,{validation:"url",code:P.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),$(s,{validation:"regex",code:P.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),$(s,{code:P.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),$(s,{code:P.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),$(s,{code:P.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?cy(i).test(e.data)||(s=this._getOrReturnCtx(e,s),$(s,{code:P.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?ay.test(e.data)||(s=this._getOrReturnCtx(e,s),$(s,{code:P.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?ly(i).test(e.data)||(s=this._getOrReturnCtx(e,s),$(s,{code:P.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?K_.test(e.data)||(s=this._getOrReturnCtx(e,s),$(s,{validation:"duration",code:P.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?uy(e.data,i.version)||(s=this._getOrReturnCtx(e,s),$(s,{validation:"ip",code:P.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?hy(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),$(s,{validation:"jwt",code:P.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?dy(e.data,i.version)||(s=this._getOrReturnCtx(e,s),$(s,{validation:"cidr",code:P.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?iy.test(e.data)||(s=this._getOrReturnCtx(e,s),$(s,{validation:"base64",code:P.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?oy.test(e.data)||(s=this._getOrReturnCtx(e,s),$(s,{validation:"base64url",code:P.invalid_string,message:i.message}),r.dirty()):se.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:P.invalid_string,...L.errToObj(r)})}_addCheck(e){return new Nr({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...L.errToObj(e)})}url(e){return this._addCheck({kind:"url",...L.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...L.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...L.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...L.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...L.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...L.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...L.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...L.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...L.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...L.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...L.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...L.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...L.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...L.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...L.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...L.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...L.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...L.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...L.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...L.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...L.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...L.errToObj(n)})}nonempty(e){return this.min(1,L.errToObj(e))}trim(){return new Nr({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Nr({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Nr({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};ei.create=t=>new ei({checks:[],typeName:V.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...X(t)});function fy(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(t.toFixed(s).replace(".","")),o=Number.parseInt(e.toFixed(s).replace(".",""));return i%o/10**s}let Nc=class Wo extends ee{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==D.number){const i=this._getOrReturnCtx(e);return $(i,{code:P.invalid_type,expected:D.number,received:i.parsedType}),H}let r;const s=new Ye;for(const i of this._def.checks)i.kind==="int"?se.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),$(r,{code:P.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),$(r,{code:P.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),$(r,{code:P.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?fy(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),$(r,{code:P.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),$(r,{code:P.not_finite,message:i.message}),s.dirty()):se.assertNever(i);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,L.toString(n))}gt(e,n){return this.setLimit("min",e,!1,L.toString(n))}lte(e,n){return this.setLimit("max",e,!0,L.toString(n))}lt(e,n){return this.setLimit("max",e,!1,L.toString(n))}setLimit(e,n,r,s){return new Wo({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:L.toString(s)}]})}_addCheck(e){return new Wo({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:L.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:L.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:L.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:L.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:L.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:L.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:L.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:L.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:L.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&se.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};Nc.create=t=>new Nc({checks:[],typeName:V.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...X(t)});class Jr extends ee{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==D.bigint)return this._getInvalidInput(e);let r;const s=new Ye;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),$(r,{code:P.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),$(r,{code:P.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),$(r,{code:P.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):se.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return $(n,{code:P.invalid_type,expected:D.bigint,received:n.parsedType}),H}gte(e,n){return this.setLimit("min",e,!0,L.toString(n))}gt(e,n){return this.setLimit("min",e,!1,L.toString(n))}lte(e,n){return this.setLimit("max",e,!0,L.toString(n))}lt(e,n){return this.setLimit("max",e,!1,L.toString(n))}setLimit(e,n,r,s){return new Jr({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:L.toString(s)}]})}_addCheck(e){return new Jr({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:L.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:L.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:L.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:L.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:L.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}Jr.create=t=>new Jr({checks:[],typeName:V.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...X(t)});let Fc=class extends ee{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==D.boolean){const r=this._getOrReturnCtx(e);return $(r,{code:P.invalid_type,expected:D.boolean,received:r.parsedType}),H}return pt(e.data)}};Fc.create=t=>new Fc({typeName:V.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...X(t)});class ti extends ee{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==D.date){const i=this._getOrReturnCtx(e);return $(i,{code:P.invalid_type,expected:D.date,received:i.parsedType}),H}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return $(i,{code:P.invalid_date}),H}const r=new Ye;let s;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),$(s,{code:P.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),$(s,{code:P.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):se.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ti({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:L.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:L.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}ti.create=t=>new ti({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:V.ZodDate,...X(t)});class Lc extends ee{_parse(e){if(this._getType(e)!==D.symbol){const r=this._getOrReturnCtx(e);return $(r,{code:P.invalid_type,expected:D.symbol,received:r.parsedType}),H}return pt(e.data)}}Lc.create=t=>new Lc({typeName:V.ZodSymbol,...X(t)});class Bc extends ee{_parse(e){if(this._getType(e)!==D.undefined){const r=this._getOrReturnCtx(e);return $(r,{code:P.invalid_type,expected:D.undefined,received:r.parsedType}),H}return pt(e.data)}}Bc.create=t=>new Bc({typeName:V.ZodUndefined,...X(t)});class Zc extends ee{_parse(e){if(this._getType(e)!==D.null){const r=this._getOrReturnCtx(e);return $(r,{code:P.invalid_type,expected:D.null,received:r.parsedType}),H}return pt(e.data)}}Zc.create=t=>new Zc({typeName:V.ZodNull,...X(t)});let Uc=class extends ee{constructor(){super(...arguments),this._any=!0}_parse(e){return pt(e.data)}};Uc.create=t=>new Uc({typeName:V.ZodAny,...X(t)});let Yo=class extends ee{constructor(){super(...arguments),this._unknown=!0}_parse(e){return pt(e.data)}};Yo.create=t=>new Yo({typeName:V.ZodUnknown,...X(t)});let un=class extends ee{_parse(e){const n=this._getOrReturnCtx(e);return $(n,{code:P.invalid_type,expected:D.never,received:n.parsedType}),H}};un.create=t=>new un({typeName:V.ZodNever,...X(t)});class Gc extends ee{_parse(e){if(this._getType(e)!==D.undefined){const r=this._getOrReturnCtx(e);return $(r,{code:P.invalid_type,expected:D.void,received:r.parsedType}),H}return pt(e.data)}}Gc.create=t=>new Gc({typeName:V.ZodVoid,...X(t)});let ir=class Ws extends ee{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==D.array)return $(n,{code:P.invalid_type,expected:D.array,received:n.parsedType}),H;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,a=n.data.length<s.exactLength.value;(o||a)&&($(n,{code:o?P.too_big:P.too_small,minimum:a?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&($(n,{code:P.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&($(n,{code:P.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>s.type._parseAsync(new Ot(n,o,n.path,a)))).then(o=>Ye.mergeArray(r,o));const i=[...n.data].map((o,a)=>s.type._parseSync(new Ot(n,o,n.path,a)));return Ye.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new Ws({...this._def,minLength:{value:e,message:L.toString(n)}})}max(e,n){return new Ws({...this._def,maxLength:{value:e,message:L.toString(n)}})}length(e,n){return new Ws({...this._def,exactLength:{value:e,message:L.toString(n)}})}nonempty(e){return this.min(1,e)}};ir.create=(t,e)=>new ir({type:t,minLength:null,maxLength:null,exactLength:null,typeName:V.ZodArray,...X(e)});function jn(t){if(t instanceof Wt){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=cn.create(jn(r))}return new Wt({...t._def,shape:()=>e})}else return t instanceof ir?new ir({...t._def,type:jn(t.element)}):t instanceof cn?cn.create(jn(t.unwrap())):t instanceof ar?ar.create(jn(t.unwrap())):t instanceof In?In.create(t.items.map(e=>jn(e))):t}let Wt=class vt extends ee{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=se.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==D.object){const c=this._getOrReturnCtx(e);return $(c,{code:P.invalid_type,expected:D.object,received:c.parsedType}),H}const{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof un&&this._def.unknownKeys==="strip"))for(const c in s.data)o.includes(c)||a.push(c);const l=[];for(const c of o){const u=i[c],h=s.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Ot(s,h,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof un){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:s.data[u]}});else if(c==="strict")a.length>0&&($(s,{code:P.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of a){const h=s.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Ot(s,h,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const h=await u.key,f=await u.value;c.push({key:h,value:f,alwaysSet:u.alwaysSet})}return c}).then(c=>Ye.mergeObjectSync(r,c)):Ye.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return L.errToObj,new vt({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var i,o;const s=((o=(i=this._def).errorMap)==null?void 0:o.call(i,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:L.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new vt({...this._def,unknownKeys:"strip"})}passthrough(){return new vt({...this._def,unknownKeys:"passthrough"})}extend(e){return new vt({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new vt({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:V.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new vt({...this._def,catchall:e})}pick(e){const n={};for(const r of se.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new vt({...this._def,shape:()=>n})}omit(e){const n={};for(const r of se.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new vt({...this._def,shape:()=>n})}deepPartial(){return jn(this)}partial(e){const n={};for(const r of se.objectKeys(this.shape)){const s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}return new vt({...this._def,shape:()=>n})}required(e){const n={};for(const r of se.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof cn;)i=i._def.innerType;n[r]=i}return new vt({...this._def,shape:()=>n})}keyof(){return ad(se.objectKeys(this.shape))}};Wt.create=(t,e)=>new Wt({shape:()=>t,unknownKeys:"strip",catchall:un.create(),typeName:V.ZodObject,...X(e)});Wt.strictCreate=(t,e)=>new Wt({shape:()=>t,unknownKeys:"strict",catchall:un.create(),typeName:V.ZodObject,...X(e)});Wt.lazycreate=(t,e)=>new Wt({shape:t,unknownKeys:"strip",catchall:un.create(),typeName:V.ZodObject,...X(e)});let ni=class extends ee{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function s(i){for(const a of i)if(a.result.status==="valid")return a.result;for(const a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(a=>new Ht(a.ctx.common.issues));return $(n,{code:P.invalid_union,unionErrors:o}),H}if(n.common.async)return Promise.all(r.map(async i=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let i;const o=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const a=o.map(l=>new Ht(l));return $(n,{code:P.invalid_union,unionErrors:a}),H}}get options(){return this._def.options}};ni.create=(t,e)=>new ni({options:t,typeName:V.ZodUnion,...X(e)});function qo(t,e){const n=tn(t),r=tn(e);if(t===e)return{valid:!0,data:t};if(n===D.object&&r===D.object){const s=se.objectKeys(e),i=se.objectKeys(t).filter(a=>s.indexOf(a)!==-1),o={...t,...e};for(const a of i){const l=qo(t[a],e[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(n===D.array&&r===D.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let i=0;i<t.length;i++){const o=t[i],a=e[i],l=qo(o,a);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return n===D.date&&r===D.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}let ri=class extends ee{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=(i,o)=>{if(Oc(i)||Oc(o))return H;const a=qo(i.value,o.value);return a.valid?(($c(i)||$c(o))&&n.dirty(),{status:n.value,value:a.data}):($(r,{code:P.invalid_intersection_types}),H)};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(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};ri.create=(t,e,n)=>new ri({left:t,right:e,typeName:V.ZodIntersection,...X(n)});class In extends ee{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.array)return $(r,{code:P.invalid_type,expected:D.array,received:r.parsedType}),H;if(r.data.length<this._def.items.length)return $(r,{code:P.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),H;!this._def.rest&&r.data.length>this._def.items.length&&($(r,{code:P.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new Ot(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>Ye.mergeArray(n,o)):Ye.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new In({...this._def,rest:e})}}In.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new In({items:t,typeName:V.ZodTuple,rest:null,...X(e)})};let py=class Xo extends ee{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.object)return $(r,{code:P.invalid_type,expected:D.object,received:r.parsedType}),H;const s=[],i=this._def.keyType,o=this._def.valueType;for(const a in r.data)s.push({key:i._parse(new Ot(r,a,r.path,a)),value:o._parse(new Ot(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?Ye.mergeObjectAsync(n,s):Ye.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof ee?new Xo({keyType:e,valueType:n,typeName:V.ZodRecord,...X(r)}):new Xo({keyType:ei.create(),valueType:e,typeName:V.ZodRecord,...X(n)})}};class jc extends ee{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.map)return $(r,{code:P.invalid_type,expected:D.map,received:r.parsedType}),H;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([a,l],c)=>({key:s._parse(new Ot(r,a,r.path,[c,"key"])),value:i._parse(new Ot(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return H;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of o){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return H;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}}jc.create=(t,e,n)=>new jc({valueType:e,keyType:t,typeName:V.ZodMap,...X(n)});class Kr extends ee{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.set)return $(r,{code:P.invalid_type,expected:D.set,received:r.parsedType}),H;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&($(r,{code:P.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&($(r,{code:P.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const i=this._def.valueType;function o(l){const c=new Set;for(const u of l){if(u.status==="aborted")return H;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>i._parse(new Ot(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(e,n){return new Kr({...this._def,minSize:{value:e,message:L.toString(n)}})}max(e,n){return new Kr({...this._def,maxSize:{value:e,message:L.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}Kr.create=(t,e)=>new Kr({valueType:t,minSize:null,maxSize:null,typeName:V.ZodSet,...X(e)});let Vc=class extends ee{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};Vc.create=(t,e)=>new Vc({getter:t,typeName:V.ZodLazy,...X(e)});let Jo=class extends ee{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return $(n,{received:n.data,code:P.invalid_literal,expected:this._def.value}),H}return{status:"valid",value:e.data}}get value(){return this._def.value}};Jo.create=(t,e)=>new Jo({value:t,typeName:V.ZodLiteral,...X(e)});function ad(t,e){return new Ia({values:t,typeName:V.ZodEnum,...X(e)})}let Ia=class Ko extends ee{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return $(n,{expected:se.joinValues(r),received:n.parsedType,code:P.invalid_type}),H}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return $(n,{received:n.data,code:P.invalid_enum_value,options:r}),H}return pt(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return Ko.create(e,{...this._def,...n})}exclude(e,n=this._def){return Ko.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};Ia.create=ad;class Hc extends ee{_parse(e){const n=se.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==D.string&&r.parsedType!==D.number){const s=se.objectValues(n);return $(r,{expected:se.joinValues(s),received:r.parsedType,code:P.invalid_type}),H}if(this._cache||(this._cache=new Set(se.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=se.objectValues(n);return $(r,{received:r.data,code:P.invalid_enum_value,options:s}),H}return pt(e.data)}get enum(){return this._def.values}}Hc.create=(t,e)=>new Hc({values:t,typeName:V.ZodNativeEnum,...X(e)});class si extends ee{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==D.promise&&n.common.async===!1)return $(n,{code:P.invalid_type,expected:D.promise,received:n.parsedType}),H;const r=n.parsedType===D.promise?n.data:Promise.resolve(n.data);return pt(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}si.create=(t,e)=>new si({type:t,typeName:V.ZodPromise,...X(e)});class or extends ee{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===V.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:o=>{$(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const o=s.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return H;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?H:l.status==="dirty"||n.value==="dirty"?Dr(l.value):l});{if(n.value==="aborted")return H;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?H:a.status==="dirty"||n.value==="dirty"?Dr(a.value):a}}if(s.type==="refinement"){const o=a=>{const l=s.refinement(a,i);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 a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?H:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?H:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(s.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!sr(o))return H;const a=s.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>sr(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:n.value,value:a})):H);se.assertNever(s)}}or.create=(t,e,n)=>new or({schema:t,typeName:V.ZodEffects,effect:e,...X(n)});or.createWithPreprocess=(t,e,n)=>new or({schema:e,effect:{type:"preprocess",transform:t},typeName:V.ZodEffects,...X(n)});let cn=class extends ee{_parse(e){return this._getType(e)===D.undefined?pt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};cn.create=(t,e)=>new cn({innerType:t,typeName:V.ZodOptional,...X(e)});let ar=class extends ee{_parse(e){return this._getType(e)===D.null?pt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ar.create=(t,e)=>new ar({innerType:t,typeName:V.ZodNullable,...X(e)});let Qo=class extends ee{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===D.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};Qo.create=(t,e)=>new Qo({innerType:t,typeName:V.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...X(e)});let ea=class extends ee{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Qs(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ht(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ht(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};ea.create=(t,e)=>new ea({innerType:t,typeName:V.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...X(e)});class Wc extends ee{_parse(e){if(this._getType(e)!==D.nan){const r=this._getOrReturnCtx(e);return $(r,{code:P.invalid_type,expected:D.nan,received:r.parsedType}),H}return{status:"valid",value:e.data}}}Wc.create=t=>new Wc({typeName:V.ZodNaN,...X(t)});class my extends ee{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Ma extends ee{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?H:i.status==="dirty"?(n.dirty(),Dr(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?H:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new Ma({in:e,out:n,typeName:V.ZodPipeline})}}let ta=class extends ee{_parse(e){const n=this._def.innerType._parse(e),r=s=>(sr(s)&&(s.value=Object.freeze(s.value)),s);return Qs(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}};ta.create=(t,e)=>new ta({innerType:t,typeName:V.ZodReadonly,...X(e)});var V;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(V||(V={}));const et=ei.create,Ra=Yo.create;un.create;ir.create;const _s=Wt.create;ni.create;ri.create;In.create;const za=py.create,gy=Jo.create,Qr=Ia.create;si.create;cn.create;ar.create;var _y=/^[a-z][a-z0-9-]*$/;function yy(t){const e=t.trim(),n=e.indexOf("://");if(n<=0)throw new Error("invalid intercom-address");const r=e.slice(0,n).trim().toLowerCase(),s=e.slice(n+3).trim();if(!_y.test(r)||!r.endsWith("-intercom"))throw new Error("invalid intercom-address");if(s.length===0)throw new Error("invalid intercom-address");return{protocol:r,value:s}}function xy(t){return yy(t).value}var Pe=et().trim().min(1),Oa=et().trim().transform(t=>(xy(t),t)),by=_s({requestId:Pe,mainNodeId:Pe,fromPlayerId:Pe,toPlayerId:Pe,kind:Qr(["assist","chat","realtime"]),toolName:et().optional(),args:za(et(),Ra()).optional(),text:et().optional(),intercomAddress:Oa.optional()}).superRefine((t,e)=>{t.kind==="assist"&&(t.toolName??"").trim().length===0&&e.addIssue({code:P.custom,path:["toolName"],message:"toolName is required for assist"}),t.kind==="chat"&&(t.text??"").trim().length===0&&e.addIssue({code:P.custom,path:["text"],message:"text is required for chat"})});_s({requestId:Pe,mainNodeId:Pe,toPlayerId:Pe,fromPlayerId:Pe,kind:Qr(["assist","chat","realtime"]),status:Qr(["started","stream","completed","failed","forwarded"]),toolName:et().optional(),message:et().optional(),result:za(et(),Ra()).optional(),error:et().nullable().optional(),ts:Pe,channelKey:et().optional(),intercomAddress:Oa.optional(),command:by.optional()});_s({requestId:Pe,mainNodeId:Pe,toPlayerId:Pe,fromPlayerId:Pe,kind:Qr(["assist","chat","realtime"]),status:Qr(["stream","completed","failed"]),toolName:et().optional(),message:et().optional(),result:za(et(),Ra()).optional(),error:et().nullable().optional(),ts:Pe,intercomAddress:Oa.optional()}).superRefine((t,e)=>{t.status==="failed"&&(t.error??"").trim().length===0&&e.addIssue({code:P.custom,path:["error"],message:"error is required when status is failed"})});_s({consent:gy(!0),nodeId:Pe,passwHash:Pe}).strict();_s({requestId:Pe,mainNodeId:Pe,fromPlayerId:Pe,message:Pe}).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:ld,setPrototypeOf:Yc,isFrozen:vy,getPrototypeOf:wy,getOwnPropertyDescriptor:ky}=Object;let{freeze:qe,seal:ft,create:Ys}=Object,{apply:na,construct:ra}=typeof Reflect<"u"&&Reflect;qe||(qe=function(e){return e});ft||(ft=function(e){return e});na||(na=function(e,n){for(var r=arguments.length,s=new Array(r>2?r-2:0),i=2;i<r;i++)s[i-2]=arguments[i];return e.apply(n,s)});ra||(ra=function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return new e(...r)});const Ds=Xe(Array.prototype.forEach),Sy=Xe(Array.prototype.lastIndexOf),qc=Xe(Array.prototype.pop),Tr=Xe(Array.prototype.push),Ty=Xe(Array.prototype.splice),qs=Xe(String.prototype.toLowerCase),uo=Xe(String.prototype.toString),ho=Xe(String.prototype.match),Ar=Xe(String.prototype.replace),Ay=Xe(String.prototype.indexOf),Cy=Xe(String.prototype.trim),ot=Xe(Object.prototype.hasOwnProperty),je=Xe(RegExp.prototype.test),Cr=Ey(TypeError);function Xe(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return na(t,e,r)}}function Ey(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return ra(t,n)}}function J(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:qs;Yc&&Yc(t,null);let r=e.length;for(;r--;){let s=e[r];if(typeof s=="string"){const i=n(s);i!==s&&(vy(e)||(e[r]=i),s=i)}t[s]=!0}return t}function Py(t){for(let e=0;e<t.length;e++)ot(t,e)||(t[e]=null);return t}function Rt(t){const e=Ys(null);for(const[n,r]of ld(t))ot(t,n)&&(Array.isArray(r)?e[n]=Py(r):r&&typeof r=="object"&&r.constructor===Object?e[n]=Rt(r):e[n]=r);return e}function Er(t,e){for(;t!==null;){const r=ky(t,e);if(r){if(r.get)return Xe(r.get);if(typeof r.value=="function")return Xe(r.value)}t=wy(t)}function n(){return null}return n}const Xc=qe(["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"]),fo=qe(["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"]),po=qe(["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"]),Iy=qe(["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"]),mo=qe(["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"]),My=qe(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Jc=qe(["#text"]),Kc=qe(["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"]),go=qe(["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"]),Qc=qe(["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"]),Ns=qe(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ry=ft(/\{\{[\w\W]*|[\w\W]*\}\}/gm),zy=ft(/<%[\w\W]*|[\w\W]*%>/gm),Oy=ft(/\$\{[\w\W]*/gm),$y=ft(/^data-[\-\w.\u00B7-\uFFFF]+$/),Dy=ft(/^aria-[\-\w]+$/),cd=ft(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ny=ft(/^(?:\w+script|data):/i),Fy=ft(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ud=ft(/^html$/i),Ly=ft(/^[a-z][.\w]*(-[.\w]+)+$/i);var eu=Object.freeze({__proto__:null,ARIA_ATTR:Dy,ATTR_WHITESPACE:Fy,CUSTOM_ELEMENT:Ly,DATA_ATTR:$y,DOCTYPE_NAME:ud,ERB_EXPR:zy,IS_ALLOWED_URI:cd,IS_SCRIPT_OR_DATA:Ny,MUSTACHE_EXPR:Ry,TMPLIT_EXPR:Oy});const Pr={element:1,text:3,progressingInstruction:7,comment:8,document:9},By=function(){return typeof window>"u"?null:window},Zy=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null;const s="data-tt-policy-suffix";n&&n.hasAttribute(s)&&(r=n.getAttribute(s));const i="dompurify"+(r?"#"+r:"");try{return e.createPolicy(i,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},tu=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function hd(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:By();const e=Z=>hd(Z);if(e.version="3.3.3",e.removed=[],!t||!t.document||t.document.nodeType!==Pr.document||!t.Element)return e.isSupported=!1,e;let{document:n}=t;const r=n,s=r.currentScript,{DocumentFragment:i,HTMLTemplateElement:o,Node:a,Element:l,NodeFilter:c,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:h,DOMParser:f,trustedTypes:d}=t,m=l.prototype,_=Er(m,"cloneNode"),g=Er(m,"remove"),y=Er(m,"nextSibling"),b=Er(m,"childNodes"),w=Er(m,"parentNode");if(typeof o=="function"){const Z=n.createElement("template");Z.content&&Z.content.ownerDocument&&(n=Z.content.ownerDocument)}let k,E="";const{implementation:A,createNodeIterator:C,createDocumentFragment:j,getElementsByTagName:W}=n,{importNode:O}=r;let z=tu();e.isSupported=typeof ld=="function"&&typeof w=="function"&&A&&A.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:ie,ERB_EXPR:ce,TMPLIT_EXPR:ue,DATA_ATTR:qt,ARIA_ATTR:N,IS_SCRIPT_OR_DATA:U,ATTR_WHITESPACE:Xt,CUSTOM_ELEMENT:re}=eu;let{IS_ALLOWED_URI:gt}=eu,be=null;const Jt=J({},[...Xc,...fo,...po,...mo,...Jc]);let ke=null;const fr=J({},[...Kc,...go,...Qc,...Ns]);let pe=Object.seal(Ys(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,gn=null;const yt=Object.seal(Ys(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let _n=!0,Kt=!0,On=!1,Ct=!0,Je=!1,ut=!0,Ge=!1,pr=!1,$n=!1,Qt=!1,mr=!1,xs=!1,ol=!0,al=!1;const Ef="user-content-";let Ci=!0,gr=!1,Dn={},Et=null;const Ei=J({},["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 ll=null;const cl=J({},["audio","video","img","source","image","track"]);let Pi=null;const ul=J({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),bs="http://www.w3.org/1998/Math/MathML",vs="http://www.w3.org/2000/svg",$t="http://www.w3.org/1999/xhtml";let Nn=$t,Ii=!1,Mi=null;const Pf=J({},[bs,vs,$t],uo);let ws=J({},["mi","mo","mn","ms","mtext"]),ks=J({},["annotation-xml"]);const If=J({},["title","style","font","a","script"]);let _r=null;const Mf=["application/xhtml+xml","text/html"],Rf="text/html";let Me=null,Fn=null;const zf=n.createElement("form"),hl=function(x){return x instanceof RegExp||x instanceof Function},Ri=function(){let x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Fn&&Fn===x)){if((!x||typeof x!="object")&&(x={}),x=Rt(x),_r=Mf.indexOf(x.PARSER_MEDIA_TYPE)===-1?Rf:x.PARSER_MEDIA_TYPE,Me=_r==="application/xhtml+xml"?uo:qs,be=ot(x,"ALLOWED_TAGS")?J({},x.ALLOWED_TAGS,Me):Jt,ke=ot(x,"ALLOWED_ATTR")?J({},x.ALLOWED_ATTR,Me):fr,Mi=ot(x,"ALLOWED_NAMESPACES")?J({},x.ALLOWED_NAMESPACES,uo):Pf,Pi=ot(x,"ADD_URI_SAFE_ATTR")?J(Rt(ul),x.ADD_URI_SAFE_ATTR,Me):ul,ll=ot(x,"ADD_DATA_URI_TAGS")?J(Rt(cl),x.ADD_DATA_URI_TAGS,Me):cl,Et=ot(x,"FORBID_CONTENTS")?J({},x.FORBID_CONTENTS,Me):Ei,_t=ot(x,"FORBID_TAGS")?J({},x.FORBID_TAGS,Me):Rt({}),gn=ot(x,"FORBID_ATTR")?J({},x.FORBID_ATTR,Me):Rt({}),Dn=ot(x,"USE_PROFILES")?x.USE_PROFILES:!1,_n=x.ALLOW_ARIA_ATTR!==!1,Kt=x.ALLOW_DATA_ATTR!==!1,On=x.ALLOW_UNKNOWN_PROTOCOLS||!1,Ct=x.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Je=x.SAFE_FOR_TEMPLATES||!1,ut=x.SAFE_FOR_XML!==!1,Ge=x.WHOLE_DOCUMENT||!1,Qt=x.RETURN_DOM||!1,mr=x.RETURN_DOM_FRAGMENT||!1,xs=x.RETURN_TRUSTED_TYPE||!1,$n=x.FORCE_BODY||!1,ol=x.SANITIZE_DOM!==!1,al=x.SANITIZE_NAMED_PROPS||!1,Ci=x.KEEP_CONTENT!==!1,gr=x.IN_PLACE||!1,gt=x.ALLOWED_URI_REGEXP||cd,Nn=x.NAMESPACE||$t,ws=x.MATHML_TEXT_INTEGRATION_POINTS||ws,ks=x.HTML_INTEGRATION_POINTS||ks,pe=x.CUSTOM_ELEMENT_HANDLING||{},x.CUSTOM_ELEMENT_HANDLING&&hl(x.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(pe.tagNameCheck=x.CUSTOM_ELEMENT_HANDLING.tagNameCheck),x.CUSTOM_ELEMENT_HANDLING&&hl(x.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(pe.attributeNameCheck=x.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),x.CUSTOM_ELEMENT_HANDLING&&typeof x.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(pe.allowCustomizedBuiltInElements=x.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Je&&(Kt=!1),mr&&(Qt=!0),Dn&&(be=J({},Jc),ke=Ys(null),Dn.html===!0&&(J(be,Xc),J(ke,Kc)),Dn.svg===!0&&(J(be,fo),J(ke,go),J(ke,Ns)),Dn.svgFilters===!0&&(J(be,po),J(ke,go),J(ke,Ns)),Dn.mathMl===!0&&(J(be,mo),J(ke,Qc),J(ke,Ns))),ot(x,"ADD_TAGS")||(yt.tagCheck=null),ot(x,"ADD_ATTR")||(yt.attributeCheck=null),x.ADD_TAGS&&(typeof x.ADD_TAGS=="function"?yt.tagCheck=x.ADD_TAGS:(be===Jt&&(be=Rt(be)),J(be,x.ADD_TAGS,Me))),x.ADD_ATTR&&(typeof x.ADD_ATTR=="function"?yt.attributeCheck=x.ADD_ATTR:(ke===fr&&(ke=Rt(ke)),J(ke,x.ADD_ATTR,Me))),x.ADD_URI_SAFE_ATTR&&J(Pi,x.ADD_URI_SAFE_ATTR,Me),x.FORBID_CONTENTS&&(Et===Ei&&(Et=Rt(Et)),J(Et,x.FORBID_CONTENTS,Me)),x.ADD_FORBID_CONTENTS&&(Et===Ei&&(Et=Rt(Et)),J(Et,x.ADD_FORBID_CONTENTS,Me)),Ci&&(be["#text"]=!0),Ge&&J(be,["html","head","body"]),be.table&&(J(be,["tbody"]),delete _t.tbody),x.TRUSTED_TYPES_POLICY){if(typeof x.TRUSTED_TYPES_POLICY.createHTML!="function")throw Cr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof x.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Cr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');k=x.TRUSTED_TYPES_POLICY,E=k.createHTML("")}else k===void 0&&(k=Zy(d,s)),k!==null&&typeof E=="string"&&(E=k.createHTML(""));qe&&qe(x),Fn=x}},dl=J({},[...fo,...po,...Iy]),fl=J({},[...mo,...My]),Of=function(x){let I=w(x);(!I||!I.tagName)&&(I={namespaceURI:Nn,tagName:"template"});const F=qs(x.tagName),ve=qs(I.tagName);return Mi[x.namespaceURI]?x.namespaceURI===vs?I.namespaceURI===$t?F==="svg":I.namespaceURI===bs?F==="svg"&&(ve==="annotation-xml"||ws[ve]):!!dl[F]:x.namespaceURI===bs?I.namespaceURI===$t?F==="math":I.namespaceURI===vs?F==="math"&&ks[ve]:!!fl[F]:x.namespaceURI===$t?I.namespaceURI===vs&&!ks[ve]||I.namespaceURI===bs&&!ws[ve]?!1:!fl[F]&&(If[F]||!dl[F]):!!(_r==="application/xhtml+xml"&&Mi[x.namespaceURI]):!1},Pt=function(x){Tr(e.removed,{element:x});try{w(x).removeChild(x)}catch{g(x)}},yn=function(x,I){try{Tr(e.removed,{attribute:I.getAttributeNode(x),from:I})}catch{Tr(e.removed,{attribute:null,from:I})}if(I.removeAttribute(x),x==="is")if(Qt||mr)try{Pt(I)}catch{}else try{I.setAttribute(x,"")}catch{}},pl=function(x){let I=null,F=null;if($n)x="<remove></remove>"+x;else{const Ee=ho(x,/^[\r\n\t ]+/);F=Ee&&Ee[0]}_r==="application/xhtml+xml"&&Nn===$t&&(x='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+x+"</body></html>");const ve=k?k.createHTML(x):x;if(Nn===$t)try{I=new f().parseFromString(ve,_r)}catch{}if(!I||!I.documentElement){I=A.createDocument(Nn,"template",null);try{I.documentElement.innerHTML=Ii?E:ve}catch{}}const Fe=I.body||I.documentElement;return x&&F&&Fe.insertBefore(n.createTextNode(F),Fe.childNodes[0]||null),Nn===$t?W.call(I,Ge?"html":"body")[0]:Ge?I.documentElement:Fe},ml=function(x){return C.call(x.ownerDocument||x,x,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},zi=function(x){return x instanceof h&&(typeof x.nodeName!="string"||typeof x.textContent!="string"||typeof x.removeChild!="function"||!(x.attributes instanceof u)||typeof x.removeAttribute!="function"||typeof x.setAttribute!="function"||typeof x.namespaceURI!="string"||typeof x.insertBefore!="function"||typeof x.hasChildNodes!="function")},gl=function(x){return typeof a=="function"&&x instanceof a};function Dt(Z,x,I){Ds(Z,F=>{F.call(e,x,I,Fn)})}const _l=function(x){let I=null;if(Dt(z.beforeSanitizeElements,x,null),zi(x))return Pt(x),!0;const F=Me(x.nodeName);if(Dt(z.uponSanitizeElement,x,{tagName:F,allowedTags:be}),ut&&x.hasChildNodes()&&!gl(x.firstElementChild)&&je(/<[/\w!]/g,x.innerHTML)&&je(/<[/\w!]/g,x.textContent)||x.nodeType===Pr.progressingInstruction||ut&&x.nodeType===Pr.comment&&je(/<[/\w]/g,x.data))return Pt(x),!0;if(!(yt.tagCheck instanceof Function&&yt.tagCheck(F))&&(!be[F]||_t[F])){if(!_t[F]&&xl(F)&&(pe.tagNameCheck instanceof RegExp&&je(pe.tagNameCheck,F)||pe.tagNameCheck instanceof Function&&pe.tagNameCheck(F)))return!1;if(Ci&&!Et[F]){const ve=w(x)||x.parentNode,Fe=b(x)||x.childNodes;if(Fe&&ve){const Ee=Fe.length;for(let Ke=Ee-1;Ke>=0;--Ke){const Nt=_(Fe[Ke],!0);Nt.__removalCount=(x.__removalCount||0)+1,ve.insertBefore(Nt,y(x))}}}return Pt(x),!0}return x instanceof l&&!Of(x)||(F==="noscript"||F==="noembed"||F==="noframes")&&je(/<\/no(script|embed|frames)/i,x.innerHTML)?(Pt(x),!0):(Je&&x.nodeType===Pr.text&&(I=x.textContent,Ds([ie,ce,ue],ve=>{I=Ar(I,ve," ")}),x.textContent!==I&&(Tr(e.removed,{element:x.cloneNode()}),x.textContent=I)),Dt(z.afterSanitizeElements,x,null),!1)},yl=function(x,I,F){if(gn[I]||ol&&(I==="id"||I==="name")&&(F in n||F in zf))return!1;if(!(Kt&&!gn[I]&&je(qt,I))){if(!(_n&&je(N,I))){if(!(yt.attributeCheck instanceof Function&&yt.attributeCheck(I,x))){if(!ke[I]||gn[I]){if(!(xl(x)&&(pe.tagNameCheck instanceof RegExp&&je(pe.tagNameCheck,x)||pe.tagNameCheck instanceof Function&&pe.tagNameCheck(x))&&(pe.attributeNameCheck instanceof RegExp&&je(pe.attributeNameCheck,I)||pe.attributeNameCheck instanceof Function&&pe.attributeNameCheck(I,x))||I==="is"&&pe.allowCustomizedBuiltInElements&&(pe.tagNameCheck instanceof RegExp&&je(pe.tagNameCheck,F)||pe.tagNameCheck instanceof Function&&pe.tagNameCheck(F))))return!1}else if(!Pi[I]){if(!je(gt,Ar(F,Xt,""))){if(!((I==="src"||I==="xlink:href"||I==="href")&&x!=="script"&&Ay(F,"data:")===0&&ll[x])){if(!(On&&!je(U,Ar(F,Xt,"")))){if(F)return!1}}}}}}}return!0},xl=function(x){return x!=="annotation-xml"&&ho(x,re)},bl=function(x){Dt(z.beforeSanitizeAttributes,x,null);const{attributes:I}=x;if(!I||zi(x))return;const F={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ke,forceKeepAttr:void 0};let ve=I.length;for(;ve--;){const Fe=I[ve],{name:Ee,namespaceURI:Ke,value:Nt}=Fe,Ln=Me(Ee),Oi=Nt;let $e=Ee==="value"?Oi:Cy(Oi);if(F.attrName=Ln,F.attrValue=$e,F.keepAttr=!0,F.forceKeepAttr=void 0,Dt(z.uponSanitizeAttribute,x,F),$e=F.attrValue,al&&(Ln==="id"||Ln==="name")&&(yn(Ee,x),$e=Ef+$e),ut&&je(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,$e)){yn(Ee,x);continue}if(Ln==="attributename"&&ho($e,"href")){yn(Ee,x);continue}if(F.forceKeepAttr)continue;if(!F.keepAttr){yn(Ee,x);continue}if(!Ct&&je(/\/>/i,$e)){yn(Ee,x);continue}Je&&Ds([ie,ce,ue],wl=>{$e=Ar($e,wl," ")});const vl=Me(x.nodeName);if(!yl(vl,Ln,$e)){yn(Ee,x);continue}if(k&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!Ke)switch(d.getAttributeType(vl,Ln)){case"TrustedHTML":{$e=k.createHTML($e);break}case"TrustedScriptURL":{$e=k.createScriptURL($e);break}}if($e!==Oi)try{Ke?x.setAttributeNS(Ke,Ee,$e):x.setAttribute(Ee,$e),zi(x)?Pt(x):qc(e.removed)}catch{yn(Ee,x)}}Dt(z.afterSanitizeAttributes,x,null)},$f=function Z(x){let I=null;const F=ml(x);for(Dt(z.beforeSanitizeShadowDOM,x,null);I=F.nextNode();)Dt(z.uponSanitizeShadowNode,I,null),_l(I),bl(I),I.content instanceof i&&Z(I.content);Dt(z.afterSanitizeShadowDOM,x,null)};return e.sanitize=function(Z){let x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},I=null,F=null,ve=null,Fe=null;if(Ii=!Z,Ii&&(Z="<!-->"),typeof Z!="string"&&!gl(Z))if(typeof Z.toString=="function"){if(Z=Z.toString(),typeof Z!="string")throw Cr("dirty is not a string, aborting")}else throw Cr("toString is not a function");if(!e.isSupported)return Z;if(pr||Ri(x),e.removed=[],typeof Z=="string"&&(gr=!1),gr){if(Z.nodeName){const Nt=Me(Z.nodeName);if(!be[Nt]||_t[Nt])throw Cr("root node is forbidden and cannot be sanitized in-place")}}else if(Z instanceof a)I=pl("<!---->"),F=I.ownerDocument.importNode(Z,!0),F.nodeType===Pr.element&&F.nodeName==="BODY"||F.nodeName==="HTML"?I=F:I.appendChild(F);else{if(!Qt&&!Je&&!Ge&&Z.indexOf("<")===-1)return k&&xs?k.createHTML(Z):Z;if(I=pl(Z),!I)return Qt?null:xs?E:""}I&&$n&&Pt(I.firstChild);const Ee=ml(gr?Z:I);for(;ve=Ee.nextNode();)_l(ve),bl(ve),ve.content instanceof i&&$f(ve.content);if(gr)return Z;if(Qt){if(mr)for(Fe=j.call(I.ownerDocument);I.firstChild;)Fe.appendChild(I.firstChild);else Fe=I;return(ke.shadowroot||ke.shadowrootmode)&&(Fe=O.call(r,Fe,!0)),Fe}let Ke=Ge?I.outerHTML:I.innerHTML;return Ge&&be["!doctype"]&&I.ownerDocument&&I.ownerDocument.doctype&&I.ownerDocument.doctype.name&&je(ud,I.ownerDocument.doctype.name)&&(Ke="<!DOCTYPE "+I.ownerDocument.doctype.name+`>
|
|
240
|
+
`+Ke),Je&&Ds([ie,ce,ue],Nt=>{Ke=Ar(Ke,Nt," ")}),k&&xs?k.createHTML(Ke):Ke},e.setConfig=function(){let Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ri(Z),pr=!0},e.clearConfig=function(){Fn=null,pr=!1},e.isValidAttribute=function(Z,x,I){Fn||Ri({});const F=Me(Z),ve=Me(x);return yl(F,ve,I)},e.addHook=function(Z,x){typeof x=="function"&&Tr(z[Z],x)},e.removeHook=function(Z,x){if(x!==void 0){const I=Sy(z[Z],x);return I===-1?void 0:Ty(z[Z],I,1)[0]}return qc(z[Z])},e.removeHooks=function(Z){z[Z]=[]},e.removeAllHooks=function(){z=tu()},e}hd();function $a(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Rn=$a();function dd(t){Rn=t}var Tn={exec:()=>null};function ne(t,e=""){let n=typeof t=="string"?t:t.source,r={replace:(s,i)=>{let o=typeof i=="string"?i:i.source;return o=o.replace(We.caret,"$1"),n=n.replace(s,o),r},getRegex:()=>new RegExp(n,e)};return r}var Uy=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),We={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:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}>`)},Gy=/^(?:[ \t]*(?:\n|$))+/,jy=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Vy=/^ {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+|$)/,Hy=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Da=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,fd=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,pd=ne(fd).replace(/bull/g,Da).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(),Wy=ne(fd).replace(/bull/g,Da).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(),Na=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Yy=/^[^\n]+/,Fa=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,qy=ne(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Fa).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Xy=ne(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Da).getRegex(),_i="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",La=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Jy=ne("^ {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",La).replace("tag",_i).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),md=ne(Na).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",_i).getRegex(),Ky=ne(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",md).getRegex(),Ba={blockquote:Ky,code:jy,def:qy,fences:Vy,heading:Hy,hr:ys,html:Jy,lheading:pd,list:Xy,newline:Gy,paragraph:md,table:Tn,text:Yy},nu=ne("^ *([^\\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",_i).getRegex(),Qy={...Ba,lheading:Wy,table:nu,paragraph:ne(Na).replace("hr",ys).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",nu).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",_i).getRegex()},ex={...Ba,html:ne(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",La).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:Tn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ne(Na).replace("hr",ys).replace("heading",` *#{1,6} *[^
|
|
241
|
+
]`).replace("lheading",pd).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},tx=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,nx=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,gd=/^( {2,}|\\)\n(?!\s*$)/,rx=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ur=/[\p{P}\p{S}]/u,yi=/[\s\p{P}\p{S}]/u,Za=/[^\s\p{P}\p{S}]/u,sx=ne(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,yi).getRegex(),_d=/(?!~)[\p{P}\p{S}]/u,ix=/(?!~)[\s\p{P}\p{S}]/u,ox=/(?:[^\s\p{P}\p{S}]|~)/u,ax=ne(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Uy?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),yd=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,lx=ne(yd,"u").replace(/punct/g,ur).getRegex(),cx=ne(yd,"u").replace(/punct/g,_d).getRegex(),xd="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",ux=ne(xd,"gu").replace(/notPunctSpace/g,Za).replace(/punctSpace/g,yi).replace(/punct/g,ur).getRegex(),hx=ne(xd,"gu").replace(/notPunctSpace/g,ox).replace(/punctSpace/g,ix).replace(/punct/g,_d).getRegex(),dx=ne("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Za).replace(/punctSpace/g,yi).replace(/punct/g,ur).getRegex(),fx=ne(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,ur).getRegex(),px="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",mx=ne(px,"gu").replace(/notPunctSpace/g,Za).replace(/punctSpace/g,yi).replace(/punct/g,ur).getRegex(),gx=ne(/\\(punct)/,"gu").replace(/punct/g,ur).getRegex(),_x=ne(/^<(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(),yx=ne(La).replace("(?:-->|$)","-->").getRegex(),xx=ne("^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",yx).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ii=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,bx=ne(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",ii).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),bd=ne(/^!?\[(label)\]\[(ref)\]/).replace("label",ii).replace("ref",Fa).getRegex(),vd=ne(/^!?\[(ref)\](?:\[\])?/).replace("ref",Fa).getRegex(),vx=ne("reflink|nolink(?!\\()","g").replace("reflink",bd).replace("nolink",vd).getRegex(),ru=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ua={_backpedal:Tn,anyPunctuation:gx,autolink:_x,blockSkip:ax,br:gd,code:nx,del:Tn,delLDelim:Tn,delRDelim:Tn,emStrongLDelim:lx,emStrongRDelimAst:ux,emStrongRDelimUnd:dx,escape:tx,link:bx,nolink:vd,punctuation:sx,reflink:bd,reflinkSearch:vx,tag:xx,text:rx,url:Tn},wx={...Ua,link:ne(/^!?\[(label)\]\((.*?)\)/).replace("label",ii).getRegex(),reflink:ne(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ii).getRegex()},sa={...Ua,emStrongRDelimAst:hx,emStrongLDelim:cx,delLDelim:fx,delRDelim:mx,url:ne(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",ru).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:ne(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",ru).getRegex()},kx={...sa,br:ne(gd).replace("{2,}","*").getRegex(),text:ne(sa.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Fs={normal:Ba,gfm:Qy,pedantic:ex},Ir={normal:Ua,gfm:sa,breaks:kx,pedantic:wx},Sx={"&":"&","<":"<",">":">",'"':""","'":"'"},su=t=>Sx[t];function zt(t,e){if(e){if(We.escapeTest.test(t))return t.replace(We.escapeReplace,su)}else if(We.escapeTestNoEncode.test(t))return t.replace(We.escapeReplaceNoEncode,su);return t}function iu(t){try{t=encodeURI(t).replace(We.percentDecode,"%")}catch{return null}return t}function ou(t,e){var i;let n=t.replace(We.findPipe,(o,a,l)=>{let c=!1,u=a;for(;--u>=0&&l[u]==="\\";)c=!c;return c?"|":" |"}),r=n.split(We.splitPipe),s=0;if(r[0].trim()||r.shift(),r.length>0&&!((i=r.at(-1))!=null&&i.trim())&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;s<r.length;s++)r[s]=r[s].trim().replace(We.slashPipe,"|");return r}function Mr(t,e,n){let r=t.length;if(r===0)return"";let s=0;for(;s<r&&t.charAt(r-s-1)===e;)s++;return t.slice(0,r-s)}function Tx(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let r=0;r<t.length;r++)if(t[r]==="\\")r++;else if(t[r]===e[0])n++;else if(t[r]===e[1]&&(n--,n<0))return r;return n>0?-2:-1}function Ax(t,e=0){let n=e,r="";for(let s of t)if(s===" "){let i=4-n%4;r+=" ".repeat(i),n+=i}else r+=s,n++;return r}function au(t,e,n,r,s){let i=e.href,o=e.title||null,a=t[1].replace(s.other.outputLinkReplace,"$1");r.state.inLink=!0;let l={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:o,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,l}function Cx(t,e,n){let r=t.match(n.other.indentCodeCompensation);if(r===null)return e;let s=r[1];return e.split(`
|
|
242
|
+
`).map(i=>{let o=i.match(n.other.beginningSpace);if(o===null)return i;let[a]=o;return a.length>=s.length?i.slice(s.length):i}).join(`
|
|
243
|
+
`)}var oi=class{constructor(t){K(this,"options");K(this,"rules");K(this,"lexer");this.options=t||Rn}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let n=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Mr(n,`
|
|
244
|
+
`)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let n=e[0],r=Cx(n,e[3]||"",this.rules);return{type:"code",raw:n,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let n=e[2].trim();if(this.rules.other.endingHash.test(n)){let r=Mr(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:Mr(e[0],`
|
|
245
|
+
`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let n=Mr(e[0],`
|
|
246
|
+
`).split(`
|
|
247
|
+
`),r="",s="",i=[];for(;n.length>0;){let o=!1,a=[],l;for(l=0;l<n.length;l++)if(this.rules.other.blockquoteStart.test(n[l]))a.push(n[l]),o=!0;else if(!o)a.push(n[l]);else break;n=n.slice(l);let c=a.join(`
|
|
248
|
+
`),u=c.replace(this.rules.other.blockquoteSetextReplace,`
|
|
249
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
|
|
250
|
+
${c}`:c,s=s?`${s}
|
|
251
|
+
${u}`:u;let h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,i,!0),this.lexer.state.top=h,n.length===0)break;let f=i.at(-1);if((f==null?void 0:f.type)==="code")break;if((f==null?void 0:f.type)==="blockquote"){let d=f,m=d.raw+`
|
|
252
|
+
`+n.join(`
|
|
253
|
+
`),_=this.blockquote(m);i[i.length-1]=_,r=r.substring(0,r.length-d.raw.length)+_.raw,s=s.substring(0,s.length-d.text.length)+_.text;break}else if((f==null?void 0:f.type)==="list"){let d=f,m=d.raw+`
|
|
254
|
+
`+n.join(`
|
|
255
|
+
`),_=this.list(m);i[i.length-1]=_,r=r.substring(0,r.length-f.raw.length)+_.raw,s=s.substring(0,s.length-d.raw.length)+_.raw,n=m.substring(i.at(-1).raw.length).split(`
|
|
256
|
+
`);continue}}return{type:"blockquote",raw:r,tokens:i,text:s}}}list(t){var n,r;let e=this.rules.block.list.exec(t);if(e){let s=e[1].trim(),i=s.length>1,o={type:"list",raw:"",ordered:i,start:i?+s.slice(0,-1):"",loose:!1,items:[]};s=i?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=i?s:"[*+-]");let a=this.rules.other.listItemRegex(s),l=!1;for(;t;){let u=!1,h="",f="";if(!(e=a.exec(t))||this.rules.block.hr.test(t))break;h=e[0],t=t.substring(h.length);let d=Ax(e[2].split(`
|
|
257
|
+
`,1)[0],e[1].length),m=t.split(`
|
|
258
|
+
`,1)[0],_=!d.trim(),g=0;if(this.options.pedantic?(g=2,f=d.trimStart()):_?g=e[1].length+1:(g=d.search(this.rules.other.nonSpaceChar),g=g>4?1:g,f=d.slice(g),g+=e[1].length),_&&this.rules.other.blankLine.test(m)&&(h+=m+`
|
|
259
|
+
`,t=t.substring(m.length+1),u=!0),!u){let y=this.rules.other.nextBulletRegex(g),b=this.rules.other.hrRegex(g),w=this.rules.other.fencesBeginRegex(g),k=this.rules.other.headingBeginRegex(g),E=this.rules.other.htmlBeginRegex(g),A=this.rules.other.blockquoteBeginRegex(g);for(;t;){let C=t.split(`
|
|
260
|
+
`,1)[0],j;if(m=C,this.options.pedantic?(m=m.replace(this.rules.other.listReplaceNesting," "),j=m):j=m.replace(this.rules.other.tabCharGlobal," "),w.test(m)||k.test(m)||E.test(m)||A.test(m)||y.test(m)||b.test(m))break;if(j.search(this.rules.other.nonSpaceChar)>=g||!m.trim())f+=`
|
|
261
|
+
`+j.slice(g);else{if(_||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||w.test(d)||k.test(d)||b.test(d))break;f+=`
|
|
262
|
+
`+m}_=!m.trim(),h+=C+`
|
|
263
|
+
`,t=t.substring(C.length+1),d=j.slice(g)}}o.loose||(l?o.loose=!0:this.rules.other.doubleBlankLine.test(h)&&(l=!0)),o.items.push({type:"list_item",raw:h,task:!!this.options.gfm&&this.rules.other.listIsTask.test(f),loose:!1,text:f,tokens:[]}),o.raw+=h}let c=o.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let u of o.items){if(this.lexer.state.top=!1,u.tokens=this.lexer.blockTokens(u.text,[]),u.task){if(u.text=u.text.replace(this.rules.other.listReplaceTask,""),((n=u.tokens[0])==null?void 0:n.type)==="text"||((r=u.tokens[0])==null?void 0:r.type)==="paragraph"){u.tokens[0].raw=u.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),u.tokens[0].text=u.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 h=this.rules.other.listTaskCheckbox.exec(u.raw);if(h){let f={type:"checkbox",raw:h[0]+" ",checked:h[0]!=="[ ]"};u.checked=f.checked,o.loose?u.tokens[0]&&["paragraph","text"].includes(u.tokens[0].type)&&"tokens"in u.tokens[0]&&u.tokens[0].tokens?(u.tokens[0].raw=f.raw+u.tokens[0].raw,u.tokens[0].text=f.raw+u.tokens[0].text,u.tokens[0].tokens.unshift(f)):u.tokens.unshift({type:"paragraph",raw:f.raw,text:f.raw,tokens:[f]}):u.tokens.unshift(f)}}if(!o.loose){let h=u.tokens.filter(d=>d.type==="space"),f=h.length>0&&h.some(d=>this.rules.other.anyLine.test(d.raw));o.loose=f}}if(o.loose)for(let u of o.items){u.loose=!0;for(let h of u.tokens)h.type==="text"&&(h.type="paragraph")}return o}}html(t){let e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){let e=this.rules.block.def.exec(t);if(e){let n=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:n,raw:e[0],href:r,title:s}}}table(t){var o;let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let n=ou(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=(o=e[3])!=null&&o.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
264
|
+
`):[],i={type:"table",raw:e[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let a of r)this.rules.other.tableAlignRight.test(a)?i.align.push("right"):this.rules.other.tableAlignCenter.test(a)?i.align.push("center"):this.rules.other.tableAlignLeft.test(a)?i.align.push("left"):i.align.push(null);for(let a=0;a<n.length;a++)i.header.push({text:n[a],tokens:this.lexer.inline(n[a]),header:!0,align:i.align[a]});for(let a of s)i.rows.push(ou(a,i.header.length).map((l,c)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:i.align[c]})));return i}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e){let n=e[1].trim();return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:n,tokens:this.lexer.inline(n)}}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let n=e[1].charAt(e[1].length-1)===`
|
|
265
|
+
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let i=Mr(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=Tx(e[2],"()");if(i===-2)return;if(i>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let r=e[2],s="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],s=i[3])}else s=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),au(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[r.toLowerCase()];if(!s){let i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return au(n,s,n[0],this.lexer,this.rules)}}emStrong(t,e,n=""){let r=this.rules.inline.emStrongLDelim.exec(t);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let s=[...r[0]].length-1,i,o,a=s,l=0,c=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,e=e.slice(-1*t.length+s);(r=c.exec(e))!=null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(o=[...i].length,r[3]||r[4]){a+=o;continue}else if((r[5]||r[6])&&s%3&&!((s+o)%3)){l+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a+l);let u=[...r[0]][0].length,h=t.slice(0,s+r.index+u+o);if(Math.min(s,o)%2){let d=h.slice(1,-1);return{type:"em",raw:h,text:d,tokens:this.lexer.inlineTokens(d)}}let f=h.slice(2,-2);return{type:"strong",raw:h,text:f,tokens:this.lexer.inlineTokens(f)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),s=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&s&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:e[0],text:n}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t,e,n=""){let r=this.rules.inline.delLDelim.exec(t);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let s=[...r[0]].length-1,i,o,a=s,l=this.rules.inline.delRDelim;for(l.lastIndex=0,e=e.slice(-1*t.length+s);(r=l.exec(e))!=null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(o=[...i].length,o!==s))continue;if(r[3]||r[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let c=[...r[0]][0].length,u=t.slice(0,s+r.index+c+o),h=u.slice(s,-s);return{type:"del",raw:u,text:h,tokens:this.lexer.inlineTokens(h)}}}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let n,r;return e[2]==="@"?(n=e[1],r="mailto:"+n):(n=e[1],r=n),{type:"link",raw:e[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(t){var n;let e;if(e=this.rules.inline.url.exec(t)){let r,s;if(e[2]==="@")r=e[0],s="mailto:"+r;else{let i;do i=e[0],e[0]=((n=this.rules.inline._backpedal.exec(e[0]))==null?void 0:n[0])??"";while(i!==e[0]);r=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let n=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:n}}}},wt=class ia{constructor(e){K(this,"tokens");K(this,"options");K(this,"state");K(this,"inlineQueue");K(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Rn,this.options.tokenizer=this.options.tokenizer||new oi,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 n={other:We,block:Fs.normal,inline:Ir.normal};this.options.pedantic?(n.block=Fs.pedantic,n.inline=Ir.pedantic):this.options.gfm&&(n.block=Fs.gfm,this.options.breaks?n.inline=Ir.breaks:n.inline=Ir.gfm),this.tokenizer.rules=n}static get rules(){return{block:Fs,inline:Ir}}static lex(e,n){return new ia(n).lex(e)}static lexInline(e,n){return new ia(n).inlineTokens(e)}lex(e){e=e.replace(We.carriageReturn,`
|
|
266
|
+
`),this.blockTokens(e,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,n=[],r=!1){var s,i,o;for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(We.tabCharGlobal," ").replace(We.spaceLine,""));e;){let a;if((i=(s=this.options.extensions)==null?void 0:s.block)!=null&&i.some(c=>(a=c.call({lexer:this},e,n))?(e=e.substring(a.raw.length),n.push(a),!0):!1))continue;if(a=this.tokenizer.space(e)){e=e.substring(a.raw.length);let c=n.at(-1);a.raw.length===1&&c!==void 0?c.raw+=`
|
|
267
|
+
`:n.push(a);continue}if(a=this.tokenizer.code(e)){e=e.substring(a.raw.length);let c=n.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
|
|
268
|
+
`)?"":`
|
|
269
|
+
`)+a.raw,c.text+=`
|
|
270
|
+
`+a.text,this.inlineQueue.at(-1).src=c.text):n.push(a);continue}if(a=this.tokenizer.fences(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.heading(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.hr(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.blockquote(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.list(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.html(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.def(e)){e=e.substring(a.raw.length);let c=n.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
|
|
271
|
+
`)?"":`
|
|
272
|
+
`)+a.raw,c.text+=`
|
|
273
|
+
`+a.raw,this.inlineQueue.at(-1).src=c.text):this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title},n.push(a));continue}if(a=this.tokenizer.table(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.lheading(e)){e=e.substring(a.raw.length),n.push(a);continue}let l=e;if((o=this.options.extensions)!=null&&o.startBlock){let c=1/0,u=e.slice(1),h;this.options.extensions.startBlock.forEach(f=>{h=f.call({lexer:this},u),typeof h=="number"&&h>=0&&(c=Math.min(c,h))}),c<1/0&&c>=0&&(l=e.substring(0,c+1))}if(this.state.top&&(a=this.tokenizer.paragraph(l))){let c=n.at(-1);r&&(c==null?void 0:c.type)==="paragraph"?(c.raw+=(c.raw.endsWith(`
|
|
274
|
+
`)?"":`
|
|
275
|
+
`)+a.raw,c.text+=`
|
|
276
|
+
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):n.push(a),r=l.length!==e.length,e=e.substring(a.raw.length);continue}if(a=this.tokenizer.text(e)){e=e.substring(a.raw.length);let c=n.at(-1);(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
|
|
277
|
+
`)?"":`
|
|
278
|
+
`)+a.raw,c.text+=`
|
|
279
|
+
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):n.push(a);continue}if(e){let c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){var l,c,u,h,f;this.tokenizer.lexer=this;let r=e,s=null;if(this.tokens.links){let d=Object.keys(this.tokens.links);if(d.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)d.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,s.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(s=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)i=s[2]?s[2].length:0,r=r.slice(0,s.index+i)+"["+"a".repeat(s[0].length-i-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=((c=(l=this.options.hooks)==null?void 0:l.emStrongMask)==null?void 0:c.call({lexer:this},r))??r;let o=!1,a="";for(;e;){o||(a=""),o=!1;let d;if((h=(u=this.options.extensions)==null?void 0:u.inline)!=null&&h.some(_=>(d=_.call({lexer:this},e,n))?(e=e.substring(d.raw.length),n.push(d),!0):!1))continue;if(d=this.tokenizer.escape(e)){e=e.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.tag(e)){e=e.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.link(e)){e=e.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(d.raw.length);let _=n.at(-1);d.type==="text"&&(_==null?void 0:_.type)==="text"?(_.raw+=d.raw,_.text+=d.text):n.push(d);continue}if(d=this.tokenizer.emStrong(e,r,a)){e=e.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.codespan(e)){e=e.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.br(e)){e=e.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.del(e,r,a)){e=e.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.autolink(e)){e=e.substring(d.raw.length),n.push(d);continue}if(!this.state.inLink&&(d=this.tokenizer.url(e))){e=e.substring(d.raw.length),n.push(d);continue}let m=e;if((f=this.options.extensions)!=null&&f.startInline){let _=1/0,g=e.slice(1),y;this.options.extensions.startInline.forEach(b=>{y=b.call({lexer:this},g),typeof y=="number"&&y>=0&&(_=Math.min(_,y))}),_<1/0&&_>=0&&(m=e.substring(0,_+1))}if(d=this.tokenizer.inlineText(m)){e=e.substring(d.raw.length),d.raw.slice(-1)!=="_"&&(a=d.raw.slice(-1)),o=!0;let _=n.at(-1);(_==null?void 0:_.type)==="text"?(_.raw+=d.raw,_.text+=d.text):n.push(d);continue}if(e){let _="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(_);break}else throw new Error(_)}}return n}},ai=class{constructor(t){K(this,"options");K(this,"parser");this.options=t||Rn}space(t){return""}code({text:t,lang:e,escaped:n}){var i;let r=(i=(e||"").match(We.notSpaceStart))==null?void 0:i[0],s=t.replace(We.endingNewline,"")+`
|
|
280
|
+
`;return r?'<pre><code class="language-'+zt(r)+'">'+(n?s:zt(s,!0))+`</code></pre>
|
|
281
|
+
`:"<pre><code>"+(n?s:zt(s,!0))+`</code></pre>
|
|
282
|
+
`}blockquote({tokens:t}){return`<blockquote>
|
|
283
|
+
${this.parser.parse(t)}</blockquote>
|
|
284
|
+
`}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
|
|
285
|
+
`}hr(t){return`<hr>
|
|
286
|
+
`}list(t){let e=t.ordered,n=t.start,r="";for(let o=0;o<t.items.length;o++){let a=t.items[o];r+=this.listitem(a)}let s=e?"ol":"ul",i=e&&n!==1?' start="'+n+'"':"";return"<"+s+i+`>
|
|
287
|
+
`+r+"</"+s+`>
|
|
288
|
+
`}listitem(t){return`<li>${this.parser.parse(t.tokens)}</li>
|
|
289
|
+
`}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
|
|
290
|
+
`}table(t){let e="",n="";for(let s=0;s<t.header.length;s++)n+=this.tablecell(t.header[s]);e+=this.tablerow({text:n});let r="";for(let s=0;s<t.rows.length;s++){let i=t.rows[s];n="";for(let o=0;o<i.length;o++)n+=this.tablecell(i[o]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
|
|
291
|
+
<thead>
|
|
292
|
+
`+e+`</thead>
|
|
293
|
+
`+r+`</table>
|
|
294
|
+
`}tablerow({text:t}){return`<tr>
|
|
295
|
+
${t}</tr>
|
|
296
|
+
`}tablecell(t){let e=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
|
|
297
|
+
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${zt(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){let r=this.parser.parseInline(n),s=iu(t);if(s===null)return r;t=s;let i='<a href="'+t+'"';return e&&(i+=' title="'+zt(e)+'"'),i+=">"+r+"</a>",i}image({href:t,title:e,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let s=iu(t);if(s===null)return zt(n);t=s;let i=`<img src="${t}" alt="${zt(n)}"`;return e&&(i+=` title="${zt(e)}"`),i+=">",i}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:zt(t.text)}},Ga=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},kt=class oa{constructor(e){K(this,"options");K(this,"renderer");K(this,"textRenderer");this.options=e||Rn,this.options.renderer=this.options.renderer||new ai,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ga}static parse(e,n){return new oa(n).parse(e)}static parseInline(e,n){return new oa(n).parseInline(e)}parse(e){var r,s;this.renderer.parser=this;let n="";for(let i=0;i<e.length;i++){let o=e[i];if((s=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&s[o.type]){let l=o,c=this.options.extensions.renderers[l.type].call({parser:this},l);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(l.type)){n+=c||"";continue}}let a=o;switch(a.type){case"space":{n+=this.renderer.space(a);break}case"hr":{n+=this.renderer.hr(a);break}case"heading":{n+=this.renderer.heading(a);break}case"code":{n+=this.renderer.code(a);break}case"table":{n+=this.renderer.table(a);break}case"blockquote":{n+=this.renderer.blockquote(a);break}case"list":{n+=this.renderer.list(a);break}case"checkbox":{n+=this.renderer.checkbox(a);break}case"html":{n+=this.renderer.html(a);break}case"def":{n+=this.renderer.def(a);break}case"paragraph":{n+=this.renderer.paragraph(a);break}case"text":{n+=this.renderer.text(a);break}default:{let l='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return n}parseInline(e,n=this.renderer){var s,i;this.renderer.parser=this;let r="";for(let o=0;o<e.length;o++){let a=e[o];if((i=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&i[a.type]){let c=this.options.extensions.renderers[a.type].call({parser:this},a);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){r+=c||"";continue}}let l=a;switch(l.type){case"escape":{r+=n.text(l);break}case"html":{r+=n.html(l);break}case"link":{r+=n.link(l);break}case"image":{r+=n.image(l);break}case"checkbox":{r+=n.checkbox(l);break}case"strong":{r+=n.strong(l);break}case"em":{r+=n.em(l);break}case"codespan":{r+=n.codespan(l);break}case"br":{r+=n.br(l);break}case"del":{r+=n.del(l);break}case"text":{r+=n.text(l);break}default:{let c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return r}},js,Fr=(js=class{constructor(t){K(this,"options");K(this,"block");this.options=t||Rn}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(){return this.block?wt.lex:wt.lexInline}provideParser(){return this.block?kt.parse:kt.parseInline}},K(js,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),K(js,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),js),Ex=class{constructor(...t){K(this,"defaults",$a());K(this,"options",this.setOptions);K(this,"parse",this.parseMarkdown(!0));K(this,"parseInline",this.parseMarkdown(!1));K(this,"Parser",kt);K(this,"Renderer",ai);K(this,"TextRenderer",Ga);K(this,"Lexer",wt);K(this,"Tokenizer",oi);K(this,"Hooks",Fr);this.use(...t)}walkTokens(t,e){var r,s;let n=[];for(let i of t)switch(n=n.concat(e.call(this,i)),i.type){case"table":{let o=i;for(let a of o.header)n=n.concat(this.walkTokens(a.tokens,e));for(let a of o.rows)for(let l of a)n=n.concat(this.walkTokens(l.tokens,e));break}case"list":{let o=i;n=n.concat(this.walkTokens(o.items,e));break}default:{let o=i;(s=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&s[o.type]?this.defaults.extensions.childTokens[o.type].forEach(a=>{let l=o[a].flat(1/0);n=n.concat(this.walkTokens(l,e))}):o.tokens&&(n=n.concat(this.walkTokens(o.tokens,e)))}}return n}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let i=e.renderers[s.name];i?e.renderers[s.name]=function(...o){let a=s.renderer.apply(this,o);return a===!1&&(a=i.apply(this,o)),a}:e.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=e[s.level];i?i.unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),r.extensions=e),n.renderer){let s=this.defaults.renderer||new ai(this.defaults);for(let i in n.renderer){if(!(i in s))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let o=i,a=n.renderer[o],l=s[o];s[o]=(...c)=>{let u=a.apply(s,c);return u===!1&&(u=l.apply(s,c)),u||""}}r.renderer=s}if(n.tokenizer){let s=this.defaults.tokenizer||new oi(this.defaults);for(let i in n.tokenizer){if(!(i in s))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let o=i,a=n.tokenizer[o],l=s[o];s[o]=(...c)=>{let u=a.apply(s,c);return u===!1&&(u=l.apply(s,c)),u}}r.tokenizer=s}if(n.hooks){let s=this.defaults.hooks||new Fr;for(let i in n.hooks){if(!(i in s))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let o=i,a=n.hooks[o],l=s[o];Fr.passThroughHooks.has(i)?s[o]=c=>{if(this.defaults.async&&Fr.passThroughHooksRespectAsync.has(i))return(async()=>{let h=await a.call(s,c);return l.call(s,h)})();let u=a.call(s,c);return l.call(s,u)}:s[o]=(...c)=>{if(this.defaults.async)return(async()=>{let h=await a.apply(s,c);return h===!1&&(h=await l.apply(s,c)),h})();let u=a.apply(s,c);return u===!1&&(u=l.apply(s,c)),u}}r.hooks=s}if(n.walkTokens){let s=this.defaults.walkTokens,i=n.walkTokens;r.walkTokens=function(o){let a=[];return a.push(i.call(this,o)),s&&(a=a.concat(s.call(this,o))),a}}this.defaults={...this.defaults,...r}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return wt.lex(t,e??this.defaults)}parser(t,e){return kt.parse(t,e??this.defaults)}parseMarkdown(t){return(e,n)=>{let r={...n},s={...this.defaults,...r},i=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&r.async===!1)return i(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 e>"u"||e===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=t),s.async)return(async()=>{let o=s.hooks?await s.hooks.preprocess(e):e,a=await(s.hooks?await s.hooks.provideLexer():t?wt.lex:wt.lexInline)(o,s),l=s.hooks?await s.hooks.processAllTokens(a):a;s.walkTokens&&await Promise.all(this.walkTokens(l,s.walkTokens));let c=await(s.hooks?await s.hooks.provideParser():t?kt.parse:kt.parseInline)(l,s);return s.hooks?await s.hooks.postprocess(c):c})().catch(i);try{s.hooks&&(e=s.hooks.preprocess(e));let o=(s.hooks?s.hooks.provideLexer():t?wt.lex:wt.lexInline)(e,s);s.hooks&&(o=s.hooks.processAllTokens(o)),s.walkTokens&&this.walkTokens(o,s.walkTokens);let a=(s.hooks?s.hooks.provideParser():t?kt.parse:kt.parseInline)(o,s);return s.hooks&&(a=s.hooks.postprocess(a)),a}catch(o){return i(o)}}}onError(t,e){return n=>{if(n.message+=`
|
|
298
|
+
Please report this to https://github.com/markedjs/marked.`,t){let r="<p>An error occurred:</p><pre>"+zt(n.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},Mn=new Ex;function le(t,e){return Mn.parse(t,e)}le.options=le.setOptions=function(t){return Mn.setOptions(t),le.defaults=Mn.defaults,dd(le.defaults),le};le.getDefaults=$a;le.defaults=Rn;le.use=function(...t){return Mn.use(...t),le.defaults=Mn.defaults,dd(le.defaults),le};le.walkTokens=function(t,e){return Mn.walkTokens(t,e)};le.parseInline=Mn.parseInline;le.Parser=kt;le.parser=kt.parse;le.Renderer=ai;le.TextRenderer=Ga;le.Lexer=wt;le.lexer=wt.lex;le.Tokenizer=oi;le.Hooks=Fr;le.parse=le;le.options;le.setOptions;le.use;le.walkTokens;le.parseInline;kt.parse;wt.lex;le.setOptions({gfm:!0,breaks:!0,async:!1});const Px="agent-play-preview-chat-display-v1",wd={fontSizePx:8,panelWidthPx:200,scrollMaxHeightPx:148};function _o(t,e,n){return Math.min(n,Math.max(e,t))}function Ix(t){if(t===null||t.length===0)return null;try{const e=JSON.parse(t);if(e===null||typeof e!="object")return null;const n=e,r={};return typeof n.fontSizePx=="number"&&Number.isFinite(n.fontSizePx)&&(r.fontSizePx=n.fontSizePx),typeof n.panelWidthPx=="number"&&Number.isFinite(n.panelWidthPx)&&(r.panelWidthPx=n.panelWidthPx),typeof n.scrollMaxHeightPx=="number"&&Number.isFinite(n.scrollMaxHeightPx)&&(r.scrollMaxHeightPx=n.scrollMaxHeightPx),Object.keys(r).length>0?r:null}catch{return null}}let lu={...wd};function Mx(t){return{fontSizePx:_o(Math.round(t.fontSizePx),5,18),panelWidthPx:_o(Math.round(t.panelWidthPx),100,400),scrollMaxHeightPx:_o(Math.round(t.scrollMaxHeightPx),24,200)}}function Rx(){const t=Ix(typeof localStorage<"u"?localStorage.getItem(Px):null),e={...wd,...t};return lu=Mx(e),{...lu}}typeof localStorage<"u"&&Rx();function T(t,e,n){function r(a,l){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:l,constr:o,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,l);const c=o.prototype,u=Object.keys(c);for(let h=0;h<u.length;h++){const f=u[h];f in a||(a[f]=c[f].bind(a))}}const s=(n==null?void 0:n.Parent)??Object;class i extends s{}Object.defineProperty(i,"name",{value:t});function o(a){var l;const c=n!=null&&n.Parent?new i:this;r(c,a),(l=c._zod).deferred??(l.deferred=[]);for(const u of c._zod.deferred)u();return c}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:a=>{var l,c;return n!=null&&n.Parent&&a instanceof n.Parent?!0:(c=(l=a==null?void 0:a._zod)==null?void 0:l.traits)==null?void 0:c.has(t)}}),Object.defineProperty(o,"name",{value:t}),o}class Xn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class kd extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const Sd={};function hn(t){return Sd}function Td(t){const e=Object.values(t).filter(r=>typeof r=="number");return Object.entries(t).filter(([r,s])=>e.indexOf(+r)===-1).map(([r,s])=>s)}function aa(t,e){return typeof e=="bigint"?e.toString():e}function xi(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function ja(t){return t==null}function Va(t){const e=t.startsWith("^")?1:0,n=t.endsWith("$")?t.length-1:t.length;return t.slice(e,n)}function zx(t,e){const n=(t.toString().split(".")[1]||"").length,r=e.toString();let s=(r.split(".")[1]||"").length;if(s===0&&/\d?e-\d?/.test(r)){const l=r.match(/\d?e-(\d?)/);l!=null&&l[1]&&(s=Number.parseInt(l[1]))}const i=n>s?n:s,o=Number.parseInt(t.toFixed(i).replace(".","")),a=Number.parseInt(e.toFixed(i).replace(".",""));return o%a/10**i}const cu=Symbol("evaluating");function Q(t,e,n){let r;Object.defineProperty(t,e,{get(){if(r!==cu)return r===void 0&&(r=cu,r=n()),r},set(s){Object.defineProperty(t,e,{value:s})},configurable:!0})}function zn(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0})}function pn(...t){const e={};for(const n of t){const r=Object.getOwnPropertyDescriptors(n);Object.assign(e,r)}return Object.defineProperties({},e)}function uu(t){return JSON.stringify(t)}function Ox(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Ad="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function es(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const $x=xi(()=>{var t;if(typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)!=null&&t.includes("Cloudflare")))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function lr(t){if(es(t)===!1)return!1;const e=t.constructor;if(e===void 0||typeof e!="function")return!0;const n=e.prototype;return!(es(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Cd(t){return lr(t)?{...t}:Array.isArray(t)?[...t]:t}const Dx=new Set(["string","number","symbol"]);function cr(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function mn(t,e,n){const r=new t._zod.constr(e??t._zod.def);return(!e||n!=null&&n.parent)&&(r._zod.parent=t),r}function B(t){const e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if((e==null?void 0:e.message)!==void 0){if((e==null?void 0:e.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function Nx(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}const Fx={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Lx(t,e){const n=t._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=pn(t._zod.def,{get shape(){const o={};for(const a in e){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(o[a]=n.shape[a])}return zn(this,"shape",o),o},checks:[]});return mn(t,i)}function Bx(t,e){const n=t._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=pn(t._zod.def,{get shape(){const o={...t._zod.def.shape};for(const a in e){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete o[a]}return zn(this,"shape",o),o},checks:[]});return mn(t,i)}function Zx(t,e){if(!lr(e))throw new Error("Invalid input to extend: expected a plain object");const n=t._zod.def.checks;if(n&&n.length>0){const i=t._zod.def.shape;for(const o in e)if(Object.getOwnPropertyDescriptor(i,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const s=pn(t._zod.def,{get shape(){const i={...t._zod.def.shape,...e};return zn(this,"shape",i),i}});return mn(t,s)}function Ux(t,e){if(!lr(e))throw new Error("Invalid input to safeExtend: expected a plain object");const n=pn(t._zod.def,{get shape(){const r={...t._zod.def.shape,...e};return zn(this,"shape",r),r}});return mn(t,n)}function Gx(t,e){const n=pn(t._zod.def,{get shape(){const r={...t._zod.def.shape,...e._zod.def.shape};return zn(this,"shape",r),r},get catchall(){return e._zod.def.catchall},checks:[]});return mn(t,n)}function jx(t,e,n){const s=e._zod.def.checks;if(s&&s.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const o=pn(e._zod.def,{get shape(){const a=e._zod.def.shape,l={...a};if(n)for(const c in n){if(!(c in a))throw new Error(`Unrecognized key: "${c}"`);n[c]&&(l[c]=t?new t({type:"optional",innerType:a[c]}):a[c])}else for(const c in a)l[c]=t?new t({type:"optional",innerType:a[c]}):a[c];return zn(this,"shape",l),l},checks:[]});return mn(e,o)}function Vx(t,e,n){const r=pn(e._zod.def,{get shape(){const s=e._zod.def.shape,i={...s};if(n)for(const o in n){if(!(o in i))throw new Error(`Unrecognized key: "${o}"`);n[o]&&(i[o]=new t({type:"nonoptional",innerType:s[o]}))}else for(const o in s)i[o]=new t({type:"nonoptional",innerType:s[o]});return zn(this,"shape",i),i}});return mn(e,r)}function Yn(t,e=0){var n;if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(((n=t.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function qn(t,e){return e.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(t),n})}function Ls(t){return typeof t=="string"?t:t==null?void 0:t.message}function dn(t,e,n){var s,i,o,a,l,c;const r={...t,path:t.path??[]};if(!t.message){const u=Ls((o=(i=(s=t.inst)==null?void 0:s._zod.def)==null?void 0:i.error)==null?void 0:o.call(i,t))??Ls((a=e==null?void 0:e.error)==null?void 0:a.call(e,t))??Ls((l=n.customError)==null?void 0:l.call(n,t))??Ls((c=n.localeError)==null?void 0:c.call(n,t))??"Invalid input";r.message=u}return delete r.inst,delete r.continue,e!=null&&e.reportInput||delete r.input,r}function Ha(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function ts(...t){const[e,n,r]=t;return typeof e=="string"?{message:e,code:"custom",input:n,inst:r}:{...e}}const Ed=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,aa,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},Pd=T("$ZodError",Ed),Id=T("$ZodError",Ed,{Parent:Error});function Hx(t,e=n=>n.message){const n={},r=[];for(const s of t.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(e(s))):r.push(e(s));return{formErrors:r,fieldErrors:n}}function Wx(t,e=n=>n.message){const n={_errors:[]},r=s=>{for(const i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(o=>r({issues:o}));else if(i.code==="invalid_key")r({issues:i.issues});else if(i.code==="invalid_element")r({issues:i.issues});else if(i.path.length===0)n._errors.push(e(i));else{let o=n,a=0;for(;a<i.path.length;){const l=i.path[a];a===i.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(e(i))):o[l]=o[l]||{_errors:[]},o=o[l],a++}}};return r(t),n}const Wa=t=>(e,n,r,s)=>{const i=r?Object.assign(r,{async:!1}):{async:!1},o=e._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new Xn;if(o.issues.length){const a=new((s==null?void 0:s.Err)??t)(o.issues.map(l=>dn(l,i,hn())));throw Ad(a,s==null?void 0:s.callee),a}return o.value},Ya=t=>async(e,n,r,s)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let o=e._zod.run({value:n,issues:[]},i);if(o instanceof Promise&&(o=await o),o.issues.length){const a=new((s==null?void 0:s.Err)??t)(o.issues.map(l=>dn(l,i,hn())));throw Ad(a,s==null?void 0:s.callee),a}return o.value},bi=t=>(e,n,r)=>{const s=r?{...r,async:!1}:{async:!1},i=e._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new Xn;return i.issues.length?{success:!1,error:new(t??Pd)(i.issues.map(o=>dn(o,s,hn())))}:{success:!0,data:i.value}},Yx=bi(Id),vi=t=>async(e,n,r)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let i=e._zod.run({value:n,issues:[]},s);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new t(i.issues.map(o=>dn(o,s,hn())))}:{success:!0,data:i.value}},qx=vi(Id),Xx=t=>(e,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Wa(t)(e,n,s)},Jx=t=>(e,n,r)=>Wa(t)(e,n,r),Kx=t=>async(e,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ya(t)(e,n,s)},Qx=t=>async(e,n,r)=>Ya(t)(e,n,r),eb=t=>(e,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return bi(t)(e,n,s)},tb=t=>(e,n,r)=>bi(t)(e,n,r),nb=t=>async(e,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return vi(t)(e,n,s)},rb=t=>async(e,n,r)=>vi(t)(e,n,r),sb=/^[cC][^\s-]{8,}$/,ib=/^[0-9a-z]+$/,ob=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ab=/^[0-9a-vA-V]{20}$/,lb=/^[A-Za-z0-9]{27}$/,cb=/^[a-zA-Z0-9_-]{21}$/,ub=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,hb=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,hu=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,db=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,fb="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function pb(){return new RegExp(fb,"u")}const mb=/^(?:(?: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])$/,gb=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,_b=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,yb=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,xb=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Md=/^[A-Za-z0-9_-]*$/,bb=/^\+[1-9]\d{6,14}$/,Rd="(?:(?:\\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])))",vb=new RegExp(`^${Rd}$`);function zd(t){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function wb(t){return new RegExp(`^${zd(t)}$`)}function kb(t){const e=zd({precision:t.precision}),n=["Z"];t.local&&n.push(""),t.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${e}(?:${n.join("|")})`;return new RegExp(`^${Rd}T(?:${r})$`)}const Sb=t=>{const e=t?`[\\s\\S]{${(t==null?void 0:t.minimum)??0},${(t==null?void 0:t.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},Tb=/^-?\d+$/,Od=/^-?\d+(?:\.\d+)?$/,Ab=/^(?:true|false)$/i,Cb=/^[^A-Z]*$/,Eb=/^[^a-z]*$/,rt=T("$ZodCheck",(t,e)=>{var n;t._zod??(t._zod={}),t._zod.def=e,(n=t._zod).onattach??(n.onattach=[])}),$d={number:"number",bigint:"bigint",object:"date"},Dd=T("$ZodCheckLessThan",(t,e)=>{rt.init(t,e);const n=$d[typeof e.value];t._zod.onattach.push(r=>{const s=r._zod.bag,i=(e.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<i&&(e.inclusive?s.maximum=e.value:s.exclusiveMaximum=e.value)}),t._zod.check=r=>{(e.inclusive?r.value<=e.value:r.value<e.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Nd=T("$ZodCheckGreaterThan",(t,e)=>{rt.init(t,e);const n=$d[typeof e.value];t._zod.onattach.push(r=>{const s=r._zod.bag,i=(e.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>i&&(e.inclusive?s.minimum=e.value:s.exclusiveMinimum=e.value)}),t._zod.check=r=>{(e.inclusive?r.value>=e.value:r.value>e.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Pb=T("$ZodCheckMultipleOf",(t,e)=>{rt.init(t,e),t._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=e.value)}),t._zod.check=n=>{if(typeof n.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%e.value===BigInt(0):zx(n.value,e.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:e.value,input:n.value,inst:t,continue:!e.abort})}}),Ib=T("$ZodCheckNumberFormat",(t,e)=>{var o;rt.init(t,e),e.format=e.format||"float64";const n=(o=e.format)==null?void 0:o.includes("int"),r=n?"int":"number",[s,i]=Fx[e.format];t._zod.onattach.push(a=>{const l=a._zod.bag;l.format=e.format,l.minimum=s,l.maximum=i,n&&(l.pattern=Tb)}),t._zod.check=a=>{const l=a.value;if(n){if(!Number.isInteger(l)){a.issues.push({expected:r,format:e.format,code:"invalid_type",continue:!1,input:l,inst:t});return}if(!Number.isSafeInteger(l)){l>0?a.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:r,inclusive:!0,continue:!e.abort}):a.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:r,inclusive:!0,continue:!e.abort});return}}l<s&&a.issues.push({origin:"number",input:l,code:"too_small",minimum:s,inclusive:!0,inst:t,continue:!e.abort}),l>i&&a.issues.push({origin:"number",input:l,code:"too_big",maximum:i,inclusive:!0,inst:t,continue:!e.abort})}}),Mb=T("$ZodCheckMaxLength",(t,e)=>{var n;rt.init(t,e),(n=t._zod.def).when??(n.when=r=>{const s=r.value;return!ja(s)&&s.length!==void 0}),t._zod.onattach.push(r=>{const s=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<s&&(r._zod.bag.maximum=e.maximum)}),t._zod.check=r=>{const s=r.value;if(s.length<=e.maximum)return;const o=Ha(s);r.issues.push({origin:o,code:"too_big",maximum:e.maximum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),Rb=T("$ZodCheckMinLength",(t,e)=>{var n;rt.init(t,e),(n=t._zod.def).when??(n.when=r=>{const s=r.value;return!ja(s)&&s.length!==void 0}),t._zod.onattach.push(r=>{const s=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>s&&(r._zod.bag.minimum=e.minimum)}),t._zod.check=r=>{const s=r.value;if(s.length>=e.minimum)return;const o=Ha(s);r.issues.push({origin:o,code:"too_small",minimum:e.minimum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),zb=T("$ZodCheckLengthEquals",(t,e)=>{var n;rt.init(t,e),(n=t._zod.def).when??(n.when=r=>{const s=r.value;return!ja(s)&&s.length!==void 0}),t._zod.onattach.push(r=>{const s=r._zod.bag;s.minimum=e.length,s.maximum=e.length,s.length=e.length}),t._zod.check=r=>{const s=r.value,i=s.length;if(i===e.length)return;const o=Ha(s),a=i>e.length;r.issues.push({origin:o,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:r.value,inst:t,continue:!e.abort})}}),wi=T("$ZodCheckStringFormat",(t,e)=>{var n,r;rt.init(t,e),t._zod.onattach.push(s=>{const i=s._zod.bag;i.format=e.format,e.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(e.pattern))}),e.pattern?(n=t._zod).check??(n.check=s=>{e.pattern.lastIndex=0,!e.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:e.format,input:s.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(r=t._zod).check??(r.check=()=>{})}),Ob=T("$ZodCheckRegex",(t,e)=>{wi.init(t,e),t._zod.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),$b=T("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Cb),wi.init(t,e)}),Db=T("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=Eb),wi.init(t,e)}),Nb=T("$ZodCheckIncludes",(t,e)=>{rt.init(t,e);const n=cr(e.includes),r=new RegExp(typeof e.position=="number"?`^.{${e.position}}${n}`:n);e.pattern=r,t._zod.onattach.push(s=>{const i=s._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),t._zod.check=s=>{s.value.includes(e.includes,e.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:s.value,inst:t,continue:!e.abort})}}),Fb=T("$ZodCheckStartsWith",(t,e)=>{rt.init(t,e);const n=new RegExp(`^${cr(e.prefix)}.*`);e.pattern??(e.pattern=n),t._zod.onattach.push(r=>{const s=r._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),t._zod.check=r=>{r.value.startsWith(e.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:r.value,inst:t,continue:!e.abort})}}),Lb=T("$ZodCheckEndsWith",(t,e)=>{rt.init(t,e);const n=new RegExp(`.*${cr(e.suffix)}$`);e.pattern??(e.pattern=n),t._zod.onattach.push(r=>{const s=r._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),t._zod.check=r=>{r.value.endsWith(e.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:r.value,inst:t,continue:!e.abort})}}),Bb=T("$ZodCheckOverwrite",(t,e)=>{rt.init(t,e),t._zod.check=n=>{n.value=e.tx(n.value)}});class Zb{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const r=e.split(`
|
|
299
|
+
`).filter(o=>o),s=Math.min(...r.map(o=>o.length-o.trimStart().length)),i=r.map(o=>o.slice(s)).map(o=>" ".repeat(this.indent*2)+o);for(const o of i)this.content.push(o)}compile(){const e=Function,n=this==null?void 0:this.args,s=[...((this==null?void 0:this.content)??[""]).map(i=>` ${i}`)];return new e(...n,s.join(`
|
|
300
|
+
`))}}const Ub={major:4,minor:3,patch:6},ye=T("$ZodType",(t,e)=>{var s;var n;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=Ub;const r=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&r.unshift(t);for(const i of r)for(const o of i._zod.onattach)o(t);if(r.length===0)(n=t._zod).deferred??(n.deferred=[]),(s=t._zod.deferred)==null||s.push(()=>{t._zod.run=t._zod.parse});else{const i=(a,l,c)=>{let u=Yn(a),h;for(const f of l){if(f._zod.def.when){if(!f._zod.def.when(a))continue}else if(u)continue;const d=a.issues.length,m=f._zod.check(a);if(m instanceof Promise&&(c==null?void 0:c.async)===!1)throw new Xn;if(h||m instanceof Promise)h=(h??Promise.resolve()).then(async()=>{await m,a.issues.length!==d&&(u||(u=Yn(a,d)))});else{if(a.issues.length===d)continue;u||(u=Yn(a,d))}}return h?h.then(()=>a):a},o=(a,l,c)=>{if(Yn(a))return a.aborted=!0,a;const u=i(l,r,c);if(u instanceof Promise){if(c.async===!1)throw new Xn;return u.then(h=>t._zod.parse(h,c))}return t._zod.parse(u,c)};t._zod.run=(a,l)=>{if(l.skipChecks)return t._zod.parse(a,l);if(l.direction==="backward"){const u=t._zod.parse({value:a.value,issues:[]},{...l,skipChecks:!0});return u instanceof Promise?u.then(h=>o(h,a,l)):o(u,a,l)}const c=t._zod.parse(a,l);if(c instanceof Promise){if(l.async===!1)throw new Xn;return c.then(u=>i(u,r,l))}return i(c,r,l)}}Q(t,"~standard",()=>({validate:i=>{var o;try{const a=Yx(t,i);return a.success?{value:a.data}:{issues:(o=a.error)==null?void 0:o.issues}}catch{return qx(t,i).then(l=>{var c;return l.success?{value:l.data}:{issues:(c=l.error)==null?void 0:c.issues}})}},vendor:"zod",version:1}))}),qa=T("$ZodString",(t,e)=>{var n;ye.init(t,e),t._zod.pattern=[...((n=t==null?void 0:t._zod.bag)==null?void 0:n.patterns)??[]].pop()??Sb(t._zod.bag),t._zod.parse=(r,s)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),we=T("$ZodStringFormat",(t,e)=>{wi.init(t,e),qa.init(t,e)}),Gb=T("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=hb),we.init(t,e)}),jb=T("$ZodUUID",(t,e)=>{if(e.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(r===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=hu(r))}else e.pattern??(e.pattern=hu());we.init(t,e)}),Vb=T("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=db),we.init(t,e)}),Hb=T("$ZodURL",(t,e)=>{we.init(t,e),t._zod.check=n=>{try{const r=n.value.trim(),s=new URL(r);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(s.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:n.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:n.value,inst:t,continue:!e.abort})),e.normalize?n.value=s.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:t,continue:!e.abort})}}}),Wb=T("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=pb()),we.init(t,e)}),Yb=T("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=cb),we.init(t,e)}),qb=T("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=sb),we.init(t,e)}),Xb=T("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=ib),we.init(t,e)}),Jb=T("$ZodULID",(t,e)=>{e.pattern??(e.pattern=ob),we.init(t,e)}),Kb=T("$ZodXID",(t,e)=>{e.pattern??(e.pattern=ab),we.init(t,e)}),Qb=T("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=lb),we.init(t,e)}),e0=T("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=kb(e)),we.init(t,e)}),t0=T("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=vb),we.init(t,e)}),n0=T("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=wb(e)),we.init(t,e)}),r0=T("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=ub),we.init(t,e)}),s0=T("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=mb),we.init(t,e),t._zod.bag.format="ipv4"}),i0=T("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=gb),we.init(t,e),t._zod.bag.format="ipv6",t._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:t,continue:!e.abort})}}}),o0=T("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=_b),we.init(t,e)}),a0=T("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=yb),we.init(t,e),t._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[s,i]=r;if(!i)throw new Error;const o=Number(i);if(`${o}`!==i)throw new Error;if(o<0||o>128)throw new Error;new URL(`http://[${s}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:t,continue:!e.abort})}}});function Fd(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const l0=T("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=xb),we.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=n=>{Fd(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:t,continue:!e.abort})}});function c0(t){if(!Md.test(t))return!1;const e=t.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=e.padEnd(Math.ceil(e.length/4)*4,"=");return Fd(n)}const u0=T("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Md),we.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=n=>{c0(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:t,continue:!e.abort})}}),h0=T("$ZodE164",(t,e)=>{e.pattern??(e.pattern=bb),we.init(t,e)});function d0(t,e=null){try{const n=t.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const s=JSON.parse(atob(r));return!("typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&(!("alg"in s)||s.alg!==e))}catch{return!1}}const f0=T("$ZodJWT",(t,e)=>{we.init(t,e),t._zod.check=n=>{d0(n.value,e.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:t,continue:!e.abort})}}),Ld=T("$ZodNumber",(t,e)=>{ye.init(t,e),t._zod.pattern=t._zod.bag.pattern??Od,t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=Number(n.value)}catch{}const s=n.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return n;const i=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:s,inst:t,...i?{received:i}:{}}),n}}),p0=T("$ZodNumberFormat",(t,e)=>{Ib.init(t,e),Ld.init(t,e)}),m0=T("$ZodBoolean",(t,e)=>{ye.init(t,e),t._zod.pattern=Ab,t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=!!n.value}catch{}const s=n.value;return typeof s=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:t}),n}}),g0=T("$ZodAny",(t,e)=>{ye.init(t,e),t._zod.parse=n=>n}),_0=T("$ZodUnknown",(t,e)=>{ye.init(t,e),t._zod.parse=n=>n}),y0=T("$ZodNever",(t,e)=>{ye.init(t,e),t._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:t}),n)});function du(t,e,n){t.issues.length&&e.issues.push(...qn(n,t.issues)),e.value[n]=t.value}const x0=T("$ZodArray",(t,e)=>{ye.init(t,e),t._zod.parse=(n,r)=>{const s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:t}),n;n.value=Array(s.length);const i=[];for(let o=0;o<s.length;o++){const a=s[o],l=e.element._zod.run({value:a,issues:[]},r);l instanceof Promise?i.push(l.then(c=>du(c,n,o))):du(l,n,o)}return i.length?Promise.all(i).then(()=>n):n}});function li(t,e,n,r,s){if(t.issues.length){if(s&&!(n in r))return;e.issues.push(...qn(n,t.issues))}t.value===void 0?n in r&&(e.value[n]=void 0):e.value[n]=t.value}function Bd(t){var r,s,i,o;const e=Object.keys(t.shape);for(const a of e)if(!((o=(i=(s=(r=t.shape)==null?void 0:r[a])==null?void 0:s._zod)==null?void 0:i.traits)!=null&&o.has("$ZodType")))throw new Error(`Invalid element at key "${a}": expected a Zod schema`);const n=Nx(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(n)}}function Zd(t,e,n,r,s,i){const o=[],a=s.keySet,l=s.catchall._zod,c=l.def.type,u=l.optout==="optional";for(const h in e){if(a.has(h))continue;if(c==="never"){o.push(h);continue}const f=l.run({value:e[h],issues:[]},r);f instanceof Promise?t.push(f.then(d=>li(d,n,h,e,u))):li(f,n,h,e,u)}return o.length&&n.issues.push({code:"unrecognized_keys",keys:o,input:e,inst:i}),t.length?Promise.all(t).then(()=>n):n}const b0=T("$ZodObject",(t,e)=>{ye.init(t,e);const n=Object.getOwnPropertyDescriptor(e,"shape");if(!(n!=null&&n.get)){const a=e.shape;Object.defineProperty(e,"shape",{get:()=>{const l={...a};return Object.defineProperty(e,"shape",{value:l}),l}})}const r=xi(()=>Bd(e));Q(t._zod,"propValues",()=>{const a=e.shape,l={};for(const c in a){const u=a[c]._zod;if(u.values){l[c]??(l[c]=new Set);for(const h of u.values)l[c].add(h)}}return l});const s=es,i=e.catchall;let o;t._zod.parse=(a,l)=>{o??(o=r.value);const c=a.value;if(!s(c))return a.issues.push({expected:"object",code:"invalid_type",input:c,inst:t}),a;a.value={};const u=[],h=o.shape;for(const f of o.keys){const d=h[f],m=d._zod.optout==="optional",_=d._zod.run({value:c[f],issues:[]},l);_ instanceof Promise?u.push(_.then(g=>li(g,a,f,c,m))):li(_,a,f,c,m)}return i?Zd(u,c,a,l,r.value,t):u.length?Promise.all(u).then(()=>a):a}}),v0=T("$ZodObjectJIT",(t,e)=>{b0.init(t,e);const n=t._zod.parse,r=xi(()=>Bd(e)),s=f=>{var w;const d=new Zb(["shape","payload","ctx"]),m=r.value,_=k=>{const E=uu(k);return`shape[${E}]._zod.run({ value: input[${E}], issues: [] }, ctx)`};d.write("const input = payload.value;");const g=Object.create(null);let y=0;for(const k of m.keys)g[k]=`key_${y++}`;d.write("const newResult = {};");for(const k of m.keys){const E=g[k],A=uu(k),C=f[k],j=((w=C==null?void 0:C._zod)==null?void 0:w.optout)==="optional";d.write(`const ${E} = ${_(k)};`),j?d.write(`
|
|
301
|
+
if (${E}.issues.length) {
|
|
302
|
+
if (${A} in input) {
|
|
303
|
+
payload.issues = payload.issues.concat(${E}.issues.map(iss => ({
|
|
304
|
+
...iss,
|
|
305
|
+
path: iss.path ? [${A}, ...iss.path] : [${A}]
|
|
306
|
+
})));
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
if (${E}.value === undefined) {
|
|
311
|
+
if (${A} in input) {
|
|
312
|
+
newResult[${A}] = undefined;
|
|
313
|
+
}
|
|
314
|
+
} else {
|
|
315
|
+
newResult[${A}] = ${E}.value;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
`):d.write(`
|
|
319
|
+
if (${E}.issues.length) {
|
|
320
|
+
payload.issues = payload.issues.concat(${E}.issues.map(iss => ({
|
|
321
|
+
...iss,
|
|
322
|
+
path: iss.path ? [${A}, ...iss.path] : [${A}]
|
|
323
|
+
})));
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
if (${E}.value === undefined) {
|
|
327
|
+
if (${A} in input) {
|
|
328
|
+
newResult[${A}] = undefined;
|
|
329
|
+
}
|
|
330
|
+
} else {
|
|
331
|
+
newResult[${A}] = ${E}.value;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
`)}d.write("payload.value = newResult;"),d.write("return payload;");const b=d.compile();return(k,E)=>b(f,k,E)};let i;const o=es,a=!Sd.jitless,c=a&&$x.value,u=e.catchall;let h;t._zod.parse=(f,d)=>{h??(h=r.value);const m=f.value;return o(m)?a&&c&&(d==null?void 0:d.async)===!1&&d.jitless!==!0?(i||(i=s(e.shape)),f=i(f,d),u?Zd([],m,f,d,h,t):f):n(f,d):(f.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),f)}});function fu(t,e,n,r){for(const i of t)if(i.issues.length===0)return e.value=i.value,e;const s=t.filter(i=>!Yn(i));return s.length===1?(e.value=s[0].value,s[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:n,errors:t.map(i=>i.issues.map(o=>dn(o,r,hn())))}),e)}const Ud=T("$ZodUnion",(t,e)=>{ye.init(t,e),Q(t._zod,"optin",()=>e.options.some(s=>s._zod.optin==="optional")?"optional":void 0),Q(t._zod,"optout",()=>e.options.some(s=>s._zod.optout==="optional")?"optional":void 0),Q(t._zod,"values",()=>{if(e.options.every(s=>s._zod.values))return new Set(e.options.flatMap(s=>Array.from(s._zod.values)))}),Q(t._zod,"pattern",()=>{if(e.options.every(s=>s._zod.pattern)){const s=e.options.map(i=>i._zod.pattern);return new RegExp(`^(${s.map(i=>Va(i.source)).join("|")})$`)}});const n=e.options.length===1,r=e.options[0]._zod.run;t._zod.parse=(s,i)=>{if(n)return r(s,i);let o=!1;const a=[];for(const l of e.options){const c=l._zod.run({value:s.value,issues:[]},i);if(c instanceof Promise)a.push(c),o=!0;else{if(c.issues.length===0)return c;a.push(c)}}return o?Promise.all(a).then(l=>fu(l,s,t,i)):fu(a,s,t,i)}}),w0=T("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,Ud.init(t,e);const n=t._zod.parse;Q(t._zod,"propValues",()=>{const s={};for(const i of e.options){const o=i._zod.propValues;if(!o||Object.keys(o).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(const[a,l]of Object.entries(o)){s[a]||(s[a]=new Set);for(const c of l)s[a].add(c)}}return s});const r=xi(()=>{var o;const s=e.options,i=new Map;for(const a of s){const l=(o=a._zod.propValues)==null?void 0:o[e.discriminator];if(!l||l.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(a)}"`);for(const c of l){if(i.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,a)}}return i});t._zod.parse=(s,i)=>{const o=s.value;if(!es(o))return s.issues.push({code:"invalid_type",expected:"object",input:o,inst:t}),s;const a=r.value.get(o==null?void 0:o[e.discriminator]);return a?a._zod.run(s,i):e.unionFallback?n(s,i):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,input:o,path:[e.discriminator],inst:t}),s)}}),k0=T("$ZodIntersection",(t,e)=>{ye.init(t,e),t._zod.parse=(n,r)=>{const s=n.value,i=e.left._zod.run({value:s,issues:[]},r),o=e.right._zod.run({value:s,issues:[]},r);return i instanceof Promise||o instanceof Promise?Promise.all([i,o]).then(([l,c])=>pu(n,l,c)):pu(n,i,o)}});function la(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(lr(t)&&lr(e)){const n=Object.keys(e),r=Object.keys(t).filter(i=>n.indexOf(i)!==-1),s={...t,...e};for(const i of r){const o=la(t[i],e[i]);if(!o.valid)return{valid:!1,mergeErrorPath:[i,...o.mergeErrorPath]};s[i]=o.data}return{valid:!0,data:s}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<t.length;r++){const s=t[r],i=e[r],o=la(s,i);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function pu(t,e,n){const r=new Map;let s;for(const a of e.issues)if(a.code==="unrecognized_keys"){s??(s=a);for(const l of a.keys)r.has(l)||r.set(l,{}),r.get(l).l=!0}else t.issues.push(a);for(const a of n.issues)if(a.code==="unrecognized_keys")for(const l of a.keys)r.has(l)||r.set(l,{}),r.get(l).r=!0;else t.issues.push(a);const i=[...r].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(i.length&&s&&t.issues.push({...s,keys:i}),Yn(t))return t;const o=la(e.value,n.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return t.value=o.data,t}const S0=T("$ZodRecord",(t,e)=>{ye.init(t,e),t._zod.parse=(n,r)=>{const s=n.value;if(!lr(s))return n.issues.push({expected:"record",code:"invalid_type",input:s,inst:t}),n;const i=[],o=e.keyType._zod.values;if(o){n.value={};const a=new Set;for(const c of o)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){a.add(typeof c=="number"?c.toString():c);const u=e.valueType._zod.run({value:s[c],issues:[]},r);u instanceof Promise?i.push(u.then(h=>{h.issues.length&&n.issues.push(...qn(c,h.issues)),n.value[c]=h.value})):(u.issues.length&&n.issues.push(...qn(c,u.issues)),n.value[c]=u.value)}let l;for(const c in s)a.has(c)||(l=l??[],l.push(c));l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:s,inst:t,keys:l})}else{n.value={};for(const a of Reflect.ownKeys(s)){if(a==="__proto__")continue;let l=e.keyType._zod.run({value:a,issues:[]},r);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&Od.test(a)&&l.issues.length){const h=e.keyType._zod.run({value:Number(a),issues:[]},r);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");h.issues.length===0&&(l=h)}if(l.issues.length){e.mode==="loose"?n.value[a]=s[a]:n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(h=>dn(h,r,hn())),input:a,path:[a],inst:t});continue}const u=e.valueType._zod.run({value:s[a],issues:[]},r);u instanceof Promise?i.push(u.then(h=>{h.issues.length&&n.issues.push(...qn(a,h.issues)),n.value[l.value]=h.value})):(u.issues.length&&n.issues.push(...qn(a,u.issues)),n.value[l.value]=u.value)}}return i.length?Promise.all(i).then(()=>n):n}}),T0=T("$ZodEnum",(t,e)=>{ye.init(t,e);const n=Td(e.entries),r=new Set(n);t._zod.values=r,t._zod.pattern=new RegExp(`^(${n.filter(s=>Dx.has(typeof s)).map(s=>typeof s=="string"?cr(s):s.toString()).join("|")})$`),t._zod.parse=(s,i)=>{const o=s.value;return r.has(o)||s.issues.push({code:"invalid_value",values:n,input:o,inst:t}),s}}),A0=T("$ZodLiteral",(t,e)=>{if(ye.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(e.values);t._zod.values=n,t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?cr(r):r?cr(r.toString()):String(r)).join("|")})$`),t._zod.parse=(r,s)=>{const i=r.value;return n.has(i)||r.issues.push({code:"invalid_value",values:e.values,input:i,inst:t}),r}}),C0=T("$ZodTransform",(t,e)=>{ye.init(t,e),t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new kd(t.constructor.name);const s=e.transform(n.value,n);if(r.async)return(s instanceof Promise?s:Promise.resolve(s)).then(o=>(n.value=o,n));if(s instanceof Promise)throw new Xn;return n.value=s,n}});function mu(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}const Gd=T("$ZodOptional",(t,e)=>{ye.init(t,e),t._zod.optin="optional",t._zod.optout="optional",Q(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),Q(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${Va(n.source)})?$`):void 0}),t._zod.parse=(n,r)=>{if(e.innerType._zod.optin==="optional"){const s=e.innerType._zod.run(n,r);return s instanceof Promise?s.then(i=>mu(i,n.value)):mu(s,n.value)}return n.value===void 0?n:e.innerType._zod.run(n,r)}}),E0=T("$ZodExactOptional",(t,e)=>{Gd.init(t,e),Q(t._zod,"values",()=>e.innerType._zod.values),Q(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(n,r)=>e.innerType._zod.run(n,r)}),P0=T("$ZodNullable",(t,e)=>{ye.init(t,e),Q(t._zod,"optin",()=>e.innerType._zod.optin),Q(t._zod,"optout",()=>e.innerType._zod.optout),Q(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${Va(n.source)}|null)$`):void 0}),Q(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(n,r)=>n.value===null?n:e.innerType._zod.run(n,r)}),I0=T("$ZodDefault",(t,e)=>{ye.init(t,e),t._zod.optin="optional",Q(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);if(n.value===void 0)return n.value=e.defaultValue,n;const s=e.innerType._zod.run(n,r);return s instanceof Promise?s.then(i=>gu(i,e)):gu(s,e)}});function gu(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const M0=T("$ZodPrefault",(t,e)=>{ye.init(t,e),t._zod.optin="optional",Q(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=e.defaultValue),e.innerType._zod.run(n,r))}),R0=T("$ZodNonOptional",(t,e)=>{ye.init(t,e),Q(t._zod,"values",()=>{const n=e.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),t._zod.parse=(n,r)=>{const s=e.innerType._zod.run(n,r);return s instanceof Promise?s.then(i=>_u(i,t)):_u(s,t)}});function _u(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}const z0=T("$ZodCatch",(t,e)=>{ye.init(t,e),Q(t._zod,"optin",()=>e.innerType._zod.optin),Q(t._zod,"optout",()=>e.innerType._zod.optout),Q(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);const s=e.innerType._zod.run(n,r);return s instanceof Promise?s.then(i=>(n.value=i.value,i.issues.length&&(n.value=e.catchValue({...n,error:{issues:i.issues.map(o=>dn(o,r,hn()))},input:n.value}),n.issues=[]),n)):(n.value=s.value,s.issues.length&&(n.value=e.catchValue({...n,error:{issues:s.issues.map(i=>dn(i,r,hn()))},input:n.value}),n.issues=[]),n)}}),O0=T("$ZodPipe",(t,e)=>{ye.init(t,e),Q(t._zod,"values",()=>e.in._zod.values),Q(t._zod,"optin",()=>e.in._zod.optin),Q(t._zod,"optout",()=>e.out._zod.optout),Q(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(n,r)=>{if(r.direction==="backward"){const i=e.out._zod.run(n,r);return i instanceof Promise?i.then(o=>Bs(o,e.in,r)):Bs(i,e.in,r)}const s=e.in._zod.run(n,r);return s instanceof Promise?s.then(i=>Bs(i,e.out,r)):Bs(s,e.out,r)}});function Bs(t,e,n){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},n)}const $0=T("$ZodReadonly",(t,e)=>{ye.init(t,e),Q(t._zod,"propValues",()=>e.innerType._zod.propValues),Q(t._zod,"values",()=>e.innerType._zod.values),Q(t._zod,"optin",()=>{var n,r;return(r=(n=e.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),Q(t._zod,"optout",()=>{var n,r;return(r=(n=e.innerType)==null?void 0:n._zod)==null?void 0:r.optout}),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);const s=e.innerType._zod.run(n,r);return s instanceof Promise?s.then(yu):yu(s)}});function yu(t){return t.value=Object.freeze(t.value),t}const D0=T("$ZodLazy",(t,e)=>{ye.init(t,e),Q(t._zod,"innerType",()=>e.getter()),Q(t._zod,"pattern",()=>{var n,r;return(r=(n=t._zod.innerType)==null?void 0:n._zod)==null?void 0:r.pattern}),Q(t._zod,"propValues",()=>{var n,r;return(r=(n=t._zod.innerType)==null?void 0:n._zod)==null?void 0:r.propValues}),Q(t._zod,"optin",()=>{var n,r;return((r=(n=t._zod.innerType)==null?void 0:n._zod)==null?void 0:r.optin)??void 0}),Q(t._zod,"optout",()=>{var n,r;return((r=(n=t._zod.innerType)==null?void 0:n._zod)==null?void 0:r.optout)??void 0}),t._zod.parse=(n,r)=>t._zod.innerType._zod.run(n,r)}),N0=T("$ZodCustom",(t,e)=>{rt.init(t,e),ye.init(t,e),t._zod.parse=(n,r)=>n,t._zod.check=n=>{const r=n.value,s=e.fn(r);if(s instanceof Promise)return s.then(i=>xu(i,n,r,t));xu(s,n,r,t)}});function xu(t,e,n,r){if(!t){const s={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(s.params=r._zod.def.params),e.issues.push(ts(s))}}var bu;class F0{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...n){const r=n[0];return this._map.set(e,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const n=this._map.get(e);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(e),this}get(e){const n=e._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const s={...r,...this._map.get(e)};return Object.keys(s).length?s:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function L0(){return new F0}(bu=globalThis).__zod_globalRegistry??(bu.__zod_globalRegistry=L0());const Lr=globalThis.__zod_globalRegistry;function B0(t,e){return new t({type:"string",...B(e)})}function Z0(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...B(e)})}function vu(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...B(e)})}function U0(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...B(e)})}function G0(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...B(e)})}function j0(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...B(e)})}function V0(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...B(e)})}function H0(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...B(e)})}function W0(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...B(e)})}function Y0(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...B(e)})}function q0(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...B(e)})}function X0(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...B(e)})}function J0(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...B(e)})}function K0(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...B(e)})}function Q0(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...B(e)})}function ev(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...B(e)})}function tv(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...B(e)})}function nv(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...B(e)})}function rv(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...B(e)})}function sv(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...B(e)})}function iv(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...B(e)})}function ov(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...B(e)})}function av(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...B(e)})}function lv(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...B(e)})}function cv(t,e){return new t({type:"string",format:"date",check:"string_format",...B(e)})}function uv(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...B(e)})}function hv(t,e){return new t({type:"string",format:"duration",check:"string_format",...B(e)})}function dv(t,e){return new t({type:"number",checks:[],...B(e)})}function fv(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...B(e)})}function pv(t,e){return new t({type:"boolean",...B(e)})}function mv(t){return new t({type:"any"})}function gv(t){return new t({type:"unknown"})}function _v(t,e){return new t({type:"never",...B(e)})}function wu(t,e){return new Dd({check:"less_than",...B(e),value:t,inclusive:!1})}function yo(t,e){return new Dd({check:"less_than",...B(e),value:t,inclusive:!0})}function ku(t,e){return new Nd({check:"greater_than",...B(e),value:t,inclusive:!1})}function xo(t,e){return new Nd({check:"greater_than",...B(e),value:t,inclusive:!0})}function Su(t,e){return new Pb({check:"multiple_of",...B(e),value:t})}function jd(t,e){return new Mb({check:"max_length",...B(e),maximum:t})}function ci(t,e){return new Rb({check:"min_length",...B(e),minimum:t})}function Vd(t,e){return new zb({check:"length_equals",...B(e),length:t})}function yv(t,e){return new Ob({check:"string_format",format:"regex",...B(e),pattern:t})}function xv(t){return new $b({check:"string_format",format:"lowercase",...B(t)})}function bv(t){return new Db({check:"string_format",format:"uppercase",...B(t)})}function vv(t,e){return new Nb({check:"string_format",format:"includes",...B(e),includes:t})}function wv(t,e){return new Fb({check:"string_format",format:"starts_with",...B(e),prefix:t})}function kv(t,e){return new Lb({check:"string_format",format:"ends_with",...B(e),suffix:t})}function hr(t){return new Bb({check:"overwrite",tx:t})}function Sv(t){return hr(e=>e.normalize(t))}function Tv(){return hr(t=>t.trim())}function Av(){return hr(t=>t.toLowerCase())}function Cv(){return hr(t=>t.toUpperCase())}function Ev(){return hr(t=>Ox(t))}function Pv(t,e,n){return new t({type:"array",element:e,...B(n)})}function Iv(t,e,n){return new t({type:"custom",check:"custom",fn:e,...B(n)})}function Mv(t){const e=Rv(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(ts(r,n.value,e._zod.def));else{const s=r;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=e),s.continue??(s.continue=!e._zod.def.abort),n.issues.push(ts(s))}},t(n.value,n)));return e}function Rv(t,e){const n=new rt({check:"custom",...B(e)});return n._zod.check=t,n}function Hd(t){let e=(t==null?void 0:t.target)??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:(t==null?void 0:t.metadata)??Lr,target:e,unrepresentable:(t==null?void 0:t.unrepresentable)??"throw",override:(t==null?void 0:t.override)??(()=>{}),io:(t==null?void 0:t.io)??"output",counter:0,seen:new Map,cycles:(t==null?void 0:t.cycles)??"ref",reused:(t==null?void 0:t.reused)??"inline",external:(t==null?void 0:t.external)??void 0}}function Ce(t,e,n={path:[],schemaPath:[]}){var u,h;var r;const s=t._zod.def,i=e.seen.get(t);if(i)return i.count++,n.schemaPath.includes(t)&&(i.cycle=n.path),i.schema;const o={schema:{},count:1,cycle:void 0,path:n.path};e.seen.set(t,o);const a=(h=(u=t._zod).toJSONSchema)==null?void 0:h.call(u);if(a)o.schema=a;else{const f={...n,schemaPath:[...n.schemaPath,t],path:n.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,o.schema,f);else{const m=o.schema,_=e.processors[s.type];if(!_)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);_(t,e,m,f)}const d=t._zod.parent;d&&(o.ref||(o.ref=d),Ce(d,e,f),e.seen.get(d).isParent=!0)}const l=e.metadataRegistry.get(t);return l&&Object.assign(o.schema,l),e.io==="input"&&Ve(t)&&(delete o.schema.examples,delete o.schema.default),e.io==="input"&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,e.seen.get(t).schema}function Wd(t,e){var o,a,l,c;const n=t.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const u of t.seen.entries()){const h=(o=t.metadataRegistry.get(u[0]))==null?void 0:o.id;if(h){const f=r.get(h);if(f&&f!==u[0])throw new Error(`Duplicate schema id "${h}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(h,u[0])}}const s=u=>{var _;const h=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){const g=(_=t.external.registry.get(u[0]))==null?void 0:_.id,y=t.external.uri??(w=>w);if(g)return{ref:y(g)};const b=u[1].defId??u[1].schema.id??`schema${t.counter++}`;return u[1].defId=b,{defId:b,ref:`${y("__shared")}#/${h}/${b}`}}if(u[1]===n)return{ref:"#"};const d=`#/${h}/`,m=u[1].schema.id??`__schema${t.counter++}`;return{defId:m,ref:d+m}},i=u=>{if(u[1].schema.$ref)return;const h=u[1],{ref:f,defId:d}=s(u);h.def={...h.schema},d&&(h.defId=d);const m=h.schema;for(const _ in m)delete m[_];m.$ref=f};if(t.cycles==="throw")for(const u of t.seen.entries()){const h=u[1];if(h.cycle)throw new Error(`Cycle detected: #/${(a=h.cycle)==null?void 0:a.join("/")}/<root>
|
|
335
|
+
|
|
336
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const u of t.seen.entries()){const h=u[1];if(e===u[0]){i(u);continue}if(t.external){const d=(l=t.external.registry.get(u[0]))==null?void 0:l.id;if(e!==u[0]&&d){i(u);continue}}if((c=t.metadataRegistry.get(u[0]))==null?void 0:c.id){i(u);continue}if(h.cycle){i(u);continue}if(h.count>1&&t.reused==="ref"){i(u);continue}}}function Yd(t,e){var o,a,l;const n=t.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=c=>{const u=t.seen.get(c);if(u.ref===null)return;const h=u.def??u.schema,f={...h},d=u.ref;if(u.ref=null,d){r(d);const _=t.seen.get(d),g=_.schema;if(g.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(h.allOf=h.allOf??[],h.allOf.push(g)):Object.assign(h,g),Object.assign(h,f),c._zod.parent===d)for(const b in h)b==="$ref"||b==="allOf"||b in f||delete h[b];if(g.$ref&&_.def)for(const b in h)b==="$ref"||b==="allOf"||b in _.def&&JSON.stringify(h[b])===JSON.stringify(_.def[b])&&delete h[b]}const m=c._zod.parent;if(m&&m!==d){r(m);const _=t.seen.get(m);if(_!=null&&_.schema.$ref&&(h.$ref=_.schema.$ref,_.def))for(const g in h)g==="$ref"||g==="allOf"||g in _.def&&JSON.stringify(h[g])===JSON.stringify(_.def[g])&&delete h[g]}t.override({zodSchema:c,jsonSchema:h,path:u.path??[]})};for(const c of[...t.seen.entries()].reverse())r(c[0]);const s={};if(t.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":t.target,(o=t.external)!=null&&o.uri){const c=(a=t.external.registry.get(e))==null?void 0:a.id;if(!c)throw new Error("Schema is missing an `id` property");s.$id=t.external.uri(c)}Object.assign(s,n.def??n.schema);const i=((l=t.external)==null?void 0:l.defs)??{};for(const c of t.seen.entries()){const u=c[1];u.def&&u.defId&&(i[u.defId]=u.def)}t.external||Object.keys(i).length>0&&(t.target==="draft-2020-12"?s.$defs=i:s.definitions=i);try{const c=JSON.parse(JSON.stringify(s));return Object.defineProperty(c,"~standard",{value:{...e["~standard"],jsonSchema:{input:ui(e,"input",t.processors),output:ui(e,"output",t.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function Ve(t,e){const n=e??{seen:new Set};if(n.seen.has(t))return!1;n.seen.add(t);const r=t._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Ve(r.element,n);if(r.type==="set")return Ve(r.valueType,n);if(r.type==="lazy")return Ve(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Ve(r.innerType,n);if(r.type==="intersection")return Ve(r.left,n)||Ve(r.right,n);if(r.type==="record"||r.type==="map")return Ve(r.keyType,n)||Ve(r.valueType,n);if(r.type==="pipe")return Ve(r.in,n)||Ve(r.out,n);if(r.type==="object"){for(const s in r.shape)if(Ve(r.shape[s],n))return!0;return!1}if(r.type==="union"){for(const s of r.options)if(Ve(s,n))return!0;return!1}if(r.type==="tuple"){for(const s of r.items)if(Ve(s,n))return!0;return!!(r.rest&&Ve(r.rest,n))}return!1}const zv=(t,e={})=>n=>{const r=Hd({...n,processors:e});return Ce(t,r),Wd(r,t),Yd(r,t)},ui=(t,e,n={})=>r=>{const{libraryOptions:s,target:i}=r??{},o=Hd({...s??{},target:i,io:e,processors:n});return Ce(t,o),Wd(o,t),Yd(o,t)},Ov={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},$v=(t,e,n,r)=>{const s=n;s.type="string";const{minimum:i,maximum:o,format:a,patterns:l,contentEncoding:c}=t._zod.bag;if(typeof i=="number"&&(s.minLength=i),typeof o=="number"&&(s.maxLength=o),a&&(s.format=Ov[a]??a,s.format===""&&delete s.format,a==="time"&&delete s.format),c&&(s.contentEncoding=c),l&&l.size>0){const u=[...l];u.length===1?s.pattern=u[0].source:u.length>1&&(s.allOf=[...u.map(h=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))])}},Dv=(t,e,n,r)=>{const s=n,{minimum:i,maximum:o,format:a,multipleOf:l,exclusiveMaximum:c,exclusiveMinimum:u}=t._zod.bag;typeof a=="string"&&a.includes("int")?s.type="integer":s.type="number",typeof u=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(s.minimum=u,s.exclusiveMinimum=!0):s.exclusiveMinimum=u),typeof i=="number"&&(s.minimum=i,typeof u=="number"&&e.target!=="draft-04"&&(u>=i?delete s.minimum:delete s.exclusiveMinimum)),typeof c=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(s.maximum=c,s.exclusiveMaximum=!0):s.exclusiveMaximum=c),typeof o=="number"&&(s.maximum=o,typeof c=="number"&&e.target!=="draft-04"&&(c<=o?delete s.maximum:delete s.exclusiveMaximum)),typeof l=="number"&&(s.multipleOf=l)},Nv=(t,e,n,r)=>{n.type="boolean"},Fv=(t,e,n,r)=>{n.not={}},Lv=(t,e,n,r)=>{},Bv=(t,e,n,r)=>{},Zv=(t,e,n,r)=>{const s=t._zod.def,i=Td(s.entries);i.every(o=>typeof o=="number")&&(n.type="number"),i.every(o=>typeof o=="string")&&(n.type="string"),n.enum=i},Uv=(t,e,n,r)=>{const s=t._zod.def,i=[];for(const o of s.values)if(o===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof o=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(o))}else i.push(o);if(i.length!==0)if(i.length===1){const o=i[0];n.type=o===null?"null":typeof o,e.target==="draft-04"||e.target==="openapi-3.0"?n.enum=[o]:n.const=o}else i.every(o=>typeof o=="number")&&(n.type="number"),i.every(o=>typeof o=="string")&&(n.type="string"),i.every(o=>typeof o=="boolean")&&(n.type="boolean"),i.every(o=>o===null)&&(n.type="null"),n.enum=i},Gv=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},jv=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Vv=(t,e,n,r)=>{const s=n,i=t._zod.def,{minimum:o,maximum:a}=t._zod.bag;typeof o=="number"&&(s.minItems=o),typeof a=="number"&&(s.maxItems=a),s.type="array",s.items=Ce(i.element,e,{...r,path:[...r.path,"items"]})},Hv=(t,e,n,r)=>{var c;const s=n,i=t._zod.def;s.type="object",s.properties={};const o=i.shape;for(const u in o)s.properties[u]=Ce(o[u],e,{...r,path:[...r.path,"properties",u]});const a=new Set(Object.keys(o)),l=new Set([...a].filter(u=>{const h=i.shape[u]._zod;return e.io==="input"?h.optin===void 0:h.optout===void 0}));l.size>0&&(s.required=Array.from(l)),((c=i.catchall)==null?void 0:c._zod.def.type)==="never"?s.additionalProperties=!1:i.catchall?i.catchall&&(s.additionalProperties=Ce(i.catchall,e,{...r,path:[...r.path,"additionalProperties"]})):e.io==="output"&&(s.additionalProperties=!1)},Wv=(t,e,n,r)=>{const s=t._zod.def,i=s.inclusive===!1,o=s.options.map((a,l)=>Ce(a,e,{...r,path:[...r.path,i?"oneOf":"anyOf",l]}));i?n.oneOf=o:n.anyOf=o},Yv=(t,e,n,r)=>{const s=t._zod.def,i=Ce(s.left,e,{...r,path:[...r.path,"allOf",0]}),o=Ce(s.right,e,{...r,path:[...r.path,"allOf",1]}),a=c=>"allOf"in c&&Object.keys(c).length===1,l=[...a(i)?i.allOf:[i],...a(o)?o.allOf:[o]];n.allOf=l},qv=(t,e,n,r)=>{const s=n,i=t._zod.def;s.type="object";const o=i.keyType,a=o._zod.bag,l=a==null?void 0:a.patterns;if(i.mode==="loose"&&l&&l.size>0){const u=Ce(i.valueType,e,{...r,path:[...r.path,"patternProperties","*"]});s.patternProperties={};for(const h of l)s.patternProperties[h.source]=u}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(s.propertyNames=Ce(i.keyType,e,{...r,path:[...r.path,"propertyNames"]})),s.additionalProperties=Ce(i.valueType,e,{...r,path:[...r.path,"additionalProperties"]});const c=o._zod.values;if(c){const u=[...c].filter(h=>typeof h=="string"||typeof h=="number");u.length>0&&(s.required=u)}},Xv=(t,e,n,r)=>{const s=t._zod.def,i=Ce(s.innerType,e,r),o=e.seen.get(t);e.target==="openapi-3.0"?(o.ref=s.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},Jv=(t,e,n,r)=>{const s=t._zod.def;Ce(s.innerType,e,r);const i=e.seen.get(t);i.ref=s.innerType},Kv=(t,e,n,r)=>{const s=t._zod.def;Ce(s.innerType,e,r);const i=e.seen.get(t);i.ref=s.innerType,n.default=JSON.parse(JSON.stringify(s.defaultValue))},Qv=(t,e,n,r)=>{const s=t._zod.def;Ce(s.innerType,e,r);const i=e.seen.get(t);i.ref=s.innerType,e.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(s.defaultValue)))},ew=(t,e,n,r)=>{const s=t._zod.def;Ce(s.innerType,e,r);const i=e.seen.get(t);i.ref=s.innerType;let o;try{o=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=o},tw=(t,e,n,r)=>{const s=t._zod.def,i=e.io==="input"?s.in._zod.def.type==="transform"?s.out:s.in:s.out;Ce(i,e,r);const o=e.seen.get(t);o.ref=i},nw=(t,e,n,r)=>{const s=t._zod.def;Ce(s.innerType,e,r);const i=e.seen.get(t);i.ref=s.innerType,n.readOnly=!0},qd=(t,e,n,r)=>{const s=t._zod.def;Ce(s.innerType,e,r);const i=e.seen.get(t);i.ref=s.innerType},rw=(t,e,n,r)=>{const s=t._zod.innerType;Ce(s,e,r);const i=e.seen.get(t);i.ref=s},sw=T("ZodISODateTime",(t,e)=>{e0.init(t,e),Te.init(t,e)});function iw(t){return lv(sw,t)}const ow=T("ZodISODate",(t,e)=>{t0.init(t,e),Te.init(t,e)});function aw(t){return cv(ow,t)}const lw=T("ZodISOTime",(t,e)=>{n0.init(t,e),Te.init(t,e)});function cw(t){return uv(lw,t)}const uw=T("ZodISODuration",(t,e)=>{r0.init(t,e),Te.init(t,e)});function hw(t){return hv(uw,t)}const dw=(t,e)=>{Pd.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:n=>Wx(t,n)},flatten:{value:n=>Hx(t,n)},addIssue:{value:n=>{t.issues.push(n),t.message=JSON.stringify(t.issues,aa,2)}},addIssues:{value:n=>{t.issues.push(...n),t.message=JSON.stringify(t.issues,aa,2)}},isEmpty:{get(){return t.issues.length===0}}})},mt=T("ZodError",dw,{Parent:Error}),fw=Wa(mt),pw=Ya(mt),mw=bi(mt),gw=vi(mt),_w=Xx(mt),yw=Jx(mt),xw=Kx(mt),bw=Qx(mt),vw=eb(mt),ww=tb(mt),kw=nb(mt),Sw=rb(mt),xe=T("ZodType",(t,e)=>(ye.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:ui(t,"input"),output:ui(t,"output")}}),t.toJSONSchema=zv(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.check=(...n)=>t.clone(pn(e,{checks:[...e.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),t.with=t.check,t.clone=(n,r)=>mn(t,n,r),t.brand=()=>t,t.register=((n,r)=>(n.add(t,r),t)),t.parse=(n,r)=>fw(t,n,r,{callee:t.parse}),t.safeParse=(n,r)=>mw(t,n,r),t.parseAsync=async(n,r)=>pw(t,n,r,{callee:t.parseAsync}),t.safeParseAsync=async(n,r)=>gw(t,n,r),t.spa=t.safeParseAsync,t.encode=(n,r)=>_w(t,n,r),t.decode=(n,r)=>yw(t,n,r),t.encodeAsync=async(n,r)=>xw(t,n,r),t.decodeAsync=async(n,r)=>bw(t,n,r),t.safeEncode=(n,r)=>vw(t,n,r),t.safeDecode=(n,r)=>ww(t,n,r),t.safeEncodeAsync=async(n,r)=>kw(t,n,r),t.safeDecodeAsync=async(n,r)=>Sw(t,n,r),t.refine=(n,r)=>t.check(xk(n,r)),t.superRefine=n=>t.check(bk(n)),t.overwrite=n=>t.check(hr(n)),t.optional=()=>Cu(t),t.exactOptional=()=>ik(t),t.nullable=()=>Eu(t),t.nullish=()=>Cu(Eu(t)),t.nonoptional=n=>hk(t,n),t.array=()=>G(t),t.or=n=>Tt([t,n]),t.and=n=>Qw(t,n),t.transform=n=>Pu(t,rk(n)),t.default=n=>lk(t,n),t.prefault=n=>uk(t,n),t.catch=n=>fk(t,n),t.pipe=n=>Pu(t,n),t.readonly=()=>gk(t),t.describe=n=>{const r=t.clone();return Lr.add(r,{description:n}),r},Object.defineProperty(t,"description",{get(){var n;return(n=Lr.get(t))==null?void 0:n.description},configurable:!0}),t.meta=(...n)=>{if(n.length===0)return Lr.get(t);const r=t.clone();return Lr.add(r,n[0]),r},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t.apply=n=>n(t),t)),Xd=T("_ZodString",(t,e)=>{qa.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(r,s,i)=>$v(t,r,s);const n=t._zod.bag;t.format=n.format??null,t.minLength=n.minimum??null,t.maxLength=n.maximum??null,t.regex=(...r)=>t.check(yv(...r)),t.includes=(...r)=>t.check(vv(...r)),t.startsWith=(...r)=>t.check(wv(...r)),t.endsWith=(...r)=>t.check(kv(...r)),t.min=(...r)=>t.check(ci(...r)),t.max=(...r)=>t.check(jd(...r)),t.length=(...r)=>t.check(Vd(...r)),t.nonempty=(...r)=>t.check(ci(1,...r)),t.lowercase=r=>t.check(xv(r)),t.uppercase=r=>t.check(bv(r)),t.trim=()=>t.check(Tv()),t.normalize=(...r)=>t.check(Sv(...r)),t.toLowerCase=()=>t.check(Av()),t.toUpperCase=()=>t.check(Cv()),t.slugify=()=>t.check(Ev())}),Tw=T("ZodString",(t,e)=>{qa.init(t,e),Xd.init(t,e),t.email=n=>t.check(Z0(Aw,n)),t.url=n=>t.check(H0(Cw,n)),t.jwt=n=>t.check(av(Uw,n)),t.emoji=n=>t.check(W0(Ew,n)),t.guid=n=>t.check(vu(Tu,n)),t.uuid=n=>t.check(U0(Zs,n)),t.uuidv4=n=>t.check(G0(Zs,n)),t.uuidv6=n=>t.check(j0(Zs,n)),t.uuidv7=n=>t.check(V0(Zs,n)),t.nanoid=n=>t.check(Y0(Pw,n)),t.guid=n=>t.check(vu(Tu,n)),t.cuid=n=>t.check(q0(Iw,n)),t.cuid2=n=>t.check(X0(Mw,n)),t.ulid=n=>t.check(J0(Rw,n)),t.base64=n=>t.check(sv(Lw,n)),t.base64url=n=>t.check(iv(Bw,n)),t.xid=n=>t.check(K0(zw,n)),t.ksuid=n=>t.check(Q0(Ow,n)),t.ipv4=n=>t.check(ev($w,n)),t.ipv6=n=>t.check(tv(Dw,n)),t.cidrv4=n=>t.check(nv(Nw,n)),t.cidrv6=n=>t.check(rv(Fw,n)),t.e164=n=>t.check(ov(Zw,n)),t.datetime=n=>t.check(iw(n)),t.date=n=>t.check(aw(n)),t.time=n=>t.check(cw(n)),t.duration=n=>t.check(hw(n))});function p(t){return B0(Tw,t)}const Te=T("ZodStringFormat",(t,e)=>{we.init(t,e),Xd.init(t,e)}),Aw=T("ZodEmail",(t,e)=>{Vb.init(t,e),Te.init(t,e)}),Tu=T("ZodGUID",(t,e)=>{Gb.init(t,e),Te.init(t,e)}),Zs=T("ZodUUID",(t,e)=>{jb.init(t,e),Te.init(t,e)}),Cw=T("ZodURL",(t,e)=>{Hb.init(t,e),Te.init(t,e)}),Ew=T("ZodEmoji",(t,e)=>{Wb.init(t,e),Te.init(t,e)}),Pw=T("ZodNanoID",(t,e)=>{Yb.init(t,e),Te.init(t,e)}),Iw=T("ZodCUID",(t,e)=>{qb.init(t,e),Te.init(t,e)}),Mw=T("ZodCUID2",(t,e)=>{Xb.init(t,e),Te.init(t,e)}),Rw=T("ZodULID",(t,e)=>{Jb.init(t,e),Te.init(t,e)}),zw=T("ZodXID",(t,e)=>{Kb.init(t,e),Te.init(t,e)}),Ow=T("ZodKSUID",(t,e)=>{Qb.init(t,e),Te.init(t,e)}),$w=T("ZodIPv4",(t,e)=>{s0.init(t,e),Te.init(t,e)}),Dw=T("ZodIPv6",(t,e)=>{i0.init(t,e),Te.init(t,e)}),Nw=T("ZodCIDRv4",(t,e)=>{o0.init(t,e),Te.init(t,e)}),Fw=T("ZodCIDRv6",(t,e)=>{a0.init(t,e),Te.init(t,e)}),Lw=T("ZodBase64",(t,e)=>{l0.init(t,e),Te.init(t,e)}),Bw=T("ZodBase64URL",(t,e)=>{u0.init(t,e),Te.init(t,e)}),Zw=T("ZodE164",(t,e)=>{h0.init(t,e),Te.init(t,e)}),Uw=T("ZodJWT",(t,e)=>{f0.init(t,e),Te.init(t,e)}),Jd=T("ZodNumber",(t,e)=>{Ld.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(r,s,i)=>Dv(t,r,s),t.gt=(r,s)=>t.check(ku(r,s)),t.gte=(r,s)=>t.check(xo(r,s)),t.min=(r,s)=>t.check(xo(r,s)),t.lt=(r,s)=>t.check(wu(r,s)),t.lte=(r,s)=>t.check(yo(r,s)),t.max=(r,s)=>t.check(yo(r,s)),t.int=r=>t.check(Au(r)),t.safe=r=>t.check(Au(r)),t.positive=r=>t.check(ku(0,r)),t.nonnegative=r=>t.check(xo(0,r)),t.negative=r=>t.check(wu(0,r)),t.nonpositive=r=>t.check(yo(0,r)),t.multipleOf=(r,s)=>t.check(Su(r,s)),t.step=(r,s)=>t.check(Su(r,s)),t.finite=()=>t;const n=t._zod.bag;t.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),t.isFinite=!0,t.format=n.format??null});function M(t){return dv(Jd,t)}const Gw=T("ZodNumberFormat",(t,e)=>{p0.init(t,e),Jd.init(t,e)});function Au(t){return fv(Gw,t)}const jw=T("ZodBoolean",(t,e)=>{m0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Nv(t,n,r)});function ln(t){return pv(jw,t)}const Vw=T("ZodAny",(t,e)=>{g0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Lv()});function Y(){return mv(Vw)}const Hw=T("ZodUnknown",(t,e)=>{_0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Bv()});function ca(){return gv(Hw)}const Ww=T("ZodNever",(t,e)=>{y0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Fv(t,n,r)});function Yw(t){return _v(Ww,t)}const qw=T("ZodArray",(t,e)=>{x0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Vv(t,n,r,s),t.element=e.element,t.min=(n,r)=>t.check(ci(n,r)),t.nonempty=n=>t.check(ci(1,n)),t.max=(n,r)=>t.check(jd(n,r)),t.length=(n,r)=>t.check(Vd(n,r)),t.unwrap=()=>t.element});function G(t,e){return Pv(qw,t,e)}const Xw=T("ZodObject",(t,e)=>{v0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Hv(t,n,r,s),Q(t,"shape",()=>e.shape),t.keyof=()=>_e(Object.keys(t._zod.def.shape)),t.catchall=n=>t.clone({...t._zod.def,catchall:n}),t.passthrough=()=>t.clone({...t._zod.def,catchall:ca()}),t.loose=()=>t.clone({...t._zod.def,catchall:ca()}),t.strict=()=>t.clone({...t._zod.def,catchall:Yw()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=n=>Zx(t,n),t.safeExtend=n=>Ux(t,n),t.merge=n=>Gx(t,n),t.pick=n=>Lx(t,n),t.omit=n=>Bx(t,n),t.partial=(...n)=>jx(Qd,t,n[0]),t.required=(...n)=>Vx(ef,t,n[0])});function v(t,e){const n={type:"object",shape:t??{},...B(e)};return new Xw(n)}const Kd=T("ZodUnion",(t,e)=>{Ud.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Wv(t,n,r,s),t.options=e.options});function Tt(t,e){return new Kd({type:"union",options:t,...B(e)})}const Jw=T("ZodDiscriminatedUnion",(t,e)=>{Kd.init(t,e),w0.init(t,e)});function Ne(t,e,n){return new Jw({type:"union",options:e,discriminator:t,...B(n)})}const Kw=T("ZodIntersection",(t,e)=>{k0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Yv(t,n,r,s)});function Qw(t,e){return new Kw({type:"intersection",left:t,right:e})}const ek=T("ZodRecord",(t,e)=>{S0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>qv(t,n,r,s),t.keyType=e.keyType,t.valueType=e.valueType});function oe(t,e,n){return new ek({type:"record",keyType:t,valueType:e,...B(n)})}const ua=T("ZodEnum",(t,e)=>{T0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(r,s,i)=>Zv(t,r,s),t.enum=e.entries,t.options=Object.values(e.entries);const n=new Set(Object.keys(e.entries));t.extract=(r,s)=>{const i={};for(const o of r)if(n.has(o))i[o]=e.entries[o];else throw new Error(`Key ${o} not found in enum`);return new ua({...e,checks:[],...B(s),entries:i})},t.exclude=(r,s)=>{const i={...e.entries};for(const o of r)if(n.has(o))delete i[o];else throw new Error(`Key ${o} not found in enum`);return new ua({...e,checks:[],...B(s),entries:i})}});function _e(t,e){const n=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new ua({type:"enum",entries:n,...B(e)})}const tk=T("ZodLiteral",(t,e)=>{A0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Uv(t,n,r),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function S(t,e){return new tk({type:"literal",values:Array.isArray(t)?t:[t],...B(e)})}const nk=T("ZodTransform",(t,e)=>{C0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>jv(t,n),t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new kd(t.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(ts(i,n.value,e));else{const o=i;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),n.issues.push(ts(o))}};const s=e.transform(n.value,n);return s instanceof Promise?s.then(i=>(n.value=i,n)):(n.value=s,n)}});function rk(t){return new nk({type:"transform",transform:t})}const Qd=T("ZodOptional",(t,e)=>{Gd.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>qd(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function Cu(t){return new Qd({type:"optional",innerType:t})}const sk=T("ZodExactOptional",(t,e)=>{E0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>qd(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function ik(t){return new sk({type:"optional",innerType:t})}const ok=T("ZodNullable",(t,e)=>{P0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Xv(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function Eu(t){return new ok({type:"nullable",innerType:t})}const ak=T("ZodDefault",(t,e)=>{I0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Kv(t,n,r,s),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function lk(t,e){return new ak({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():Cd(e)}})}const ck=T("ZodPrefault",(t,e)=>{M0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Qv(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function uk(t,e){return new ck({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():Cd(e)}})}const ef=T("ZodNonOptional",(t,e)=>{R0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Jv(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function hk(t,e){return new ef({type:"nonoptional",innerType:t,...B(e)})}const dk=T("ZodCatch",(t,e)=>{z0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>ew(t,n,r,s),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function fk(t,e){return new dk({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const pk=T("ZodPipe",(t,e)=>{O0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>tw(t,n,r,s),t.in=e.in,t.out=e.out});function Pu(t,e){return new pk({type:"pipe",in:t,out:e})}const mk=T("ZodReadonly",(t,e)=>{$0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>nw(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function gk(t){return new mk({type:"readonly",innerType:t})}const _k=T("ZodLazy",(t,e)=>{D0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>rw(t,n,r,s),t.unwrap=()=>t._zod.def.getter()});function yk(t){return new _k({type:"lazy",getter:t})}const tf=T("ZodCustom",(t,e)=>{N0.init(t,e),xe.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Gv(t,n)});function xk(t,e={}){return Iv(tf,t,e)}function bk(t){return Mv(t)}function nf(t,e={}){const n=new tf({type:"custom",check:"custom",fn:r=>r instanceof t,abort:!0,...B(e)});return n._zod.bag.Class=t,n._zod.check=r=>{r.value instanceof t||r.issues.push({code:"invalid_type",expected:t.name,input:r.value,inst:n,path:[...n._zod.def.path??[]]})},n}const vk={custom:"custom"};var Us={exports:{}},bo,Iu;function wk(){if(Iu)return bo;Iu=1;var t=1e3,e=t*60,n=e*60,r=n*24,s=r*7,i=r*365.25;bo=function(u,h){h=h||{};var f=typeof u;if(f==="string"&&u.length>0)return o(u);if(f==="number"&&isFinite(u))return h.long?l(u):a(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))};function o(u){if(u=String(u),!(u.length>100)){var h=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(u);if(h){var f=parseFloat(h[1]),d=(h[2]||"ms").toLowerCase();switch(d){case"years":case"year":case"yrs":case"yr":case"y":return f*i;case"weeks":case"week":case"w":return f*s;case"days":case"day":case"d":return f*r;case"hours":case"hour":case"hrs":case"hr":case"h":return f*n;case"minutes":case"minute":case"mins":case"min":case"m":return f*e;case"seconds":case"second":case"secs":case"sec":case"s":return f*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return f;default:return}}}}function a(u){var h=Math.abs(u);return h>=r?Math.round(u/r)+"d":h>=n?Math.round(u/n)+"h":h>=e?Math.round(u/e)+"m":h>=t?Math.round(u/t)+"s":u+"ms"}function l(u){var h=Math.abs(u);return h>=r?c(u,h,r,"day"):h>=n?c(u,h,n,"hour"):h>=e?c(u,h,e,"minute"):h>=t?c(u,h,t,"second"):u+" ms"}function c(u,h,f,d){var m=h>=f*1.5;return Math.round(u/f)+" "+d+(m?"s":"")}return bo}var vo,Mu;function kk(){if(Mu)return vo;Mu=1;function t(e){r.debug=r,r.default=r,r.coerce=c,r.disable=a,r.enable=i,r.enabled=l,r.humanize=wk(),r.destroy=u,Object.keys(e).forEach(h=>{r[h]=e[h]}),r.names=[],r.skips=[],r.formatters={};function n(h){let f=0;for(let d=0;d<h.length;d++)f=(f<<5)-f+h.charCodeAt(d),f|=0;return r.colors[Math.abs(f)%r.colors.length]}r.selectColor=n;function r(h){let f,d=null,m,_;function g(...y){if(!g.enabled)return;const b=g,w=Number(new Date),k=w-(f||w);b.diff=k,b.prev=f,b.curr=w,f=w,y[0]=r.coerce(y[0]),typeof y[0]!="string"&&y.unshift("%O");let E=0;y[0]=y[0].replace(/%([a-zA-Z%])/g,(C,j)=>{if(C==="%%")return"%";E++;const W=r.formatters[j];if(typeof W=="function"){const O=y[E];C=W.call(b,O),y.splice(E,1),E--}return C}),r.formatArgs.call(b,y),(b.log||r.log).apply(b,y)}return g.namespace=h,g.useColors=r.useColors(),g.color=r.selectColor(h),g.extend=s,g.destroy=r.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(m!==r.namespaces&&(m=r.namespaces,_=r.enabled(h)),_),set:y=>{d=y}}),typeof r.init=="function"&&r.init(g),g}function s(h,f){const d=r(this.namespace+(typeof f>"u"?":":f)+h);return d.log=this.log,d}function i(h){r.save(h),r.namespaces=h,r.names=[],r.skips=[];const f=(typeof h=="string"?h:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const d of f)d[0]==="-"?r.skips.push(d.slice(1)):r.names.push(d)}function o(h,f){let d=0,m=0,_=-1,g=0;for(;d<h.length;)if(m<f.length&&(f[m]===h[d]||f[m]==="*"))f[m]==="*"?(_=m,g=d,m++):(d++,m++);else if(_!==-1)m=_+1,g++,d=g;else return!1;for(;m<f.length&&f[m]==="*";)m++;return m===f.length}function a(){const h=[...r.names,...r.skips.map(f=>"-"+f)].join(",");return r.enable(""),h}function l(h){for(const f of r.skips)if(o(h,f))return!1;for(const f of r.names)if(o(h,f))return!0;return!1}function c(h){return h instanceof Error?h.stack||h.message:h}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}return vo=t,vo}var Ru;function Sk(){return Ru||(Ru=1,(function(t,e){var n={};e.formatArgs=s,e.save=i,e.load=o,e.useColors=r,e.storage=a(),e.destroy=(()=>{let c=!1;return()=>{c||(c=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let c;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(c=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(c[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function s(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const u="color: "+this.color;c.splice(1,0,u,"color: inherit");let h=0,f=0;c[0].replace(/%[a-zA-Z%]/g,d=>{d!=="%%"&&(h++,d==="%c"&&(f=h))}),c.splice(f,0,u)}e.log=console.debug||console.log||(()=>{});function i(c){try{c?e.storage.setItem("debug",c):e.storage.removeItem("debug")}catch{}}function o(){let c;try{c=e.storage.getItem("debug")||e.storage.getItem("DEBUG")}catch{}return!c&&typeof process<"u"&&"env"in process&&(c=n.DEBUG),c}function a(){try{return localStorage}catch{}}t.exports=kk()(e);const{formatters:l}=t.exports;l.j=function(c){try{return JSON.stringify(c)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}})(Us,Us.exports)),Us.exports}var Tk=Sk();const Ak=pa(Tk);function Ck(){return typeof window<"u"&&typeof document<"u"&&typeof document.createElement=="function"}function Ek(){try{if(typeof $u=="function")return $u()}catch{}return Ck()}function rf(){try{const t=wo==null?void 0:wo();return typeof t=="object"&&t!=null?t:{}}catch{return{}}}function ha(t){const e=rf();return typeof e<"u"&&(e[t]==="true"||e[t]==="1")}const sf={get disabled(){return Ek()||rf().NODE_ENV==="test"?!0:ha("OPENAI_AGENTS_DISABLE_TRACING")}},zu={get dontLogModelData(){return ha("OPENAI_AGENTS_DONT_LOG_MODEL_DATA")},get dontLogToolData(){return ha("OPENAI_AGENTS_DONT_LOG_TOOL_DATA")}};function Xa(t="openai-agents"){return{namespace:t,debug:Ak(t),error:(...e)=>console.error(...e),warn:(...e)=>console.warn(...e),get dontLogModelData(){return zu.dontLogModelData},get dontLogToolData(){return zu.dontLogToolData}}}const me=Xa("openai-agents:core");v({name:p(),description:p().optional(),inputSchema:v({type:S("object"),properties:oe(p(),Y()),required:G(p()),additionalProperties:ln()})});function wo(){return{}}const of=()=>typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)});class Ou{constructor(){K(this,"context",null)}run(e,n){return this.context=e,n()}getStore(){return this.context}enterWith(e){this.context=e}}function $u(){return!0}class Pk{constructor(){}setTimeout(e,n){const r=setTimeout(e,n);return r.ref=typeof r.ref=="function"?r.ref:()=>r,r.unref=typeof r.unref=="function"?r.unref:()=>r,r.hasRef=typeof r.hasRef=="function"?r.hasRef:()=>!0,r.refresh=typeof r.refresh=="function"?r.refresh:()=>r,r}clearTimeout(e){window.clearTimeout(e)}}const Ik=new Pk,Re=v({providerData:oe(p(),Y()).optional()}),st=Re.extend({id:p().optional()}),Mk=Re.extend({type:S("refusal"),refusal:p()}),Rk=Re.extend({type:S("output_text"),text:p()}),Ja=Re.extend({type:S("input_text"),text:p()}),zk=Re.extend({type:S("reasoning_text"),text:p()}),af=Re.extend({type:S("input_image"),image:p().or(v({id:p().describe("OpenAI file ID")})).describe("Either base64 encoded image data, a data URL, or an object with a file ID.").optional(),detail:p().optional()}),lf=Re.extend({type:S("input_file"),file:p().describe("Either base64 encoded file data or a publicly accessible file URL").or(v({id:p().describe("OpenAI file ID")})).or(v({url:p().describe("Publicly accessible file URL")})).describe("Contents of the file or an object with a file ID.").optional(),filename:p().optional()}),cf=Re.extend({type:S("audio"),audio:p().or(v({id:p()})).describe("Base64 encoded audio data or file id"),format:p().nullable().optional(),transcript:p().nullable().optional()}),Ok=Re.extend({type:S("image"),image:p().describe("Base64 encoded image data")}),$k=Re.extend({type:S("text"),text:p()}),Dk=v({data:Tt([p(),nf(Uint8Array)]).describe("Base64 image data, or raw bytes that will be base64 encoded automatically."),mediaType:p().optional()}),Nk=v({url:p().describe("Publicly accessible URL pointing to the image content")}),Fk=v({fileId:p().describe("OpenAI file ID referencing uploaded image content")}),Lk=Tt([Dk,Nk,Fk]).describe("Inline image data or references to uploaded content."),Bk=v({data:Tt([p(),nf(Uint8Array)]).describe("Base64 encoded file data, or raw bytes that will be encoded automatically."),mediaType:p().describe("IANA media type describing the file contents"),filename:p().describe("Filename associated with the inline data")}),Zk=v({url:p().describe("Publicly accessible URL for the file content"),filename:p().optional()}),Uk=v({id:p().describe("OpenAI file ID referencing uploaded content"),filename:p().optional()}),Gk=Tt([p().describe("Existing data URL or base64 string"),Bk,Zk,Uk]).describe("Inline data (with metadata) or references pointing to file contents."),jk=(...t)=>p(),Vk=Re.extend({type:S("image"),image:p().or(Lk).optional(),detail:jk("low","high","auto").optional()}),Hk=Re.extend({type:S("file"),file:Gk}),Wk=Re.extend({type:S("computer_screenshot"),data:p().describe("Base64 encoded image data or URL")}),Du=Ne("type",[v({type:S("screenshot")}),v({type:S("click"),x:M(),y:M(),button:_e(["left","right","wheel","back","forward"])}),v({type:S("double_click"),x:M(),y:M()}),v({type:S("scroll"),x:M(),y:M(),scroll_x:M(),scroll_y:M()}),v({type:S("type"),text:p()}),v({type:S("wait")}),v({type:S("move"),x:M(),y:M()}),v({type:S("keypress"),keys:G(p())}),v({type:S("drag"),path:G(v({x:M(),y:M()}))})]),Yk=Ne("type",[Rk,Mk,cf,Ok]),Ka=st.extend({type:S("message").optional()}),ki=Ka.extend({role:S("assistant"),status:_e(["in_progress","completed","incomplete"]),content:G(Yk)}),qk=Ne("type",[Ja,af,lf,cf]),uf=Ka.extend({role:S("user"),content:G(qk).or(p())}),hf=Ka.extend({role:S("system"),content:p()});Ne("role",[hf,ki,uf]);const ns=st.extend({type:S("hosted_tool_call"),name:p().describe("The name of the hosted tool"),arguments:p().describe("The arguments of the hosted tool call").optional(),status:p().optional(),output:p().optional()}),rs=st.extend({type:S("function_call"),callId:p().describe("The ID of the tool call"),name:p().describe("The name of the function"),namespace:p().optional(),status:_e(["in_progress","completed","incomplete"]).optional(),arguments:p()});v({type:S("tool_reference"),functionName:p(),namespace:p().optional()});const Xk=oe(p(),Y()),Jk=ca(),Qa=st.extend({type:S("tool_search_call"),call_id:p().nullable().optional(),callId:p().nullable().optional(),execution:_e(["client","server"]).optional(),arguments:Jk,status:p().optional()}),el=st.extend({type:S("tool_search_output"),call_id:p().nullable().optional(),callId:p().nullable().optional(),execution:_e(["client","server"]).optional(),status:p().optional(),tools:G(Xk)}),Kk=Ne("type",[$k,Vk,Hk]),Qk=Ne("type",[Ja,af,lf]),hi=st.extend({type:S("function_call_result"),name:p().describe("The name of the tool"),namespace:p().optional(),callId:p().describe("The ID of the tool call"),status:_e(["in_progress","completed","incomplete"]),output:Tt([p(),Kk,G(Qk)]).describe("Output returned by the tool call. Supports plain strings, legacy ToolOutput items, or structured input_* items.")}),Si=st.extend({type:S("computer_call"),callId:p().describe("The ID of the computer call"),status:_e(["in_progress","completed","incomplete"]),action:Du.optional(),actions:G(Du).min(1).optional()}).superRefine((t,e)=>{!t.action&&(!t.actions||t.actions.length===0)&&e.addIssue({code:vk.custom,message:"computer_call items must include action or actions.",path:["action"]})}),df=st.extend({type:S("computer_call_result"),callId:p().describe("The ID of the computer call"),output:Wk}),eS=v({commands:G(p()),timeoutMs:M().int().min(0).optional(),maxOutputLength:M().int().min(0).optional()}),Ti=st.extend({type:S("shell_call"),callId:p(),status:_e(["in_progress","completed","incomplete"]).optional(),action:eS}),tS=Ne("type",[v({type:S("timeout")}),v({type:S("exit"),exitCode:M().int().nullable()})]),nS=v({stdout:p(),stderr:p(),outcome:tS}).passthrough(),tl=st.extend({type:S("shell_call_output"),callId:p(),maxOutputLength:M().optional(),output:G(nS)}),rS=v({type:S("create_file"),path:p(),diff:p()}),sS=v({type:S("update_file"),path:p(),diff:p()}),iS=v({type:S("delete_file"),path:p()}),oS=Ne("type",[rS,sS,iS]),Ai=st.extend({type:S("apply_patch_call"),callId:p(),status:_e(["in_progress","completed"]),operation:oS}),nl=st.extend({type:S("apply_patch_call_output"),callId:p(),status:_e(["completed","failed"]),output:p().optional()}),aS=Ne("type",[Si,Ti,Ai,rs,ns]),rl=Re.extend({id:p().optional(),type:S("reasoning"),content:G(Ja),rawContent:G(zk).optional()}),ff=st.extend({type:S("compaction"),encrypted_content:p(),id:p().optional(),created_by:p().optional()}),pf=st.extend({type:S("unknown")}),mf=Ne("type",[ki,Qa,el,ns,rs,Si,Ti,Ai,hi,tl,nl,rl,ff,pf]),lS=Tt([uf,ki,hf,Qa,el,ns,rs,Si,Ti,Ai,hi,df,tl,nl,rl,ff,pf]),cS=v({inputTokens:M(),outputTokens:M(),totalTokens:M(),inputTokensDetails:oe(p(),M()).optional(),outputTokensDetails:oe(p(),M()).optional(),endpoint:p().optional()}),uS=v({requests:M().optional(),inputTokens:M(),outputTokens:M(),totalTokens:M(),inputTokensDetails:Tt([oe(p(),M()),G(oe(p(),M()))]).optional(),outputTokensDetails:Tt([oe(p(),M()),G(oe(p(),M()))]).optional(),requestUsageEntries:G(cS).optional()}),hS=Re.extend({type:S("output_text_delta"),delta:p()}),dS=Re.extend({type:S("response_started")}),fS=Re.extend({type:S("response_done"),response:Re.extend({id:p(),requestId:p().optional(),usage:uS,output:G(mf)})}),pS=Re.extend({type:S("model"),event:Y().describe("The event from the model")});Ne("type",[hS,fS,dS,pS]);const Nu=Symbol.for("openai.agents.core.asyncLocalStorage");let ko;function mS(){try{const t=globalThis,e=t[Nu];if(e)return e;const n=new Ou;return t[Nu]=n,n}catch{return ko||(ko=new Ou),ko}}function gf(){const t=mS().getStore();if((t==null?void 0:t.active)===!0)return t}function Fu(){const t=gf();return t!=null&&t.trace?t.trace:null}function Lu(){const t=gf();return t!=null&&t.span?t.span:null}class gS{async export(e){if(sf.disabled){me.debug("Tracing is disabled. Skipping export");return}for(const n of e)n.type==="trace"?console.log(`[Exporter] Export trace traceId=${n.traceId} name=${n.name}${n.groupId?` groupId=${n.groupId}`:""}`):console.log(`[Exporter] Export span: ${JSON.stringify(n)}`)}}var os,Jn,as,ls,Kn,Le,Lt,nn,rn,Qn,tt,da,fa,Vn;class _S{constructor(e,{maxQueueSize:n=1e3,maxBatchSize:r=100,scheduleDelay:s=5e3,exportTriggerRatio:i=.8}={}){ae(this,tt);ae(this,os);ae(this,Jn);ae(this,as);ae(this,ls);ae(this,Kn);ae(this,Le,[]);ae(this,Lt);ae(this,nn,null);ae(this,rn,!1);ae(this,Qn,null);q(this,os,n),q(this,Jn,r),q(this,as,s),q(this,ls,n*i),q(this,Kn,e),q(this,Lt,Ik),me.debug("Automatic trace export loop is not supported in this environment. You need to manually call `getGlobalTraceProvider().forceFlush()` to export traces.")}start(){q(this,Qn,new AbortController),xt(this,tt,fa).call(this)}async onTraceStart(e){await xt(this,tt,da).call(this,e)}async onTraceEnd(e){}async onSpanStart(e){}async onSpanEnd(e){await xt(this,tt,da).call(this,e)}async shutdown(e){var n;for(e&&R(this,Lt).setTimeout(()=>{var r;(r=R(this,Qn))==null||r.abort()},e),me.debug("Shutting down gracefully");R(this,Le).length>0;){if(me.debug(`Waiting for buffer to empty. Items left: ${R(this,Le).length}`),R(this,rn)||await xt(this,tt,Vn).call(this,!0),(n=R(this,Qn))!=null&&n.signal.aborted){me.debug("Timeout reached, force flushing"),await xt(this,tt,Vn).call(this,!0);break}await new Promise(r=>R(this,Lt).setTimeout(r,500))}me.debug("Buffer empty. Exiting"),R(this,Lt)&&R(this,nn)&&R(this,Lt).clearTimeout(R(this,nn))}async forceFlush(){R(this,Le).length>0&&await xt(this,tt,Vn).call(this,!0)}}os=new WeakMap,Jn=new WeakMap,as=new WeakMap,ls=new WeakMap,Kn=new WeakMap,Le=new WeakMap,Lt=new WeakMap,nn=new WeakMap,rn=new WeakMap,Qn=new WeakMap,tt=new WeakSet,da=async function(e){if(R(this,Le).length+1>R(this,os)){me.error("Dropping trace because buffer is full");return}R(this,Le).push(e),R(this,Le).length>R(this,ls)&&await xt(this,tt,Vn).call(this)},fa=function(){q(this,nn,R(this,Lt).setTimeout(async()=>{await xt(this,tt,Vn).call(this),xt(this,tt,fa).call(this)},R(this,as))),typeof R(this,nn).unref=="function"&&R(this,nn).unref()},Vn=async function(e=!1){if(R(this,Le).length!==0){if(me.debug(`Exporting batches. Force: ${e}. Buffer size: ${R(this,Le).length}`),e||R(this,Le).length<R(this,Jn)){const n=[...R(this,Le)];q(this,Le,[]),q(this,rn,!0),await R(this,Kn).export(n),q(this,rn,!1)}else if(R(this,Le).length>0){const n=R(this,Le).splice(0,R(this,Jn));q(this,rn,!0),await R(this,Kn).export(n),q(this,rn,!1)}}};var at;class yS{constructor(){ae(this,at,[])}start(){for(const e of R(this,at))e.start&&e.start()}addTraceProcessor(e){R(this,at).push(e)}setProcessors(e){me.debug("Shutting down old processors");for(const n of R(this,at))n.shutdown();q(this,at,e)}async onTraceStart(e){for(const n of R(this,at))await n.onTraceStart(e)}async onTraceEnd(e){for(const n of R(this,at))await n.onTraceEnd(e)}async onSpanStart(e){for(const n of R(this,at))await n.onSpanStart(e)}async onSpanEnd(e){for(const n of R(this,at))await n.onSpanEnd(e)}async shutdown(e){for(const n of R(this,at))await n.shutdown(e)}async forceFlush(){for(const e of R(this,at))await e.forceFlush()}}at=new WeakMap;let So=null,To=null;function xS(){return So||(So=new gS),So}function _f(){return To||(To=new _S(xS())),To}function Bu(){return new Date().toISOString()}function yf(){return`trace_${of().replace(/-/g,"")}`}function bS(){return`span_${of().replace(/-/g,"").slice(0,24)}`}function vS(t){return Object.fromEntries(Object.entries(t).filter(([e])=>!e.startsWith("_")))}var cs,us,hs,ds,fs,An,sn,on,Cn,er,ps;const sl=class sl{constructor(e,n){K(this,"type","trace.span");ae(this,cs);ae(this,us);ae(this,hs);ae(this,ds);ae(this,fs);ae(this,An);ae(this,sn);ae(this,on);ae(this,Cn);ae(this,er);ae(this,ps);q(this,us,e.traceId),q(this,hs,e.spanId??bS()),q(this,cs,e.data),q(this,An,n),q(this,ds,e.parentId??null),q(this,fs,e.traceMetadata),q(this,Cn,e.error??null),q(this,sn,e.startedAt??null),q(this,on,e.endedAt??null),q(this,er,e.tracingApiKey)}get traceId(){return R(this,us)}get spanData(){return R(this,cs)}get traceMetadata(){return R(this,fs)}get spanId(){return R(this,hs)}get parentId(){return R(this,ds)}get previousSpan(){return R(this,ps)}set previousSpan(e){q(this,ps,e)}start(){if(R(this,sn)){me.warn("Span already started");return}q(this,sn,Bu()),R(this,An).onSpanStart(this)}end(){if(R(this,on)){me.debug("Span already finished",this.spanData);return}q(this,on,Bu()),R(this,An).onSpanEnd(this)}setError(e){q(this,Cn,e)}get error(){return R(this,Cn)}get startedAt(){return R(this,sn)}get endedAt(){return R(this,on)}get tracingApiKey(){return R(this,er)}clone(){var n;const e=new sl({traceId:this.traceId,spanId:this.spanId,parentId:this.parentId??void 0,data:this.spanData,traceMetadata:this.traceMetadata,startedAt:R(this,sn)??void 0,endedAt:R(this,on)??void 0,error:R(this,Cn)??void 0,tracingApiKey:R(this,er)},R(this,An));return e.previousSpan=(n=this.previousSpan)==null?void 0:n.clone(),e}toJSON(){return{object:this.type,id:this.spanId,trace_id:this.traceId,parent_id:this.parentId,started_at:this.startedAt,ended_at:this.endedAt,span_data:vS(this.spanData),error:this.error}}};cs=new WeakMap,us=new WeakMap,hs=new WeakMap,ds=new WeakMap,fs=new WeakMap,An=new WeakMap,sn=new WeakMap,on=new WeakMap,Cn=new WeakMap,er=new WeakMap,ps=new WeakMap;let ss=sl;class en extends ss{constructor(e,n){super({traceId:"no-op",spanId:"no-op",data:e},n)}start(){}end(){}setError(){}toJSON(){return null}}var tr,Bt;const il=class il{constructor(e,n){K(this,"type","trace");K(this,"traceId");K(this,"name");K(this,"groupId",null);K(this,"metadata");K(this,"tracingApiKey");ae(this,tr);ae(this,Bt);this.traceId=e.traceId??yf(),this.name=e.name??"Agent workflow",this.groupId=e.groupId??null,this.metadata=e.metadata??{},this.tracingApiKey=e.tracingApiKey,q(this,tr,n??_f()),q(this,Bt,e.started??!1)}async start(){R(this,Bt)||(q(this,Bt,!0),await R(this,tr).onTraceStart(this))}async end(){R(this,Bt)&&(q(this,Bt,!1),await R(this,tr).onTraceEnd(this))}clone(){return new il({traceId:this.traceId,name:this.name,groupId:this.groupId??void 0,metadata:this.metadata,started:R(this,Bt),tracingApiKey:this.tracingApiKey})}toJSON(e){const n={object:this.type,id:this.traceId,workflow_name:this.name,group_id:this.groupId,metadata:this.metadata};return e!=null&&e.includeTracingApiKey&&this.tracingApiKey&&(n.tracing_api_key=this.tracingApiKey),n}};tr=new WeakMap,Bt=new WeakMap;let is=il;class Ao extends is{constructor(){super({})}async start(){}async end(){}toJSON(){return null}}var De,En,Zt,di,bf;class xf{constructor(){ae(this,di);ae(this,De);ae(this,En);ae(this,Zt);q(this,De,new yS),q(this,En,sf.disabled),q(this,Zt,null),xt(this,di,bf).call(this)}registerProcessor(e){q(this,Zt,null),R(this,De).addTraceProcessor(e)}setProcessors(e){q(this,Zt,null),R(this,De).setProcessors(e)}getCurrentTrace(){return Fu()}getCurrentSpan(){return Lu()}setDisabled(e){q(this,En,e)}startExportLoop(){R(this,De).start()}createTrace(e){if(R(this,En))return me.debug("Tracing is disabled, Not creating trace %o",e),new Ao;const n=e.traceId??yf(),r=e.name??"Agent workflow";return me.debug("Creating trace %s with name %s",n,r),new is({...e,name:r,traceId:n},R(this,De))}createSpan(e,n){if(R(this,En)||e.disabled)return me.debug("Tracing is disabled, Not creating span %o",e),new en(e.data,R(this,De));let r,s,i,o;if(n){if(n instanceof is){if(n instanceof Ao)return me.debug("Parent trace is no-op, returning NoopSpan"),new en(e.data,R(this,De));s=n.traceId,i=n.tracingApiKey,o=n.metadata}else if(n instanceof ss){if(n instanceof en)return me.debug("Parent span is no-op, returning NoopSpan"),new en(e.data,R(this,De));r=n.spanId,s=n.traceId,i=n.tracingApiKey,o=n.traceMetadata}}else{const a=Fu(),l=Lu();if(!a)return me.error("No active trace. Make sure to start a trace with `withTrace()` first. Returning NoopSpan."),new en(e.data,R(this,De));if(l instanceof en||a instanceof Ao)return me.debug(`Parent ${l} or ${a} is no-op, returning NoopSpan`),new en(e.data,R(this,De));s=a.traceId,i=a.tracingApiKey,o=a.metadata,l?(me.debug("Using parent span %s",l.spanId),r=l.spanId):me.debug("No parent span, using current trace %s",a.traceId)}return s?(me.debug(`Creating span ${JSON.stringify(e.data)} with id ${e.spanId??s}`),new ss({...e,traceId:s,parentId:r,traceMetadata:o??e.traceMetadata,tracingApiKey:i??e.tracingApiKey},R(this,De))):(me.error("No traceId found. Make sure to start a trace with `withTrace()` first. Returning NoopSpan."),new en(e.data,R(this,De)))}async shutdown(e){R(this,Zt)||q(this,Zt,(async()=>{try{me.debug("Shutting down tracing provider"),await R(this,De).shutdown(e)}catch(n){me.error("Error shutting down tracing provider %o",n)}})()),await R(this,Zt)}async forceFlush(){await R(this,De).forceFlush()}}De=new WeakMap,En=new WeakMap,Zt=new WeakMap,di=new WeakSet,bf=function(){if(typeof process<"u"&&typeof process.on=="function"){const e=async()=>{const n=setTimeout(()=>{console.warn("Cleanup timeout, forcing exit"),process.exit(1)},5e3);try{await this.shutdown()}finally{clearTimeout(n)}};process.once("beforeExit",e),process.on("SIGINT",async()=>{await e(),Zu("SIGINT")||process.exit(130)}),process.on("SIGTERM",async()=>{await e(),Zu("SIGTERM")||process.exit(0)}),process.on("unhandledRejection",async(n,r)=>{me.error("Unhandled rejection",n,r),await e(),wS("unhandledRejection")||process.exit(1)})}};let Co;function Zu(t){return process.listeners(t).length>1}function wS(t){return process.listeners(t).length>1}function kS(){const t=Symbol.for("openai.agents.core.traceProvider");try{const e=globalThis,n=e[t];if(n)return n;const r=Object.getOwnPropertyDescriptor(e,t);if(r&&r.writable===!1&&r.configurable===!1&&!r.set)return Gs();if(!r)try{Object.defineProperty(e,t,{value:void 0,writable:!0,configurable:!0})}catch{return Gs()}try{const s=new xf;return e[t]=s,s}catch{return Gs()}}catch{return Gs()}}function Gs(){return Co||(Co=new xf),Co}function SS(t){kS().registerProcessor(t)}const TS=Ne("type",[v({type:S("next_step_handoff"),newAgent:Y()}),v({type:S("next_step_final_output"),output:p()}),v({type:S("next_step_run_again")}),v({type:S("next_step_interruption"),data:oe(p(),Y())})]),AS="1.8",CS=["1.0","1.1","1.2","1.3","1.4","1.5","1.6","1.7",AS],ES=_e(CS),ht=v({name:p()}),PS=v({object:S("trace.span"),id:p(),trace_id:p(),parent_id:p().nullable(),started_at:p().nullable(),ended_at:p().nullable(),error:v({message:p(),data:oe(p(),Y()).optional()}).nullable(),span_data:oe(p(),Y())}),vf=PS.extend({previous_span:yk(()=>vf).optional()}),IS=v({inputTokens:M(),outputTokens:M(),totalTokens:M(),inputTokensDetails:oe(p(),M()).optional(),outputTokensDetails:oe(p(),M()).optional(),endpoint:p().optional()}),wf=v({requests:M(),inputTokens:M(),outputTokens:M(),totalTokens:M(),inputTokensDetails:G(oe(p(),M())).optional(),outputTokensDetails:G(oe(p(),M())).optional(),requestUsageEntries:G(IS).optional()}),Uu=v({usage:wf,output:G(mf),responseId:p().optional(),requestId:p().optional(),providerData:oe(p(),Y()).optional()}),kf=Ne("type",[v({type:S("message_output_item"),rawItem:ki,agent:ht}),v({type:S("tool_search_call_item"),rawItem:Qa,agent:ht}),v({type:S("tool_search_output_item"),rawItem:el,agent:ht}),v({type:S("tool_call_item"),rawItem:aS.or(ns),agent:ht}),v({type:S("tool_call_output_item"),rawItem:hi.or(df).or(tl).or(nl),agent:ht,output:p()}),v({type:S("reasoning_item"),rawItem:rl,agent:ht}),v({type:S("handoff_call_item"),rawItem:rs,agent:ht}),v({type:S("handoff_output_item"),rawItem:hi,sourceAgent:ht,targetAgent:ht}),v({type:S("tool_approval_item"),rawItem:rs.or(ns).or(Si).or(Ti).or(Ai),agent:ht,toolName:p().optional()})]),MS=v({object:S("trace"),id:p(),workflow_name:p(),group_id:p().nullable(),metadata:oe(p(),Y()),tracing_api_key:p().optional().nullable()}),RS=v({newItems:G(kf),toolsUsed:G(p()),handoffs:G(v({toolCall:Y(),handoff:Y()})),functions:G(v({toolCall:Y(),tool:Y()})),computerActions:G(v({toolCall:Y(),computer:Y()})),shellActions:G(v({toolCall:Y(),shell:Y()})).optional(),applyPatchActions:G(v({toolCall:Y(),applyPatch:Y()})).optional(),mcpApprovalRequests:G(v({requestItem:v({rawItem:v({type:S("hosted_tool_call"),name:p(),arguments:p().optional(),status:p().optional(),output:p().optional(),providerData:oe(p(),Y()).nullable().optional()})}),mcpTool:v({type:S("hosted_tool"),name:S("hosted_mcp"),providerData:oe(p(),Y())})})).optional()}),Sf=v({tripwireTriggered:ln(),outputInfo:Y()}),zS=Ne("type",[v({type:S("allow")}),v({type:S("rejectContent"),message:p()}),v({type:S("throwException")})]),Tf=v({outputInfo:Y().optional(),behavior:zS}),Af=v({type:Tt([S("tool_input"),S("tool_output")]),name:p()}),OS=v({guardrail:v({type:S("input"),name:p()}),output:Sf}),$S=v({guardrail:v({type:S("output"),name:p()}),agentOutput:Y(),agent:ht,output:Sf}),DS=v({guardrail:Af.extend({type:S("tool_input")}),output:Tf}),NS=v({guardrail:Af.extend({type:S("tool_output")}),output:Tf});v({$schemaVersion:ES,currentTurn:M(),currentAgent:ht,originalInput:p().or(G(lS)),modelResponses:G(Uu),context:v({usage:wf,approvals:oe(p(),v({approved:G(p()).or(ln()),rejected:G(p()).or(ln()),messages:oe(p(),p()).optional(),stickyRejectMessage:p().optional()})),context:oe(p(),Y()),toolInput:Y().optional()}),toolUseTracker:oe(p(),G(p())),maxTurns:M(),currentAgentSpan:vf.nullable().optional(),noActiveAgentRun:ln(),inputGuardrailResults:G(OS),outputGuardrailResults:G($S),toolInputGuardrailResults:G(DS).optional().default([]),toolOutputGuardrailResults:G(NS).optional().default([]),currentTurnInProgress:ln().optional(),currentStep:TS.optional(),lastModelResponse:Uu.optional(),generatedItems:G(kf),pendingAgentToolRuns:oe(p(),p()).optional().default({}),lastProcessedResponse:RS.optional(),currentTurnPersistedItemCount:M().int().min(0).optional(),conversationId:p().optional(),previousResponseId:p().optional(),reasoningItemIdPolicy:_e(["preserve","omit"]).optional(),trace:MS.nullable()});v({input:p()});Xa("openai-agents:mcp-servers");SS(_f());v({itemId:p()});Ne("role",[v({itemId:p(),previousItemId:p().nullable().optional(),type:S("message"),role:S("system"),content:G(v({type:S("input_text"),text:p()}))}),v({itemId:p(),previousItemId:p().nullable().optional(),type:S("message"),role:S("user"),status:_e(["in_progress","completed"]),content:G(v({type:S("input_text"),text:p()}).or(v({type:S("input_audio"),audio:p().nullable().optional(),transcript:p().nullable()})))}),v({itemId:p(),previousItemId:p().nullable().optional(),type:S("message"),role:S("assistant"),status:_e(["in_progress","completed","incomplete"]),content:G(v({type:S("output_text"),text:p()}).or(v({type:S("output_audio"),audio:p().nullable().optional(),transcript:p().nullable().optional()})))})]);v({itemId:p(),previousItemId:p().nullable().optional(),type:S("function_call"),status:_e(["in_progress","completed","incomplete"]),arguments:p(),name:p(),output:p().nullable()});v({itemId:p(),previousItemId:p().nullable().optional(),type:_e(["mcp_call","mcp_tool_call"]),status:_e(["in_progress","completed","incomplete"]),arguments:p(),name:p(),output:p().nullable()});v({itemId:p(),type:S("mcp_approval_request"),serverLabel:p(),name:p(),arguments:oe(p(),Y()),approved:ln().optional().nullable()});Xa("openai-agents:realtime");const Cf=v({id:p().optional().nullable(),conversation_id:p().optional().nullable(),max_output_tokens:M().or(S("inf")).optional().nullable(),metadata:oe(p(),Y()).optional().nullable(),output_modalities:G(p()).optional().nullable(),object:S("realtime.response").optional().nullable(),output:G(Y()).optional().nullable(),audio:v({output:v({format:Y().optional().nullable(),voice:p().optional().nullable()}).optional().nullable()}).optional().nullable(),status:_e(["completed","incomplete","failed","cancelled","in_progress"]).optional().nullable(),status_details:oe(p(),Y()).optional().nullable(),usage:v({input_tokens:M().optional(),input_token_details:oe(p(),Y()).optional().nullable(),output_tokens:M().optional(),output_token_details:oe(p(),Y()).optional().nullable()}).optional().nullable()}),FS=v({id:p().optional(),audio:p().nullable().optional(),text:p().nullable().optional(),transcript:p().nullable().optional(),type:Tt([S("input_text"),S("input_audio"),S("item_reference"),S("output_text"),S("output_audio")])}),dr=v({id:p().optional(),arguments:p().optional(),call_id:p().optional(),content:G(FS).optional(),name:p().optional(),output:p().nullable().optional(),role:_e(["user","assistant","system"]).optional(),status:_e(["completed","incomplete","in_progress"]).optional(),type:_e(["message","function_call","function_call_output","mcp_list_tools","mcp_tool_call","mcp_call","mcp_approval_request","mcp_approval_response"]).optional(),approval_request_id:p().nullable().optional(),approve:ln().nullable().optional(),reason:p().nullable().optional(),server_label:p().optional(),error:Y().nullable().optional(),tools:G(v({name:p(),description:p(),input_schema:oe(p(),Y()).optional()}).passthrough()).optional()}).passthrough(),LS=v({type:S("conversation.created"),event_id:p(),conversation:v({id:p().optional(),object:S("realtime.conversation").optional()})}),BS=v({type:S("conversation.item.added"),event_id:p(),item:dr,previous_item_id:p().nullable().optional()}),ZS=v({type:S("conversation.item.done"),event_id:p(),item:dr,previous_item_id:p().nullable().optional()}),US=v({type:S("conversation.item.deleted"),event_id:p(),item_id:p()}),GS=v({type:S("conversation.item.input_audio_transcription.completed"),event_id:p(),item_id:p(),content_index:M(),transcript:p(),logprobs:G(Y()).nullable().optional(),usage:v({type:S("tokens"),total_tokens:M(),input_tokens:M(),input_token_details:v({text_tokens:M(),audio_tokens:M()}),output_tokens:M()}).optional()}),jS=v({type:S("conversation.item.input_audio_transcription.delta"),event_id:p(),item_id:p(),content_index:M().optional(),delta:p().optional(),logprobs:G(Y()).nullable().optional()}),VS=v({type:S("conversation.item.input_audio_transcription.failed"),event_id:p(),item_id:p(),content_index:M(),error:v({code:p().optional(),message:p().optional(),param:p().optional(),type:p().optional()})}),HS=v({type:S("conversation.item.retrieved"),event_id:p(),item:dr}),WS=v({type:S("conversation.item.truncated"),event_id:p(),item_id:p(),audio_end_ms:M(),content_index:M()}),YS=v({type:S("conversation.item.create"),item:dr,event_id:p().optional(),previous_item_id:p().nullable().optional()}),qS=v({type:S("conversation.item.delete"),item_id:p(),event_id:p().optional()}),XS=v({type:S("conversation.item.retrieve"),item_id:p(),event_id:p().optional()}),JS=v({type:S("conversation.item.truncate"),item_id:p(),audio_end_ms:M(),content_index:M(),event_id:p().optional()}),KS=v({type:S("error"),event_id:p().optional(),error:Y().optional()}),QS=v({type:S("input_audio_buffer.cleared"),event_id:p()}),e1=v({type:S("input_audio_buffer.append"),audio:p(),event_id:p().optional()}),t1=v({type:S("input_audio_buffer.clear"),event_id:p().optional()}),n1=v({type:S("input_audio_buffer.commit"),event_id:p().optional()}),r1=v({type:S("input_audio_buffer.committed"),event_id:p(),item_id:p(),previous_item_id:p().nullable().optional()}),s1=v({type:S("input_audio_buffer.speech_started"),event_id:p(),item_id:p(),audio_start_ms:M()}),i1=v({type:S("input_audio_buffer.speech_stopped"),event_id:p(),item_id:p(),audio_end_ms:M()}),o1=v({type:S("output_audio_buffer.started"),event_id:p()}).passthrough(),a1=v({type:S("output_audio_buffer.stopped"),event_id:p()}).passthrough(),l1=v({type:S("output_audio_buffer.cleared"),event_id:p()}),c1=v({type:S("rate_limits.updated"),event_id:p(),rate_limits:G(v({limit:M().optional(),name:_e(["requests","tokens"]).optional(),remaining:M().optional(),reset_seconds:M().optional()}))}),u1=v({type:S("response.output_audio.delta"),event_id:p(),item_id:p(),content_index:M(),delta:p(),output_index:M(),response_id:p()}),h1=v({type:S("response.output_audio.done"),event_id:p(),item_id:p(),content_index:M(),output_index:M(),response_id:p()}),d1=v({type:S("response.output_audio_transcript.delta"),event_id:p(),item_id:p(),content_index:M(),delta:p(),output_index:M(),response_id:p()}),f1=v({type:S("response.output_audio_transcript.done"),event_id:p(),item_id:p(),content_index:M(),transcript:p(),output_index:M(),response_id:p()}),p1=v({type:S("response.content_part.added"),event_id:p(),item_id:p(),content_index:M(),output_index:M(),response_id:p(),part:v({audio:p().optional(),text:p().optional(),transcript:p().optional(),type:_e(["text","audio"]).optional()})}),m1=v({type:S("response.content_part.done"),event_id:p(),item_id:p(),content_index:M(),output_index:M(),response_id:p(),part:v({audio:p().optional(),text:p().optional(),transcript:p().optional(),type:_e(["text","audio"]).optional()})}),g1=v({type:S("response.created"),event_id:p(),response:Cf}),_1=v({type:S("response.done"),event_id:p(),response:Cf}),y1=v({type:S("response.function_call_arguments.delta"),event_id:p(),item_id:p(),call_id:p(),delta:p(),output_index:M(),response_id:p()}),x1=v({type:S("response.function_call_arguments.done"),event_id:p(),item_id:p(),call_id:p(),arguments:p(),output_index:M(),response_id:p()}),b1=v({type:S("response.output_item.added"),event_id:p(),item:dr,output_index:M(),response_id:p()}),v1=v({type:S("response.output_item.done"),event_id:p(),item:dr,output_index:M(),response_id:p()}),w1=v({type:S("response.output_text.delta"),event_id:p(),item_id:p(),content_index:M(),delta:p(),output_index:M(),response_id:p()}),k1=v({type:S("response.output_text.done"),event_id:p(),item_id:p(),content_index:M(),text:p(),output_index:M(),response_id:p()}),S1=v({type:S("session.created"),event_id:p(),session:Y()}),T1=v({type:S("session.updated"),event_id:p(),session:Y()}),A1=v({type:S("response.cancel"),event_id:p().optional(),response_id:p().optional()}),C1=v({type:S("response.create"),event_id:p().optional(),response:Y().optional()}),E1=v({type:S("session.update"),event_id:p().optional(),session:Y()}),P1=v({type:S("mcp_list_tools.in_progress"),event_id:p().optional(),item_id:p().optional()}),I1=v({type:S("mcp_list_tools.completed"),event_id:p().optional(),item_id:p().optional()}),M1=v({type:S("response.mcp_call_arguments.delta"),event_id:p(),response_id:p(),item_id:p(),output_index:M(),delta:p(),obfuscation:p()}),R1=v({type:S("response.mcp_call_arguments.done"),event_id:p(),response_id:p(),item_id:p(),output_index:M(),arguments:p()}),z1=v({type:S("response.mcp_call.in_progress"),event_id:p(),output_index:M(),item_id:p()}),O1=v({type:S("response.mcp_call.completed"),event_id:p(),output_index:M(),item_id:p()}),$1=v({type:S("mcp_list_tools.failed"),event_id:p().optional(),item_id:p().optional()});v({type:p(),event_id:p().optional().nullable()}).passthrough();Ne("type",[LS,BS,ZS,US,GS,jS,VS,HS,WS,KS,QS,r1,s1,i1,o1,a1,l1,c1,u1,h1,d1,f1,p1,m1,g1,_1,y1,x1,b1,v1,w1,k1,S1,T1,P1,I1,$1,M1,R1,z1,O1]);Ne("type",[YS,qS,XS,JS,e1,t1,n1,A1,C1,E1]);const Eo={};var Ut={};const D1=typeof process<"u"&&typeof(Ut==null?void 0:Ut.NEXT_PUBLIC_AGENT_PLAY_BASE)=="string"?Ut.NEXT_PUBLIC_AGENT_PLAY_BASE.replace(/\/$/,""):typeof import.meta<"u"&&"/agent-play/".replace(/\/$/,"")||"";typeof process<"u"&&typeof(Ut==null?void 0:Ut.NEXT_PUBLIC_PLAY_API_BASE)=="string"&&Ut.NEXT_PUBLIC_PLAY_API_BASE.length>0?Ut.NEXT_PUBLIC_PLAY_API_BASE.replace(/\/$/,""):typeof import.meta<"u"&&typeof(Eo==null?void 0:Eo.VITE_PLAY_API_BASE)=="string"&&(void 0).length>0&&(void 0).replace(/\/$/,"");U_({});new Yt;new Ks;new Yt;new Yt;new Yt;export{Hs as B,Yt as C,fe as E,pi as G,te as M,Ue as P,No as R,ba as S,Is as T,Oo as U,fn as a,Rh as b,Ah as c,Ih as d,ct as e,ah as f,de as g,Wm as h,St as i,fp as r,lt as w};
|