zion-mcp 2.0.9 → 2.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/server.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __nodeCreateRequire } from 'node:module';
2
2
  const require = __nodeCreateRequire(import.meta.url);
3
- import{a as K,c as _,d as vy,e as Rt,g as p,h as g}from"./chunk-LIZH3M5S.js";var ca=_((by,Fx)=>{p();var td=K("buffer"),Vn=td.Buffer;function qx(e,t){for(var r in e)t[r]=e[r]}Vn.from&&Vn.alloc&&Vn.allocUnsafe&&Vn.allocUnsafeSlow?Fx.exports=td:(qx(td,by),by.Buffer=qo);function qo(e,t,r){return Vn(e,t,r)}qo.prototype=Object.create(Vn.prototype);qx(Vn,qo);qo.from=function(e,t,r){if(typeof e=="number")throw new TypeError("Argument must not be a number");return Vn(e,t,r)};qo.alloc=function(e,t,r){if(typeof e!="number")throw new TypeError("Argument must be a number");var n=Vn(e);return t!==void 0?typeof r=="string"?n.fill(t,r):n.fill(t):n.fill(0),n};qo.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Vn(e)};qo.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return td.SlowBuffer(e)}});var Sy=_((aTe,Ux)=>{p();var rd=ca().Buffer,UZ=K("stream"),zZ=K("util");function nd(e){if(this.buffer=null,this.writable=!0,this.readable=!0,!e)return this.buffer=rd.alloc(0),this;if(typeof e.pipe=="function")return this.buffer=rd.alloc(0),e.pipe(this),this;if(e.length||typeof e=="object")return this.buffer=e,this.writable=!1,process.nextTick(function(){this.emit("end",e),this.readable=!1,this.emit("close")}.bind(this)),this;throw new TypeError("Unexpected data type ("+typeof e+")")}zZ.inherits(nd,UZ);nd.prototype.write=function(t){this.buffer=rd.concat([this.buffer,rd.from(t)]),this.emit("data",t)};nd.prototype.end=function(t){t&&this.write(t),this.emit("end",t),this.emit("close"),this.writable=!1,this.readable=!1};Ux.exports=nd});var Gx=_((uTe,zx)=>{"use strict";p();function Oy(e){var t=(e/8|0)+(e%8===0?0:1);return t}var GZ={ES256:Oy(256),ES384:Oy(384),ES512:Oy(521)};function VZ(e){var t=GZ[e];if(t)return t;throw new Error('Unknown algorithm "'+e+'"')}zx.exports=VZ});var Wx=_((pTe,Qx)=>{"use strict";p();var id=ca().Buffer,Bx=Gx(),od=128,Zx=0,BZ=32,ZZ=16,KZ=2,Kx=ZZ|BZ|Zx<<6,sd=KZ|Zx<<6;function HZ(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Hx(e){if(id.isBuffer(e))return e;if(typeof e=="string")return id.from(e,"base64");throw new TypeError("ECDSA signature must be a Base64 string or a Buffer")}function QZ(e,t){e=Hx(e);var r=Bx(t),n=r+1,i=e.length,o=0;if(e[o++]!==Kx)throw new Error('Could not find expected "seq"');var s=e[o++];if(s===(od|1)&&(s=e[o++]),i-o<s)throw new Error('"seq" specified length of "'+s+'", only "'+(i-o)+'" remaining');if(e[o++]!==sd)throw new Error('Could not find expected "int" for "r"');var a=e[o++];if(i-o-2<a)throw new Error('"r" specified length of "'+a+'", only "'+(i-o-2)+'" available');if(n<a)throw new Error('"r" specified length of "'+a+'", max of "'+n+'" is acceptable');var c=o;if(o+=a,e[o++]!==sd)throw new Error('Could not find expected "int" for "s"');var u=e[o++];if(i-o!==u)throw new Error('"s" specified length of "'+u+'", expected "'+(i-o)+'"');if(n<u)throw new Error('"s" specified length of "'+u+'", max of "'+n+'" is acceptable');var l=o;if(o+=u,o!==i)throw new Error('Expected to consume entire buffer, but "'+(i-o)+'" bytes remain');var d=r-a,f=r-u,h=id.allocUnsafe(d+a+f+u);for(o=0;o<d;++o)h[o]=0;e.copy(h,o,c+Math.max(-d,0),c+a),o=r;for(var m=o;o<m+f;++o)h[o]=0;return e.copy(h,o,l+Math.max(-f,0),l+u),h=h.toString("base64"),h=HZ(h),h}function Vx(e,t,r){for(var n=0;t+n<r&&e[t+n]===0;)++n;var i=e[t+n]>=od;return i&&--n,n}function WZ(e,t){e=Hx(e);var r=Bx(t),n=e.length;if(n!==r*2)throw new TypeError('"'+t+'" signatures must be "'+r*2+'" bytes, saw "'+n+'"');var i=Vx(e,0,r),o=Vx(e,r,e.length),s=r-i,a=r-o,c=2+s+1+1+a,u=c<od,l=id.allocUnsafe((u?2:3)+c),d=0;return l[d++]=Kx,u?l[d++]=c:(l[d++]=od|1,l[d++]=c&255),l[d++]=sd,l[d++]=s,i<0?(l[d++]=0,d+=e.copy(l,d,0,r)):d+=e.copy(l,d,i,r),l[d++]=sd,l[d++]=a,o<0?(l[d++]=0,e.copy(l,d,r)):e.copy(l,d,r+o),l}Qx.exports={derToJose:QZ,joseToDer:WZ}});var Yx=_((fTe,Jx)=>{"use strict";p();var iu=K("buffer").Buffer,Iy=K("buffer").SlowBuffer;Jx.exports=ad;function ad(e,t){if(!iu.isBuffer(e)||!iu.isBuffer(t)||e.length!==t.length)return!1;for(var r=0,n=0;n<e.length;n++)r|=e[n]^t[n];return r===0}ad.install=function(){iu.prototype.equal=Iy.prototype.equal=function(t){return ad(this,t)}};var JZ=iu.prototype.equal,YZ=Iy.prototype.equal;ad.restore=function(){iu.prototype.equal=JZ,Iy.prototype.equal=YZ}});var Ny=_((mTe,aA)=>{p();var la=ca().Buffer,Wr=K("crypto"),eA=Wx(),Xx=K("util"),XZ=`"%s" is not a valid algorithm.
3
+ import{a as K,c as _,d as vy,e as Rt,g as p,h as g}from"./chunk-BL6OZVKX.js";var ca=_((by,Fx)=>{p();var td=K("buffer"),Vn=td.Buffer;function qx(e,t){for(var r in e)t[r]=e[r]}Vn.from&&Vn.alloc&&Vn.allocUnsafe&&Vn.allocUnsafeSlow?Fx.exports=td:(qx(td,by),by.Buffer=qo);function qo(e,t,r){return Vn(e,t,r)}qo.prototype=Object.create(Vn.prototype);qx(Vn,qo);qo.from=function(e,t,r){if(typeof e=="number")throw new TypeError("Argument must not be a number");return Vn(e,t,r)};qo.alloc=function(e,t,r){if(typeof e!="number")throw new TypeError("Argument must be a number");var n=Vn(e);return t!==void 0?typeof r=="string"?n.fill(t,r):n.fill(t):n.fill(0),n};qo.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Vn(e)};qo.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return td.SlowBuffer(e)}});var Sy=_((aTe,Ux)=>{p();var rd=ca().Buffer,UZ=K("stream"),zZ=K("util");function nd(e){if(this.buffer=null,this.writable=!0,this.readable=!0,!e)return this.buffer=rd.alloc(0),this;if(typeof e.pipe=="function")return this.buffer=rd.alloc(0),e.pipe(this),this;if(e.length||typeof e=="object")return this.buffer=e,this.writable=!1,process.nextTick(function(){this.emit("end",e),this.readable=!1,this.emit("close")}.bind(this)),this;throw new TypeError("Unexpected data type ("+typeof e+")")}zZ.inherits(nd,UZ);nd.prototype.write=function(t){this.buffer=rd.concat([this.buffer,rd.from(t)]),this.emit("data",t)};nd.prototype.end=function(t){t&&this.write(t),this.emit("end",t),this.emit("close"),this.writable=!1,this.readable=!1};Ux.exports=nd});var Gx=_((uTe,zx)=>{"use strict";p();function Oy(e){var t=(e/8|0)+(e%8===0?0:1);return t}var GZ={ES256:Oy(256),ES384:Oy(384),ES512:Oy(521)};function VZ(e){var t=GZ[e];if(t)return t;throw new Error('Unknown algorithm "'+e+'"')}zx.exports=VZ});var Wx=_((pTe,Qx)=>{"use strict";p();var id=ca().Buffer,Bx=Gx(),od=128,Zx=0,BZ=32,ZZ=16,KZ=2,Kx=ZZ|BZ|Zx<<6,sd=KZ|Zx<<6;function HZ(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Hx(e){if(id.isBuffer(e))return e;if(typeof e=="string")return id.from(e,"base64");throw new TypeError("ECDSA signature must be a Base64 string or a Buffer")}function QZ(e,t){e=Hx(e);var r=Bx(t),n=r+1,i=e.length,o=0;if(e[o++]!==Kx)throw new Error('Could not find expected "seq"');var s=e[o++];if(s===(od|1)&&(s=e[o++]),i-o<s)throw new Error('"seq" specified length of "'+s+'", only "'+(i-o)+'" remaining');if(e[o++]!==sd)throw new Error('Could not find expected "int" for "r"');var a=e[o++];if(i-o-2<a)throw new Error('"r" specified length of "'+a+'", only "'+(i-o-2)+'" available');if(n<a)throw new Error('"r" specified length of "'+a+'", max of "'+n+'" is acceptable');var c=o;if(o+=a,e[o++]!==sd)throw new Error('Could not find expected "int" for "s"');var u=e[o++];if(i-o!==u)throw new Error('"s" specified length of "'+u+'", expected "'+(i-o)+'"');if(n<u)throw new Error('"s" specified length of "'+u+'", max of "'+n+'" is acceptable');var l=o;if(o+=u,o!==i)throw new Error('Expected to consume entire buffer, but "'+(i-o)+'" bytes remain');var d=r-a,f=r-u,h=id.allocUnsafe(d+a+f+u);for(o=0;o<d;++o)h[o]=0;e.copy(h,o,c+Math.max(-d,0),c+a),o=r;for(var m=o;o<m+f;++o)h[o]=0;return e.copy(h,o,l+Math.max(-f,0),l+u),h=h.toString("base64"),h=HZ(h),h}function Vx(e,t,r){for(var n=0;t+n<r&&e[t+n]===0;)++n;var i=e[t+n]>=od;return i&&--n,n}function WZ(e,t){e=Hx(e);var r=Bx(t),n=e.length;if(n!==r*2)throw new TypeError('"'+t+'" signatures must be "'+r*2+'" bytes, saw "'+n+'"');var i=Vx(e,0,r),o=Vx(e,r,e.length),s=r-i,a=r-o,c=2+s+1+1+a,u=c<od,l=id.allocUnsafe((u?2:3)+c),d=0;return l[d++]=Kx,u?l[d++]=c:(l[d++]=od|1,l[d++]=c&255),l[d++]=sd,l[d++]=s,i<0?(l[d++]=0,d+=e.copy(l,d,0,r)):d+=e.copy(l,d,i,r),l[d++]=sd,l[d++]=a,o<0?(l[d++]=0,e.copy(l,d,r)):e.copy(l,d,r+o),l}Qx.exports={derToJose:QZ,joseToDer:WZ}});var Yx=_((fTe,Jx)=>{"use strict";p();var iu=K("buffer").Buffer,Iy=K("buffer").SlowBuffer;Jx.exports=ad;function ad(e,t){if(!iu.isBuffer(e)||!iu.isBuffer(t)||e.length!==t.length)return!1;for(var r=0,n=0;n<e.length;n++)r|=e[n]^t[n];return r===0}ad.install=function(){iu.prototype.equal=Iy.prototype.equal=function(t){return ad(this,t)}};var JZ=iu.prototype.equal,YZ=Iy.prototype.equal;ad.restore=function(){iu.prototype.equal=JZ,Iy.prototype.equal=YZ}});var Ny=_((mTe,aA)=>{p();var la=ca().Buffer,Wr=K("crypto"),eA=Wx(),Xx=K("util"),XZ=`"%s" is not a valid algorithm.
4
4
  Supported algorithms are:
5
5
  "HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".`,ou="secret must be a string or buffer",ua="key must be a string or a buffer",eK="key must be a string, a buffer or an object",xy=typeof Wr.createPublicKey=="function";xy&&(ua+=" or a KeyObject",ou+="or a KeyObject");function tA(e){if(!la.isBuffer(e)&&typeof e!="string"&&(!xy||typeof e!="object"||typeof e.type!="string"||typeof e.asymmetricKeyType!="string"||typeof e.export!="function"))throw En(ua)}function rA(e){if(!la.isBuffer(e)&&typeof e!="string"&&typeof e!="object")throw En(eK)}function tK(e){if(!la.isBuffer(e)){if(typeof e=="string")return e;if(!xy||typeof e!="object"||e.type!=="secret"||typeof e.export!="function")throw En(ou)}}function Ay(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function nA(e){e=e.toString();var t=4-e.length%4;if(t!==4)for(var r=0;r<t;++r)e+="=";return e.replace(/\-/g,"+").replace(/_/g,"/")}function En(e){var t=[].slice.call(arguments,1),r=Xx.format.bind(Xx,e).apply(null,t);return new TypeError(r)}function rK(e){return la.isBuffer(e)||typeof e=="string"}function su(e){return rK(e)||(e=JSON.stringify(e)),e}function iA(e){return function(r,n){tK(n),r=su(r);var i=Wr.createHmac("sha"+e,n),o=(i.update(r),i.digest("base64"));return Ay(o)}}var wy,nK="timingSafeEqual"in Wr?function(t,r){return t.byteLength!==r.byteLength?!1:Wr.timingSafeEqual(t,r)}:function(t,r){return wy||(wy=Yx()),wy(t,r)};function iK(e){return function(r,n,i){var o=iA(e)(r,i);return nK(la.from(n),la.from(o))}}function oA(e){return function(r,n){rA(n),r=su(r);var i=Wr.createSign("RSA-SHA"+e),o=(i.update(r),i.sign(n,"base64"));return Ay(o)}}function sA(e){return function(r,n,i){tA(i),r=su(r),n=nA(n);var o=Wr.createVerify("RSA-SHA"+e);return o.update(r),o.verify(i,n,"base64")}}function oK(e){return function(r,n){rA(n),r=su(r);var i=Wr.createSign("RSA-SHA"+e),o=(i.update(r),i.sign({key:n,padding:Wr.constants.RSA_PKCS1_PSS_PADDING,saltLength:Wr.constants.RSA_PSS_SALTLEN_DIGEST},"base64"));return Ay(o)}}function sK(e){return function(r,n,i){tA(i),r=su(r),n=nA(n);var o=Wr.createVerify("RSA-SHA"+e);return o.update(r),o.verify({key:i,padding:Wr.constants.RSA_PKCS1_PSS_PADDING,saltLength:Wr.constants.RSA_PSS_SALTLEN_DIGEST},n,"base64")}}function aK(e){var t=oA(e);return function(){var n=t.apply(null,arguments);return n=eA.derToJose(n,"ES"+e),n}}function cK(e){var t=sA(e);return function(n,i,o){i=eA.joseToDer(i,"ES"+e).toString("base64");var s=t(n,i,o);return s}}function uK(){return function(){return""}}function lK(){return function(t,r){return r===""}}aA.exports=function(t){var r={hs:iA,rs:oA,ps:oK,es:aK,none:uK},n={hs:iK,rs:sA,ps:sK,es:cK,none:lK},i=t.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/);if(!i)throw En(XZ,t);var o=(i[1]||i[3]).toLowerCase(),s=i[2];return{sign:r[o](s),verify:n[o](s)}}});var Py=_((yTe,cA)=>{p();var pK=K("buffer").Buffer;cA.exports=function(t){return typeof t=="string"?t:typeof t=="number"||pK.isBuffer(t)?t.toString():JSON.stringify(t)}});var hA=_((vTe,fA)=>{p();var dK=ca().Buffer,uA=Sy(),fK=Ny(),hK=K("stream"),lA=Py(),Ry=K("util");function pA(e,t){return dK.from(e,t).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function mK(e,t,r){r=r||"utf8";var n=pA(lA(e),"binary"),i=pA(lA(t),r);return Ry.format("%s.%s",n,i)}function dA(e){var t=e.header,r=e.payload,n=e.secret||e.privateKey,i=e.encoding,o=fK(t.alg),s=mK(t,r,i),a=o.sign(s,n);return Ry.format("%s.%s",s,a)}function cd(e){var t=e.secret;if(t=t??e.privateKey,t=t??e.key,/^hs/i.test(e.header.alg)===!0&&t==null)throw new TypeError("secret must be a string or buffer or a KeyObject");var r=new uA(t);this.readable=!0,this.header=e.header,this.encoding=e.encoding,this.secret=this.privateKey=this.key=r,this.payload=new uA(e.payload),this.secret.once("close",function(){!this.payload.writable&&this.readable&&this.sign()}.bind(this)),this.payload.once("close",function(){!this.secret.writable&&this.readable&&this.sign()}.bind(this))}Ry.inherits(cd,hK);cd.prototype.sign=function(){try{var t=dA({header:this.header,payload:this.payload.buffer,secret:this.secret.buffer,encoding:this.encoding});return this.emit("done",t),this.emit("data",t),this.emit("end"),this.readable=!1,t}catch(r){this.readable=!1,this.emit("error",r),this.emit("close")}};cd.sign=dA;fA.exports=cd});var OA=_((TTe,SA)=>{p();var gA=ca().Buffer,mA=Sy(),gK=Ny(),yK=K("stream"),yA=Py(),_K=K("util"),vK=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function EK(e){return Object.prototype.toString.call(e)==="[object Object]"}function TK(e){if(EK(e))return e;try{return JSON.parse(e)}catch{return}}function _A(e){var t=e.split(".",1)[0];return TK(gA.from(t,"base64").toString("binary"))}function bK(e){return e.split(".",2).join(".")}function vA(e){return e.split(".")[2]}function SK(e,t){t=t||"utf8";var r=e.split(".")[1];return gA.from(r,"base64").toString(t)}function EA(e){return vK.test(e)&&!!_A(e)}function TA(e,t,r){if(!t){var n=new Error("Missing algorithm parameter for jws.verify");throw n.code="MISSING_ALGORITHM",n}e=yA(e);var i=vA(e),o=bK(e),s=gK(t);return s.verify(o,i,r)}function bA(e,t){if(t=t||{},e=yA(e),!EA(e))return null;var r=_A(e);if(!r)return null;var n=SK(e);return(r.typ==="JWT"||t.json)&&(n=JSON.parse(n,t.encoding)),{header:r,payload:n,signature:vA(e)}}function pa(e){e=e||{};var t=e.secret;if(t=t??e.publicKey,t=t??e.key,/^hs/i.test(e.algorithm)===!0&&t==null)throw new TypeError("secret must be a string or buffer or a KeyObject");var r=new mA(t);this.readable=!0,this.algorithm=e.algorithm,this.encoding=e.encoding,this.secret=this.publicKey=this.key=r,this.signature=new mA(e.signature),this.secret.once("close",function(){!this.signature.writable&&this.readable&&this.verify()}.bind(this)),this.signature.once("close",function(){!this.secret.writable&&this.readable&&this.verify()}.bind(this))}_K.inherits(pa,yK);pa.prototype.verify=function(){try{var t=TA(this.signature.buffer,this.algorithm,this.key.buffer),r=bA(this.signature.buffer,this.encoding);return this.emit("done",t,r),this.emit("data",t),this.emit("end"),this.readable=!1,t}catch(n){this.readable=!1,this.emit("error",n),this.emit("close")}};pa.decode=bA;pa.isValid=EA;pa.verify=TA;SA.exports=pa});var ld=_(Zi=>{p();var IA=hA(),ud=OA(),OK=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"];Zi.ALGORITHMS=OK;Zi.sign=IA.sign;Zi.verify=ud.verify;Zi.decode=ud.decode;Zi.isValid=ud.isValid;Zi.createSign=function(t){return new IA(t)};Zi.createVerify=function(t){return new ud(t)}});var Dy=_((ITe,wA)=>{p();var IK=ld();wA.exports=function(e,t){t=t||{};var r=IK.decode(e,t);if(!r)return null;var n=r.payload;if(typeof n=="string")try{var i=JSON.parse(n);i!==null&&typeof i=="object"&&(n=i)}catch{}return t.complete===!0?{header:r.header,payload:n,signature:r.signature}:n}});var au=_((xTe,xA)=>{p();var pd=function(e,t){Error.call(this,e),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name="JsonWebTokenError",this.message=e,t&&(this.inner=t)};pd.prototype=Object.create(Error.prototype);pd.prototype.constructor=pd;xA.exports=pd});var ky=_((NTe,NA)=>{p();var AA=au(),dd=function(e,t){AA.call(this,e),this.name="NotBeforeError",this.date=t};dd.prototype=Object.create(AA.prototype);dd.prototype.constructor=dd;NA.exports=dd});var Cy=_((RTe,RA)=>{p();var PA=au(),fd=function(e,t){PA.call(this,e),this.name="TokenExpiredError",this.expiredAt=t};fd.prototype=Object.create(PA.prototype);fd.prototype.constructor=fd;RA.exports=fd});var kA=_((kTe,DA)=>{p();var da=1e3,fa=da*60,ha=fa*60,Fo=ha*24,wK=Fo*7,xK=Fo*365.25;DA.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return AK(e);if(r==="number"&&isFinite(e))return t.long?PK(e):NK(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function AK(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*xK;case"weeks":case"week":case"w":return r*wK;case"days":case"day":case"d":return r*Fo;case"hours":case"hour":case"hrs":case"hr":case"h":return r*ha;case"minutes":case"minute":case"mins":case"min":case"m":return r*fa;case"seconds":case"second":case"secs":case"sec":case"s":return r*da;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function NK(e){var t=Math.abs(e);return t>=Fo?Math.round(e/Fo)+"d":t>=ha?Math.round(e/ha)+"h":t>=fa?Math.round(e/fa)+"m":t>=da?Math.round(e/da)+"s":e+"ms"}function PK(e){var t=Math.abs(e);return t>=Fo?hd(e,t,Fo,"day"):t>=ha?hd(e,t,ha,"hour"):t>=fa?hd(e,t,fa,"minute"):t>=da?hd(e,t,da,"second"):e+" ms"}function hd(e,t,r,n){var i=t>=r*1.5;return Math.round(e/r)+" "+n+(i?"s":"")}});var Ly=_((LTe,CA)=>{p();var RK=kA();CA.exports=function(e,t){var r=t||Math.floor(Date.now()/1e3);if(typeof e=="string"){var n=RK(e);return typeof n>"u"?void 0:Math.floor(r+n/1e3)}else return typeof e=="number"?r+e:void 0}});var ma=_(($Te,LA)=>{"use strict";p();var DK="2.0.0",kK=Number.MAX_SAFE_INTEGER||9007199254740991,CK=16,LK=250,jK=["major","premajor","minor","preminor","patch","prepatch","prerelease"];LA.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:CK,MAX_SAFE_BUILD_LENGTH:LK,MAX_SAFE_INTEGER:kK,RELEASE_TYPES:jK,SEMVER_SPEC_VERSION:DK,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var cu=_((qTe,jA)=>{"use strict";p();var $K=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};jA.exports=$K});var ga=_((Bn,$A)=>{"use strict";p();var{MAX_SAFE_COMPONENT_LENGTH:jy,MAX_SAFE_BUILD_LENGTH:MK,MAX_LENGTH:qK}=ma(),FK=cu();Bn=$A.exports={};var UK=Bn.re=[],zK=Bn.safeRe=[],U=Bn.src=[],GK=Bn.safeSrc=[],z=Bn.t={},VK=0,$y="[a-zA-Z0-9-]",BK=[["\\s",1],["\\d",qK],[$y,MK]],ZK=e=>{for(let[t,r]of BK)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},pe=(e,t,r)=>{let n=ZK(t),i=VK++;FK(e,i,t),z[e]=i,U[i]=t,GK[i]=n,UK[i]=new RegExp(t,r?"g":void 0),zK[i]=new RegExp(n,r?"g":void 0)};pe("NUMERICIDENTIFIER","0|[1-9]\\d*");pe("NUMERICIDENTIFIERLOOSE","\\d+");pe("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${$y}*`);pe("MAINVERSION",`(${U[z.NUMERICIDENTIFIER]})\\.(${U[z.NUMERICIDENTIFIER]})\\.(${U[z.NUMERICIDENTIFIER]})`);pe("MAINVERSIONLOOSE",`(${U[z.NUMERICIDENTIFIERLOOSE]})\\.(${U[z.NUMERICIDENTIFIERLOOSE]})\\.(${U[z.NUMERICIDENTIFIERLOOSE]})`);pe("PRERELEASEIDENTIFIER",`(?:${U[z.NONNUMERICIDENTIFIER]}|${U[z.NUMERICIDENTIFIER]})`);pe("PRERELEASEIDENTIFIERLOOSE",`(?:${U[z.NONNUMERICIDENTIFIER]}|${U[z.NUMERICIDENTIFIERLOOSE]})`);pe("PRERELEASE",`(?:-(${U[z.PRERELEASEIDENTIFIER]}(?:\\.${U[z.PRERELEASEIDENTIFIER]})*))`);pe("PRERELEASELOOSE",`(?:-?(${U[z.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${U[z.PRERELEASEIDENTIFIERLOOSE]})*))`);pe("BUILDIDENTIFIER",`${$y}+`);pe("BUILD",`(?:\\+(${U[z.BUILDIDENTIFIER]}(?:\\.${U[z.BUILDIDENTIFIER]})*))`);pe("FULLPLAIN",`v?${U[z.MAINVERSION]}${U[z.PRERELEASE]}?${U[z.BUILD]}?`);pe("FULL",`^${U[z.FULLPLAIN]}$`);pe("LOOSEPLAIN",`[v=\\s]*${U[z.MAINVERSIONLOOSE]}${U[z.PRERELEASELOOSE]}?${U[z.BUILD]}?`);pe("LOOSE",`^${U[z.LOOSEPLAIN]}$`);pe("GTLT","((?:<|>)?=?)");pe("XRANGEIDENTIFIERLOOSE",`${U[z.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);pe("XRANGEIDENTIFIER",`${U[z.NUMERICIDENTIFIER]}|x|X|\\*`);pe("XRANGEPLAIN",`[v=\\s]*(${U[z.XRANGEIDENTIFIER]})(?:\\.(${U[z.XRANGEIDENTIFIER]})(?:\\.(${U[z.XRANGEIDENTIFIER]})(?:${U[z.PRERELEASE]})?${U[z.BUILD]}?)?)?`);pe("XRANGEPLAINLOOSE",`[v=\\s]*(${U[z.XRANGEIDENTIFIERLOOSE]})(?:\\.(${U[z.XRANGEIDENTIFIERLOOSE]})(?:\\.(${U[z.XRANGEIDENTIFIERLOOSE]})(?:${U[z.PRERELEASELOOSE]})?${U[z.BUILD]}?)?)?`);pe("XRANGE",`^${U[z.GTLT]}\\s*${U[z.XRANGEPLAIN]}$`);pe("XRANGELOOSE",`^${U[z.GTLT]}\\s*${U[z.XRANGEPLAINLOOSE]}$`);pe("COERCEPLAIN",`(^|[^\\d])(\\d{1,${jy}})(?:\\.(\\d{1,${jy}}))?(?:\\.(\\d{1,${jy}}))?`);pe("COERCE",`${U[z.COERCEPLAIN]}(?:$|[^\\d])`);pe("COERCEFULL",U[z.COERCEPLAIN]+`(?:${U[z.PRERELEASE]})?(?:${U[z.BUILD]})?(?:$|[^\\d])`);pe("COERCERTL",U[z.COERCE],!0);pe("COERCERTLFULL",U[z.COERCEFULL],!0);pe("LONETILDE","(?:~>?)");pe("TILDETRIM",`(\\s*)${U[z.LONETILDE]}\\s+`,!0);Bn.tildeTrimReplace="$1~";pe("TILDE",`^${U[z.LONETILDE]}${U[z.XRANGEPLAIN]}$`);pe("TILDELOOSE",`^${U[z.LONETILDE]}${U[z.XRANGEPLAINLOOSE]}$`);pe("LONECARET","(?:\\^)");pe("CARETTRIM",`(\\s*)${U[z.LONECARET]}\\s+`,!0);Bn.caretTrimReplace="$1^";pe("CARET",`^${U[z.LONECARET]}${U[z.XRANGEPLAIN]}$`);pe("CARETLOOSE",`^${U[z.LONECARET]}${U[z.XRANGEPLAINLOOSE]}$`);pe("COMPARATORLOOSE",`^${U[z.GTLT]}\\s*(${U[z.LOOSEPLAIN]})$|^$`);pe("COMPARATOR",`^${U[z.GTLT]}\\s*(${U[z.FULLPLAIN]})$|^$`);pe("COMPARATORTRIM",`(\\s*)${U[z.GTLT]}\\s*(${U[z.LOOSEPLAIN]}|${U[z.XRANGEPLAIN]})`,!0);Bn.comparatorTrimReplace="$1$2$3";pe("HYPHENRANGE",`^\\s*(${U[z.XRANGEPLAIN]})\\s+-\\s+(${U[z.XRANGEPLAIN]})\\s*$`);pe("HYPHENRANGELOOSE",`^\\s*(${U[z.XRANGEPLAINLOOSE]})\\s+-\\s+(${U[z.XRANGEPLAINLOOSE]})\\s*$`);pe("STAR","(<|>)?=?\\s*\\*");pe("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");pe("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var md=_((zTe,MA)=>{"use strict";p();var KK=Object.freeze({loose:!0}),HK=Object.freeze({}),QK=e=>e?typeof e!="object"?KK:e:HK;MA.exports=QK});var My=_((VTe,UA)=>{"use strict";p();var qA=/^[0-9]+$/,FA=(e,t)=>{if(typeof e=="number"&&typeof t=="number")return e===t?0:e<t?-1:1;let r=qA.test(e),n=qA.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},WK=(e,t)=>FA(t,e);UA.exports={compareIdentifiers:FA,rcompareIdentifiers:WK}});var Gt=_((ZTe,GA)=>{"use strict";p();var gd=cu(),{MAX_LENGTH:zA,MAX_SAFE_INTEGER:yd}=ma(),{safeRe:_d,t:vd}=ga(),JK=md(),{compareIdentifiers:qy}=My(),Fy=class e{constructor(t,r){if(r=JK(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>zA)throw new TypeError(`version is longer than ${zA} characters`);gd("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=t.trim().match(r.loose?_d[vd.LOOSE]:_d[vd.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>yd||this.major<0)throw new TypeError("Invalid major version");if(this.minor>yd||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>yd||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){let o=+i;if(o>=0&&o<yd)return o}return i}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(gd("SemVer.compare",this.version,this.options,t),!(t instanceof e)){if(typeof t=="string"&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:this.patch>t.patch?1:0}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],i=t.prerelease[r];if(gd("prerelease compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return qy(n,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let n=this.build[r],i=t.build[r];if(gd("build compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return qy(n,i)}while(++r)}inc(t,r,n){if(t.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let i=`-${r}`.match(this.options.loose?_d[vd.PRERELEASELOOSE]:_d[vd.PRERELEASE]);if(!i||i[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let i=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[i];else{let o=this.prerelease.length;for(;--o>=0;)typeof this.prerelease[o]=="number"&&(this.prerelease[o]++,o=-2);if(o===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(r){let o=[r,i];n===!1&&(o=[r]),qy(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=o):this.prerelease=o}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};GA.exports=Fy});var Ki=_((HTe,BA)=>{"use strict";p();var VA=Gt(),YK=(e,t,r=!1)=>{if(e instanceof VA)return e;try{return new VA(e,t)}catch(n){if(!r)return null;throw n}};BA.exports=YK});var KA=_((WTe,ZA)=>{"use strict";p();var XK=Ki(),eH=(e,t)=>{let r=XK(e,t);return r?r.version:null};ZA.exports=eH});var QA=_((YTe,HA)=>{"use strict";p();var tH=Ki(),rH=(e,t)=>{let r=tH(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};HA.exports=rH});var YA=_((ebe,JA)=>{"use strict";p();var WA=Gt(),nH=(e,t,r,n,i)=>{typeof r=="string"&&(i=n,n=r,r=void 0);try{return new WA(e instanceof WA?e.version:e,r).inc(t,n,i).version}catch{return null}};JA.exports=nH});var tN=_((rbe,eN)=>{"use strict";p();var XA=Ki(),iH=(e,t)=>{let r=XA(e,null,!0),n=XA(t,null,!0),i=r.compare(n);if(i===0)return null;let o=i>0,s=o?r:n,a=o?n:r,c=!!s.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(s)===0)return a.minor&&!a.patch?"minor":"patch"}let l=c?"pre":"";return r.major!==n.major?l+"major":r.minor!==n.minor?l+"minor":r.patch!==n.patch?l+"patch":"prerelease"};eN.exports=iH});var nN=_((ibe,rN)=>{"use strict";p();var oH=Gt(),sH=(e,t)=>new oH(e,t).major;rN.exports=sH});var oN=_((sbe,iN)=>{"use strict";p();var aH=Gt(),cH=(e,t)=>new aH(e,t).minor;iN.exports=cH});var aN=_((cbe,sN)=>{"use strict";p();var uH=Gt(),lH=(e,t)=>new uH(e,t).patch;sN.exports=lH});var uN=_((lbe,cN)=>{"use strict";p();var pH=Ki(),dH=(e,t)=>{let r=pH(e,t);return r&&r.prerelease.length?r.prerelease:null};cN.exports=dH});var Jr=_((dbe,pN)=>{"use strict";p();var lN=Gt(),fH=(e,t,r)=>new lN(e,r).compare(new lN(t,r));pN.exports=fH});var fN=_((hbe,dN)=>{"use strict";p();var hH=Jr(),mH=(e,t,r)=>hH(t,e,r);dN.exports=mH});var mN=_((gbe,hN)=>{"use strict";p();var gH=Jr(),yH=(e,t)=>gH(e,t,!0);hN.exports=yH});var Ed=_((_be,yN)=>{"use strict";p();var gN=Gt(),_H=(e,t,r)=>{let n=new gN(e,r),i=new gN(t,r);return n.compare(i)||n.compareBuild(i)};yN.exports=_H});var vN=_((Ebe,_N)=>{"use strict";p();var vH=Ed(),EH=(e,t)=>e.sort((r,n)=>vH(r,n,t));_N.exports=EH});var TN=_((bbe,EN)=>{"use strict";p();var TH=Ed(),bH=(e,t)=>e.sort((r,n)=>TH(n,r,t));EN.exports=bH});var uu=_((Obe,bN)=>{"use strict";p();var SH=Jr(),OH=(e,t,r)=>SH(e,t,r)>0;bN.exports=OH});var Td=_((wbe,SN)=>{"use strict";p();var IH=Jr(),wH=(e,t,r)=>IH(e,t,r)<0;SN.exports=wH});var Uy=_((Abe,ON)=>{"use strict";p();var xH=Jr(),AH=(e,t,r)=>xH(e,t,r)===0;ON.exports=AH});var zy=_((Pbe,IN)=>{"use strict";p();var NH=Jr(),PH=(e,t,r)=>NH(e,t,r)!==0;IN.exports=PH});var bd=_((Dbe,wN)=>{"use strict";p();var RH=Jr(),DH=(e,t,r)=>RH(e,t,r)>=0;wN.exports=DH});var Sd=_((Cbe,xN)=>{"use strict";p();var kH=Jr(),CH=(e,t,r)=>kH(e,t,r)<=0;xN.exports=CH});var Gy=_((jbe,AN)=>{"use strict";p();var LH=Uy(),jH=zy(),$H=uu(),MH=bd(),qH=Td(),FH=Sd(),UH=(e,t,r,n)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return LH(e,r,n);case"!=":return jH(e,r,n);case">":return $H(e,r,n);case">=":return MH(e,r,n);case"<":return qH(e,r,n);case"<=":return FH(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};AN.exports=UH});var PN=_((Mbe,NN)=>{"use strict";p();var zH=Gt(),GH=Ki(),{safeRe:Od,t:Id}=ga(),VH=(e,t)=>{if(e instanceof zH)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?Od[Id.COERCEFULL]:Od[Id.COERCE]);else{let c=t.includePrerelease?Od[Id.COERCERTLFULL]:Od[Id.COERCERTL],u;for(;(u=c.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||u.index+u[0].length!==r.index+r[0].length)&&(r=u),c.lastIndex=u.index+u[1].length+u[2].length;c.lastIndex=-1}if(r===null)return null;let n=r[2],i=r[3]||"0",o=r[4]||"0",s=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return GH(`${n}.${i}.${o}${s}${a}`,t)};NN.exports=VH});var DN=_((Fbe,RN)=>{"use strict";p();var BH=Ki(),ZH=ma(),KH=Gt(),HH=(e,t,r)=>{if(!ZH.RELEASE_TYPES.includes(t))return null;let n=QH(e,r);return n&&WH(n,t)},QH=(e,t)=>{let r=e instanceof KH?e.version:e;return BH(r,t)},WH=(e,t)=>{if(JH(t))return e.version;switch(e.prerelease=[],t){case"major":e.minor=0,e.patch=0;break;case"minor":e.patch=0;break}return e.format()},JH=e=>e.startsWith("pre");RN.exports=HH});var CN=_((zbe,kN)=>{"use strict";p();var Vy=class{constructor(){this.max=1e3,this.map=new Map}get(t){let r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){let i=this.map.keys().next().value;this.delete(i)}this.map.set(t,r)}return this}};kN.exports=Vy});var Yr=_((Vbe,MN)=>{"use strict";p();var YH=/\s+/g,By=class e{constructor(t,r){if(r=eQ(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof Zy)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(YH," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(i=>!jN(i[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let i of this.set)if(i.length===1&&uQ(i[0])){this.set=[i];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let t=0;t<this.set.length;t++){t>0&&(this.formatted+="||");let r=this.set[t];for(let n=0;n<r.length;n++)n>0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(t){t=t.replace(cQ,"");let n=((this.options.includePrerelease&&sQ)|(this.options.loose&&aQ))+":"+t,i=LN.get(n);if(i)return i;let o=this.options.loose,s=o?dr[Vt.HYPHENRANGELOOSE]:dr[Vt.HYPHENRANGE];t=t.replace(s,vQ(this.options.includePrerelease)),it("hyphen replace",t),t=t.replace(dr[Vt.COMPARATORTRIM],nQ),it("comparator trim",t),t=t.replace(dr[Vt.TILDETRIM],iQ),it("tilde trim",t),t=t.replace(dr[Vt.CARETTRIM],oQ),it("caret trim",t);let a=t.split(" ").map(d=>lQ(d,this.options)).join(" ").split(/\s+/).map(d=>_Q(d,this.options));o&&(a=a.filter(d=>(it("loose invalid filter",d,this.options),!!d.match(dr[Vt.COMPARATORLOOSE])))),it("range list",a);let c=new Map,u=a.map(d=>new Zy(d,this.options));for(let d of u){if(jN(d))return[d];c.set(d.value,d)}c.size>1&&c.has("")&&c.delete("");let l=[...c.values()];return LN.set(n,l),l}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some(n=>$N(n,r)&&t.set.some(i=>$N(i,r)&&n.every(o=>i.every(s=>o.intersects(s,r)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new tQ(t,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(EQ(this.set[r],t,this.options))return!0;return!1}};MN.exports=By;var XH=CN(),LN=new XH,eQ=md(),Zy=lu(),it=cu(),tQ=Gt(),{safeRe:dr,src:rQ,t:Vt,comparatorTrimReplace:nQ,tildeTrimReplace:iQ,caretTrimReplace:oQ}=ga(),{FLAG_INCLUDE_PRERELEASE:sQ,FLAG_LOOSE:aQ}=ma(),cQ=new RegExp(rQ[Vt.BUILD],"g"),jN=e=>e.value==="<0.0.0-0",uQ=e=>e.value==="",$N=(e,t)=>{let r=!0,n=e.slice(),i=n.pop();for(;r&&n.length;)r=n.every(o=>i.intersects(o,t)),i=n.pop();return r},lQ=(e,t)=>(e=e.replace(dr[Vt.BUILD],""),it("comp",e,t),e=fQ(e,t),it("caret",e),e=pQ(e,t),it("tildes",e),e=mQ(e,t),it("xrange",e),e=yQ(e,t),it("stars",e),e),fr=e=>!e||e.toLowerCase()==="x"||e==="*",pQ=(e,t)=>e.trim().split(/\s+/).map(r=>dQ(r,t)).join(" "),dQ=(e,t)=>{let r=t.loose?dr[Vt.TILDELOOSE]:dr[Vt.TILDE];return e.replace(r,(n,i,o,s,a)=>{it("tilde",e,n,i,o,s,a);let c;return fr(i)?c="":fr(o)?c=`>=${i}.0.0 <${+i+1}.0.0-0`:fr(s)?c=`>=${i}.${o}.0 <${i}.${+o+1}.0-0`:a?(it("replaceTilde pr",a),c=`>=${i}.${o}.${s}-${a} <${i}.${+o+1}.0-0`):c=`>=${i}.${o}.${s} <${i}.${+o+1}.0-0`,it("tilde return",c),c})},fQ=(e,t)=>e.trim().split(/\s+/).map(r=>hQ(r,t)).join(" "),hQ=(e,t)=>{it("caret",e,t);let r=t.loose?dr[Vt.CARETLOOSE]:dr[Vt.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(i,o,s,a,c)=>{it("caret",e,i,o,s,a,c);let u;return fr(o)?u="":fr(s)?u=`>=${o}.0.0${n} <${+o+1}.0.0-0`:fr(a)?o==="0"?u=`>=${o}.${s}.0${n} <${o}.${+s+1}.0-0`:u=`>=${o}.${s}.0${n} <${+o+1}.0.0-0`:c?(it("replaceCaret pr",c),o==="0"?s==="0"?u=`>=${o}.${s}.${a}-${c} <${o}.${s}.${+a+1}-0`:u=`>=${o}.${s}.${a}-${c} <${o}.${+s+1}.0-0`:u=`>=${o}.${s}.${a}-${c} <${+o+1}.0.0-0`):(it("no pr"),o==="0"?s==="0"?u=`>=${o}.${s}.${a}${n} <${o}.${s}.${+a+1}-0`:u=`>=${o}.${s}.${a}${n} <${o}.${+s+1}.0-0`:u=`>=${o}.${s}.${a} <${+o+1}.0.0-0`),it("caret return",u),u})},mQ=(e,t)=>(it("replaceXRanges",e,t),e.split(/\s+/).map(r=>gQ(r,t)).join(" ")),gQ=(e,t)=>{e=e.trim();let r=t.loose?dr[Vt.XRANGELOOSE]:dr[Vt.XRANGE];return e.replace(r,(n,i,o,s,a,c)=>{it("xRange",e,n,i,o,s,a,c);let u=fr(o),l=u||fr(s),d=l||fr(a),f=d;return i==="="&&f&&(i=""),c=t.includePrerelease?"-0":"",u?i===">"||i==="<"?n="<0.0.0-0":n="*":i&&f?(l&&(s=0),a=0,i===">"?(i=">=",l?(o=+o+1,s=0,a=0):(s=+s+1,a=0)):i==="<="&&(i="<",l?o=+o+1:s=+s+1),i==="<"&&(c="-0"),n=`${i+o}.${s}.${a}${c}`):l?n=`>=${o}.0.0${c} <${+o+1}.0.0-0`:d&&(n=`>=${o}.${s}.0${c} <${o}.${+s+1}.0-0`),it("xRange return",n),n})},yQ=(e,t)=>(it("replaceStars",e,t),e.trim().replace(dr[Vt.STAR],"")),_Q=(e,t)=>(it("replaceGTE0",e,t),e.trim().replace(dr[t.includePrerelease?Vt.GTE0PRE:Vt.GTE0],"")),vQ=e=>(t,r,n,i,o,s,a,c,u,l,d,f)=>(fr(n)?r="":fr(i)?r=`>=${n}.0.0${e?"-0":""}`:fr(o)?r=`>=${n}.${i}.0${e?"-0":""}`:s?r=`>=${r}`:r=`>=${r}${e?"-0":""}`,fr(u)?c="":fr(l)?c=`<${+u+1}.0.0-0`:fr(d)?c=`<${u}.${+l+1}.0-0`:f?c=`<=${u}.${l}.${d}-${f}`:e?c=`<${u}.${l}.${+d+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),EQ=(e,t,r)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let n=0;n<e.length;n++)if(it(e[n].semver),e[n].semver!==Zy.ANY&&e[n].semver.prerelease.length>0){let i=e[n].semver;if(i.major===t.major&&i.minor===t.minor&&i.patch===t.patch)return!0}return!1}return!0}});var lu=_((Zbe,VN)=>{"use strict";p();var pu=Symbol("SemVer ANY"),Qy=class e{static get ANY(){return pu}constructor(t,r){if(r=qN(r),t instanceof e){if(t.loose===!!r.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),Hy("comparator",t,r),this.options=r,this.loose=!!r.loose,this.parse(t),this.semver===pu?this.value="":this.value=this.operator+this.semver.version,Hy("comp",this)}parse(t){let r=this.options.loose?FN[UN.COMPARATORLOOSE]:FN[UN.COMPARATOR],n=t.match(r);if(!n)throw new TypeError(`Invalid comparator: ${t}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new zN(n[2],this.options.loose):this.semver=pu}toString(){return this.value}test(t){if(Hy("Comparator.test",t,this.options.loose),this.semver===pu||t===pu)return!0;if(typeof t=="string")try{t=new zN(t,this.options)}catch{return!1}return Ky(t,this.operator,this.semver,this.options)}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new GN(t.value,r).test(this.value):t.operator===""?t.value===""?!0:new GN(this.value,r).test(t.semver):(r=qN(r),r.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||Ky(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||Ky(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};VN.exports=Qy;var qN=md(),{safeRe:FN,t:UN}=ga(),Ky=Gy(),Hy=cu(),zN=Gt(),GN=Yr()});var du=_((Hbe,BN)=>{"use strict";p();var TQ=Yr(),bQ=(e,t,r)=>{try{t=new TQ(t,r)}catch{return!1}return t.test(e)};BN.exports=bQ});var KN=_((Wbe,ZN)=>{"use strict";p();var SQ=Yr(),OQ=(e,t)=>new SQ(e,t).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));ZN.exports=OQ});var QN=_((Ybe,HN)=>{"use strict";p();var IQ=Gt(),wQ=Yr(),xQ=(e,t,r)=>{let n=null,i=null,o=null;try{o=new wQ(t,r)}catch{return null}return e.forEach(s=>{o.test(s)&&(!n||i.compare(s)===-1)&&(n=s,i=new IQ(n,r))}),n};HN.exports=xQ});var JN=_((eSe,WN)=>{"use strict";p();var AQ=Gt(),NQ=Yr(),PQ=(e,t,r)=>{let n=null,i=null,o=null;try{o=new NQ(t,r)}catch{return null}return e.forEach(s=>{o.test(s)&&(!n||i.compare(s)===1)&&(n=s,i=new AQ(n,r))}),n};WN.exports=PQ});var eP=_((rSe,XN)=>{"use strict";p();var Wy=Gt(),RQ=Yr(),YN=uu(),DQ=(e,t)=>{e=new RQ(e,t);let r=new Wy("0.0.0");if(e.test(r)||(r=new Wy("0.0.0-0"),e.test(r)))return r;r=null;for(let n=0;n<e.set.length;++n){let i=e.set[n],o=null;i.forEach(s=>{let a=new Wy(s.semver.version);switch(s.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!o||YN(a,o))&&(o=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${s.operator}`)}}),o&&(!r||YN(r,o))&&(r=o)}return r&&e.test(r)?r:null};XN.exports=DQ});var rP=_((iSe,tP)=>{"use strict";p();var kQ=Yr(),CQ=(e,t)=>{try{return new kQ(e,t).range||"*"}catch{return null}};tP.exports=CQ});var wd=_((sSe,sP)=>{"use strict";p();var LQ=Gt(),oP=lu(),{ANY:jQ}=oP,$Q=Yr(),MQ=du(),nP=uu(),iP=Td(),qQ=Sd(),FQ=bd(),UQ=(e,t,r,n)=>{e=new LQ(e,n),t=new $Q(t,n);let i,o,s,a,c;switch(r){case">":i=nP,o=qQ,s=iP,a=">",c=">=";break;case"<":i=iP,o=FQ,s=nP,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(MQ(e,t,n))return!1;for(let u=0;u<t.set.length;++u){let l=t.set[u],d=null,f=null;if(l.forEach(h=>{h.semver===jQ&&(h=new oP(">=0.0.0")),d=d||h,f=f||h,i(h.semver,d.semver,n)?d=h:s(h.semver,f.semver,n)&&(f=h)}),d.operator===a||d.operator===c||(!f.operator||f.operator===a)&&o(e,f.semver))return!1;if(f.operator===c&&s(e,f.semver))return!1}return!0};sP.exports=UQ});var cP=_((cSe,aP)=>{"use strict";p();var zQ=wd(),GQ=(e,t,r)=>zQ(e,t,">",r);aP.exports=GQ});var lP=_((lSe,uP)=>{"use strict";p();var VQ=wd(),BQ=(e,t,r)=>VQ(e,t,"<",r);uP.exports=BQ});var fP=_((dSe,dP)=>{"use strict";p();var pP=Yr(),ZQ=(e,t,r)=>(e=new pP(e,r),t=new pP(t,r),e.intersects(t,r));dP.exports=ZQ});var mP=_((hSe,hP)=>{"use strict";p();var KQ=du(),HQ=Jr();hP.exports=(e,t,r)=>{let n=[],i=null,o=null,s=e.sort((l,d)=>HQ(l,d,r));for(let l of s)KQ(l,t,r)?(o=l,i||(i=l)):(o&&n.push([i,o]),o=null,i=null);i&&n.push([i,null]);let a=[];for(let[l,d]of n)l===d?a.push(l):!d&&l===s[0]?a.push("*"):d?l===s[0]?a.push(`<=${d}`):a.push(`${l} - ${d}`):a.push(`>=${l}`);let c=a.join(" || "),u=typeof t.raw=="string"?t.raw:String(t);return c.length<u.length?c:t}});var TP=_((gSe,EP)=>{"use strict";p();var gP=Yr(),Xy=lu(),{ANY:Jy}=Xy,Yy=du(),e_=Jr(),QQ=(e,t,r={})=>{if(e===t)return!0;e=new gP(e,r),t=new gP(t,r);let n=!1;e:for(let i of e.set){for(let o of t.set){let s=JQ(i,o,r);if(n=n||s!==null,s)continue e}if(n)return!1}return!0},WQ=[new Xy(">=0.0.0-0")],yP=[new Xy(">=0.0.0")],JQ=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===Jy){if(t.length===1&&t[0].semver===Jy)return!0;r.includePrerelease?e=WQ:e=yP}if(t.length===1&&t[0].semver===Jy){if(r.includePrerelease)return!0;t=yP}let n=new Set,i,o;for(let h of e)h.operator===">"||h.operator===">="?i=_P(i,h,r):h.operator==="<"||h.operator==="<="?o=vP(o,h,r):n.add(h.semver);if(n.size>1)return null;let s;if(i&&o){if(s=e_(i.semver,o.semver,r),s>0)return null;if(s===0&&(i.operator!==">="||o.operator!=="<="))return null}for(let h of n){if(i&&!Yy(h,String(i),r)||o&&!Yy(h,String(o),r))return null;for(let m of t)if(!Yy(h,String(m),r))return!1;return!0}let a,c,u,l,d=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1,f=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1;d&&d.prerelease.length===1&&o.operator==="<"&&d.prerelease[0]===0&&(d=!1);for(let h of t){if(l=l||h.operator===">"||h.operator===">=",u=u||h.operator==="<"||h.operator==="<=",i){if(f&&h.semver.prerelease&&h.semver.prerelease.length&&h.semver.major===f.major&&h.semver.minor===f.minor&&h.semver.patch===f.patch&&(f=!1),h.operator===">"||h.operator===">="){if(a=_P(i,h,r),a===h&&a!==i)return!1}else if(i.operator===">="&&!h.test(i.semver))return!1}if(o){if(d&&h.semver.prerelease&&h.semver.prerelease.length&&h.semver.major===d.major&&h.semver.minor===d.minor&&h.semver.patch===d.patch&&(d=!1),h.operator==="<"||h.operator==="<="){if(c=vP(o,h,r),c===h&&c!==o)return!1}else if(o.operator==="<="&&!h.test(o.semver))return!1}if(!h.operator&&(o||i)&&s!==0)return!1}return!(i&&u&&!o&&s!==0||o&&l&&!i&&s!==0||f||d)},_P=(e,t,r)=>{if(!e)return t;let n=e_(e.semver,t.semver,r);return n>0?e:n<0||t.operator===">"&&e.operator===">="?t:e},vP=(e,t,r)=>{if(!e)return t;let n=e_(e.semver,t.semver,r);return n<0?e:n>0||t.operator==="<"&&e.operator==="<="?t:e};EP.exports=QQ});var xd=_((_Se,OP)=>{"use strict";p();var t_=ga(),bP=ma(),YQ=Gt(),SP=My(),XQ=Ki(),e2=KA(),t2=QA(),r2=YA(),n2=tN(),i2=nN(),o2=oN(),s2=aN(),a2=uN(),c2=Jr(),u2=fN(),l2=mN(),p2=Ed(),d2=vN(),f2=TN(),h2=uu(),m2=Td(),g2=Uy(),y2=zy(),_2=bd(),v2=Sd(),E2=Gy(),T2=PN(),b2=DN(),S2=lu(),O2=Yr(),I2=du(),w2=KN(),x2=QN(),A2=JN(),N2=eP(),P2=rP(),R2=wd(),D2=cP(),k2=lP(),C2=fP(),L2=mP(),j2=TP();OP.exports={parse:XQ,valid:e2,clean:t2,inc:r2,diff:n2,major:i2,minor:o2,patch:s2,prerelease:a2,compare:c2,rcompare:u2,compareLoose:l2,compareBuild:p2,sort:d2,rsort:f2,gt:h2,lt:m2,eq:g2,neq:y2,gte:_2,lte:v2,cmp:E2,coerce:T2,truncate:b2,Comparator:S2,Range:O2,satisfies:I2,toComparators:w2,maxSatisfying:x2,minSatisfying:A2,minVersion:N2,validRange:P2,outside:R2,gtr:D2,ltr:k2,intersects:C2,simplifyRange:L2,subset:j2,SemVer:YQ,re:t_.re,src:t_.src,tokens:t_.t,SEMVER_SPEC_VERSION:bP.SEMVER_SPEC_VERSION,RELEASE_TYPES:bP.RELEASE_TYPES,compareIdentifiers:SP.compareIdentifiers,rcompareIdentifiers:SP.rcompareIdentifiers}});var wP=_((ESe,IP)=>{p();var $2=xd();IP.exports=$2.satisfies(process.version,">=15.7.0")});var AP=_((bSe,xP)=>{p();var M2=xd();xP.exports=M2.satisfies(process.version,">=16.9.0")});var r_=_((OSe,NP)=>{p();var q2=wP(),F2=AP(),U2={ec:["ES256","ES384","ES512"],rsa:["RS256","PS256","RS384","PS384","RS512","PS512"],"rsa-pss":["PS256","PS384","PS512"]},z2={ES256:"prime256v1",ES384:"secp384r1",ES512:"secp521r1"};NP.exports=function(e,t){if(!e||!t)return;let r=t.asymmetricKeyType;if(!r)return;let n=U2[r];if(!n)throw new Error(`Unknown key type "${r}".`);if(!n.includes(e))throw new Error(`"alg" parameter for "${r}" key type must be one of: ${n.join(", ")}.`);if(q2)switch(r){case"ec":let i=t.asymmetricKeyDetails.namedCurve,o=z2[e];if(i!==o)throw new Error(`"alg" parameter "${e}" requires curve "${o}".`);break;case"rsa-pss":if(F2){let s=parseInt(e.slice(-3),10),{hashAlgorithm:a,mgf1HashAlgorithm:c,saltLength:u}=t.asymmetricKeyDetails;if(a!==`sha${s}`||c!==a)throw new Error(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${e}.`);if(u!==void 0&&u>s>>3)throw new Error(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${e}.`)}break}}});var n_=_((wSe,PP)=>{p();var G2=xd();PP.exports=G2.satisfies(process.version,"^6.12.0 || >=8.0.0")});var kP=_((ASe,DP)=>{p();var et=au(),V2=ky(),RP=Cy(),B2=Dy(),Z2=Ly(),K2=r_(),H2=n_(),Q2=ld(),{KeyObject:W2,createSecretKey:J2,createPublicKey:Y2}=K("crypto"),i_=["RS256","RS384","RS512"],X2=["ES256","ES384","ES512"],o_=["RS256","RS384","RS512"],e4=["HS256","HS384","HS512"];H2&&(i_.splice(i_.length,0,"PS256","PS384","PS512"),o_.splice(o_.length,0,"PS256","PS384","PS512"));DP.exports=function(e,t,r,n){typeof r=="function"&&!n&&(n=r,r={}),r||(r={}),r=Object.assign({},r);let i;if(n?i=n:i=function(l,d){if(l)throw l;return d},r.clockTimestamp&&typeof r.clockTimestamp!="number")return i(new et("clockTimestamp must be a number"));if(r.nonce!==void 0&&(typeof r.nonce!="string"||r.nonce.trim()===""))return i(new et("nonce must be a non-empty string"));if(r.allowInvalidAsymmetricKeyTypes!==void 0&&typeof r.allowInvalidAsymmetricKeyTypes!="boolean")return i(new et("allowInvalidAsymmetricKeyTypes must be a boolean"));let o=r.clockTimestamp||Math.floor(Date.now()/1e3);if(!e)return i(new et("jwt must be provided"));if(typeof e!="string")return i(new et("jwt must be a string"));let s=e.split(".");if(s.length!==3)return i(new et("jwt malformed"));let a;try{a=B2(e,{complete:!0})}catch(l){return i(l)}if(!a)return i(new et("invalid token"));let c=a.header,u;if(typeof t=="function"){if(!n)return i(new et("verify must be called asynchronous if secret or public key is provided as a callback"));u=t}else u=function(l,d){return d(null,t)};return u(c,function(l,d){if(l)return i(new et("error in secret or public key callback: "+l.message));let f=s[2].trim()!=="";if(!f&&d)return i(new et("jwt signature is required"));if(f&&!d)return i(new et("secret or public key must be provided"));if(!f&&!r.algorithms)return i(new et('please specify "none" in "algorithms" to verify unsigned tokens'));if(d!=null&&!(d instanceof W2))try{d=Y2(d)}catch{try{d=J2(typeof d=="string"?Buffer.from(d):d)}catch{return i(new et("secretOrPublicKey is not valid key material"))}}if(r.algorithms||(d.type==="secret"?r.algorithms=e4:["rsa","rsa-pss"].includes(d.asymmetricKeyType)?r.algorithms=o_:d.asymmetricKeyType==="ec"?r.algorithms=X2:r.algorithms=i_),r.algorithms.indexOf(a.header.alg)===-1)return i(new et("invalid algorithm"));if(c.alg.startsWith("HS")&&d.type!=="secret")return i(new et(`secretOrPublicKey must be a symmetric key when using ${c.alg}`));if(/^(?:RS|PS|ES)/.test(c.alg)&&d.type!=="public")return i(new et(`secretOrPublicKey must be an asymmetric key when using ${c.alg}`));if(!r.allowInvalidAsymmetricKeyTypes)try{K2(c.alg,d)}catch(y){return i(y)}let h;try{h=Q2.verify(e,a.header.alg,d)}catch(y){return i(y)}if(!h)return i(new et("invalid signature"));let m=a.payload;if(typeof m.nbf<"u"&&!r.ignoreNotBefore){if(typeof m.nbf!="number")return i(new et("invalid nbf value"));if(m.nbf>o+(r.clockTolerance||0))return i(new V2("jwt not active",new Date(m.nbf*1e3)))}if(typeof m.exp<"u"&&!r.ignoreExpiration){if(typeof m.exp!="number")return i(new et("invalid exp value"));if(o>=m.exp+(r.clockTolerance||0))return i(new RP("jwt expired",new Date(m.exp*1e3)))}if(r.audience){let y=Array.isArray(r.audience)?r.audience:[r.audience];if(!(Array.isArray(m.aud)?m.aud:[m.aud]).some(function(b){return y.some(function(O){return O instanceof RegExp?O.test(b):O===b})}))return i(new et("jwt audience invalid. expected: "+y.join(" or ")))}if(r.issuer&&(typeof r.issuer=="string"&&m.iss!==r.issuer||Array.isArray(r.issuer)&&r.issuer.indexOf(m.iss)===-1))return i(new et("jwt issuer invalid. expected: "+r.issuer));if(r.subject&&m.sub!==r.subject)return i(new et("jwt subject invalid. expected: "+r.subject));if(r.jwtid&&m.jti!==r.jwtid)return i(new et("jwt jwtid invalid. expected: "+r.jwtid));if(r.nonce&&m.nonce!==r.nonce)return i(new et("jwt nonce invalid. expected: "+r.nonce));if(r.maxAge){if(typeof m.iat!="number")return i(new et("iat required when maxAge is specified"));let y=Z2(r.maxAge,m.iat);if(typeof y>"u")return i(new et('"maxAge" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));if(o>=y+(r.clockTolerance||0))return i(new RP("maxAge exceeded",new Date(y*1e3)))}if(r.complete===!0){let y=a.signature;return i(null,{header:c,payload:m,signature:y})}return i(null,m)})}});var qP=_((PSe,MP)=>{p();var CP=1/0,jP=9007199254740991,t4=17976931348623157e292,LP=NaN,r4="[object Arguments]",n4="[object Function]",i4="[object GeneratorFunction]",o4="[object String]",s4="[object Symbol]",a4=/^\s+|\s+$/g,c4=/^[-+]0x[0-9a-f]+$/i,u4=/^0b[01]+$/i,l4=/^0o[0-7]+$/i,p4=/^(?:0|[1-9]\d*)$/,d4=parseInt;function f4(e,t){for(var r=-1,n=e?e.length:0,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}function h4(e,t,r,n){for(var i=e.length,o=r+(n?1:-1);n?o--:++o<i;)if(t(e[o],o,e))return o;return-1}function m4(e,t,r){if(t!==t)return h4(e,g4,r);for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}function g4(e){return e!==e}function y4(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function _4(e,t){return f4(t,function(r){return e[r]})}function v4(e,t){return function(r){return e(t(r))}}var Ad=Object.prototype,a_=Ad.hasOwnProperty,Nd=Ad.toString,E4=Ad.propertyIsEnumerable,T4=v4(Object.keys,Object),b4=Math.max;function S4(e,t){var r=$P(e)||A4(e)?y4(e.length,String):[],n=r.length,i=!!n;for(var o in e)(t||a_.call(e,o))&&!(i&&(o=="length"||I4(o,n)))&&r.push(o);return r}function O4(e){if(!w4(e))return T4(e);var t=[];for(var r in Object(e))a_.call(e,r)&&r!="constructor"&&t.push(r);return t}function I4(e,t){return t=t??jP,!!t&&(typeof e=="number"||p4.test(e))&&e>-1&&e%1==0&&e<t}function w4(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||Ad;return e===r}function x4(e,t,r,n){e=c_(e)?e:M4(e),r=r&&!n?L4(r):0;var i=e.length;return r<0&&(r=b4(i+r,0)),D4(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&m4(e,t,r)>-1}function A4(e){return N4(e)&&a_.call(e,"callee")&&(!E4.call(e,"callee")||Nd.call(e)==r4)}var $P=Array.isArray;function c_(e){return e!=null&&R4(e.length)&&!P4(e)}function N4(e){return u_(e)&&c_(e)}function P4(e){var t=s_(e)?Nd.call(e):"";return t==n4||t==i4}function R4(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=jP}function s_(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function u_(e){return!!e&&typeof e=="object"}function D4(e){return typeof e=="string"||!$P(e)&&u_(e)&&Nd.call(e)==o4}function k4(e){return typeof e=="symbol"||u_(e)&&Nd.call(e)==s4}function C4(e){if(!e)return e===0?e:0;if(e=j4(e),e===CP||e===-CP){var t=e<0?-1:1;return t*t4}return e===e?e:0}function L4(e){var t=C4(e),r=t%1;return t===t?r?t-r:t:0}function j4(e){if(typeof e=="number")return e;if(k4(e))return LP;if(s_(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=s_(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(a4,"");var r=u4.test(e);return r||l4.test(e)?d4(e.slice(2),r?2:8):c4.test(e)?LP:+e}function $4(e){return c_(e)?S4(e):O4(e)}function M4(e){return e?_4(e,$4(e)):[]}MP.exports=x4});var UP=_((DSe,FP)=>{p();var q4="[object Boolean]",F4=Object.prototype,U4=F4.toString;function z4(e){return e===!0||e===!1||G4(e)&&U4.call(e)==q4}function G4(e){return!!e&&typeof e=="object"}FP.exports=z4});var ZP=_((CSe,BP)=>{p();var zP=1/0,V4=17976931348623157e292,GP=NaN,B4="[object Symbol]",Z4=/^\s+|\s+$/g,K4=/^[-+]0x[0-9a-f]+$/i,H4=/^0b[01]+$/i,Q4=/^0o[0-7]+$/i,W4=parseInt,J4=Object.prototype,Y4=J4.toString;function X4(e){return typeof e=="number"&&e==nW(e)}function VP(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function eW(e){return!!e&&typeof e=="object"}function tW(e){return typeof e=="symbol"||eW(e)&&Y4.call(e)==B4}function rW(e){if(!e)return e===0?e:0;if(e=iW(e),e===zP||e===-zP){var t=e<0?-1:1;return t*V4}return e===e?e:0}function nW(e){var t=rW(e),r=t%1;return t===t?r?t-r:t:0}function iW(e){if(typeof e=="number")return e;if(tW(e))return GP;if(VP(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=VP(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(Z4,"");var r=H4.test(e);return r||Q4.test(e)?W4(e.slice(2),r?2:8):K4.test(e)?GP:+e}BP.exports=X4});var HP=_((jSe,KP)=>{p();var oW="[object Number]",sW=Object.prototype,aW=sW.toString;function cW(e){return!!e&&typeof e=="object"}function uW(e){return typeof e=="number"||cW(e)&&aW.call(e)==oW}KP.exports=uW});var YP=_((MSe,JP)=>{p();var lW="[object Object]";function pW(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}function dW(e,t){return function(r){return e(t(r))}}var fW=Function.prototype,QP=Object.prototype,WP=fW.toString,hW=QP.hasOwnProperty,mW=WP.call(Object),gW=QP.toString,yW=dW(Object.getPrototypeOf,Object);function _W(e){return!!e&&typeof e=="object"}function vW(e){if(!_W(e)||gW.call(e)!=lW||pW(e))return!1;var t=yW(e);if(t===null)return!0;var r=hW.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&WP.call(r)==mW}JP.exports=vW});var eR=_((FSe,XP)=>{p();var EW="[object String]",TW=Object.prototype,bW=TW.toString,SW=Array.isArray;function OW(e){return!!e&&typeof e=="object"}function IW(e){return typeof e=="string"||!SW(e)&&OW(e)&&bW.call(e)==EW}XP.exports=IW});var oR=_((zSe,iR)=>{p();var wW="Expected a function",tR=1/0,xW=17976931348623157e292,rR=NaN,AW="[object Symbol]",NW=/^\s+|\s+$/g,PW=/^[-+]0x[0-9a-f]+$/i,RW=/^0b[01]+$/i,DW=/^0o[0-7]+$/i,kW=parseInt,CW=Object.prototype,LW=CW.toString;function jW(e,t){var r;if(typeof t!="function")throw new TypeError(wW);return e=UW(e),function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=void 0),r}}function $W(e){return jW(2,e)}function nR(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function MW(e){return!!e&&typeof e=="object"}function qW(e){return typeof e=="symbol"||MW(e)&&LW.call(e)==AW}function FW(e){if(!e)return e===0?e:0;if(e=zW(e),e===tR||e===-tR){var t=e<0?-1:1;return t*xW}return e===e?e:0}function UW(e){var t=FW(e),r=t%1;return t===t?r?t-r:t:0}function zW(e){if(typeof e=="number")return e;if(qW(e))return rR;if(nR(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=nR(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(NW,"");var r=RW.test(e);return r||DW.test(e)?kW(e.slice(2),r?2:8):PW.test(e)?rR:+e}iR.exports=$W});var hR=_((VSe,fR)=>{p();var sR=Ly(),GW=n_(),VW=r_(),aR=ld(),BW=qP(),Pd=UP(),cR=ZP(),l_=HP(),lR=YP(),Hi=eR(),ZW=oR(),{KeyObject:KW,createSecretKey:HW,createPrivateKey:QW}=K("crypto"),pR=["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512","none"];GW&&pR.splice(3,0,"PS256","PS384","PS512");var WW={expiresIn:{isValid:function(e){return cR(e)||Hi(e)&&e},message:'"expiresIn" should be a number of seconds or string representing a timespan'},notBefore:{isValid:function(e){return cR(e)||Hi(e)&&e},message:'"notBefore" should be a number of seconds or string representing a timespan'},audience:{isValid:function(e){return Hi(e)||Array.isArray(e)},message:'"audience" must be a string or array'},algorithm:{isValid:BW.bind(null,pR),message:'"algorithm" must be a valid string enum value'},header:{isValid:lR,message:'"header" must be an object'},encoding:{isValid:Hi,message:'"encoding" must be a string'},issuer:{isValid:Hi,message:'"issuer" must be a string'},subject:{isValid:Hi,message:'"subject" must be a string'},jwtid:{isValid:Hi,message:'"jwtid" must be a string'},noTimestamp:{isValid:Pd,message:'"noTimestamp" must be a boolean'},keyid:{isValid:Hi,message:'"keyid" must be a string'},mutatePayload:{isValid:Pd,message:'"mutatePayload" must be a boolean'},allowInsecureKeySizes:{isValid:Pd,message:'"allowInsecureKeySizes" must be a boolean'},allowInvalidAsymmetricKeyTypes:{isValid:Pd,message:'"allowInvalidAsymmetricKeyTypes" must be a boolean'}},JW={iat:{isValid:l_,message:'"iat" should be a number of seconds'},exp:{isValid:l_,message:'"exp" should be a number of seconds'},nbf:{isValid:l_,message:'"nbf" should be a number of seconds'}};function dR(e,t,r,n){if(!lR(r))throw new Error('Expected "'+n+'" to be a plain object.');Object.keys(r).forEach(function(i){let o=e[i];if(!o){if(!t)throw new Error('"'+i+'" is not allowed in "'+n+'"');return}if(!o.isValid(r[i]))throw new Error(o.message)})}function YW(e){return dR(WW,!1,e,"options")}function XW(e){return dR(JW,!0,e,"payload")}var uR={audience:"aud",issuer:"iss",subject:"sub",jwtid:"jti"},e9=["expiresIn","notBefore","noTimestamp","audience","issuer","subject","jwtid"];fR.exports=function(e,t,r,n){typeof r=="function"?(n=r,r={}):r=r||{};let i=typeof e=="object"&&!Buffer.isBuffer(e),o=Object.assign({alg:r.algorithm||"HS256",typ:i?"JWT":void 0,kid:r.keyid},r.header);function s(u){if(n)return n(u);throw u}if(!t&&r.algorithm!=="none")return s(new Error("secretOrPrivateKey must have a value"));if(t!=null&&!(t instanceof KW))try{t=QW(t)}catch{try{t=HW(typeof t=="string"?Buffer.from(t):t)}catch{return s(new Error("secretOrPrivateKey is not valid key material"))}}if(o.alg.startsWith("HS")&&t.type!=="secret")return s(new Error(`secretOrPrivateKey must be a symmetric key when using ${o.alg}`));if(/^(?:RS|PS|ES)/.test(o.alg)){if(t.type!=="private")return s(new Error(`secretOrPrivateKey must be an asymmetric key when using ${o.alg}`));if(!r.allowInsecureKeySizes&&!o.alg.startsWith("ES")&&t.asymmetricKeyDetails!==void 0&&t.asymmetricKeyDetails.modulusLength<2048)return s(new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${o.alg}`))}if(typeof e>"u")return s(new Error("payload is required"));if(i){try{XW(e)}catch(u){return s(u)}r.mutatePayload||(e=Object.assign({},e))}else{let u=e9.filter(function(l){return typeof r[l]<"u"});if(u.length>0)return s(new Error("invalid "+u.join(",")+" option for "+typeof e+" payload"))}if(typeof e.exp<"u"&&typeof r.expiresIn<"u")return s(new Error('Bad "options.expiresIn" option the payload already has an "exp" property.'));if(typeof e.nbf<"u"&&typeof r.notBefore<"u")return s(new Error('Bad "options.notBefore" option the payload already has an "nbf" property.'));try{YW(r)}catch(u){return s(u)}if(!r.allowInvalidAsymmetricKeyTypes)try{VW(o.alg,t)}catch(u){return s(u)}let a=e.iat||Math.floor(Date.now()/1e3);if(r.noTimestamp?delete e.iat:i&&(e.iat=a),typeof r.notBefore<"u"){try{e.nbf=sR(r.notBefore,a)}catch(u){return s(u)}if(typeof e.nbf>"u")return s(new Error('"notBefore" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}if(typeof r.expiresIn<"u"&&typeof e=="object"){try{e.exp=sR(r.expiresIn,a)}catch(u){return s(u)}if(typeof e.exp>"u")return s(new Error('"expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}Object.keys(uR).forEach(function(u){let l=uR[u];if(typeof r[u]<"u"){if(typeof e[l]<"u")return s(new Error('Bad "options.'+u+'" option. The payload already has an "'+l+'" property.'));e[l]=r[u]}});let c=r.encoding||"utf8";if(typeof n=="function")n=n&&ZW(n),aR.createSign({header:o,privateKey:t,payload:e,encoding:c}).once("error",n).once("done",function(u){if(!r.allowInsecureKeySizes&&/^(?:RS|PS)/.test(o.alg)&&u.length<256)return n(new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${o.alg}`));n(null,u)});else{let u=aR.sign({header:o,payload:e,secret:t,encoding:c});if(!r.allowInsecureKeySizes&&/^(?:RS|PS)/.test(o.alg)&&u.length<256)throw new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${o.alg}`);return u}}});var fu=_((ZSe,mR)=>{p();mR.exports={decode:Dy(),verify:kP(),sign:hR(),JsonWebTokenError:au(),NotBeforeError:ky(),TokenExpiredError:Cy()}});var xR=_(_a=>{"use strict";p();Object.defineProperty(_a,"__esModule",{value:!0});_a.versionInfo=_a.version=void 0;var b9="15.10.2";_a.version=b9;var S9=Object.freeze({major:15,minor:10,patch:2,preReleaseTag:null});_a.versionInfo=S9});var Md=_(__=>{"use strict";p();Object.defineProperty(__,"__esModule",{value:!0});__.default=O9;function O9(e){return typeof e?.then=="function"}});var Xr=_(v_=>{"use strict";p();Object.defineProperty(v_,"__esModule",{value:!0});v_.default=I9;function I9(e,t){var r=!!e;if(!r)throw new Error(t)}});var Kn=_(E_=>{"use strict";p();Object.defineProperty(E_,"__esModule",{value:!0});E_.default=w9;function qd(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?qd=function(r){return typeof r}:qd=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},qd(e)}function w9(e){return qd(e)=="object"&&e!==null}});var Hn=_(Qi=>{"use strict";p();Object.defineProperty(Qi,"__esModule",{value:!0});Qi.SYMBOL_TO_STRING_TAG=Qi.SYMBOL_ASYNC_ITERATOR=Qi.SYMBOL_ITERATOR=void 0;var x9=typeof Symbol=="function"&&Symbol.iterator!=null?Symbol.iterator:"@@iterator";Qi.SYMBOL_ITERATOR=x9;var A9=typeof Symbol=="function"&&Symbol.asyncIterator!=null?Symbol.asyncIterator:"@@asyncIterator";Qi.SYMBOL_ASYNC_ITERATOR=A9;var N9=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";Qi.SYMBOL_TO_STRING_TAG=N9});var Fd=_(T_=>{"use strict";p();Object.defineProperty(T_,"__esModule",{value:!0});T_.getLocation=P9;function P9(e,t){for(var r=/\r\n|[\n\r]/g,n=1,i=t+1,o;(o=r.exec(e.body))&&o.index<t;)n+=1,i=t+1-(o.index+o[0].length);return{line:n,column:i}}});var b_=_(zd=>{"use strict";p();Object.defineProperty(zd,"__esModule",{value:!0});zd.printLocation=D9;zd.printSourceLocation=NR;var R9=Fd();function D9(e){return NR(e.source,(0,R9.getLocation)(e.source,e.start))}function NR(e,t){var r=e.locationOffset.column-1,n=Ud(r)+e.body,i=t.line-1,o=e.locationOffset.line-1,s=t.line+o,a=t.line===1?r:0,c=t.column+a,u="".concat(e.name,":").concat(s,":").concat(c,`
6
6
  `),l=n.split(/\r\n|[\n\r]/g),d=l[i];if(d.length>120){for(var f=Math.floor(c/80),h=c%80,m=[],y=0;y<d.length;y+=80)m.push(d.slice(y,y+80));return u+AR([["".concat(s),m[0]]].concat(m.slice(1,f+1).map(function(v){return["",v]}),[[" ",Ud(h-1)+"^"],["",m[f+1]]]))}return u+AR([["".concat(s-1),l[i-1]],["".concat(s),d],["",Ud(c-1)+"^"],["".concat(s+1),l[i+1]]])}function AR(e){var t=e.filter(function(n){var i=n[0],o=n[1];return o!==void 0}),r=Math.max.apply(Math,t.map(function(n){var i=n[0];return i.length}));return t.map(function(n){var i=n[0],o=n[1];return k9(r,i)+(o?" | "+o:" |")}).join(`
@@ -1072,7 +1072,7 @@ ${String(e)}`)}catch(t){return t}},bj=e=>{if(typeof e!="object"||e===null)throw
1072
1072
  }
1073
1073
  }
1074
1074
  }
1075
- `;p();import{randomUUID as bse}from"crypto";var Hq=Rt(NM(),1);p();var hse=Rt(Oq(),1),mse=Rt(Fh(),1),gse=Rt(cc(),1),yse=Rt(uS(),1),_se=Rt(dS(),1),vse=Rt(_S(),1),kq=Rt(Vh(),1),Ese=Rt(Dq(),1);var Cq=kq.default;p();var Lq=100*1024*1024,Zh=class{current=Promise.resolve();async run(t){let r=this.current,n=()=>{};this.current=new Promise(i=>{n=i}),await r;try{return await t()}finally{n()}}},Fq=async e=>{let t=await fetch(e);if(!t.ok)throw new Error(`Failed to download CRDT model: ${t.status} ${t.statusText}`);let r=t.body?.getReader();if(!r)throw new Error("Failed to read CRDT model response body");let n=[],i=0;for(;;){let{done:a,value:c}=await r.read();if(a)break;if(i+=c.length,i>Lq)throw new Error(`CRDT model is larger than ${Lq} bytes`);n.push(c)}let o=new Uint8Array(i),s=0;for(let a of n)o.set(a,s),s+=a.length;return o},Kh=async(e,t)=>{try{return await t()}catch(r){return V.warn(`Optional runtime package unavailable: ${e}`,r.message),null}},jq=null,oi=async()=>(jq??=Kh("@functorz/ztype",()=>import("./ztype-NOE3RX2D.js")).then(e=>(e?.default??e)?.com?.functorz?.ztype??null),jq),$q=null,Uq=async()=>($q??=oi().then(e=>e?.typesystem?.schema?.SCHEMA_VERSION??null),$q),Mq=null,Hh=async()=>(Mq??=Kh("@functorz/crdt-helper",()=>import("./index.cjs-BCDCWBZR.js")).then(e=>e?.Crdt??e?.default?.Crdt??null),Mq),qq=null,zq=async()=>(qq??=Kh("json-joy/lib/json-crdt-patch/index.js",()=>import("./json-crdt-patch-TK577EJE.js")).then(e=>e??Kh("json-joy/lib/json-crdt/index.js",()=>import("./json-crdt-BRECEWRJ.js"))).then(e=>e?.Patch??e?.default?.Patch??null),qq),ES=e=>e?.lastUploadedSchema??null,TS=e=>[e?.project?.lastDeployedServerSchemaExId,e?.lastDeployedServerSchemaExId,e?.project?.latestDeployedServerSchema?.exId,e?.latestDeployedServerSchema?.exId].find(r=>typeof r=="string"&&r.length>0)??null,bS=e=>e==null?e:structuredClone(e),Gq=(e,t)=>e?.appExId?e.appExId:t?.name??"",Vq=(e,t)=>{let r=e?.typesystem?.schema?.ClientType;if(r)return t==="WECHAT_MINI_PROGRAM"?r.WECHAT_MINI_PROGRAM??r.WECHAT??r.WEB:t==="MOBILE"?r.MOBILE??r.WEB:r.WEB},Bq=e=>{let t=e?.typesystem?.schema?.Product?.[Uo];if(!t)throw new Error(`ztype runtime has no Product enum member for ${Uo}`);return t},Tse=e=>{try{return JSON.parse(JSON.stringify(e))}catch{return String(e)}},Qh=e=>({componentId:e?.componentId??null,message:typeof e?.getLocalizedErrorMessage=="function"?e.getLocalizedErrorMessage("EN"):e?.message??String(e),zhMessage:typeof e?.getLocalizedErrorMessage=="function"?e.getLocalizedErrorMessage("ZH"):void 0,platform:e?.platform??null,isBackendError:!!e?.isBackendError,fullPath:Tse(e?.fullPath??[])}),Wh=e=>e.stableErrors.concat(e.betaErrors).filter(t=>!!t.isBackendError),Zq=e=>Wh(e).length,Kq=(e,t)=>{if(t.__typename==="DiffItem"){let r=t.pathComponents?.at(-1)?.key??"";if(t.operation==="delete"){delete e[r];return}e[r]=structuredClone(t.newValue);return}if(t.__typename==="ArrayDiffItem"){let r=t.pathComponents?.at(-1)?.index??-1;if(!Array.isArray(e)||r<0)throw new Error("Invalid array diff target");if(t.operation==="delete"){e.splice(r,1);return}if(t.operation==="insert"){e.splice(r,0,structuredClone(t.newValue));return}e[r]=structuredClone(t.newValue)}};var Qq=bse(),Sse=e=>{if(!e)return e;if(Array.isArray(e))return e.map(([r,n])=>[r,String(r).toLowerCase()==="authorization"?"Bearer <redacted>":n]);if(typeof e=="object"&&"forEach"in e&&typeof e.forEach=="function"){let r={};return e.forEach((n,i)=>{r[i]=i.toLowerCase()==="authorization"?"Bearer <redacted>":String(n)}),r}let t={};for(let[r,n]of Object.entries(e))t[r]=r.toLowerCase()==="authorization"?"Bearer <redacted>":String(n);return t};function SS(e){if(!Array.isArray(e)||e.length===0)return null;let t=e.map(r=>{let n=r,i=typeof n.operation=="string"?n.operation:null,o=typeof n.errorType=="string"?n.errorType:typeof n.extensions?.classification=="string"?n.extensions.classification:null,s=typeof n.message=="string"?n.message:null;return!s&&!i&&!o?null:`${i?`${i}: `:""}${s??"GraphQL error"}${o?` (${o})`:""}`}).filter(r=>!!r);return t.length>0?t.join("; "):null}var Ose=e=>{if(typeof e=="string")return e;if(e instanceof Uint8Array)return Buffer.from(e).toString("utf8");try{return String(e)}catch{return"<unserializable body>"}},Ll=async(e,t)=>{let r=Ld();V.debug(`[HTTP] Request URL: ${e.toString()}`),t?.headers&&V.debug(`[HTTP] Request Headers: ${JSON.stringify(Sse(t.headers))}`),r&&t?.body!=null&&V.debug(`[GQL] Request Body: ${Ose(t.body)}`);let n=await fetch(e,t),i=null;try{i=await n.clone().text()}catch(o){V.debug(`[GQL] Response read failed: ${String(o)}`)}if(r&&V.debug(`[GQL] Response ${n.status}: ${i??"<read failed>"}`),i&&i.includes('"errors"')){let o=null;try{o=JSON.parse(i).errors}catch{o=null}let s=SS(o);s&&V.warn(`[GQL] ${n.status} errors: ${s}`)}return n};async function OS(e,t){let r=await e.getValidToken(),n=await An(t),i={Authorization:`Bearer ${r}`,"User-Locale":"en_US","X-SESSION-ID":Qq},o=await Uq();return o&&(i["X-ZED-VERSION"]=o),process.env.REACT_APP_VERSION&&(i["X-REACT-APP-VERSION"]=process.env.REACT_APP_VERSION),new tr(`${n.apiBaseUrl}/api/graphql`,{headers:i,fetch:Ll})}async function Wq(e,t){let r=await e.getValidToken(),i=`${(await An(t)).apiBaseUrl.replace(/^http:/,"ws:").replace(/^https:/,"wss:")}/api/graphql-subscription`;return async(o,s,a)=>{let c=Ld(),u={authToken:r,"X-SESSION-ID":Qq};V.debug(`[SUB] connecting ${i} params=${JSON.stringify({...u,authToken:"Bearer <redacted>"})}`);let l=new Hq.SubscriptionClient(i,{lazy:!0,reconnect:!0,minTimeout:3e3,connectionParams:u},Cq);l.onConnected(()=>V.debug("[SUB] connected")),l.onReconnected(()=>V.debug("[SUB] reconnected")),l.onDisconnected(()=>V.debug("[SUB] disconnected")),l.onError(h=>V.debug(`[SUB] error ${h?.message??String(h)}`));let f=[{name:"onNewCrdtPatchV2",query:t$,variables:{projectExId:o.projectExId,appExId:o.appExId??null,versionExId:o.appVersionExId??null,latestPatchExIdInClient:s}},{name:"onSchemaUploadV3",query:r$,variables:{projectExId:o.projectExId,appExId:o.appExId??null,appVersionExId:o.appVersionExId??null}}].map(h=>(V.debug(`[SUB] subscribe ${h.name} vars=${JSON.stringify(h.variables)}`),l.request({query:h.query,variables:h.variables}).subscribe({next:m=>{c&&V.debug(`[SUB] ${h.name} event: ${JSON.stringify(m)}`),a()},error:m=>{V.warn("Schema subscription event failed",String(m)),a()}})));return{unsubscribe(){for(let h of f)h.unsubscribe();l.close(!1,!1)}}}}async function Jh(e,t){if(t.projectExId)return await e.saveProjectContext(t.projectExId),t.projectExId;let r=await e.loadProjectContext();if(!r?.projectExId)throw new Error("No projectExId provided and no current project is set");return r.projectExId}p();p();p();import{createHash as Ise}from"crypto";var wse=e=>!!(e&&typeof e=="object"&&!Array.isArray(e)),IS=e=>{if(Array.isArray(e))return e.map(r=>r===void 0?null:IS(r));if(!wse(e))return e;let t={};for(let r of Object.keys(e).sort()){let n=e[r];n!==void 0&&(t[r]=IS(n))}return t},xse=e=>JSON.stringify(IS(e)),Ase=e=>Ise("sha256").update(xse(e)).digest("hex"),Jq=e=>({projectExId:e.projectExId,appExId:e.appExId??null,appVersionExId:e.appVersionExId??null,schemaExId:e.schemaExId??null,lastPatchExId:e.lastPatchExId??null,snapshotHash:Ase(e.snapshot),deployedSchemaExId:e.deployedSchemaExId??null,checkedAt:e.checkedAt??new Date().toISOString()}),Yq=(e,t)=>!e||!t?e!==t:e.schemaExId!==t.schemaExId||e.lastPatchExId!==t.lastPatchExId||e.snapshotHash!==t.snapshotHash||e.deployedSchemaExId!==t.deployedSchemaExId,Yh=e=>e.changes.length>0;var Xq=null,Nse=()=>(Xq??=oi().then(e=>{let t=e?.typesystem?.schema?.diff?.computeSemanticSchemaChanges;return typeof t=="function"?t:null}),Xq),wS=async(e,t)=>{let r=await Nse();return r?r(e,t):{changes:[]}};p();var Es=class extends Error{constructor(r,n){super(r);this.diagnostics=n;this.name="ZtypeValidationError"}};p();function Xh(e,t,r){let n=Vq(e,r?.appType);return e.api.ZTypeCoreApi.genZTypeApiContext(t,Bq(e),n,Gq(r,n),e?.utils?.Locale?.EN,null)}p();var Rn=e=>e==null,Pse=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),e1=e=>{if(Pse(e)){if(!Rn(e.id))return{key:"id",value:e.id};if(!Rn(e.uniqueId))return{key:"uniqueId",value:e.uniqueId};if(!Rn(e.mRef))return{key:"mRef",value:e.mRef}}},xS=(e,t)=>{if(Rn(e)&&Rn(t)||e===t)return!0;if(Rn(e)||Rn(t)||typeof e!="object"||typeof t!="object")return!1;let r=e,n=t,i=new Set([...Object.keys(r),...Object.keys(n)]);for(let o of i)if(!xS(r[o],n[o]))return!1;return!0},t1=e=>{if(e.__typename==="DiffItem")switch(e.operation){case"add":return{__typename:"DiffItem",oldValue:e.newValue,newValue:null,operation:"delete",pathComponents:e.pathComponents};case"delete":return{__typename:"DiffItem",oldValue:null,newValue:e.oldValue,operation:"add",pathComponents:e.pathComponents};case"update":return{__typename:"DiffItem",oldValue:e.newValue,newValue:e.oldValue,operation:"update",pathComponents:e.pathComponents}}else switch(e.operation){case"insert":return{__typename:"ArrayDiffItem",oldValue:e.newValue,newValue:null,previousValue:e.previousValue,nextValue:e.nextValue,operation:"delete",pathComponents:e.pathComponents};case"delete":return{__typename:"ArrayDiffItem",oldValue:null,newValue:e.oldValue,previousValue:e.previousValue,nextValue:e.nextValue,operation:"insert",pathComponents:e.pathComponents};case"update":return{__typename:"ArrayDiffItem",oldValue:e.newValue,newValue:e.oldValue,operation:"update",pathComponents:e.pathComponents}}throw new Error(`Cannot reverse diff item: ${JSON.stringify(e)}`)},Rse=e=>e.key??e.index??"",Dse=(e,t)=>{let r=e;for(let n of t){if(r===null||typeof r!="object")return;r=r[n]}return r},kse=(e,t)=>{if(t.__typename!=="DiffItem")return null;let r=t.pathComponents.at(-1)?.key;if(r===void 0)return null;let n=e1(e[r]),i=n===void 0?xS(e[r],t.oldValue):n.value===t.oldValue?.[n.key];switch(t.operation){case"add":e[r]=t.newValue;break;case"update":if(!i)return null;e[r]=t.newValue;break;case"delete":if(!Object.prototype.hasOwnProperty.call(e,r)||!i)return null;delete e[r];break;default:return null}return t},Cse=(e,t)=>{if(t.__typename!=="ArrayDiffItem")return null;let r=t.pathComponents.at(-1)?.index;if(r===void 0||r>e.length)return null;let n=()=>{let i=e1(e[r]);return i===void 0?xS(e[r],t.oldValue):i.value===t.oldValue?.[i.key]};switch(t.operation){case"insert":e.splice(r,0,t.newValue);break;case"delete":if(!n())return null;e.splice(r,1);break;case"update":if(!n())return null;e.splice(r,1,t.newValue);break;default:return null}return t},r1=(e,t)=>{let r=e,n=new WeakSet,i=s=>{if(r===null||typeof r!="object")return r;n.has(r)||(r=Array.isArray(r)?[...r]:{...r},n.add(r));let a=r;for(let c of s){let u=a[c];if(u!==null&&typeof u=="object"){if(!n.has(u)){let l=Array.isArray(u)?[...u]:{...u};n.add(l),a[c]=l}a=a[c]}else a=u}return a},o=[];for(let s of t)try{let c=s.pathComponents.map(Rse).slice(0,-1);if(Rn(Dse(r,c)))continue;let u=i(c);if(Array.isArray(u)){let l=Cse(u,s);l&&o.push(l)}else if(u!==null&&typeof u=="object"){let l=kse(u,s);l&&o.push(l)}}catch{continue}return o};p();var Lse=3e4,em=class{constructor(t){this.options=t}timer=null;subscriptionHandle=null;running=!1;isActive(){return this.timer!==null||this.subscriptionHandle!==null}start(){this.timer||this.subscriptionHandle||!this.options.subscriptionFactory||this.options.subscriptionFactory(this.options.sessionKey,this.options.getLastPatchExId(),()=>{this.run()}).then(t=>{this.subscriptionHandle=t}).catch(t=>{V.warn("Schema subscription failed; falling back to polling",t.message)}).finally(()=>{this.schedulePoll()})}dispose(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.subscriptionHandle?.unsubscribe(),this.subscriptionHandle=null}schedulePoll(){!this.options.subscriptionFactory||this.timer||(this.timer=setTimeout(()=>{this.timer=null,this.run().finally(()=>this.schedulePoll())},Lse),this.timer.unref())}async run(){if(!this.running){this.running=!0;try{await this.options.refresh()}finally{this.running=!1}}}};p();p();var E={};vy(E,{BRAND:()=>aae,DIRTY:()=>Ts,EMPTY_PATH:()=>qse,INVALID:()=>ie,NEVER:()=>Vae,OK:()=>ar,ParseStatus:()=>Ht,Schema:()=>ge,ZodAny:()=>Eo,ZodArray:()=>$i,ZodBigInt:()=>Ss,ZodBoolean:()=>Os,ZodBranded:()=>$l,ZodCatch:()=>Ls,ZodDate:()=>Is,ZodDefault:()=>Cs,ZodDiscriminatedUnion:()=>nm,ZodEffects:()=>pn,ZodEnum:()=>Ds,ZodError:()=>Nr,ZodFirstPartyTypeKind:()=>D,ZodFunction:()=>om,ZodIntersection:()=>Ns,ZodIssueCode:()=>R,ZodLazy:()=>Ps,ZodLiteral:()=>Rs,ZodMap:()=>vc,ZodNaN:()=>Tc,ZodNativeEnum:()=>ks,ZodNever:()=>Dn,ZodNull:()=>xs,ZodNullable:()=>ci,ZodNumber:()=>bs,ZodObject:()=>Rr,ZodOptional:()=>Pr,ZodParsedType:()=>M,ZodPipeline:()=>Ml,ZodPromise:()=>To,ZodReadonly:()=>js,ZodRecord:()=>im,ZodSchema:()=>ge,ZodSet:()=>Ec,ZodString:()=>vo,ZodSymbol:()=>yc,ZodTransformer:()=>pn,ZodTuple:()=>ai,ZodType:()=>ge,ZodUndefined:()=>ws,ZodUnion:()=>As,ZodUnknown:()=>ji,ZodVoid:()=>_c,addIssueToContext:()=>$,any:()=>gae,array:()=>Eae,bigint:()=>pae,boolean:()=>f1,coerce:()=>Gae,custom:()=>l1,date:()=>dae,datetimeRegex:()=>c1,defaultErrorMap:()=>Ci,discriminatedUnion:()=>Sae,effect:()=>Lae,enum:()=>Dae,function:()=>Nae,getErrorMap:()=>hc,getParsedType:()=>si,instanceof:()=>uae,intersection:()=>Oae,isAborted:()=>tm,isAsync:()=>mc,isDirty:()=>rm,isValid:()=>_o,late:()=>cae,lazy:()=>Pae,literal:()=>Rae,makeIssue:()=>jl,map:()=>xae,nan:()=>lae,nativeEnum:()=>kae,never:()=>_ae,null:()=>mae,nullable:()=>$ae,number:()=>d1,object:()=>RS,objectUtil:()=>AS,oboolean:()=>zae,onumber:()=>Uae,optional:()=>jae,ostring:()=>Fae,pipeline:()=>qae,preprocess:()=>Mae,promise:()=>Cae,quotelessJson:()=>jse,record:()=>wae,set:()=>Aae,setErrorMap:()=>Mse,strictObject:()=>Tae,string:()=>p1,symbol:()=>fae,transformer:()=>Lae,tuple:()=>Iae,undefined:()=>hae,union:()=>bae,unknown:()=>yae,util:()=>Te,void:()=>vae});p();p();p();p();p();var Te;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function r(i){throw new Error}e.assertNever=r,e.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},e.getValidEnumValues=i=>{let o=e.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(let a of o)s[a]=i[a];return e.objectValues(s)},e.objectValues=i=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},e.find=(i,o)=>{for(let s of i)if(o(s))return s},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}e.joinValues=n,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(Te||(Te={}));var AS;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(AS||(AS={}));var M=Te.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),si=e=>{switch(typeof e){case"undefined":return M.undefined;case"string":return M.string;case"number":return Number.isNaN(e)?M.nan:M.number;case"boolean":return M.boolean;case"function":return M.function;case"bigint":return M.bigint;case"symbol":return M.symbol;case"object":return Array.isArray(e)?M.array:e===null?M.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?M.promise:typeof Map<"u"&&e instanceof Map?M.map:typeof Set<"u"&&e instanceof Set?M.set:typeof Date<"u"&&e instanceof Date?M.date:M.object;default:return M.unknown}};var R=Te.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"]),jse=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),Nr=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(o){return o.message},n={_errors:[]},i=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,c=0;for(;c<s.path.length;){let u=s.path[c];c===s.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(s))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return i(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Te.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];r[o]=r[o]||[],r[o].push(t(i))}else n.push(t(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Nr.create=e=>new Nr(e);var $se=(e,t)=>{let r;switch(e.code){case R.invalid_type:e.received===M.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case R.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Te.jsonStringifyReplacer)}`;break;case R.unrecognized_keys:r=`Unrecognized key(s) in object: ${Te.joinValues(e.keys,", ")}`;break;case R.invalid_union:r="Invalid input";break;case R.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Te.joinValues(e.options)}`;break;case R.invalid_enum_value:r=`Invalid enum value. Expected ${Te.joinValues(e.options)}, received '${e.received}'`;break;case R.invalid_arguments:r="Invalid function arguments";break;case R.invalid_return_type:r="Invalid function return type";break;case R.invalid_date:r="Invalid date";break;case R.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Te.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case R.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case R.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case R.custom:r="Invalid input";break;case R.invalid_intersection_types:r="Intersection results could not be merged";break;case R.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case R.not_finite:r="Number must be finite";break;default:r=t.defaultError,Te.assertNever(e)}return{message:r}},Ci=$se;var n1=Ci;function Mse(e){n1=e}function hc(){return n1}p();var jl=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,o=[...r,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(s,{data:t,defaultError:a}).message;return{...i,path:o,message:a}},qse=[];function $(e,t){let r=hc(),n=jl({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Ci?void 0:Ci].filter(i=>!!i)});e.common.issues.push(n)}var Ht=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let i of r){if(i.status==="aborted")return ie;i.status==="dirty"&&t.dirty(),n.push(i.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let i of r){let o=await i.key,s=await i.value;n.push({key:o,value:s})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let i of r){let{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return ie;o.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(n[o.value]=s.value)}return{status:t.value,value:n}}},ie=Object.freeze({status:"aborted"}),Ts=e=>({status:"dirty",value:e}),ar=e=>({status:"valid",value:e}),tm=e=>e.status==="aborted",rm=e=>e.status==="dirty",_o=e=>e.status==="valid",mc=e=>typeof Promise<"u"&&e instanceof Promise;p();p();var H;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(H||(H={}));var ln=class{constructor(t,r,n,i){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},i1=(e,t)=>{if(_o(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Nr(e.common.issues);return this._error=r,this._error}}};function fe(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(s,a)=>{let{message:c}=e;return s.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:i}}var ge=class{get description(){return this._def.description}_getType(t){return si(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:si(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Ht,ctx:{common:t.parent.common,data:t.data,parsedType:si(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(mc(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:si(t)},i=this._parseSync({data:t,path:n.path,parent:n});return i1(n,i)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:si(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return _o(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>_o(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:si(t)},i=this._parse({data:t,path:n.path,parent:n}),o=await(mc(i)?i:Promise.resolve(i));return i1(n,o)}refine(t,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,o)=>{let s=t(i),a=()=>o.addIssue({code:R.custom,...n(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,r){return this._refinement((n,i)=>t(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(t){return new pn({schema:this,typeName:D.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Pr.create(this,this._def)}nullable(){return ci.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return $i.create(this)}promise(){return To.create(this,this._def)}or(t){return As.create([this,t],this._def)}and(t){return Ns.create(this,t,this._def)}transform(t){return new pn({...fe(this._def),schema:this,typeName:D.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Cs({...fe(this._def),innerType:this,defaultValue:r,typeName:D.ZodDefault})}brand(){return new $l({typeName:D.ZodBranded,type:this,...fe(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Ls({...fe(this._def),innerType:this,catchValue:r,typeName:D.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Ml.create(this,t)}readonly(){return js.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Fse=/^c[^\s-]{8,}$/i,Use=/^[0-9a-z]+$/,zse=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Gse=/^[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,Vse=/^[a-z0-9_-]{21}$/i,Bse=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Zse=/^[-+]?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)?)??$/,Kse=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Hse="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",NS,Qse=/^(?:(?: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])$/,Wse=/^(?:(?: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])$/,Jse=/^(([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]))$/,Yse=/^(([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])$/,Xse=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,eae=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,s1="((\\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])))",tae=new RegExp(`^${s1}$`);function a1(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function rae(e){return new RegExp(`^${a1(e)}$`)}function c1(e){let t=`${s1}T${a1(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function nae(e,t){return!!((t==="v4"||!t)&&Qse.test(e)||(t==="v6"||!t)&&Jse.test(e))}function iae(e,t){if(!Bse.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function oae(e,t){return!!((t==="v4"||!t)&&Wse.test(e)||(t==="v6"||!t)&&Yse.test(e))}var vo=class e extends ge{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==M.string){let o=this._getOrReturnCtx(t);return $(o,{code:R.invalid_type,expected:M.string,received:o.parsedType}),ie}let n=new Ht,i;for(let o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(i=this._getOrReturnCtx(t,i),$(i,{code:R.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")t.data.length>o.value&&(i=this._getOrReturnCtx(t,i),$(i,{code:R.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let s=t.data.length>o.value,a=t.data.length<o.value;(s||a)&&(i=this._getOrReturnCtx(t,i),s?$(i,{code:R.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&$(i,{code:R.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")Kse.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"email",code:R.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")NS||(NS=new RegExp(Hse,"u")),NS.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"emoji",code:R.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")Gse.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"uuid",code:R.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")Vse.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"nanoid",code:R.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")Fse.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"cuid",code:R.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")Use.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"cuid2",code:R.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")zse.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"ulid",code:R.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),$(i,{validation:"url",code:R.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"regex",code:R.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(t,i),$(i,{code:R.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(i=this._getOrReturnCtx(t,i),$(i,{code:R.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(i=this._getOrReturnCtx(t,i),$(i,{code:R.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?c1(o).test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{code:R.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?tae.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{code:R.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?rae(o).test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{code:R.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?Zse.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"duration",code:R.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?nae(t.data,o.version)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"ip",code:R.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?iae(t.data,o.alg)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"jwt",code:R.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?oae(t.data,o.version)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"cidr",code:R.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?Xse.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"base64",code:R.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?eae.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"base64url",code:R.invalid_string,message:o.message}),n.dirty()):Te.assertNever(o);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(i=>t.test(i),{validation:r,code:R.invalid_string,...H.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...H.errToObj(t)})}url(t){return this._addCheck({kind:"url",...H.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...H.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...H.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...H.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...H.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...H.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...H.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...H.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...H.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...H.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...H.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...H.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...H.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...H.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...H.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...H.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...H.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...H.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...H.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...H.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...H.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...H.errToObj(r)})}nonempty(t){return this.min(1,H.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};vo.create=e=>new vo({checks:[],typeName:D.ZodString,coerce:e?.coerce??!1,...fe(e)});function sae(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n,o=Number.parseInt(e.toFixed(i).replace(".","")),s=Number.parseInt(t.toFixed(i).replace(".",""));return o%s/10**i}var bs=class e extends ge{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==M.number){let o=this._getOrReturnCtx(t);return $(o,{code:R.invalid_type,expected:M.number,received:o.parsedType}),ie}let n,i=new Ht;for(let o of this._def.checks)o.kind==="int"?Te.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),$(n,{code:R.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),$(n,{code:R.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),$(n,{code:R.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?sae(t.data,o.value)!==0&&(n=this._getOrReturnCtx(t,n),$(n,{code:R.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),$(n,{code:R.not_finite,message:o.message}),i.dirty()):Te.assertNever(o);return{status:i.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,H.toString(r))}gt(t,r){return this.setLimit("min",t,!1,H.toString(r))}lte(t,r){return this.setLimit("max",t,!0,H.toString(r))}lt(t,r){return this.setLimit("max",t,!1,H.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:H.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:H.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:H.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:H.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:H.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:H.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:H.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:H.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:H.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:H.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Te.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};bs.create=e=>new bs({checks:[],typeName:D.ZodNumber,coerce:e?.coerce||!1,...fe(e)});var Ss=class e extends ge{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==M.bigint)return this._getInvalidInput(t);let n,i=new Ht;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),$(n,{code:R.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),$(n,{code:R.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),$(n,{code:R.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Te.assertNever(o);return{status:i.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return $(r,{code:R.invalid_type,expected:M.bigint,received:r.parsedType}),ie}gte(t,r){return this.setLimit("min",t,!0,H.toString(r))}gt(t,r){return this.setLimit("min",t,!1,H.toString(r))}lte(t,r){return this.setLimit("max",t,!0,H.toString(r))}lt(t,r){return this.setLimit("max",t,!1,H.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:H.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:H.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:H.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:H.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:H.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:H.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Ss.create=e=>new Ss({checks:[],typeName:D.ZodBigInt,coerce:e?.coerce??!1,...fe(e)});var Os=class extends ge{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==M.boolean){let n=this._getOrReturnCtx(t);return $(n,{code:R.invalid_type,expected:M.boolean,received:n.parsedType}),ie}return ar(t.data)}};Os.create=e=>new Os({typeName:D.ZodBoolean,coerce:e?.coerce||!1,...fe(e)});var Is=class e extends ge{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==M.date){let o=this._getOrReturnCtx(t);return $(o,{code:R.invalid_type,expected:M.date,received:o.parsedType}),ie}if(Number.isNaN(t.data.getTime())){let o=this._getOrReturnCtx(t);return $(o,{code:R.invalid_date}),ie}let n=new Ht,i;for(let o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(i=this._getOrReturnCtx(t,i),$(i,{code:R.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(i=this._getOrReturnCtx(t,i),$(i,{code:R.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):Te.assertNever(o);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:H.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:H.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};Is.create=e=>new Is({checks:[],coerce:e?.coerce||!1,typeName:D.ZodDate,...fe(e)});var yc=class extends ge{_parse(t){if(this._getType(t)!==M.symbol){let n=this._getOrReturnCtx(t);return $(n,{code:R.invalid_type,expected:M.symbol,received:n.parsedType}),ie}return ar(t.data)}};yc.create=e=>new yc({typeName:D.ZodSymbol,...fe(e)});var ws=class extends ge{_parse(t){if(this._getType(t)!==M.undefined){let n=this._getOrReturnCtx(t);return $(n,{code:R.invalid_type,expected:M.undefined,received:n.parsedType}),ie}return ar(t.data)}};ws.create=e=>new ws({typeName:D.ZodUndefined,...fe(e)});var xs=class extends ge{_parse(t){if(this._getType(t)!==M.null){let n=this._getOrReturnCtx(t);return $(n,{code:R.invalid_type,expected:M.null,received:n.parsedType}),ie}return ar(t.data)}};xs.create=e=>new xs({typeName:D.ZodNull,...fe(e)});var Eo=class extends ge{constructor(){super(...arguments),this._any=!0}_parse(t){return ar(t.data)}};Eo.create=e=>new Eo({typeName:D.ZodAny,...fe(e)});var ji=class extends ge{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ar(t.data)}};ji.create=e=>new ji({typeName:D.ZodUnknown,...fe(e)});var Dn=class extends ge{_parse(t){let r=this._getOrReturnCtx(t);return $(r,{code:R.invalid_type,expected:M.never,received:r.parsedType}),ie}};Dn.create=e=>new Dn({typeName:D.ZodNever,...fe(e)});var _c=class extends ge{_parse(t){if(this._getType(t)!==M.undefined){let n=this._getOrReturnCtx(t);return $(n,{code:R.invalid_type,expected:M.void,received:n.parsedType}),ie}return ar(t.data)}};_c.create=e=>new _c({typeName:D.ZodVoid,...fe(e)});var $i=class e extends ge{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),i=this._def;if(r.parsedType!==M.array)return $(r,{code:R.invalid_type,expected:M.array,received:r.parsedType}),ie;if(i.exactLength!==null){let s=r.data.length>i.exactLength.value,a=r.data.length<i.exactLength.value;(s||a)&&($(r,{code:s?R.too_big:R.too_small,minimum:a?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&($(r,{code:R.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&($(r,{code:R.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>i.type._parseAsync(new ln(r,s,r.path,a)))).then(s=>Ht.mergeArray(n,s));let o=[...r.data].map((s,a)=>i.type._parseSync(new ln(r,s,r.path,a)));return Ht.mergeArray(n,o)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:H.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:H.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:H.toString(r)}})}nonempty(t){return this.min(1,t)}};$i.create=(e,t)=>new $i({type:e,minLength:null,maxLength:null,exactLength:null,typeName:D.ZodArray,...fe(t)});function gc(e){if(e instanceof Rr){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Pr.create(gc(n))}return new Rr({...e._def,shape:()=>t})}else return e instanceof $i?new $i({...e._def,type:gc(e.element)}):e instanceof Pr?Pr.create(gc(e.unwrap())):e instanceof ci?ci.create(gc(e.unwrap())):e instanceof ai?ai.create(e.items.map(t=>gc(t))):e}var Rr=class e extends ge{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=Te.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==M.object){let u=this._getOrReturnCtx(t);return $(u,{code:R.invalid_type,expected:M.object,received:u.parsedType}),ie}let{status:n,ctx:i}=this._processInputParams(t),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof Dn&&this._def.unknownKeys==="strip"))for(let u in i.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let l=o[u],d=i.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new ln(i,d,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof Dn){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:i.data[l]}});else if(u==="strict")a.length>0&&($(i,{code:R.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of a){let d=i.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new ln(i,d,i.path,l)),alwaysSet:l in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,f=await l.value;u.push({key:d,value:f,alwaysSet:l.alwaysSet})}return u}).then(u=>Ht.mergeObjectSync(n,u)):Ht.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return H.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:H.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:D.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of Te.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of Te.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return gc(this)}partial(t){let r={};for(let n of Te.objectKeys(this.shape)){let i=this.shape[n];t&&!t[n]?r[n]=i:r[n]=i.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of Te.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof Pr;)o=o._def.innerType;r[n]=o}return new e({...this._def,shape:()=>r})}keyof(){return u1(Te.objectKeys(this.shape))}};Rr.create=(e,t)=>new Rr({shape:()=>e,unknownKeys:"strip",catchall:Dn.create(),typeName:D.ZodObject,...fe(t)});Rr.strictCreate=(e,t)=>new Rr({shape:()=>e,unknownKeys:"strict",catchall:Dn.create(),typeName:D.ZodObject,...fe(t)});Rr.lazycreate=(e,t)=>new Rr({shape:e,unknownKeys:"strip",catchall:Dn.create(),typeName:D.ZodObject,...fe(t)});var As=class extends ge{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function i(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new Nr(a.ctx.common.issues));return $(r,{code:R.invalid_union,unionErrors:s}),ie}if(r.common.async)return Promise.all(n.map(async o=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(i);{let o,s=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!o&&(o={result:l,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(c=>new Nr(c));return $(r,{code:R.invalid_union,unionErrors:a}),ie}}get options(){return this._def.options}};As.create=(e,t)=>new As({options:e,typeName:D.ZodUnion,...fe(t)});var Li=e=>e instanceof Ps?Li(e.schema):e instanceof pn?Li(e.innerType()):e instanceof Rs?[e.value]:e instanceof Ds?e.options:e instanceof ks?Te.objectValues(e.enum):e instanceof Cs?Li(e._def.innerType):e instanceof ws?[void 0]:e instanceof xs?[null]:e instanceof Pr?[void 0,...Li(e.unwrap())]:e instanceof ci?[null,...Li(e.unwrap())]:e instanceof $l||e instanceof js?Li(e.unwrap()):e instanceof Ls?Li(e._def.innerType):[],nm=class e extends ge{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==M.object)return $(r,{code:R.invalid_type,expected:M.object,received:r.parsedType}),ie;let n=this.discriminator,i=r.data[n],o=this.optionsMap.get(i);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):($(r,{code:R.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ie)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let i=new Map;for(let o of r){let s=Li(o.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of s){if(i.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);i.set(a,o)}}return new e({typeName:D.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,...fe(n)})}};function PS(e,t){let r=si(e),n=si(t);if(e===t)return{valid:!0,data:e};if(r===M.object&&n===M.object){let i=Te.objectKeys(t),o=Te.objectKeys(e).filter(a=>i.indexOf(a)!==-1),s={...e,...t};for(let a of o){let c=PS(e[a],t[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===M.array&&n===M.array){if(e.length!==t.length)return{valid:!1};let i=[];for(let o=0;o<e.length;o++){let s=e[o],a=t[o],c=PS(s,a);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===M.date&&n===M.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Ns=class extends ge{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=(o,s)=>{if(tm(o)||tm(s))return ie;let a=PS(o.value,s.value);return a.valid?((rm(o)||rm(s))&&r.dirty(),{status:r.value,value:a.data}):($(n,{code:R.invalid_intersection_types}),ie)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Ns.create=(e,t,r)=>new Ns({left:e,right:t,typeName:D.ZodIntersection,...fe(r)});var ai=class e extends ge{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==M.array)return $(n,{code:R.invalid_type,expected:M.array,received:n.parsedType}),ie;if(n.data.length<this._def.items.length)return $(n,{code:R.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ie;!this._def.rest&&n.data.length>this._def.items.length&&($(n,{code:R.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new ln(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>Ht.mergeArray(r,s)):Ht.mergeArray(r,o)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};ai.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ai({items:e,typeName:D.ZodTuple,rest:null,...fe(t)})};var im=class e extends ge{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==M.object)return $(n,{code:R.invalid_type,expected:M.object,received:n.parsedType}),ie;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in n.data)i.push({key:o._parse(new ln(n,a,n.path,a)),value:s._parse(new ln(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Ht.mergeObjectAsync(r,i):Ht.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof ge?new e({keyType:t,valueType:r,typeName:D.ZodRecord,...fe(n)}):new e({keyType:vo.create(),valueType:t,typeName:D.ZodRecord,...fe(r)})}},vc=class extends ge{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==M.map)return $(n,{code:R.invalid_type,expected:M.map,received:n.parsedType}),ie;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([a,c],u)=>({key:i._parse(new ln(n,a,n.path,[u,"key"])),value:o._parse(new ln(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of s){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return ie;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of s){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return ie;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}};vc.create=(e,t,r)=>new vc({valueType:t,keyType:e,typeName:D.ZodMap,...fe(r)});var Ec=class e extends ge{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==M.set)return $(n,{code:R.invalid_type,expected:M.set,received:n.parsedType}),ie;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&($(n,{code:R.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&($(n,{code:R.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let o=this._def.valueType;function s(c){let u=new Set;for(let l of c){if(l.status==="aborted")return ie;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>o._parse(new ln(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(t,r){return new e({...this._def,minSize:{value:t,message:H.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:H.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Ec.create=(e,t)=>new Ec({valueType:e,minSize:null,maxSize:null,typeName:D.ZodSet,...fe(t)});var om=class e extends ge{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==M.function)return $(r,{code:R.invalid_type,expected:M.function,received:r.parsedType}),ie;function n(a,c){return jl({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,hc(),Ci].filter(u=>!!u),issueData:{code:R.invalid_arguments,argumentsError:c}})}function i(a,c){return jl({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,hc(),Ci].filter(u=>!!u),issueData:{code:R.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof To){let a=this;return ar(async function(...c){let u=new Nr([]),l=await a._def.args.parseAsync(c,o).catch(h=>{throw u.addIssue(n(c,h)),u}),d=await Reflect.apply(s,this,l);return await a._def.returns._def.type.parseAsync(d,o).catch(h=>{throw u.addIssue(i(d,h)),u})})}else{let a=this;return ar(function(...c){let u=a._def.args.safeParse(c,o);if(!u.success)throw new Nr([n(c,u.error)]);let l=Reflect.apply(s,this,u.data),d=a._def.returns.safeParse(l,o);if(!d.success)throw new Nr([i(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:ai.create(t).rest(ji.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||ai.create([]).rest(ji.create()),returns:r||ji.create(),typeName:D.ZodFunction,...fe(n)})}},Ps=class extends ge{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Ps.create=(e,t)=>new Ps({getter:e,typeName:D.ZodLazy,...fe(t)});var Rs=class extends ge{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return $(r,{received:r.data,code:R.invalid_literal,expected:this._def.value}),ie}return{status:"valid",value:t.data}}get value(){return this._def.value}};Rs.create=(e,t)=>new Rs({value:e,typeName:D.ZodLiteral,...fe(t)});function u1(e,t){return new Ds({values:e,typeName:D.ZodEnum,...fe(t)})}var Ds=class e extends ge{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return $(r,{expected:Te.joinValues(n),received:r.parsedType,code:R.invalid_type}),ie}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return $(r,{received:r.data,code:R.invalid_enum_value,options:n}),ie}return ar(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};Ds.create=u1;var ks=class extends ge{_parse(t){let r=Te.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==M.string&&n.parsedType!==M.number){let i=Te.objectValues(r);return $(n,{expected:Te.joinValues(i),received:n.parsedType,code:R.invalid_type}),ie}if(this._cache||(this._cache=new Set(Te.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let i=Te.objectValues(r);return $(n,{received:n.data,code:R.invalid_enum_value,options:i}),ie}return ar(t.data)}get enum(){return this._def.values}};ks.create=(e,t)=>new ks({values:e,typeName:D.ZodNativeEnum,...fe(t)});var To=class extends ge{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==M.promise&&r.common.async===!1)return $(r,{code:R.invalid_type,expected:M.promise,received:r.parsedType}),ie;let n=r.parsedType===M.promise?r.data:Promise.resolve(r.data);return ar(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};To.create=(e,t)=>new To({type:e,typeName:D.ZodPromise,...fe(t)});var pn=class extends ge{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===D.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=this._def.effect||null,o={addIssue:s=>{$(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let s=i.transform(n.data,o);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return ie;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?ie:c.status==="dirty"?Ts(c.value):r.value==="dirty"?Ts(c.value):c});{if(r.value==="aborted")return ie;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?ie:a.status==="dirty"?Ts(a.value):r.value==="dirty"?Ts(a.value):a}}if(i.type==="refinement"){let s=a=>{let c=i.refinement(a,o);if(n.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(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?ie:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?ie:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!_o(s))return ie;let a=i.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>_o(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:r.value,value:a})):ie);Te.assertNever(i)}};pn.create=(e,t,r)=>new pn({schema:e,typeName:D.ZodEffects,effect:t,...fe(r)});pn.createWithPreprocess=(e,t,r)=>new pn({schema:t,effect:{type:"preprocess",transform:e},typeName:D.ZodEffects,...fe(r)});var Pr=class extends ge{_parse(t){return this._getType(t)===M.undefined?ar(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Pr.create=(e,t)=>new Pr({innerType:e,typeName:D.ZodOptional,...fe(t)});var ci=class extends ge{_parse(t){return this._getType(t)===M.null?ar(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};ci.create=(e,t)=>new ci({innerType:e,typeName:D.ZodNullable,...fe(t)});var Cs=class extends ge{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===M.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Cs.create=(e,t)=>new Cs({innerType:e,typeName:D.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...fe(t)});var Ls=class extends ge{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return mc(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Nr(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Nr(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Ls.create=(e,t)=>new Ls({innerType:e,typeName:D.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...fe(t)});var Tc=class extends ge{_parse(t){if(this._getType(t)!==M.nan){let n=this._getOrReturnCtx(t);return $(n,{code:R.invalid_type,expected:M.nan,received:n.parsedType}),ie}return{status:"valid",value:t.data}}};Tc.create=e=>new Tc({typeName:D.ZodNaN,...fe(e)});var aae=Symbol("zod_brand"),$l=class extends ge{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Ml=class e extends ge{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?ie:o.status==="dirty"?(r.dirty(),Ts(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?ie:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:D.ZodPipeline})}},js=class extends ge{_parse(t){let r=this._def.innerType._parse(t),n=i=>(_o(i)&&(i.value=Object.freeze(i.value)),i);return mc(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};js.create=(e,t)=>new js({innerType:e,typeName:D.ZodReadonly,...fe(t)});function o1(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function l1(e,t={},r){return e?Eo.create().superRefine((n,i)=>{let o=e(n);if(o instanceof Promise)return o.then(s=>{if(!s){let a=o1(t,n),c=a.fatal??r??!0;i.addIssue({code:"custom",...a,fatal:c})}});if(!o){let s=o1(t,n),a=s.fatal??r??!0;i.addIssue({code:"custom",...s,fatal:a})}}):Eo.create()}var cae={object:Rr.lazycreate},D;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(D||(D={}));var uae=(e,t={message:`Input not instance of ${e.name}`})=>l1(r=>r instanceof e,t),p1=vo.create,d1=bs.create,lae=Tc.create,pae=Ss.create,f1=Os.create,dae=Is.create,fae=yc.create,hae=ws.create,mae=xs.create,gae=Eo.create,yae=ji.create,_ae=Dn.create,vae=_c.create,Eae=$i.create,RS=Rr.create,Tae=Rr.strictCreate,bae=As.create,Sae=nm.create,Oae=Ns.create,Iae=ai.create,wae=im.create,xae=vc.create,Aae=Ec.create,Nae=om.create,Pae=Ps.create,Rae=Rs.create,Dae=Ds.create,kae=ks.create,Cae=To.create,Lae=pn.create,jae=Pr.create,$ae=ci.create,Mae=pn.createWithPreprocess,qae=Ml.create,Fae=()=>p1().optional(),Uae=()=>d1().optional(),zae=()=>f1().optional(),Gae={string:(e=>vo.create({...e,coerce:!0})),number:(e=>bs.create({...e,coerce:!0})),boolean:(e=>Os.create({...e,coerce:!0})),bigint:(e=>Ss.create({...e,coerce:!0})),date:(e=>Is.create({...e,coerce:!0}))};var Vae=ie;var DS=[{name:"schema_actionflow",description:`Action flows \u2014 flow-level (addressed by actionFlowId). Discover types via op=SELECTABLE_TYPES and ids via op=GET_DETAIL. AI nodes require isAsync=true.
1075
+ `;p();import{randomUUID as bse}from"crypto";var Hq=Rt(NM(),1);p();var hse=Rt(Oq(),1),mse=Rt(Fh(),1),gse=Rt(cc(),1),yse=Rt(uS(),1),_se=Rt(dS(),1),vse=Rt(_S(),1),kq=Rt(Vh(),1),Ese=Rt(Dq(),1);var Cq=kq.default;p();var Lq=100*1024*1024,Zh=class{current=Promise.resolve();async run(t){let r=this.current,n=()=>{};this.current=new Promise(i=>{n=i}),await r;try{return await t()}finally{n()}}},Fq=async e=>{let t=await fetch(e);if(!t.ok)throw new Error(`Failed to download CRDT model: ${t.status} ${t.statusText}`);let r=t.body?.getReader();if(!r)throw new Error("Failed to read CRDT model response body");let n=[],i=0;for(;;){let{done:a,value:c}=await r.read();if(a)break;if(i+=c.length,i>Lq)throw new Error(`CRDT model is larger than ${Lq} bytes`);n.push(c)}let o=new Uint8Array(i),s=0;for(let a of n)o.set(a,s),s+=a.length;return o},Kh=async(e,t)=>{try{return await t()}catch(r){return V.warn(`Optional runtime package unavailable: ${e}`,r.message),null}},jq=null,oi=async()=>(jq??=Kh("@functorz/ztype",()=>import("./ztype-R7L6UA5Z.js")).then(e=>(e?.default??e)?.com?.functorz?.ztype??null),jq),$q=null,Uq=async()=>($q??=oi().then(e=>e?.typesystem?.schema?.SCHEMA_VERSION??null),$q),Mq=null,Hh=async()=>(Mq??=Kh("@functorz/crdt-helper",()=>import("./index.cjs-YNIXM3ZV.js")).then(e=>e?.Crdt??e?.default?.Crdt??null),Mq),qq=null,zq=async()=>(qq??=Kh("json-joy/lib/json-crdt-patch/index.js",()=>import("./json-crdt-patch-Q4LXVXVQ.js")).then(e=>e??Kh("json-joy/lib/json-crdt/index.js",()=>import("./json-crdt-R2WVCAG5.js"))).then(e=>e?.Patch??e?.default?.Patch??null),qq),ES=e=>e?.lastUploadedSchema??null,TS=e=>[e?.project?.lastDeployedServerSchemaExId,e?.lastDeployedServerSchemaExId,e?.project?.latestDeployedServerSchema?.exId,e?.latestDeployedServerSchema?.exId].find(r=>typeof r=="string"&&r.length>0)??null,bS=e=>e==null?e:structuredClone(e),Gq=(e,t)=>e?.appExId?e.appExId:t?.name??"",Vq=(e,t)=>{let r=e?.typesystem?.schema?.ClientType;if(r)return t==="WECHAT_MINI_PROGRAM"?r.WECHAT_MINI_PROGRAM??r.WECHAT??r.WEB:t==="MOBILE"?r.MOBILE??r.WEB:r.WEB},Bq=e=>{let t=e?.typesystem?.schema?.Product?.[Uo];if(!t)throw new Error(`ztype runtime has no Product enum member for ${Uo}`);return t},Tse=e=>{try{return JSON.parse(JSON.stringify(e))}catch{return String(e)}},Qh=e=>({componentId:e?.componentId??null,message:typeof e?.getLocalizedErrorMessage=="function"?e.getLocalizedErrorMessage("EN"):e?.message??String(e),zhMessage:typeof e?.getLocalizedErrorMessage=="function"?e.getLocalizedErrorMessage("ZH"):void 0,platform:e?.platform??null,isBackendError:!!e?.isBackendError,fullPath:Tse(e?.fullPath??[])}),Wh=e=>e.stableErrors.concat(e.betaErrors).filter(t=>!!t.isBackendError),Zq=e=>Wh(e).length,Kq=(e,t)=>{if(t.__typename==="DiffItem"){let r=t.pathComponents?.at(-1)?.key??"";if(t.operation==="delete"){delete e[r];return}e[r]=structuredClone(t.newValue);return}if(t.__typename==="ArrayDiffItem"){let r=t.pathComponents?.at(-1)?.index??-1;if(!Array.isArray(e)||r<0)throw new Error("Invalid array diff target");if(t.operation==="delete"){e.splice(r,1);return}if(t.operation==="insert"){e.splice(r,0,structuredClone(t.newValue));return}e[r]=structuredClone(t.newValue)}};var Qq=bse(),Sse=e=>{if(!e)return e;if(Array.isArray(e))return e.map(([r,n])=>[r,String(r).toLowerCase()==="authorization"?"Bearer <redacted>":n]);if(typeof e=="object"&&"forEach"in e&&typeof e.forEach=="function"){let r={};return e.forEach((n,i)=>{r[i]=i.toLowerCase()==="authorization"?"Bearer <redacted>":String(n)}),r}let t={};for(let[r,n]of Object.entries(e))t[r]=r.toLowerCase()==="authorization"?"Bearer <redacted>":String(n);return t};function SS(e){if(!Array.isArray(e)||e.length===0)return null;let t=e.map(r=>{let n=r,i=typeof n.operation=="string"?n.operation:null,o=typeof n.errorType=="string"?n.errorType:typeof n.extensions?.classification=="string"?n.extensions.classification:null,s=typeof n.message=="string"?n.message:null;return!s&&!i&&!o?null:`${i?`${i}: `:""}${s??"GraphQL error"}${o?` (${o})`:""}`}).filter(r=>!!r);return t.length>0?t.join("; "):null}var Ose=e=>{if(typeof e=="string")return e;if(e instanceof Uint8Array)return Buffer.from(e).toString("utf8");try{return String(e)}catch{return"<unserializable body>"}},Ll=async(e,t)=>{let r=Ld();V.debug(`[HTTP] Request URL: ${e.toString()}`),t?.headers&&V.debug(`[HTTP] Request Headers: ${JSON.stringify(Sse(t.headers))}`),r&&t?.body!=null&&V.debug(`[GQL] Request Body: ${Ose(t.body)}`);let n=await fetch(e,t),i=null;try{i=await n.clone().text()}catch(o){V.debug(`[GQL] Response read failed: ${String(o)}`)}if(r&&V.debug(`[GQL] Response ${n.status}: ${i??"<read failed>"}`),i&&i.includes('"errors"')){let o=null;try{o=JSON.parse(i).errors}catch{o=null}let s=SS(o);s&&V.warn(`[GQL] ${n.status} errors: ${s}`)}return n};async function OS(e,t){let r=await e.getValidToken(),n=await An(t),i={Authorization:`Bearer ${r}`,"User-Locale":"en_US","X-SESSION-ID":Qq},o=await Uq();return o&&(i["X-ZED-VERSION"]=o),process.env.REACT_APP_VERSION&&(i["X-REACT-APP-VERSION"]=process.env.REACT_APP_VERSION),new tr(`${n.apiBaseUrl}/api/graphql`,{headers:i,fetch:Ll})}async function Wq(e,t){let r=await e.getValidToken(),i=`${(await An(t)).apiBaseUrl.replace(/^http:/,"ws:").replace(/^https:/,"wss:")}/api/graphql-subscription`;return async(o,s,a)=>{let c=Ld(),u={authToken:r,"X-SESSION-ID":Qq};V.debug(`[SUB] connecting ${i} params=${JSON.stringify({...u,authToken:"Bearer <redacted>"})}`);let l=new Hq.SubscriptionClient(i,{lazy:!0,reconnect:!0,minTimeout:3e3,connectionParams:u},Cq);l.onConnected(()=>V.debug("[SUB] connected")),l.onReconnected(()=>V.debug("[SUB] reconnected")),l.onDisconnected(()=>V.debug("[SUB] disconnected")),l.onError(h=>V.debug(`[SUB] error ${h?.message??String(h)}`));let f=[{name:"onNewCrdtPatchV2",query:t$,variables:{projectExId:o.projectExId,appExId:o.appExId??null,versionExId:o.appVersionExId??null,latestPatchExIdInClient:s}},{name:"onSchemaUploadV3",query:r$,variables:{projectExId:o.projectExId,appExId:o.appExId??null,appVersionExId:o.appVersionExId??null}}].map(h=>(V.debug(`[SUB] subscribe ${h.name} vars=${JSON.stringify(h.variables)}`),l.request({query:h.query,variables:h.variables}).subscribe({next:m=>{c&&V.debug(`[SUB] ${h.name} event: ${JSON.stringify(m)}`),a()},error:m=>{V.warn("Schema subscription event failed",String(m)),a()}})));return{unsubscribe(){for(let h of f)h.unsubscribe();l.close(!1,!1)}}}}async function Jh(e,t){if(t.projectExId)return await e.saveProjectContext(t.projectExId),t.projectExId;let r=await e.loadProjectContext();if(!r?.projectExId)throw new Error("No projectExId provided and no current project is set");return r.projectExId}p();p();p();import{createHash as Ise}from"crypto";var wse=e=>!!(e&&typeof e=="object"&&!Array.isArray(e)),IS=e=>{if(Array.isArray(e))return e.map(r=>r===void 0?null:IS(r));if(!wse(e))return e;let t={};for(let r of Object.keys(e).sort()){let n=e[r];n!==void 0&&(t[r]=IS(n))}return t},xse=e=>JSON.stringify(IS(e)),Ase=e=>Ise("sha256").update(xse(e)).digest("hex"),Jq=e=>({projectExId:e.projectExId,appExId:e.appExId??null,appVersionExId:e.appVersionExId??null,schemaExId:e.schemaExId??null,lastPatchExId:e.lastPatchExId??null,snapshotHash:Ase(e.snapshot),deployedSchemaExId:e.deployedSchemaExId??null,checkedAt:e.checkedAt??new Date().toISOString()}),Yq=(e,t)=>!e||!t?e!==t:e.schemaExId!==t.schemaExId||e.lastPatchExId!==t.lastPatchExId||e.snapshotHash!==t.snapshotHash||e.deployedSchemaExId!==t.deployedSchemaExId,Yh=e=>e.changes.length>0;var Xq=null,Nse=()=>(Xq??=oi().then(e=>{let t=e?.typesystem?.schema?.diff?.computeSemanticSchemaChanges;return typeof t=="function"?t:null}),Xq),wS=async(e,t)=>{let r=await Nse();return r?r(e,t):{changes:[]}};p();var Es=class extends Error{constructor(r,n){super(r);this.diagnostics=n;this.name="ZtypeValidationError"}};p();function Xh(e,t,r){let n=Vq(e,r?.appType);return e.api.ZTypeCoreApi.genZTypeApiContext(t,Bq(e),n,Gq(r,n),e?.utils?.Locale?.EN,null)}p();var Rn=e=>e==null,Pse=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),e1=e=>{if(Pse(e)){if(!Rn(e.id))return{key:"id",value:e.id};if(!Rn(e.uniqueId))return{key:"uniqueId",value:e.uniqueId};if(!Rn(e.mRef))return{key:"mRef",value:e.mRef}}},xS=(e,t)=>{if(Rn(e)&&Rn(t)||e===t)return!0;if(Rn(e)||Rn(t)||typeof e!="object"||typeof t!="object")return!1;let r=e,n=t,i=new Set([...Object.keys(r),...Object.keys(n)]);for(let o of i)if(!xS(r[o],n[o]))return!1;return!0},t1=e=>{if(e.__typename==="DiffItem")switch(e.operation){case"add":return{__typename:"DiffItem",oldValue:e.newValue,newValue:null,operation:"delete",pathComponents:e.pathComponents};case"delete":return{__typename:"DiffItem",oldValue:null,newValue:e.oldValue,operation:"add",pathComponents:e.pathComponents};case"update":return{__typename:"DiffItem",oldValue:e.newValue,newValue:e.oldValue,operation:"update",pathComponents:e.pathComponents}}else switch(e.operation){case"insert":return{__typename:"ArrayDiffItem",oldValue:e.newValue,newValue:null,previousValue:e.previousValue,nextValue:e.nextValue,operation:"delete",pathComponents:e.pathComponents};case"delete":return{__typename:"ArrayDiffItem",oldValue:null,newValue:e.oldValue,previousValue:e.previousValue,nextValue:e.nextValue,operation:"insert",pathComponents:e.pathComponents};case"update":return{__typename:"ArrayDiffItem",oldValue:e.newValue,newValue:e.oldValue,operation:"update",pathComponents:e.pathComponents}}throw new Error(`Cannot reverse diff item: ${JSON.stringify(e)}`)},Rse=e=>e.key??e.index??"",Dse=(e,t)=>{let r=e;for(let n of t){if(r===null||typeof r!="object")return;r=r[n]}return r},kse=(e,t)=>{if(t.__typename!=="DiffItem")return null;let r=t.pathComponents.at(-1)?.key;if(r===void 0)return null;let n=e1(e[r]),i=n===void 0?xS(e[r],t.oldValue):n.value===t.oldValue?.[n.key];switch(t.operation){case"add":e[r]=t.newValue;break;case"update":if(!i)return null;e[r]=t.newValue;break;case"delete":if(!Object.prototype.hasOwnProperty.call(e,r)||!i)return null;delete e[r];break;default:return null}return t},Cse=(e,t)=>{if(t.__typename!=="ArrayDiffItem")return null;let r=t.pathComponents.at(-1)?.index;if(r===void 0||r>e.length)return null;let n=()=>{let i=e1(e[r]);return i===void 0?xS(e[r],t.oldValue):i.value===t.oldValue?.[i.key]};switch(t.operation){case"insert":e.splice(r,0,t.newValue);break;case"delete":if(!n())return null;e.splice(r,1);break;case"update":if(!n())return null;e.splice(r,1,t.newValue);break;default:return null}return t},r1=(e,t)=>{let r=e,n=new WeakSet,i=s=>{if(r===null||typeof r!="object")return r;n.has(r)||(r=Array.isArray(r)?[...r]:{...r},n.add(r));let a=r;for(let c of s){let u=a[c];if(u!==null&&typeof u=="object"){if(!n.has(u)){let l=Array.isArray(u)?[...u]:{...u};n.add(l),a[c]=l}a=a[c]}else a=u}return a},o=[];for(let s of t)try{let c=s.pathComponents.map(Rse).slice(0,-1);if(Rn(Dse(r,c)))continue;let u=i(c);if(Array.isArray(u)){let l=Cse(u,s);l&&o.push(l)}else if(u!==null&&typeof u=="object"){let l=kse(u,s);l&&o.push(l)}}catch{continue}return o};p();var Lse=3e4,em=class{constructor(t){this.options=t}timer=null;subscriptionHandle=null;running=!1;isActive(){return this.timer!==null||this.subscriptionHandle!==null}start(){this.timer||this.subscriptionHandle||!this.options.subscriptionFactory||this.options.subscriptionFactory(this.options.sessionKey,this.options.getLastPatchExId(),()=>{this.run()}).then(t=>{this.subscriptionHandle=t}).catch(t=>{V.warn("Schema subscription failed; falling back to polling",t.message)}).finally(()=>{this.schedulePoll()})}dispose(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.subscriptionHandle?.unsubscribe(),this.subscriptionHandle=null}schedulePoll(){!this.options.subscriptionFactory||this.timer||(this.timer=setTimeout(()=>{this.timer=null,this.run().finally(()=>this.schedulePoll())},Lse),this.timer.unref())}async run(){if(!this.running){this.running=!0;try{await this.options.refresh()}finally{this.running=!1}}}};p();p();var E={};vy(E,{BRAND:()=>aae,DIRTY:()=>Ts,EMPTY_PATH:()=>qse,INVALID:()=>ie,NEVER:()=>Vae,OK:()=>ar,ParseStatus:()=>Ht,Schema:()=>ge,ZodAny:()=>Eo,ZodArray:()=>$i,ZodBigInt:()=>Ss,ZodBoolean:()=>Os,ZodBranded:()=>$l,ZodCatch:()=>Ls,ZodDate:()=>Is,ZodDefault:()=>Cs,ZodDiscriminatedUnion:()=>nm,ZodEffects:()=>pn,ZodEnum:()=>Ds,ZodError:()=>Nr,ZodFirstPartyTypeKind:()=>D,ZodFunction:()=>om,ZodIntersection:()=>Ns,ZodIssueCode:()=>R,ZodLazy:()=>Ps,ZodLiteral:()=>Rs,ZodMap:()=>vc,ZodNaN:()=>Tc,ZodNativeEnum:()=>ks,ZodNever:()=>Dn,ZodNull:()=>xs,ZodNullable:()=>ci,ZodNumber:()=>bs,ZodObject:()=>Rr,ZodOptional:()=>Pr,ZodParsedType:()=>M,ZodPipeline:()=>Ml,ZodPromise:()=>To,ZodReadonly:()=>js,ZodRecord:()=>im,ZodSchema:()=>ge,ZodSet:()=>Ec,ZodString:()=>vo,ZodSymbol:()=>yc,ZodTransformer:()=>pn,ZodTuple:()=>ai,ZodType:()=>ge,ZodUndefined:()=>ws,ZodUnion:()=>As,ZodUnknown:()=>ji,ZodVoid:()=>_c,addIssueToContext:()=>$,any:()=>gae,array:()=>Eae,bigint:()=>pae,boolean:()=>f1,coerce:()=>Gae,custom:()=>l1,date:()=>dae,datetimeRegex:()=>c1,defaultErrorMap:()=>Ci,discriminatedUnion:()=>Sae,effect:()=>Lae,enum:()=>Dae,function:()=>Nae,getErrorMap:()=>hc,getParsedType:()=>si,instanceof:()=>uae,intersection:()=>Oae,isAborted:()=>tm,isAsync:()=>mc,isDirty:()=>rm,isValid:()=>_o,late:()=>cae,lazy:()=>Pae,literal:()=>Rae,makeIssue:()=>jl,map:()=>xae,nan:()=>lae,nativeEnum:()=>kae,never:()=>_ae,null:()=>mae,nullable:()=>$ae,number:()=>d1,object:()=>RS,objectUtil:()=>AS,oboolean:()=>zae,onumber:()=>Uae,optional:()=>jae,ostring:()=>Fae,pipeline:()=>qae,preprocess:()=>Mae,promise:()=>Cae,quotelessJson:()=>jse,record:()=>wae,set:()=>Aae,setErrorMap:()=>Mse,strictObject:()=>Tae,string:()=>p1,symbol:()=>fae,transformer:()=>Lae,tuple:()=>Iae,undefined:()=>hae,union:()=>bae,unknown:()=>yae,util:()=>Te,void:()=>vae});p();p();p();p();p();var Te;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function r(i){throw new Error}e.assertNever=r,e.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},e.getValidEnumValues=i=>{let o=e.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(let a of o)s[a]=i[a];return e.objectValues(s)},e.objectValues=i=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},e.find=(i,o)=>{for(let s of i)if(o(s))return s},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}e.joinValues=n,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(Te||(Te={}));var AS;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(AS||(AS={}));var M=Te.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),si=e=>{switch(typeof e){case"undefined":return M.undefined;case"string":return M.string;case"number":return Number.isNaN(e)?M.nan:M.number;case"boolean":return M.boolean;case"function":return M.function;case"bigint":return M.bigint;case"symbol":return M.symbol;case"object":return Array.isArray(e)?M.array:e===null?M.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?M.promise:typeof Map<"u"&&e instanceof Map?M.map:typeof Set<"u"&&e instanceof Set?M.set:typeof Date<"u"&&e instanceof Date?M.date:M.object;default:return M.unknown}};var R=Te.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"]),jse=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),Nr=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(o){return o.message},n={_errors:[]},i=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,c=0;for(;c<s.path.length;){let u=s.path[c];c===s.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(s))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return i(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Te.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];r[o]=r[o]||[],r[o].push(t(i))}else n.push(t(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Nr.create=e=>new Nr(e);var $se=(e,t)=>{let r;switch(e.code){case R.invalid_type:e.received===M.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case R.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Te.jsonStringifyReplacer)}`;break;case R.unrecognized_keys:r=`Unrecognized key(s) in object: ${Te.joinValues(e.keys,", ")}`;break;case R.invalid_union:r="Invalid input";break;case R.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Te.joinValues(e.options)}`;break;case R.invalid_enum_value:r=`Invalid enum value. Expected ${Te.joinValues(e.options)}, received '${e.received}'`;break;case R.invalid_arguments:r="Invalid function arguments";break;case R.invalid_return_type:r="Invalid function return type";break;case R.invalid_date:r="Invalid date";break;case R.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Te.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case R.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case R.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case R.custom:r="Invalid input";break;case R.invalid_intersection_types:r="Intersection results could not be merged";break;case R.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case R.not_finite:r="Number must be finite";break;default:r=t.defaultError,Te.assertNever(e)}return{message:r}},Ci=$se;var n1=Ci;function Mse(e){n1=e}function hc(){return n1}p();var jl=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,o=[...r,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(s,{data:t,defaultError:a}).message;return{...i,path:o,message:a}},qse=[];function $(e,t){let r=hc(),n=jl({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Ci?void 0:Ci].filter(i=>!!i)});e.common.issues.push(n)}var Ht=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let i of r){if(i.status==="aborted")return ie;i.status==="dirty"&&t.dirty(),n.push(i.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let i of r){let o=await i.key,s=await i.value;n.push({key:o,value:s})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let i of r){let{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return ie;o.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(n[o.value]=s.value)}return{status:t.value,value:n}}},ie=Object.freeze({status:"aborted"}),Ts=e=>({status:"dirty",value:e}),ar=e=>({status:"valid",value:e}),tm=e=>e.status==="aborted",rm=e=>e.status==="dirty",_o=e=>e.status==="valid",mc=e=>typeof Promise<"u"&&e instanceof Promise;p();p();var H;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(H||(H={}));var ln=class{constructor(t,r,n,i){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},i1=(e,t)=>{if(_o(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Nr(e.common.issues);return this._error=r,this._error}}};function fe(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(s,a)=>{let{message:c}=e;return s.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:i}}var ge=class{get description(){return this._def.description}_getType(t){return si(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:si(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Ht,ctx:{common:t.parent.common,data:t.data,parsedType:si(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(mc(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:si(t)},i=this._parseSync({data:t,path:n.path,parent:n});return i1(n,i)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:si(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return _o(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>_o(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:si(t)},i=this._parse({data:t,path:n.path,parent:n}),o=await(mc(i)?i:Promise.resolve(i));return i1(n,o)}refine(t,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,o)=>{let s=t(i),a=()=>o.addIssue({code:R.custom,...n(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,r){return this._refinement((n,i)=>t(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(t){return new pn({schema:this,typeName:D.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Pr.create(this,this._def)}nullable(){return ci.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return $i.create(this)}promise(){return To.create(this,this._def)}or(t){return As.create([this,t],this._def)}and(t){return Ns.create(this,t,this._def)}transform(t){return new pn({...fe(this._def),schema:this,typeName:D.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Cs({...fe(this._def),innerType:this,defaultValue:r,typeName:D.ZodDefault})}brand(){return new $l({typeName:D.ZodBranded,type:this,...fe(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Ls({...fe(this._def),innerType:this,catchValue:r,typeName:D.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Ml.create(this,t)}readonly(){return js.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Fse=/^c[^\s-]{8,}$/i,Use=/^[0-9a-z]+$/,zse=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Gse=/^[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,Vse=/^[a-z0-9_-]{21}$/i,Bse=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Zse=/^[-+]?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)?)??$/,Kse=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Hse="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",NS,Qse=/^(?:(?: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])$/,Wse=/^(?:(?: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])$/,Jse=/^(([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]))$/,Yse=/^(([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])$/,Xse=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,eae=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,s1="((\\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])))",tae=new RegExp(`^${s1}$`);function a1(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function rae(e){return new RegExp(`^${a1(e)}$`)}function c1(e){let t=`${s1}T${a1(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function nae(e,t){return!!((t==="v4"||!t)&&Qse.test(e)||(t==="v6"||!t)&&Jse.test(e))}function iae(e,t){if(!Bse.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function oae(e,t){return!!((t==="v4"||!t)&&Wse.test(e)||(t==="v6"||!t)&&Yse.test(e))}var vo=class e extends ge{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==M.string){let o=this._getOrReturnCtx(t);return $(o,{code:R.invalid_type,expected:M.string,received:o.parsedType}),ie}let n=new Ht,i;for(let o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(i=this._getOrReturnCtx(t,i),$(i,{code:R.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")t.data.length>o.value&&(i=this._getOrReturnCtx(t,i),$(i,{code:R.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let s=t.data.length>o.value,a=t.data.length<o.value;(s||a)&&(i=this._getOrReturnCtx(t,i),s?$(i,{code:R.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&$(i,{code:R.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")Kse.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"email",code:R.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")NS||(NS=new RegExp(Hse,"u")),NS.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"emoji",code:R.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")Gse.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"uuid",code:R.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")Vse.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"nanoid",code:R.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")Fse.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"cuid",code:R.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")Use.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"cuid2",code:R.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")zse.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"ulid",code:R.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),$(i,{validation:"url",code:R.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"regex",code:R.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(t,i),$(i,{code:R.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(i=this._getOrReturnCtx(t,i),$(i,{code:R.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(i=this._getOrReturnCtx(t,i),$(i,{code:R.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?c1(o).test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{code:R.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?tae.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{code:R.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?rae(o).test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{code:R.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?Zse.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"duration",code:R.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?nae(t.data,o.version)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"ip",code:R.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?iae(t.data,o.alg)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"jwt",code:R.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?oae(t.data,o.version)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"cidr",code:R.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?Xse.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"base64",code:R.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?eae.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"base64url",code:R.invalid_string,message:o.message}),n.dirty()):Te.assertNever(o);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(i=>t.test(i),{validation:r,code:R.invalid_string,...H.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...H.errToObj(t)})}url(t){return this._addCheck({kind:"url",...H.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...H.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...H.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...H.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...H.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...H.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...H.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...H.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...H.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...H.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...H.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...H.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...H.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...H.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...H.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...H.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...H.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...H.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...H.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...H.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...H.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...H.errToObj(r)})}nonempty(t){return this.min(1,H.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};vo.create=e=>new vo({checks:[],typeName:D.ZodString,coerce:e?.coerce??!1,...fe(e)});function sae(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n,o=Number.parseInt(e.toFixed(i).replace(".","")),s=Number.parseInt(t.toFixed(i).replace(".",""));return o%s/10**i}var bs=class e extends ge{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==M.number){let o=this._getOrReturnCtx(t);return $(o,{code:R.invalid_type,expected:M.number,received:o.parsedType}),ie}let n,i=new Ht;for(let o of this._def.checks)o.kind==="int"?Te.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),$(n,{code:R.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),$(n,{code:R.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),$(n,{code:R.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?sae(t.data,o.value)!==0&&(n=this._getOrReturnCtx(t,n),$(n,{code:R.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),$(n,{code:R.not_finite,message:o.message}),i.dirty()):Te.assertNever(o);return{status:i.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,H.toString(r))}gt(t,r){return this.setLimit("min",t,!1,H.toString(r))}lte(t,r){return this.setLimit("max",t,!0,H.toString(r))}lt(t,r){return this.setLimit("max",t,!1,H.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:H.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:H.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:H.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:H.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:H.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:H.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:H.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:H.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:H.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:H.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Te.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};bs.create=e=>new bs({checks:[],typeName:D.ZodNumber,coerce:e?.coerce||!1,...fe(e)});var Ss=class e extends ge{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==M.bigint)return this._getInvalidInput(t);let n,i=new Ht;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),$(n,{code:R.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),$(n,{code:R.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),$(n,{code:R.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Te.assertNever(o);return{status:i.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return $(r,{code:R.invalid_type,expected:M.bigint,received:r.parsedType}),ie}gte(t,r){return this.setLimit("min",t,!0,H.toString(r))}gt(t,r){return this.setLimit("min",t,!1,H.toString(r))}lte(t,r){return this.setLimit("max",t,!0,H.toString(r))}lt(t,r){return this.setLimit("max",t,!1,H.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:H.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:H.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:H.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:H.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:H.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:H.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Ss.create=e=>new Ss({checks:[],typeName:D.ZodBigInt,coerce:e?.coerce??!1,...fe(e)});var Os=class extends ge{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==M.boolean){let n=this._getOrReturnCtx(t);return $(n,{code:R.invalid_type,expected:M.boolean,received:n.parsedType}),ie}return ar(t.data)}};Os.create=e=>new Os({typeName:D.ZodBoolean,coerce:e?.coerce||!1,...fe(e)});var Is=class e extends ge{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==M.date){let o=this._getOrReturnCtx(t);return $(o,{code:R.invalid_type,expected:M.date,received:o.parsedType}),ie}if(Number.isNaN(t.data.getTime())){let o=this._getOrReturnCtx(t);return $(o,{code:R.invalid_date}),ie}let n=new Ht,i;for(let o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(i=this._getOrReturnCtx(t,i),$(i,{code:R.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(i=this._getOrReturnCtx(t,i),$(i,{code:R.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):Te.assertNever(o);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:H.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:H.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};Is.create=e=>new Is({checks:[],coerce:e?.coerce||!1,typeName:D.ZodDate,...fe(e)});var yc=class extends ge{_parse(t){if(this._getType(t)!==M.symbol){let n=this._getOrReturnCtx(t);return $(n,{code:R.invalid_type,expected:M.symbol,received:n.parsedType}),ie}return ar(t.data)}};yc.create=e=>new yc({typeName:D.ZodSymbol,...fe(e)});var ws=class extends ge{_parse(t){if(this._getType(t)!==M.undefined){let n=this._getOrReturnCtx(t);return $(n,{code:R.invalid_type,expected:M.undefined,received:n.parsedType}),ie}return ar(t.data)}};ws.create=e=>new ws({typeName:D.ZodUndefined,...fe(e)});var xs=class extends ge{_parse(t){if(this._getType(t)!==M.null){let n=this._getOrReturnCtx(t);return $(n,{code:R.invalid_type,expected:M.null,received:n.parsedType}),ie}return ar(t.data)}};xs.create=e=>new xs({typeName:D.ZodNull,...fe(e)});var Eo=class extends ge{constructor(){super(...arguments),this._any=!0}_parse(t){return ar(t.data)}};Eo.create=e=>new Eo({typeName:D.ZodAny,...fe(e)});var ji=class extends ge{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ar(t.data)}};ji.create=e=>new ji({typeName:D.ZodUnknown,...fe(e)});var Dn=class extends ge{_parse(t){let r=this._getOrReturnCtx(t);return $(r,{code:R.invalid_type,expected:M.never,received:r.parsedType}),ie}};Dn.create=e=>new Dn({typeName:D.ZodNever,...fe(e)});var _c=class extends ge{_parse(t){if(this._getType(t)!==M.undefined){let n=this._getOrReturnCtx(t);return $(n,{code:R.invalid_type,expected:M.void,received:n.parsedType}),ie}return ar(t.data)}};_c.create=e=>new _c({typeName:D.ZodVoid,...fe(e)});var $i=class e extends ge{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),i=this._def;if(r.parsedType!==M.array)return $(r,{code:R.invalid_type,expected:M.array,received:r.parsedType}),ie;if(i.exactLength!==null){let s=r.data.length>i.exactLength.value,a=r.data.length<i.exactLength.value;(s||a)&&($(r,{code:s?R.too_big:R.too_small,minimum:a?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&($(r,{code:R.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&($(r,{code:R.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>i.type._parseAsync(new ln(r,s,r.path,a)))).then(s=>Ht.mergeArray(n,s));let o=[...r.data].map((s,a)=>i.type._parseSync(new ln(r,s,r.path,a)));return Ht.mergeArray(n,o)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:H.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:H.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:H.toString(r)}})}nonempty(t){return this.min(1,t)}};$i.create=(e,t)=>new $i({type:e,minLength:null,maxLength:null,exactLength:null,typeName:D.ZodArray,...fe(t)});function gc(e){if(e instanceof Rr){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Pr.create(gc(n))}return new Rr({...e._def,shape:()=>t})}else return e instanceof $i?new $i({...e._def,type:gc(e.element)}):e instanceof Pr?Pr.create(gc(e.unwrap())):e instanceof ci?ci.create(gc(e.unwrap())):e instanceof ai?ai.create(e.items.map(t=>gc(t))):e}var Rr=class e extends ge{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=Te.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==M.object){let u=this._getOrReturnCtx(t);return $(u,{code:R.invalid_type,expected:M.object,received:u.parsedType}),ie}let{status:n,ctx:i}=this._processInputParams(t),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof Dn&&this._def.unknownKeys==="strip"))for(let u in i.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let l=o[u],d=i.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new ln(i,d,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof Dn){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:i.data[l]}});else if(u==="strict")a.length>0&&($(i,{code:R.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of a){let d=i.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new ln(i,d,i.path,l)),alwaysSet:l in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,f=await l.value;u.push({key:d,value:f,alwaysSet:l.alwaysSet})}return u}).then(u=>Ht.mergeObjectSync(n,u)):Ht.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return H.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:H.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:D.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of Te.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of Te.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return gc(this)}partial(t){let r={};for(let n of Te.objectKeys(this.shape)){let i=this.shape[n];t&&!t[n]?r[n]=i:r[n]=i.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of Te.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof Pr;)o=o._def.innerType;r[n]=o}return new e({...this._def,shape:()=>r})}keyof(){return u1(Te.objectKeys(this.shape))}};Rr.create=(e,t)=>new Rr({shape:()=>e,unknownKeys:"strip",catchall:Dn.create(),typeName:D.ZodObject,...fe(t)});Rr.strictCreate=(e,t)=>new Rr({shape:()=>e,unknownKeys:"strict",catchall:Dn.create(),typeName:D.ZodObject,...fe(t)});Rr.lazycreate=(e,t)=>new Rr({shape:e,unknownKeys:"strip",catchall:Dn.create(),typeName:D.ZodObject,...fe(t)});var As=class extends ge{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function i(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new Nr(a.ctx.common.issues));return $(r,{code:R.invalid_union,unionErrors:s}),ie}if(r.common.async)return Promise.all(n.map(async o=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(i);{let o,s=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!o&&(o={result:l,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(c=>new Nr(c));return $(r,{code:R.invalid_union,unionErrors:a}),ie}}get options(){return this._def.options}};As.create=(e,t)=>new As({options:e,typeName:D.ZodUnion,...fe(t)});var Li=e=>e instanceof Ps?Li(e.schema):e instanceof pn?Li(e.innerType()):e instanceof Rs?[e.value]:e instanceof Ds?e.options:e instanceof ks?Te.objectValues(e.enum):e instanceof Cs?Li(e._def.innerType):e instanceof ws?[void 0]:e instanceof xs?[null]:e instanceof Pr?[void 0,...Li(e.unwrap())]:e instanceof ci?[null,...Li(e.unwrap())]:e instanceof $l||e instanceof js?Li(e.unwrap()):e instanceof Ls?Li(e._def.innerType):[],nm=class e extends ge{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==M.object)return $(r,{code:R.invalid_type,expected:M.object,received:r.parsedType}),ie;let n=this.discriminator,i=r.data[n],o=this.optionsMap.get(i);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):($(r,{code:R.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ie)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let i=new Map;for(let o of r){let s=Li(o.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of s){if(i.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);i.set(a,o)}}return new e({typeName:D.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,...fe(n)})}};function PS(e,t){let r=si(e),n=si(t);if(e===t)return{valid:!0,data:e};if(r===M.object&&n===M.object){let i=Te.objectKeys(t),o=Te.objectKeys(e).filter(a=>i.indexOf(a)!==-1),s={...e,...t};for(let a of o){let c=PS(e[a],t[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===M.array&&n===M.array){if(e.length!==t.length)return{valid:!1};let i=[];for(let o=0;o<e.length;o++){let s=e[o],a=t[o],c=PS(s,a);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===M.date&&n===M.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Ns=class extends ge{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=(o,s)=>{if(tm(o)||tm(s))return ie;let a=PS(o.value,s.value);return a.valid?((rm(o)||rm(s))&&r.dirty(),{status:r.value,value:a.data}):($(n,{code:R.invalid_intersection_types}),ie)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Ns.create=(e,t,r)=>new Ns({left:e,right:t,typeName:D.ZodIntersection,...fe(r)});var ai=class e extends ge{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==M.array)return $(n,{code:R.invalid_type,expected:M.array,received:n.parsedType}),ie;if(n.data.length<this._def.items.length)return $(n,{code:R.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ie;!this._def.rest&&n.data.length>this._def.items.length&&($(n,{code:R.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new ln(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>Ht.mergeArray(r,s)):Ht.mergeArray(r,o)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};ai.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ai({items:e,typeName:D.ZodTuple,rest:null,...fe(t)})};var im=class e extends ge{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==M.object)return $(n,{code:R.invalid_type,expected:M.object,received:n.parsedType}),ie;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in n.data)i.push({key:o._parse(new ln(n,a,n.path,a)),value:s._parse(new ln(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Ht.mergeObjectAsync(r,i):Ht.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof ge?new e({keyType:t,valueType:r,typeName:D.ZodRecord,...fe(n)}):new e({keyType:vo.create(),valueType:t,typeName:D.ZodRecord,...fe(r)})}},vc=class extends ge{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==M.map)return $(n,{code:R.invalid_type,expected:M.map,received:n.parsedType}),ie;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([a,c],u)=>({key:i._parse(new ln(n,a,n.path,[u,"key"])),value:o._parse(new ln(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of s){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return ie;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of s){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return ie;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}};vc.create=(e,t,r)=>new vc({valueType:t,keyType:e,typeName:D.ZodMap,...fe(r)});var Ec=class e extends ge{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==M.set)return $(n,{code:R.invalid_type,expected:M.set,received:n.parsedType}),ie;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&($(n,{code:R.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&($(n,{code:R.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let o=this._def.valueType;function s(c){let u=new Set;for(let l of c){if(l.status==="aborted")return ie;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>o._parse(new ln(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(t,r){return new e({...this._def,minSize:{value:t,message:H.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:H.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Ec.create=(e,t)=>new Ec({valueType:e,minSize:null,maxSize:null,typeName:D.ZodSet,...fe(t)});var om=class e extends ge{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==M.function)return $(r,{code:R.invalid_type,expected:M.function,received:r.parsedType}),ie;function n(a,c){return jl({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,hc(),Ci].filter(u=>!!u),issueData:{code:R.invalid_arguments,argumentsError:c}})}function i(a,c){return jl({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,hc(),Ci].filter(u=>!!u),issueData:{code:R.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof To){let a=this;return ar(async function(...c){let u=new Nr([]),l=await a._def.args.parseAsync(c,o).catch(h=>{throw u.addIssue(n(c,h)),u}),d=await Reflect.apply(s,this,l);return await a._def.returns._def.type.parseAsync(d,o).catch(h=>{throw u.addIssue(i(d,h)),u})})}else{let a=this;return ar(function(...c){let u=a._def.args.safeParse(c,o);if(!u.success)throw new Nr([n(c,u.error)]);let l=Reflect.apply(s,this,u.data),d=a._def.returns.safeParse(l,o);if(!d.success)throw new Nr([i(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:ai.create(t).rest(ji.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||ai.create([]).rest(ji.create()),returns:r||ji.create(),typeName:D.ZodFunction,...fe(n)})}},Ps=class extends ge{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Ps.create=(e,t)=>new Ps({getter:e,typeName:D.ZodLazy,...fe(t)});var Rs=class extends ge{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return $(r,{received:r.data,code:R.invalid_literal,expected:this._def.value}),ie}return{status:"valid",value:t.data}}get value(){return this._def.value}};Rs.create=(e,t)=>new Rs({value:e,typeName:D.ZodLiteral,...fe(t)});function u1(e,t){return new Ds({values:e,typeName:D.ZodEnum,...fe(t)})}var Ds=class e extends ge{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return $(r,{expected:Te.joinValues(n),received:r.parsedType,code:R.invalid_type}),ie}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return $(r,{received:r.data,code:R.invalid_enum_value,options:n}),ie}return ar(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};Ds.create=u1;var ks=class extends ge{_parse(t){let r=Te.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==M.string&&n.parsedType!==M.number){let i=Te.objectValues(r);return $(n,{expected:Te.joinValues(i),received:n.parsedType,code:R.invalid_type}),ie}if(this._cache||(this._cache=new Set(Te.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let i=Te.objectValues(r);return $(n,{received:n.data,code:R.invalid_enum_value,options:i}),ie}return ar(t.data)}get enum(){return this._def.values}};ks.create=(e,t)=>new ks({values:e,typeName:D.ZodNativeEnum,...fe(t)});var To=class extends ge{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==M.promise&&r.common.async===!1)return $(r,{code:R.invalid_type,expected:M.promise,received:r.parsedType}),ie;let n=r.parsedType===M.promise?r.data:Promise.resolve(r.data);return ar(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};To.create=(e,t)=>new To({type:e,typeName:D.ZodPromise,...fe(t)});var pn=class extends ge{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===D.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=this._def.effect||null,o={addIssue:s=>{$(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let s=i.transform(n.data,o);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return ie;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?ie:c.status==="dirty"?Ts(c.value):r.value==="dirty"?Ts(c.value):c});{if(r.value==="aborted")return ie;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?ie:a.status==="dirty"?Ts(a.value):r.value==="dirty"?Ts(a.value):a}}if(i.type==="refinement"){let s=a=>{let c=i.refinement(a,o);if(n.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(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?ie:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?ie:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!_o(s))return ie;let a=i.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>_o(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:r.value,value:a})):ie);Te.assertNever(i)}};pn.create=(e,t,r)=>new pn({schema:e,typeName:D.ZodEffects,effect:t,...fe(r)});pn.createWithPreprocess=(e,t,r)=>new pn({schema:t,effect:{type:"preprocess",transform:e},typeName:D.ZodEffects,...fe(r)});var Pr=class extends ge{_parse(t){return this._getType(t)===M.undefined?ar(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Pr.create=(e,t)=>new Pr({innerType:e,typeName:D.ZodOptional,...fe(t)});var ci=class extends ge{_parse(t){return this._getType(t)===M.null?ar(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};ci.create=(e,t)=>new ci({innerType:e,typeName:D.ZodNullable,...fe(t)});var Cs=class extends ge{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===M.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Cs.create=(e,t)=>new Cs({innerType:e,typeName:D.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...fe(t)});var Ls=class extends ge{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return mc(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Nr(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Nr(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Ls.create=(e,t)=>new Ls({innerType:e,typeName:D.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...fe(t)});var Tc=class extends ge{_parse(t){if(this._getType(t)!==M.nan){let n=this._getOrReturnCtx(t);return $(n,{code:R.invalid_type,expected:M.nan,received:n.parsedType}),ie}return{status:"valid",value:t.data}}};Tc.create=e=>new Tc({typeName:D.ZodNaN,...fe(e)});var aae=Symbol("zod_brand"),$l=class extends ge{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Ml=class e extends ge{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?ie:o.status==="dirty"?(r.dirty(),Ts(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?ie:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:D.ZodPipeline})}},js=class extends ge{_parse(t){let r=this._def.innerType._parse(t),n=i=>(_o(i)&&(i.value=Object.freeze(i.value)),i);return mc(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};js.create=(e,t)=>new js({innerType:e,typeName:D.ZodReadonly,...fe(t)});function o1(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function l1(e,t={},r){return e?Eo.create().superRefine((n,i)=>{let o=e(n);if(o instanceof Promise)return o.then(s=>{if(!s){let a=o1(t,n),c=a.fatal??r??!0;i.addIssue({code:"custom",...a,fatal:c})}});if(!o){let s=o1(t,n),a=s.fatal??r??!0;i.addIssue({code:"custom",...s,fatal:a})}}):Eo.create()}var cae={object:Rr.lazycreate},D;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(D||(D={}));var uae=(e,t={message:`Input not instance of ${e.name}`})=>l1(r=>r instanceof e,t),p1=vo.create,d1=bs.create,lae=Tc.create,pae=Ss.create,f1=Os.create,dae=Is.create,fae=yc.create,hae=ws.create,mae=xs.create,gae=Eo.create,yae=ji.create,_ae=Dn.create,vae=_c.create,Eae=$i.create,RS=Rr.create,Tae=Rr.strictCreate,bae=As.create,Sae=nm.create,Oae=Ns.create,Iae=ai.create,wae=im.create,xae=vc.create,Aae=Ec.create,Nae=om.create,Pae=Ps.create,Rae=Rs.create,Dae=Ds.create,kae=ks.create,Cae=To.create,Lae=pn.create,jae=Pr.create,$ae=ci.create,Mae=pn.createWithPreprocess,qae=Ml.create,Fae=()=>p1().optional(),Uae=()=>d1().optional(),zae=()=>f1().optional(),Gae={string:(e=>vo.create({...e,coerce:!0})),number:(e=>bs.create({...e,coerce:!0})),boolean:(e=>Os.create({...e,coerce:!0})),bigint:(e=>Ss.create({...e,coerce:!0})),date:(e=>Is.create({...e,coerce:!0}))};var Vae=ie;var DS=[{name:"schema_actionflow",description:`Action flows \u2014 flow-level (addressed by actionFlowId). Discover types via op=SELECTABLE_TYPES and ids via op=GET_DETAIL. AI nodes require isAsync=true.
1076
1076
  Changes apply immediately; use schema_undo to revert the last change. Ops:
1077
1077
  - op=ADD \u2192 ADD_ACTION_FLOWS (req: items)
1078
1078
  - op=ADD_GLOBAL_VARS \u2192 ADD_ACTION_FLOW_GLOBAL_VARIABLES (req: actionFlowId, items)
@@ -1272,7 +1272,7 @@ ${zl(o)}
1272
1272
  }
1273
1273
  }
1274
1274
  `;return t.ok(Br(FS(await n.dataClient.request(s,{where:e.where??{}})),r))},j1={"support.graphql":Qce,"support.query":Wce,"support.insert":Jce,"support.update":Yce,"support.delete":Xce};p();var eue=["GATEWAY","ACTION_FLOW","ACTION_FLOW_NODE","ACTION_FLOW_CONTEXT_LOG","DEPLOYMENT","TPA","TRIGGER","SQL_GENERATION","GQL","ZAI"],tue=["INFO","WARNING","ERROR"],rue=50,nue=100,$1=5,M1=e=>`${e.toISOString().slice(0,19)}Z`,iue=e=>{if(!e)return new Date;let t=new Date(e);return Number.isNaN(t.getTime())?new Date:t},q1=(e,t)=>{if(!e)return;let r=e.map(n=>n.toUpperCase()).filter(n=>t.includes(n));return r.length>0?r:void 0},oue=async(e,t)=>{let r=await t.getProjectArgs(e),i=(await Gl(t.client,r)).dataVisualizer.token;if(!i)throw new Error(`Log admin token is missing for project ${r.projectExId}`);let o=iue(Pe(e.requestCreatedAt)),s={start:M1(new Date(o.getTime()-$1*6e4)),end:M1(new Date(o.getTime()+$1*6e4)),desc:!0},a=q1($s(e.types),eue);a&&(s.type=a);let c=q1($s(e.levels),tue);c&&(s.level=c);let u=Pe(e.customQueryCondition);u&&(s.customQueryCondition=u);let l=Math.min(nue,dn(e.limit,rue)),d=xr().logApiUrlTemplate.replace("{projectExId}",r.projectExId),m=((await new tr(d,{headers:{authorization:`Bearer ${i}`},fetch:Ll}).request(p$,{queryCreation:s,paginator:{first:l}}))?.fetchLogsByPaginator?.edges??[]).map(y=>y?.node).filter(y=>!!y);return t.ok({entries:m})},F1={"logs.search":oue};p();p();p();p();import{readFileSync as hue}from"node:fs";import{dirname as mue,join as gue}from"node:path";import{fileURLToPath as yue}from"node:url";p();var $t,Bl=null;function dm(){return(Bl===null||Bl.byteLength===0)&&(Bl=new Uint8Array($t.memory.buffer)),Bl}var fm=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&fm.decode();var sue=2146435072,US=0;function aue(e,t){return US+=t,US>=sue&&(fm=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}},fm.decode(),US=t),fm.decode(dm().subarray(e,e+t))}function zS(e,t){return e=e>>>0,aue(e,t)}function GS(e){let t=typeof e;if(t=="number"||t=="boolean"||e==null)return`${e}`;if(t=="string")return`"${e}"`;if(t=="symbol"){let i=e.description;return i==null?"Symbol":`Symbol(${i})`}if(t=="function"){let i=e.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(e)){let i=e.length,o="[";i>0&&(o+=GS(e[0]));for(let s=1;s<i;s++)o+=", "+GS(e[s]);return o+="]",o}let r=/\[object ([^\]]+)\]/.exec(toString.call(e)),n;if(r&&r.length>1)n=r[1];else return toString.call(e);if(n=="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return e instanceof Error?`${e.name}: ${e.message}
1275
- ${e.stack}`:n}var mm=0,hm=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},cue=typeof hm.encodeInto=="function"?function(e,t){return hm.encodeInto(e,t)}:function(e,t){let r=hm.encode(e);return t.set(r),{read:e.length,written:r.length}};function U1(e,t,r){if(r===void 0){let a=hm.encode(e),c=t(a.length,1)>>>0;return dm().subarray(c,c+a.length).set(a),mm=a.length,c}let n=e.length,i=t(n,1)>>>0,o=dm(),s=0;for(;s<n;s++){let a=e.charCodeAt(s);if(a>127)break;o[i+s]=a}if(s!==n){s!==0&&(e=e.slice(s)),i=r(i,n,n=s+e.length*3,1)>>>0;let a=dm().subarray(i+s,i+n),c=cue(e,a);s+=c.written,i=r(i,n,s,1)>>>0}return mm=s,i}var Ms=null;function VS(){return(Ms===null||Ms.buffer.detached===!0||Ms.buffer.detached===void 0&&Ms.buffer!==$t.memory.buffer)&&(Ms=new DataView($t.memory.buffer)),Ms}function uue(e){return e==null}function lue(e,t){e=e>>>0;let r=VS(),n=[];for(let i=e;i<e+4*t;i+=4)n.push($t.__wbindgen_export_2.get(r.getUint32(i,!0)));return $t.__externref_drop_slice(e,t),n}function z1(e,t){let r=U1(e,$t.__wbindgen_malloc,$t.__wbindgen_realloc),n=mm,i=$t.cut(r,n,uue(t)?16777215:t?1:0);var o=lue(i[0],i[1]).slice();return $t.__wbindgen_free(i[0],i[1]*4,4),o}var pue=new Set(["basic","cors","default"]);async function due(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(n){if(e.ok&&pue.has(e.type)&&e.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n);else throw n}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let r=await WebAssembly.instantiate(e,t);return r instanceof WebAssembly.Instance?{instance:r,module:e}:r}}function G1(){let e={};return e.wbg={},e.wbg.__wbg_Error_0497d5bdba9362e5=function(t,r){return Error(zS(t,r))},e.wbg.__wbg_new_07b483f72211fd66=function(){return new Object},e.wbg.__wbg_set_3f1d0b984ed272ed=function(t,r,n){t[r]=n},e.wbg.__wbindgen_bigint_from_u64=function(t){return BigInt.asUintN(64,t)},e.wbg.__wbindgen_debug_string=function(t,r){let n=GS(r),i=U1(n,$t.__wbindgen_malloc,$t.__wbindgen_realloc),o=mm;VS().setInt32(t+4,o,!0),VS().setInt32(t+0,i,!0)},e.wbg.__wbindgen_init_externref_table=function(){let t=$t.__wbindgen_export_2,r=t.grow(4);t.set(0,void 0),t.set(r+0,void 0),t.set(r+1,null),t.set(r+2,!0),t.set(r+3,!1)},e.wbg.__wbindgen_number_new=function(t){return t},e.wbg.__wbindgen_string_new=function(t,r){return zS(t,r)},e.wbg.__wbindgen_throw=function(t,r){throw new Error(zS(t,r))},e}function V1(e,t){return $t=e.exports,fue.__wbindgen_wasm_module=t,Ms=null,Bl=null,$t.__wbindgen_start(),$t}function B1(e){if($t!==void 0)return $t;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let t=G1();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));let r=new WebAssembly.Instance(e,t);return V1(r,e)}async function fue(e){if($t!==void 0)return $t;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof e>"u"&&(e=new URL("jieba_rs_wasm_bg.wasm",import.meta.url));let t=G1();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:r,module:n}=await due(await e,t);return V1(r,n)}var Z1=!1,K1=(e,t)=>{if(!Z1){let r=gue(mue(yue(import.meta.url)),"jieba-engine.wasm");B1({module:hue(r)}),Z1=!0}return z1(e,t)};var _ue=new Set(["a","an","and","are","as","at","be","but","by","for","if","in","into","is","it","no","not","of","on","or","such","that","the","their","then","there","these","they","this","to","was","will","with"]),vue=/[a-z0-9]+/g,Eue=e=>{let t=e.toLowerCase().replace(/'s\b/g,""),r=[];for(let n of t.matchAll(vue)){let i=n[0];_ue.has(i)||r.push(Sue(i))}return r},Tue=/[㐀-鿿豈-﫿぀-ヿ가-힯]|[a-z0-9]/i,bue=e=>K1(e.toLowerCase(),!0).filter(t=>Tue.test(t)),ym=e=>Uo==="ZION"?bue(e):Eue(e),qs=(e,t)=>{let r=e[t];return r==="a"||r==="e"||r==="i"||r==="o"||r==="u"?!1:r==="y"?t===0?!0:!qs(e,t-1):!0},bo=e=>{let t=0,r=!1;for(let n=0;n<e.length;n+=1){let i=!qs(e,n);r&&!i&&(t+=1),r=i}return t},BS=e=>{for(let t=0;t<e.length;t+=1)if(!qs(e,t))return!0;return!1},H1=e=>{let t=e.length;return t>=2&&e[t-1]===e[t-2]&&qs(e,t-1)},Q1=e=>{let t=e.length;if(t<3||!qs(e,t-1)||qs(e,t-2)||!qs(e,t-3))return!1;let r=e[t-1];return r!=="w"&&r!=="x"&&r!=="y"},gm=(e,t,r)=>e.slice(0,e.length-t.length)+r;function Sue(e){let t=e;if(t.length<=2)return t;t.endsWith("sses")?t=gm(t,"sses","ss"):t.endsWith("ies")?t=gm(t,"ies","i"):t.endsWith("ss")||t.endsWith("s")&&(t=t.slice(0,-1));let r=!1;t.endsWith("eed")?bo(t.slice(0,-3))>0&&(t=t.slice(0,-1)):t.endsWith("ed")&&BS(t.slice(0,-2))?(t=t.slice(0,-2),r=!0):t.endsWith("ing")&&BS(t.slice(0,-3))&&(t=t.slice(0,-3),r=!0),r&&(t.endsWith("at")||t.endsWith("bl")||t.endsWith("iz")?t+="e":H1(t)&&!/[lsz]$/.test(t)?t=t.slice(0,-1):bo(t)===1&&Q1(t)&&(t+="e")),t.endsWith("y")&&BS(t.slice(0,-1))&&(t=`${t.slice(0,-1)}i`);let n=[["ational","ate"],["tional","tion"],["enci","ence"],["anci","ance"],["izer","ize"],["bli","ble"],["alli","al"],["entli","ent"],["eli","e"],["ousli","ous"],["ization","ize"],["ation","ate"],["ator","ate"],["alism","al"],["iveness","ive"],["fulness","ful"],["ousness","ous"],["aliti","al"],["iviti","ive"],["biliti","ble"],["logi","log"]];for(let[a,c]of n)if(t.endsWith(a)){bo(t.slice(0,t.length-a.length))>0&&(t=gm(t,a,c));break}let i=[["icate","ic"],["ative",""],["alize","al"],["iciti","ic"],["ical","ic"],["ful",""],["ness",""]];for(let[a,c]of i)if(t.endsWith(a)){bo(t.slice(0,t.length-a.length))>0&&(t=gm(t,a,c));break}let o=["al","ance","ence","er","ic","able","ible","ant","ement","ment","ent","ou","ism","ate","iti","ous","ive","ize"],s=!1;for(let a of o)if(t.endsWith(a)){let c=t.slice(0,t.length-a.length);bo(c)>1&&(t=c),s=!0;break}if(!s&&t.endsWith("ion")){let a=t.slice(0,-3);bo(a)>1&&/[st]$/.test(a)&&(t=a)}if(t.endsWith("e")){let a=t.slice(0,-1),c=bo(a);(c>1||c===1&&!Q1(a))&&(t=a)}return bo(t)>1&&H1(t)&&t.endsWith("l")&&(t=t.slice(0,-1)),t}var Oue=async()=>(await import("./corpus-IAMR5GHQ.js")).DOCS_CORPUS,W1=1.5,J1=.75,Iue=3,Y1=null,wue=e=>{let t=[],r=new Map,n=new Map,i=0;for(let o of e){n.set(o.path,o);let s=ym(o.content),a=ym(o.title);for(let u=0;u<Iue;u+=1)s.push(...a);let c=new Map;for(let u of s)c.set(u,(c.get(u)??0)+1);for(let u of c.keys())r.set(u,(r.get(u)??0)+1);t.push({page:o,tf:c,length:s.length}),i+=s.length}return{docs:t,df:r,avgdl:t.length>0?i/t.length:0,byPath:n}},X1=async()=>(Y1??=wue(await Oue()),Y1),eF=async(e,t=10)=>{let r=await X1(),n=[...new Set(ym(e))];if(n.length===0||r.docs.length===0)return[];let i=r.docs.length;return r.docs.map(s=>{let a=0;for(let c of n){let u=s.tf.get(c);if(!u)continue;let l=r.df.get(c)??0,d=Math.log(1+(i-l+.5)/(l+.5)),f=u+W1*(1-J1+J1*s.length/(r.avgdl||1));a+=d*(u*(W1+1)/f)}return{page:s.page,score:a}}).filter(s=>s.score>0).sort((s,a)=>a.score-s.score).slice(0,Math.max(1,t)).map(s=>({path:s.page.path,title:s.page.title,url:s.page.url}))},tF=async e=>{let t=e.replace(/\.mdx$/,""),r=t.startsWith("/")?t:`/${t}`;return(await X1()).byPath.get(r)??null};var xue=async(e,t)=>{let r=Pe(e.query);if(!r)throw new Error("query is required");let n=dn(e.limit,10);return t.ok({results:await eF(r,n)})},Aue=async(e,t)=>{let r=Pe(e.path);if(!r)throw new Error("path is required");let n=await tF(r);if(!n)throw new Error(`No doc page found for path: ${r}`);return t.ok(n)},rF={"docs.search":xue,"docs.get_page":Aue};p();var Nue=async(e,t)=>{let r=Pe(e.query);if(!r)throw new Error("query is required");let n=e.variables&&typeof e.variables=="object"?e.variables:{};return t.ok(await t.client.request(r,n))},nF={"zb.graphql":Nue};p();var iF={...S1,...P1,...C1,...L1,...j1,...F1,...rF,...nF};var Pue=new Set(["docs.search","docs.get_page"]),Rue=e=>new Proxy({},{get(){throw new Error(`${e} is a local-only command and has no authenticated client`)}});function Due(e){if(!(e instanceof Error))return String(e);let t=SS(e.response?.errors);return t||e.message||String(e)}function _m(e,t={}){let r=new gi(e),n=new Ya(r),i=new sm(()=>OS(n,r),t.watchSchemaChanges?async(...c)=>(await Wq(n,r))(...c):void 0),o=(c,u)=>({ok:!0,data:c,message:u}),s=c=>({ok:!1,error:Due(c),data:c instanceof Es?{ztypeDiagnostics:c.diagnostics}:void 0});return{execute:async(c,u)=>{let l=g1(c.args);try{let d=iF[c.name];if(!d)throw new Error(`Unknown command: ${c.name}`);let f=Pue.has(c.name)?Rue(c.name):await OS(n,r),h=null,m=async T=>(h??=await v1(r,T),h);return await d(l,{credentialStore:r,tokenManager:n,schemaManager:i,client:f,signal:u,getProjectArgs:m,checkSchema:async T=>{let b=await m(T);return i.checkRemoteAndSync(am(b.projectExId,b))},ok:o,fail:s})}catch(d){return s(d)}},schemaManager:i,setWorkspaceRoot(c){r.setWorkspaceRoot(c),i.clear()},stop(){i.clear()}}}p();var sF=Rt(fu(),1);import{createRequire as kue}from"module";import{fileURLToPath as Cue}from"url";import oF from"path";var aF=kue(import.meta.url),qi=typeof g>"u"?void 0:g,Lue=()=>{if(qi)return{version:qi.agent};try{let e=oF.resolve(oF.dirname(Cue(import.meta.url)),"../../package.json");return aF(e)}catch{return{}}},vm=e=>{if(qi){if(e==="@functorz/ztype")return qi.ztype;if(e==="@functorz/crdt-helper")return qi.crdtHelper;if(e==="json-joy")return qi.jsonJoy}try{return aF(`${e}/package.json`).version??"unknown"}catch{return"unavailable"}},jue=async()=>{if(qi)return{ztypeVersion:qi.ztype,ztypeSchemaVersion:qi.ztypeSchemaVersion};try{let e=await oi();return{ztypeVersion:e?.ZTypeSystem?.getZTypeVersion?.()??vm("@functorz/ztype"),ztypeSchemaVersion:e?.ZTypeSystem?.getSchemaVersion?.()??"unknown"}}catch{return{ztypeVersion:vm("@functorz/ztype"),ztypeSchemaVersion:"unavailable"}}};async function ZS(){let e=Lue(),t=await jue();return{agentVersion:e.version??"0.0.0",nodeMajor:process.versions.node.split(".")[0],platform:process.platform,arch:process.arch,ztypeVersion:t.ztypeVersion,ztypeSchemaVersion:t.ztypeSchemaVersion,crdtHelperVersion:vm("@functorz/crdt-helper"),jsonJoyVersion:vm("json-joy")}}async function Sc(e,t){let[r,n,i]=await Promise.all([ZS(),An(e),e.loadCredentials()]),o=i?sF.default.decode(i.access_token):null,s=typeof o=="object"&&o!==null?String(o.sub??o.exId??o.id??"authenticated"):"anonymous";return{...r,product:er,apiBaseUrl:n.apiBaseUrl,authUserId:s,workspaceRoot:e.getWorkspaceRoot(),startupFlags:[...t].sort()}}function cF(e,t){return JSON.stringify(e)===JSON.stringify(t)}p();import Em from"net";var $ue=600*1e3;async function Dr(e,t,r){let{socketPath:n,token:i}=e,o=`${Date.now()}-${Math.random().toString(16).slice(2)}`,s={id:o,token:i,command:t};return new Promise((a,c)=>{let u=n.startsWith("tcp://")?Em.createConnection(lF(n)):Em.createConnection(n),l="",d=setTimeout(()=>{u.destroy(),c(new Error(`Timed out waiting for daemon response to ${t.name}`))},$ue),f=()=>{r&&r.removeEventListener("abort",h)},h=()=>{clearTimeout(d),u.destroy(),c(new Error(`Request aborted: ${t.name}`))};if(r){if(r.aborted){h();return}r.addEventListener("abort",h)}u.on("connect",()=>{u.write(`${JSON.stringify(s)}
1275
+ ${e.stack}`:n}var mm=0,hm=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},cue=typeof hm.encodeInto=="function"?function(e,t){return hm.encodeInto(e,t)}:function(e,t){let r=hm.encode(e);return t.set(r),{read:e.length,written:r.length}};function U1(e,t,r){if(r===void 0){let a=hm.encode(e),c=t(a.length,1)>>>0;return dm().subarray(c,c+a.length).set(a),mm=a.length,c}let n=e.length,i=t(n,1)>>>0,o=dm(),s=0;for(;s<n;s++){let a=e.charCodeAt(s);if(a>127)break;o[i+s]=a}if(s!==n){s!==0&&(e=e.slice(s)),i=r(i,n,n=s+e.length*3,1)>>>0;let a=dm().subarray(i+s,i+n),c=cue(e,a);s+=c.written,i=r(i,n,s,1)>>>0}return mm=s,i}var Ms=null;function VS(){return(Ms===null||Ms.buffer.detached===!0||Ms.buffer.detached===void 0&&Ms.buffer!==$t.memory.buffer)&&(Ms=new DataView($t.memory.buffer)),Ms}function uue(e){return e==null}function lue(e,t){e=e>>>0;let r=VS(),n=[];for(let i=e;i<e+4*t;i+=4)n.push($t.__wbindgen_export_2.get(r.getUint32(i,!0)));return $t.__externref_drop_slice(e,t),n}function z1(e,t){let r=U1(e,$t.__wbindgen_malloc,$t.__wbindgen_realloc),n=mm,i=$t.cut(r,n,uue(t)?16777215:t?1:0);var o=lue(i[0],i[1]).slice();return $t.__wbindgen_free(i[0],i[1]*4,4),o}var pue=new Set(["basic","cors","default"]);async function due(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(n){if(e.ok&&pue.has(e.type)&&e.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n);else throw n}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let r=await WebAssembly.instantiate(e,t);return r instanceof WebAssembly.Instance?{instance:r,module:e}:r}}function G1(){let e={};return e.wbg={},e.wbg.__wbg_Error_0497d5bdba9362e5=function(t,r){return Error(zS(t,r))},e.wbg.__wbg_new_07b483f72211fd66=function(){return new Object},e.wbg.__wbg_set_3f1d0b984ed272ed=function(t,r,n){t[r]=n},e.wbg.__wbindgen_bigint_from_u64=function(t){return BigInt.asUintN(64,t)},e.wbg.__wbindgen_debug_string=function(t,r){let n=GS(r),i=U1(n,$t.__wbindgen_malloc,$t.__wbindgen_realloc),o=mm;VS().setInt32(t+4,o,!0),VS().setInt32(t+0,i,!0)},e.wbg.__wbindgen_init_externref_table=function(){let t=$t.__wbindgen_export_2,r=t.grow(4);t.set(0,void 0),t.set(r+0,void 0),t.set(r+1,null),t.set(r+2,!0),t.set(r+3,!1)},e.wbg.__wbindgen_number_new=function(t){return t},e.wbg.__wbindgen_string_new=function(t,r){return zS(t,r)},e.wbg.__wbindgen_throw=function(t,r){throw new Error(zS(t,r))},e}function V1(e,t){return $t=e.exports,fue.__wbindgen_wasm_module=t,Ms=null,Bl=null,$t.__wbindgen_start(),$t}function B1(e){if($t!==void 0)return $t;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let t=G1();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));let r=new WebAssembly.Instance(e,t);return V1(r,e)}async function fue(e){if($t!==void 0)return $t;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof e>"u"&&(e=new URL("jieba_rs_wasm_bg.wasm",import.meta.url));let t=G1();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:r,module:n}=await due(await e,t);return V1(r,n)}var Z1=!1,K1=(e,t)=>{if(!Z1){let r=gue(mue(yue(import.meta.url)),"jieba-engine.wasm");B1({module:hue(r)}),Z1=!0}return z1(e,t)};var _ue=new Set(["a","an","and","are","as","at","be","but","by","for","if","in","into","is","it","no","not","of","on","or","such","that","the","their","then","there","these","they","this","to","was","will","with"]),vue=/[a-z0-9]+/g,Eue=e=>{let t=e.toLowerCase().replace(/'s\b/g,""),r=[];for(let n of t.matchAll(vue)){let i=n[0];_ue.has(i)||r.push(Sue(i))}return r},Tue=/[㐀-鿿豈-﫿぀-ヿ가-힯]|[a-z0-9]/i,bue=e=>K1(e.toLowerCase(),!0).filter(t=>Tue.test(t)),ym=e=>Uo==="ZION"?bue(e):Eue(e),qs=(e,t)=>{let r=e[t];return r==="a"||r==="e"||r==="i"||r==="o"||r==="u"?!1:r==="y"?t===0?!0:!qs(e,t-1):!0},bo=e=>{let t=0,r=!1;for(let n=0;n<e.length;n+=1){let i=!qs(e,n);r&&!i&&(t+=1),r=i}return t},BS=e=>{for(let t=0;t<e.length;t+=1)if(!qs(e,t))return!0;return!1},H1=e=>{let t=e.length;return t>=2&&e[t-1]===e[t-2]&&qs(e,t-1)},Q1=e=>{let t=e.length;if(t<3||!qs(e,t-1)||qs(e,t-2)||!qs(e,t-3))return!1;let r=e[t-1];return r!=="w"&&r!=="x"&&r!=="y"},gm=(e,t,r)=>e.slice(0,e.length-t.length)+r;function Sue(e){let t=e;if(t.length<=2)return t;t.endsWith("sses")?t=gm(t,"sses","ss"):t.endsWith("ies")?t=gm(t,"ies","i"):t.endsWith("ss")||t.endsWith("s")&&(t=t.slice(0,-1));let r=!1;t.endsWith("eed")?bo(t.slice(0,-3))>0&&(t=t.slice(0,-1)):t.endsWith("ed")&&BS(t.slice(0,-2))?(t=t.slice(0,-2),r=!0):t.endsWith("ing")&&BS(t.slice(0,-3))&&(t=t.slice(0,-3),r=!0),r&&(t.endsWith("at")||t.endsWith("bl")||t.endsWith("iz")?t+="e":H1(t)&&!/[lsz]$/.test(t)?t=t.slice(0,-1):bo(t)===1&&Q1(t)&&(t+="e")),t.endsWith("y")&&BS(t.slice(0,-1))&&(t=`${t.slice(0,-1)}i`);let n=[["ational","ate"],["tional","tion"],["enci","ence"],["anci","ance"],["izer","ize"],["bli","ble"],["alli","al"],["entli","ent"],["eli","e"],["ousli","ous"],["ization","ize"],["ation","ate"],["ator","ate"],["alism","al"],["iveness","ive"],["fulness","ful"],["ousness","ous"],["aliti","al"],["iviti","ive"],["biliti","ble"],["logi","log"]];for(let[a,c]of n)if(t.endsWith(a)){bo(t.slice(0,t.length-a.length))>0&&(t=gm(t,a,c));break}let i=[["icate","ic"],["ative",""],["alize","al"],["iciti","ic"],["ical","ic"],["ful",""],["ness",""]];for(let[a,c]of i)if(t.endsWith(a)){bo(t.slice(0,t.length-a.length))>0&&(t=gm(t,a,c));break}let o=["al","ance","ence","er","ic","able","ible","ant","ement","ment","ent","ou","ism","ate","iti","ous","ive","ize"],s=!1;for(let a of o)if(t.endsWith(a)){let c=t.slice(0,t.length-a.length);bo(c)>1&&(t=c),s=!0;break}if(!s&&t.endsWith("ion")){let a=t.slice(0,-3);bo(a)>1&&/[st]$/.test(a)&&(t=a)}if(t.endsWith("e")){let a=t.slice(0,-1),c=bo(a);(c>1||c===1&&!Q1(a))&&(t=a)}return bo(t)>1&&H1(t)&&t.endsWith("l")&&(t=t.slice(0,-1)),t}var Oue=async()=>(await import("./corpus-LYOWPOCP.js")).DOCS_CORPUS,W1=1.5,J1=.75,Iue=3,Y1=null,wue=e=>{let t=[],r=new Map,n=new Map,i=0;for(let o of e){n.set(o.path,o);let s=ym(o.content),a=ym(o.title);for(let u=0;u<Iue;u+=1)s.push(...a);let c=new Map;for(let u of s)c.set(u,(c.get(u)??0)+1);for(let u of c.keys())r.set(u,(r.get(u)??0)+1);t.push({page:o,tf:c,length:s.length}),i+=s.length}return{docs:t,df:r,avgdl:t.length>0?i/t.length:0,byPath:n}},X1=async()=>(Y1??=wue(await Oue()),Y1),eF=async(e,t=10)=>{let r=await X1(),n=[...new Set(ym(e))];if(n.length===0||r.docs.length===0)return[];let i=r.docs.length;return r.docs.map(s=>{let a=0;for(let c of n){let u=s.tf.get(c);if(!u)continue;let l=r.df.get(c)??0,d=Math.log(1+(i-l+.5)/(l+.5)),f=u+W1*(1-J1+J1*s.length/(r.avgdl||1));a+=d*(u*(W1+1)/f)}return{page:s.page,score:a}}).filter(s=>s.score>0).sort((s,a)=>a.score-s.score).slice(0,Math.max(1,t)).map(s=>({path:s.page.path,title:s.page.title,url:s.page.url}))},tF=async e=>{let t=e.replace(/\.mdx$/,""),r=t.startsWith("/")?t:`/${t}`;return(await X1()).byPath.get(r)??null};var xue=async(e,t)=>{let r=Pe(e.query);if(!r)throw new Error("query is required");let n=dn(e.limit,10);return t.ok({results:await eF(r,n)})},Aue=async(e,t)=>{let r=Pe(e.path);if(!r)throw new Error("path is required");let n=await tF(r);if(!n)throw new Error(`No doc page found for path: ${r}`);return t.ok(n)},rF={"docs.search":xue,"docs.get_page":Aue};p();var Nue=async(e,t)=>{let r=Pe(e.query);if(!r)throw new Error("query is required");let n=e.variables&&typeof e.variables=="object"?e.variables:{};return t.ok(await t.client.request(r,n))},nF={"zb.graphql":Nue};p();var iF={...S1,...P1,...C1,...L1,...j1,...F1,...rF,...nF};var Pue=new Set(["docs.search","docs.get_page"]),Rue=e=>new Proxy({},{get(){throw new Error(`${e} is a local-only command and has no authenticated client`)}});function Due(e){if(!(e instanceof Error))return String(e);let t=SS(e.response?.errors);return t||e.message||String(e)}function _m(e,t={}){let r=new gi(e),n=new Ya(r),i=new sm(()=>OS(n,r),t.watchSchemaChanges?async(...c)=>(await Wq(n,r))(...c):void 0),o=(c,u)=>({ok:!0,data:c,message:u}),s=c=>({ok:!1,error:Due(c),data:c instanceof Es?{ztypeDiagnostics:c.diagnostics}:void 0});return{execute:async(c,u)=>{let l=g1(c.args);try{let d=iF[c.name];if(!d)throw new Error(`Unknown command: ${c.name}`);let f=Pue.has(c.name)?Rue(c.name):await OS(n,r),h=null,m=async T=>(h??=await v1(r,T),h);return await d(l,{credentialStore:r,tokenManager:n,schemaManager:i,client:f,signal:u,getProjectArgs:m,checkSchema:async T=>{let b=await m(T);return i.checkRemoteAndSync(am(b.projectExId,b))},ok:o,fail:s})}catch(d){return s(d)}},schemaManager:i,setWorkspaceRoot(c){r.setWorkspaceRoot(c),i.clear()},stop(){i.clear()}}}p();var sF=Rt(fu(),1);import{createRequire as kue}from"module";import{fileURLToPath as Cue}from"url";import oF from"path";var aF=kue(import.meta.url),qi=typeof g>"u"?void 0:g,Lue=()=>{if(qi)return{version:qi.agent};try{let e=oF.resolve(oF.dirname(Cue(import.meta.url)),"../../package.json");return aF(e)}catch{return{}}},vm=e=>{if(qi){if(e==="@functorz/ztype")return qi.ztype;if(e==="@functorz/crdt-helper")return qi.crdtHelper;if(e==="json-joy")return qi.jsonJoy}try{return aF(`${e}/package.json`).version??"unknown"}catch{return"unavailable"}},jue=async()=>{if(qi)return{ztypeVersion:qi.ztype,ztypeSchemaVersion:qi.ztypeSchemaVersion};try{let e=await oi();return{ztypeVersion:e?.ZTypeSystem?.getZTypeVersion?.()??vm("@functorz/ztype"),ztypeSchemaVersion:e?.ZTypeSystem?.getSchemaVersion?.()??"unknown"}}catch{return{ztypeVersion:vm("@functorz/ztype"),ztypeSchemaVersion:"unavailable"}}};async function ZS(){let e=Lue(),t=await jue();return{agentVersion:e.version??"0.0.0",nodeMajor:process.versions.node.split(".")[0],platform:process.platform,arch:process.arch,ztypeVersion:t.ztypeVersion,ztypeSchemaVersion:t.ztypeSchemaVersion,crdtHelperVersion:vm("@functorz/crdt-helper"),jsonJoyVersion:vm("json-joy")}}async function Sc(e,t){let[r,n,i]=await Promise.all([ZS(),An(e),e.loadCredentials()]),o=i?sF.default.decode(i.access_token):null,s=typeof o=="object"&&o!==null?String(o.sub??o.exId??o.id??"authenticated"):"anonymous";return{...r,product:er,apiBaseUrl:n.apiBaseUrl,authUserId:s,workspaceRoot:e.getWorkspaceRoot(),startupFlags:[...t].sort()}}function cF(e,t){return JSON.stringify(e)===JSON.stringify(t)}p();import Em from"net";var $ue=600*1e3;async function Dr(e,t,r){let{socketPath:n,token:i}=e,o=`${Date.now()}-${Math.random().toString(16).slice(2)}`,s={id:o,token:i,command:t};return new Promise((a,c)=>{let u=n.startsWith("tcp://")?Em.createConnection(lF(n)):Em.createConnection(n),l="",d=setTimeout(()=>{u.destroy(),c(new Error(`Timed out waiting for daemon response to ${t.name}`))},$ue),f=()=>{r&&r.removeEventListener("abort",h)},h=()=>{clearTimeout(d),u.destroy(),c(new Error(`Request aborted: ${t.name}`))};if(r){if(r.aborted){h();return}r.addEventListener("abort",h)}u.on("connect",()=>{u.write(`${JSON.stringify(s)}
1276
1276
  `)}),u.on("data",m=>{l+=m.toString("utf8");let y=l.indexOf(`
1277
1277
  `);if(y<0)return;let v=l.slice(0,y);clearTimeout(d),f(),u.end();try{let T=JSON.parse(v);if(T.id!==o){c(new Error("Daemon response id mismatch"));return}a(T.result)}catch(T){c(T)}}),u.on("error",m=>{clearTimeout(d),f(),c(m)})})}function uF(e,t,r){let{socketPath:n,token:i}=e,o=null,s=!1,a=null,c=()=>{if(s)return;o=n.startsWith("tcp://")?Em.createConnection(lF(n)):Em.createConnection(n);let u=`sub-${Date.now()}-${Math.random().toString(16).slice(2)}`,l={id:u,token:i,command:{name:"schema.subscribe"}},d="";o.on("connect",()=>{o?.write(`${JSON.stringify(l)}
1278
1278
  `)}),o.on("data",f=>{for(d+=f.toString("utf8");;){let h=d.indexOf(`