@agent-play/play-ui 3.7.3 → 3.7.5

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.
@@ -0,0 +1,336 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/browserAll-B-jOXTvk.js","assets/webworkerAll-BOJk_1EQ.js"])))=>i.map(i=>d[i]);
2
+ var lm=Object.defineProperty;var Sl=t=>{throw TypeError(t)};var um=(t,e,n)=>e in t?lm(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var ie=(t,e,n)=>um(t,typeof e!="symbol"?e+"":e,n),vo=(t,e,n)=>e.has(t)||Sl("Cannot "+n);var O=(t,e,n)=>(vo(t,e,"read from private field"),n?n.call(t):e.get(t)),ge=(t,e,n)=>e.has(t)?Sl("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),te=(t,e,n,r)=>(vo(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),Mt=(t,e,n)=>(vo(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 hm="modulepreload",dm=function(t){return"/agent-play/"+t},Tl={},cd=function(e,n,r){let s=Promise.resolve();if(n&&n.length>0){let o=function(l){return Promise.all(l.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]"),c=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=o(n.map(l=>{if(l=dm(l),l in Tl)return;Tl[l]=!0;const u=l.endsWith(".css"),h=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${h}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":hm,u||(f.as="script"),f.crossOrigin="",f.href=l,c&&f.setAttribute("nonce",c),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 ${l}`)))})}))}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 we=(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))(we||{});const ma=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},ni=(t,e)=>ma(t).priority??e,bt={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...t){return t.map(ma).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(ma).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)=>ni(o.value,n)-ni(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)=>ni(i,n)-ni(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))}},fm={extension:{type:we.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await cd(()=>import("./browserAll-B-jOXTvk.js"),__vite__mapDeps([0,1]))}},pm={extension:{type:we.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await cd(()=>import("./webworkerAll-BOJk_1EQ.js"),[])}};class Xe{constructor(e,n,r){this._x=n||0,this._y=r||0,this._observer=e}clone(e){return new Xe(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 fc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var wo={exports:{}},Al;function mm(){return Al||(Al=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(c,l,u){this.fn=c,this.context=l,this.once=u||!1}function i(c,l,u,h,f){if(typeof u!="function")throw new TypeError("The listener must be a function");var d=new s(u,h||c,f),m=n?n+l:l;return c._events[m]?c._events[m].fn?c._events[m]=[c._events[m],d]:c._events[m].push(d):(c._events[m]=d,c._eventsCount++),c}function o(c,l){--c._eventsCount===0?c._events=new r:delete c._events[l]}function a(){this._events=new r,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],u,h;if(this._eventsCount===0)return l;for(h in u=this._events)e.call(u,h)&&l.push(n?h.slice(1):h);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(u)):l},a.prototype.listeners=function(l){var u=n?n+l:l,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(l){var u=n?n+l:l,h=this._events[u];return h?h.fn?1:h.length:0},a.prototype.emit=function(l,u,h,f,d,m){var _=n?n+l:l;if(!this._events[_])return!1;var g=this._events[_],y=arguments.length,b,w;if(g.fn){switch(g.once&&this.removeListener(l,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(l,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(l,u,h){return i(this,l,u,h,!1)},a.prototype.once=function(l,u,h){return i(this,l,u,h,!0)},a.prototype.removeListener=function(l,u,h,f){var d=n?n+l:l;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(l){var u;return l?(u=n?n+l:l,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})(wo)),wo.exports}var gm=mm();const Rn=fc(gm),_m=Math.PI*2,ym=180/Math.PI,xm=Math.PI/180;class Ke{constructor(e=0,n=0){this.x=0,this.y=0,this.x=e,this.y=n}clone(){return new Ke(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 ko.x=0,ko.y=0,ko}}const ko=new Ke;class ce{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 Ke;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 Ke;const r=this.a,s=this.b,i=this.c,o=this.d,a=this.tx,c=this.ty,l=1/(r*o+i*-s),u=e.x,h=e.y;return n.x=o*l*u+-i*l*h+(c*i-a*o)*l,n.y=r*l*h+-s*l*u+(-c*r+a*s)*l,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,c=e.ty,l=n.a,u=n.b,h=n.c,f=n.d;return this.a=r*l+s*h,this.b=r*u+s*f,this.c=i*l+o*h,this.d=i*u+o*f,this.tx=a*l+c*h+n.tx,this.ty=a*u+c*f+n.ty,this}setTransform(e,n,r,s,i,o,a,c,l){return this.a=Math.cos(a+l)*i,this.b=Math.sin(a+l)*i,this.c=-Math.sin(a-c)*o,this.d=Math.cos(a-c)*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),c=Math.atan2(r,n),l=Math.abs(a+c);return l<1e-5||Math.abs(_m-l)<1e-5?(e.rotation=c,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=a,e.skew.y=c),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 ce;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 vm.identity()}static get shared(){return bm.identity()}}const bm=new ce,vm=new ce,Zn=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Fn=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Bn=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Un=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],ga=[],ld=[],ri=Math.sign;function wm(){for(let t=0;t<16;t++){const e=[];ga.push(e);for(let n=0;n<16;n++){const r=ri(Zn[t]*Zn[n]+Bn[t]*Fn[n]),s=ri(Fn[t]*Zn[n]+Un[t]*Fn[n]),i=ri(Zn[t]*Bn[n]+Bn[t]*Un[n]),o=ri(Fn[t]*Bn[n]+Un[t]*Un[n]);for(let a=0;a<16;a++)if(Zn[a]===r&&Fn[a]===s&&Bn[a]===i&&Un[a]===o){e.push(a);break}}}for(let t=0;t<16;t++){const e=new ce;e.set(Zn[t],Fn[t],Bn[t],Un[t],0,0),ld.push(e)}}wm();const be={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=>Zn[t],uY:t=>Fn[t],vX:t=>Bn[t],vY:t=>Un[t],inv:t=>t&8?t&15:-t&7,add:(t,e)=>ga[t][e],sub:(t,e)=>ga[t][be.inv(e)],rotate180:t=>t^4,isVertical:t=>(t&3)===2,byDirection:(t,e)=>Math.abs(t)*2<=Math.abs(e)?e>=0?be.S:be.N:Math.abs(e)*2<=Math.abs(t)?t>0?be.E:be.W:e>0?t>0?be.SE:be.SW:t>0?be.NE:be.NW,matrixAppendRotationInv:(t,e,n=0,r=0,s=0,i=0)=>{const o=ld[be.inv(e)],a=o.a,c=o.b,l=o.c,u=o.d,h=n-Math.min(0,a*s,l*i,a*s+l*i),f=r-Math.min(0,c*s,u*i,c*s+u*i),d=t.a,m=t.b,_=t.c,g=t.d;t.a=a*d+c*_,t.b=a*m+c*g,t.c=l*d+u*_,t.d=l*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:c,y:l,width:u,height:h}=e;return n===be.E?(r.set(s+c,i+l,o,a),r):n===be.S?r.set(u-i-a+c,s+l,a,o):n===be.W?r.set(u-s-o+c,h-i-a+l,o,a):n===be.N?r.set(i+c,h-s-o+l,a,o):r.set(s+c,i+l,o,a)}},si=[new Ke,new Ke,new Ke,new Ke];class Ge{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 Ge(0,0,0,0)}clone(){return new Ge(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,c=this.y,l=r*(1-s),u=r-l,h=a-l,f=a+i+l,d=c-l,m=c+o+l,_=a+u,g=a+i-u,y=c+u,b=c+o-u;return e>=h&&e<=f&&n>=d&&n<=m&&!(e>_&&e<g&&n>y&&n<b)}intersects(e,n){if(!n){const Y=this.x<e.x?e.x:this.x;if((this.right>e.right?e.right:this.right)<=Y)return!1;const z=this.y<e.y?e.y:this.y;return(this.bottom>e.bottom?e.bottom:this.bottom)>z}const r=this.left,s=this.right,i=this.top,o=this.bottom;if(s<=r||o<=i)return!1;const a=si[0].set(e.left,e.top),c=si[1].set(e.left,e.bottom),l=si[2].set(e.right,e.top),u=si[3].set(e.right,e.bottom);if(l.x<=a.x||c.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(c,c),n.apply(l,l),n.apply(u,u),Math.max(a.x,c.x,l.x,u.x)<=r||Math.min(a.x,c.x,l.x,u.x)>=s||Math.max(a.y,c.y,l.y,u.y)<=i||Math.min(a.y,c.y,l.y,u.y)>=o))return!1;const f=h*(c.y-a.y),d=h*(a.x-c.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-l.y),w=h*(l.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 Ge),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 So={default:-1};function Ze(t="default"){return So[t]===void 0&&(So[t]=-1),++So[t]}const Cl=new Set,Je="8.0.0",km="8.3.4",pr={quiet:!1,noColor:!1},Te=((t,e,n=3)=>{if(pr.quiet||Cl.has(e))return;let r=new Error().stack;const s=`${e}
3
+ Deprecated since v${t}`,i=typeof console.groupCollapsed=="function"&&!pr.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))),Cl.add(e)});Object.defineProperties(Te,{quiet:{get:()=>pr.quiet,set:t=>{pr.quiet=t},enumerable:!0,configurable:!1},noColor:{get:()=>pr.noColor,set:t=>{pr.noColor=t},enumerable:!0,configurable:!1}});const ud=()=>{};function El(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 Il(t){return!(t&t-1)&&!!t}function hd(t){const e={};for(const n in t)t[n]!==void 0&&(e[n]=t[n]);return e}const Pl=Object.create(null);function Sm(t){const e=Pl[t];return e===void 0&&(Pl[t]=Ze("resource")),e}const dd=class fd extends Rn{constructor(e={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,e={...fd.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){Te(Je,"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=Sm(e),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};dd.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};let pd=dd;const md=class gd extends Rn{constructor(e={}){super(),this.options=e,this._gpuData=Object.create(null),this._gcLastUsed=-1,this.uid=Ze("textureSource"),this._resourceType="textureSource",this._resourceId=Ze("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={...gd.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 pd(hd(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=Ze("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=Ze("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=Il(this.pixelWidth)&&Il(this.pixelHeight)}static test(e){throw new Error("Unimplemented")}};md.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 Ft=md;class pc extends Ft{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}}pc.extension=we.TextureSource;const Ml=new ce;class Tm{constructor(e,n){this.mapCoord=new ce,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&&(Ml.set(r.width/s.width,0,0,r.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(Ml));const i=e.source,o=this.uClampFrame,a=this.clampMargin/i._resolution,c=this.clampOffset/i._resolution;return o[0]=(e.frame.x+a+c)/i.width,o[1]=(e.frame.y+a+c)/i.height,o[2]=(e.frame.x+e.frame.width-a+c)/i.width,o[3]=(e.frame.y+e.frame.height-a+c)/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 ve extends Rn{constructor({source:e,label:n,frame:r,orig:s,trim:i,defaultAnchor:o,defaultBorders:a,rotate:c,dynamic:l}={}){if(super(),this.uid=Ze("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new Ge,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=n,this.source=(e==null?void 0:e.source)??new Ft,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=c??0,this.defaultAnchor=o,this.defaultBorders=a,this.destroyed=!1,this.dynamic=l||!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 Tm(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,c=n.height/s;let l=this.rotate;if(l){const u=a/2,h=c/2,f=i+u,d=o+h;l=be.add(l,be.NW),e.x0=f+u*be.uX(l),e.y0=d+h*be.uY(l),l=be.add(l,2),e.x1=f+u*be.uX(l),e.y1=d+h*be.uY(l),l=be.add(l,2),e.x2=f+u*be.uX(l),e.y2=d+h*be.uY(l),l=be.add(l,2),e.x3=f+u*be.uX(l),e.y3=d+h*be.uY(l)}else e.x0=i,e.y0=o,e.x1=i+a,e.y1=o,e.x2=i+a,e.y2=o+c,e.x3=i,e.y3=o+c}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 Te(Je,"Texture.baseTexture is now Texture.source"),this._source}}ve.EMPTY=new ve({label:"EMPTY",source:new Ft({label:"EMPTY"})});ve.EMPTY.destroy=ud;ve.WHITE=new ve({source:new pc({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});ve.WHITE.destroy=ud;function Am(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 Rl=new ce;class Dt{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=Rl,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 Ge);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=Rl,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,c=i.c,l=i.d,u=i.tx,h=i.ty;let f=this.minX,d=this.minY,m=this.maxX,_=this.maxY,g=o*e+c*n+u,y=a*e+l*n+h;g<f&&(f=g),y<d&&(d=y),g>m&&(m=g),y>_&&(_=y),g=o*r+c*n+u,y=a*r+l*n+h,g<f&&(f=g),y<d&&(d=y),g>m&&(m=g),y>_&&(_=y),g=o*e+c*s+u,y=a*e+l*s+h,g<f&&(f=g),y<d&&(d=y),g>m&&(m=g),y>_&&(_=y),g=o*r+c*s+u,y=a*r+l*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,d:l,tx:u,ty:h}=e;let f=o*n+c*r+u,d=a*n+l*r+h;this.minX=f,this.minY=d,this.maxX=f,this.maxY=d,f=o*s+c*r+u,d=a*s+l*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+c*i+u,d=a*n+l*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+c*i+u,d=a*s+l*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 Dt(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,c=this.maxY;s||(s=this.matrix);const l=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=l*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,c=w>c?w:c}this.minX=i,this.minY=o,this.maxX=a,this.maxY=c}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 Cm={grad:.9,turn:360,rad:360/(2*Math.PI)},Qt=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},je=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n+0},kt=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t>e?t:e},_d=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},Ol=function(t){return{r:kt(t.r,0,255),g:kt(t.g,0,255),b:kt(t.b,0,255),a:kt(t.a)}},To=function(t){return{r:je(t.r),g:je(t.g),b:je(t.b),a:je(t.a,3)}},Em=/^#([0-9a-f]{3,8})$/i,ii=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},yd=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}},xd=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),c=r*(1-(1-e+i)*n),l=i%6;return{r:255*[r,a,o,o,c,r][l],g:255*[c,r,r,a,o,o][l],b:255*[o,o,c,r,r,a][l],a:s}},$l=function(t){return{h:_d(t.h),s:kt(t.s,0,100),l:kt(t.l,0,100),a:kt(t.a)}},zl=function(t){return{h:je(t.h),s:je(t.s),l:je(t.l),a:je(t.a,3)}},Nl=function(t){return xd((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},gs=function(t){return{h:(e=yd(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},Im=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Pm=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Mm=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Rm=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,_a={string:[[function(t){var e=Em.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?je(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?je(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=Mm.exec(t)||Rm.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:Ol({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=Im.exec(t)||Pm.exec(t);if(!e)return null;var n,r,s=$l({h:(n=e[1],r=e[2],r===void 0&&(r="deg"),Number(n)*(Cm[r]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return Nl(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 Qt(e)&&Qt(n)&&Qt(r)?Ol({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(!Qt(e)||!Qt(n)||!Qt(r))return null;var o=$l({h:Number(e),s:Number(n),l:Number(r),a:Number(i)});return Nl(o)},"hsl"],[function(t){var e=t.h,n=t.s,r=t.v,s=t.a,i=s===void 0?1:s;if(!Qt(e)||!Qt(n)||!Qt(r))return null;var o=(function(a){return{h:_d(a.h),s:kt(a.s,0,100),v:kt(a.v,0,100),a:kt(a.a)}})({h:Number(e),s:Number(n),v:Number(r),a:Number(i)});return xd(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]},Om=function(t){return typeof t=="string"?Dl(t.trim(),_a.string):typeof t=="object"&&t!==null?Dl(t,_a.object):[null,void 0]},Ao=function(t,e){var n=gs(t);return{h:n.h,s:kt(n.s+100*e,0,100),l:n.l,a:n.a}},Co=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},Ll=function(t,e){var n=gs(t);return{h:n.h,s:n.s,l:kt(n.l+100*e,0,100),a:n.a}},ya=(function(){function t(e){this.parsed=Om(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 je(Co(this.rgba),2)},t.prototype.isDark=function(){return Co(this.rgba)<.5},t.prototype.isLight=function(){return Co(this.rgba)>=.5},t.prototype.toHex=function(){return e=To(this.rgba),n=e.r,r=e.g,s=e.b,o=(i=e.a)<1?ii(je(255*i)):"","#"+ii(n)+ii(r)+ii(s)+o;var e,n,r,s,i,o},t.prototype.toRgb=function(){return To(this.rgba)},t.prototype.toRgbString=function(){return e=To(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 zl(gs(this.rgba))},t.prototype.toHslString=function(){return e=zl(gs(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=yd(this.rgba),{h:je(e.h),s:je(e.s),v:je(e.v),a:je(e.a,3)};var e},t.prototype.invert=function(){return Gt({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),Gt(Ao(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),Gt(Ao(this.rgba,-e))},t.prototype.grayscale=function(){return Gt(Ao(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),Gt(Ll(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),Gt(Ll(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"?Gt({r:(n=this.rgba).r,g:n.g,b:n.b,a:e}):je(this.rgba.a,3);var n},t.prototype.hue=function(e){var n=gs(this.rgba);return typeof e=="number"?Gt({h:e,s:n.s,l:n.l,a:n.a}):je(n.h)},t.prototype.isEqual=function(e){return this.toHex()===Gt(e).toHex()},t})(),Gt=function(t){return t instanceof ya?t:new ya(t)},Zl=[],$m=function(t){t.forEach(function(e){Zl.indexOf(e)<0&&(e(ya,_a),Zl.push(e))})};function zm(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,c,l=r[this.toHex()];if(l)return l;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,c=i[m],Math.pow(a.r-c.r,2)+Math.pow(a.g-c.g,2)+Math.pow(a.b-c.b,2));_<h&&(h=_,f=m)}return f}},e.string.push([function(o){var a=o.toLowerCase(),c=a==="transparent"?"#0000":n[a];return c?new t(c).toRgb():null},"name"])}$m([zm]);const Sr=class os{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 os)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]=os._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=os.HEX_PATTERN.exec(e);a&&(e=`#${a[2]}`)}const o=Gt(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 os||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}};Sr.shared=new Sr;Sr._temp=new Sr;Sr.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let an=Sr;const Nm={cullArea:null,cullable:!1,cullableChildren:!0};let Eo=0;const Fl=500;function xt(...t){Eo!==Fl&&(Eo++,Eo===Fl?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...t))}const mc={_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 Dm{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 Lm{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 Dm(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 ft=new Lm;mc.register(ft);const Zm={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){Te("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(t)}};function Fm(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 Bm={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 c=this.children[a];c&&(s.push(c),c.parent=null)}Fm(this.children,t,n);const o=this.renderGroup||this.parentRenderGroup;o&&o.removeChildren(s);for(let a=0;a<s.length;++a){const c=s[a];(i=c.parentRenderLayer)==null||i.detach(c),this.emit("childRemoved",c,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||Te(Je,"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)}},Um={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 jm{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 ft.get(r.maskClass,e)}return e}returnMaskEffect(e){ft.return(e)}}const xa=new jm;bt.handleByList(we.MaskEffect,xa._effectClasses);const Gm={_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),xa.returnMaskEffect(e),this._maskEffect=null),t!=null&&(this._maskEffect=xa.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}},Vm={label:null,get name(){return Te(Je,"Container.name property has been removed, use Container.label instead"),this.label},set name(t){Te(Je,"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}},rt=ft.getPool(ce),sn=ft.getPool(Dt),Hm=new ce,Wm={getFastGlobalBounds(t,e){e||(e=new Dt),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=sn.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(Hm).invert()),e.addBounds(r),sn.return(r)}else this.renderGroup&&(e.addBounds(r,this.relativeGroupTransform),sn.return(r))}};function bd(t,e,n){n.clear();let r,s;return t.parent?e?r=t.parent.worldTransform:(s=rt.get().identity(),r=gc(t,s)):r=ce.IDENTITY,vd(t,n,r,e),s&&rt.return(s),n.isValid||n.set(0,0,0,0),n}function vd(t,e,n,r){var a,c;if(!t.visible||!t.measurable)return;let s;r?s=t.worldTransform:(t.updateLocalTransform(),s=rt.get(),s.appendFrom(t.localTransform,n));const i=e,o=!!t.effects.length;if(o&&(e=sn.get().clear()),t.boundsArea)e.addRect(t.boundsArea,s);else{const l=t.bounds;l&&!l.isEmpty()&&(e.matrix=s,e.addBounds(l));for(let u=0;u<t.children.length;u++)vd(t.children[u],e,s,r)}if(o){for(let l=0;l<t.effects.length;l++)(c=(a=t.effects[l]).addBounds)==null||c.call(a,e);i.addBounds(e,ce.IDENTITY),sn.return(e)}r||rt.return(s)}function gc(t,e){const n=t.parent;return n&&(gc(n,e),n.updateLocalTransform(),e.append(n.localTransform)),e}function wd(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,c=n*i/255|0,l=r*o/255|0,u=s*a/255|0;return(c<<16)+(l<<8)+u}const Ul=16777215;function jl(t,e){return t===Ul?e:e===Ul?t:wd(t,e)}function ki(t){return((t&255)<<16)+(t&65280)+(t>>16&255)}const Ym={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 ce,e){if(e)return t.copyFrom(this.worldTransform);this.updateLocalTransform();const n=gc(this,rt.get().identity());return t.appendFrom(this.localTransform,n),rt.return(n),t},getGlobalTint(t){if(t)return this.renderGroup?ki(this.renderGroup.worldColor):this.parentRenderGroup?ki(jl(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let e=this.localColor,n=this.parent;for(;n;)e=jl(e,n.localColor),n=n.parent;return ki(e)}};function kd(t,e,n){return e.clear(),n||(n=ce.IDENTITY),Sd(t,e,n,t,!0),e.isValid||e.set(0,0,0,0),e}function Sd(t,e,n,r,s){var c,l;let i;if(s)i=rt.get(),i=n.copyTo(i);else{if(!t.visible||!t.measurable)return;t.updateLocalTransform();const u=t.localTransform;i=rt.get(),i.appendFrom(u,n)}const o=e,a=!!t.effects.length;if(a&&(e=sn.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++)Sd(u[h],e,i,r,!1)}if(a){for(let u=0;u<t.effects.length;u++)(l=(c=t.effects[u]).addLocalBounds)==null||l.call(c,e,r);o.addBounds(e,ce.IDENTITY),sn.return(e)}rt.return(i)}function Td(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&&Td(s,e)}return e.didChange}const qm=new ce,Xm={_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 Dt});const t=this._localBoundsCacheData;return t.index=1,t.didChange=!1,t.data[0]!==this._didViewChangeTick&&(t.didChange=!0,t.data[0]=this._didViewChangeTick),Td(this,t),t.didChange&&kd(this,t.localBounds,qm),t.localBounds},getBounds(t,e){return bd(this,t,e||new Dt)}},Jm={_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}},Km={_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(Qm))}};function Qm(t,e){return t._zIndex-e._zIndex}const eg={getGlobalPosition(t=new Ke,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(rt.get(),n);return e=r.apply(t,e),rt.return(r),e},toLocal(t,e,n,r){e&&(t=e.toGlobal(t,n,r));const s=this.getGlobalTransform(rt.get(),r);return n=s.applyInverse(t,n),rt.return(s),n}};class _c{constructor(){this.uid=Ze("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 tg=0;class ng{constructor(e){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1,this.textureStyle=new pd(this.textureOptions)}createTexture(e,n,r,s){const i=new Ft({...this.textureOptions,width:e,height:n,resolution:1,antialias:r,autoGarbageCollect:!1,autoGenerateMipmaps:s});return new ve({source:i,label:`texturePool_${tg++}`})}getOptimalTexture(e,n,r=1,s,i=!1){let o=Math.ceil(e*r-1e-6),a=Math.ceil(n*r-1e-6);o=El(o),a=El(a);const c=s?1:0,l=i?1:0,u=(o<<17)+(a<<2)+(l<<1)+c;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 Ad=new ng;mc.register(Ad);class rg{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new ce,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 _c,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&&(Ad.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 ce),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new ce),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 ce),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 sg(t,e,n={}){for(const r in e)!n[r]&&e[r]!==void 0&&(t[r]=e[r])}const Io=new Xe(null),oi=new Xe(null),Po=new Xe(null,1,1),ai=new Xe(null),Gl=1,ig=2,Mo=4;class qt extends Rn{constructor(e={}){var n,r;super(),this.uid=Ze("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 ce,this.relativeGroupTransform=new ce,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new Xe(this,0,0),this._scale=Po,this._pivot=oi,this._origin=ai,this._skew=Io,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=[],sg(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){Te("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),bt.mixin(qt,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||Te(Je,"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=ft.get(rg,this),this.groupTransform=ce.IDENTITY,e==null||e.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;const e=this.parentRenderGroup;e==null||e.removeChild(this),ft.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 ce),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*ym}set angle(e){this.rotation=e*xm}get pivot(){return this._pivot===oi&&(this._pivot=new Xe(this,0,0)),this._pivot}set pivot(e){this._pivot===oi&&(this._pivot=new Xe(this,0,0),this._origin!==ai&&xt("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===Io&&(this._skew=new Xe(this,0,0)),this._skew}set skew(e){this._skew===Io&&(this._skew=new Xe(this,0,0)),this._skew.copyFrom(e)}get scale(){return this._scale===Po&&(this._scale=new Xe(this,1,1)),this._scale}set scale(e){this._scale===Po&&(this._scale=new Xe(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===ai&&(this._origin=new Xe(this,0,0)),this._origin}set origin(e){this._origin===ai&&(this._origin=new Xe(this,0,0),this._pivot!==oi&&xt("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,c=r._y,l=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*c,n.d=this._sy*c,n.tx=o._x-(l*n.a+u*n.c)+(h*n.a+f*n.c)-h,n.ty=o._y-(l*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=an.shared.setValue(e??16777215).toBgrNumber();r!==this.localColor&&(this.localColor=r,this._updateFlags|=Gl,this._onUpdate())}get tint(){return ki(this.localColor)}set blendMode(e){this.localBlendMode!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=ig,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|=Mo,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|=Mo,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|=Mo,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}}bt.mixin(qt,Bm,Wm,eg,Jm,Xm,Gm,Vm,Km,Nm,Zm,Ym,Um);class Cd extends qt{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 Dt(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,c=a.length;for(let l=0;l<c;l++)a[l].collectRenderables(e,n,r);s.blendMode.popBlendMode(e)}}class bs extends Cd{constructor(e=ve.EMPTY){e instanceof ve&&(e={texture:e});const{texture:n=ve.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 Xe({_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 ve?new bs(e):new bs(ve.from(e,n))}set texture(e){e||(e=ve.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 Am(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return Te("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 og=new Dt;function Ed(t,e,n){const r=og;t.measurable=!0,bd(t,n,r),e.addBoundsMask(r),t.measurable=!1}function Id(t,e,n){const r=sn.get();t.measurable=!0;const s=rt.get().identity(),i=Pd(t,n,s);kd(t,r,i),t.measurable=!1,e.addBoundsMask(r),rt.return(s),sn.return(r)}function Pd(t,e,n){return t?(t!==e&&(Pd(t.parent,e,n),t.updateLocalTransform(),n.append(t.localTransform)),n):(xt("Mask bounds, renderable is not inside the root container"),n)}class Md{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 bs),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||Ed(this.mask,e,n)}addLocalBounds(e,n){Id(this.mask,e,n)}containsPoint(e,n){const r=this.mask;return n(r,e)}destroy(){this.reset()}static test(e){return e instanceof bs}}Md.extension=we.MaskEffect;class Rd{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"}}Rd.extension=we.MaskEffect;class Od{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){Ed(this.mask,e,n)}addLocalBounds(e,n){Id(this.mask,e,n)}containsPoint(e,n){const r=this.mask;return n(r,e)}destroy(){this.reset()}static test(e){return e instanceof qt}}Od.extension=we.MaskEffect;const ag={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 Vl=ag;const Ws={get(){return Vl},set(t){Vl=t}};class $d extends Ft{constructor(e){e.resource||(e.resource=Ws.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"))}}$d.extension=we.TextureSource;class Ii extends Ft{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}}Ii.extension=we.TextureSource;var ba=(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))(ba||{});class Ro{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 zd=class gt{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 Ro(null,null,1/0),this.deltaMS=1/gt.targetFPMS,this.elapsedMS=1/gt.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=ba.NORMAL){return this._addListener(new Ro(e,n,r))}addOnce(e,n,r=ba.NORMAL){return this._addListener(new Ro(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*gt.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,gt.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(!gt._shared){const e=gt._shared=new gt;e.autoStart=!0,e._protected=!0}return gt._shared}static get system(){if(!gt._system){const e=gt._system=new gt;e.autoStart=!0,e._protected=!0}return gt._system}};zd.targetFPMS=.06;let ci=zd,Oo;async function cg(){return Oo??(Oo=(async()=>{var o;const e=Ws.get().createCanvas(1,1).getContext("webgl");if(!e)return"premultiply-alpha-on-upload";const n=await new Promise(a=>{const c=document.createElement("video");c.onloadeddata=()=>a(c),c.onerror=()=>a(null),c.autoplay=!1,c.crossOrigin="anonymous",c.preload="auto",c.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",c.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"})()),Oo}const Ji=class Nd extends Ft{constructor(e){super(e),this.isReady=!1,this.uploadMethodId="video",e={...Nd.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=ci.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 cg(),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&&(ci.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||(ci.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(ci.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement}};Ji.extension=we.TextureSource;Ji.defaultOptions={...Ft.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};Ji.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let lg=Ji;const lr=(t,e,n=!1)=>(Array.isArray(t)||(t=[t]),e?t.map(r=>typeof r=="string"||n?e(r):r):t);class ug{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||xt(`[Assets] Asset id ${e} was not found in the Cache`),n}set(e,n){const r=lr(e);let s;for(let c=0;c<this.parsers.length;c++){const l=this.parsers[c];if(l.test(n)){s=l.getCacheableAssets(r,n);break}}const i=new Map(Object.entries(s||{}));s||r.forEach(c=>{i.set(c,n)});const o=[...i.keys()],a={cacheKeys:o,keys:r};r.forEach(c=>{this._cacheMap.set(c,a)}),o.forEach(c=>{const l=s?s[c]:n;this._cache.has(c)&&this._cache.get(c)!==l&&xt("[Cache] already has key:",c),this._cache.set(c,i.get(c))})}remove(e){if(!this._cacheMap.has(e)){xt(`[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 ur=new ug,va=[];bt.handleByList(we.TextureSource,va);function Dd(t={}){const e=t&&t.resource,n=e?t.resource:t,r=e?t:{resource:t};for(let s=0;s<va.length;s++){const i=va[s];if(i.test(n))return new i(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function hg(t={},e=!1){const n=t&&t.resource,r=n?t.resource:t,s=n?t:{resource:t};if(!e&&ur.has(r))return ur.get(r);const i=new ve({source:Dd(s)});return i.on("destroy",()=>{ur.has(r)&&ur.remove(r)}),e||ur.set(r,i),i}function dg(t,e=!1){return typeof t=="string"?ur.get(t):t instanceof Ft?new ve({source:t}):hg(t,e)}ve.from=dg;Ft.from=Dd;bt.add(Md,Rd,Od,lg,Ii,$d,pc);var Ld=(t=>(t[t.Low=0]="Low",t[t.Normal=1]="Normal",t[t.High=2]="High",t))(Ld||{});function Rt(t){if(typeof t!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(t)}`)}function Hr(t){return t.split("?")[0].split("#")[0]}function fg(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function pg(t,e,n){return t.replace(new RegExp(fg(e),"g"),n)}function mg(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 c=n.lastIndexOf("/");if(c!==n.length-1){c===-1?(n="",r=0):(n=n.slice(0,c),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 vs={toPosix(t){return pg(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){Rt(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(Rt(t),this.isDataUrl(t)||this.isBlobUrl(t))return t;const r=Hr(this.toPosix(e??Ws.get().getBaseUrl())),s=Hr(this.toPosix(n??this.rootname(r)));return t=this.toPosix(t),t.startsWith("/")?vs.join(s,t.slice(1)):this.isAbsolute(t)?t:this.join(r,t)},normalize(t){if(Rt(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=mg(t),t.length>0&&r&&(t+="/"),n?`/${t}`:e+t},isAbsolute(t){return Rt(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(Rt(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(Rt(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){Rt(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){Rt(t),e&&Rt(e),t=Hr(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 c=t.charCodeAt(i);if(c===47){if(!s){n=i+1;break}}else a===-1&&(s=!1,a=i+1),o>=0&&(c===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){Rt(t),t=Hr(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){Rt(t);const e={root:"",dir:"",base:"",ext:"",name:""};if(t.length===0)return e;t=Hr(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,c=!0,l=t.length-1,u=0;for(;l>=s;--l){if(n=t.charCodeAt(l),n===47){if(!c){o=l+1;break}continue}a===-1&&(c=!1,a=l+1),n===46?i===-1?i=l: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 Zd(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?Zd(t.replace(r[n],a),e,n+1,r,s):s.push(t.replace(r[n],a))}}function gg(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)}),Zd(t,s,0,n,r)}else r.push(t);return r}const Hl=t=>!Array.isArray(t);class Fd{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 lr(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&&xt("[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 c;if(typeof a=="string"){const l=this._createBundleAssetId(e,a);r.push(l),c=[a,l]}else{const l=a.map(u=>this._createBundleAssetId(e,u));r.push(...l),c=[...a,...l]}this.add({...i,alias:c,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)&&xt(`[Resolver] already has key: ${i} overwriting`)},lr(n).forEach(i=>{const{src:o}=i;let{data:a,format:c,loadParser:l,parser:u}=i;const h=lr(o).map(_=>typeof _=="string"?gg(_):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,c=g.format??c,(g.loadParser||g.parser)&&(l=g.loadParser??l,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:c,loadParser:l,parser:u,progressSize:i.progressSize}),d.push(y)})}),f.forEach(_=>{this._assetMap[_]=d})})}resolveBundle(e){const n=Hl(e);e=lr(e);const r={};return e.forEach(s=>{const i=this._bundles[s];if(i){const o=this.resolve(i),a={};for(const c in o){const l=o[c];a[this._extractAssetIdFromBundle(s,c)]=l}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=Hl(e);e=lr(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(c=>{const l=i.filter(u=>u[a]?u[a]===c:!1);l.length&&(i=l)})}),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:c}=n;return(this._basePath||this._rootPath)&&(e.src=vs.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??_g(e.src),c!==void 0&&(e.progressSize=c),e}}Fd.RETINA_PREFIX=/@([0-9\.]+)x/;function _g(t){return t.split(".").pop().split("?").shift().split("#").shift()}const Wl=(t,e)=>{const n=e.split("?")[1];return n&&(t+=`?${n}`),t},Bd=class as{constructor(e,n){this.linkedSheets=[];let r=e;(e==null?void 0:e.source)instanceof Ft&&(r={texture:e,data:n});const{texture:s,data:i,cachePrefix:o=""}=r;this.cachePrefix=o,this._texture=s instanceof ve?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<=as.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:as.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 c=null,l=null;const u=o.trimmed!==!1&&o.sourceSize?o.sourceSize:o.frame,h=new Ge(0,0,Math.floor(u.w)/this.resolution,Math.floor(u.h)/this.resolution);o.rotated?c=new Ge(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.h)/this.resolution,Math.floor(a.w)/this.resolution):c=new Ge(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&&(l=new Ge(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 ve({source:this.textureSource,frame:c,orig:h,trim:l,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*as.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*as.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=[]}};Bd.BATCH_SIZE=1e3;let Yl=Bd;const yg=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];function Ud(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=vs.dirname(t[0]);e.linkedSheets.forEach((i,o)=>{const a=Ud([`${s}/${e.data.meta.related_multi_packs[o]}`],i,!0);Object.assign(r,a)})}return r}const xg={extension:we.Asset,cache:{test:t=>t instanceof Yl,getCacheableAssets:(t,e)=>Ud(t,e,!1)},resolver:{extension:{type:we.ResolveParser,name:"resolveSpritesheet"},test:t=>{const n=t.split("?")[0].split("."),r=n.pop(),s=n.pop();return r==="json"&&yg.includes(s)},parse:t=>{var n;const e=t.split(".");return{resolution:parseFloat(((n=Fd.RETINA_PREFIX.exec(t))==null?void 0:n[1])??"1"),format:e[e.length-2],src:t}}},loader:{name:"spritesheetLoader",id:"spritesheet",extension:{type:we.LoadParser,priority:Ld.Normal,name:"spritesheetLoader"},async testParse(t,e){return vs.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=vs.dirname(e.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let c;if(r instanceof ve)c=r;else{const d=Wl(a+(s??t.meta.image),e.src);c=(await n.load([{src:d,data:i}]))[d]}const l=new Yl({texture:c.source,data:t,cachePrefix:o});await l.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=Wl(g,e.src),d.push(n.load({src:g,data:{textureOptions:i,ignoreMultiPack:!0}})))}const m=await Promise.all(d);l.linkedSheets=m,m.forEach(_=>{_.linkedSheets=[l].concat(l.linkedSheets.filter(g=>g!==_))})}return l},async unload(t,e,n){await n.unload(t.textureSource._sourceOrigin),t.destroy(!1)}}};bt.add(xg);const $o=Object.create(null),ql=Object.create(null);function yc(t,e){let n=ql[t];return n===void 0&&($o[e]===void 0&&($o[e]=1),ql[t]=n=$o[e]++),n}let ar;function jd(){return(!ar||ar!=null&&ar.isContextLost())&&(ar=Ws.get().createCanvas().getContext("webgl",{})),ar}let li;function bg(){if(!li){li="mediump";const t=jd();t&&t.getShaderPrecisionFormat&&(li=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision?"highp":"mediump")}return li}function vg(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 wg(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 kg(t,e){return e?`#version 300 es
22
+ ${t}`:t}const Sg={},Tg={};function Ag(t,{name:e="pixi-program"},n=!0){e=e.replace(/\s+/g,"-"),e+=n?"-fragment":"-vertex";const r=n?Sg:Tg;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 Cg(t,e){return e?t.replace("#version 300 es",""):t}const zo={stripVersion:Cg,ensurePrecision:wg,addProgramDefines:vg,setProgramName:Ag,insertVersion:kg},Wr=Object.create(null),Gd=class wa{constructor(e){e={...wa.defaultOptions,...e};const n=e.fragment.indexOf("#version 300 es")!==-1,r={stripVersion:n,ensurePrecision:{requestedFragmentPrecision:e.preferredFragmentPrecision,requestedVertexPrecision:e.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:bg()},setProgramName:{name:e.name},addProgramDefines:n,insertVersion:n};let s=e.fragment,i=e.vertex;Object.keys(zo).forEach(o=>{const a=r[o];s=zo[o](s,a,!0),i=zo[o](i,a,!1)}),this.fragment=s,this.vertex=i,this.transformFeedbackVaryings=e.transformFeedbackVaryings,this._key=yc(`${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,Wr[this._cacheKey]=null}static from(e){const n=`${e.vertex}:${e.fragment}`;return Wr[n]||(Wr[n]=new wa(e),Wr[n]._cacheKey=n),Wr[n]}};Gd.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let Vd=Gd;const Xl={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 Eg(t){return Xl[t]??Xl.float32}const Ig={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"},Jl=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|\)|$)/g;function Kl(t,e){let n;for(;(n=Jl.exec(t))!==null;){const r=Ig[n[3]]??"float32";e[n[2]]={location:parseInt(n[1],10),format:r,stride:Eg(r).stride,offset:0,instance:!1,start:0}}Jl.lastIndex=0}function Pg(t){return t.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"")}function Mg({source:t,entryPoint:e}){const n={},r=Pg(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(Kl(o,n),Object.keys(n).length===0){const a=o.match(/\(\s*\w+\s*:\s*(\w+)/);if(a){const c=a[1],l=new RegExp(`struct\\s+${c}\\s*\\{([^}]+)\\}`,"s"),u=r.match(l);u&&Kl(u[1],n)}}return n}function No(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,c=/struct\s+(\w+)/,l=(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(!l)return{groups:[],structs:[]};const u=((f=t.match(o))==null?void 0:f.map(d=>{const m=d.match(c)[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})=>l.some(m=>m.type===d||m.type.includes(`<${d}>`))))??[];return{groups:l,structs:u}}var jn=(t=>(t[t.VERTEX=1]="VERTEX",t[t.FRAGMENT=2]="FRAGMENT",t[t.COMPUTE=4]="COMPUTE",t))(jn||{});function Rg({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:jn.VERTEX|jn.FRAGMENT,buffer:{type:"uniform"}}):r.type==="sampler"?e[r.group].push({binding:r.binding,visibility:jn.FRAGMENT,sampler:{type:"filtering"}}):r.type==="texture_2d"||r.type.startsWith("texture_2d<")?e[r.group].push({binding:r.binding,visibility:jn.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:jn.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:jn.FRAGMENT,texture:{sampleType:"float",viewDimension:"cube",multisampled:!1}})}for(let n=0;n<e.length;n++)e[n]||(e[n]=[]);return e}function Og({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 $g(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 Yr=Object.create(null);class Ki{constructor(e){var a,c;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 l=No(n.source);this.structsAndGroups=l}else{const l=No(r.source),u=No(n.source);this.structsAndGroups=$g(l,u)}this.layout=s??Og(this.structsAndGroups),this.gpuLayout=i??Rg(this.structsAndGroups),this.autoAssignGlobalUniforms=((a=this.layout[0])==null?void 0:a.globalUniforms)!==void 0,this.autoAssignLocalUniforms=((c=this.layout[1])==null?void 0:c.localUniforms)!==void 0,this._generateProgramKey()}_generateProgramKey(){const{vertex:e,fragment:n}=this,r=e.source+n.source+e.entryPoint+n.entryPoint;this._layoutKey=yc(r,"program")}get attributeData(){return this._attributeData??(this._attributeData=Mg(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null,Yr[this._cacheKey]=null}static from(e){const n=`${e.vertex.source}:${e.fragment.source}:${e.fragment.entryPoint}:${e.vertex.entryPoint}`;return Yr[n]||(Yr[n]=new Ki(e),Yr[n]._cacheKey=n),Yr[n]}}const Hd=["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>"],zg=Hd.reduce((t,e)=>(t[e]=!0,t),{});function Ng(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 Wd=class Yd{constructor(e,n){this._touched=0,this.uid=Ze("uniform"),this._resourceType="uniformGroup",this._resourceId=Ze("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,n={...Yd.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,!zg[i.type]){const o=i.type.match(/^array<(\w+(?:<\w+>)?),\s*(\d+)>$/);if(o){const[,a,c]=o;throw new Error(`Uniform type ${i.type} is not supported. Use type: '${a}', size: ${c} instead.`)}throw new Error(`Uniform type ${i.type} is not supported. Supported uniform types are: ${Hd.join(", ")}`)}i.value??(i.value=Ng(i.type,i.size)),r[s]=i.value}this.uniforms=r,this._dirtyId=1,this.ubo=n.ubo,this.isStatic=n.isStatic,this._signature=yc(Object.keys(r).map(s=>`${s}-${e[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};Wd.defaultOptions={ubo:!1,isStatic:!1};let qd=Wd;class Si{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 ka=(t=>(t[t.WEBGL=1]="WEBGL",t[t.WEBGPU=2]="WEBGPU",t[t.CANVAS=4]="CANVAS",t[t.BOTH=3]="BOTH",t))(ka||{});class xc extends Rn{constructor(e){super(),this.uid=Ze("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|=ka.WEBGPU),r&&(o|=ka.WEBGL)),this.compatibleRenderers=o;const c={};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 l in a)for(const u in a[l]){const h=a[l][u];c[h]={group:l,binding:u,name:h}}else if(n&&s&&!a){const l=n.structsAndGroups.groups;a={},l.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,c[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,c[h.name]=h});let l=0;for(const u in i)c[u]||(s[99]||(s[99]=new Si,this._ownedBindGroups.push(s[99])),c[u]={group:99,binding:l,name:u},a[99]=a[99]||{},a[99][l]=u,l++);for(const u in i){const h=u;let f=i[u];!f.source&&!f._resourceType&&(f=new qd(f));const d=c[h];d&&(s[d.group]||(s[d.group]=new Si,this._ownedBindGroups.push(s[d.group])),s[d.group].setResource(f,d.binding))}}this.groups=s,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(s,c)}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 Si,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=Ki.from(n)),r&&(o=Vd.from(r)),new xc({gpuProgram:i,glProgram:o,...s})}}const Dg={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},Do=0,Lo=1,Zo=2,Fo=3,Bo=4,Uo=5,Sa=class Xd{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Do)}set blend(e){!!(this.data&1<<Do)!==e&&(this.data^=1<<Do)}get offsets(){return!!(this.data&1<<Lo)}set offsets(e){!!(this.data&1<<Lo)!==e&&(this.data^=1<<Lo)}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<<Zo)}set culling(e){!!(this.data&1<<Zo)!==e&&(this.data^=1<<Zo)}get depthTest(){return!!(this.data&1<<Fo)}set depthTest(e){!!(this.data&1<<Fo)!==e&&(this.data^=1<<Fo)}get depthMask(){return!!(this.data&1<<Uo)}set depthMask(e){!!(this.data&1<<Uo)!==e&&(this.data^=1<<Uo)}get clockwiseFrontFace(){return!!(this.data&1<<Bo)}set clockwiseFrontFace(e){!!(this.data&1<<Bo)!==e&&(this.data^=1<<Bo)}get blendMode(){return this._blendMode}set blendMode(e){this.blend=e!=="none",this._blendMode=e,this._blendModeId=Dg[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 Xd;return e.depthTest=!1,e.blend=!0,e}};Sa.default2d=Sa.for2d();let Jd=Sa;function Ql(t,e,n=2){const r=e&&e.length,s=r?e[0]*n:t.length;let i=Kd(t,0,s,n,!0);const o=[];if(!i||i.next===i.prev)return o;let a,c,l;if(r&&(i=Ug(t,e,i,n)),t.length>80*n){a=t[0],c=t[1];let u=a,h=c;for(let f=n;f<s;f+=n){const d=t[f],m=t[f+1];d<a&&(a=d),m<c&&(c=m),d>u&&(u=d),m>h&&(h=m)}l=Math.max(u-a,h-c),l=l!==0?32767/l:0}return ws(i,o,n,a,c,l,0),o}function Kd(t,e,n,r,s){let i;if(s===Qg(t,e,n,r)>0)for(let o=e;o<n;o+=r)i=eu(o/r|0,t[o],t[o+1],i);else for(let o=n-r;o>=e;o-=r)i=eu(o/r|0,t[o],t[o+1],i);return i&&Tr(i,i.next)&&(Ss(i),i=i.next),i}function Yn(t,e){if(!t)return t;e||(e=t);let n=t,r;do if(r=!1,!n.steiner&&(Tr(n,n.next)||Oe(n.prev,n,n.next)===0)){if(Ss(n),n=e=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==e);return e}function ws(t,e,n,r,s,i,o){if(!t)return;!o&&i&&Wg(t,r,s,i);let a=t;for(;t.prev!==t.next;){const c=t.prev,l=t.next;if(i?Zg(t,r,s,i):Lg(t)){e.push(c.i,t.i,l.i),Ss(t),t=l.next,a=l.next;continue}if(t=l,t===a){o?o===1?(t=Fg(Yn(t),e),ws(t,e,n,r,s,i,2)):o===2&&Bg(t,e,n,r,s,i):ws(Yn(t),e,n,r,s,i,1);break}}}function Lg(t){const e=t.prev,n=t,r=t.next;if(Oe(e,n,r)>=0)return!1;const s=e.x,i=n.x,o=r.x,a=e.y,c=n.y,l=r.y,u=Math.min(s,i,o),h=Math.min(a,c,l),f=Math.max(s,i,o),d=Math.max(a,c,l);let m=r.next;for(;m!==e;){if(m.x>=u&&m.x<=f&&m.y>=h&&m.y<=d&&cs(s,a,i,c,o,l,m.x,m.y)&&Oe(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Zg(t,e,n,r){const s=t.prev,i=t,o=t.next;if(Oe(s,i,o)>=0)return!1;const a=s.x,c=i.x,l=o.x,u=s.y,h=i.y,f=o.y,d=Math.min(a,c,l),m=Math.min(u,h,f),_=Math.max(a,c,l),g=Math.max(u,h,f),y=Ta(d,m,e,n,r),b=Ta(_,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&&cs(a,u,c,h,l,f,w.x,w.y)&&Oe(w.prev,w,w.next)>=0||(w=w.prevZ,k.x>=d&&k.x<=_&&k.y>=m&&k.y<=g&&k!==s&&k!==o&&cs(a,u,c,h,l,f,k.x,k.y)&&Oe(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&&cs(a,u,c,h,l,f,w.x,w.y)&&Oe(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&&cs(a,u,c,h,l,f,k.x,k.y)&&Oe(k.prev,k,k.next)>=0)return!1;k=k.nextZ}return!0}function Fg(t,e){let n=t;do{const r=n.prev,s=n.next.next;!Tr(r,s)&&ef(r,n,n.next,s)&&ks(r,s)&&ks(s,r)&&(e.push(r.i,n.i,s.i),Ss(n),Ss(n.next),n=t=s),n=n.next}while(n!==t);return Yn(n)}function Bg(t,e,n,r,s,i){let o=t;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&Xg(o,a)){let c=tf(o,a);o=Yn(o,o.next),c=Yn(c,c.next),ws(o,e,n,r,s,i,0),ws(c,e,n,r,s,i,0);return}a=a.next}o=o.next}while(o!==t)}function Ug(t,e,n,r){const s=[];for(let i=0,o=e.length;i<o;i++){const a=e[i]*r,c=i<o-1?e[i+1]*r:t.length,l=Kd(t,a,c,r,!1);l===l.next&&(l.steiner=!0),s.push(qg(l))}s.sort(jg);for(let i=0;i<s.length;i++)n=Gg(s[i],n);return n}function jg(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 Gg(t,e){const n=Vg(t,e);if(!n)return e;const r=tf(n,t);return Yn(r,r.next),Yn(n,n.next)}function Vg(t,e){let n=e;const r=t.x,s=t.y;let i=-1/0,o;if(Tr(t,n))return n;do{if(Tr(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,c=o.x,l=o.y;let u=1/0;n=o;do{if(r>=n.x&&n.x>=c&&r!==n.x&&Qd(s<l?r:i,s,c,l,s<l?i:r,s,n.x,n.y)){const h=Math.abs(s-n.y)/(r-n.x);ks(n,t)&&(h<u||h===u&&(n.x>o.x||n.x===o.x&&Hg(o,n)))&&(o=n,u=h)}n=n.next}while(n!==a);return o}function Hg(t,e){return Oe(t.prev,t,e.prev)<0&&Oe(e.next,t,t.next)<0}function Wg(t,e,n,r){let s=t;do s.z===0&&(s.z=Ta(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,Yg(s)}function Yg(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 l=0;l<n&&(a++,o=o.nextZ,!!o);l++);let c=n;for(;a>0||c>0&&o;)a!==0&&(c===0||!o||r.z<=o.z)?(s=r,r=r.nextZ,a--):(s=o,o=o.nextZ,c--),i?i.nextZ=s:t=s,s.prevZ=i,i=s;r=o}i.nextZ=null,n*=2}while(e>1);return t}function Ta(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 qg(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 Qd(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 cs(t,e,n,r,s,i,o,a){return!(t===o&&e===a)&&Qd(t,e,n,r,s,i,o,a)}function Xg(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!Jg(t,e)&&(ks(t,e)&&ks(e,t)&&Kg(t,e)&&(Oe(t.prev,t,e.prev)||Oe(t,e.prev,e))||Tr(t,e)&&Oe(t.prev,t,t.next)>0&&Oe(e.prev,e,e.next)>0)}function Oe(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Tr(t,e){return t.x===e.x&&t.y===e.y}function ef(t,e,n,r){const s=hi(Oe(t,e,n)),i=hi(Oe(t,e,r)),o=hi(Oe(n,r,t)),a=hi(Oe(n,r,e));return!!(s!==i&&o!==a||s===0&&ui(t,n,e)||i===0&&ui(t,r,e)||o===0&&ui(n,t,r)||a===0&&ui(n,e,r))}function ui(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 hi(t){return t>0?1:t<0?-1:0}function Jg(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&&ef(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function ks(t,e){return Oe(t.prev,t,t.next)<0?Oe(t,e,t.next)>=0&&Oe(t,t.prev,e)>=0:Oe(t,e,t.prev)<0||Oe(t,t.next,e)<0}function Kg(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 tf(t,e){const n=Aa(t.i,t.x,t.y),r=Aa(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 eu(t,e,n,r){const s=Aa(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 Ss(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 Aa(t,e,n){return{i:t,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Qg(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 e_=Ql.default||Ql;var jo,tu;function t_(){if(tu)return jo;tu=1,jo=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,c,l){var u=c.toLowerCase();for(l=s(l),u=="m"&&l.length>2&&(o.push([c].concat(l.splice(0,2))),u="l",c=c=="m"?"l":"L");;){if(l.length==t[u])return l.unshift(c),o.push(l);if(l.length<t[u])throw new Error("malformed path data");o.push([c].concat(l.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 jo}var n_=t_();const r_=fc(n_);function s_(t,e){const n=r_(t),r=[];let s=null,i=0,o=0;for(let a=0;a<n.length;a++){const c=n[a],l=c[0],u=c;switch(l){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:xt(`Unknown SVG path command: ${l}`)}l!=="Z"&&l!=="z"&&s===null&&(s={startX:i,startY:o},r.push(s))}return e}class bc{constructor(e=0,n=0,r=0){this.type="circle",this.x=e,this.y=n,this.radius=r}clone(){return new bc(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,c=(1-s)*r,l=Math.sqrt(i*i+o*o);return l<=a+c&&l>a-(r-c)}getBounds(e){return e||(e=new Ge),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 vc{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 vc(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),c=r-a,l=i-c,u=o-c,h=i+a,f=o+a,d=e-this.x,m=n-this.y,_=d*d/(l*l)+m*m/(u*u),g=d*d/(h*h)+m*m/(f*f);return _>1&&g<=1}getBounds(e){return e||(e=new Ge),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 i_(t,e,n,r,s,i){const o=t-n,a=e-r,c=s-n,l=i-r,u=o*c+a*l,h=c*c+l*l;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*c,m=r+f*l);const _=t-d,g=e-m;return _*_+g*g}let o_,a_;class _s{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],c=n[(s+3)%r];e+=(a-i)*(c+o)}return e<0}containsPolygon(e){const n=this.getBounds(o_),r=e.getBounds(a_);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 _s(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],c=this.points[i*2+1],l=this.points[o*2],u=this.points[o*2+1];c>n!=u>n&&e<(l-a)*((n-c)/(u-c))+a&&(r=!r)}return r}strokeContains(e,n,r,s=.5){const i=r*r,o=i*(1-s),a=i-o,{points:c}=this,l=c.length-(this.closePath?0:2);for(let u=0;u<l;u+=2){const h=c[u],f=c[u+1],d=c[(u+2)%c.length],m=c[(u+3)%c.length],_=i_(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 Ge);const n=this.points;let r=1/0,s=-1/0,i=1/0,o=-1/0;for(let a=0,c=n.length;a<c;a+=2){const l=n[a],u=n[a+1];r=l<r?l:r,s=l>s?l: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 Te("8.11.0","Polygon.lastX is deprecated, please use Polygon.lastX instead."),this.points[this.points.length-2]}get y(){return Te("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 di=(t,e,n,r,s,i,o)=>{const a=t-n,c=e-r,l=Math.sqrt(a*a+c*c);return l>=s-i&&l<=s+o};class wc{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 Ge),e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e}clone(){return new wc(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:c,radius:l}=this,u=r*(1-s),h=r-u,f=i+l,d=o+l,m=a-l*2,_=c-l*2,g=i+a,y=o+c;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&&di(e,n,f,d,l,h,u)||e>g-l&&n<d&&di(e,n,g-l,d,l,h,u)||e>g-l&&n>y-l&&di(e,n,g-l,y-l,l,h,u)||e<f&&n>y-l&&di(e,n,f,y-l,l,h,u)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}const nf={};function c_(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 nf[r]||l_(t,e,r,n)}function l_(t,e,n,r){const s={};let i=0;for(let a=0;a<r;a++){const c=a<e?t[a]:ve.EMPTY.source;s[i++]=c.source,s[i++]=c.style}const o=new Si(s);return nf[n]=o,o}class nu{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 ru(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 u_={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};function su(t,e){return e.alphaMode==="no-premultiply-alpha"&&u_[t]||t}const h_=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
24
+ `);function d_(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 f_(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=h_.replace(/%forloop%/gi,d_(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 cr=null;function p_(){var e;if(cr)return cr;const t=jd();return cr=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),cr=f_(cr,t),(e=t.getExtension("WEBGL_lose_context"))==null||e.loseContext(),cr}class m_{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 g_{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new m_,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 ys=[];let Pi=0;mc.register({clear:()=>{if(ys.length>0)for(const t of ys)t&&t.destroy();ys.length=0,Pi=0}});function iu(){return Pi>0?ys[--Pi]:new g_}function ou(t){t.elements=null,ys[Pi++]=t}let qr=0;const rf=class sf{constructor(e){this.uid=Ze("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],e={...sf.defaultOptions,...e},e.maxTextures||(Te("v8.8.0","maxTextures is a required option for Batcher now, please pass it in the options"),e.maxTextures=p_());const{maxTextures:n,attributesInitialSize:r,indicesInitialSize:s}=e;this.attributeBuffer=new nu(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++)ou(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=iu(),s=r.textures;s.clear();const i=n[this.elementStart];let o=su(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 c=this.attributeBuffer.float32View,l=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=su(y.blendMode,w),E=o!==k||a!==y.topology;if(w._batchTick===qr&&!E){y._textureId=w._textureBindLocation,h+=y.indexSize,y.packAsQuad?(this.packQuadAttributes(y,c,l,y._attributeStart,y._textureId),this.packQuadIndex(u,y._indexStart,y._attributeStart/this.vertexSize)):(this.packAttributes(y,c,l,y._attributeStart,y._textureId),this.packIndex(y,u,y._indexStart,y._attributeStart/this.vertexSize)),y._batch=r,m.push(y);continue}w._batchTick=qr,(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=iu(),s=r.textures,s.clear(),m=[],++qr),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,c,l,y._attributeStart,y._textureId),this.packQuadIndex(u,y._indexStart,y._attributeStart/this.vertexSize)):(this.packAttributes(y,c,l,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,++qr),this.elementStart=this.elementSize,this._batchIndexStart=f,this._batchIndexSize=h}_finishBatch(e,n,r,s,i,o,a,c,l){e.gpuBindGroup=null,e.bindGroup=null,e.action=c,e.batcher=this,e.textures=s,e.blendMode=i,e.topology=o,e.start=n,e.size=r,e.elements=l,++qr,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 nu(n);ru(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 ru(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,c=e.attributeOffset;for(let l=0;l<o;l++)n[r++]=s+i[l+a]-c}destroy(e={}){var n;if(this.batches!==null){for(let r=0;r<this.batchIndex;r++)ou(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}}};rf.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};let __=rf;var ut=(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))(ut||{});class Ts extends Rn{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=Ze("buffer"),this._resourceType="buffer",this._resourceId=Ze("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&ut.STATIC)}set static(e){e?this.descriptor.usage|=ut.STATIC:this.descriptor.usage&=~ut.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=Ze("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 of(t,e){if(!(t instanceof Ts)){let n=e?ut.INDEX:ut.VERTEX;t instanceof Array&&(e?(t=new Uint32Array(t),n=ut.INDEX|ut.COPY_DST):(t=new Float32Array(t),n=ut.VERTEX|ut.COPY_DST)),t=new Ts({data:t,label:e?"index-mesh-buffer":"vertex-mesh-buffer",usage:n})}return t}function y_(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,c=-1/0;const l=s.BYTES_PER_ELEMENT,u=(r.offset||0)/l,h=(r.stride||8)/l;for(let f=u;f<s.length;f+=h){const d=s[f],m=s[f+1];d>a&&(a=d),m>c&&(c=m),d<i&&(i=d),m<o&&(o=m)}return n.minX=i,n.minY=o,n.maxX=a,n.maxY=c,n}function x_(t){return(t instanceof Ts||Array.isArray(t)||t.BYTES_PER_ELEMENT)&&(t={buffer:t}),t.buffer=of(t.buffer,!1),t}class b_ extends Rn{constructor(e={}){super(),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=Ze("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new Dt,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=x_(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=of(e,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,y_(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 v_=new Float32Array(1),w_=new Uint32Array(1);class k_ extends b_{constructor(){const n=new Ts({data:v_,label:"attribute-batch-buffer",usage:ut.VERTEX|ut.COPY_DST,shrinkToFit:!1}),r=new Ts({data:w_,label:"index-batch-buffer",usage:ut.INDEX|ut.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 au(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 xt(`${r} placement hook does not exist in shader`)}}const S_=/\{\{(.*?)\}\}/g;function cu(t){var r;const e={};return(((r=t.match(S_))==null?void 0:r.map(s=>s.replace(/[{()}]/g,"")))??[]).forEach(s=>{e[s]=[]}),e}function lu(t,e){let n;const r=/@in\s+([^;]+);/g;for(;(n=r.exec(t))!==null;)e.push(n[1])}function uu(t,e,n=!1){const r=[];lu(e,r),t.forEach(a=>{a.header&&lu(a.header,r)});const s=r;n&&s.sort();const i=s.map((a,c)=>` @location(${c}) ${a},`).join(`
26
+ `);let o=e.replace(/@in\s+[^;]+;\s*/g,"");return o=o.replace("{{in}}",`
27
+ ${i}
28
+ `),o}function hu(t,e){let n;const r=/@out\s+([^;]+);/g;for(;(n=r.exec(t))!==null;)e.push(n[1])}function T_(t){const n=/\b(\w+)\s*:/g.exec(t);return n?n[1]:""}function A_(t){const e=/@.*?\s+/g;return t.replace(e,"")}function C_(t,e){const n=[];hu(e,n),t.forEach(c=>{c.header&&hu(c.header,n)});let r=0;const s=n.sort().map(c=>c.indexOf("builtin")>-1?c:`@location(${r++}) ${c}`).join(`,
29
+ `),i=n.sort().map(c=>` var ${A_(c)};`).join(`
30
+ `),o=`return VSOutput(
31
+ ${n.sort().map(c=>` ${T_(c)}`).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 du(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 kn=Object.create(null),Go=new Map;let E_=0;function I_({template:t,bits:e}){const n=af(t,e);if(kn[n])return kn[n];const{vertex:r,fragment:s}=M_(t,e);return kn[n]=cf(r,s,e),kn[n]}function P_({template:t,bits:e}){const n=af(t,e);return kn[n]||(kn[n]=cf(t.vertex,t.fragment,e)),kn[n]}function M_(t,e){const n=e.map(o=>o.vertex).filter(o=>!!o),r=e.map(o=>o.fragment).filter(o=>!!o);let s=uu(n,t.vertex,!0);s=C_(n,s);const i=uu(r,t.fragment,!0);return{vertex:s,fragment:i}}function af(t,e){return e.map(n=>(Go.has(n)||Go.set(n,E_++),Go.get(n))).sort((n,r)=>n-r).join("-")+t.vertex+t.fragment}function cf(t,e,n){const r=cu(t),s=cu(e);return n.forEach(i=>{au(i.vertex,r,i.name),au(i.fragment,s,i.name)}),{vertex:du(t,r),fragment:du(e,s)}}const R_=`
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
+ `,O_=`
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
+ `,$_=`
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
+ `,z_=`
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
+ `,N_={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
+ `}},D_={name:"global-uniforms-bit",vertex:{header:`
176
+ uniform mat3 uProjectionMatrix;
177
+ uniform mat3 uWorldTransformMatrix;
178
+ uniform vec4 uWorldColorAlpha;
179
+ uniform vec2 uResolution;
180
+ `}};function L_({bits:t,name:e}){const n=I_({template:{fragment:O_,vertex:R_},bits:[N_,...t]});return Ki.from({name:e,vertex:{source:n.vertex,entryPoint:"main"},fragment:{source:n.fragment,entryPoint:"main"}})}function Z_({bits:t,name:e}){return new Vd({name:e,...P_({template:{vertex:$_,fragment:z_},bits:[D_,...t]})})}const F_={name:"color-bit",vertex:{header:`
181
+ @in aColor: vec4<f32>;
182
+ `,main:`
183
+ vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a);
184
+ `}},B_={name:"color-bit",vertex:{header:`
185
+ in vec4 aColor;
186
+ `,main:`
187
+ vColor *= vec4(aColor.rgb * aColor.a, aColor.a);
188
+ `}},Vo={};function U_(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 j_(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 Vo[t]||(Vo[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
+ ${U_(t)}
204
+ `,main:`
205
+ var uvDx = dpdx(vUV);
206
+ var uvDy = dpdy(vUV);
207
+
208
+ ${j_(t)}
209
+ `}}),Vo[t]}const Ho={};function V_(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 H_(t){return Ho[t]||(Ho[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
+ ${V_(t)}
229
+ `}}),Ho[t]}const W_={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
+ `}},Y_={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
+ `}},fu={};function q_(t){let e=fu[t];if(e)return e;const n=new Int32Array(t);for(let r=0;r<t;r++)n[r]=r;return e=fu[t]=new qd({uTextures:{value:n,type:"i32",size:t}},{isStatic:!0}),e}class pu extends xc{constructor(e){const n=Z_({name:"batch",bits:[B_,H_(e),Y_]}),r=L_({name:"batch",bits:[F_,G_(e),W_]});super({glProgram:n,gpuProgram:r,resources:{batchSamplers:q_(e)}}),this.maxTextures=e}}let Xr=null;const lf=class uf extends __{constructor(e){super(e),this.geometry=new k_,this.name=uf.extension.name,this.vertexSize=6,Xr??(Xr=new pu(e.maxTextures)),this.shader=Xr}packAttributes(e,n,r,s,i){const o=i<<16|e.roundPixels&65535,a=e.transform,c=a.a,l=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++]=c*E+u*A+f,n[s++]=h*A+l*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,c=a.a,l=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]=c*g+u*b+f,n[s+1]=h*b+l*g+d,n[s+2]=w.x0,n[s+3]=w.y0,r[s+4]=k,r[s+5]=E,n[s+6]=c*_+u*b+f,n[s+7]=h*b+l*_+d,n[s+8]=w.x1,n[s+9]=w.y1,r[s+10]=k,r[s+11]=E,n[s+12]=c*_+u*y+f,n[s+13]=h*y+l*_+d,n[s+14]=w.x2,n[s+15]=w.y2,r[s+16]=k,r[s+17]=E,n[s+18]=c*g+u*y+f,n[s+19]=h*y+l*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&&(Xr=new pu(e),this.shader=Xr)}destroy(){this.shader=null,super.destroy()}};lf.extension={type:[we.Batcher],name:"default"};let X_=lf;class Qi{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 J_(t,e,n,r,s,i,o,a=null){let c=0;n*=e,s*=i;const l=a.a,u=a.b,h=a.c,f=a.d,d=a.tx,m=a.ty;for(;c<o;){const _=t[n],g=t[n+1];r[s]=l*_+h*g+d,r[s+1]=u*_+f*g+m,s+=i,n+=e,c++}}function K_(t,e,n,r){let s=0;for(e*=n;s<r;)t[e]=0,t[e+1]=0,e+=n,s++}function hf(t,e,n,r,s){const i=e.a,o=e.b,a=e.c,c=e.d,l=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+l,t[h+1]=o*d+c*m+u,h+=r}}const Q_=new ce;class kc{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?wd(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)||Q_}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 As={extension:{type:we.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 c=Math.ceil(2.3*Math.sqrt(o+a)),l=c*8+(s?4:0)+(i?4:0);if(l===0)return!1;if(c===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=c*4+(s?2:0)+2,f=h,d=l,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<c;k++){const E=Math.PI/2*(k/c),A=s+Math.cos(E)*o,C=i+Math.sin(E)*a,Y=n+A,J=n-A,z=r+C,$=r-C;e[u++]=Y,e[u++]=z,e[--h]=z,e[--h]=J,e[f++]=J,e[f++]=$,e[--d]=$,e[--d]=Y}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 c=r;e[c*n]=o,e[c*n+1]=a;const l=c++;for(let u=0;u<t.length;u+=2)e[c*n]=t[u],e[c*n+1]=t[u+1],u>0&&(s[i++]=c,s[i++]=l,s[i++]=c-1),c++;s[i++]=l+1,s[i++]=l,s[i++]=c-1}},ey={...As,extension:{...As.extension,name:"ellipse"}},ty={...As,extension:{...As.extension,name:"roundedRectangle"}},df=1e-4,mu=1e-4;function ny(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 gu(t,e,n,r,s,i,o,a){const c=t-n*s,l=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=c+f,_=l+d,g=u+f,y=h+d;return a.push(m,_),a.push(g,y),2}function Ln(t,e,n,r,s,i,o,a){const c=n-t,l=r-e;let u=Math.atan2(c,l),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(c*c+l*l),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 ry(t,e,n,r,s,i){const o=df;if(t.length===0)return;const a=e;let c=a.alignment;if(e.alignment!==.5){let ue=ny(t);c=(c-.5)*ue+.5}const l=new Ke(t[0],t[1]),u=new Ke(t[t.length-2],t[t.length-1]),h=r,f=Math.abs(l.x-u.x)<o&&Math.abs(l.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 ue=(l.x+u.x)*.5,Et=(u.y+l.y)*.5;t.unshift(ue,Et),t.push(ue,Et)}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],Y=0,J=0,z=-(E-C),$=k-A,pe=0,ye=0,xe=Math.sqrt(z*z+$*$);z/=xe,$/=xe,z*=y,$*=y;const hn=c,Z=(1-hn)*2,H=hn*2;h||(a.cap==="round"?_+=Ln(k-z*(Z-H)*.5,E-$*(Z-H)*.5,k-z*Z,E-$*Z,k+z*H,E+$*H,d,!0)+2:a.cap==="square"&&(_+=gu(k,E,z,$,Z,H,!0,d))),d.push(k-z*Z,E-$*Z),d.push(k+z*H,E+$*H);for(let ue=1;ue<m-1;++ue){k=t[(ue-1)*2],E=t[(ue-1)*2+1],A=t[ue*2],C=t[ue*2+1],Y=t[(ue+1)*2],J=t[(ue+1)*2+1],z=-(E-C),$=k-A,xe=Math.sqrt(z*z+$*$),z/=xe,$/=xe,z*=y,$*=y,pe=-(C-J),ye=A-Y,xe=Math.sqrt(pe*pe+ye*ye),pe/=xe,ye/=xe,pe*=y,ye*=y;const Et=A-k,Ie=E-C,fn=A-Y,Re=J-C,Br=Et*fn+Ie*Re,ke=Ie*fn-Re*Et,It=ke<0;if(Math.abs(ke)<.001*Math.abs(Br)){d.push(A-z*Z,C-$*Z),d.push(A+z*H,C+$*H),Br>=0&&(a.join==="round"?_+=Ln(A,C,A-z*Z,C-$*Z,A-pe*Z,C-ye*Z,d,!1)+4:_+=2,d.push(A-pe*H,C-ye*H),d.push(A+pe*Z,C+ye*Z));continue}const zn=(-z+k)*(-$+C)-(-z+A)*(-$+E),Pt=(-pe+Y)*(-ye+C)-(-pe+A)*(-ye+J),Nn=(Et*Pt-fn*zn)/ke,pn=(Re*zn-Ie*Pt)/ke,tr=(Nn-A)*(Nn-A)+(pn-C)*(pn-C),Bt=A+(Nn-A)*Z,ct=C+(pn-C)*Z,vt=A-(Nn-A)*H,et=C-(pn-C)*H,Ur=Math.min(Et*Et+Ie*Ie,fn*fn+Re*Re),nr=It?Z:H,mn=Ur+nr*nr*b;tr<=mn?a.join==="bevel"||tr/b>w?(It?(d.push(Bt,ct),d.push(A+z*H,C+$*H),d.push(Bt,ct),d.push(A+pe*H,C+ye*H)):(d.push(A-z*Z,C-$*Z),d.push(vt,et),d.push(A-pe*Z,C-ye*Z),d.push(vt,et)),_+=2):a.join==="round"?It?(d.push(Bt,ct),d.push(A+z*H,C+$*H),_+=Ln(A,C,A+z*H,C+$*H,A+pe*H,C+ye*H,d,!0)+4,d.push(Bt,ct),d.push(A+pe*H,C+ye*H)):(d.push(A-z*Z,C-$*Z),d.push(vt,et),_+=Ln(A,C,A-z*Z,C-$*Z,A-pe*Z,C-ye*Z,d,!1)+4,d.push(A-pe*Z,C-ye*Z),d.push(vt,et)):(d.push(Bt,ct),d.push(vt,et)):(d.push(A-z*Z,C-$*Z),d.push(A+z*H,C+$*H),a.join==="round"?It?_+=Ln(A,C,A+z*H,C+$*H,A+pe*H,C+ye*H,d,!0)+2:_+=Ln(A,C,A-z*Z,C-$*Z,A-pe*Z,C-ye*Z,d,!1)+2:a.join==="miter"&&tr/b<=w&&(It?(d.push(vt,et),d.push(vt,et)):(d.push(Bt,ct),d.push(Bt,ct)),_+=2),d.push(A-pe*Z,C-ye*Z),d.push(A+pe*H,C+ye*H),_+=2)}k=t[(m-2)*2],E=t[(m-2)*2+1],A=t[(m-1)*2],C=t[(m-1)*2+1],z=-(E-C),$=k-A,xe=Math.sqrt(z*z+$*$),z/=xe,$/=xe,z*=y,$*=y,d.push(A-z*Z,C-$*Z),d.push(A+z*H,C+$*H),h||(a.cap==="round"?_+=Ln(A-z*(Z-H)*.5,C-$*(Z-H)*.5,A-z*Z,C-$*Z,A+z*H,C+$*H,d,!1)+2:a.cap==="square"&&(_+=gu(A,C,z,$,Z,H,!1,d)));const dn=mu*mu;for(let ue=g;ue<_+g-2;++ue)k=d[ue*2],E=d[ue*2+1],A=d[(ue+1)*2],C=d[(ue+1)*2+1],Y=d[(ue+2)*2],J=d[(ue+2)*2+1],!(Math.abs(k*(C-J)+A*(J-E)+Y*(E-C))<dn)&&i.push(ue,ue+1,ue+2)}function sy(t,e,n,r){const s=df;if(t.length===0)return;const i=t[0],o=t[1],a=t[t.length-2],c=t[t.length-1],l=e||Math.abs(i-a)<s&&Math.abs(o-c)<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);l&&r.push(f+h-1,f)}function ff(t,e,n,r,s,i,o){const a=e_(t,e,2);if(!a)return;for(let l=0;l<a.length;l+=3)i[o++]=a[l]+s,i[o++]=a[l+1]+s,i[o++]=a[l+2]+s;let c=s*r;for(let l=0;l<t.length;l+=2)n[c]=t[l],n[c+1]=t[l+1],c+=r}const iy=[],oy={extension:{type:we.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){ff(t,iy,e,n,r,s,i)}},ay={extension:{type:we.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}},cy={extension:{type:we.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}},_u=[{offset:0,color:"white"},{offset:1,color:"black"}],Sc=class Ca{constructor(...e){this.uid=Ze("fillGradient"),this._tick=0,this.type="linear",this.colorStops=[];let n=ly(e);n={...n.type==="radial"?Ca.defaultRadialOptions:Ca.defaultLinearOptions,...hd(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:an.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 c=this.colorStops.length?this.colorStops:_u,l=this._textureSize,{canvas:u,context:h}=xu(l,1),f=a?h.createLinearGradient(this._textureSize,0,0,0):h.createLinearGradient(0,0,this._textureSize,0);yu(f,c),h.fillStyle=f,h.fillRect(0,0,l,1),this.texture=new ve({source:new Ii({resource:u,addressMode:this._wrapMode})});const d=Math.sqrt(i*i+o*o),m=Math.atan2(o,i),_=new ce;_.scale(d/l,1),_.rotate(m),_.translate(e,n),this.textureSpace==="local"&&_.scale(l,l),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:_u,n=this._textureSize,{canvas:r,context:s}=xu(n,n),{x:i,y:o}=this.center,{x:a,y:c}=this.outerCenter,l=this.innerRadius,u=this.outerRadius,h=a-u,f=c-u,d=n/(u*2),m=(i-h)*d,_=(o-f)*d,g=s.createRadialGradient(m,_,l*d,(a-h)*d,(c-f)*d,u*d);yu(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 ve({source:new Ii({resource:r,addressMode:this._wrapMode})});const y=new ce;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}`}};Sc.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};Sc.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};let Ys=Sc;function yu(t,e){for(let n=0;n<e.length;n++){const r=e[n];t.addColorStop(r.offset,r.color)}}function xu(t,e){const n=Ws.get().createCanvas(t,e),r=n.getContext("2d");return{canvas:n,context:r}}function ly(t){let e=t[0]??{};return(typeof e=="number"||t[1])&&(Te("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]??Ys.defaultLinearOptions.textureSize}),e}const uy=new ce,hy=new Ge;function dy(t,e,n,r){const s=e.matrix?t.copyFrom(e.matrix).invert():t.identity();if(e.textureSpace==="local"){const o=n.getBounds(hy);e.width&&o.pad(e.width);const{x:a,y:c}=o,l=1/o.width,u=1/o.height,h=-a*l,f=-c*u,d=s.a,m=s.b,_=s.c,g=s.d;s.a*=l,s.b*=l,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 Ys)&&i.addressMode==="clamp-to-edge"&&(i.addressMode="repeat",i.update()),r&&s.append(uy.copyFrom(r).invert()),s}const eo={};bt.handleByMap(we.ShapeBuilder,eo);bt.add(ay,oy,cy,As,ey,ty);const fy=new Ge,py=new ce;function my(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")gy(i.data,r,n);else if(i.action==="fill"||i.action==="stroke"){const o=i.action==="stroke",a=i.data.path.shapePath,c=i.data.style,l=i.data.hole;o&&l&&bu(l.shapePath,c,!0,r,n),l&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=l.shapePath.shapePrimitives),bu(a,c,o,r,n)}}}function gy(t,e,n){const r=[],s=eo.rectangle,i=fy;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:c,indices:l}=n,u=l.length,h=a.length/2;o&&hf(r,o),s.triangulate(r,a,2,h,l,u);const f=t.image,d=f.uvs;c.push(d.x0,d.y0,d.x1,d.y1,d.x3,d.y3,d.x2,d.y2);const m=ft.get(kc);m.indexOffset=u,m.indexSize=l.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 bu(t,e,n,r,s){const{vertices:i,uvs:o,indices:a}=s;t.shapePrimitives.forEach(({shape:c,transform:l,holes:u})=>{const h=[],f=eo[c.type];if(!f.build(c,h))return;const d=a.length,m=i.length/2;let _="triangle-list";if(l&&hf(h,l),n){const w=c.closePath??!0,k=e;k.pixelLine?(sy(h,w,i,a),_="line-list"):ry(h,k,!1,w,i,a)}else if(u){const w=[],k=h.slice();_y(u).forEach(A=>{w.push(k.length/2),k.push(...A)}),ff(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!==ve.WHITE){const w=dy(py,e,c,l);J_(i,2,m,o,g,2,i.length/2-m,w)}else K_(o,g,2,i.length/2-m);const b=ft.get(kc);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 _y(t){const e=[];for(let n=0;n<t.length;n++){const r=t[n].shape,s=[];eo[r.type].build(r,s)&&e.push(s)}return e}class yy{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}reset(){this.batches&&this.batches.forEach(e=>{ft.return(e)}),this.graphicsData&&ft.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 xy{constructor(){this.instructions=new _c}init(e){const n=e.maxTextures;this.batcher?this.batcher._updateMaxTextures(n):this.batcher=new X_({maxTextures:n}),this.instructions.reset()}get geometry(){return Te(km,"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 Tc=class Ea{constructor(e){this._renderer=e,this._managedContexts=new Qi({renderer:e,type:"resource",name:"graphicsContext"})}init(e){Ea.defaultOptions.bezierSmoothness=(e==null?void 0:e.bezierSmoothness)??Ea.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(),my(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=ft.get(xy,{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 c=n.batcher;c.ensureAttributeBuffer(o),c.ensureIndexBuffer(a),c.begin();for(let h=0;h<s.length;h++){const f=s[h];c.add(f)}c.finish(n.instructions);const l=c.geometry;l.indexBuffer.setDataWithSize(c.indexBuffer,c.indexSize,!0),l.buffers[0].setDataWithSize(c.attributeBuffer.float32View,c.attributeSize,!0);const u=c.batches;for(let h=0;h<u.length;h++){const f=u[h];f.bindGroup=c_(f.textures.textures,f.textures.count,this._renderer.limits.maxBatchableTextures)}return n}_initContext(e){const n=new yy;return n.context=e,e._gpuData[this._renderer.uid]=n,this._managedContexts.add(e),n}destroy(){this._managedContexts.destroy(),this._renderer=null}};Tc.extension={type:[we.WebGLSystem,we.WebGPUSystem],name:"graphicsContext"};Tc.defaultOptions={bezierSmoothness:.5};let Ac=Tc;const by=8,fi=11920929e-14,vy=1;function pf(t,e,n,r,s,i,o,a,c,l){const h=Math.min(.99,Math.max(0,l??Ac.defaultOptions.bezierSmoothness));let f=(vy-h)/1;return f*=f,wy(e,n,r,s,i,o,a,c,t,f),t}function wy(t,e,n,r,s,i,o,a,c,l){Ia(t,e,n,r,s,i,o,a,c,l,0),c.push(o,a)}function Ia(t,e,n,r,s,i,o,a,c,l,u){if(u>by)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,Y=a-e;const J=Math.abs((n-o)*Y-(r-a)*C),z=Math.abs((s-o)*Y-(i-a)*C);if(J>fi&&z>fi){if((J+z)*(J+z)<=l*(C*C+Y*Y)){c.push(E,A);return}}else if(J>fi){if(J*J<=l*(C*C+Y*Y)){c.push(E,A);return}}else if(z>fi){if(z*z<=l*(C*C+Y*Y)){c.push(E,A);return}}else if(C=E-(t+o)/2,Y=A-(e+a)/2,C*C+Y*Y<=l){c.push(E,A);return}}Ia(t,e,h,f,y,b,E,A,c,l,u+1),Ia(E,A,w,k,_,g,o,a,c,l,u+1)}const ky=8,Sy=11920929e-14,Ty=1;function Ay(t,e,n,r,s,i,o,a){const l=Math.min(.99,Math.max(0,a??Ac.defaultOptions.bezierSmoothness));let u=(Ty-l)/1;return u*=u,Cy(e,n,r,s,i,o,t,u),t}function Cy(t,e,n,r,s,i,o,a){Pa(o,t,e,n,r,s,i,a,0),o.push(s,i)}function Pa(t,e,n,r,s,i,o,a,c){if(c>ky)return;const l=(e+r)/2,u=(n+s)/2,h=(r+i)/2,f=(s+o)/2,d=(l+h)/2,m=(u+f)/2;let _=i-e,g=o-n;const y=Math.abs((r-i)*g-(s-o)*_);if(y>Sy){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}Pa(t,e,n,l,u,d,m,a,c+1),Pa(t,d,m,h,f,i,o,a,c+1)}function mf(t,e,n,r,s,i,o,a){let c=Math.abs(s-i);(!o&&s>i||o&&i>s)&&(c=2*Math.PI-c),a||(a=Math.max(6,Math.floor(6*Math.pow(r,1/3)*(c/Math.PI)))),a=Math.max(a,3);let l=c/a,u=s;l*=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+=l}}function Ey(t,e,n,r,s,i){const o=t[t.length-2],c=t[t.length-1]-n,l=o-e,u=s-n,h=r-e,f=Math.abs(c*h-l*u);if(f<1e-8||i===0){(t[t.length-2]!==e||t[t.length-1]!==n)&&t.push(e,n);return}const d=c*c+l*l,m=u*u+h*h,_=c*u+l*h,g=i*Math.sqrt(d)/f,y=i*Math.sqrt(m)/f,b=g*_/d,w=y*_/m,k=g*h+y*l,E=g*u+y*c,A=l*(y+b),C=c*(y+b),Y=h*(g+w),J=u*(g+w),z=Math.atan2(C-E,A-k),$=Math.atan2(J-E,Y-k);mf(t,k+e,E+n,i,z,$,l*u>h*c)}const xs=Math.PI*2,Wo={centerX:0,centerY:0,ang1:0,ang2:0},Yo=({x:t,y:e},n,r,s,i,o,a,c)=>{t*=n,e*=r;const l=s*t-i*e,u=i*t+s*e;return c.x=l+o,c.y=u+a,c};function Iy(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 vu=(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)},Py=(t,e,n,r,s,i,o,a,c,l,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=l*b-c*w+(t+n)/2,E=c*b+l*w+(e+r)/2,A=(u-b)/s,C=(h-w)/i,Y=(-u-b)/s,J=(-h-w)/i,z=vu(1,0,A,C);let $=vu(A,C,Y,J);a===0&&$>0&&($-=xs),a===1&&$<0&&($+=xs),f.centerX=k,f.centerY=E,f.ang1=z,f.ang2=$};function My(t,e,n,r,s,i,o,a=0,c=0,l=0){if(i===0||o===0)return;const u=Math.sin(a*xs/360),h=Math.cos(a*xs/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)),Py(e,n,r,s,i,o,c,l,u,h,f,d,Wo);let{ang1:_,ang2:g}=Wo;const{centerX:y,centerY:b}=Wo;let w=Math.abs(g)/(xs/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 Y=0;Y<k;Y++){const J=Iy(_,g),{x:z,y:$}=Yo(J[0],i,o,h,u,y,b,C),{x:pe,y:ye}=Yo(J[1],i,o,h,u,y,b,C),{x:xe,y:hn}=Yo(J[2],i,o,h,u,y,b,C);pf(t,E,A,z,$,pe,ye,xe,hn),E=xe,A=hn,_+=g}}function Ry(t,e,n){const r=(o,a)=>{const c=a.x-o.x,l=a.y-o.y,u=Math.sqrt(c*c+l*l),h=c/u,f=l/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],c=a.radius??n;if(c<=0){s(o,a),i=a;continue}const l=e[(o+1)%e.length],u=r(a,i),h=r(a,l);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(_)*c/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=c;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 Oy(t,e,n,r){const s=(a,c)=>Math.sqrt((a.x-c.x)**2+(a.y-c.y)**2),i=(a,c,l)=>({x:a.x+(c.x-a.x)*l,y:a.y+(c.y-a.y)*l}),o=e.length;for(let a=0;a<o;a++){const c=e[(a+1)%o],l=c.radius??n;if(l<=0){a===0?t.moveTo(c.x,c.y):t.lineTo(c.x,c.y);continue}const u=e[a],h=e[(a+2)%o],f=s(u,c);let d;if(f<1e-4)d=c;else{const g=Math.min(f/2,l);d=i(c,u,g/f)}const m=s(h,c);let _;if(m<1e-4)_=c;else{const g=Math.min(m/2,l);_=i(c,h,g/m)}a===0?t.moveTo(d.x,d.y):t.lineTo(d.x,d.y),t.quadraticCurveTo(c.x,c.y,_.x,_.y,r)}}const $y=new Ge;class zy{constructor(e){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new Dt,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 mf(a,e,n,r,s,i,o),this}arcTo(e,n,r,s,i){this._ensurePoly();const o=this._currentPoly.points;return Ey(o,e,n,r,s,i),this}arcToSvg(e,n,r,s,i,o,a){const c=this._currentPoly.points;return My(c,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 c=this._currentPoly;return pf(this._currentPoly.points,c.lastX,c.lastY,e,n,r,s,i,o,a),this}quadraticCurveTo(e,n,r,s,i){this._ensurePoly();const o=this._currentPoly;return Ay(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 c=a.shape,l=i==null?void 0:i.shape;l&&l.containsPolygon(c)?(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 Ge(e,n,r,s),i),this}circle(e,n,r,s){return this.drawShape(new bc(e,n,r),s),this}poly(e,n,r){const s=new _s(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,c=Math.PI*2/s,l=[];for(let u=0;u<s;u++){const h=a-u*c;l.push(e+r*Math.cos(h),n+r*Math.sin(h))}return this.poly(l,!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 c=r*Math.sin(Math.PI/s)-.001;i=Math.min(i,c);const l=-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+l,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?Oy(this,e,n,s):Ry(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)),c=e+r,l=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(c-h,n).arcTo(c-u,n+u,c,n+h,h).lineTo(c,l-h).arcTo(c-u,l-u,e+r-h,l,h).lineTo(e+h,l).arcTo(e+u,l-u,e,l-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),c=e+r,l=n+s,u=[e+a,n,c-a,n,c,n+a,c,l-a,c-a,l,e+a,l,e,l-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 vc(e,n,r,s),i),this}roundRect(e,n,r,s,i,o){return this.drawShape(new wc(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 _s,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 _s,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($y);s.transform?e.addRect(i,s.transform):e.addRect(i)}return e}}class on{constructor(e,n=!1){this.instructions=[],this.uid=Ze("graphicsPath"),this._dirty=!0,this.checkForHoles=n,typeof e=="string"?s_(e,this):this.instructions=(e==null?void 0:e.slice())??[]}get shapePath(){return this._shapePath||(this._shapePath=new zy(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(Ke.shared);let c=0,l=0;if(!o||o.action!=="bezierCurveTo")c=a.x,l=a.y;else{c=o.data[2],l=o.data[3];const u=a.x,h=a.y;c=u+(u-c),l=h+(h-l)}return this.instructions.push({action:"bezierCurveTo",data:[c,l,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(Ke.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 c=i.x,l=i.y;o=c+(c-o),a=l+(l-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 c=-1*Math.PI/2+o,l=r*2,u=Math.PI*2/l,h=[];for(let f=0;f<l;f++){const d=f%2?i:s,m=f*u+c;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 on;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 c=0,l=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":c=b[0],l=b[1],b[0]=n*c+s*l+o,b[1]=r*c+i*l+a;break;case"bezierCurveTo":u=b[0],h=b[1],f=b[2],d=b[3],c=b[4],l=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*c+s*l+o,b[5]=r*c+i*l+a;break;case"quadraticCurveTo":u=b[0],h=b[1],c=b[2],l=b[3],b[0]=n*u+s*h+o,b[1]=r*u+i*h+a,b[2]=n*c+s*l+o,b[3]=r*c+i*l+a;break;case"arcToSvg":c=b[5],l=b[6],m=b[0],_=b[1],b[0]=n*m+s*_,b[1]=r*m+i*_,b[5]=n*c+s*l+o,b[6]=r*c+i*l+a;break;case"circle":b[4]=Jr(b[3],e);break;case"rect":b[4]=Jr(b[4],e);break;case"ellipse":b[8]=Jr(b[8],e);break;case"roundRect":b[5]=Jr(b[5],e);break;case"addPath":b[0].transform(e);break;case"poly":b[2]=Jr(b[2],e);break;default:xt("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 Jr(t,e){return t?t.prepend(e):e.clone()}function ze(t,e,n){const r=t.getAttribute(e);return r?Number(r):n}function Ny(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]=Dy(o);break;case"radialgradient":e.defs[o.id]=Ly();break}}}}function Dy(t){const e=ze(t,"x1",0),n=ze(t,"y1",0),r=ze(t,"x2",1),s=ze(t,"y2",0),i=t.getAttribute("gradientUnits")||"objectBoundingBox",o=new Ys(e,n,r,s,i==="objectBoundingBox"?"local":"global");for(let a=0;a<t.children.length;a++){const c=t.children[a],l=ze(c,"offset",0),u=an.shared.setValue(c.getAttribute("stop-color")).toNumber();o.addColorStop(l,u)}return o}function Ly(t){return xt("[SVG Parser] Radial gradients are not yet supported"),new Ys(0,0,1,0)}function wu(t){const e=t.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return e?e[1]:""}const ku={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 gf(t,e){const n=t.getAttribute("style"),r={},s={},i={strokeStyle:r,fillStyle:s,useFill:!1,useStroke:!1};for(const o in ku){const a=t.getAttribute(o);a&&Su(e,i,o,a.trim())}if(n){const o=n.split(";");for(let a=0;a<o.length;a++){const c=o[a].trim(),[l,u]=c.split(":");ku[l]&&Su(e,i,l,u.trim())}}return{strokeStyle:i.useStroke?r:null,fillStyle:i.useFill?s:null,useFill:i.useFill,useStroke:i.useStroke}}function Su(t,e,n,r){switch(n){case"stroke":if(r!=="none"){if(r.startsWith("url(")){const s=wu(r);e.strokeStyle.fill=t.defs[s]}else e.strokeStyle.color=an.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=wu(r);e.fillStyle.fill=t.defs[s]}else e.fillStyle.color=an.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 Zy(t){if(t.length<=2)return!0;const e=t.map(a=>a.area).sort((a,c)=>c-a),[n,r]=e,s=e[e.length-1],i=n/r,o=r/s;return!(i>3&&o<2)}function Fy(t){return t.split(/(?=[Mm])/).filter(r=>r.trim().length>0)}function By(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),c=Math.max(...s);return(o-i)*(c-a)}function Tu(t,e){const n=new on(t,!1);for(const r of n.instructions)e.instructions.push(r)}function Uy(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 on};Ny(t,n);const r=t.children,{fillStyle:s,strokeStyle:i}=gf(t,n);for(let o=0;o<r.length;o++){const a=r[o];a.nodeName.toLowerCase()!=="defs"&&_f(a,n,s,i)}return e}function _f(t,e,n,r){const s=t.children,{fillStyle:i,strokeStyle:o}=gf(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 c,l,u,h,f,d,m,_,g,y,b,w,k,E,A,C,Y;switch(t.nodeName.toLowerCase()){case"path":{E=t.getAttribute("d");const J=t.getAttribute("fill-rule"),z=Fy(E),$=J==="evenodd",pe=z.length>1;if($&&pe){const xe=z.map(Z=>({path:Z,area:By(Z)}));if(xe.sort((Z,H)=>H.area-Z.area),z.length>3||!Zy(xe))for(let Z=0;Z<xe.length;Z++){const H=xe[Z],dn=Z===0;e.context.beginPath();const ue=new on(void 0,!0);Tu(H.path,ue),e.context.path(ue),dn?(n&&e.context.fill(n),r&&e.context.stroke(r)):e.context.cut()}else for(let Z=0;Z<xe.length;Z++){const H=xe[Z],dn=Z%2===1;e.context.beginPath();const ue=new on(void 0,!0);Tu(H.path,ue),e.context.path(ue),dn?e.context.cut():(n&&e.context.fill(n),r&&e.context.stroke(r))}}else{const xe=J?J==="evenodd":!0;A=new on(E,xe),e.context.path(A),n&&e.context.fill(n),r&&e.context.stroke(r)}break}case"circle":m=ze(t,"cx",0),_=ze(t,"cy",0),g=ze(t,"r",0),e.context.ellipse(m,_,g,g),n&&e.context.fill(n),r&&e.context.stroke(r);break;case"rect":c=ze(t,"x",0),l=ze(t,"y",0),C=ze(t,"width",0),Y=ze(t,"height",0),y=ze(t,"rx",0),b=ze(t,"ry",0),y||b?e.context.roundRect(c,l,C,Y,y||b):e.context.rect(c,l,C,Y),n&&e.context.fill(n),r&&e.context.stroke(r);break;case"ellipse":m=ze(t,"cx",0),_=ze(t,"cy",0),y=ze(t,"rx",0),b=ze(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=ze(t,"x1",0),h=ze(t,"y1",0),f=ze(t,"x2",0),d=ze(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(J=>parseInt(J,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(J=>parseInt(J,10)),e.context.poly(w,!1),r&&e.context.stroke(r);break;case"g":case"svg":break;default:{xt(`[SVG parser] <${t.nodeName}> elements unsupported`);break}}a&&(n=null);for(let J=0;J<s.length;J++)_f(s[J],e,n,r)}const Au={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 jy{constructor(e,n){this.uid=Ze("fillPattern"),this._tick=0,this.transform=new ce,this.texture=e,this.transform.scale(1/e.frame.width,1/e.frame.height),n&&(e.source.style.addressModeU=Au[n].addressModeU,e.source.style.addressModeV=Au[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 Gy(t){return an.isColorLike(t)}function Cu(t){return t instanceof jy}function Eu(t){return t instanceof Ys}function Vy(t){return t instanceof ve}function Hy(t,e,n){const r=an.shared.setValue(e??0);return t.color=r.toNumber(),t.alpha=r.alpha===1?n.alpha:r.alpha,t.texture=ve.WHITE,{...n,...t}}function Wy(t,e,n){return t.texture=e,{...n,...t}}function Iu(t,e,n){return t.fill=e,t.color=16777215,t.texture=e.texture,t.matrix=e.transform,{...n,...t}}function Pu(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 Yy(t,e){const n={...e,...t},r=an.shared.setValue(n.color);return n.alpha*=r.alpha,n.color=r.toNumber(),n}function ls(t,e){if(t==null)return null;const n={},r=t;return Gy(t)?Hy(n,t,e):Vy(t)?Wy(n,t,e):Cu(t)?Iu(n,t,e):Eu(t)?Pu(n,t,e):r.fill&&Cu(r.fill)?Iu(r,r.fill,e):r.fill&&Eu(r.fill)?Pu(r,r.fill,e):Yy(r,e)}function Mu(t,e){const{width:n,alignment:r,miterLimit:s,cap:i,join:o,pixelLine:a,...c}=e,l=ls(t,c);return l?{width:n,alignment:r,miterLimit:s,cap:i,join:o,pixelLine:a,...l}:null}function qy(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 c=i.closePath;for(let l=0;l<a;l+=2){if(!c&&(l===0||l===a-2))continue;const u=(l-2+a)%a,h=(l+2)%a,f=o[u],d=o[u+1],m=o[l],_=o[l+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 z=(b*k+w*E)/Math.sqrt(A*C);z<-1?z=-1:z>1&&(z=1);const $=Math.sqrt((1-z)*.5);if($<1e-6)continue;const pe=Math.min(1/$,e);pe>n&&(n=pe)}}return n}const Xy=new Ke,Ru=new ce,Cc=class Vt extends Rn{constructor(){super(...arguments),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=Ze("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this.destroyed=!1,this._activePath=new on,this._transform=new ce,this._fillStyle={...Vt.defaultFillStyle},this._strokeStyle={...Vt.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new Dt,this._boundsDirty=!0}clone(){const e=new Vt;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=ls(e,Vt.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(e){this._strokeStyle=Mu(e,Vt.defaultStrokeStyle)}setFillStyle(e){return this._fillStyle=ls(e,Vt.defaultFillStyle),this}setStrokeStyle(e){return this._strokeStyle=ls(e,Vt.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?an.shared.setValue(n).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new on,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"&&(Te(Je,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),e={color:e,alpha:n}),this._fillStyle=ls(e,Vt.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(Ke.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=Mu(e,Vt.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 c=this._transform;return this._activePath.arcToSvg(e,n,r,s,i,c.a*o+c.c*a+c.tx,c.b*o+c.d*a+c.ty),this}bezierCurveTo(e,n,r,s,i,o,a){this._tick++;const c=this._transform;return this._activePath.bezierCurveTo(c.a*e+c.c*n+c.tx,c.b*e+c.d*n+c.ty,c.a*r+c.c*s+c.tx,c.b*r+c.d*s+c.ty,c.a*i+c.c*o+c.tx,c.b*i+c.d*o+c.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++,Uy(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 ce?(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 ce?(this._transform.append(e),this):(Ru.set(e,n,r,s,i,o),this._transform.append(Ru),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*=qy(i.path,i.style.miterLimit));const c=i.path.bounds;e.addFrame(c.minX-a,c.minY-a,c.maxX+a,c.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,c=a.path;if(!o.action||!c)continue;const l=a.style,u=c.shapePath.shapePrimitives;for(let h=0;h<u.length;h++){const f=u[h].shape;if(!l||!f)continue;const d=u[h].transform,m=d?d.applyInverse(e,Xy):e;if(o.action==="fill")r=f.contains(m.x,m.y);else{const g=l;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}};Cc.defaultFillStyle={color:16777215,alpha:1,texture:ve.WHITE,matrix:null,fill:null,textureSpace:"local"};Cc.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:ve.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};let Kr=Cc;class Jy{constructor(){this.isBatchable=!1}reset(){this.isBatchable=!1,this.context=null,this.graphicsData&&(this.graphicsData.destroy(),this.graphicsData=null)}destroy(){this.reset()}}class Ky{constructor(){this.instructions=new _c}init(){this.instructions.reset()}destroy(){this.instructions.destroy(),this.instructions=null}}const Ec=class Ma{constructor(e){this._renderer=e,this._managedContexts=new Qi({renderer:e,type:"resource",name:"graphicsContext"})}init(e){Ma.defaultOptions.bezierSmoothness=(e==null?void 0:e.bezierSmoothness)??Ma.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 Ky,r=this.getGpuContext(e);return r.graphicsData=n,n.init(),n}_initContext(e){const n=new Jy;return n.context=e,e._gpuData[this._renderer.uid]=n,this._managedContexts.add(e),n}destroy(){this._managedContexts.destroy(),this._renderer=null}};Ec.extension={type:[we.CanvasSystem],name:"graphicsContext"};Ec.defaultOptions={bezierSmoothness:.5};let Qy=Ec;class yf{constructor(e,n){this.state=Jd.for2d(),this.renderer=e,this._adaptor=n,this.renderer.runners.contextChange.add(this),this._managedGraphics=new Qi({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}}yf.extension={type:[we.CanvasPipes],name:"graphics"};function ex(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 tx{constructor(){this.batches=[],this.batched=!1}destroy(){this.batches.forEach(e=>{ft.return(e)}),this.batches.length=0}}class xf{constructor(e,n){this.state=Jd.for2d(),this.renderer=e,this._adaptor=n,this.renderer.runners.contextChange.add(this),this._managedGraphics=new Qi({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,ex(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 tx;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 c=ft.get(kc);return a.copyTo(c),c.renderable=e,c.roundPixels=o,c})}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null}}xf.extension={type:[we.WebGLPipes,we.WebGPUPipes],name:"graphics"};bt.add(yf);bt.add(xf);bt.add(Qy);bt.add(Ac);class Mi extends Cd{constructor(e){e instanceof Kr&&(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 Kr,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 Mi(this._context.clone()):(this._ownedContext=null,new Mi(this._context))}lineStyle(e,n,r){Te(Je,"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){Te(Je,"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(){Te(Je,"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!==Kr.defaultStrokeStyle.width||e.color!==Kr.defaultStrokeStyle.color||e.alpha!==Kr.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...e){return Te(Je,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",e)}drawEllipse(...e){return Te(Je,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",e)}drawPolygon(...e){return Te(Je,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",e)}drawRect(...e){return Te(Je,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",e)}drawRoundedRect(...e){return Te(Je,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",e)}drawStar(...e){return Te(Je,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",e)}}bt.add(fm,pm);const nx={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 rx(t){return{...nx,...t}}var de;(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})(de||(de={}));var Ou;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Ou||(Ou={}));const F=de.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),_n=t=>{switch(typeof t){case"undefined":return F.undefined;case"string":return F.string;case"number":return Number.isNaN(t)?F.nan:F.number;case"boolean":return F.boolean;case"function":return F.function;case"bigint":return F.bigint;case"symbol":return F.symbol;case"object":return Array.isArray(t)?F.array:t===null?F.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?F.promise:typeof Map<"u"&&t instanceof Map?F.map:typeof Set<"u"&&t instanceof Set?F.set:typeof Date<"u"&&t instanceof Date?F.date:F.object;default:return F.unknown}},M=de.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"]);let qn=class bf 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,c=0;for(;c<o.path.length;){const l=o.path[c];c===o.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(n(o))):a[l]=a[l]||{_errors:[]},a=a[l],c++}}};return s(this),r}static assert(e){if(!(e instanceof bf))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,de.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()}};qn.create=t=>new qn(t);const Ra=(t,e)=>{let n;switch(t.code){case M.invalid_type:t.received===F.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case M.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,de.jsonStringifyReplacer)}`;break;case M.unrecognized_keys:n=`Unrecognized key(s) in object: ${de.joinValues(t.keys,", ")}`;break;case M.invalid_union:n="Invalid input";break;case M.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${de.joinValues(t.options)}`;break;case M.invalid_enum_value:n=`Invalid enum value. Expected ${de.joinValues(t.options)}, received '${t.received}'`;break;case M.invalid_arguments:n="Invalid function arguments";break;case M.invalid_return_type:n="Invalid function return type";break;case M.invalid_date:n="Invalid date";break;case M.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}"`:de.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case M.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 M.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 M.custom:n="Invalid input";break;case M.invalid_intersection_types:n="Intersection results could not be merged";break;case M.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case M.not_finite:n="Number must be finite";break;default:n=e.defaultError,de.assertNever(t)}return{message:n}};let sx=Ra;function ix(){return sx}const ox=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 c=r.filter(l=>!!l).slice().reverse();for(const l of c)a=l(o,{data:e,defaultError:a}).message;return{...s,path:i,message:a}};function D(t,e){const n=ix(),r=ox({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Ra?void 0:Ra].filter(s=>!!s)});t.common.issues.push(r)}let Lt=class vf{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 K;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 vf.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 K;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 K=Object.freeze({status:"aborted"}),us=t=>({status:"dirty",value:t}),Tt=t=>({status:"valid",value:t}),$u=t=>t.status==="aborted",zu=t=>t.status==="dirty",Ar=t=>t.status==="valid",Ri=t=>typeof Promise<"u"&&t instanceof Promise;var U;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(U||(U={}));let Cn=class{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 Nu=(t,e)=>{if(Ar(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 qn(t.common.issues);return this._error=n,this._error}}};function se(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:c}=t;return o.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:c??n??a.defaultError}},description:s}}let he=class{get description(){return this._def.description}_getType(e){return _n(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:_n(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Lt,ctx:{common:e.parent.common,data:e.data,parsedType:_n(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Ri(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:_n(e)},s=this._parseSync({data:e,path:r.path,parent:r});return Nu(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:_n(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:n});return Ar(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=>Ar(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:_n(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(Ri(s)?s:Promise.resolve(s));return Nu(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:M.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!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 Er({schema:this,typeName:Q.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 Tn.create(this,this._def)}nullable(){return Ir.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Cr.create(this)}promise(){return zi.create(this,this._def)}or(e){return Oi.create([this,e],this._def)}and(e){return $i.create(this,e,this._def)}transform(e){return new Er({...se(this._def),schema:this,typeName:Q.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Ba({...se(this._def),innerType:this,defaultValue:n,typeName:Q.ZodDefault})}brand(){return new Ix({typeName:Q.ZodBranded,type:this,...se(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new Ua({...se(this._def),innerType:this,catchValue:n,typeName:Q.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Px.create(this,e)}readonly(){return ja.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const ax=/^c[^\s-]{8,}$/i,cx=/^[0-9a-z]+$/,lx=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ux=/^[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,hx=/^[a-z0-9_-]{21}$/i,dx=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,fx=/^[-+]?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)?)??$/,px=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,mx="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let qo;const gx=/^(?:(?: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])$/,_x=/^(?:(?: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])$/,yx=/^(([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]))$/,xx=/^(([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])$/,bx=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,vx=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,wf="((\\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])))",wx=new RegExp(`^${wf}$`);function kf(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 kx(t){return new RegExp(`^${kf(t)}$`)}function Sx(t){let e=`${wf}T${kf(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 Tx(t,e){return!!((e==="v4"||!e)&&gx.test(t)||(e==="v6"||!e)&&yx.test(t))}function Ax(t,e){if(!dx.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 Cx(t,e){return!!((e==="v4"||!e)&&_x.test(t)||(e==="v6"||!e)&&xx.test(t))}let Oa=class hs extends he{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==F.string){const i=this._getOrReturnCtx(e);return D(i,{code:M.invalid_type,expected:F.string,received:i.parsedType}),K}const r=new Lt;let s;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),D(s,{code:M.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),D(s,{code:M.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?D(s,{code:M.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&D(s,{code:M.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")px.test(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{validation:"email",code:M.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")qo||(qo=new RegExp(mx,"u")),qo.test(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{validation:"emoji",code:M.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")ux.test(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{validation:"uuid",code:M.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")hx.test(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{validation:"nanoid",code:M.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")ax.test(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{validation:"cuid",code:M.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")cx.test(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{validation:"cuid2",code:M.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")lx.test(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{validation:"ulid",code:M.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),D(s,{validation:"url",code:M.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),D(s,{validation:"regex",code:M.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),D(s,{code:M.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),D(s,{code:M.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),D(s,{code:M.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?Sx(i).test(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{code:M.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?wx.test(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{code:M.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?kx(i).test(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{code:M.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?fx.test(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{validation:"duration",code:M.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?Tx(e.data,i.version)||(s=this._getOrReturnCtx(e,s),D(s,{validation:"ip",code:M.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?Ax(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),D(s,{validation:"jwt",code:M.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?Cx(e.data,i.version)||(s=this._getOrReturnCtx(e,s),D(s,{validation:"cidr",code:M.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?bx.test(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{validation:"base64",code:M.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?vx.test(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{validation:"base64url",code:M.invalid_string,message:i.message}),r.dirty()):de.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:M.invalid_string,...U.errToObj(r)})}_addCheck(e){return new hs({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...U.errToObj(e)})}url(e){return this._addCheck({kind:"url",...U.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...U.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...U.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...U.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...U.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...U.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...U.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...U.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...U.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...U.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...U.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...U.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,...U.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,...U.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...U.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...U.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...U.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...U.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...U.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...U.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...U.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...U.errToObj(n)})}nonempty(e){return this.min(1,U.errToObj(e))}trim(){return new hs({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new hs({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new hs({...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}};Oa.create=t=>new Oa({checks:[],typeName:Q.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...se(t)});function Ex(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 $a=class za extends he{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)!==F.number){const i=this._getOrReturnCtx(e);return D(i,{code:M.invalid_type,expected:F.number,received:i.parsedType}),K}let r;const s=new Lt;for(const i of this._def.checks)i.kind==="int"?de.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{code:M.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),D(r,{code:M.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),D(r,{code:M.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?Ex(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),D(r,{code:M.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{code:M.not_finite,message:i.message}),s.dirty()):de.assertNever(i);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,U.toString(n))}gt(e,n){return this.setLimit("min",e,!1,U.toString(n))}lte(e,n){return this.setLimit("max",e,!0,U.toString(n))}lt(e,n){return this.setLimit("max",e,!1,U.toString(n))}setLimit(e,n,r,s){return new za({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:U.toString(s)}]})}_addCheck(e){return new za({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:U.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:U.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:U.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:U.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:U.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:U.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:U.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:U.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:U.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"&&de.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)}};$a.create=t=>new $a({checks:[],typeName:Q.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...se(t)});let Du=class Na extends he{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)!==F.bigint)return this._getInvalidInput(e);let r;const s=new Lt;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),D(r,{code:M.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),D(r,{code:M.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),D(r,{code:M.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):de.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return D(n,{code:M.invalid_type,expected:F.bigint,received:n.parsedType}),K}gte(e,n){return this.setLimit("min",e,!0,U.toString(n))}gt(e,n){return this.setLimit("min",e,!1,U.toString(n))}lte(e,n){return this.setLimit("max",e,!0,U.toString(n))}lt(e,n){return this.setLimit("max",e,!1,U.toString(n))}setLimit(e,n,r,s){return new Na({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:U.toString(s)}]})}_addCheck(e){return new Na({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:U.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:U.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:U.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:U.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:U.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}};Du.create=t=>new Du({checks:[],typeName:Q.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...se(t)});let Lu=class extends he{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==F.boolean){const r=this._getOrReturnCtx(e);return D(r,{code:M.invalid_type,expected:F.boolean,received:r.parsedType}),K}return Tt(e.data)}};Lu.create=t=>new Lu({typeName:Q.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...se(t)});let Zu=class Sf extends he{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==F.date){const i=this._getOrReturnCtx(e);return D(i,{code:M.invalid_type,expected:F.date,received:i.parsedType}),K}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return D(i,{code:M.invalid_date}),K}const r=new Lt;let s;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),D(s,{code:M.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),D(s,{code:M.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):de.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Sf({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:U.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:U.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}};Zu.create=t=>new Zu({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Q.ZodDate,...se(t)});let Fu=class extends he{_parse(e){if(this._getType(e)!==F.symbol){const r=this._getOrReturnCtx(e);return D(r,{code:M.invalid_type,expected:F.symbol,received:r.parsedType}),K}return Tt(e.data)}};Fu.create=t=>new Fu({typeName:Q.ZodSymbol,...se(t)});let Bu=class extends he{_parse(e){if(this._getType(e)!==F.undefined){const r=this._getOrReturnCtx(e);return D(r,{code:M.invalid_type,expected:F.undefined,received:r.parsedType}),K}return Tt(e.data)}};Bu.create=t=>new Bu({typeName:Q.ZodUndefined,...se(t)});let Uu=class extends he{_parse(e){if(this._getType(e)!==F.null){const r=this._getOrReturnCtx(e);return D(r,{code:M.invalid_type,expected:F.null,received:r.parsedType}),K}return Tt(e.data)}};Uu.create=t=>new Uu({typeName:Q.ZodNull,...se(t)});let ju=class extends he{constructor(){super(...arguments),this._any=!0}_parse(e){return Tt(e.data)}};ju.create=t=>new ju({typeName:Q.ZodAny,...se(t)});let Gu=class extends he{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Tt(e.data)}};Gu.create=t=>new Gu({typeName:Q.ZodUnknown,...se(t)});let En=class extends he{_parse(e){const n=this._getOrReturnCtx(e);return D(n,{code:M.invalid_type,expected:F.never,received:n.parsedType}),K}};En.create=t=>new En({typeName:Q.ZodNever,...se(t)});let Vu=class extends he{_parse(e){if(this._getType(e)!==F.undefined){const r=this._getOrReturnCtx(e);return D(r,{code:M.invalid_type,expected:F.void,received:r.parsedType}),K}return Tt(e.data)}};Vu.create=t=>new Vu({typeName:Q.ZodVoid,...se(t)});let Cr=class Ti extends he{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==F.array)return D(n,{code:M.invalid_type,expected:F.array,received:n.parsedType}),K;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,a=n.data.length<s.exactLength.value;(o||a)&&(D(n,{code:o?M.too_big:M.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&&(D(n,{code:M.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&&(D(n,{code:M.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 Cn(n,o,n.path,a)))).then(o=>Lt.mergeArray(r,o));const i=[...n.data].map((o,a)=>s.type._parseSync(new Cn(n,o,n.path,a)));return Lt.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new Ti({...this._def,minLength:{value:e,message:U.toString(n)}})}max(e,n){return new Ti({...this._def,maxLength:{value:e,message:U.toString(n)}})}length(e,n){return new Ti({...this._def,exactLength:{value:e,message:U.toString(n)}})}nonempty(e){return this.min(1,e)}};Cr.create=(t,e)=>new Cr({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Q.ZodArray,...se(e)});function hr(t){if(t instanceof cn){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=Tn.create(hr(r))}return new cn({...t._def,shape:()=>e})}else return t instanceof Cr?new Cr({...t._def,type:hr(t.element)}):t instanceof Tn?Tn.create(hr(t.unwrap())):t instanceof Ir?Ir.create(hr(t.unwrap())):t instanceof Cs?Cs.create(t.items.map(e=>hr(e))):t}let cn=class Ot extends he{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=de.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==F.object){const l=this._getOrReturnCtx(e);return D(l,{code:M.invalid_type,expected:F.object,received:l.parsedType}),K}const{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof En&&this._def.unknownKeys==="strip"))for(const l in s.data)o.includes(l)||a.push(l);const c=[];for(const l of o){const u=i[l],h=s.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Cn(s,h,s.path,l)),alwaysSet:l in s.data})}if(this._def.catchall instanceof En){const l=this._def.unknownKeys;if(l==="passthrough")for(const u of a)c.push({key:{status:"valid",value:u},value:{status:"valid",value:s.data[u]}});else if(l==="strict")a.length>0&&(D(s,{code:M.unrecognized_keys,keys:a}),r.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const u of a){const h=s.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Cn(s,h,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const l=[];for(const u of c){const h=await u.key,f=await u.value;l.push({key:h,value:f,alwaysSet:u.alwaysSet})}return l}).then(l=>Lt.mergeObjectSync(r,l)):Lt.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(e){return U.errToObj,new Ot({...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:U.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new Ot({...this._def,unknownKeys:"strip"})}passthrough(){return new Ot({...this._def,unknownKeys:"passthrough"})}extend(e){return new Ot({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Ot({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Q.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new Ot({...this._def,catchall:e})}pick(e){const n={};for(const r of de.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new Ot({...this._def,shape:()=>n})}omit(e){const n={};for(const r of de.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new Ot({...this._def,shape:()=>n})}deepPartial(){return hr(this)}partial(e){const n={};for(const r of de.objectKeys(this.shape)){const s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}return new Ot({...this._def,shape:()=>n})}required(e){const n={};for(const r of de.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof Tn;)i=i._def.innerType;n[r]=i}return new Ot({...this._def,shape:()=>n})}keyof(){return Af(de.objectKeys(this.shape))}};cn.create=(t,e)=>new cn({shape:()=>t,unknownKeys:"strip",catchall:En.create(),typeName:Q.ZodObject,...se(e)});cn.strictCreate=(t,e)=>new cn({shape:()=>t,unknownKeys:"strict",catchall:En.create(),typeName:Q.ZodObject,...se(e)});cn.lazycreate=(t,e)=>new cn({shape:t,unknownKeys:"strip",catchall:En.create(),typeName:Q.ZodObject,...se(e)});let Oi=class extends he{_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 qn(a.ctx.common.issues));return D(n,{code:M.invalid_union,unionErrors:o}),K}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 c of r){const l={...n,common:{...n.common,issues:[]},parent:null},u=c._parseSync({data:n.data,path:n.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const a=o.map(c=>new qn(c));return D(n,{code:M.invalid_union,unionErrors:a}),K}}get options(){return this._def.options}};Oi.create=(t,e)=>new Oi({options:t,typeName:Q.ZodUnion,...se(e)});function Da(t,e){const n=_n(t),r=_n(e);if(t===e)return{valid:!0,data:t};if(n===F.object&&r===F.object){const s=de.objectKeys(e),i=de.objectKeys(t).filter(a=>s.indexOf(a)!==-1),o={...t,...e};for(const a of i){const c=Da(t[a],e[a]);if(!c.valid)return{valid:!1};o[a]=c.data}return{valid:!0,data:o}}else if(n===F.array&&r===F.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],c=Da(o,a);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return n===F.date&&r===F.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}let $i=class extends he{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=(i,o)=>{if($u(i)||$u(o))return K;const a=Da(i.value,o.value);return a.valid?((zu(i)||zu(o))&&n.dirty(),{status:n.value,value:a.data}):(D(r,{code:M.invalid_intersection_types}),K)};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}))}};$i.create=(t,e,n)=>new $i({left:t,right:e,typeName:Q.ZodIntersection,...se(n)});let Cs=class Tf extends he{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==F.array)return D(r,{code:M.invalid_type,expected:F.array,received:r.parsedType}),K;if(r.data.length<this._def.items.length)return D(r,{code:M.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),K;!this._def.rest&&r.data.length>this._def.items.length&&(D(r,{code:M.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((o,a)=>{const c=this._def.items[a]||this._def.rest;return c?c._parse(new Cn(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>Lt.mergeArray(n,o)):Lt.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new Tf({...this._def,rest:e})}};Cs.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Cs({items:t,typeName:Q.ZodTuple,rest:null,...se(e)})};let Hu=class extends he{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!==F.map)return D(r,{code:M.invalid_type,expected:F.map,received:r.parsedType}),K;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([a,c],l)=>({key:s._parse(new Cn(r,a,r.path,[l,"key"])),value:i._parse(new Cn(r,c,r.path,[l,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const c of o){const l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return K;(l.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(l.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const c of o){const l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return K;(l.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(l.value,u.value)}return{status:n.value,value:a}}}};Hu.create=(t,e,n)=>new Hu({valueType:e,keyType:t,typeName:Q.ZodMap,...se(n)});let Wu=class La extends he{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==F.set)return D(r,{code:M.invalid_type,expected:F.set,received:r.parsedType}),K;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(D(r,{code:M.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&&(D(r,{code:M.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(c){const l=new Set;for(const u of c){if(u.status==="aborted")return K;u.status==="dirty"&&n.dirty(),l.add(u.value)}return{status:n.value,value:l}}const a=[...r.data.values()].map((c,l)=>i._parse(new Cn(r,c,r.path,l)));return r.common.async?Promise.all(a).then(c=>o(c)):o(a)}min(e,n){return new La({...this._def,minSize:{value:e,message:U.toString(n)}})}max(e,n){return new La({...this._def,maxSize:{value:e,message:U.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};Wu.create=(t,e)=>new Wu({valueType:t,minSize:null,maxSize:null,typeName:Q.ZodSet,...se(e)});let Yu=class extends he{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})}};Yu.create=(t,e)=>new Yu({getter:t,typeName:Q.ZodLazy,...se(e)});let Za=class extends he{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return D(n,{received:n.data,code:M.invalid_literal,expected:this._def.value}),K}return{status:"valid",value:e.data}}get value(){return this._def.value}};Za.create=(t,e)=>new Za({value:t,typeName:Q.ZodLiteral,...se(e)});function Af(t,e){return new Ic({values:t,typeName:Q.ZodEnum,...se(e)})}let Ic=class Fa extends he{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return D(n,{expected:de.joinValues(r),received:n.parsedType,code:M.invalid_type}),K}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 D(n,{received:n.data,code:M.invalid_enum_value,options:r}),K}return Tt(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 Fa.create(e,{...this._def,...n})}exclude(e,n=this._def){return Fa.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};Ic.create=Af;let qu=class extends he{_parse(e){const n=de.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==F.string&&r.parsedType!==F.number){const s=de.objectValues(n);return D(r,{expected:de.joinValues(s),received:r.parsedType,code:M.invalid_type}),K}if(this._cache||(this._cache=new Set(de.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=de.objectValues(n);return D(r,{received:r.data,code:M.invalid_enum_value,options:s}),K}return Tt(e.data)}get enum(){return this._def.values}};qu.create=(t,e)=>new qu({values:t,typeName:Q.ZodNativeEnum,...se(e)});let zi=class extends he{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==F.promise&&n.common.async===!1)return D(n,{code:M.invalid_type,expected:F.promise,received:n.parsedType}),K;const r=n.parsedType===F.promise?n.data:Promise.resolve(n.data);return Tt(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}};zi.create=(t,e)=>new zi({type:t,typeName:Q.ZodPromise,...se(e)});let Er=class extends he{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Q.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=>{D(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 K;const c=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return c.status==="aborted"?K:c.status==="dirty"||n.value==="dirty"?us(c.value):c});{if(n.value==="aborted")return K;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?K:a.status==="dirty"||n.value==="dirty"?us(a.value):a}}if(s.type==="refinement"){const o=a=>{const c=s.refinement(a,i);if(r.common.async)return Promise.resolve(c);if(c 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"?K:(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"?K:(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(!Ar(o))return K;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=>Ar(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:n.value,value:a})):K);de.assertNever(s)}};Er.create=(t,e,n)=>new Er({schema:t,typeName:Q.ZodEffects,effect:e,...se(n)});Er.createWithPreprocess=(t,e,n)=>new Er({schema:e,effect:{type:"preprocess",transform:t},typeName:Q.ZodEffects,...se(n)});let Tn=class extends he{_parse(e){return this._getType(e)===F.undefined?Tt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Tn.create=(t,e)=>new Tn({innerType:t,typeName:Q.ZodOptional,...se(e)});let Ir=class extends he{_parse(e){return this._getType(e)===F.null?Tt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ir.create=(t,e)=>new Ir({innerType:t,typeName:Q.ZodNullable,...se(e)});let Ba=class extends he{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===F.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};Ba.create=(t,e)=>new Ba({innerType:t,typeName:Q.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...se(e)});let Ua=class extends he{_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 Ri(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new qn(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new qn(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Ua.create=(t,e)=>new Ua({innerType:t,typeName:Q.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...se(e)});let Xu=class extends he{_parse(e){if(this._getType(e)!==F.nan){const r=this._getOrReturnCtx(e);return D(r,{code:M.invalid_type,expected:F.nan,received:r.parsedType}),K}return{status:"valid",value:e.data}}};Xu.create=t=>new Xu({typeName:Q.ZodNaN,...se(t)});let Ix=class extends he{_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}},Px=class Cf extends he{_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"?K:i.status==="dirty"?(n.dirty(),us(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"?K: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 Cf({in:e,out:n,typeName:Q.ZodPipeline})}},ja=class extends he{_parse(e){const n=this._def.innerType._parse(e),r=s=>(Ar(s)&&(s.value=Object.freeze(s.value)),s);return Ri(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}};ja.create=(t,e)=>new ja({innerType:t,typeName:Q.ZodReadonly,...se(e)});var Q;(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"})(Q||(Q={}));const Nr=Oa.create,Es=$a.create;En.create;Cr.create;const Xn=cn.create,Ga=Oi.create;$i.create;Cs.create;const Be=Za.create,Ni=Ic.create;zi.create;Tn.create;Ir.create;const Qe=Nr().trim().min(1),Dr=Nr().trim().min(1),to=Es().finite().positive(),Pc=Xn({status:Ni(["available","sold"]),soldToPlayerId:Qe.optional(),soldAt:Dr.optional()});Xn({id:Qe,spaceId:Qe,type:Ni(["book","music","coffee"]),name:Qe,description:Nr(),priceUsd:to,createdAt:Dr,sale:Pc});Xn({id:Qe,spaceId:Qe,row:Ga([Be(1),Be(2),Be(3),Be(4)]),column:Ga([Be(1),Be(2),Be(3),Be(4),Be(5)]),name:Qe,description:Nr(),priceUsd:to,createdAt:Dr,sale:Pc});const Mx=Nr().trim().regex(/^#[0-9a-fA-F]{6}$/,"expected #rrggbb hex color");Xn({id:Qe,spaceId:Qe,slot:Ga([Be(1),Be(2),Be(3),Be(4),Be(5),Be(6),Be(7),Be(8),Be(9)]),name:Qe,model:Qe,year:Es().int().min(1900).max(3e3),priceUsd:to,colorHex:Mx,createdAt:Dr,sale:Pc});Xn({playerId:Qe,balanceUsd:Es().finite().nonnegative(),currency:Be("USD"),updatedAt:Dr,powerUps:Es().int().nonnegative().default(0)});Xn({id:Qe,playerId:Qe,spaceId:Qe,amenityKind:Ni(["shop","supermarket","car_wash","talk_time","wallet_bundle"]),itemRef:Xn({kind:Ni(["shop","supermarket","carwash"]),id:Qe}),priceUsd:to,at:Dr,detail:Nr().optional(),powerUpsSpent:Es().int().positive().optional()});function Rx(){return["park","new_york","tokyo"]}const Ox="agent-play-preview-view-settings-v2",$x="agent-play-deep-logs",zx=["English","Yoruba","Igbo","Hausa","French","Spanish","Portuguese","German","Italian","Arabic","Swahili","Mandarin Chinese","Hindi","Japanese"];function Nx(){if(typeof window>"u")return!1;const t=window.location.hostname;return t==="localhost"||t==="127.0.0.1"||t==="::1"||t==="[::1]"}function Dx(){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 Ef(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 Lx(){if(typeof window>"u")return;const e=new URL(window.location.href).searchParams.get("deepLogs");if(e!==null)return Ef(e)}function Zx(){if(typeof localStorage>"u")return;const t=localStorage.getItem($x);if(!(t===null||t.length===0))return Ef(t)}function Fx(){const t=Lx();return t!==void 0?t:Zx()}function If(t){return t==="default"||t==="ember"||t==="forest"}function Pf(t){return t==="unspecified"||t==="feminine"||t==="masculine"||t==="neutral"}function Mf(t){return zx.includes(t)}function mr(){return{themeId:"park",showChatUi:!0,debugMode:Nx(),debugOccupancyQuartiles:!1,debugOccupancyFreeGrids:!1,worldGeographyEnabled:!1,joystickEnabled:!0,stationaryPanels:!1,p2aEnabled:!1,deepLogsEnabled:Dx(),profileAvatarPresetId:"default",profileGender:"unspecified",language:"English"}}function Rf(t){return Rx().includes(t)}function Bx(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"&&Rf(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.worldGeographyEnabled=="boolean"&&(r.worldGeographyEnabled=n.worldGeographyEnabled),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"&&If(n.profileAvatarPresetId)&&(r.profileAvatarPresetId=n.profileAvatarPresetId),typeof n.profileGender=="string"&&Pf(n.profileGender)&&(r.profileGender=n.profileGender),typeof n.language=="string"&&Mf(n.language)&&(r.language=n.language),Object.keys(r).length>0?r:null}catch{return null}}let Ju=mr();function Ux(t){const e=Rf(t.themeId)?t.themeId:mr().themeId,n=If(t.profileAvatarPresetId)?t.profileAvatarPresetId:mr().profileAvatarPresetId,r=Pf(t.profileGender)?t.profileGender:mr().profileGender,s=Mf(t.language)?t.language:mr().language;return{themeId:e,showChatUi:t.showChatUi,debugMode:t.debugMode,debugOccupancyQuartiles:t.debugOccupancyQuartiles,debugOccupancyFreeGrids:t.debugOccupancyFreeGrids,worldGeographyEnabled:t.worldGeographyEnabled,joystickEnabled:t.joystickEnabled,stationaryPanels:t.stationaryPanels,p2aEnabled:t.p2aEnabled,deepLogsEnabled:t.deepLogsEnabled,profileAvatarPresetId:n,profileGender:r,language:s}}function jx(){const t=Bx(typeof localStorage<"u"?localStorage.getItem(Ox):null),e={...mr(),...t},n=Fx();return Ju=Ux({...e,...n!==void 0?{deepLogsEnabled:n}:{}}),{...Ju}}typeof localStorage<"u"&&jx();var fe;(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})(fe||(fe={}));var Ku;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Ku||(Ku={}));const L=fe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),yn=t=>{switch(typeof t){case"undefined":return L.undefined;case"string":return L.string;case"number":return Number.isNaN(t)?L.nan:L.number;case"boolean":return L.boolean;case"function":return L.function;case"bigint":return L.bigint;case"symbol":return L.symbol;case"object":return Array.isArray(t)?L.array:t===null?L.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?L.promise:typeof Map<"u"&&t instanceof Map?L.map:typeof Set<"u"&&t instanceof Set?L.set:typeof Date<"u"&&t instanceof Date?L.date:L.object;default:return L.unknown}},I=fe.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 ln 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,c=0;for(;c<o.path.length;){const l=o.path[c];c===o.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(n(o))):a[l]=a[l]||{_errors:[]},a=a[l],c++}}};return s(this),r}static assert(e){if(!(e instanceof ln))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,fe.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()}}ln.create=t=>new ln(t);const Va=(t,e)=>{let n;switch(t.code){case I.invalid_type:t.received===L.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case I.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,fe.jsonStringifyReplacer)}`;break;case I.unrecognized_keys:n=`Unrecognized key(s) in object: ${fe.joinValues(t.keys,", ")}`;break;case I.invalid_union:n="Invalid input";break;case I.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${fe.joinValues(t.options)}`;break;case I.invalid_enum_value:n=`Invalid enum value. Expected ${fe.joinValues(t.options)}, received '${t.received}'`;break;case I.invalid_arguments:n="Invalid function arguments";break;case I.invalid_return_type:n="Invalid function return type";break;case I.invalid_date:n="Invalid date";break;case I.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}"`:fe.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case I.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 I.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 I.custom:n="Invalid input";break;case I.invalid_intersection_types:n="Intersection results could not be merged";break;case I.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case I.not_finite:n="Number must be finite";break;default:n=e.defaultError,fe.assertNever(t)}return{message:n}};let Gx=Va;function Vx(){return Gx}const Hx=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 c=r.filter(l=>!!l).slice().reverse();for(const l of c)a=l(o,{data:e,defaultError:a}).message;return{...s,path:i,message:a}};function N(t,e){const n=Vx(),r=Hx({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Va?void 0:Va].filter(s=>!!s)});t.common.issues.push(r)}class it{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 X;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 it.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 X;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 X=Object.freeze({status:"aborted"}),ds=t=>({status:"dirty",value:t}),At=t=>({status:"valid",value:t}),Qu=t=>t.status==="aborted",eh=t=>t.status==="dirty",Pr=t=>t.status==="valid",Di=t=>typeof Promise<"u"&&t instanceof Promise;var j;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(j||(j={}));class Yt{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 th=(t,e)=>{if(Pr(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 ln(t.common.issues);return this._error=n,this._error}}};function ne(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:c}=t;return o.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:c??n??a.defaultError}},description:s}}let ae=class{get description(){return this._def.description}_getType(e){return yn(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:yn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new it,ctx:{common:e.parent.common,data:e.data,parsedType:yn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Di(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:yn(e)},s=this._parseSync({data:e,path:r.path,parent:r});return th(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:yn(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:n});return Pr(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=>Pr(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:yn(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(Di(s)?s:Promise.resolve(s));return th(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:I.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!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 Rr({schema:this,typeName:q.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 An.create(this,this._def)}nullable(){return Or.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Mr.create(this)}promise(){return Ui.create(this,this._def)}or(e){return Fi.create([this,e],this._def)}and(e){return Bi.create(this,e,this._def)}transform(e){return new Rr({...ne(this._def),schema:this,typeName:q.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Ka({...ne(this._def),innerType:this,defaultValue:n,typeName:q.ZodDefault})}brand(){return new gb({typeName:q.ZodBranded,type:this,...ne(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new Qa({...ne(this._def),innerType:this,catchValue:n,typeName:q.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Rc.create(this,e)}readonly(){return ec.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const Wx=/^c[^\s-]{8,}$/i,Yx=/^[0-9a-z]+$/,qx=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Xx=/^[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,Jx=/^[a-z0-9_-]{21}$/i,Kx=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Qx=/^[-+]?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)?)??$/,eb=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,tb="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Xo;const nb=/^(?:(?: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])$/,rb=/^(?:(?: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])$/,sb=/^(([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]))$/,ib=/^(([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])$/,ob=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ab=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Of="((\\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])))",cb=new RegExp(`^${Of}$`);function $f(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 lb(t){return new RegExp(`^${$f(t)}$`)}function ub(t){let e=`${Of}T${$f(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 hb(t,e){return!!((e==="v4"||!e)&&nb.test(t)||(e==="v6"||!e)&&sb.test(t))}function db(t,e){if(!Kx.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 fb(t,e){return!!((e==="v4"||!e)&&rb.test(t)||(e==="v6"||!e)&&ib.test(t))}let Li=class fs extends ae{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==L.string){const i=this._getOrReturnCtx(e);return N(i,{code:I.invalid_type,expected:L.string,received:i.parsedType}),X}const r=new it;let s;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),N(s,{code:I.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),N(s,{code:I.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?N(s,{code:I.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&N(s,{code:I.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")eb.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"email",code:I.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Xo||(Xo=new RegExp(tb,"u")),Xo.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"emoji",code:I.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")Xx.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"uuid",code:I.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")Jx.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"nanoid",code:I.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")Wx.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"cuid",code:I.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")Yx.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"cuid2",code:I.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")qx.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"ulid",code:I.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),N(s,{validation:"url",code:I.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),N(s,{validation:"regex",code:I.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),N(s,{code:I.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),N(s,{code:I.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),N(s,{code:I.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?ub(i).test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{code:I.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?cb.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{code:I.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?lb(i).test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{code:I.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?Qx.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"duration",code:I.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?hb(e.data,i.version)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"ip",code:I.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?db(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"jwt",code:I.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?fb(e.data,i.version)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"cidr",code:I.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?ob.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"base64",code:I.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?ab.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"base64url",code:I.invalid_string,message:i.message}),r.dirty()):fe.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:I.invalid_string,...j.errToObj(r)})}_addCheck(e){return new fs({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...j.errToObj(e)})}url(e){return this._addCheck({kind:"url",...j.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...j.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...j.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...j.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...j.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...j.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...j.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...j.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...j.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...j.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...j.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...j.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,...j.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,...j.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...j.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...j.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...j.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...j.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...j.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...j.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...j.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...j.errToObj(n)})}nonempty(e){return this.min(1,j.errToObj(e))}trim(){return new fs({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new fs({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new fs({...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}};Li.create=t=>new Li({checks:[],typeName:q.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...ne(t)});function pb(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 nh=class Ha extends ae{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)!==L.number){const i=this._getOrReturnCtx(e);return N(i,{code:I.invalid_type,expected:L.number,received:i.parsedType}),X}let r;const s=new it;for(const i of this._def.checks)i.kind==="int"?fe.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),N(r,{code:I.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),N(r,{code:I.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),N(r,{code:I.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?pb(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),N(r,{code:I.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),N(r,{code:I.not_finite,message:i.message}),s.dirty()):fe.assertNever(i);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,j.toString(n))}gt(e,n){return this.setLimit("min",e,!1,j.toString(n))}lte(e,n){return this.setLimit("max",e,!0,j.toString(n))}lt(e,n){return this.setLimit("max",e,!1,j.toString(n))}setLimit(e,n,r,s){return new Ha({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:j.toString(s)}]})}_addCheck(e){return new Ha({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:j.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:j.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:j.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:j.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:j.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:j.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:j.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:j.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:j.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"&&fe.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)}};nh.create=t=>new nh({checks:[],typeName:q.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...ne(t)});class Is extends ae{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)!==L.bigint)return this._getInvalidInput(e);let r;const s=new it;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),N(r,{code:I.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),N(r,{code:I.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),N(r,{code:I.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):fe.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return N(n,{code:I.invalid_type,expected:L.bigint,received:n.parsedType}),X}gte(e,n){return this.setLimit("min",e,!0,j.toString(n))}gt(e,n){return this.setLimit("min",e,!1,j.toString(n))}lte(e,n){return this.setLimit("max",e,!0,j.toString(n))}lt(e,n){return this.setLimit("max",e,!1,j.toString(n))}setLimit(e,n,r,s){return new Is({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:j.toString(s)}]})}_addCheck(e){return new Is({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:j.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:j.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:j.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:j.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:j.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}}Is.create=t=>new Is({checks:[],typeName:q.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...ne(t)});let rh=class extends ae{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==L.boolean){const r=this._getOrReturnCtx(e);return N(r,{code:I.invalid_type,expected:L.boolean,received:r.parsedType}),X}return At(e.data)}};rh.create=t=>new rh({typeName:q.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...ne(t)});class Zi extends ae{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==L.date){const i=this._getOrReturnCtx(e);return N(i,{code:I.invalid_type,expected:L.date,received:i.parsedType}),X}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return N(i,{code:I.invalid_date}),X}const r=new it;let s;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),N(s,{code:I.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),N(s,{code:I.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):fe.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Zi({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:j.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:j.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}}Zi.create=t=>new Zi({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:q.ZodDate,...ne(t)});class sh extends ae{_parse(e){if(this._getType(e)!==L.symbol){const r=this._getOrReturnCtx(e);return N(r,{code:I.invalid_type,expected:L.symbol,received:r.parsedType}),X}return At(e.data)}}sh.create=t=>new sh({typeName:q.ZodSymbol,...ne(t)});class ih extends ae{_parse(e){if(this._getType(e)!==L.undefined){const r=this._getOrReturnCtx(e);return N(r,{code:I.invalid_type,expected:L.undefined,received:r.parsedType}),X}return At(e.data)}}ih.create=t=>new ih({typeName:q.ZodUndefined,...ne(t)});class oh extends ae{_parse(e){if(this._getType(e)!==L.null){const r=this._getOrReturnCtx(e);return N(r,{code:I.invalid_type,expected:L.null,received:r.parsedType}),X}return At(e.data)}}oh.create=t=>new oh({typeName:q.ZodNull,...ne(t)});let ah=class extends ae{constructor(){super(...arguments),this._any=!0}_parse(e){return At(e.data)}};ah.create=t=>new ah({typeName:q.ZodAny,...ne(t)});let Wa=class extends ae{constructor(){super(...arguments),this._unknown=!0}_parse(e){return At(e.data)}};Wa.create=t=>new Wa({typeName:q.ZodUnknown,...ne(t)});let In=class extends ae{_parse(e){const n=this._getOrReturnCtx(e);return N(n,{code:I.invalid_type,expected:L.never,received:n.parsedType}),X}};In.create=t=>new In({typeName:q.ZodNever,...ne(t)});class ch extends ae{_parse(e){if(this._getType(e)!==L.undefined){const r=this._getOrReturnCtx(e);return N(r,{code:I.invalid_type,expected:L.void,received:r.parsedType}),X}return At(e.data)}}ch.create=t=>new ch({typeName:q.ZodVoid,...ne(t)});let Mr=class Ai extends ae{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==L.array)return N(n,{code:I.invalid_type,expected:L.array,received:n.parsedType}),X;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,a=n.data.length<s.exactLength.value;(o||a)&&(N(n,{code:o?I.too_big:I.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(n,{code:I.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(n,{code:I.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 Yt(n,o,n.path,a)))).then(o=>it.mergeArray(r,o));const i=[...n.data].map((o,a)=>s.type._parseSync(new Yt(n,o,n.path,a)));return it.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new Ai({...this._def,minLength:{value:e,message:j.toString(n)}})}max(e,n){return new Ai({...this._def,maxLength:{value:e,message:j.toString(n)}})}length(e,n){return new Ai({...this._def,exactLength:{value:e,message:j.toString(n)}})}nonempty(e){return this.min(1,e)}};Mr.create=(t,e)=>new Mr({type:t,minLength:null,maxLength:null,exactLength:null,typeName:q.ZodArray,...ne(e)});function dr(t){if(t instanceof un){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=An.create(dr(r))}return new un({...t._def,shape:()=>e})}else return t instanceof Mr?new Mr({...t._def,type:dr(t.element)}):t instanceof An?An.create(dr(t.unwrap())):t instanceof Or?Or.create(dr(t.unwrap())):t instanceof Jn?Jn.create(t.items.map(e=>dr(e))):t}let un=class $t extends ae{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=fe.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==L.object){const l=this._getOrReturnCtx(e);return N(l,{code:I.invalid_type,expected:L.object,received:l.parsedType}),X}const{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof In&&this._def.unknownKeys==="strip"))for(const l in s.data)o.includes(l)||a.push(l);const c=[];for(const l of o){const u=i[l],h=s.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Yt(s,h,s.path,l)),alwaysSet:l in s.data})}if(this._def.catchall instanceof In){const l=this._def.unknownKeys;if(l==="passthrough")for(const u of a)c.push({key:{status:"valid",value:u},value:{status:"valid",value:s.data[u]}});else if(l==="strict")a.length>0&&(N(s,{code:I.unrecognized_keys,keys:a}),r.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const u of a){const h=s.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Yt(s,h,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const l=[];for(const u of c){const h=await u.key,f=await u.value;l.push({key:h,value:f,alwaysSet:u.alwaysSet})}return l}).then(l=>it.mergeObjectSync(r,l)):it.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(e){return j.errToObj,new $t({...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:j.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new $t({...this._def,unknownKeys:"strip"})}passthrough(){return new $t({...this._def,unknownKeys:"passthrough"})}extend(e){return new $t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new $t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:q.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new $t({...this._def,catchall:e})}pick(e){const n={};for(const r of fe.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new $t({...this._def,shape:()=>n})}omit(e){const n={};for(const r of fe.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new $t({...this._def,shape:()=>n})}deepPartial(){return dr(this)}partial(e){const n={};for(const r of fe.objectKeys(this.shape)){const s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}return new $t({...this._def,shape:()=>n})}required(e){const n={};for(const r of fe.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof An;)i=i._def.innerType;n[r]=i}return new $t({...this._def,shape:()=>n})}keyof(){return zf(fe.objectKeys(this.shape))}};un.create=(t,e)=>new un({shape:()=>t,unknownKeys:"strip",catchall:In.create(),typeName:q.ZodObject,...ne(e)});un.strictCreate=(t,e)=>new un({shape:()=>t,unknownKeys:"strict",catchall:In.create(),typeName:q.ZodObject,...ne(e)});un.lazycreate=(t,e)=>new un({shape:t,unknownKeys:"strip",catchall:In.create(),typeName:q.ZodObject,...ne(e)});let Fi=class extends ae{_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 ln(a.ctx.common.issues));return N(n,{code:I.invalid_union,unionErrors:o}),X}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 c of r){const l={...n,common:{...n.common,issues:[]},parent:null},u=c._parseSync({data:n.data,path:n.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const a=o.map(c=>new ln(c));return N(n,{code:I.invalid_union,unionErrors:a}),X}}get options(){return this._def.options}};Fi.create=(t,e)=>new Fi({options:t,typeName:q.ZodUnion,...ne(e)});function Ya(t,e){const n=yn(t),r=yn(e);if(t===e)return{valid:!0,data:t};if(n===L.object&&r===L.object){const s=fe.objectKeys(e),i=fe.objectKeys(t).filter(a=>s.indexOf(a)!==-1),o={...t,...e};for(const a of i){const c=Ya(t[a],e[a]);if(!c.valid)return{valid:!1};o[a]=c.data}return{valid:!0,data:o}}else if(n===L.array&&r===L.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],c=Ya(o,a);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return n===L.date&&r===L.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}let Bi=class extends ae{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=(i,o)=>{if(Qu(i)||Qu(o))return X;const a=Ya(i.value,o.value);return a.valid?((eh(i)||eh(o))&&n.dirty(),{status:n.value,value:a.data}):(N(r,{code:I.invalid_intersection_types}),X)};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}))}};Bi.create=(t,e,n)=>new Bi({left:t,right:e,typeName:q.ZodIntersection,...ne(n)});class Jn extends ae{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==L.array)return N(r,{code:I.invalid_type,expected:L.array,received:r.parsedType}),X;if(r.data.length<this._def.items.length)return N(r,{code:I.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),X;!this._def.rest&&r.data.length>this._def.items.length&&(N(r,{code:I.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((o,a)=>{const c=this._def.items[a]||this._def.rest;return c?c._parse(new Yt(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>it.mergeArray(n,o)):it.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new Jn({...this._def,rest:e})}}Jn.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Jn({items:t,typeName:q.ZodTuple,rest:null,...ne(e)})};let mb=class qa extends ae{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!==L.object)return N(r,{code:I.invalid_type,expected:L.object,received:r.parsedType}),X;const s=[],i=this._def.keyType,o=this._def.valueType;for(const a in r.data)s.push({key:i._parse(new Yt(r,a,r.path,a)),value:o._parse(new Yt(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?it.mergeObjectAsync(n,s):it.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof ae?new qa({keyType:e,valueType:n,typeName:q.ZodRecord,...ne(r)}):new qa({keyType:Li.create(),valueType:e,typeName:q.ZodRecord,...ne(n)})}};class lh extends ae{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!==L.map)return N(r,{code:I.invalid_type,expected:L.map,received:r.parsedType}),X;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([a,c],l)=>({key:s._parse(new Yt(r,a,r.path,[l,"key"])),value:i._parse(new Yt(r,c,r.path,[l,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const c of o){const l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return X;(l.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(l.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const c of o){const l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return X;(l.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(l.value,u.value)}return{status:n.value,value:a}}}}lh.create=(t,e,n)=>new lh({valueType:e,keyType:t,typeName:q.ZodMap,...ne(n)});class Ps extends ae{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==L.set)return N(r,{code:I.invalid_type,expected:L.set,received:r.parsedType}),X;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(N(r,{code:I.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&&(N(r,{code:I.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(c){const l=new Set;for(const u of c){if(u.status==="aborted")return X;u.status==="dirty"&&n.dirty(),l.add(u.value)}return{status:n.value,value:l}}const a=[...r.data.values()].map((c,l)=>i._parse(new Yt(r,c,r.path,l)));return r.common.async?Promise.all(a).then(c=>o(c)):o(a)}min(e,n){return new Ps({...this._def,minSize:{value:e,message:j.toString(n)}})}max(e,n){return new Ps({...this._def,maxSize:{value:e,message:j.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}Ps.create=(t,e)=>new Ps({valueType:t,minSize:null,maxSize:null,typeName:q.ZodSet,...ne(e)});let uh=class extends ae{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})}};uh.create=(t,e)=>new uh({getter:t,typeName:q.ZodLazy,...ne(e)});let Xa=class extends ae{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return N(n,{received:n.data,code:I.invalid_literal,expected:this._def.value}),X}return{status:"valid",value:e.data}}get value(){return this._def.value}};Xa.create=(t,e)=>new Xa({value:t,typeName:q.ZodLiteral,...ne(e)});function zf(t,e){return new Mc({values:t,typeName:q.ZodEnum,...ne(e)})}let Mc=class Ja extends ae{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return N(n,{expected:fe.joinValues(r),received:n.parsedType,code:I.invalid_type}),X}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(n,{received:n.data,code:I.invalid_enum_value,options:r}),X}return At(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 Ja.create(e,{...this._def,...n})}exclude(e,n=this._def){return Ja.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};Mc.create=zf;class hh extends ae{_parse(e){const n=fe.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==L.string&&r.parsedType!==L.number){const s=fe.objectValues(n);return N(r,{expected:fe.joinValues(s),received:r.parsedType,code:I.invalid_type}),X}if(this._cache||(this._cache=new Set(fe.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=fe.objectValues(n);return N(r,{received:r.data,code:I.invalid_enum_value,options:s}),X}return At(e.data)}get enum(){return this._def.values}}hh.create=(t,e)=>new hh({values:t,typeName:q.ZodNativeEnum,...ne(e)});class Ui extends ae{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==L.promise&&n.common.async===!1)return N(n,{code:I.invalid_type,expected:L.promise,received:n.parsedType}),X;const r=n.parsedType===L.promise?n.data:Promise.resolve(n.data);return At(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Ui.create=(t,e)=>new Ui({type:t,typeName:q.ZodPromise,...ne(e)});class Rr extends ae{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===q.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=>{N(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 X;const c=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return c.status==="aborted"?X:c.status==="dirty"||n.value==="dirty"?ds(c.value):c});{if(n.value==="aborted")return X;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?X:a.status==="dirty"||n.value==="dirty"?ds(a.value):a}}if(s.type==="refinement"){const o=a=>{const c=s.refinement(a,i);if(r.common.async)return Promise.resolve(c);if(c 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"?X:(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"?X:(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(!Pr(o))return X;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=>Pr(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:n.value,value:a})):X);fe.assertNever(s)}}Rr.create=(t,e,n)=>new Rr({schema:t,typeName:q.ZodEffects,effect:e,...ne(n)});Rr.createWithPreprocess=(t,e,n)=>new Rr({schema:e,effect:{type:"preprocess",transform:t},typeName:q.ZodEffects,...ne(n)});let An=class extends ae{_parse(e){return this._getType(e)===L.undefined?At(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};An.create=(t,e)=>new An({innerType:t,typeName:q.ZodOptional,...ne(e)});let Or=class extends ae{_parse(e){return this._getType(e)===L.null?At(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Or.create=(t,e)=>new Or({innerType:t,typeName:q.ZodNullable,...ne(e)});let Ka=class extends ae{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===L.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};Ka.create=(t,e)=>new Ka({innerType:t,typeName:q.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ne(e)});let Qa=class extends ae{_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 Di(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ln(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new ln(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Qa.create=(t,e)=>new Qa({innerType:t,typeName:q.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ne(e)});class dh extends ae{_parse(e){if(this._getType(e)!==L.nan){const r=this._getOrReturnCtx(e);return N(r,{code:I.invalid_type,expected:L.nan,received:r.parsedType}),X}return{status:"valid",value:e.data}}}dh.create=t=>new dh({typeName:q.ZodNaN,...ne(t)});class gb extends ae{_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 Rc extends ae{_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"?X:i.status==="dirty"?(n.dirty(),ds(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"?X: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 Rc({in:e,out:n,typeName:q.ZodPipeline})}}let ec=class extends ae{_parse(e){const n=this._def.innerType._parse(e),r=s=>(Pr(s)&&(s.value=Object.freeze(s.value)),s);return Di(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}};ec.create=(t,e)=>new ec({innerType:t,typeName:q.ZodReadonly,...ne(e)});var q;(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"})(q||(q={}));const ht=Li.create,Oc=Wa.create;In.create;Mr.create;const qs=un.create;Fi.create;Bi.create;Jn.create;const $c=mb.create,_b=Xa.create,Ms=Mc.create;Ui.create;An.create;Or.create;var yb=/^[a-z][a-z0-9-]*$/;function xb(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(!yb.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 bb(t){return xb(t).value}var Le=ht().trim().min(1),zc=ht().trim().transform(t=>(bb(t),t)),vb=qs({requestId:Le,mainNodeId:Le,fromPlayerId:Le,toPlayerId:Le,kind:Ms(["assist","chat","realtime"]),toolName:ht().optional(),args:$c(ht(),Oc()).optional(),text:ht().optional(),intercomAddress:zc.optional()}).superRefine((t,e)=>{t.kind==="assist"&&(t.toolName??"").trim().length===0&&e.addIssue({code:I.custom,path:["toolName"],message:"toolName is required for assist"}),t.kind==="chat"&&(t.text??"").trim().length===0&&e.addIssue({code:I.custom,path:["text"],message:"text is required for chat"})});qs({requestId:Le,mainNodeId:Le,toPlayerId:Le,fromPlayerId:Le,kind:Ms(["assist","chat","realtime"]),status:Ms(["started","stream","completed","failed","forwarded"]),toolName:ht().optional(),message:ht().optional(),result:$c(ht(),Oc()).optional(),error:ht().nullable().optional(),ts:Le,channelKey:ht().optional(),intercomAddress:zc.optional(),command:vb.optional()});qs({requestId:Le,mainNodeId:Le,toPlayerId:Le,fromPlayerId:Le,kind:Ms(["assist","chat","realtime"]),status:Ms(["stream","completed","failed"]),toolName:ht().optional(),message:ht().optional(),result:$c(ht(),Oc()).optional(),error:ht().nullable().optional(),ts:Le,intercomAddress:zc.optional()}).superRefine((t,e)=>{t.status==="failed"&&(t.error??"").trim().length===0&&e.addIssue({code:I.custom,path:["error"],message:"error is required when status is failed"})});qs({consent:_b(!0),nodeId:Le,passwHash:Le}).strict();qs({requestId:Le,mainNodeId:Le,fromPlayerId:Le,message:Le}).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:Nf,setPrototypeOf:fh,isFrozen:wb,getPrototypeOf:kb,getOwnPropertyDescriptor:Sb}=Object;let{freeze:ot,seal:St,create:Ci}=Object,{apply:tc,construct:nc}=typeof Reflect<"u"&&Reflect;ot||(ot=function(e){return e});St||(St=function(e){return e});tc||(tc=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)});nc||(nc=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 pi=at(Array.prototype.forEach),Tb=at(Array.prototype.lastIndexOf),ph=at(Array.prototype.pop),Qr=at(Array.prototype.push),Ab=at(Array.prototype.splice),Ei=at(String.prototype.toLowerCase),Jo=at(String.prototype.toString),Ko=at(String.prototype.match),es=at(String.prototype.replace),Cb=at(String.prototype.indexOf),Eb=at(String.prototype.trim),_t=at(Object.prototype.hasOwnProperty),tt=at(RegExp.prototype.test),ts=Ib(TypeError);function at(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 tc(t,e,r)}}function Ib(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return nc(t,n)}}function re(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ei;fh&&fh(t,null);let r=e.length;for(;r--;){let s=e[r];if(typeof s=="string"){const i=n(s);i!==s&&(wb(e)||(e[r]=i),s=i)}t[s]=!0}return t}function Pb(t){for(let e=0;e<t.length;e++)_t(t,e)||(t[e]=null);return t}function Ht(t){const e=Ci(null);for(const[n,r]of Nf(t))_t(t,n)&&(Array.isArray(r)?e[n]=Pb(r):r&&typeof r=="object"&&r.constructor===Object?e[n]=Ht(r):e[n]=r);return e}function ns(t,e){for(;t!==null;){const r=Sb(t,e);if(r){if(r.get)return at(r.get);if(typeof r.value=="function")return at(r.value)}t=kb(t)}function n(){return null}return n}const mh=ot(["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"]),Qo=ot(["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"]),ea=ot(["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"]),Mb=ot(["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"]),ta=ot(["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"]),Rb=ot(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),gh=ot(["#text"]),_h=ot(["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"]),na=ot(["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"]),yh=ot(["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"]),mi=ot(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ob=St(/\{\{[\w\W]*|[\w\W]*\}\}/gm),$b=St(/<%[\w\W]*|[\w\W]*%>/gm),zb=St(/\$\{[\w\W]*/gm),Nb=St(/^data-[\-\w.\u00B7-\uFFFF]+$/),Db=St(/^aria-[\-\w]+$/),Df=St(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Lb=St(/^(?:\w+script|data):/i),Zb=St(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Lf=St(/^html$/i),Fb=St(/^[a-z][.\w]*(-[.\w]+)+$/i);var xh=Object.freeze({__proto__:null,ARIA_ATTR:Db,ATTR_WHITESPACE:Zb,CUSTOM_ELEMENT:Fb,DATA_ATTR:Nb,DOCTYPE_NAME:Lf,ERB_EXPR:$b,IS_ALLOWED_URI:Df,IS_SCRIPT_OR_DATA:Lb,MUSTACHE_EXPR:Ob,TMPLIT_EXPR:zb});const rs={element:1,text:3,progressingInstruction:7,comment:8,document:9},Bb=function(){return typeof window>"u"?null:window},Ub=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}},bh=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Zf(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Bb();const e=V=>Zf(V);if(e.version="3.3.3",e.removed=[],!t||!t.document||t.document.nodeType!==rs.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:c,NodeFilter:l,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:h,DOMParser:f,trustedTypes:d}=t,m=c.prototype,_=ns(m,"cloneNode"),g=ns(m,"remove"),y=ns(m,"nextSibling"),b=ns(m,"childNodes"),w=ns(m,"parentNode");if(typeof o=="function"){const V=n.createElement("template");V.content&&V.content.ownerDocument&&(n=V.content.ownerDocument)}let k,E="";const{implementation:A,createNodeIterator:C,createDocumentFragment:Y,getElementsByTagName:J}=n,{importNode:z}=r;let $=bh();e.isSupported=typeof Nf=="function"&&typeof w=="function"&&A&&A.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:pe,ERB_EXPR:ye,TMPLIT_EXPR:xe,DATA_ATTR:hn,ARIA_ATTR:Z,IS_SCRIPT_OR_DATA:H,ATTR_WHITESPACE:dn,CUSTOM_ELEMENT:ue}=xh;let{IS_ALLOWED_URI:Et}=xh,Ie=null;const fn=re({},[...mh,...Qo,...ea,...ta,...gh]);let Re=null;const Br=re({},[..._h,...na,...yh,...mi]);let ke=Object.seal(Ci(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}})),It=null,zn=null;const Pt=Object.seal(Ci(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Nn=!0,pn=!0,tr=!1,Bt=!0,ct=!1,vt=!0,et=!1,Ur=!1,nr=!1,mn=!1,jr=!1,Js=!1,al=!0,cl=!1;const tm="user-content-";let fo=!0,Gr=!1,rr={},Ut=null;const po=re({},["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 ul=re({},["audio","video","img","source","image","track"]);let mo=null;const hl=re({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ks="http://www.w3.org/1998/Math/MathML",Qs="http://www.w3.org/2000/svg",Xt="http://www.w3.org/1999/xhtml";let sr=Xt,go=!1,_o=null;const nm=re({},[Ks,Qs,Xt],Jo);let ei=re({},["mi","mo","mn","ms","mtext"]),ti=re({},["annotation-xml"]);const rm=re({},["title","style","font","a","script"]);let Vr=null;const sm=["application/xhtml+xml","text/html"],im="text/html";let Fe=null,ir=null;const om=n.createElement("form"),dl=function(x){return x instanceof RegExp||x instanceof Function},yo=function(){let x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(ir&&ir===x)){if((!x||typeof x!="object")&&(x={}),x=Ht(x),Vr=sm.indexOf(x.PARSER_MEDIA_TYPE)===-1?im:x.PARSER_MEDIA_TYPE,Fe=Vr==="application/xhtml+xml"?Jo:Ei,Ie=_t(x,"ALLOWED_TAGS")?re({},x.ALLOWED_TAGS,Fe):fn,Re=_t(x,"ALLOWED_ATTR")?re({},x.ALLOWED_ATTR,Fe):Br,_o=_t(x,"ALLOWED_NAMESPACES")?re({},x.ALLOWED_NAMESPACES,Jo):nm,mo=_t(x,"ADD_URI_SAFE_ATTR")?re(Ht(hl),x.ADD_URI_SAFE_ATTR,Fe):hl,ll=_t(x,"ADD_DATA_URI_TAGS")?re(Ht(ul),x.ADD_DATA_URI_TAGS,Fe):ul,Ut=_t(x,"FORBID_CONTENTS")?re({},x.FORBID_CONTENTS,Fe):po,It=_t(x,"FORBID_TAGS")?re({},x.FORBID_TAGS,Fe):Ht({}),zn=_t(x,"FORBID_ATTR")?re({},x.FORBID_ATTR,Fe):Ht({}),rr=_t(x,"USE_PROFILES")?x.USE_PROFILES:!1,Nn=x.ALLOW_ARIA_ATTR!==!1,pn=x.ALLOW_DATA_ATTR!==!1,tr=x.ALLOW_UNKNOWN_PROTOCOLS||!1,Bt=x.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ct=x.SAFE_FOR_TEMPLATES||!1,vt=x.SAFE_FOR_XML!==!1,et=x.WHOLE_DOCUMENT||!1,mn=x.RETURN_DOM||!1,jr=x.RETURN_DOM_FRAGMENT||!1,Js=x.RETURN_TRUSTED_TYPE||!1,nr=x.FORCE_BODY||!1,al=x.SANITIZE_DOM!==!1,cl=x.SANITIZE_NAMED_PROPS||!1,fo=x.KEEP_CONTENT!==!1,Gr=x.IN_PLACE||!1,Et=x.ALLOWED_URI_REGEXP||Df,sr=x.NAMESPACE||Xt,ei=x.MATHML_TEXT_INTEGRATION_POINTS||ei,ti=x.HTML_INTEGRATION_POINTS||ti,ke=x.CUSTOM_ELEMENT_HANDLING||{},x.CUSTOM_ELEMENT_HANDLING&&dl(x.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ke.tagNameCheck=x.CUSTOM_ELEMENT_HANDLING.tagNameCheck),x.CUSTOM_ELEMENT_HANDLING&&dl(x.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ke.attributeNameCheck=x.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),x.CUSTOM_ELEMENT_HANDLING&&typeof x.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ke.allowCustomizedBuiltInElements=x.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ct&&(pn=!1),jr&&(mn=!0),rr&&(Ie=re({},gh),Re=Ci(null),rr.html===!0&&(re(Ie,mh),re(Re,_h)),rr.svg===!0&&(re(Ie,Qo),re(Re,na),re(Re,mi)),rr.svgFilters===!0&&(re(Ie,ea),re(Re,na),re(Re,mi)),rr.mathMl===!0&&(re(Ie,ta),re(Re,yh),re(Re,mi))),_t(x,"ADD_TAGS")||(Pt.tagCheck=null),_t(x,"ADD_ATTR")||(Pt.attributeCheck=null),x.ADD_TAGS&&(typeof x.ADD_TAGS=="function"?Pt.tagCheck=x.ADD_TAGS:(Ie===fn&&(Ie=Ht(Ie)),re(Ie,x.ADD_TAGS,Fe))),x.ADD_ATTR&&(typeof x.ADD_ATTR=="function"?Pt.attributeCheck=x.ADD_ATTR:(Re===Br&&(Re=Ht(Re)),re(Re,x.ADD_ATTR,Fe))),x.ADD_URI_SAFE_ATTR&&re(mo,x.ADD_URI_SAFE_ATTR,Fe),x.FORBID_CONTENTS&&(Ut===po&&(Ut=Ht(Ut)),re(Ut,x.FORBID_CONTENTS,Fe)),x.ADD_FORBID_CONTENTS&&(Ut===po&&(Ut=Ht(Ut)),re(Ut,x.ADD_FORBID_CONTENTS,Fe)),fo&&(Ie["#text"]=!0),et&&re(Ie,["html","head","body"]),Ie.table&&(re(Ie,["tbody"]),delete It.tbody),x.TRUSTED_TYPES_POLICY){if(typeof x.TRUSTED_TYPES_POLICY.createHTML!="function")throw ts('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof x.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ts('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');k=x.TRUSTED_TYPES_POLICY,E=k.createHTML("")}else k===void 0&&(k=Ub(d,s)),k!==null&&typeof E=="string"&&(E=k.createHTML(""));ot&&ot(x),ir=x}},fl=re({},[...Qo,...ea,...Mb]),pl=re({},[...ta,...Rb]),am=function(x){let P=w(x);(!P||!P.tagName)&&(P={namespaceURI:sr,tagName:"template"});const B=Ei(x.tagName),Pe=Ei(P.tagName);return _o[x.namespaceURI]?x.namespaceURI===Qs?P.namespaceURI===Xt?B==="svg":P.namespaceURI===Ks?B==="svg"&&(Pe==="annotation-xml"||ei[Pe]):!!fl[B]:x.namespaceURI===Ks?P.namespaceURI===Xt?B==="math":P.namespaceURI===Qs?B==="math"&&ti[Pe]:!!pl[B]:x.namespaceURI===Xt?P.namespaceURI===Qs&&!ti[Pe]||P.namespaceURI===Ks&&!ei[Pe]?!1:!pl[B]&&(rm[B]||!fl[B]):!!(Vr==="application/xhtml+xml"&&_o[x.namespaceURI]):!1},jt=function(x){Qr(e.removed,{element:x});try{w(x).removeChild(x)}catch{g(x)}},Dn=function(x,P){try{Qr(e.removed,{attribute:P.getAttributeNode(x),from:P})}catch{Qr(e.removed,{attribute:null,from:P})}if(P.removeAttribute(x),x==="is")if(mn||jr)try{jt(P)}catch{}else try{P.setAttribute(x,"")}catch{}},ml=function(x){let P=null,B=null;if(nr)x="<remove></remove>"+x;else{const De=Ko(x,/^[\r\n\t ]+/);B=De&&De[0]}Vr==="application/xhtml+xml"&&sr===Xt&&(x='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+x+"</body></html>");const Pe=k?k.createHTML(x):x;if(sr===Xt)try{P=new f().parseFromString(Pe,Vr)}catch{}if(!P||!P.documentElement){P=A.createDocument(sr,"template",null);try{P.documentElement.innerHTML=go?E:Pe}catch{}}const Ye=P.body||P.documentElement;return x&&B&&Ye.insertBefore(n.createTextNode(B),Ye.childNodes[0]||null),sr===Xt?J.call(P,et?"html":"body")[0]:et?P.documentElement:Ye},gl=function(x){return C.call(x.ownerDocument||x,x,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},xo=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")},_l=function(x){return typeof a=="function"&&x instanceof a};function Jt(V,x,P){pi(V,B=>{B.call(e,x,P,ir)})}const yl=function(x){let P=null;if(Jt($.beforeSanitizeElements,x,null),xo(x))return jt(x),!0;const B=Fe(x.nodeName);if(Jt($.uponSanitizeElement,x,{tagName:B,allowedTags:Ie}),vt&&x.hasChildNodes()&&!_l(x.firstElementChild)&&tt(/<[/\w!]/g,x.innerHTML)&&tt(/<[/\w!]/g,x.textContent)||x.nodeType===rs.progressingInstruction||vt&&x.nodeType===rs.comment&&tt(/<[/\w]/g,x.data))return jt(x),!0;if(!(Pt.tagCheck instanceof Function&&Pt.tagCheck(B))&&(!Ie[B]||It[B])){if(!It[B]&&bl(B)&&(ke.tagNameCheck instanceof RegExp&&tt(ke.tagNameCheck,B)||ke.tagNameCheck instanceof Function&&ke.tagNameCheck(B)))return!1;if(fo&&!Ut[B]){const Pe=w(x)||x.parentNode,Ye=b(x)||x.childNodes;if(Ye&&Pe){const De=Ye.length;for(let lt=De-1;lt>=0;--lt){const Kt=_(Ye[lt],!0);Kt.__removalCount=(x.__removalCount||0)+1,Pe.insertBefore(Kt,y(x))}}}return jt(x),!0}return x instanceof c&&!am(x)||(B==="noscript"||B==="noembed"||B==="noframes")&&tt(/<\/no(script|embed|frames)/i,x.innerHTML)?(jt(x),!0):(ct&&x.nodeType===rs.text&&(P=x.textContent,pi([pe,ye,xe],Pe=>{P=es(P,Pe," ")}),x.textContent!==P&&(Qr(e.removed,{element:x.cloneNode()}),x.textContent=P)),Jt($.afterSanitizeElements,x,null),!1)},xl=function(x,P,B){if(zn[P]||al&&(P==="id"||P==="name")&&(B in n||B in om))return!1;if(!(pn&&!zn[P]&&tt(hn,P))){if(!(Nn&&tt(Z,P))){if(!(Pt.attributeCheck instanceof Function&&Pt.attributeCheck(P,x))){if(!Re[P]||zn[P]){if(!(bl(x)&&(ke.tagNameCheck instanceof RegExp&&tt(ke.tagNameCheck,x)||ke.tagNameCheck instanceof Function&&ke.tagNameCheck(x))&&(ke.attributeNameCheck instanceof RegExp&&tt(ke.attributeNameCheck,P)||ke.attributeNameCheck instanceof Function&&ke.attributeNameCheck(P,x))||P==="is"&&ke.allowCustomizedBuiltInElements&&(ke.tagNameCheck instanceof RegExp&&tt(ke.tagNameCheck,B)||ke.tagNameCheck instanceof Function&&ke.tagNameCheck(B))))return!1}else if(!mo[P]){if(!tt(Et,es(B,dn,""))){if(!((P==="src"||P==="xlink:href"||P==="href")&&x!=="script"&&Cb(B,"data:")===0&&ll[x])){if(!(tr&&!tt(H,es(B,dn,"")))){if(B)return!1}}}}}}}return!0},bl=function(x){return x!=="annotation-xml"&&Ko(x,ue)},vl=function(x){Jt($.beforeSanitizeAttributes,x,null);const{attributes:P}=x;if(!P||xo(x))return;const B={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Re,forceKeepAttr:void 0};let Pe=P.length;for(;Pe--;){const Ye=P[Pe],{name:De,namespaceURI:lt,value:Kt}=Ye,or=Fe(De),bo=Kt;let Ve=De==="value"?bo:Eb(bo);if(B.attrName=or,B.attrValue=Ve,B.keepAttr=!0,B.forceKeepAttr=void 0,Jt($.uponSanitizeAttribute,x,B),Ve=B.attrValue,cl&&(or==="id"||or==="name")&&(Dn(De,x),Ve=tm+Ve),vt&&tt(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Ve)){Dn(De,x);continue}if(or==="attributename"&&Ko(Ve,"href")){Dn(De,x);continue}if(B.forceKeepAttr)continue;if(!B.keepAttr){Dn(De,x);continue}if(!Bt&&tt(/\/>/i,Ve)){Dn(De,x);continue}ct&&pi([pe,ye,xe],kl=>{Ve=es(Ve,kl," ")});const wl=Fe(x.nodeName);if(!xl(wl,or,Ve)){Dn(De,x);continue}if(k&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!lt)switch(d.getAttributeType(wl,or)){case"TrustedHTML":{Ve=k.createHTML(Ve);break}case"TrustedScriptURL":{Ve=k.createScriptURL(Ve);break}}if(Ve!==bo)try{lt?x.setAttributeNS(lt,De,Ve):x.setAttribute(De,Ve),xo(x)?jt(x):ph(e.removed)}catch{Dn(De,x)}}Jt($.afterSanitizeAttributes,x,null)},cm=function V(x){let P=null;const B=gl(x);for(Jt($.beforeSanitizeShadowDOM,x,null);P=B.nextNode();)Jt($.uponSanitizeShadowNode,P,null),yl(P),vl(P),P.content instanceof i&&V(P.content);Jt($.afterSanitizeShadowDOM,x,null)};return e.sanitize=function(V){let x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},P=null,B=null,Pe=null,Ye=null;if(go=!V,go&&(V="<!-->"),typeof V!="string"&&!_l(V))if(typeof V.toString=="function"){if(V=V.toString(),typeof V!="string")throw ts("dirty is not a string, aborting")}else throw ts("toString is not a function");if(!e.isSupported)return V;if(Ur||yo(x),e.removed=[],typeof V=="string"&&(Gr=!1),Gr){if(V.nodeName){const Kt=Fe(V.nodeName);if(!Ie[Kt]||It[Kt])throw ts("root node is forbidden and cannot be sanitized in-place")}}else if(V instanceof a)P=ml("<!---->"),B=P.ownerDocument.importNode(V,!0),B.nodeType===rs.element&&B.nodeName==="BODY"||B.nodeName==="HTML"?P=B:P.appendChild(B);else{if(!mn&&!ct&&!et&&V.indexOf("<")===-1)return k&&Js?k.createHTML(V):V;if(P=ml(V),!P)return mn?null:Js?E:""}P&&nr&&jt(P.firstChild);const De=gl(Gr?V:P);for(;Pe=De.nextNode();)yl(Pe),vl(Pe),Pe.content instanceof i&&cm(Pe.content);if(Gr)return V;if(mn){if(jr)for(Ye=Y.call(P.ownerDocument);P.firstChild;)Ye.appendChild(P.firstChild);else Ye=P;return(Re.shadowroot||Re.shadowrootmode)&&(Ye=z.call(r,Ye,!0)),Ye}let lt=et?P.outerHTML:P.innerHTML;return et&&Ie["!doctype"]&&P.ownerDocument&&P.ownerDocument.doctype&&P.ownerDocument.doctype.name&&tt(Lf,P.ownerDocument.doctype.name)&&(lt="<!DOCTYPE "+P.ownerDocument.doctype.name+`>
240
+ `+lt),ct&&pi([pe,ye,xe],Kt=>{lt=es(lt,Kt," ")}),k&&Js?k.createHTML(lt):lt},e.setConfig=function(){let V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};yo(V),Ur=!0},e.clearConfig=function(){ir=null,Ur=!1},e.isValidAttribute=function(V,x,P){ir||yo({});const B=Fe(V),Pe=Fe(x);return xl(B,Pe,P)},e.addHook=function(V,x){typeof x=="function"&&Qr($[V],x)},e.removeHook=function(V,x){if(x!==void 0){const P=Tb($[V],x);return P===-1?void 0:Ab($[V],P,1)[0]}return ph($[V])},e.removeHooks=function(V){$[V]=[]},e.removeAllHooks=function(){$=bh()},e}Zf();function Nc(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Qn=Nc();function Ff(t){Qn=t}var Gn={exec:()=>null};function le(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(st.caret,"$1"),n=n.replace(s,o),r},getRegex:()=>new RegExp(n,e)};return r}var jb=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),st={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)}}>`)},Gb=/^(?:[ \t]*(?:\n|$))+/,Vb=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Hb=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Xs=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Wb=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Dc=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Bf=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Uf=le(Bf).replace(/bull/g,Dc).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(),Yb=le(Bf).replace(/bull/g,Dc).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(),Lc=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,qb=/^[^\n]+/,Zc=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Xb=le(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Zc).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Jb=le(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Dc).getRegex(),no="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",Fc=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Kb=le("^ {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",Fc).replace("tag",no).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),jf=le(Lc).replace("hr",Xs).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",no).getRegex(),Qb=le(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",jf).getRegex(),Bc={blockquote:Qb,code:Vb,def:Xb,fences:Hb,heading:Wb,hr:Xs,html:Kb,lheading:Uf,list:Jb,newline:Gb,paragraph:jf,table:Gn,text:qb},vh=le("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Xs).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",no).getRegex(),ev={...Bc,lheading:Yb,table:vh,paragraph:le(Lc).replace("hr",Xs).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",vh).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",no).getRegex()},tv={...Bc,html:le(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Fc).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:Gn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:le(Lc).replace("hr",Xs).replace("heading",` *#{1,6} *[^
241
+ ]`).replace("lheading",Uf).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},nv=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,rv=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Gf=/^( {2,}|\\)\n(?!\s*$)/,sv=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Lr=/[\p{P}\p{S}]/u,ro=/[\s\p{P}\p{S}]/u,Uc=/[^\s\p{P}\p{S}]/u,iv=le(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ro).getRegex(),Vf=/(?!~)[\p{P}\p{S}]/u,ov=/(?!~)[\s\p{P}\p{S}]/u,av=/(?:[^\s\p{P}\p{S}]|~)/u,cv=le(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",jb?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Hf=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,lv=le(Hf,"u").replace(/punct/g,Lr).getRegex(),uv=le(Hf,"u").replace(/punct/g,Vf).getRegex(),Wf="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",hv=le(Wf,"gu").replace(/notPunctSpace/g,Uc).replace(/punctSpace/g,ro).replace(/punct/g,Lr).getRegex(),dv=le(Wf,"gu").replace(/notPunctSpace/g,av).replace(/punctSpace/g,ov).replace(/punct/g,Vf).getRegex(),fv=le("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Uc).replace(/punctSpace/g,ro).replace(/punct/g,Lr).getRegex(),pv=le(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Lr).getRegex(),mv="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",gv=le(mv,"gu").replace(/notPunctSpace/g,Uc).replace(/punctSpace/g,ro).replace(/punct/g,Lr).getRegex(),_v=le(/\\(punct)/,"gu").replace(/punct/g,Lr).getRegex(),yv=le(/^<(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(),xv=le(Fc).replace("(?:-->|$)","-->").getRegex(),bv=le("^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",xv).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ji=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,vv=le(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",ji).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Yf=le(/^!?\[(label)\]\[(ref)\]/).replace("label",ji).replace("ref",Zc).getRegex(),qf=le(/^!?\[(ref)\](?:\[\])?/).replace("ref",Zc).getRegex(),wv=le("reflink|nolink(?!\\()","g").replace("reflink",Yf).replace("nolink",qf).getRegex(),wh=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,jc={_backpedal:Gn,anyPunctuation:_v,autolink:yv,blockSkip:cv,br:Gf,code:rv,del:Gn,delLDelim:Gn,delRDelim:Gn,emStrongLDelim:lv,emStrongRDelimAst:hv,emStrongRDelimUnd:fv,escape:nv,link:vv,nolink:qf,punctuation:iv,reflink:Yf,reflinkSearch:wv,tag:bv,text:sv,url:Gn},kv={...jc,link:le(/^!?\[(label)\]\((.*?)\)/).replace("label",ji).getRegex(),reflink:le(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ji).getRegex()},rc={...jc,emStrongRDelimAst:dv,emStrongLDelim:uv,delLDelim:pv,delRDelim:gv,url:le(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",wh).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:le(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",wh).getRegex()},Sv={...rc,br:le(Gf).replace("{2,}","*").getRegex(),text:le(rc.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},gi={normal:Bc,gfm:ev,pedantic:tv},ss={normal:jc,gfm:rc,breaks:Sv,pedantic:kv},Tv={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},kh=t=>Tv[t];function Wt(t,e){if(e){if(st.escapeTest.test(t))return t.replace(st.escapeReplace,kh)}else if(st.escapeTestNoEncode.test(t))return t.replace(st.escapeReplaceNoEncode,kh);return t}function Sh(t){try{t=encodeURI(t).replace(st.percentDecode,"%")}catch{return null}return t}function Th(t,e){var i;let n=t.replace(st.findPipe,(o,a,c)=>{let l=!1,u=a;for(;--u>=0&&c[u]==="\\";)l=!l;return l?"|":" |"}),r=n.split(st.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(st.slashPipe,"|");return r}function is(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 Av(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 Cv(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 Ah(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 c={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:o,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,c}function Ev(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 Gi=class{constructor(t){ie(this,"options");ie(this,"rules");ie(this,"lexer");this.options=t||Qn}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:is(n,`
244
+ `)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let n=e[0],r=Ev(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=is(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:is(e[0],`
245
+ `)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let n=is(e[0],`
246
+ `).split(`
247
+ `),r="",s="",i=[];for(;n.length>0;){let o=!1,a=[],c;for(c=0;c<n.length;c++)if(this.rules.other.blockquoteStart.test(n[c]))a.push(n[c]),o=!0;else if(!o)a.push(n[c]);else break;n=n.slice(c);let l=a.join(`
248
+ `),u=l.replace(this.rules.other.blockquoteSetextReplace,`
249
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
250
+ ${l}`:l,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),c=!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=Cv(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],Y;if(m=C,this.options.pedantic?(m=m.replace(this.rules.other.listReplaceNesting," "),Y=m):Y=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(Y.search(this.rules.other.nonSpaceChar)>=g||!m.trim())f+=`
261
+ `+Y.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=Y.slice(g)}}o.loose||(c?o.loose=!0:this.rules.other.doubleBlankLine.test(h)&&(c=!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 l=o.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.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=Th(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(Th(a,i.header.length).map((c,l)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:i.align[l]})));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=is(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=Av(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)),Ah(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 Ah(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,c=0,l=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;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)continue;if(o=[...i].length,r[3]||r[4]){a+=o;continue}else if((r[5]||r[6])&&s%3&&!((s+o)%3)){c+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a+c);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,c=this.rules.inline.delRDelim;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||(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 l=[...r[0]][0].length,u=t.slice(0,s+r.index+l+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}}}},zt=class sc{constructor(e){ie(this,"tokens");ie(this,"options");ie(this,"state");ie(this,"inlineQueue");ie(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Qn,this.options.tokenizer=this.options.tokenizer||new Gi,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:st,block:gi.normal,inline:ss.normal};this.options.pedantic?(n.block=gi.pedantic,n.inline=ss.pedantic):this.options.gfm&&(n.block=gi.gfm,this.options.breaks?n.inline=ss.breaks:n.inline=ss.gfm),this.tokenizer.rules=n}static get rules(){return{block:gi,inline:ss}}static lex(e,n){return new sc(n).lex(e)}static lexInline(e,n){return new sc(n).inlineTokens(e)}lex(e){e=e.replace(st.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(st.tabCharGlobal," ").replace(st.spaceLine,""));e;){let a;if((i=(s=this.options.extensions)==null?void 0:s.block)!=null&&i.some(l=>(a=l.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 l=n.at(-1);a.raw.length===1&&l!==void 0?l.raw+=`
267
+ `:n.push(a);continue}if(a=this.tokenizer.code(e)){e=e.substring(a.raw.length);let l=n.at(-1);(l==null?void 0:l.type)==="paragraph"||(l==null?void 0:l.type)==="text"?(l.raw+=(l.raw.endsWith(`
268
+ `)?"":`
269
+ `)+a.raw,l.text+=`
270
+ `+a.text,this.inlineQueue.at(-1).src=l.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 l=n.at(-1);(l==null?void 0:l.type)==="paragraph"||(l==null?void 0:l.type)==="text"?(l.raw+=(l.raw.endsWith(`
271
+ `)?"":`
272
+ `)+a.raw,l.text+=`
273
+ `+a.raw,this.inlineQueue.at(-1).src=l.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 c=e;if((o=this.options.extensions)!=null&&o.startBlock){let l=1/0,u=e.slice(1),h;this.options.extensions.startBlock.forEach(f=>{h=f.call({lexer:this},u),typeof h=="number"&&h>=0&&(l=Math.min(l,h))}),l<1/0&&l>=0&&(c=e.substring(0,l+1))}if(this.state.top&&(a=this.tokenizer.paragraph(c))){let l=n.at(-1);r&&(l==null?void 0:l.type)==="paragraph"?(l.raw+=(l.raw.endsWith(`
274
+ `)?"":`
275
+ `)+a.raw,l.text+=`
276
+ `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):n.push(a),r=c.length!==e.length,e=e.substring(a.raw.length);continue}if(a=this.tokenizer.text(e)){e=e.substring(a.raw.length);let l=n.at(-1);(l==null?void 0:l.type)==="text"?(l.raw+=(l.raw.endsWith(`
277
+ `)?"":`
278
+ `)+a.raw,l.text+=`
279
+ `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):n.push(a);continue}if(e){let l="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(l);break}else throw new Error(l)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){var c,l,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=((l=(c=this.options.hooks)==null?void 0:c.emStrongMask)==null?void 0:l.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}},Vi=class{constructor(t){ie(this,"options");ie(this,"parser");this.options=t||Qn}space(t){return""}code({text:t,lang:e,escaped:n}){var i;let r=(i=(e||"").match(st.notSpaceStart))==null?void 0:i[0],s=t.replace(st.endingNewline,"")+`
280
+ `;return r?'<pre><code class="language-'+Wt(r)+'">'+(n?s:Wt(s,!0))+`</code></pre>
281
+ `:"<pre><code>"+(n?s:Wt(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>${Wt(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=Sh(t);if(s===null)return r;t=s;let i='<a href="'+t+'"';return e&&(i+=' title="'+Wt(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=Sh(t);if(s===null)return Wt(n);t=s;let i=`<img src="${t}" alt="${Wt(n)}"`;return e&&(i+=` title="${Wt(e)}"`),i+=">",i}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:Wt(t.text)}},Gc=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}},Nt=class ic{constructor(e){ie(this,"options");ie(this,"renderer");ie(this,"textRenderer");this.options=e||Qn,this.options.renderer=this.options.renderer||new Vi,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Gc}static parse(e,n){return new ic(n).parse(e)}static parseInline(e,n){return new ic(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 c=o,l=this.options.extensions.renderers[c.type].call({parser:this},c);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(c.type)){n+=l||"";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 c='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}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 l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){r+=l||"";continue}}let c=a;switch(c.type){case"escape":{r+=n.text(c);break}case"html":{r+=n.html(c);break}case"link":{r+=n.link(c);break}case"image":{r+=n.image(c);break}case"checkbox":{r+=n.checkbox(c);break}case"strong":{r+=n.strong(c);break}case"em":{r+=n.em(c);break}case"codespan":{r+=n.codespan(c);break}case"br":{r+=n.br(c);break}case"del":{r+=n.del(c);break}case"text":{r+=n.text(c);break}default:{let l='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return r}},wi,ps=(wi=class{constructor(t){ie(this,"options");ie(this,"block");this.options=t||Qn}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(){return this.block?zt.lex:zt.lexInline}provideParser(){return this.block?Nt.parse:Nt.parseInline}},ie(wi,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),ie(wi,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),wi),Iv=class{constructor(...t){ie(this,"defaults",Nc());ie(this,"options",this.setOptions);ie(this,"parse",this.parseMarkdown(!0));ie(this,"parseInline",this.parseMarkdown(!1));ie(this,"Parser",Nt);ie(this,"Renderer",Vi);ie(this,"TextRenderer",Gc);ie(this,"Lexer",zt);ie(this,"Tokenizer",Gi);ie(this,"Hooks",ps);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 c of a)n=n.concat(this.walkTokens(c.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 c=o[a].flat(1/0);n=n.concat(this.walkTokens(c,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 Vi(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],c=s[o];s[o]=(...l)=>{let u=a.apply(s,l);return u===!1&&(u=c.apply(s,l)),u||""}}r.renderer=s}if(n.tokenizer){let s=this.defaults.tokenizer||new Gi(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],c=s[o];s[o]=(...l)=>{let u=a.apply(s,l);return u===!1&&(u=c.apply(s,l)),u}}r.tokenizer=s}if(n.hooks){let s=this.defaults.hooks||new ps;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],c=s[o];ps.passThroughHooks.has(i)?s[o]=l=>{if(this.defaults.async&&ps.passThroughHooksRespectAsync.has(i))return(async()=>{let h=await a.call(s,l);return c.call(s,h)})();let u=a.call(s,l);return c.call(s,u)}:s[o]=(...l)=>{if(this.defaults.async)return(async()=>{let h=await a.apply(s,l);return h===!1&&(h=await c.apply(s,l)),h})();let u=a.apply(s,l);return u===!1&&(u=c.apply(s,l)),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 zt.lex(t,e??this.defaults)}parser(t,e){return Nt.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?zt.lex:zt.lexInline)(o,s),c=s.hooks?await s.hooks.processAllTokens(a):a;s.walkTokens&&await Promise.all(this.walkTokens(c,s.walkTokens));let l=await(s.hooks?await s.hooks.provideParser():t?Nt.parse:Nt.parseInline)(c,s);return s.hooks?await s.hooks.postprocess(l):l})().catch(i);try{s.hooks&&(e=s.hooks.preprocess(e));let o=(s.hooks?s.hooks.provideLexer():t?zt.lex:zt.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?Nt.parse:Nt.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>"+Wt(n.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},Kn=new Iv;function _e(t,e){return Kn.parse(t,e)}_e.options=_e.setOptions=function(t){return Kn.setOptions(t),_e.defaults=Kn.defaults,Ff(_e.defaults),_e};_e.getDefaults=Nc;_e.defaults=Qn;_e.use=function(...t){return Kn.use(...t),_e.defaults=Kn.defaults,Ff(_e.defaults),_e};_e.walkTokens=function(t,e){return Kn.walkTokens(t,e)};_e.parseInline=Kn.parseInline;_e.Parser=Nt;_e.parser=Nt.parse;_e.Renderer=Vi;_e.TextRenderer=Gc;_e.Lexer=zt;_e.lexer=zt.lex;_e.Tokenizer=Gi;_e.Hooks=ps;_e.parse=_e;_e.options;_e.setOptions;_e.use;_e.walkTokens;_e.parseInline;Nt.parse;zt.lex;_e.setOptions({gfm:!0,breaks:!0,async:!1});const Pv="agent-play-preview-chat-display-v1",Xf={fontSizePx:8,panelWidthPx:200,scrollMaxHeightPx:148};function ra(t,e,n){return Math.min(n,Math.max(e,t))}function Mv(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 Ch={...Xf};function Rv(t){return{fontSizePx:ra(Math.round(t.fontSizePx),5,18),panelWidthPx:ra(Math.round(t.panelWidthPx),100,400),scrollMaxHeightPx:ra(Math.round(t.scrollMaxHeightPx),24,200)}}function Ov(){const t=Mv(typeof localStorage<"u"?localStorage.getItem(Pv):null),e={...Xf,...t};return Ch=Rv(e),{...Ch}}typeof localStorage<"u"&&Ov();function T(t,e,n){function r(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:o,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,c);const l=o.prototype,u=Object.keys(l);for(let h=0;h<u.length;h++){const f=u[h];f in a||(a[f]=l[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 c;const l=n!=null&&n.Parent?new i:this;r(l,a),(c=l._zod).deferred??(c.deferred=[]);for(const u of l._zod.deferred)u();return l}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:a=>{var c,l;return n!=null&&n.Parent&&a instanceof n.Parent?!0:(l=(c=a==null?void 0:a._zod)==null?void 0:c.traits)==null?void 0:l.has(t)}}),Object.defineProperty(o,"name",{value:t}),o}class yr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Jf extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const Kf={};function Pn(t){return Kf}function Qf(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 oc(t,e){return typeof e=="bigint"?e.toString():e}function so(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function Vc(t){return t==null}function Hc(t){const e=t.startsWith("^")?1:0,n=t.endsWith("$")?t.length-1:t.length;return t.slice(e,n)}function $v(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 c=r.match(/\d?e-(\d?)/);c!=null&&c[1]&&(s=Number.parseInt(c[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 Eh=Symbol("evaluating");function oe(t,e,n){let r;Object.defineProperty(t,e,{get(){if(r!==Eh)return r===void 0&&(r=Eh,r=n()),r},set(s){Object.defineProperty(t,e,{value:s})},configurable:!0})}function er(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0})}function On(...t){const e={};for(const n of t){const r=Object.getOwnPropertyDescriptors(n);Object.assign(e,r)}return Object.defineProperties({},e)}function Ih(t){return JSON.stringify(t)}function zv(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const ep="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function Rs(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const Nv=so(()=>{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 $r(t){if(Rs(t)===!1)return!1;const e=t.constructor;if(e===void 0||typeof e!="function")return!0;const n=e.prototype;return!(Rs(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function tp(t){return $r(t)?{...t}:Array.isArray(t)?[...t]:t}const Dv=new Set(["string","number","symbol"]);function zr(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function $n(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 G(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 Lv(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}const Zv={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 Fv(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=On(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 er(this,"shape",o),o},checks:[]});return $n(t,i)}function Bv(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=On(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 er(this,"shape",o),o},checks:[]});return $n(t,i)}function Uv(t,e){if(!$r(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=On(t._zod.def,{get shape(){const i={...t._zod.def.shape,...e};return er(this,"shape",i),i}});return $n(t,s)}function jv(t,e){if(!$r(e))throw new Error("Invalid input to safeExtend: expected a plain object");const n=On(t._zod.def,{get shape(){const r={...t._zod.def.shape,...e};return er(this,"shape",r),r}});return $n(t,n)}function Gv(t,e){const n=On(t._zod.def,{get shape(){const r={...t._zod.def.shape,...e._zod.def.shape};return er(this,"shape",r),r},get catchall(){return e._zod.def.catchall},checks:[]});return $n(t,n)}function Vv(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=On(e._zod.def,{get shape(){const a=e._zod.def.shape,c={...a};if(n)for(const l in n){if(!(l in a))throw new Error(`Unrecognized key: "${l}"`);n[l]&&(c[l]=t?new t({type:"optional",innerType:a[l]}):a[l])}else for(const l in a)c[l]=t?new t({type:"optional",innerType:a[l]}):a[l];return er(this,"shape",c),c},checks:[]});return $n(e,o)}function Hv(t,e,n){const r=On(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 er(this,"shape",i),i}});return $n(e,r)}function gr(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 _r(t,e){return e.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(t),n})}function _i(t){return typeof t=="string"?t:t==null?void 0:t.message}function Mn(t,e,n){var s,i,o,a,c,l;const r={...t,path:t.path??[]};if(!t.message){const u=_i((o=(i=(s=t.inst)==null?void 0:s._zod.def)==null?void 0:i.error)==null?void 0:o.call(i,t))??_i((a=e==null?void 0:e.error)==null?void 0:a.call(e,t))??_i((c=n.customError)==null?void 0:c.call(n,t))??_i((l=n.localeError)==null?void 0:l.call(n,t))??"Invalid input";r.message=u}return delete r.inst,delete r.continue,e!=null&&e.reportInput||delete r.input,r}function Wc(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Os(...t){const[e,n,r]=t;return typeof e=="string"?{message:e,code:"custom",input:n,inst:r}:{...e}}const np=(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,oc,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},rp=T("$ZodError",np),sp=T("$ZodError",np,{Parent:Error});function Wv(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 Yv(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 c=i.path[a];a===i.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(e(i))):o[c]=o[c]||{_errors:[]},o=o[c],a++}}};return r(t),n}const Yc=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 yr;if(o.issues.length){const a=new((s==null?void 0:s.Err)??t)(o.issues.map(c=>Mn(c,i,Pn())));throw ep(a,s==null?void 0:s.callee),a}return o.value},qc=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(c=>Mn(c,i,Pn())));throw ep(a,s==null?void 0:s.callee),a}return o.value},io=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 yr;return i.issues.length?{success:!1,error:new(t??rp)(i.issues.map(o=>Mn(o,s,Pn())))}:{success:!0,data:i.value}},qv=io(sp),oo=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=>Mn(o,s,Pn())))}:{success:!0,data:i.value}},Xv=oo(sp),Jv=t=>(e,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Yc(t)(e,n,s)},Kv=t=>(e,n,r)=>Yc(t)(e,n,r),Qv=t=>async(e,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return qc(t)(e,n,s)},e0=t=>async(e,n,r)=>qc(t)(e,n,r),t0=t=>(e,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return io(t)(e,n,s)},n0=t=>(e,n,r)=>io(t)(e,n,r),r0=t=>async(e,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return oo(t)(e,n,s)},s0=t=>async(e,n,r)=>oo(t)(e,n,r),i0=/^[cC][^\s-]{8,}$/,o0=/^[0-9a-z]+$/,a0=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,c0=/^[0-9a-vA-V]{20}$/,l0=/^[A-Za-z0-9]{27}$/,u0=/^[a-zA-Z0-9_-]{21}$/,h0=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,d0=/^([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})$/,Ph=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)$/,f0=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,p0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function m0(){return new RegExp(p0,"u")}const g0=/^(?:(?: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=/^(([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}|:))$/,y0=/^((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])$/,x0=/^(([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])$/,b0=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ip=/^[A-Za-z0-9_-]*$/,v0=/^\+[1-9]\d{6,14}$/,op="(?:(?:\\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])))",w0=new RegExp(`^${op}$`);function ap(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 k0(t){return new RegExp(`^${ap(t)}$`)}function S0(t){const e=ap({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(`^${op}T(?:${r})$`)}const T0=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}$`)},A0=/^-?\d+$/,cp=/^-?\d+(?:\.\d+)?$/,C0=/^(?:true|false)$/i,E0=/^[^A-Z]*$/,I0=/^[^a-z]*$/,pt=T("$ZodCheck",(t,e)=>{var n;t._zod??(t._zod={}),t._zod.def=e,(n=t._zod).onattach??(n.onattach=[])}),lp={number:"number",bigint:"bigint",object:"date"},up=T("$ZodCheckLessThan",(t,e)=>{pt.init(t,e);const n=lp[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})}}),hp=T("$ZodCheckGreaterThan",(t,e)=>{pt.init(t,e);const n=lp[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})}}),P0=T("$ZodCheckMultipleOf",(t,e)=>{pt.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):$v(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})}}),M0=T("$ZodCheckNumberFormat",(t,e)=>{var o;pt.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]=Zv[e.format];t._zod.onattach.push(a=>{const c=a._zod.bag;c.format=e.format,c.minimum=s,c.maximum=i,n&&(c.pattern=A0)}),t._zod.check=a=>{const c=a.value;if(n){if(!Number.isInteger(c)){a.issues.push({expected:r,format:e.format,code:"invalid_type",continue:!1,input:c,inst:t});return}if(!Number.isSafeInteger(c)){c>0?a.issues.push({input:c,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:c,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}}c<s&&a.issues.push({origin:"number",input:c,code:"too_small",minimum:s,inclusive:!0,inst:t,continue:!e.abort}),c>i&&a.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inclusive:!0,inst:t,continue:!e.abort})}}),R0=T("$ZodCheckMaxLength",(t,e)=>{var n;pt.init(t,e),(n=t._zod.def).when??(n.when=r=>{const s=r.value;return!Vc(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=Wc(s);r.issues.push({origin:o,code:"too_big",maximum:e.maximum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),O0=T("$ZodCheckMinLength",(t,e)=>{var n;pt.init(t,e),(n=t._zod.def).when??(n.when=r=>{const s=r.value;return!Vc(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=Wc(s);r.issues.push({origin:o,code:"too_small",minimum:e.minimum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),$0=T("$ZodCheckLengthEquals",(t,e)=>{var n;pt.init(t,e),(n=t._zod.def).when??(n.when=r=>{const s=r.value;return!Vc(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=Wc(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})}}),ao=T("$ZodCheckStringFormat",(t,e)=>{var n,r;pt.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=()=>{})}),z0=T("$ZodCheckRegex",(t,e)=>{ao.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})}}),N0=T("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=E0),ao.init(t,e)}),D0=T("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=I0),ao.init(t,e)}),L0=T("$ZodCheckIncludes",(t,e)=>{pt.init(t,e);const n=zr(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})}}),Z0=T("$ZodCheckStartsWith",(t,e)=>{pt.init(t,e);const n=new RegExp(`^${zr(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})}}),F0=T("$ZodCheckEndsWith",(t,e)=>{pt.init(t,e);const n=new RegExp(`.*${zr(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})}}),B0=T("$ZodCheckOverwrite",(t,e)=>{pt.init(t,e),t._zod.check=n=>{n.value=e.tx(n.value)}});class U0{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 j0={major:4,minor:3,patch:6},Ce=T("$ZodType",(t,e)=>{var s;var n;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=j0;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,c,l)=>{let u=gr(a),h;for(const f of c){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&&(l==null?void 0:l.async)===!1)throw new yr;if(h||m instanceof Promise)h=(h??Promise.resolve()).then(async()=>{await m,a.issues.length!==d&&(u||(u=gr(a,d)))});else{if(a.issues.length===d)continue;u||(u=gr(a,d))}}return h?h.then(()=>a):a},o=(a,c,l)=>{if(gr(a))return a.aborted=!0,a;const u=i(c,r,l);if(u instanceof Promise){if(l.async===!1)throw new yr;return u.then(h=>t._zod.parse(h,l))}return t._zod.parse(u,l)};t._zod.run=(a,c)=>{if(c.skipChecks)return t._zod.parse(a,c);if(c.direction==="backward"){const u=t._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return u instanceof Promise?u.then(h=>o(h,a,c)):o(u,a,c)}const l=t._zod.parse(a,c);if(l instanceof Promise){if(c.async===!1)throw new yr;return l.then(u=>i(u,r,c))}return i(l,r,c)}}oe(t,"~standard",()=>({validate:i=>{var o;try{const a=qv(t,i);return a.success?{value:a.data}:{issues:(o=a.error)==null?void 0:o.issues}}catch{return Xv(t,i).then(c=>{var l;return c.success?{value:c.data}:{issues:(l=c.error)==null?void 0:l.issues}})}},vendor:"zod",version:1}))}),Xc=T("$ZodString",(t,e)=>{var n;Ce.init(t,e),t._zod.pattern=[...((n=t==null?void 0:t._zod.bag)==null?void 0:n.patterns)??[]].pop()??T0(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}}),Me=T("$ZodStringFormat",(t,e)=>{ao.init(t,e),Xc.init(t,e)}),G0=T("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=d0),Me.init(t,e)}),V0=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=Ph(r))}else e.pattern??(e.pattern=Ph());Me.init(t,e)}),H0=T("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=f0),Me.init(t,e)}),W0=T("$ZodURL",(t,e)=>{Me.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})}}}),Y0=T("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=m0()),Me.init(t,e)}),q0=T("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=u0),Me.init(t,e)}),X0=T("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=i0),Me.init(t,e)}),J0=T("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=o0),Me.init(t,e)}),K0=T("$ZodULID",(t,e)=>{e.pattern??(e.pattern=a0),Me.init(t,e)}),Q0=T("$ZodXID",(t,e)=>{e.pattern??(e.pattern=c0),Me.init(t,e)}),ew=T("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=l0),Me.init(t,e)}),tw=T("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=S0(e)),Me.init(t,e)}),nw=T("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=w0),Me.init(t,e)}),rw=T("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=k0(e)),Me.init(t,e)}),sw=T("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=h0),Me.init(t,e)}),iw=T("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=g0),Me.init(t,e),t._zod.bag.format="ipv4"}),ow=T("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=_0),Me.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})}}}),aw=T("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=y0),Me.init(t,e)}),cw=T("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=x0),Me.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 dp(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const lw=T("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=b0),Me.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=n=>{dp(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:t,continue:!e.abort})}});function uw(t){if(!ip.test(t))return!1;const e=t.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=e.padEnd(Math.ceil(e.length/4)*4,"=");return dp(n)}const hw=T("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=ip),Me.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=n=>{uw(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:t,continue:!e.abort})}}),dw=T("$ZodE164",(t,e)=>{e.pattern??(e.pattern=v0),Me.init(t,e)});function fw(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 pw=T("$ZodJWT",(t,e)=>{Me.init(t,e),t._zod.check=n=>{fw(n.value,e.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:t,continue:!e.abort})}}),fp=T("$ZodNumber",(t,e)=>{Ce.init(t,e),t._zod.pattern=t._zod.bag.pattern??cp,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}}),mw=T("$ZodNumberFormat",(t,e)=>{M0.init(t,e),fp.init(t,e)}),gw=T("$ZodBoolean",(t,e)=>{Ce.init(t,e),t._zod.pattern=C0,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}}),_w=T("$ZodAny",(t,e)=>{Ce.init(t,e),t._zod.parse=n=>n}),yw=T("$ZodUnknown",(t,e)=>{Ce.init(t,e),t._zod.parse=n=>n}),xw=T("$ZodNever",(t,e)=>{Ce.init(t,e),t._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:t}),n)});function Mh(t,e,n){t.issues.length&&e.issues.push(..._r(n,t.issues)),e.value[n]=t.value}const bw=T("$ZodArray",(t,e)=>{Ce.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],c=e.element._zod.run({value:a,issues:[]},r);c instanceof Promise?i.push(c.then(l=>Mh(l,n,o))):Mh(c,n,o)}return i.length?Promise.all(i).then(()=>n):n}});function Hi(t,e,n,r,s){if(t.issues.length){if(s&&!(n in r))return;e.issues.push(..._r(n,t.issues))}t.value===void 0?n in r&&(e.value[n]=void 0):e.value[n]=t.value}function pp(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=Lv(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(n)}}function mp(t,e,n,r,s,i){const o=[],a=s.keySet,c=s.catchall._zod,l=c.def.type,u=c.optout==="optional";for(const h in e){if(a.has(h))continue;if(l==="never"){o.push(h);continue}const f=c.run({value:e[h],issues:[]},r);f instanceof Promise?t.push(f.then(d=>Hi(d,n,h,e,u))):Hi(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 vw=T("$ZodObject",(t,e)=>{Ce.init(t,e);const n=Object.getOwnPropertyDescriptor(e,"shape");if(!(n!=null&&n.get)){const a=e.shape;Object.defineProperty(e,"shape",{get:()=>{const c={...a};return Object.defineProperty(e,"shape",{value:c}),c}})}const r=so(()=>pp(e));oe(t._zod,"propValues",()=>{const a=e.shape,c={};for(const l in a){const u=a[l]._zod;if(u.values){c[l]??(c[l]=new Set);for(const h of u.values)c[l].add(h)}}return c});const s=Rs,i=e.catchall;let o;t._zod.parse=(a,c)=>{o??(o=r.value);const l=a.value;if(!s(l))return a.issues.push({expected:"object",code:"invalid_type",input:l,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:l[f],issues:[]},c);_ instanceof Promise?u.push(_.then(g=>Hi(g,a,f,l,m))):Hi(_,a,f,l,m)}return i?mp(u,l,a,c,r.value,t):u.length?Promise.all(u).then(()=>a):a}}),ww=T("$ZodObjectJIT",(t,e)=>{vw.init(t,e);const n=t._zod.parse,r=so(()=>pp(e)),s=f=>{var w;const d=new U0(["shape","payload","ctx"]),m=r.value,_=k=>{const E=Ih(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=Ih(k),C=f[k],Y=((w=C==null?void 0:C._zod)==null?void 0:w.optout)==="optional";d.write(`const ${E} = ${_(k)};`),Y?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=Rs,a=!Kf.jitless,l=a&&Nv.value,u=e.catchall;let h;t._zod.parse=(f,d)=>{h??(h=r.value);const m=f.value;return o(m)?a&&l&&(d==null?void 0:d.async)===!1&&d.jitless!==!0?(i||(i=s(e.shape)),f=i(f,d),u?mp([],m,f,d,h,t):f):n(f,d):(f.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),f)}});function Rh(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=>!gr(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=>Mn(o,r,Pn())))}),e)}const gp=T("$ZodUnion",(t,e)=>{Ce.init(t,e),oe(t._zod,"optin",()=>e.options.some(s=>s._zod.optin==="optional")?"optional":void 0),oe(t._zod,"optout",()=>e.options.some(s=>s._zod.optout==="optional")?"optional":void 0),oe(t._zod,"values",()=>{if(e.options.every(s=>s._zod.values))return new Set(e.options.flatMap(s=>Array.from(s._zod.values)))}),oe(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=>Hc(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 c of e.options){const l=c._zod.run({value:s.value,issues:[]},i);if(l instanceof Promise)a.push(l),o=!0;else{if(l.issues.length===0)return l;a.push(l)}}return o?Promise.all(a).then(c=>Rh(c,s,t,i)):Rh(a,s,t,i)}}),kw=T("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,gp.init(t,e);const n=t._zod.parse;oe(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,c]of Object.entries(o)){s[a]||(s[a]=new Set);for(const l of c)s[a].add(l)}}return s});const r=so(()=>{var o;const s=e.options,i=new Map;for(const a of s){const c=(o=a._zod.propValues)==null?void 0:o[e.discriminator];if(!c||c.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(a)}"`);for(const l of c){if(i.has(l))throw new Error(`Duplicate discriminator value "${String(l)}"`);i.set(l,a)}}return i});t._zod.parse=(s,i)=>{const o=s.value;if(!Rs(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)}}),Sw=T("$ZodIntersection",(t,e)=>{Ce.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(([c,l])=>Oh(n,c,l)):Oh(n,i,o)}});function ac(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($r(t)&&$r(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=ac(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=ac(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 Oh(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 c of a.keys)r.has(c)||r.set(c,{}),r.get(c).l=!0}else t.issues.push(a);for(const a of n.issues)if(a.code==="unrecognized_keys")for(const c of a.keys)r.has(c)||r.set(c,{}),r.get(c).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}),gr(t))return t;const o=ac(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 Tw=T("$ZodRecord",(t,e)=>{Ce.init(t,e),t._zod.parse=(n,r)=>{const s=n.value;if(!$r(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 l of o)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){a.add(typeof l=="number"?l.toString():l);const u=e.valueType._zod.run({value:s[l],issues:[]},r);u instanceof Promise?i.push(u.then(h=>{h.issues.length&&n.issues.push(..._r(l,h.issues)),n.value[l]=h.value})):(u.issues.length&&n.issues.push(..._r(l,u.issues)),n.value[l]=u.value)}let c;for(const l in s)a.has(l)||(c=c??[],c.push(l));c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:s,inst:t,keys:c})}else{n.value={};for(const a of Reflect.ownKeys(s)){if(a==="__proto__")continue;let c=e.keyType._zod.run({value:a,issues:[]},r);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&cp.test(a)&&c.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&&(c=h)}if(c.issues.length){e.mode==="loose"?n.value[a]=s[a]:n.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(h=>Mn(h,r,Pn())),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(..._r(a,h.issues)),n.value[c.value]=h.value})):(u.issues.length&&n.issues.push(..._r(a,u.issues)),n.value[c.value]=u.value)}}return i.length?Promise.all(i).then(()=>n):n}}),Aw=T("$ZodEnum",(t,e)=>{Ce.init(t,e);const n=Qf(e.entries),r=new Set(n);t._zod.values=r,t._zod.pattern=new RegExp(`^(${n.filter(s=>Dv.has(typeof s)).map(s=>typeof s=="string"?zr(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}}),Cw=T("$ZodLiteral",(t,e)=>{if(Ce.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"?zr(r):r?zr(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}}),Ew=T("$ZodTransform",(t,e)=>{Ce.init(t,e),t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Jf(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 yr;return n.value=s,n}});function $h(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}const _p=T("$ZodOptional",(t,e)=>{Ce.init(t,e),t._zod.optin="optional",t._zod.optout="optional",oe(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),oe(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${Hc(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=>$h(i,n.value)):$h(s,n.value)}return n.value===void 0?n:e.innerType._zod.run(n,r)}}),Iw=T("$ZodExactOptional",(t,e)=>{_p.init(t,e),oe(t._zod,"values",()=>e.innerType._zod.values),oe(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(n,r)=>e.innerType._zod.run(n,r)}),Pw=T("$ZodNullable",(t,e)=>{Ce.init(t,e),oe(t._zod,"optin",()=>e.innerType._zod.optin),oe(t._zod,"optout",()=>e.innerType._zod.optout),oe(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${Hc(n.source)}|null)$`):void 0}),oe(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)}),Mw=T("$ZodDefault",(t,e)=>{Ce.init(t,e),t._zod.optin="optional",oe(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=>zh(i,e)):zh(s,e)}});function zh(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const Rw=T("$ZodPrefault",(t,e)=>{Ce.init(t,e),t._zod.optin="optional",oe(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))}),Ow=T("$ZodNonOptional",(t,e)=>{Ce.init(t,e),oe(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=>Nh(i,t)):Nh(s,t)}});function Nh(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 $w=T("$ZodCatch",(t,e)=>{Ce.init(t,e),oe(t._zod,"optin",()=>e.innerType._zod.optin),oe(t._zod,"optout",()=>e.innerType._zod.optout),oe(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=>Mn(o,r,Pn()))},input:n.value}),n.issues=[]),n)):(n.value=s.value,s.issues.length&&(n.value=e.catchValue({...n,error:{issues:s.issues.map(i=>Mn(i,r,Pn()))},input:n.value}),n.issues=[]),n)}}),zw=T("$ZodPipe",(t,e)=>{Ce.init(t,e),oe(t._zod,"values",()=>e.in._zod.values),oe(t._zod,"optin",()=>e.in._zod.optin),oe(t._zod,"optout",()=>e.out._zod.optout),oe(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=>yi(o,e.in,r)):yi(i,e.in,r)}const s=e.in._zod.run(n,r);return s instanceof Promise?s.then(i=>yi(i,e.out,r)):yi(s,e.out,r)}});function yi(t,e,n){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},n)}const Nw=T("$ZodReadonly",(t,e)=>{Ce.init(t,e),oe(t._zod,"propValues",()=>e.innerType._zod.propValues),oe(t._zod,"values",()=>e.innerType._zod.values),oe(t._zod,"optin",()=>{var n,r;return(r=(n=e.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),oe(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(Dh):Dh(s)}});function Dh(t){return t.value=Object.freeze(t.value),t}const Dw=T("$ZodLazy",(t,e)=>{Ce.init(t,e),oe(t._zod,"innerType",()=>e.getter()),oe(t._zod,"pattern",()=>{var n,r;return(r=(n=t._zod.innerType)==null?void 0:n._zod)==null?void 0:r.pattern}),oe(t._zod,"propValues",()=>{var n,r;return(r=(n=t._zod.innerType)==null?void 0:n._zod)==null?void 0:r.propValues}),oe(t._zod,"optin",()=>{var n,r;return((r=(n=t._zod.innerType)==null?void 0:n._zod)==null?void 0:r.optin)??void 0}),oe(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)}),Lw=T("$ZodCustom",(t,e)=>{pt.init(t,e),Ce.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=>Lh(i,n,r,t));Lh(s,n,r,t)}});function Lh(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(Os(s))}}var Zh;class Zw{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 Fw(){return new Zw}(Zh=globalThis).__zod_globalRegistry??(Zh.__zod_globalRegistry=Fw());const ms=globalThis.__zod_globalRegistry;function Bw(t,e){return new t({type:"string",...G(e)})}function Uw(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...G(e)})}function Fh(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...G(e)})}function jw(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...G(e)})}function Gw(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...G(e)})}function Vw(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...G(e)})}function Hw(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...G(e)})}function Ww(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...G(e)})}function Yw(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...G(e)})}function qw(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...G(e)})}function Xw(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...G(e)})}function Jw(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...G(e)})}function Kw(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...G(e)})}function Qw(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...G(e)})}function ek(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...G(e)})}function tk(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...G(e)})}function nk(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...G(e)})}function rk(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...G(e)})}function sk(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...G(e)})}function ik(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...G(e)})}function ok(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...G(e)})}function ak(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...G(e)})}function ck(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...G(e)})}function lk(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...G(e)})}function uk(t,e){return new t({type:"string",format:"date",check:"string_format",...G(e)})}function hk(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...G(e)})}function dk(t,e){return new t({type:"string",format:"duration",check:"string_format",...G(e)})}function fk(t,e){return new t({type:"number",checks:[],...G(e)})}function pk(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...G(e)})}function mk(t,e){return new t({type:"boolean",...G(e)})}function gk(t){return new t({type:"any"})}function _k(t){return new t({type:"unknown"})}function yk(t,e){return new t({type:"never",...G(e)})}function Bh(t,e){return new up({check:"less_than",...G(e),value:t,inclusive:!1})}function sa(t,e){return new up({check:"less_than",...G(e),value:t,inclusive:!0})}function Uh(t,e){return new hp({check:"greater_than",...G(e),value:t,inclusive:!1})}function ia(t,e){return new hp({check:"greater_than",...G(e),value:t,inclusive:!0})}function jh(t,e){return new P0({check:"multiple_of",...G(e),value:t})}function yp(t,e){return new R0({check:"max_length",...G(e),maximum:t})}function Wi(t,e){return new O0({check:"min_length",...G(e),minimum:t})}function xp(t,e){return new $0({check:"length_equals",...G(e),length:t})}function xk(t,e){return new z0({check:"string_format",format:"regex",...G(e),pattern:t})}function bk(t){return new N0({check:"string_format",format:"lowercase",...G(t)})}function vk(t){return new D0({check:"string_format",format:"uppercase",...G(t)})}function wk(t,e){return new L0({check:"string_format",format:"includes",...G(e),includes:t})}function kk(t,e){return new Z0({check:"string_format",format:"starts_with",...G(e),prefix:t})}function Sk(t,e){return new F0({check:"string_format",format:"ends_with",...G(e),suffix:t})}function Zr(t){return new B0({check:"overwrite",tx:t})}function Tk(t){return Zr(e=>e.normalize(t))}function Ak(){return Zr(t=>t.trim())}function Ck(){return Zr(t=>t.toLowerCase())}function Ek(){return Zr(t=>t.toUpperCase())}function Ik(){return Zr(t=>zv(t))}function Pk(t,e,n){return new t({type:"array",element:e,...G(n)})}function Mk(t,e,n){return new t({type:"custom",check:"custom",fn:e,...G(n)})}function Rk(t){const e=Ok(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Os(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(Os(s))}},t(n.value,n)));return e}function Ok(t,e){const n=new pt({check:"custom",...G(e)});return n._zod.check=t,n}function bp(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)??ms,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 Ne(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),Ne(d,e,f),e.seen.get(d).isParent=!0)}const c=e.metadataRegistry.get(t);return c&&Object.assign(o.schema,c),e.io==="input"&&nt(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 vp(t,e){var o,a,c,l;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=(c=t.external.registry.get(u[0]))==null?void 0:c.id;if(e!==u[0]&&d){i(u);continue}}if((l=t.metadataRegistry.get(u[0]))==null?void 0:l.id){i(u);continue}if(h.cycle){i(u);continue}if(h.count>1&&t.reused==="ref"){i(u);continue}}}function wp(t,e){var o,a,c;const n=t.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=l=>{const u=t.seen.get(l);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),l._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=l._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:l,jsonSchema:h,path:u.path??[]})};for(const l of[...t.seen.entries()].reverse())r(l[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 l=(a=t.external.registry.get(e))==null?void 0:a.id;if(!l)throw new Error("Schema is missing an `id` property");s.$id=t.external.uri(l)}Object.assign(s,n.def??n.schema);const i=((c=t.external)==null?void 0:c.defs)??{};for(const l of t.seen.entries()){const u=l[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 l=JSON.parse(JSON.stringify(s));return Object.defineProperty(l,"~standard",{value:{...e["~standard"],jsonSchema:{input:Yi(e,"input",t.processors),output:Yi(e,"output",t.processors)}},enumerable:!1,writable:!1}),l}catch{throw new Error("Error converting schema to JSON.")}}function nt(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 nt(r.element,n);if(r.type==="set")return nt(r.valueType,n);if(r.type==="lazy")return nt(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 nt(r.innerType,n);if(r.type==="intersection")return nt(r.left,n)||nt(r.right,n);if(r.type==="record"||r.type==="map")return nt(r.keyType,n)||nt(r.valueType,n);if(r.type==="pipe")return nt(r.in,n)||nt(r.out,n);if(r.type==="object"){for(const s in r.shape)if(nt(r.shape[s],n))return!0;return!1}if(r.type==="union"){for(const s of r.options)if(nt(s,n))return!0;return!1}if(r.type==="tuple"){for(const s of r.items)if(nt(s,n))return!0;return!!(r.rest&&nt(r.rest,n))}return!1}const $k=(t,e={})=>n=>{const r=bp({...n,processors:e});return Ne(t,r),vp(r,t),wp(r,t)},Yi=(t,e,n={})=>r=>{const{libraryOptions:s,target:i}=r??{},o=bp({...s??{},target:i,io:e,processors:n});return Ne(t,o),vp(o,t),wp(o,t)},zk={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Nk=(t,e,n,r)=>{const s=n;s.type="string";const{minimum:i,maximum:o,format:a,patterns:c,contentEncoding:l}=t._zod.bag;if(typeof i=="number"&&(s.minLength=i),typeof o=="number"&&(s.maxLength=o),a&&(s.format=zk[a]??a,s.format===""&&delete s.format,a==="time"&&delete s.format),l&&(s.contentEncoding=l),c&&c.size>0){const u=[...c];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}))])}},Dk=(t,e,n,r)=>{const s=n,{minimum:i,maximum:o,format:a,multipleOf:c,exclusiveMaximum:l,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 l=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(s.maximum=l,s.exclusiveMaximum=!0):s.exclusiveMaximum=l),typeof o=="number"&&(s.maximum=o,typeof l=="number"&&e.target!=="draft-04"&&(l<=o?delete s.maximum:delete s.exclusiveMaximum)),typeof c=="number"&&(s.multipleOf=c)},Lk=(t,e,n,r)=>{n.type="boolean"},Zk=(t,e,n,r)=>{n.not={}},Fk=(t,e,n,r)=>{},Bk=(t,e,n,r)=>{},Uk=(t,e,n,r)=>{const s=t._zod.def,i=Qf(s.entries);i.every(o=>typeof o=="number")&&(n.type="number"),i.every(o=>typeof o=="string")&&(n.type="string"),n.enum=i},jk=(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},Gk=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Vk=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Hk=(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=Ne(i.element,e,{...r,path:[...r.path,"items"]})},Wk=(t,e,n,r)=>{var l;const s=n,i=t._zod.def;s.type="object",s.properties={};const o=i.shape;for(const u in o)s.properties[u]=Ne(o[u],e,{...r,path:[...r.path,"properties",u]});const a=new Set(Object.keys(o)),c=new Set([...a].filter(u=>{const h=i.shape[u]._zod;return e.io==="input"?h.optin===void 0:h.optout===void 0}));c.size>0&&(s.required=Array.from(c)),((l=i.catchall)==null?void 0:l._zod.def.type)==="never"?s.additionalProperties=!1:i.catchall?i.catchall&&(s.additionalProperties=Ne(i.catchall,e,{...r,path:[...r.path,"additionalProperties"]})):e.io==="output"&&(s.additionalProperties=!1)},Yk=(t,e,n,r)=>{const s=t._zod.def,i=s.inclusive===!1,o=s.options.map((a,c)=>Ne(a,e,{...r,path:[...r.path,i?"oneOf":"anyOf",c]}));i?n.oneOf=o:n.anyOf=o},qk=(t,e,n,r)=>{const s=t._zod.def,i=Ne(s.left,e,{...r,path:[...r.path,"allOf",0]}),o=Ne(s.right,e,{...r,path:[...r.path,"allOf",1]}),a=l=>"allOf"in l&&Object.keys(l).length===1,c=[...a(i)?i.allOf:[i],...a(o)?o.allOf:[o]];n.allOf=c},Xk=(t,e,n,r)=>{const s=n,i=t._zod.def;s.type="object";const o=i.keyType,a=o._zod.bag,c=a==null?void 0:a.patterns;if(i.mode==="loose"&&c&&c.size>0){const u=Ne(i.valueType,e,{...r,path:[...r.path,"patternProperties","*"]});s.patternProperties={};for(const h of c)s.patternProperties[h.source]=u}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(s.propertyNames=Ne(i.keyType,e,{...r,path:[...r.path,"propertyNames"]})),s.additionalProperties=Ne(i.valueType,e,{...r,path:[...r.path,"additionalProperties"]});const l=o._zod.values;if(l){const u=[...l].filter(h=>typeof h=="string"||typeof h=="number");u.length>0&&(s.required=u)}},Jk=(t,e,n,r)=>{const s=t._zod.def,i=Ne(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"}]},Kk=(t,e,n,r)=>{const s=t._zod.def;Ne(s.innerType,e,r);const i=e.seen.get(t);i.ref=s.innerType},Qk=(t,e,n,r)=>{const s=t._zod.def;Ne(s.innerType,e,r);const i=e.seen.get(t);i.ref=s.innerType,n.default=JSON.parse(JSON.stringify(s.defaultValue))},e1=(t,e,n,r)=>{const s=t._zod.def;Ne(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)))},t1=(t,e,n,r)=>{const s=t._zod.def;Ne(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},n1=(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;Ne(i,e,r);const o=e.seen.get(t);o.ref=i},r1=(t,e,n,r)=>{const s=t._zod.def;Ne(s.innerType,e,r);const i=e.seen.get(t);i.ref=s.innerType,n.readOnly=!0},kp=(t,e,n,r)=>{const s=t._zod.def;Ne(s.innerType,e,r);const i=e.seen.get(t);i.ref=s.innerType},s1=(t,e,n,r)=>{const s=t._zod.innerType;Ne(s,e,r);const i=e.seen.get(t);i.ref=s},i1=T("ZodISODateTime",(t,e)=>{tw.init(t,e),$e.init(t,e)});function o1(t){return lk(i1,t)}const a1=T("ZodISODate",(t,e)=>{nw.init(t,e),$e.init(t,e)});function c1(t){return uk(a1,t)}const l1=T("ZodISOTime",(t,e)=>{rw.init(t,e),$e.init(t,e)});function u1(t){return hk(l1,t)}const h1=T("ZodISODuration",(t,e)=>{sw.init(t,e),$e.init(t,e)});function d1(t){return dk(h1,t)}const f1=(t,e)=>{rp.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:n=>Yv(t,n)},flatten:{value:n=>Wv(t,n)},addIssue:{value:n=>{t.issues.push(n),t.message=JSON.stringify(t.issues,oc,2)}},addIssues:{value:n=>{t.issues.push(...n),t.message=JSON.stringify(t.issues,oc,2)}},isEmpty:{get(){return t.issues.length===0}}})},Ct=T("ZodError",f1,{Parent:Error}),p1=Yc(Ct),m1=qc(Ct),g1=io(Ct),_1=oo(Ct),y1=Jv(Ct),x1=Kv(Ct),b1=Qv(Ct),v1=e0(Ct),w1=t0(Ct),k1=n0(Ct),S1=r0(Ct),T1=s0(Ct),Ee=T("ZodType",(t,e)=>(Ce.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:Yi(t,"input"),output:Yi(t,"output")}}),t.toJSONSchema=$k(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.check=(...n)=>t.clone(On(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)=>$n(t,n,r),t.brand=()=>t,t.register=((n,r)=>(n.add(t,r),t)),t.parse=(n,r)=>p1(t,n,r,{callee:t.parse}),t.safeParse=(n,r)=>g1(t,n,r),t.parseAsync=async(n,r)=>m1(t,n,r,{callee:t.parseAsync}),t.safeParseAsync=async(n,r)=>_1(t,n,r),t.spa=t.safeParseAsync,t.encode=(n,r)=>y1(t,n,r),t.decode=(n,r)=>x1(t,n,r),t.encodeAsync=async(n,r)=>b1(t,n,r),t.decodeAsync=async(n,r)=>v1(t,n,r),t.safeEncode=(n,r)=>w1(t,n,r),t.safeDecode=(n,r)=>k1(t,n,r),t.safeEncodeAsync=async(n,r)=>S1(t,n,r),t.safeDecodeAsync=async(n,r)=>T1(t,n,r),t.refine=(n,r)=>t.check(bS(n,r)),t.superRefine=n=>t.check(vS(n)),t.overwrite=n=>t.check(Zr(n)),t.optional=()=>Hh(t),t.exactOptional=()=>oS(t),t.nullable=()=>Wh(t),t.nullish=()=>Hh(Wh(t)),t.nonoptional=n=>dS(t,n),t.array=()=>W(t),t.or=n=>Zt([t,n]),t.and=n=>eS(t,n),t.transform=n=>Yh(t,sS(n)),t.default=n=>lS(t,n),t.prefault=n=>hS(t,n),t.catch=n=>pS(t,n),t.pipe=n=>Yh(t,n),t.readonly=()=>_S(t),t.describe=n=>{const r=t.clone();return ms.add(r,{description:n}),r},Object.defineProperty(t,"description",{get(){var n;return(n=ms.get(t))==null?void 0:n.description},configurable:!0}),t.meta=(...n)=>{if(n.length===0)return ms.get(t);const r=t.clone();return ms.add(r,n[0]),r},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t.apply=n=>n(t),t)),Sp=T("_ZodString",(t,e)=>{Xc.init(t,e),Ee.init(t,e),t._zod.processJSONSchema=(r,s,i)=>Nk(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(xk(...r)),t.includes=(...r)=>t.check(wk(...r)),t.startsWith=(...r)=>t.check(kk(...r)),t.endsWith=(...r)=>t.check(Sk(...r)),t.min=(...r)=>t.check(Wi(...r)),t.max=(...r)=>t.check(yp(...r)),t.length=(...r)=>t.check(xp(...r)),t.nonempty=(...r)=>t.check(Wi(1,...r)),t.lowercase=r=>t.check(bk(r)),t.uppercase=r=>t.check(vk(r)),t.trim=()=>t.check(Ak()),t.normalize=(...r)=>t.check(Tk(...r)),t.toLowerCase=()=>t.check(Ck()),t.toUpperCase=()=>t.check(Ek()),t.slugify=()=>t.check(Ik())}),A1=T("ZodString",(t,e)=>{Xc.init(t,e),Sp.init(t,e),t.email=n=>t.check(Uw(C1,n)),t.url=n=>t.check(Ww(E1,n)),t.jwt=n=>t.check(ck(j1,n)),t.emoji=n=>t.check(Yw(I1,n)),t.guid=n=>t.check(Fh(Gh,n)),t.uuid=n=>t.check(jw(xi,n)),t.uuidv4=n=>t.check(Gw(xi,n)),t.uuidv6=n=>t.check(Vw(xi,n)),t.uuidv7=n=>t.check(Hw(xi,n)),t.nanoid=n=>t.check(qw(P1,n)),t.guid=n=>t.check(Fh(Gh,n)),t.cuid=n=>t.check(Xw(M1,n)),t.cuid2=n=>t.check(Jw(R1,n)),t.ulid=n=>t.check(Kw(O1,n)),t.base64=n=>t.check(ik(F1,n)),t.base64url=n=>t.check(ok(B1,n)),t.xid=n=>t.check(Qw($1,n)),t.ksuid=n=>t.check(ek(z1,n)),t.ipv4=n=>t.check(tk(N1,n)),t.ipv6=n=>t.check(nk(D1,n)),t.cidrv4=n=>t.check(rk(L1,n)),t.cidrv6=n=>t.check(sk(Z1,n)),t.e164=n=>t.check(ak(U1,n)),t.datetime=n=>t.check(o1(n)),t.date=n=>t.check(c1(n)),t.time=n=>t.check(u1(n)),t.duration=n=>t.check(d1(n))});function p(t){return Bw(A1,t)}const $e=T("ZodStringFormat",(t,e)=>{Me.init(t,e),Sp.init(t,e)}),C1=T("ZodEmail",(t,e)=>{H0.init(t,e),$e.init(t,e)}),Gh=T("ZodGUID",(t,e)=>{G0.init(t,e),$e.init(t,e)}),xi=T("ZodUUID",(t,e)=>{V0.init(t,e),$e.init(t,e)}),E1=T("ZodURL",(t,e)=>{W0.init(t,e),$e.init(t,e)}),I1=T("ZodEmoji",(t,e)=>{Y0.init(t,e),$e.init(t,e)}),P1=T("ZodNanoID",(t,e)=>{q0.init(t,e),$e.init(t,e)}),M1=T("ZodCUID",(t,e)=>{X0.init(t,e),$e.init(t,e)}),R1=T("ZodCUID2",(t,e)=>{J0.init(t,e),$e.init(t,e)}),O1=T("ZodULID",(t,e)=>{K0.init(t,e),$e.init(t,e)}),$1=T("ZodXID",(t,e)=>{Q0.init(t,e),$e.init(t,e)}),z1=T("ZodKSUID",(t,e)=>{ew.init(t,e),$e.init(t,e)}),N1=T("ZodIPv4",(t,e)=>{iw.init(t,e),$e.init(t,e)}),D1=T("ZodIPv6",(t,e)=>{ow.init(t,e),$e.init(t,e)}),L1=T("ZodCIDRv4",(t,e)=>{aw.init(t,e),$e.init(t,e)}),Z1=T("ZodCIDRv6",(t,e)=>{cw.init(t,e),$e.init(t,e)}),F1=T("ZodBase64",(t,e)=>{lw.init(t,e),$e.init(t,e)}),B1=T("ZodBase64URL",(t,e)=>{hw.init(t,e),$e.init(t,e)}),U1=T("ZodE164",(t,e)=>{dw.init(t,e),$e.init(t,e)}),j1=T("ZodJWT",(t,e)=>{pw.init(t,e),$e.init(t,e)}),Tp=T("ZodNumber",(t,e)=>{fp.init(t,e),Ee.init(t,e),t._zod.processJSONSchema=(r,s,i)=>Dk(t,r,s),t.gt=(r,s)=>t.check(Uh(r,s)),t.gte=(r,s)=>t.check(ia(r,s)),t.min=(r,s)=>t.check(ia(r,s)),t.lt=(r,s)=>t.check(Bh(r,s)),t.lte=(r,s)=>t.check(sa(r,s)),t.max=(r,s)=>t.check(sa(r,s)),t.int=r=>t.check(Vh(r)),t.safe=r=>t.check(Vh(r)),t.positive=r=>t.check(Uh(0,r)),t.nonnegative=r=>t.check(ia(0,r)),t.negative=r=>t.check(Bh(0,r)),t.nonpositive=r=>t.check(sa(0,r)),t.multipleOf=(r,s)=>t.check(jh(r,s)),t.step=(r,s)=>t.check(jh(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 R(t){return fk(Tp,t)}const G1=T("ZodNumberFormat",(t,e)=>{mw.init(t,e),Tp.init(t,e)});function Vh(t){return pk(G1,t)}const V1=T("ZodBoolean",(t,e)=>{gw.init(t,e),Ee.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Lk(t,n,r)});function Sn(t){return mk(V1,t)}const H1=T("ZodAny",(t,e)=>{_w.init(t,e),Ee.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Fk()});function ee(){return gk(H1)}const W1=T("ZodUnknown",(t,e)=>{yw.init(t,e),Ee.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Bk()});function cc(){return _k(W1)}const Y1=T("ZodNever",(t,e)=>{xw.init(t,e),Ee.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Zk(t,n,r)});function q1(t){return yk(Y1,t)}const X1=T("ZodArray",(t,e)=>{bw.init(t,e),Ee.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Hk(t,n,r,s),t.element=e.element,t.min=(n,r)=>t.check(Wi(n,r)),t.nonempty=n=>t.check(Wi(1,n)),t.max=(n,r)=>t.check(yp(n,r)),t.length=(n,r)=>t.check(xp(n,r)),t.unwrap=()=>t.element});function W(t,e){return Pk(X1,t,e)}const J1=T("ZodObject",(t,e)=>{ww.init(t,e),Ee.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Wk(t,n,r,s),oe(t,"shape",()=>e.shape),t.keyof=()=>Ae(Object.keys(t._zod.def.shape)),t.catchall=n=>t.clone({...t._zod.def,catchall:n}),t.passthrough=()=>t.clone({...t._zod.def,catchall:cc()}),t.loose=()=>t.clone({...t._zod.def,catchall:cc()}),t.strict=()=>t.clone({...t._zod.def,catchall:q1()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=n=>Uv(t,n),t.safeExtend=n=>jv(t,n),t.merge=n=>Gv(t,n),t.pick=n=>Fv(t,n),t.omit=n=>Bv(t,n),t.partial=(...n)=>Vv(Cp,t,n[0]),t.required=(...n)=>Hv(Ep,t,n[0])});function v(t,e){const n={type:"object",shape:t??{},...G(e)};return new J1(n)}const Ap=T("ZodUnion",(t,e)=>{gp.init(t,e),Ee.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Yk(t,n,r,s),t.options=e.options});function Zt(t,e){return new Ap({type:"union",options:t,...G(e)})}const K1=T("ZodDiscriminatedUnion",(t,e)=>{Ap.init(t,e),kw.init(t,e)});function We(t,e,n){return new K1({type:"union",options:e,discriminator:t,...G(n)})}const Q1=T("ZodIntersection",(t,e)=>{Sw.init(t,e),Ee.init(t,e),t._zod.processJSONSchema=(n,r,s)=>qk(t,n,r,s)});function eS(t,e){return new Q1({type:"intersection",left:t,right:e})}const tS=T("ZodRecord",(t,e)=>{Tw.init(t,e),Ee.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Xk(t,n,r,s),t.keyType=e.keyType,t.valueType=e.valueType});function me(t,e,n){return new tS({type:"record",keyType:t,valueType:e,...G(n)})}const lc=T("ZodEnum",(t,e)=>{Aw.init(t,e),Ee.init(t,e),t._zod.processJSONSchema=(r,s,i)=>Uk(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 lc({...e,checks:[],...G(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 lc({...e,checks:[],...G(s),entries:i})}});function Ae(t,e){const n=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new lc({type:"enum",entries:n,...G(e)})}const nS=T("ZodLiteral",(t,e)=>{Cw.init(t,e),Ee.init(t,e),t._zod.processJSONSchema=(n,r,s)=>jk(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 nS({type:"literal",values:Array.isArray(t)?t:[t],...G(e)})}const rS=T("ZodTransform",(t,e)=>{Ew.init(t,e),Ee.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Vk(t,n),t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Jf(t.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(Os(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(Os(o))}};const s=e.transform(n.value,n);return s instanceof Promise?s.then(i=>(n.value=i,n)):(n.value=s,n)}});function sS(t){return new rS({type:"transform",transform:t})}const Cp=T("ZodOptional",(t,e)=>{_p.init(t,e),Ee.init(t,e),t._zod.processJSONSchema=(n,r,s)=>kp(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function Hh(t){return new Cp({type:"optional",innerType:t})}const iS=T("ZodExactOptional",(t,e)=>{Iw.init(t,e),Ee.init(t,e),t._zod.processJSONSchema=(n,r,s)=>kp(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function oS(t){return new iS({type:"optional",innerType:t})}const aS=T("ZodNullable",(t,e)=>{Pw.init(t,e),Ee.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Jk(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function Wh(t){return new aS({type:"nullable",innerType:t})}const cS=T("ZodDefault",(t,e)=>{Mw.init(t,e),Ee.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Qk(t,n,r,s),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function lS(t,e){return new cS({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():tp(e)}})}const uS=T("ZodPrefault",(t,e)=>{Rw.init(t,e),Ee.init(t,e),t._zod.processJSONSchema=(n,r,s)=>e1(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function hS(t,e){return new uS({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():tp(e)}})}const Ep=T("ZodNonOptional",(t,e)=>{Ow.init(t,e),Ee.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Kk(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function dS(t,e){return new Ep({type:"nonoptional",innerType:t,...G(e)})}const fS=T("ZodCatch",(t,e)=>{$w.init(t,e),Ee.init(t,e),t._zod.processJSONSchema=(n,r,s)=>t1(t,n,r,s),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function pS(t,e){return new fS({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const mS=T("ZodPipe",(t,e)=>{zw.init(t,e),Ee.init(t,e),t._zod.processJSONSchema=(n,r,s)=>n1(t,n,r,s),t.in=e.in,t.out=e.out});function Yh(t,e){return new mS({type:"pipe",in:t,out:e})}const gS=T("ZodReadonly",(t,e)=>{Nw.init(t,e),Ee.init(t,e),t._zod.processJSONSchema=(n,r,s)=>r1(t,n,r,s),t.unwrap=()=>t._zod.def.innerType});function _S(t){return new gS({type:"readonly",innerType:t})}const yS=T("ZodLazy",(t,e)=>{Dw.init(t,e),Ee.init(t,e),t._zod.processJSONSchema=(n,r,s)=>s1(t,n,r,s),t.unwrap=()=>t._zod.def.getter()});function xS(t){return new yS({type:"lazy",getter:t})}const Ip=T("ZodCustom",(t,e)=>{Lw.init(t,e),Ee.init(t,e),t._zod.processJSONSchema=(n,r,s)=>Gk(t,n)});function bS(t,e={}){return Mk(Ip,t,e)}function vS(t){return Rk(t)}function Pp(t,e={}){const n=new Ip({type:"custom",check:"custom",fn:r=>r instanceof t,abort:!0,...G(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 wS={custom:"custom"};var bi={exports:{}},oa,qh;function kS(){if(qh)return oa;qh=1;var t=1e3,e=t*60,n=e*60,r=n*24,s=r*7,i=r*365.25;oa=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?c(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 c(u){var h=Math.abs(u);return h>=r?l(u,h,r,"day"):h>=n?l(u,h,n,"hour"):h>=e?l(u,h,e,"minute"):h>=t?l(u,h,t,"second"):u+" ms"}function l(u,h,f,d){var m=h>=f*1.5;return Math.round(u/f)+" "+d+(m?"s":"")}return oa}var aa,Xh;function SS(){if(Xh)return aa;Xh=1;function t(e){r.debug=r,r.default=r,r.coerce=l,r.disable=a,r.enable=i,r.enabled=c,r.humanize=kS(),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,Y)=>{if(C==="%%")return"%";E++;const J=r.formatters[Y];if(typeof J=="function"){const z=y[E];C=J.call(b,z),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 c(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 l(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 aa=t,aa}var Jh;function TS(){return Jh||(Jh=1,(function(t,e){var n={};e.formatArgs=s,e.save=i,e.load=o,e.useColors=r,e.storage=a(),e.destroy=(()=>{let l=!1;return()=>{l||(l=!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 l;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&&(l=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(l[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function s(l){if(l[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+l[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const u="color: "+this.color;l.splice(1,0,u,"color: inherit");let h=0,f=0;l[0].replace(/%[a-zA-Z%]/g,d=>{d!=="%%"&&(h++,d==="%c"&&(f=h))}),l.splice(f,0,u)}e.log=console.debug||console.log||(()=>{});function i(l){try{l?e.storage.setItem("debug",l):e.storage.removeItem("debug")}catch{}}function o(){let l;try{l=e.storage.getItem("debug")||e.storage.getItem("DEBUG")}catch{}return!l&&typeof process<"u"&&"env"in process&&(l=n.DEBUG),l}function a(){try{return localStorage}catch{}}t.exports=SS()(e);const{formatters:c}=t.exports;c.j=function(l){try{return JSON.stringify(l)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}})(bi,bi.exports)),bi.exports}var AS=TS();const CS=fc(AS);function ES(){return typeof window<"u"&&typeof document<"u"&&typeof document.createElement=="function"}function IS(){try{if(typeof ed=="function")return ed()}catch{}return ES()}function Mp(){try{const t=ca==null?void 0:ca();return typeof t=="object"&&t!=null?t:{}}catch{return{}}}function uc(t){const e=Mp();return typeof e<"u"&&(e[t]==="true"||e[t]==="1")}const Rp={get disabled(){return IS()||Mp().NODE_ENV==="test"?!0:uc("OPENAI_AGENTS_DISABLE_TRACING")}},Kh={get dontLogModelData(){return uc("OPENAI_AGENTS_DONT_LOG_MODEL_DATA")},get dontLogToolData(){return uc("OPENAI_AGENTS_DONT_LOG_TOOL_DATA")}};function Jc(t="openai-agents"){return{namespace:t,debug:CS(t),error:(...e)=>console.error(...e),warn:(...e)=>console.warn(...e),get dontLogModelData(){return Kh.dontLogModelData},get dontLogToolData(){return Kh.dontLogToolData}}}const Se=Jc("openai-agents:core");v({name:p(),description:p().optional(),inputSchema:v({type:S("object"),properties:me(p(),ee()),required:W(p()),additionalProperties:Sn()})});function ca(){return{}}const Op=()=>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 Qh{constructor(){ie(this,"context",null)}run(e,n){return this.context=e,n()}getStore(){return this.context}enterWith(e){this.context=e}}function ed(){return!0}class PS{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 MS=new PS,Ue=v({providerData:me(p(),ee()).optional()}),mt=Ue.extend({id:p().optional()}),RS=Ue.extend({type:S("refusal"),refusal:p()}),OS=Ue.extend({type:S("output_text"),text:p()}),Kc=Ue.extend({type:S("input_text"),text:p()}),$S=Ue.extend({type:S("reasoning_text"),text:p()}),$p=Ue.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()}),zp=Ue.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()}),Np=Ue.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()}),zS=Ue.extend({type:S("image"),image:p().describe("Base64 encoded image data")}),NS=Ue.extend({type:S("text"),text:p()}),DS=v({data:Zt([p(),Pp(Uint8Array)]).describe("Base64 image data, or raw bytes that will be base64 encoded automatically."),mediaType:p().optional()}),LS=v({url:p().describe("Publicly accessible URL pointing to the image content")}),ZS=v({fileId:p().describe("OpenAI file ID referencing uploaded image content")}),FS=Zt([DS,LS,ZS]).describe("Inline image data or references to uploaded content."),BS=v({data:Zt([p(),Pp(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")}),US=v({url:p().describe("Publicly accessible URL for the file content"),filename:p().optional()}),jS=v({id:p().describe("OpenAI file ID referencing uploaded content"),filename:p().optional()}),GS=Zt([p().describe("Existing data URL or base64 string"),BS,US,jS]).describe("Inline data (with metadata) or references pointing to file contents."),VS=(...t)=>p(),HS=Ue.extend({type:S("image"),image:p().or(FS).optional(),detail:VS("low","high","auto").optional()}),WS=Ue.extend({type:S("file"),file:GS}),YS=Ue.extend({type:S("computer_screenshot"),data:p().describe("Base64 encoded image data or URL")}),td=We("type",[v({type:S("screenshot")}),v({type:S("click"),x:R(),y:R(),button:Ae(["left","right","wheel","back","forward"])}),v({type:S("double_click"),x:R(),y:R()}),v({type:S("scroll"),x:R(),y:R(),scroll_x:R(),scroll_y:R()}),v({type:S("type"),text:p()}),v({type:S("wait")}),v({type:S("move"),x:R(),y:R()}),v({type:S("keypress"),keys:W(p())}),v({type:S("drag"),path:W(v({x:R(),y:R()}))})]),qS=We("type",[OS,RS,Np,zS]),Qc=mt.extend({type:S("message").optional()}),co=Qc.extend({role:S("assistant"),status:Ae(["in_progress","completed","incomplete"]),content:W(qS)}),XS=We("type",[Kc,$p,zp,Np]),Dp=Qc.extend({role:S("user"),content:W(XS).or(p())}),Lp=Qc.extend({role:S("system"),content:p()});We("role",[Lp,co,Dp]);const $s=mt.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()}),zs=mt.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:Ae(["in_progress","completed","incomplete"]).optional(),arguments:p()});v({type:S("tool_reference"),functionName:p(),namespace:p().optional()});const JS=me(p(),ee()),KS=cc(),el=mt.extend({type:S("tool_search_call"),call_id:p().nullable().optional(),callId:p().nullable().optional(),execution:Ae(["client","server"]).optional(),arguments:KS,status:p().optional()}),tl=mt.extend({type:S("tool_search_output"),call_id:p().nullable().optional(),callId:p().nullable().optional(),execution:Ae(["client","server"]).optional(),status:p().optional(),tools:W(JS)}),QS=We("type",[NS,HS,WS]),eT=We("type",[Kc,$p,zp]),qi=mt.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:Ae(["in_progress","completed","incomplete"]),output:Zt([p(),QS,W(eT)]).describe("Output returned by the tool call. Supports plain strings, legacy ToolOutput items, or structured input_* items.")}),lo=mt.extend({type:S("computer_call"),callId:p().describe("The ID of the computer call"),status:Ae(["in_progress","completed","incomplete"]),action:td.optional(),actions:W(td).min(1).optional()}).superRefine((t,e)=>{!t.action&&(!t.actions||t.actions.length===0)&&e.addIssue({code:wS.custom,message:"computer_call items must include action or actions.",path:["action"]})}),Zp=mt.extend({type:S("computer_call_result"),callId:p().describe("The ID of the computer call"),output:YS}),tT=v({commands:W(p()),timeoutMs:R().int().min(0).optional(),maxOutputLength:R().int().min(0).optional()}),uo=mt.extend({type:S("shell_call"),callId:p(),status:Ae(["in_progress","completed","incomplete"]).optional(),action:tT}),nT=We("type",[v({type:S("timeout")}),v({type:S("exit"),exitCode:R().int().nullable()})]),rT=v({stdout:p(),stderr:p(),outcome:nT}).passthrough(),nl=mt.extend({type:S("shell_call_output"),callId:p(),maxOutputLength:R().optional(),output:W(rT)}),sT=v({type:S("create_file"),path:p(),diff:p()}),iT=v({type:S("update_file"),path:p(),diff:p()}),oT=v({type:S("delete_file"),path:p()}),aT=We("type",[sT,iT,oT]),ho=mt.extend({type:S("apply_patch_call"),callId:p(),status:Ae(["in_progress","completed"]),operation:aT}),rl=mt.extend({type:S("apply_patch_call_output"),callId:p(),status:Ae(["completed","failed"]),output:p().optional()}),cT=We("type",[lo,uo,ho,zs,$s]),sl=Ue.extend({id:p().optional(),type:S("reasoning"),content:W(Kc),rawContent:W($S).optional()}),Fp=mt.extend({type:S("compaction"),encrypted_content:p(),id:p().optional(),created_by:p().optional()}),Bp=mt.extend({type:S("unknown")}),Up=We("type",[co,el,tl,$s,zs,lo,uo,ho,qi,nl,rl,sl,Fp,Bp]),lT=Zt([Dp,co,Lp,el,tl,$s,zs,lo,uo,ho,qi,Zp,nl,rl,sl,Fp,Bp]),uT=v({inputTokens:R(),outputTokens:R(),totalTokens:R(),inputTokensDetails:me(p(),R()).optional(),outputTokensDetails:me(p(),R()).optional(),endpoint:p().optional()}),hT=v({requests:R().optional(),inputTokens:R(),outputTokens:R(),totalTokens:R(),inputTokensDetails:Zt([me(p(),R()),W(me(p(),R()))]).optional(),outputTokensDetails:Zt([me(p(),R()),W(me(p(),R()))]).optional(),requestUsageEntries:W(uT).optional()}),dT=Ue.extend({type:S("output_text_delta"),delta:p()}),fT=Ue.extend({type:S("response_started")}),pT=Ue.extend({type:S("response_done"),response:Ue.extend({id:p(),requestId:p().optional(),usage:hT,output:W(Up)})}),mT=Ue.extend({type:S("model"),event:ee().describe("The event from the model")});We("type",[dT,pT,fT,mT]);const nd=Symbol.for("openai.agents.core.asyncLocalStorage");let la;function gT(){try{const t=globalThis,e=t[nd];if(e)return e;const n=new Qh;return t[nd]=n,n}catch{return la||(la=new Qh),la}}function jp(){const t=gT().getStore();if((t==null?void 0:t.active)===!0)return t}function rd(){const t=jp();return t!=null&&t.trace?t.trace:null}function sd(){const t=jp();return t!=null&&t.span?t.span:null}class _T{async export(e){if(Rp.disabled){Se.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 Ls,xr,Zs,Fs,br,qe,en,xn,bn,vr,dt,hc,dc,fr;class yT{constructor(e,{maxQueueSize:n=1e3,maxBatchSize:r=100,scheduleDelay:s=5e3,exportTriggerRatio:i=.8}={}){ge(this,dt);ge(this,Ls);ge(this,xr);ge(this,Zs);ge(this,Fs);ge(this,br);ge(this,qe,[]);ge(this,en);ge(this,xn,null);ge(this,bn,!1);ge(this,vr,null);te(this,Ls,n),te(this,xr,r),te(this,Zs,s),te(this,Fs,n*i),te(this,br,e),te(this,en,MS),Se.debug("Automatic trace export loop is not supported in this environment. You need to manually call `getGlobalTraceProvider().forceFlush()` to export traces.")}start(){te(this,vr,new AbortController),Mt(this,dt,dc).call(this)}async onTraceStart(e){await Mt(this,dt,hc).call(this,e)}async onTraceEnd(e){}async onSpanStart(e){}async onSpanEnd(e){await Mt(this,dt,hc).call(this,e)}async shutdown(e){var n;for(e&&O(this,en).setTimeout(()=>{var r;(r=O(this,vr))==null||r.abort()},e),Se.debug("Shutting down gracefully");O(this,qe).length>0;){if(Se.debug(`Waiting for buffer to empty. Items left: ${O(this,qe).length}`),O(this,bn)||await Mt(this,dt,fr).call(this,!0),(n=O(this,vr))!=null&&n.signal.aborted){Se.debug("Timeout reached, force flushing"),await Mt(this,dt,fr).call(this,!0);break}await new Promise(r=>O(this,en).setTimeout(r,500))}Se.debug("Buffer empty. Exiting"),O(this,en)&&O(this,xn)&&O(this,en).clearTimeout(O(this,xn))}async forceFlush(){O(this,qe).length>0&&await Mt(this,dt,fr).call(this,!0)}}Ls=new WeakMap,xr=new WeakMap,Zs=new WeakMap,Fs=new WeakMap,br=new WeakMap,qe=new WeakMap,en=new WeakMap,xn=new WeakMap,bn=new WeakMap,vr=new WeakMap,dt=new WeakSet,hc=async function(e){if(O(this,qe).length+1>O(this,Ls)){Se.error("Dropping trace because buffer is full");return}O(this,qe).push(e),O(this,qe).length>O(this,Fs)&&await Mt(this,dt,fr).call(this)},dc=function(){te(this,xn,O(this,en).setTimeout(async()=>{await Mt(this,dt,fr).call(this),Mt(this,dt,dc).call(this)},O(this,Zs))),typeof O(this,xn).unref=="function"&&O(this,xn).unref()},fr=async function(e=!1){if(O(this,qe).length!==0){if(Se.debug(`Exporting batches. Force: ${e}. Buffer size: ${O(this,qe).length}`),e||O(this,qe).length<O(this,xr)){const n=[...O(this,qe)];te(this,qe,[]),te(this,bn,!0),await O(this,br).export(n),te(this,bn,!1)}else if(O(this,qe).length>0){const n=O(this,qe).splice(0,O(this,xr));te(this,bn,!0),await O(this,br).export(n),te(this,bn,!1)}}};var yt;class xT{constructor(){ge(this,yt,[])}start(){for(const e of O(this,yt))e.start&&e.start()}addTraceProcessor(e){O(this,yt).push(e)}setProcessors(e){Se.debug("Shutting down old processors");for(const n of O(this,yt))n.shutdown();te(this,yt,e)}async onTraceStart(e){for(const n of O(this,yt))await n.onTraceStart(e)}async onTraceEnd(e){for(const n of O(this,yt))await n.onTraceEnd(e)}async onSpanStart(e){for(const n of O(this,yt))await n.onSpanStart(e)}async onSpanEnd(e){for(const n of O(this,yt))await n.onSpanEnd(e)}async shutdown(e){for(const n of O(this,yt))await n.shutdown(e)}async forceFlush(){for(const e of O(this,yt))await e.forceFlush()}}yt=new WeakMap;let ua=null,ha=null;function bT(){return ua||(ua=new _T),ua}function Gp(){return ha||(ha=new yT(bT())),ha}function id(){return new Date().toISOString()}function Vp(){return`trace_${Op().replace(/-/g,"")}`}function vT(){return`span_${Op().replace(/-/g,"").slice(0,24)}`}function wT(t){return Object.fromEntries(Object.entries(t).filter(([e])=>!e.startsWith("_")))}var Bs,Us,js,Gs,Vs,Vn,vn,wn,Hn,wr,Hs;const il=class il{constructor(e,n){ie(this,"type","trace.span");ge(this,Bs);ge(this,Us);ge(this,js);ge(this,Gs);ge(this,Vs);ge(this,Vn);ge(this,vn);ge(this,wn);ge(this,Hn);ge(this,wr);ge(this,Hs);te(this,Us,e.traceId),te(this,js,e.spanId??vT()),te(this,Bs,e.data),te(this,Vn,n),te(this,Gs,e.parentId??null),te(this,Vs,e.traceMetadata),te(this,Hn,e.error??null),te(this,vn,e.startedAt??null),te(this,wn,e.endedAt??null),te(this,wr,e.tracingApiKey)}get traceId(){return O(this,Us)}get spanData(){return O(this,Bs)}get traceMetadata(){return O(this,Vs)}get spanId(){return O(this,js)}get parentId(){return O(this,Gs)}get previousSpan(){return O(this,Hs)}set previousSpan(e){te(this,Hs,e)}start(){if(O(this,vn)){Se.warn("Span already started");return}te(this,vn,id()),O(this,Vn).onSpanStart(this)}end(){if(O(this,wn)){Se.debug("Span already finished",this.spanData);return}te(this,wn,id()),O(this,Vn).onSpanEnd(this)}setError(e){te(this,Hn,e)}get error(){return O(this,Hn)}get startedAt(){return O(this,vn)}get endedAt(){return O(this,wn)}get tracingApiKey(){return O(this,wr)}clone(){var n;const e=new il({traceId:this.traceId,spanId:this.spanId,parentId:this.parentId??void 0,data:this.spanData,traceMetadata:this.traceMetadata,startedAt:O(this,vn)??void 0,endedAt:O(this,wn)??void 0,error:O(this,Hn)??void 0,tracingApiKey:O(this,wr)},O(this,Vn));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:wT(this.spanData),error:this.error}}};Bs=new WeakMap,Us=new WeakMap,js=new WeakMap,Gs=new WeakMap,Vs=new WeakMap,Vn=new WeakMap,vn=new WeakMap,wn=new WeakMap,Hn=new WeakMap,wr=new WeakMap,Hs=new WeakMap;let Ns=il;class gn extends Ns{constructor(e,n){super({traceId:"no-op",spanId:"no-op",data:e},n)}start(){}end(){}setError(){}toJSON(){return null}}var kr,tn;const ol=class ol{constructor(e,n){ie(this,"type","trace");ie(this,"traceId");ie(this,"name");ie(this,"groupId",null);ie(this,"metadata");ie(this,"tracingApiKey");ge(this,kr);ge(this,tn);this.traceId=e.traceId??Vp(),this.name=e.name??"Agent workflow",this.groupId=e.groupId??null,this.metadata=e.metadata??{},this.tracingApiKey=e.tracingApiKey,te(this,kr,n??Gp()),te(this,tn,e.started??!1)}async start(){O(this,tn)||(te(this,tn,!0),await O(this,kr).onTraceStart(this))}async end(){O(this,tn)&&(te(this,tn,!1),await O(this,kr).onTraceEnd(this))}clone(){return new ol({traceId:this.traceId,name:this.name,groupId:this.groupId??void 0,metadata:this.metadata,started:O(this,tn),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}};kr=new WeakMap,tn=new WeakMap;let Ds=ol;class da extends Ds{constructor(){super({})}async start(){}async end(){}toJSON(){return null}}var He,Wn,nn,Xi,Wp;class Hp{constructor(){ge(this,Xi);ge(this,He);ge(this,Wn);ge(this,nn);te(this,He,new xT),te(this,Wn,Rp.disabled),te(this,nn,null),Mt(this,Xi,Wp).call(this)}registerProcessor(e){te(this,nn,null),O(this,He).addTraceProcessor(e)}setProcessors(e){te(this,nn,null),O(this,He).setProcessors(e)}getCurrentTrace(){return rd()}getCurrentSpan(){return sd()}setDisabled(e){te(this,Wn,e)}startExportLoop(){O(this,He).start()}createTrace(e){if(O(this,Wn))return Se.debug("Tracing is disabled, Not creating trace %o",e),new da;const n=e.traceId??Vp(),r=e.name??"Agent workflow";return Se.debug("Creating trace %s with name %s",n,r),new Ds({...e,name:r,traceId:n},O(this,He))}createSpan(e,n){if(O(this,Wn)||e.disabled)return Se.debug("Tracing is disabled, Not creating span %o",e),new gn(e.data,O(this,He));let r,s,i,o;if(n){if(n instanceof Ds){if(n instanceof da)return Se.debug("Parent trace is no-op, returning NoopSpan"),new gn(e.data,O(this,He));s=n.traceId,i=n.tracingApiKey,o=n.metadata}else if(n instanceof Ns){if(n instanceof gn)return Se.debug("Parent span is no-op, returning NoopSpan"),new gn(e.data,O(this,He));r=n.spanId,s=n.traceId,i=n.tracingApiKey,o=n.traceMetadata}}else{const a=rd(),c=sd();if(!a)return Se.error("No active trace. Make sure to start a trace with `withTrace()` first. Returning NoopSpan."),new gn(e.data,O(this,He));if(c instanceof gn||a instanceof da)return Se.debug(`Parent ${c} or ${a} is no-op, returning NoopSpan`),new gn(e.data,O(this,He));s=a.traceId,i=a.tracingApiKey,o=a.metadata,c?(Se.debug("Using parent span %s",c.spanId),r=c.spanId):Se.debug("No parent span, using current trace %s",a.traceId)}return s?(Se.debug(`Creating span ${JSON.stringify(e.data)} with id ${e.spanId??s}`),new Ns({...e,traceId:s,parentId:r,traceMetadata:o??e.traceMetadata,tracingApiKey:i??e.tracingApiKey},O(this,He))):(Se.error("No traceId found. Make sure to start a trace with `withTrace()` first. Returning NoopSpan."),new gn(e.data,O(this,He)))}async shutdown(e){O(this,nn)||te(this,nn,(async()=>{try{Se.debug("Shutting down tracing provider"),await O(this,He).shutdown(e)}catch(n){Se.error("Error shutting down tracing provider %o",n)}})()),await O(this,nn)}async forceFlush(){await O(this,He).forceFlush()}}He=new WeakMap,Wn=new WeakMap,nn=new WeakMap,Xi=new WeakSet,Wp=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(),od("SIGINT")||process.exit(130)}),process.on("SIGTERM",async()=>{await e(),od("SIGTERM")||process.exit(0)}),process.on("unhandledRejection",async(n,r)=>{Se.error("Unhandled rejection",n,r),await e(),kT("unhandledRejection")||process.exit(1)})}};let fa;function od(t){return process.listeners(t).length>1}function kT(t){return process.listeners(t).length>1}function ST(){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 vi();if(!r)try{Object.defineProperty(e,t,{value:void 0,writable:!0,configurable:!0})}catch{return vi()}try{const s=new Hp;return e[t]=s,s}catch{return vi()}}catch{return vi()}}function vi(){return fa||(fa=new Hp),fa}function TT(t){ST().registerProcessor(t)}const AT=We("type",[v({type:S("next_step_handoff"),newAgent:ee()}),v({type:S("next_step_final_output"),output:p()}),v({type:S("next_step_run_again")}),v({type:S("next_step_interruption"),data:me(p(),ee())})]),CT="1.8",ET=["1.0","1.1","1.2","1.3","1.4","1.5","1.6","1.7",CT],IT=Ae(ET),wt=v({name:p()}),PT=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:me(p(),ee()).optional()}).nullable(),span_data:me(p(),ee())}),Yp=PT.extend({previous_span:xS(()=>Yp).optional()}),MT=v({inputTokens:R(),outputTokens:R(),totalTokens:R(),inputTokensDetails:me(p(),R()).optional(),outputTokensDetails:me(p(),R()).optional(),endpoint:p().optional()}),qp=v({requests:R(),inputTokens:R(),outputTokens:R(),totalTokens:R(),inputTokensDetails:W(me(p(),R())).optional(),outputTokensDetails:W(me(p(),R())).optional(),requestUsageEntries:W(MT).optional()}),ad=v({usage:qp,output:W(Up),responseId:p().optional(),requestId:p().optional(),providerData:me(p(),ee()).optional()}),Xp=We("type",[v({type:S("message_output_item"),rawItem:co,agent:wt}),v({type:S("tool_search_call_item"),rawItem:el,agent:wt}),v({type:S("tool_search_output_item"),rawItem:tl,agent:wt}),v({type:S("tool_call_item"),rawItem:cT.or($s),agent:wt}),v({type:S("tool_call_output_item"),rawItem:qi.or(Zp).or(nl).or(rl),agent:wt,output:p()}),v({type:S("reasoning_item"),rawItem:sl,agent:wt}),v({type:S("handoff_call_item"),rawItem:zs,agent:wt}),v({type:S("handoff_output_item"),rawItem:qi,sourceAgent:wt,targetAgent:wt}),v({type:S("tool_approval_item"),rawItem:zs.or($s).or(lo).or(uo).or(ho),agent:wt,toolName:p().optional()})]),RT=v({object:S("trace"),id:p(),workflow_name:p(),group_id:p().nullable(),metadata:me(p(),ee()),tracing_api_key:p().optional().nullable()}),OT=v({newItems:W(Xp),toolsUsed:W(p()),handoffs:W(v({toolCall:ee(),handoff:ee()})),functions:W(v({toolCall:ee(),tool:ee()})),computerActions:W(v({toolCall:ee(),computer:ee()})),shellActions:W(v({toolCall:ee(),shell:ee()})).optional(),applyPatchActions:W(v({toolCall:ee(),applyPatch:ee()})).optional(),mcpApprovalRequests:W(v({requestItem:v({rawItem:v({type:S("hosted_tool_call"),name:p(),arguments:p().optional(),status:p().optional(),output:p().optional(),providerData:me(p(),ee()).nullable().optional()})}),mcpTool:v({type:S("hosted_tool"),name:S("hosted_mcp"),providerData:me(p(),ee())})})).optional()}),Jp=v({tripwireTriggered:Sn(),outputInfo:ee()}),$T=We("type",[v({type:S("allow")}),v({type:S("rejectContent"),message:p()}),v({type:S("throwException")})]),Kp=v({outputInfo:ee().optional(),behavior:$T}),Qp=v({type:Zt([S("tool_input"),S("tool_output")]),name:p()}),zT=v({guardrail:v({type:S("input"),name:p()}),output:Jp}),NT=v({guardrail:v({type:S("output"),name:p()}),agentOutput:ee(),agent:wt,output:Jp}),DT=v({guardrail:Qp.extend({type:S("tool_input")}),output:Kp}),LT=v({guardrail:Qp.extend({type:S("tool_output")}),output:Kp});v({$schemaVersion:IT,currentTurn:R(),currentAgent:wt,originalInput:p().or(W(lT)),modelResponses:W(ad),context:v({usage:qp,approvals:me(p(),v({approved:W(p()).or(Sn()),rejected:W(p()).or(Sn()),messages:me(p(),p()).optional(),stickyRejectMessage:p().optional()})),context:me(p(),ee()),toolInput:ee().optional()}),toolUseTracker:me(p(),W(p())),maxTurns:R(),currentAgentSpan:Yp.nullable().optional(),noActiveAgentRun:Sn(),inputGuardrailResults:W(zT),outputGuardrailResults:W(NT),toolInputGuardrailResults:W(DT).optional().default([]),toolOutputGuardrailResults:W(LT).optional().default([]),currentTurnInProgress:Sn().optional(),currentStep:AT.optional(),lastModelResponse:ad.optional(),generatedItems:W(Xp),pendingAgentToolRuns:me(p(),p()).optional().default({}),lastProcessedResponse:OT.optional(),currentTurnPersistedItemCount:R().int().min(0).optional(),conversationId:p().optional(),previousResponseId:p().optional(),reasoningItemIdPolicy:Ae(["preserve","omit"]).optional(),trace:RT.nullable()});v({input:p()});Jc("openai-agents:mcp-servers");TT(Gp());v({itemId:p()});We("role",[v({itemId:p(),previousItemId:p().nullable().optional(),type:S("message"),role:S("system"),content:W(v({type:S("input_text"),text:p()}))}),v({itemId:p(),previousItemId:p().nullable().optional(),type:S("message"),role:S("user"),status:Ae(["in_progress","completed"]),content:W(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:Ae(["in_progress","completed","incomplete"]),content:W(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:Ae(["in_progress","completed","incomplete"]),arguments:p(),name:p(),output:p().nullable()});v({itemId:p(),previousItemId:p().nullable().optional(),type:Ae(["mcp_call","mcp_tool_call"]),status:Ae(["in_progress","completed","incomplete"]),arguments:p(),name:p(),output:p().nullable()});v({itemId:p(),type:S("mcp_approval_request"),serverLabel:p(),name:p(),arguments:me(p(),ee()),approved:Sn().optional().nullable()});Jc("openai-agents:realtime");const em=v({id:p().optional().nullable(),conversation_id:p().optional().nullable(),max_output_tokens:R().or(S("inf")).optional().nullable(),metadata:me(p(),ee()).optional().nullable(),output_modalities:W(p()).optional().nullable(),object:S("realtime.response").optional().nullable(),output:W(ee()).optional().nullable(),audio:v({output:v({format:ee().optional().nullable(),voice:p().optional().nullable()}).optional().nullable()}).optional().nullable(),status:Ae(["completed","incomplete","failed","cancelled","in_progress"]).optional().nullable(),status_details:me(p(),ee()).optional().nullable(),usage:v({input_tokens:R().optional(),input_token_details:me(p(),ee()).optional().nullable(),output_tokens:R().optional(),output_token_details:me(p(),ee()).optional().nullable()}).optional().nullable()}),ZT=v({id:p().optional(),audio:p().nullable().optional(),text:p().nullable().optional(),transcript:p().nullable().optional(),type:Zt([S("input_text"),S("input_audio"),S("item_reference"),S("output_text"),S("output_audio")])}),Fr=v({id:p().optional(),arguments:p().optional(),call_id:p().optional(),content:W(ZT).optional(),name:p().optional(),output:p().nullable().optional(),role:Ae(["user","assistant","system"]).optional(),status:Ae(["completed","incomplete","in_progress"]).optional(),type:Ae(["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:Sn().nullable().optional(),reason:p().nullable().optional(),server_label:p().optional(),error:ee().nullable().optional(),tools:W(v({name:p(),description:p(),input_schema:me(p(),ee()).optional()}).passthrough()).optional()}).passthrough(),FT=v({type:S("conversation.created"),event_id:p(),conversation:v({id:p().optional(),object:S("realtime.conversation").optional()})}),BT=v({type:S("conversation.item.added"),event_id:p(),item:Fr,previous_item_id:p().nullable().optional()}),UT=v({type:S("conversation.item.done"),event_id:p(),item:Fr,previous_item_id:p().nullable().optional()}),jT=v({type:S("conversation.item.deleted"),event_id:p(),item_id:p()}),GT=v({type:S("conversation.item.input_audio_transcription.completed"),event_id:p(),item_id:p(),content_index:R(),transcript:p(),logprobs:W(ee()).nullable().optional(),usage:v({type:S("tokens"),total_tokens:R(),input_tokens:R(),input_token_details:v({text_tokens:R(),audio_tokens:R()}),output_tokens:R()}).optional()}),VT=v({type:S("conversation.item.input_audio_transcription.delta"),event_id:p(),item_id:p(),content_index:R().optional(),delta:p().optional(),logprobs:W(ee()).nullable().optional()}),HT=v({type:S("conversation.item.input_audio_transcription.failed"),event_id:p(),item_id:p(),content_index:R(),error:v({code:p().optional(),message:p().optional(),param:p().optional(),type:p().optional()})}),WT=v({type:S("conversation.item.retrieved"),event_id:p(),item:Fr}),YT=v({type:S("conversation.item.truncated"),event_id:p(),item_id:p(),audio_end_ms:R(),content_index:R()}),qT=v({type:S("conversation.item.create"),item:Fr,event_id:p().optional(),previous_item_id:p().nullable().optional()}),XT=v({type:S("conversation.item.delete"),item_id:p(),event_id:p().optional()}),JT=v({type:S("conversation.item.retrieve"),item_id:p(),event_id:p().optional()}),KT=v({type:S("conversation.item.truncate"),item_id:p(),audio_end_ms:R(),content_index:R(),event_id:p().optional()}),QT=v({type:S("error"),event_id:p().optional(),error:ee().optional()}),eA=v({type:S("input_audio_buffer.cleared"),event_id:p()}),tA=v({type:S("input_audio_buffer.append"),audio:p(),event_id:p().optional()}),nA=v({type:S("input_audio_buffer.clear"),event_id:p().optional()}),rA=v({type:S("input_audio_buffer.commit"),event_id:p().optional()}),sA=v({type:S("input_audio_buffer.committed"),event_id:p(),item_id:p(),previous_item_id:p().nullable().optional()}),iA=v({type:S("input_audio_buffer.speech_started"),event_id:p(),item_id:p(),audio_start_ms:R()}),oA=v({type:S("input_audio_buffer.speech_stopped"),event_id:p(),item_id:p(),audio_end_ms:R()}),aA=v({type:S("output_audio_buffer.started"),event_id:p()}).passthrough(),cA=v({type:S("output_audio_buffer.stopped"),event_id:p()}).passthrough(),lA=v({type:S("output_audio_buffer.cleared"),event_id:p()}),uA=v({type:S("rate_limits.updated"),event_id:p(),rate_limits:W(v({limit:R().optional(),name:Ae(["requests","tokens"]).optional(),remaining:R().optional(),reset_seconds:R().optional()}))}),hA=v({type:S("response.output_audio.delta"),event_id:p(),item_id:p(),content_index:R(),delta:p(),output_index:R(),response_id:p()}),dA=v({type:S("response.output_audio.done"),event_id:p(),item_id:p(),content_index:R(),output_index:R(),response_id:p()}),fA=v({type:S("response.output_audio_transcript.delta"),event_id:p(),item_id:p(),content_index:R(),delta:p(),output_index:R(),response_id:p()}),pA=v({type:S("response.output_audio_transcript.done"),event_id:p(),item_id:p(),content_index:R(),transcript:p(),output_index:R(),response_id:p()}),mA=v({type:S("response.content_part.added"),event_id:p(),item_id:p(),content_index:R(),output_index:R(),response_id:p(),part:v({audio:p().optional(),text:p().optional(),transcript:p().optional(),type:Ae(["text","audio"]).optional()})}),gA=v({type:S("response.content_part.done"),event_id:p(),item_id:p(),content_index:R(),output_index:R(),response_id:p(),part:v({audio:p().optional(),text:p().optional(),transcript:p().optional(),type:Ae(["text","audio"]).optional()})}),_A=v({type:S("response.created"),event_id:p(),response:em}),yA=v({type:S("response.done"),event_id:p(),response:em}),xA=v({type:S("response.function_call_arguments.delta"),event_id:p(),item_id:p(),call_id:p(),delta:p(),output_index:R(),response_id:p()}),bA=v({type:S("response.function_call_arguments.done"),event_id:p(),item_id:p(),call_id:p(),arguments:p(),output_index:R(),response_id:p()}),vA=v({type:S("response.output_item.added"),event_id:p(),item:Fr,output_index:R(),response_id:p()}),wA=v({type:S("response.output_item.done"),event_id:p(),item:Fr,output_index:R(),response_id:p()}),kA=v({type:S("response.output_text.delta"),event_id:p(),item_id:p(),content_index:R(),delta:p(),output_index:R(),response_id:p()}),SA=v({type:S("response.output_text.done"),event_id:p(),item_id:p(),content_index:R(),text:p(),output_index:R(),response_id:p()}),TA=v({type:S("session.created"),event_id:p(),session:ee()}),AA=v({type:S("session.updated"),event_id:p(),session:ee()}),CA=v({type:S("response.cancel"),event_id:p().optional(),response_id:p().optional()}),EA=v({type:S("response.create"),event_id:p().optional(),response:ee().optional()}),IA=v({type:S("session.update"),event_id:p().optional(),session:ee()}),PA=v({type:S("mcp_list_tools.in_progress"),event_id:p().optional(),item_id:p().optional()}),MA=v({type:S("mcp_list_tools.completed"),event_id:p().optional(),item_id:p().optional()}),RA=v({type:S("response.mcp_call_arguments.delta"),event_id:p(),response_id:p(),item_id:p(),output_index:R(),delta:p(),obfuscation:p()}),OA=v({type:S("response.mcp_call_arguments.done"),event_id:p(),response_id:p(),item_id:p(),output_index:R(),arguments:p()}),$A=v({type:S("response.mcp_call.in_progress"),event_id:p(),output_index:R(),item_id:p()}),zA=v({type:S("response.mcp_call.completed"),event_id:p(),output_index:R(),item_id:p()}),NA=v({type:S("mcp_list_tools.failed"),event_id:p().optional(),item_id:p().optional()});v({type:p(),event_id:p().optional().nullable()}).passthrough();We("type",[FT,BT,UT,jT,GT,VT,HT,WT,YT,QT,eA,sA,iA,oA,aA,cA,lA,uA,hA,dA,fA,pA,mA,gA,_A,yA,xA,bA,vA,wA,kA,SA,TA,AA,PA,MA,NA,RA,OA,$A,zA]);We("type",[qT,XT,JT,KT,tA,nA,rA,CA,EA,IA]);const pa={};var rn={};const DA=typeof process<"u"&&typeof(rn==null?void 0:rn.NEXT_PUBLIC_AGENT_PLAY_BASE)=="string"?rn.NEXT_PUBLIC_AGENT_PLAY_BASE.replace(/\/$/,""):typeof import.meta<"u"&&"/agent-play/".replace(/\/$/,"")||"";typeof process<"u"&&typeof(rn==null?void 0:rn.NEXT_PUBLIC_PLAY_API_BASE)=="string"&&rn.NEXT_PUBLIC_PLAY_API_BASE.length>0?rn.NEXT_PUBLIC_PLAY_API_BASE.replace(/\/$/,""):typeof import.meta<"u"&&typeof(pa==null?void 0:pa.VITE_PLAY_API_BASE)=="string"&&(void 0).length>0&&(void 0).replace(/\/$/,"");rx({});new qt;new Mi;new qt;new qt;new qt;new qt;export{Si as B,qt as C,we as E,Ki as G,ce as M,Ke as P,ka as R,xc as S,ci as T,ba as U,Rn as a,Jd as b,Vd as c,qd as d,bt as e,Ad as f,ve as g,b_ as h,Dt as i,Fm as r,xt as w};