@botpress/sdk 5.0.2 → 5.1.1

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/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- var ss=Object.defineProperty;var GT=Object.getOwnPropertyDescriptor;var VT=Object.getOwnPropertyNames;var JT=Object.prototype.hasOwnProperty;var st=(t,e)=>()=>(t&&(e=t(t=0)),e);var bn=(t,e)=>{for(var n in e)ss(t,n,{get:e[n],enumerable:!0})},YT=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of VT(e))!JT.call(t,o)&&o!==n&&ss(t,o,{get:()=>e[o],enumerable:!(r=GT(e,o))||r.enumerable});return t};var XT=t=>YT(ss({},"__esModule",{value:!0}),t);var I=st(()=>{});var V={};bn(V,{_debugEnd:()=>zu,_debugProcess:()=>Wu,_events:()=>lc,_eventsCount:()=>uc,_exiting:()=>Eu,_fatalExceptions:()=>Zu,_getActiveHandles:()=>Au,_getActiveRequests:()=>ku,_kill:()=>Ou,_linkedBinding:()=>xu,_maxListeners:()=>ac,_preload_modules:()=>ic,_rawDebug:()=>wu,_startProfilerIdleNotifier:()=>qu,_stopProfilerIdleNotifier:()=>Gu,_tickCallback:()=>Fu,abort:()=>Xu,addListener:()=>cc,allowedNodeEnvironmentFlags:()=>Uu,arch:()=>lu,argv:()=>du,argv0:()=>rc,assert:()=>ju,binding:()=>mu,browser:()=>bu,chdir:()=>vu,config:()=>Su,cpuUsage:()=>Ti,cwd:()=>Tu,debugPort:()=>nc,default:()=>vc,dlopen:()=>Iu,domain:()=>Bu,emit:()=>yc,emitWarning:()=>yu,env:()=>cu,execArgv:()=>fu,execPath:()=>tc,exit:()=>Du,features:()=>$u,hasUncaughtExceptionCaptureCallback:()=>Lu,hrtime:()=>hi,kill:()=>Nu,listeners:()=>Tc,memoryUsage:()=>Mu,moduleLoadList:()=>Pu,nextTick:()=>ou,off:()=>fc,on:()=>Gt,once:()=>dc,openStdin:()=>Hu,pid:()=>Qu,platform:()=>uu,ppid:()=>ec,prependListener:()=>mc,prependOnceListener:()=>hc,reallyExit:()=>Cu,release:()=>_u,removeAllListeners:()=>gc,removeListener:()=>pc,resourceUsage:()=>Ru,setSourceMapsEnabled:()=>oc,setUncaughtExceptionCaptureCallback:()=>Ku,stderr:()=>Ju,stdin:()=>Yu,stdout:()=>Vu,title:()=>au,umask:()=>hu,uptime:()=>sc,version:()=>pu,versions:()=>gu});function us(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function QT(){!Vn||!wn||(Vn=!1,wn.length?qt=wn.concat(qt):mi=-1,qt.length&&iu())}function iu(){if(!Vn){var t=setTimeout(QT,0);Vn=!0;for(var e=qt.length;e;){for(wn=qt,qt=[];++mi<e;)wn&&wn[mi].run();mi=-1,e=qt.length}wn=null,Vn=!1,clearTimeout(t)}}function ou(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];qt.push(new su(t,e)),qt.length===1&&!Vn&&setTimeout(iu,0)}function su(t,e){this.fun=t,this.array=e}function lt(){}function xu(t){us("_linkedBinding")}function Iu(t){us("dlopen")}function ku(){return[]}function Au(){return[]}function ju(t,e){if(!t)throw new Error(e||"assertion error")}function Lu(){return!1}function sc(){return dn.now()/1e3}function hi(t){var e=Math.floor((Date.now()-dn.now())*.001),n=dn.now()*.001,r=Math.floor(n)+e,o=Math.floor(n%1*1e9);return t&&(r=r-t[0],o=o-t[1],o<0&&(r--,o+=ls)),[r,o]}function Gt(){return vc}function Tc(t){return[]}var qt,Vn,wn,mi,au,lu,uu,cu,du,fu,pu,gu,yu,mu,hu,Tu,vu,_u,bu,wu,Pu,Bu,Eu,Su,Cu,Ou,Ti,Ru,Mu,Nu,Du,Hu,Uu,$u,Zu,Ku,Fu,Wu,zu,qu,Gu,Vu,Ju,Yu,Xu,Qu,ec,tc,nc,rc,ic,oc,dn,as,ls,ac,lc,uc,cc,dc,fc,pc,gc,yc,mc,hc,vc,_c=st(()=>{I();A();k();qt=[],Vn=!1,mi=-1;su.prototype.run=function(){this.fun.apply(null,this.array)};au="browser",lu="x64",uu="browser",cu={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},du=["/usr/bin/node"],fu=[],pu="v16.8.0",gu={},yu=function(t,e){console.warn((e?e+": ":"")+t)},mu=function(t){us("binding")},hu=function(t){return 0},Tu=function(){return"/"},vu=function(t){},_u={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};bu=!0,wu=lt,Pu=[];Bu={},Eu=!1,Su={};Cu=lt,Ou=lt,Ti=function(){return{}},Ru=Ti,Mu=Ti,Nu=lt,Du=lt,Hu=lt,Uu={};$u={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Zu=lt,Ku=lt;Fu=lt,Wu=lt,zu=lt,qu=lt,Gu=lt,Vu=void 0,Ju=void 0,Yu=void 0,Xu=lt,Qu=2,ec=1,tc="/bin/usr/node",nc=9229,rc="node",ic=[],oc=lt,dn={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};dn.now===void 0&&(as=Date.now(),dn.timing&&dn.timing.navigationStart&&(as=dn.timing.navigationStart),dn.now=()=>Date.now()-as);ls=1e9;hi.bigint=function(t){var e=hi(t);return typeof BigInt>"u"?e[0]*ls+e[1]:BigInt(e[0]*ls)+BigInt(e[1])};ac=10,lc={},uc=0;cc=Gt,dc=Gt,fc=Gt,pc=Gt,gc=Gt,yc=lt,mc=Gt,hc=Gt;vc={version:pu,versions:gu,arch:lu,platform:uu,browser:bu,release:_u,_rawDebug:wu,moduleLoadList:Pu,binding:mu,_linkedBinding:xu,_events:lc,_eventsCount:uc,_maxListeners:ac,on:Gt,addListener:cc,once:dc,off:fc,removeListener:pc,removeAllListeners:gc,emit:yc,prependListener:mc,prependOnceListener:hc,listeners:Tc,domain:Bu,_exiting:Eu,config:Su,dlopen:Iu,uptime:sc,_getActiveRequests:ku,_getActiveHandles:Au,reallyExit:Cu,_kill:Ou,cpuUsage:Ti,resourceUsage:Ru,memoryUsage:Mu,kill:Nu,exit:Du,openStdin:Hu,allowedNodeEnvironmentFlags:Uu,assert:ju,features:$u,_fatalExceptions:Zu,setUncaughtExceptionCaptureCallback:Ku,hasUncaughtExceptionCaptureCallback:Lu,emitWarning:yu,nextTick:ou,_tickCallback:Fu,_debugProcess:Wu,_debugEnd:zu,_startProfilerIdleNotifier:qu,_stopProfilerIdleNotifier:Gu,stdout:Vu,stdin:Yu,stderr:Ju,abort:Xu,umask:hu,chdir:vu,cwd:Tu,env:cu,title:au,argv:du,execArgv:fu,pid:Qu,ppid:ec,execPath:tc,debugPort:nc,hrtime:hi,argv0:rc,_preload_modules:ic,setSourceMapsEnabled:oc}});var k=st(()=>{_c()});function ev(){if(bc)return xr;bc=!0,xr.byteLength=a,xr.toByteArray=c,xr.fromByteArray=g;for(var t=[],e=[],n=typeof Uint8Array<"u"?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,s=r.length;o<s;++o)t[o]=r[o],e[r.charCodeAt(o)]=o;e[45]=62,e[95]=63;function i(h){var T=h.length;if(T%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var x=h.indexOf("=");x===-1&&(x=T);var B=x===T?0:4-x%4;return[x,B]}function a(h){var T=i(h),x=T[0],B=T[1];return(x+B)*3/4-B}function l(h,T,x){return(T+x)*3/4-x}function c(h){var T,x=i(h),B=x[0],_=x[1],S=new n(l(h,B,_)),E=0,H=_>0?B-4:B,Z;for(Z=0;Z<H;Z+=4)T=e[h.charCodeAt(Z)]<<18|e[h.charCodeAt(Z+1)]<<12|e[h.charCodeAt(Z+2)]<<6|e[h.charCodeAt(Z+3)],S[E++]=T>>16&255,S[E++]=T>>8&255,S[E++]=T&255;return _===2&&(T=e[h.charCodeAt(Z)]<<2|e[h.charCodeAt(Z+1)]>>4,S[E++]=T&255),_===1&&(T=e[h.charCodeAt(Z)]<<10|e[h.charCodeAt(Z+1)]<<4|e[h.charCodeAt(Z+2)]>>2,S[E++]=T>>8&255,S[E++]=T&255),S}function p(h){return t[h>>18&63]+t[h>>12&63]+t[h>>6&63]+t[h&63]}function y(h,T,x){for(var B,_=[],S=T;S<x;S+=3)B=(h[S]<<16&16711680)+(h[S+1]<<8&65280)+(h[S+2]&255),_.push(p(B));return _.join("")}function g(h){for(var T,x=h.length,B=x%3,_=[],S=16383,E=0,H=x-B;E<H;E+=S)_.push(y(h,E,E+S>H?H:E+S));return B===1?(T=h[x-1],_.push(t[T>>2]+t[T<<4&63]+"==")):B===2&&(T=(h[x-2]<<8)+h[x-1],_.push(t[T>>10]+t[T>>4&63]+t[T<<2&63]+"=")),_.join("")}return xr}function tv(){if(wc)return vi;wc=!0;return vi.read=function(t,e,n,r,o){var s,i,a=o*8-r-1,l=(1<<a)-1,c=l>>1,p=-7,y=n?o-1:0,g=n?-1:1,h=t[e+y];for(y+=g,s=h&(1<<-p)-1,h>>=-p,p+=a;p>0;s=s*256+t[e+y],y+=g,p-=8);for(i=s&(1<<-p)-1,s>>=-p,p+=r;p>0;i=i*256+t[e+y],y+=g,p-=8);if(s===0)s=1-c;else{if(s===l)return i?NaN:(h?-1:1)*(1/0);i=i+Math.pow(2,r),s=s-c}return(h?-1:1)*i*Math.pow(2,s-r)},vi.write=function(t,e,n,r,o,s){var i,a,l,c=s*8-o-1,p=(1<<c)-1,y=p>>1,g=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:s-1,T=r?1:-1,x=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,i=p):(i=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-i))<1&&(i--,l*=2),i+y>=1?e+=g/l:e+=g*Math.pow(2,1-y),e*l>=2&&(i++,l/=2),i+y>=p?(a=0,i=p):i+y>=1?(a=(e*l-1)*Math.pow(2,o),i=i+y):(a=e*Math.pow(2,y-1)*Math.pow(2,o),i=0));o>=8;t[n+h]=a&255,h+=T,a/=256,o-=8);for(i=i<<o|a,c+=o;c>0;t[n+h]=i&255,h+=T,i/=256,c-=8);t[n+h-T]|=x*128},vi}function $t(){if(Pc)return Pn;Pc=!0;let t=ev(),e=tv(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Pn.Buffer=i,Pn.SlowBuffer=_,Pn.INSPECT_MAX_BYTES=50;let r=2147483647;Pn.kMaxLength=r,i.TYPED_ARRAY_SUPPORT=o(),!i.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function o(){try{let m=new Uint8Array(1),u={foo:function(){return 42}};return Object.setPrototypeOf(u,Uint8Array.prototype),Object.setPrototypeOf(m,u),m.foo()===42}catch{return!1}}Object.defineProperty(i.prototype,"parent",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.buffer}}),Object.defineProperty(i.prototype,"offset",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.byteOffset}});function s(m){if(m>r)throw new RangeError('The value "'+m+'" is invalid for option "size"');let u=new Uint8Array(m);return Object.setPrototypeOf(u,i.prototype),u}function i(m,u,d){if(typeof m=="number"){if(typeof u=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return p(m)}return a(m,u,d)}i.poolSize=8192;function a(m,u,d){if(typeof m=="string")return y(m,u);if(ArrayBuffer.isView(m))return h(m);if(m==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof m);if(xt(m,ArrayBuffer)||m&&xt(m.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(xt(m,SharedArrayBuffer)||m&&xt(m.buffer,SharedArrayBuffer)))return T(m,u,d);if(typeof m=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let b=m.valueOf&&m.valueOf();if(b!=null&&b!==m)return i.from(b,u,d);let O=x(m);if(O)return O;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof m[Symbol.toPrimitive]=="function")return i.from(m[Symbol.toPrimitive]("string"),u,d);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof m)}i.from=function(m,u,d){return a(m,u,d)},Object.setPrototypeOf(i.prototype,Uint8Array.prototype),Object.setPrototypeOf(i,Uint8Array);function l(m){if(typeof m!="number")throw new TypeError('"size" argument must be of type number');if(m<0)throw new RangeError('The value "'+m+'" is invalid for option "size"')}function c(m,u,d){return l(m),m<=0?s(m):u!==void 0?typeof d=="string"?s(m).fill(u,d):s(m).fill(u):s(m)}i.alloc=function(m,u,d){return c(m,u,d)};function p(m){return l(m),s(m<0?0:B(m)|0)}i.allocUnsafe=function(m){return p(m)},i.allocUnsafeSlow=function(m){return p(m)};function y(m,u){if((typeof u!="string"||u==="")&&(u="utf8"),!i.isEncoding(u))throw new TypeError("Unknown encoding: "+u);let d=S(m,u)|0,b=s(d),O=b.write(m,u);return O!==d&&(b=b.slice(0,O)),b}function g(m){let u=m.length<0?0:B(m.length)|0,d=s(u);for(let b=0;b<u;b+=1)d[b]=m[b]&255;return d}function h(m){if(xt(m,Uint8Array)){let u=new Uint8Array(m);return T(u.buffer,u.byteOffset,u.byteLength)}return g(m)}function T(m,u,d){if(u<0||m.byteLength<u)throw new RangeError('"offset" is outside of buffer bounds');if(m.byteLength<u+(d||0))throw new RangeError('"length" is outside of buffer bounds');let b;return u===void 0&&d===void 0?b=new Uint8Array(m):d===void 0?b=new Uint8Array(m,u):b=new Uint8Array(m,u,d),Object.setPrototypeOf(b,i.prototype),b}function x(m){if(i.isBuffer(m)){let u=B(m.length)|0,d=s(u);return d.length===0||m.copy(d,0,0,u),d}if(m.length!==void 0)return typeof m.length!="number"||wr(m.length)?s(0):g(m);if(m.type==="Buffer"&&Array.isArray(m.data))return g(m.data)}function B(m){if(m>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return m|0}function _(m){return+m!=m&&(m=0),i.alloc(+m)}i.isBuffer=function(u){return u!=null&&u._isBuffer===!0&&u!==i.prototype},i.compare=function(u,d){if(xt(u,Uint8Array)&&(u=i.from(u,u.offset,u.byteLength)),xt(d,Uint8Array)&&(d=i.from(d,d.offset,d.byteLength)),!i.isBuffer(u)||!i.isBuffer(d))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(u===d)return 0;let b=u.length,O=d.length;for(let U=0,W=Math.min(b,O);U<W;++U)if(u[U]!==d[U]){b=u[U],O=d[U];break}return b<O?-1:O<b?1:0},i.isEncoding=function(u){switch(String(u).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},i.concat=function(u,d){if(!Array.isArray(u))throw new TypeError('"list" argument must be an Array of Buffers');if(u.length===0)return i.alloc(0);let b;if(d===void 0)for(d=0,b=0;b<u.length;++b)d+=u[b].length;let O=i.allocUnsafe(d),U=0;for(b=0;b<u.length;++b){let W=u[b];if(xt(W,Uint8Array))U+W.length>O.length?(i.isBuffer(W)||(W=i.from(W)),W.copy(O,U)):Uint8Array.prototype.set.call(O,W,U);else if(i.isBuffer(W))W.copy(O,U);else throw new TypeError('"list" argument must be an Array of Buffers');U+=W.length}return O};function S(m,u){if(i.isBuffer(m))return m.length;if(ArrayBuffer.isView(m)||xt(m,ArrayBuffer))return m.byteLength;if(typeof m!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof m);let d=m.length,b=arguments.length>2&&arguments[2]===!0;if(!b&&d===0)return 0;let O=!1;for(;;)switch(u){case"ascii":case"latin1":case"binary":return d;case"utf8":case"utf-8":return Me(m).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d*2;case"hex":return d>>>1;case"base64":return Rt(m).length;default:if(O)return b?-1:Me(m).length;u=(""+u).toLowerCase(),O=!0}}i.byteLength=S;function E(m,u,d){let b=!1;if((u===void 0||u<0)&&(u=0),u>this.length||((d===void 0||d>this.length)&&(d=this.length),d<=0)||(d>>>=0,u>>>=0,d<=u))return"";for(m||(m="utf8");;)switch(m){case"hex":return xe(this,u,d);case"utf8":case"utf-8":return nt(this,u,d);case"ascii":return Tt(this,u,d);case"latin1":case"binary":return Ue(this,u,d);case"base64":return ze(this,u,d);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Se(this,u,d);default:if(b)throw new TypeError("Unknown encoding: "+m);m=(m+"").toLowerCase(),b=!0}}i.prototype._isBuffer=!0;function H(m,u,d){let b=m[u];m[u]=m[d],m[d]=b}i.prototype.swap16=function(){let u=this.length;if(u%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let d=0;d<u;d+=2)H(this,d,d+1);return this},i.prototype.swap32=function(){let u=this.length;if(u%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let d=0;d<u;d+=4)H(this,d,d+3),H(this,d+1,d+2);return this},i.prototype.swap64=function(){let u=this.length;if(u%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let d=0;d<u;d+=8)H(this,d,d+7),H(this,d+1,d+6),H(this,d+2,d+5),H(this,d+3,d+4);return this},i.prototype.toString=function(){let u=this.length;return u===0?"":arguments.length===0?nt(this,0,u):E.apply(this,arguments)},i.prototype.toLocaleString=i.prototype.toString,i.prototype.equals=function(u){if(!i.isBuffer(u))throw new TypeError("Argument must be a Buffer");return this===u?!0:i.compare(this,u)===0},i.prototype.inspect=function(){let u="",d=Pn.INSPECT_MAX_BYTES;return u=this.toString("hex",0,d).replace(/(.{2})/g,"$1 ").trim(),this.length>d&&(u+=" ... "),"<Buffer "+u+">"},n&&(i.prototype[n]=i.prototype.inspect),i.prototype.compare=function(u,d,b,O,U){if(xt(u,Uint8Array)&&(u=i.from(u,u.offset,u.byteLength)),!i.isBuffer(u))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof u);if(d===void 0&&(d=0),b===void 0&&(b=u?u.length:0),O===void 0&&(O=0),U===void 0&&(U=this.length),d<0||b>u.length||O<0||U>this.length)throw new RangeError("out of range index");if(O>=U&&d>=b)return 0;if(O>=U)return-1;if(d>=b)return 1;if(d>>>=0,b>>>=0,O>>>=0,U>>>=0,this===u)return 0;let W=U-O,Be=b-d,qe=Math.min(W,Be),$e=this.slice(O,U),Ge=u.slice(d,b);for(let He=0;He<qe;++He)if($e[He]!==Ge[He]){W=$e[He],Be=Ge[He];break}return W<Be?-1:Be<W?1:0};function Z(m,u,d,b,O){if(m.length===0)return-1;if(typeof d=="string"?(b=d,d=0):d>2147483647?d=2147483647:d<-2147483648&&(d=-2147483648),d=+d,wr(d)&&(d=O?0:m.length-1),d<0&&(d=m.length+d),d>=m.length){if(O)return-1;d=m.length-1}else if(d<0)if(O)d=0;else return-1;if(typeof u=="string"&&(u=i.from(u,b)),i.isBuffer(u))return u.length===0?-1:re(m,u,d,b,O);if(typeof u=="number")return u=u&255,typeof Uint8Array.prototype.indexOf=="function"?O?Uint8Array.prototype.indexOf.call(m,u,d):Uint8Array.prototype.lastIndexOf.call(m,u,d):re(m,[u],d,b,O);throw new TypeError("val must be string, number or Buffer")}function re(m,u,d,b,O){let U=1,W=m.length,Be=u.length;if(b!==void 0&&(b=String(b).toLowerCase(),b==="ucs2"||b==="ucs-2"||b==="utf16le"||b==="utf-16le")){if(m.length<2||u.length<2)return-1;U=2,W/=2,Be/=2,d/=2}function qe(Ge,He){return U===1?Ge[He]:Ge.readUInt16BE(He*U)}let $e;if(O){let Ge=-1;for($e=d;$e<W;$e++)if(qe(m,$e)===qe(u,Ge===-1?0:$e-Ge)){if(Ge===-1&&(Ge=$e),$e-Ge+1===Be)return Ge*U}else Ge!==-1&&($e-=$e-Ge),Ge=-1}else for(d+Be>W&&(d=W-Be),$e=d;$e>=0;$e--){let Ge=!0;for(let He=0;He<Be;He++)if(qe(m,$e+He)!==qe(u,He)){Ge=!1;break}if(Ge)return $e}return-1}i.prototype.includes=function(u,d,b){return this.indexOf(u,d,b)!==-1},i.prototype.indexOf=function(u,d,b){return Z(this,u,d,b,!0)},i.prototype.lastIndexOf=function(u,d,b){return Z(this,u,d,b,!1)};function ee(m,u,d,b){d=Number(d)||0;let O=m.length-d;b?(b=Number(b),b>O&&(b=O)):b=O;let U=u.length;b>U/2&&(b=U/2);let W;for(W=0;W<b;++W){let Be=parseInt(u.substr(W*2,2),16);if(wr(Be))return W;m[d+W]=Be}return W}function ge(m,u,d,b){return jt(Me(u,m.length-d),m,d,b)}function se(m,u,d,b){return jt(_e(u),m,d,b)}function ie(m,u,d,b){return jt(Rt(u),m,d,b)}function Oe(m,u,d,b){return jt(j(u,m.length-d),m,d,b)}i.prototype.write=function(u,d,b,O){if(d===void 0)O="utf8",b=this.length,d=0;else if(b===void 0&&typeof d=="string")O=d,b=this.length,d=0;else if(isFinite(d))d=d>>>0,isFinite(b)?(b=b>>>0,O===void 0&&(O="utf8")):(O=b,b=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let U=this.length-d;if((b===void 0||b>U)&&(b=U),u.length>0&&(b<0||d<0)||d>this.length)throw new RangeError("Attempt to write outside buffer bounds");O||(O="utf8");let W=!1;for(;;)switch(O){case"hex":return ee(this,u,d,b);case"utf8":case"utf-8":return ge(this,u,d,b);case"ascii":case"latin1":case"binary":return se(this,u,d,b);case"base64":return ie(this,u,d,b);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Oe(this,u,d,b);default:if(W)throw new TypeError("Unknown encoding: "+O);O=(""+O).toLowerCase(),W=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ze(m,u,d){return u===0&&d===m.length?t.fromByteArray(m):t.fromByteArray(m.slice(u,d))}function nt(m,u,d){d=Math.min(m.length,d);let b=[],O=u;for(;O<d;){let U=m[O],W=null,Be=U>239?4:U>223?3:U>191?2:1;if(O+Be<=d){let qe,$e,Ge,He;switch(Be){case 1:U<128&&(W=U);break;case 2:qe=m[O+1],(qe&192)===128&&(He=(U&31)<<6|qe&63,He>127&&(W=He));break;case 3:qe=m[O+1],$e=m[O+2],(qe&192)===128&&($e&192)===128&&(He=(U&15)<<12|(qe&63)<<6|$e&63,He>2047&&(He<55296||He>57343)&&(W=He));break;case 4:qe=m[O+1],$e=m[O+2],Ge=m[O+3],(qe&192)===128&&($e&192)===128&&(Ge&192)===128&&(He=(U&15)<<18|(qe&63)<<12|($e&63)<<6|Ge&63,He>65535&&He<1114112&&(W=He))}}W===null?(W=65533,Be=1):W>65535&&(W-=65536,b.push(W>>>10&1023|55296),W=56320|W&1023),b.push(W),O+=Be}return Je(b)}let Ve=4096;function Je(m){let u=m.length;if(u<=Ve)return String.fromCharCode.apply(String,m);let d="",b=0;for(;b<u;)d+=String.fromCharCode.apply(String,m.slice(b,b+=Ve));return d}function Tt(m,u,d){let b="";d=Math.min(m.length,d);for(let O=u;O<d;++O)b+=String.fromCharCode(m[O]&127);return b}function Ue(m,u,d){let b="";d=Math.min(m.length,d);for(let O=u;O<d;++O)b+=String.fromCharCode(m[O]);return b}function xe(m,u,d){let b=m.length;(!u||u<0)&&(u=0),(!d||d<0||d>b)&&(d=b);let O="";for(let U=u;U<d;++U)O+=yi[m[U]];return O}function Se(m,u,d){let b=m.slice(u,d),O="";for(let U=0;U<b.length-1;U+=2)O+=String.fromCharCode(b[U]+b[U+1]*256);return O}i.prototype.slice=function(u,d){let b=this.length;u=~~u,d=d===void 0?b:~~d,u<0?(u+=b,u<0&&(u=0)):u>b&&(u=b),d<0?(d+=b,d<0&&(d=0)):d>b&&(d=b),d<u&&(d=u);let O=this.subarray(u,d);return Object.setPrototypeOf(O,i.prototype),O};function de(m,u,d){if(m%1!==0||m<0)throw new RangeError("offset is not uint");if(m+u>d)throw new RangeError("Trying to access beyond buffer length")}i.prototype.readUintLE=i.prototype.readUIntLE=function(u,d,b){u=u>>>0,d=d>>>0,b||de(u,d,this.length);let O=this[u],U=1,W=0;for(;++W<d&&(U*=256);)O+=this[u+W]*U;return O},i.prototype.readUintBE=i.prototype.readUIntBE=function(u,d,b){u=u>>>0,d=d>>>0,b||de(u,d,this.length);let O=this[u+--d],U=1;for(;d>0&&(U*=256);)O+=this[u+--d]*U;return O},i.prototype.readUint8=i.prototype.readUInt8=function(u,d){return u=u>>>0,d||de(u,1,this.length),this[u]},i.prototype.readUint16LE=i.prototype.readUInt16LE=function(u,d){return u=u>>>0,d||de(u,2,this.length),this[u]|this[u+1]<<8},i.prototype.readUint16BE=i.prototype.readUInt16BE=function(u,d){return u=u>>>0,d||de(u,2,this.length),this[u]<<8|this[u+1]},i.prototype.readUint32LE=i.prototype.readUInt32LE=function(u,d){return u=u>>>0,d||de(u,4,this.length),(this[u]|this[u+1]<<8|this[u+2]<<16)+this[u+3]*16777216},i.prototype.readUint32BE=i.prototype.readUInt32BE=function(u,d){return u=u>>>0,d||de(u,4,this.length),this[u]*16777216+(this[u+1]<<16|this[u+2]<<8|this[u+3])},i.prototype.readBigUInt64LE=St(function(u){u=u>>>0,w(u,"offset");let d=this[u],b=this[u+7];(d===void 0||b===void 0)&&P(u,this.length-8);let O=d+this[++u]*2**8+this[++u]*2**16+this[++u]*2**24,U=this[++u]+this[++u]*2**8+this[++u]*2**16+b*2**24;return BigInt(O)+(BigInt(U)<<BigInt(32))}),i.prototype.readBigUInt64BE=St(function(u){u=u>>>0,w(u,"offset");let d=this[u],b=this[u+7];(d===void 0||b===void 0)&&P(u,this.length-8);let O=d*2**24+this[++u]*2**16+this[++u]*2**8+this[++u],U=this[++u]*2**24+this[++u]*2**16+this[++u]*2**8+b;return(BigInt(O)<<BigInt(32))+BigInt(U)}),i.prototype.readIntLE=function(u,d,b){u=u>>>0,d=d>>>0,b||de(u,d,this.length);let O=this[u],U=1,W=0;for(;++W<d&&(U*=256);)O+=this[u+W]*U;return U*=128,O>=U&&(O-=Math.pow(2,8*d)),O},i.prototype.readIntBE=function(u,d,b){u=u>>>0,d=d>>>0,b||de(u,d,this.length);let O=d,U=1,W=this[u+--O];for(;O>0&&(U*=256);)W+=this[u+--O]*U;return U*=128,W>=U&&(W-=Math.pow(2,8*d)),W},i.prototype.readInt8=function(u,d){return u=u>>>0,d||de(u,1,this.length),this[u]&128?(255-this[u]+1)*-1:this[u]},i.prototype.readInt16LE=function(u,d){u=u>>>0,d||de(u,2,this.length);let b=this[u]|this[u+1]<<8;return b&32768?b|4294901760:b},i.prototype.readInt16BE=function(u,d){u=u>>>0,d||de(u,2,this.length);let b=this[u+1]|this[u]<<8;return b&32768?b|4294901760:b},i.prototype.readInt32LE=function(u,d){return u=u>>>0,d||de(u,4,this.length),this[u]|this[u+1]<<8|this[u+2]<<16|this[u+3]<<24},i.prototype.readInt32BE=function(u,d){return u=u>>>0,d||de(u,4,this.length),this[u]<<24|this[u+1]<<16|this[u+2]<<8|this[u+3]},i.prototype.readBigInt64LE=St(function(u){u=u>>>0,w(u,"offset");let d=this[u],b=this[u+7];(d===void 0||b===void 0)&&P(u,this.length-8);let O=this[u+4]+this[u+5]*2**8+this[u+6]*2**16+(b<<24);return(BigInt(O)<<BigInt(32))+BigInt(d+this[++u]*2**8+this[++u]*2**16+this[++u]*2**24)}),i.prototype.readBigInt64BE=St(function(u){u=u>>>0,w(u,"offset");let d=this[u],b=this[u+7];(d===void 0||b===void 0)&&P(u,this.length-8);let O=(d<<24)+this[++u]*2**16+this[++u]*2**8+this[++u];return(BigInt(O)<<BigInt(32))+BigInt(this[++u]*2**24+this[++u]*2**16+this[++u]*2**8+b)}),i.prototype.readFloatLE=function(u,d){return u=u>>>0,d||de(u,4,this.length),e.read(this,u,!0,23,4)},i.prototype.readFloatBE=function(u,d){return u=u>>>0,d||de(u,4,this.length),e.read(this,u,!1,23,4)},i.prototype.readDoubleLE=function(u,d){return u=u>>>0,d||de(u,8,this.length),e.read(this,u,!0,52,8)},i.prototype.readDoubleBE=function(u,d){return u=u>>>0,d||de(u,8,this.length),e.read(this,u,!1,52,8)};function Te(m,u,d,b,O,U){if(!i.isBuffer(m))throw new TypeError('"buffer" argument must be a Buffer instance');if(u>O||u<U)throw new RangeError('"value" argument is out of bounds');if(d+b>m.length)throw new RangeError("Index out of range")}i.prototype.writeUintLE=i.prototype.writeUIntLE=function(u,d,b,O){if(u=+u,d=d>>>0,b=b>>>0,!O){let Be=Math.pow(2,8*b)-1;Te(this,u,d,b,Be,0)}let U=1,W=0;for(this[d]=u&255;++W<b&&(U*=256);)this[d+W]=u/U&255;return d+b},i.prototype.writeUintBE=i.prototype.writeUIntBE=function(u,d,b,O){if(u=+u,d=d>>>0,b=b>>>0,!O){let Be=Math.pow(2,8*b)-1;Te(this,u,d,b,Be,0)}let U=b-1,W=1;for(this[d+U]=u&255;--U>=0&&(W*=256);)this[d+U]=u/W&255;return d+b},i.prototype.writeUint8=i.prototype.writeUInt8=function(u,d,b){return u=+u,d=d>>>0,b||Te(this,u,d,1,255,0),this[d]=u&255,d+1},i.prototype.writeUint16LE=i.prototype.writeUInt16LE=function(u,d,b){return u=+u,d=d>>>0,b||Te(this,u,d,2,65535,0),this[d]=u&255,this[d+1]=u>>>8,d+2},i.prototype.writeUint16BE=i.prototype.writeUInt16BE=function(u,d,b){return u=+u,d=d>>>0,b||Te(this,u,d,2,65535,0),this[d]=u>>>8,this[d+1]=u&255,d+2},i.prototype.writeUint32LE=i.prototype.writeUInt32LE=function(u,d,b){return u=+u,d=d>>>0,b||Te(this,u,d,4,4294967295,0),this[d+3]=u>>>24,this[d+2]=u>>>16,this[d+1]=u>>>8,this[d]=u&255,d+4},i.prototype.writeUint32BE=i.prototype.writeUInt32BE=function(u,d,b){return u=+u,d=d>>>0,b||Te(this,u,d,4,4294967295,0),this[d]=u>>>24,this[d+1]=u>>>16,this[d+2]=u>>>8,this[d+3]=u&255,d+4};function D(m,u,d,b,O){oe(u,b,O,m,d,7);let U=Number(u&BigInt(4294967295));m[d++]=U,U=U>>8,m[d++]=U,U=U>>8,m[d++]=U,U=U>>8,m[d++]=U;let W=Number(u>>BigInt(32)&BigInt(4294967295));return m[d++]=W,W=W>>8,m[d++]=W,W=W>>8,m[d++]=W,W=W>>8,m[d++]=W,d}function K(m,u,d,b,O){oe(u,b,O,m,d,7);let U=Number(u&BigInt(4294967295));m[d+7]=U,U=U>>8,m[d+6]=U,U=U>>8,m[d+5]=U,U=U>>8,m[d+4]=U;let W=Number(u>>BigInt(32)&BigInt(4294967295));return m[d+3]=W,W=W>>8,m[d+2]=W,W=W>>8,m[d+1]=W,W=W>>8,m[d]=W,d+8}i.prototype.writeBigUInt64LE=St(function(u,d=0){return D(this,u,d,BigInt(0),BigInt("0xffffffffffffffff"))}),i.prototype.writeBigUInt64BE=St(function(u,d=0){return K(this,u,d,BigInt(0),BigInt("0xffffffffffffffff"))}),i.prototype.writeIntLE=function(u,d,b,O){if(u=+u,d=d>>>0,!O){let qe=Math.pow(2,8*b-1);Te(this,u,d,b,qe-1,-qe)}let U=0,W=1,Be=0;for(this[d]=u&255;++U<b&&(W*=256);)u<0&&Be===0&&this[d+U-1]!==0&&(Be=1),this[d+U]=(u/W>>0)-Be&255;return d+b},i.prototype.writeIntBE=function(u,d,b,O){if(u=+u,d=d>>>0,!O){let qe=Math.pow(2,8*b-1);Te(this,u,d,b,qe-1,-qe)}let U=b-1,W=1,Be=0;for(this[d+U]=u&255;--U>=0&&(W*=256);)u<0&&Be===0&&this[d+U+1]!==0&&(Be=1),this[d+U]=(u/W>>0)-Be&255;return d+b},i.prototype.writeInt8=function(u,d,b){return u=+u,d=d>>>0,b||Te(this,u,d,1,127,-128),u<0&&(u=255+u+1),this[d]=u&255,d+1},i.prototype.writeInt16LE=function(u,d,b){return u=+u,d=d>>>0,b||Te(this,u,d,2,32767,-32768),this[d]=u&255,this[d+1]=u>>>8,d+2},i.prototype.writeInt16BE=function(u,d,b){return u=+u,d=d>>>0,b||Te(this,u,d,2,32767,-32768),this[d]=u>>>8,this[d+1]=u&255,d+2},i.prototype.writeInt32LE=function(u,d,b){return u=+u,d=d>>>0,b||Te(this,u,d,4,2147483647,-2147483648),this[d]=u&255,this[d+1]=u>>>8,this[d+2]=u>>>16,this[d+3]=u>>>24,d+4},i.prototype.writeInt32BE=function(u,d,b){return u=+u,d=d>>>0,b||Te(this,u,d,4,2147483647,-2147483648),u<0&&(u=4294967295+u+1),this[d]=u>>>24,this[d+1]=u>>>16,this[d+2]=u>>>8,this[d+3]=u&255,d+4},i.prototype.writeBigInt64LE=St(function(u,d=0){return D(this,u,d,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),i.prototype.writeBigInt64BE=St(function(u,d=0){return K(this,u,d,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function F(m,u,d,b,O,U){if(d+b>m.length)throw new RangeError("Index out of range");if(d<0)throw new RangeError("Index out of range")}function fe(m,u,d,b,O){return u=+u,d=d>>>0,O||F(m,u,d,4),e.write(m,u,d,b,23,4),d+4}i.prototype.writeFloatLE=function(u,d,b){return fe(this,u,d,!0,b)},i.prototype.writeFloatBE=function(u,d,b){return fe(this,u,d,!1,b)};function ve(m,u,d,b,O){return u=+u,d=d>>>0,O||F(m,u,d,8),e.write(m,u,d,b,52,8),d+8}i.prototype.writeDoubleLE=function(u,d,b){return ve(this,u,d,!0,b)},i.prototype.writeDoubleBE=function(u,d,b){return ve(this,u,d,!1,b)},i.prototype.copy=function(u,d,b,O){if(!i.isBuffer(u))throw new TypeError("argument should be a Buffer");if(b||(b=0),!O&&O!==0&&(O=this.length),d>=u.length&&(d=u.length),d||(d=0),O>0&&O<b&&(O=b),O===b||u.length===0||this.length===0)return 0;if(d<0)throw new RangeError("targetStart out of bounds");if(b<0||b>=this.length)throw new RangeError("Index out of range");if(O<0)throw new RangeError("sourceEnd out of bounds");O>this.length&&(O=this.length),u.length-d<O-b&&(O=u.length-d+b);let U=O-b;return this===u&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(d,b,O):Uint8Array.prototype.set.call(u,this.subarray(b,O),d),U},i.prototype.fill=function(u,d,b,O){if(typeof u=="string"){if(typeof d=="string"?(O=d,d=0,b=this.length):typeof b=="string"&&(O=b,b=this.length),O!==void 0&&typeof O!="string")throw new TypeError("encoding must be a string");if(typeof O=="string"&&!i.isEncoding(O))throw new TypeError("Unknown encoding: "+O);if(u.length===1){let W=u.charCodeAt(0);(O==="utf8"&&W<128||O==="latin1")&&(u=W)}}else typeof u=="number"?u=u&255:typeof u=="boolean"&&(u=Number(u));if(d<0||this.length<d||this.length<b)throw new RangeError("Out of range index");if(b<=d)return this;d=d>>>0,b=b===void 0?this.length:b>>>0,u||(u=0);let U;if(typeof u=="number")for(U=d;U<b;++U)this[U]=u;else{let W=i.isBuffer(u)?u:i.from(u,O),Be=W.length;if(Be===0)throw new TypeError('The value "'+u+'" is invalid for argument "value"');for(U=0;U<b-d;++U)this[U+d]=W[U%Be]}return this};let M={};function C(m,u,d){M[m]=class extends d{constructor(){super(),Object.defineProperty(this,"message",{value:u.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${m}]`,this.stack,delete this.name}get code(){return m}set code(O){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:O,writable:!0})}toString(){return`${this.name} [${m}]: ${this.message}`}}}C("ERR_BUFFER_OUT_OF_BOUNDS",function(m){return m?`${m} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),C("ERR_INVALID_ARG_TYPE",function(m,u){return`The "${m}" argument must be of type number. Received type ${typeof u}`},TypeError),C("ERR_OUT_OF_RANGE",function(m,u,d){let b=`The value of "${m}" is out of range.`,O=d;return Number.isInteger(d)&&Math.abs(d)>2**32?O=$(String(d)):typeof d=="bigint"&&(O=String(d),(d>BigInt(2)**BigInt(32)||d<-(BigInt(2)**BigInt(32)))&&(O=$(O)),O+="n"),b+=` It must be ${u}. Received ${O}`,b},RangeError);function $(m){let u="",d=m.length,b=m[0]==="-"?1:0;for(;d>=b+4;d-=3)u=`_${m.slice(d-3,d)}${u}`;return`${m.slice(0,d)}${u}`}function Y(m,u,d){w(u,"offset"),(m[u]===void 0||m[u+d]===void 0)&&P(u,m.length-(d+1))}function oe(m,u,d,b,O,U){if(m>d||m<u){let W=typeof u=="bigint"?"n":"",Be;throw u===0||u===BigInt(0)?Be=`>= 0${W} and < 2${W} ** ${(U+1)*8}${W}`:Be=`>= -(2${W} ** ${(U+1)*8-1}${W}) and < 2 ** ${(U+1)*8-1}${W}`,new M.ERR_OUT_OF_RANGE("value",Be,m)}Y(b,O,U)}function w(m,u){if(typeof m!="number")throw new M.ERR_INVALID_ARG_TYPE(u,"number",m)}function P(m,u,d){throw Math.floor(m)!==m?(w(m,d),new M.ERR_OUT_OF_RANGE("offset","an integer",m)):u<0?new M.ERR_BUFFER_OUT_OF_BOUNDS:new M.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${u}`,m)}let z=/[^+/0-9A-Za-z-_]/g;function Q(m){if(m=m.split("=")[0],m=m.trim().replace(z,""),m.length<2)return"";for(;m.length%4!==0;)m=m+"=";return m}function Me(m,u){u=u||1/0;let d,b=m.length,O=null,U=[];for(let W=0;W<b;++W){if(d=m.charCodeAt(W),d>55295&&d<57344){if(!O){if(d>56319){(u-=3)>-1&&U.push(239,191,189);continue}else if(W+1===b){(u-=3)>-1&&U.push(239,191,189);continue}O=d;continue}if(d<56320){(u-=3)>-1&&U.push(239,191,189),O=d;continue}d=(O-55296<<10|d-56320)+65536}else O&&(u-=3)>-1&&U.push(239,191,189);if(O=null,d<128){if((u-=1)<0)break;U.push(d)}else if(d<2048){if((u-=2)<0)break;U.push(d>>6|192,d&63|128)}else if(d<65536){if((u-=3)<0)break;U.push(d>>12|224,d>>6&63|128,d&63|128)}else if(d<1114112){if((u-=4)<0)break;U.push(d>>18|240,d>>12&63|128,d>>6&63|128,d&63|128)}else throw new Error("Invalid code point")}return U}function _e(m){let u=[];for(let d=0;d<m.length;++d)u.push(m.charCodeAt(d)&255);return u}function j(m,u){let d,b,O,U=[];for(let W=0;W<m.length&&!((u-=2)<0);++W)d=m.charCodeAt(W),b=d>>8,O=d%256,U.push(O),U.push(b);return U}function Rt(m){return t.toByteArray(Q(m))}function jt(m,u,d,b){let O;for(O=0;O<b&&!(O+d>=u.length||O>=m.length);++O)u[O+d]=m[O];return O}function xt(m,u){return m instanceof u||m!=null&&m.constructor!=null&&m.constructor.name!=null&&m.constructor.name===u.name}function wr(m){return m!==m}let yi=(function(){let m="0123456789abcdef",u=new Array(256);for(let d=0;d<16;++d){let b=d*16;for(let O=0;O<16;++O)u[b+O]=m[d]+m[O]}return u})();function St(m){return typeof BigInt>"u"?Pr:m}function Pr(){throw new Error("BigInt not supported")}return Pn}var xr,bc,vi,wc,Pn,Pc,_i=st(()=>{I();A();k();xr={},bc=!1;vi={},wc=!1;Pn={},Pc=!1});var xn,q,BA,EA,xc=st(()=>{I();A();k();_i();xn=$t();xn.Buffer;xn.SlowBuffer;xn.INSPECT_MAX_BYTES;xn.kMaxLength;q=xn.Buffer,BA=xn.INSPECT_MAX_BYTES,EA=xn.kMaxLength});var A=st(()=>{xc()});function Zt(){return zy||(zy=!0,typeof Object.create=="function"?ko=function(e,n){n&&(e.super_=n,e.prototype=Object.create(n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:ko=function(e,n){if(n){e.super_=n;var r=function(){};r.prototype=n.prototype,e.prototype=new r,e.prototype.constructor=e}}),ko}var ko,zy,da=st(()=>{I();A();k();ko={},zy=!1});function Ne(){Ne.init.call(this)}function Ao(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function nm(t){return t._maxListeners===void 0?Ne.defaultMaxListeners:t._maxListeners}function Jy(t,e,n,r){var o,s,i,a;if(Ao(n),(s=t._events)===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,n.listener?n.listener:n),s=t._events),i=s[e]),i===void 0)i=s[e]=n,++t._eventsCount;else if(typeof i=="function"?i=s[e]=r?[n,i]:[i,n]:r?i.unshift(n):i.push(n),(o=nm(t))>0&&i.length>o&&!i.warned){i.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+i.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=i.length,a=l,console&&console.warn&&console.warn(a)}return t}function VB(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Yy(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},o=VB.bind(r);return o.listener=n,r.wrapFn=o,o}function Xy(t,e,n){var r=t._events;if(r===void 0)return[];var o=r[e];return o===void 0?[]:typeof o=="function"?n?[o.listener||o]:[o]:n?(function(s){for(var i=new Array(s.length),a=0;a<i.length;++a)i[a]=s[a].listener||s[a];return i})(o):rm(o,o.length)}function Qy(t){var e=this._events;if(e!==void 0){var n=e[t];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}function rm(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}var em,tm,cr,qy,Gy,Vy,bt,fa=st(()=>{I();A();k();cr=typeof Reflect=="object"?Reflect:null,qy=cr&&typeof cr.apply=="function"?cr.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};tm=cr&&typeof cr.ownKeys=="function"?cr.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};Gy=Number.isNaN||function(t){return t!=t};em=Ne,Ne.EventEmitter=Ne,Ne.prototype._events=void 0,Ne.prototype._eventsCount=0,Ne.prototype._maxListeners=void 0;Vy=10;Object.defineProperty(Ne,"defaultMaxListeners",{enumerable:!0,get:function(){return Vy},set:function(t){if(typeof t!="number"||t<0||Gy(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Vy=t}}),Ne.init=function(){this._events!==void 0&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Ne.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||Gy(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},Ne.prototype.getMaxListeners=function(){return nm(this)},Ne.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var r=t==="error",o=this._events;if(o!==void 0)r=r&&o.error===void 0;else if(!r)return!1;if(r){var s;if(e.length>0&&(s=e[0]),s instanceof Error)throw s;var i=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw i.context=s,i}var a=o[t];if(a===void 0)return!1;if(typeof a=="function")qy(a,this,e);else{var l=a.length,c=rm(a,l);for(n=0;n<l;++n)qy(c[n],this,e)}return!0},Ne.prototype.addListener=function(t,e){return Jy(this,t,e,!1)},Ne.prototype.on=Ne.prototype.addListener,Ne.prototype.prependListener=function(t,e){return Jy(this,t,e,!0)},Ne.prototype.once=function(t,e){return Ao(e),this.on(t,Yy(this,t,e)),this},Ne.prototype.prependOnceListener=function(t,e){return Ao(e),this.prependListener(t,Yy(this,t,e)),this},Ne.prototype.removeListener=function(t,e){var n,r,o,s,i;if(Ao(e),(r=this._events)===void 0)return this;if((n=r[t])===void 0)return this;if(n===e||n.listener===e)--this._eventsCount==0?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if(typeof n!="function"){for(o=-1,s=n.length-1;s>=0;s--)if(n[s]===e||n[s].listener===e){i=n[s].listener,o=s;break}if(o<0)return this;o===0?n.shift():(function(a,l){for(;l+1<a.length;l++)a[l]=a[l+1];a.pop()})(n,o),n.length===1&&(r[t]=n[0]),r.removeListener!==void 0&&this.emit("removeListener",t,i||e)}return this},Ne.prototype.off=Ne.prototype.removeListener,Ne.prototype.removeAllListeners=function(t){var e,n,r;if((n=this._events)===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[t]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete n[t]),this;if(arguments.length===0){var o,s=Object.keys(n);for(r=0;r<s.length;++r)(o=s[r])!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(typeof(e=n[t])=="function")this.removeListener(t,e);else if(e!==void 0)for(r=e.length-1;r>=0;r--)this.removeListener(t,e[r]);return this},Ne.prototype.listeners=function(t){return Xy(this,t,!0)},Ne.prototype.rawListeners=function(t){return Xy(this,t,!1)},Ne.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Qy.call(t,e)},Ne.prototype.listenerCount=Qy,Ne.prototype.eventNames=function(){return this._eventsCount>0?tm(this._events):[]};bt=em;bt.EventEmitter;bt.defaultMaxListeners;bt.init;bt.listenerCount;bt.EventEmitter;bt.defaultMaxListeners;bt.init;bt.listenerCount});var im=st(()=>{I();A();k();fa();bt.once=function(t,e){return new Promise((n,r)=>{function o(...i){s!==void 0&&t.removeListener("error",s),n(i)}let s;e!=="error"&&(s=i=>{t.removeListener(name,o),r(i)},t.once("error",s)),t.once(e,o)})};bt.on=function(t,e){let n=[],r=[],o=null,s=!1,i={async next(){let c=n.shift();if(c)return createIterResult(c,!1);if(o){let p=Promise.reject(o);return o=null,p}return s?createIterResult(void 0,!0):new Promise((p,y)=>r.push({resolve:p,reject:y}))},async return(){t.removeListener(e,a),t.removeListener("error",l),s=!0;for(let c of r)c.resolve(createIterResult(void 0,!0));return createIterResult(void 0,!0)},throw(c){o=c,t.removeListener(e,a),t.removeListener("error",l)},[Symbol.asyncIterator](){return this}};return t.on(e,a),t.on("error",l),i;function a(...c){let p=r.shift();p?p.resolve(createIterResult(c,!1)):n.push(c)}function l(c){s=!0;let p=r.shift();p?p.reject(c):o=c,i.return()}}});function ha(){throw new Error("setTimeout has not been defined")}function Ta(){throw new Error("clearTimeout has not been defined")}function Tm(t){if(nn===setTimeout)return setTimeout(t,0);if((nn===ha||!nn)&&setTimeout)return nn=setTimeout,setTimeout(t,0);try{return nn(t,0)}catch{try{return nn.call(null,t,0)}catch{return nn.call(this||fr,t,0)}}}function JB(){dr&&Kn&&(dr=!1,Kn.length?on=Kn.concat(on):Do=-1,on.length&&vm())}function vm(){if(!dr){var t=Tm(JB);dr=!0;for(var e=on.length;e;){for(Kn=on,on=[];++Do<e;)Kn&&Kn[Do].run();Do=-1,e=on.length}Kn=null,dr=!1,(function(n){if(rn===clearTimeout)return clearTimeout(n);if((rn===Ta||!rn)&&clearTimeout)return rn=clearTimeout,clearTimeout(n);try{rn(n)}catch{try{return rn.call(null,n)}catch{return rn.call(this||fr,n)}}})(t)}}function om(t,e){(this||fr).fun=t,(this||fr).array=e}function tn(){}function Fn(t){return t.call.bind(t)}function ri(t,e){if(typeof t!="object")return!1;try{return e(t),!0}catch{return!1}}function am(t){return wt&&Bt?It(t)!==void 0:Bm(t)||Em(t)||Sm(t)||Im(t)||km(t)||Am(t)||Cm(t)||Om(t)||Rm(t)||Mm(t)||Nm(t)}function Bm(t){return wt&&Bt?It(t)==="Uint8Array":We(t)==="[object Uint8Array]"||sE(t)&&t.buffer!==void 0}function Em(t){return wt&&Bt?It(t)==="Uint8ClampedArray":We(t)==="[object Uint8ClampedArray]"}function Sm(t){return wt&&Bt?It(t)==="Uint16Array":We(t)==="[object Uint16Array]"}function Im(t){return wt&&Bt?It(t)==="Uint32Array":We(t)==="[object Uint32Array]"}function km(t){return wt&&Bt?It(t)==="Int8Array":We(t)==="[object Int8Array]"}function Am(t){return wt&&Bt?It(t)==="Int16Array":We(t)==="[object Int16Array]"}function Cm(t){return wt&&Bt?It(t)==="Int32Array":We(t)==="[object Int32Array]"}function Om(t){return wt&&Bt?It(t)==="Float32Array":We(t)==="[object Float32Array]"}function Rm(t){return wt&&Bt?It(t)==="Float64Array":We(t)==="[object Float64Array]"}function Mm(t){return wt&&Bt?It(t)==="BigInt64Array":We(t)==="[object BigInt64Array]"}function Nm(t){return wt&&Bt?It(t)==="BigUint64Array":We(t)==="[object BigUint64Array]"}function Co(t){return We(t)==="[object Map]"}function Oo(t){return We(t)==="[object Set]"}function Ro(t){return We(t)==="[object WeakMap]"}function pa(t){return We(t)==="[object WeakSet]"}function Uo(t){return We(t)==="[object ArrayBuffer]"}function lm(t){return typeof ArrayBuffer<"u"&&(Uo.working?Uo(t):t instanceof ArrayBuffer)}function jo(t){return We(t)==="[object DataView]"}function um(t){return typeof DataView<"u"&&(jo.working?jo(t):t instanceof DataView)}function $o(t){return We(t)==="[object SharedArrayBuffer]"}function cm(t){return typeof SharedArrayBuffer<"u"&&($o.working?$o(t):t instanceof SharedArrayBuffer)}function dm(t){return ri(t,dE)}function fm(t){return ri(t,fE)}function pm(t){return ri(t,pE)}function gm(t){return xm&&ri(t,gE)}function ym(t){return _a&&ri(t,yE)}function hn(t,e){var n={seen:[],stylize:TE};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),ba(e)?n.showHidden=e:e&&L._extend(n,e),Ln(n.showHidden)&&(n.showHidden=!1),Ln(n.depth)&&(n.depth=2),Ln(n.colors)&&(n.colors=!1),Ln(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=hE),Zo(n,t,n.depth)}function hE(t,e){var n=hn.styles[e];return n?"\x1B["+hn.colors[n][0]+"m"+t+"\x1B["+hn.colors[n][1]+"m":t}function TE(t,e){return t}function Zo(t,e,n){if(t.customInspect&&e&&Ho(e.inspect)&&e.inspect!==L.inspect&&(!e.constructor||e.constructor.prototype!==e)){var r=e.inspect(n,t);return Ko(r)||(r=Zo(t,r,n)),r}var o=(function(g,h){if(Ln(h))return g.stylize("undefined","undefined");if(Ko(h)){var T="'"+JSON.stringify(h).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return g.stylize(T,"string")}if(Um(h))return g.stylize(""+h,"number");if(ba(h))return g.stylize(""+h,"boolean");if(Wo(h))return g.stylize("null","null")})(t,e);if(o)return o;var s=Object.keys(e),i=(function(g){var h={};return g.forEach((function(T,x){h[T]=!0})),h})(s);if(t.showHidden&&(s=Object.getOwnPropertyNames(e)),ni(e)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return ga(e);if(s.length===0){if(Ho(e)){var a=e.name?": "+e.name:"";return t.stylize("[Function"+a+"]","special")}if(ti(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(Lo(e))return t.stylize(Date.prototype.toString.call(e),"date");if(ni(e))return ga(e)}var l,c="",p=!1,y=["{","}"];return Hm(e)&&(p=!0,y=["[","]"]),Ho(e)&&(c=" [Function"+(e.name?": "+e.name:"")+"]"),ti(e)&&(c=" "+RegExp.prototype.toString.call(e)),Lo(e)&&(c=" "+Date.prototype.toUTCString.call(e)),ni(e)&&(c=" "+ga(e)),s.length!==0||p&&e.length!=0?n<0?ti(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),l=p?(function(g,h,T,x,B){for(var _=[],S=0,E=h.length;S<E;++S)jm(h,String(S))?_.push(ya(g,h,T,x,String(S),!0)):_.push("");return B.forEach((function(H){H.match(/^\d+$/)||_.push(ya(g,h,T,x,H,!0))})),_})(t,e,n,i,s):s.map((function(g){return ya(t,e,n,i,g,p)})),t.seen.pop(),(function(g,h,T){var x=0;return g.reduce((function(B,_){return x++,_.indexOf(`
1
+ var ss=Object.defineProperty;var GT=Object.getOwnPropertyDescriptor;var VT=Object.getOwnPropertyNames;var JT=Object.prototype.hasOwnProperty;var st=(t,e)=>()=>(t&&(e=t(t=0)),e);var bn=(t,e)=>{for(var n in e)ss(t,n,{get:e[n],enumerable:!0})},YT=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of VT(e))!JT.call(t,o)&&o!==n&&ss(t,o,{get:()=>e[o],enumerable:!(r=GT(e,o))||r.enumerable});return t};var XT=t=>YT(ss({},"__esModule",{value:!0}),t);var I=st(()=>{});var V={};bn(V,{_debugEnd:()=>zu,_debugProcess:()=>Wu,_events:()=>lc,_eventsCount:()=>uc,_exiting:()=>Eu,_fatalExceptions:()=>Zu,_getActiveHandles:()=>Au,_getActiveRequests:()=>ku,_kill:()=>Ou,_linkedBinding:()=>xu,_maxListeners:()=>ac,_preload_modules:()=>ic,_rawDebug:()=>wu,_startProfilerIdleNotifier:()=>qu,_stopProfilerIdleNotifier:()=>Gu,_tickCallback:()=>Fu,abort:()=>Xu,addListener:()=>cc,allowedNodeEnvironmentFlags:()=>Uu,arch:()=>lu,argv:()=>du,argv0:()=>rc,assert:()=>ju,binding:()=>mu,browser:()=>bu,chdir:()=>vu,config:()=>Su,cpuUsage:()=>Ti,cwd:()=>Tu,debugPort:()=>nc,default:()=>vc,dlopen:()=>Iu,domain:()=>Bu,emit:()=>yc,emitWarning:()=>yu,env:()=>cu,execArgv:()=>fu,execPath:()=>tc,exit:()=>Du,features:()=>$u,hasUncaughtExceptionCaptureCallback:()=>Lu,hrtime:()=>hi,kill:()=>Nu,listeners:()=>Tc,memoryUsage:()=>Mu,moduleLoadList:()=>Pu,nextTick:()=>ou,off:()=>fc,on:()=>Gt,once:()=>dc,openStdin:()=>Hu,pid:()=>Qu,platform:()=>uu,ppid:()=>ec,prependListener:()=>mc,prependOnceListener:()=>hc,reallyExit:()=>Cu,release:()=>_u,removeAllListeners:()=>gc,removeListener:()=>pc,resourceUsage:()=>Ru,setSourceMapsEnabled:()=>oc,setUncaughtExceptionCaptureCallback:()=>Ku,stderr:()=>Ju,stdin:()=>Yu,stdout:()=>Vu,title:()=>au,umask:()=>hu,uptime:()=>sc,version:()=>pu,versions:()=>gu});function us(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function QT(){!Vn||!wn||(Vn=!1,wn.length?qt=wn.concat(qt):mi=-1,qt.length&&iu())}function iu(){if(!Vn){var t=setTimeout(QT,0);Vn=!0;for(var e=qt.length;e;){for(wn=qt,qt=[];++mi<e;)wn&&wn[mi].run();mi=-1,e=qt.length}wn=null,Vn=!1,clearTimeout(t)}}function ou(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];qt.push(new su(t,e)),qt.length===1&&!Vn&&setTimeout(iu,0)}function su(t,e){this.fun=t,this.array=e}function lt(){}function xu(t){us("_linkedBinding")}function Iu(t){us("dlopen")}function ku(){return[]}function Au(){return[]}function ju(t,e){if(!t)throw new Error(e||"assertion error")}function Lu(){return!1}function sc(){return dn.now()/1e3}function hi(t){var e=Math.floor((Date.now()-dn.now())*.001),n=dn.now()*.001,r=Math.floor(n)+e,o=Math.floor(n%1*1e9);return t&&(r=r-t[0],o=o-t[1],o<0&&(r--,o+=ls)),[r,o]}function Gt(){return vc}function Tc(t){return[]}var qt,Vn,wn,mi,au,lu,uu,cu,du,fu,pu,gu,yu,mu,hu,Tu,vu,_u,bu,wu,Pu,Bu,Eu,Su,Cu,Ou,Ti,Ru,Mu,Nu,Du,Hu,Uu,$u,Zu,Ku,Fu,Wu,zu,qu,Gu,Vu,Ju,Yu,Xu,Qu,ec,tc,nc,rc,ic,oc,dn,as,ls,ac,lc,uc,cc,dc,fc,pc,gc,yc,mc,hc,vc,_c=st(()=>{I();A();k();qt=[],Vn=!1,mi=-1;su.prototype.run=function(){this.fun.apply(null,this.array)};au="browser",lu="x64",uu="browser",cu={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},du=["/usr/bin/node"],fu=[],pu="v16.8.0",gu={},yu=function(t,e){console.warn((e?e+": ":"")+t)},mu=function(t){us("binding")},hu=function(t){return 0},Tu=function(){return"/"},vu=function(t){},_u={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};bu=!0,wu=lt,Pu=[];Bu={},Eu=!1,Su={};Cu=lt,Ou=lt,Ti=function(){return{}},Ru=Ti,Mu=Ti,Nu=lt,Du=lt,Hu=lt,Uu={};$u={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Zu=lt,Ku=lt;Fu=lt,Wu=lt,zu=lt,qu=lt,Gu=lt,Vu=void 0,Ju=void 0,Yu=void 0,Xu=lt,Qu=2,ec=1,tc="/bin/usr/node",nc=9229,rc="node",ic=[],oc=lt,dn={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};dn.now===void 0&&(as=Date.now(),dn.timing&&dn.timing.navigationStart&&(as=dn.timing.navigationStart),dn.now=()=>Date.now()-as);ls=1e9;hi.bigint=function(t){var e=hi(t);return typeof BigInt>"u"?e[0]*ls+e[1]:BigInt(e[0]*ls)+BigInt(e[1])};ac=10,lc={},uc=0;cc=Gt,dc=Gt,fc=Gt,pc=Gt,gc=Gt,yc=lt,mc=Gt,hc=Gt;vc={version:pu,versions:gu,arch:lu,platform:uu,browser:bu,release:_u,_rawDebug:wu,moduleLoadList:Pu,binding:mu,_linkedBinding:xu,_events:lc,_eventsCount:uc,_maxListeners:ac,on:Gt,addListener:cc,once:dc,off:fc,removeListener:pc,removeAllListeners:gc,emit:yc,prependListener:mc,prependOnceListener:hc,listeners:Tc,domain:Bu,_exiting:Eu,config:Su,dlopen:Iu,uptime:sc,_getActiveRequests:ku,_getActiveHandles:Au,reallyExit:Cu,_kill:Ou,cpuUsage:Ti,resourceUsage:Ru,memoryUsage:Mu,kill:Nu,exit:Du,openStdin:Hu,allowedNodeEnvironmentFlags:Uu,assert:ju,features:$u,_fatalExceptions:Zu,setUncaughtExceptionCaptureCallback:Ku,hasUncaughtExceptionCaptureCallback:Lu,emitWarning:yu,nextTick:ou,_tickCallback:Fu,_debugProcess:Wu,_debugEnd:zu,_startProfilerIdleNotifier:qu,_stopProfilerIdleNotifier:Gu,stdout:Vu,stdin:Yu,stderr:Ju,abort:Xu,umask:hu,chdir:vu,cwd:Tu,env:cu,title:au,argv:du,execArgv:fu,pid:Qu,ppid:ec,execPath:tc,debugPort:nc,hrtime:hi,argv0:rc,_preload_modules:ic,setSourceMapsEnabled:oc}});var k=st(()=>{_c()});function ev(){if(bc)return xr;bc=!0,xr.byteLength=a,xr.toByteArray=c,xr.fromByteArray=g;for(var t=[],e=[],n=typeof Uint8Array<"u"?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,s=r.length;o<s;++o)t[o]=r[o],e[r.charCodeAt(o)]=o;e[45]=62,e[95]=63;function i(h){var T=h.length;if(T%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var x=h.indexOf("=");x===-1&&(x=T);var B=x===T?0:4-x%4;return[x,B]}function a(h){var T=i(h),x=T[0],B=T[1];return(x+B)*3/4-B}function l(h,T,x){return(T+x)*3/4-x}function c(h){var T,x=i(h),B=x[0],_=x[1],S=new n(l(h,B,_)),E=0,H=_>0?B-4:B,Z;for(Z=0;Z<H;Z+=4)T=e[h.charCodeAt(Z)]<<18|e[h.charCodeAt(Z+1)]<<12|e[h.charCodeAt(Z+2)]<<6|e[h.charCodeAt(Z+3)],S[E++]=T>>16&255,S[E++]=T>>8&255,S[E++]=T&255;return _===2&&(T=e[h.charCodeAt(Z)]<<2|e[h.charCodeAt(Z+1)]>>4,S[E++]=T&255),_===1&&(T=e[h.charCodeAt(Z)]<<10|e[h.charCodeAt(Z+1)]<<4|e[h.charCodeAt(Z+2)]>>2,S[E++]=T>>8&255,S[E++]=T&255),S}function f(h){return t[h>>18&63]+t[h>>12&63]+t[h>>6&63]+t[h&63]}function y(h,T,x){for(var B,_=[],S=T;S<x;S+=3)B=(h[S]<<16&16711680)+(h[S+1]<<8&65280)+(h[S+2]&255),_.push(f(B));return _.join("")}function g(h){for(var T,x=h.length,B=x%3,_=[],S=16383,E=0,H=x-B;E<H;E+=S)_.push(y(h,E,E+S>H?H:E+S));return B===1?(T=h[x-1],_.push(t[T>>2]+t[T<<4&63]+"==")):B===2&&(T=(h[x-2]<<8)+h[x-1],_.push(t[T>>10]+t[T>>4&63]+t[T<<2&63]+"=")),_.join("")}return xr}function tv(){if(wc)return vi;wc=!0;return vi.read=function(t,e,n,r,o){var s,i,a=o*8-r-1,l=(1<<a)-1,c=l>>1,f=-7,y=n?o-1:0,g=n?-1:1,h=t[e+y];for(y+=g,s=h&(1<<-f)-1,h>>=-f,f+=a;f>0;s=s*256+t[e+y],y+=g,f-=8);for(i=s&(1<<-f)-1,s>>=-f,f+=r;f>0;i=i*256+t[e+y],y+=g,f-=8);if(s===0)s=1-c;else{if(s===l)return i?NaN:(h?-1:1)*(1/0);i=i+Math.pow(2,r),s=s-c}return(h?-1:1)*i*Math.pow(2,s-r)},vi.write=function(t,e,n,r,o,s){var i,a,l,c=s*8-o-1,f=(1<<c)-1,y=f>>1,g=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:s-1,T=r?1:-1,x=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,i=f):(i=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-i))<1&&(i--,l*=2),i+y>=1?e+=g/l:e+=g*Math.pow(2,1-y),e*l>=2&&(i++,l/=2),i+y>=f?(a=0,i=f):i+y>=1?(a=(e*l-1)*Math.pow(2,o),i=i+y):(a=e*Math.pow(2,y-1)*Math.pow(2,o),i=0));o>=8;t[n+h]=a&255,h+=T,a/=256,o-=8);for(i=i<<o|a,c+=o;c>0;t[n+h]=i&255,h+=T,i/=256,c-=8);t[n+h-T]|=x*128},vi}function $t(){if(Pc)return Pn;Pc=!0;let t=ev(),e=tv(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Pn.Buffer=i,Pn.SlowBuffer=_,Pn.INSPECT_MAX_BYTES=50;let r=2147483647;Pn.kMaxLength=r,i.TYPED_ARRAY_SUPPORT=o(),!i.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function o(){try{let m=new Uint8Array(1),u={foo:function(){return 42}};return Object.setPrototypeOf(u,Uint8Array.prototype),Object.setPrototypeOf(m,u),m.foo()===42}catch{return!1}}Object.defineProperty(i.prototype,"parent",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.buffer}}),Object.defineProperty(i.prototype,"offset",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.byteOffset}});function s(m){if(m>r)throw new RangeError('The value "'+m+'" is invalid for option "size"');let u=new Uint8Array(m);return Object.setPrototypeOf(u,i.prototype),u}function i(m,u,d){if(typeof m=="number"){if(typeof u=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return f(m)}return a(m,u,d)}i.poolSize=8192;function a(m,u,d){if(typeof m=="string")return y(m,u);if(ArrayBuffer.isView(m))return h(m);if(m==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof m);if(xt(m,ArrayBuffer)||m&&xt(m.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(xt(m,SharedArrayBuffer)||m&&xt(m.buffer,SharedArrayBuffer)))return T(m,u,d);if(typeof m=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let b=m.valueOf&&m.valueOf();if(b!=null&&b!==m)return i.from(b,u,d);let O=x(m);if(O)return O;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof m[Symbol.toPrimitive]=="function")return i.from(m[Symbol.toPrimitive]("string"),u,d);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof m)}i.from=function(m,u,d){return a(m,u,d)},Object.setPrototypeOf(i.prototype,Uint8Array.prototype),Object.setPrototypeOf(i,Uint8Array);function l(m){if(typeof m!="number")throw new TypeError('"size" argument must be of type number');if(m<0)throw new RangeError('The value "'+m+'" is invalid for option "size"')}function c(m,u,d){return l(m),m<=0?s(m):u!==void 0?typeof d=="string"?s(m).fill(u,d):s(m).fill(u):s(m)}i.alloc=function(m,u,d){return c(m,u,d)};function f(m){return l(m),s(m<0?0:B(m)|0)}i.allocUnsafe=function(m){return f(m)},i.allocUnsafeSlow=function(m){return f(m)};function y(m,u){if((typeof u!="string"||u==="")&&(u="utf8"),!i.isEncoding(u))throw new TypeError("Unknown encoding: "+u);let d=S(m,u)|0,b=s(d),O=b.write(m,u);return O!==d&&(b=b.slice(0,O)),b}function g(m){let u=m.length<0?0:B(m.length)|0,d=s(u);for(let b=0;b<u;b+=1)d[b]=m[b]&255;return d}function h(m){if(xt(m,Uint8Array)){let u=new Uint8Array(m);return T(u.buffer,u.byteOffset,u.byteLength)}return g(m)}function T(m,u,d){if(u<0||m.byteLength<u)throw new RangeError('"offset" is outside of buffer bounds');if(m.byteLength<u+(d||0))throw new RangeError('"length" is outside of buffer bounds');let b;return u===void 0&&d===void 0?b=new Uint8Array(m):d===void 0?b=new Uint8Array(m,u):b=new Uint8Array(m,u,d),Object.setPrototypeOf(b,i.prototype),b}function x(m){if(i.isBuffer(m)){let u=B(m.length)|0,d=s(u);return d.length===0||m.copy(d,0,0,u),d}if(m.length!==void 0)return typeof m.length!="number"||wr(m.length)?s(0):g(m);if(m.type==="Buffer"&&Array.isArray(m.data))return g(m.data)}function B(m){if(m>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return m|0}function _(m){return+m!=m&&(m=0),i.alloc(+m)}i.isBuffer=function(u){return u!=null&&u._isBuffer===!0&&u!==i.prototype},i.compare=function(u,d){if(xt(u,Uint8Array)&&(u=i.from(u,u.offset,u.byteLength)),xt(d,Uint8Array)&&(d=i.from(d,d.offset,d.byteLength)),!i.isBuffer(u)||!i.isBuffer(d))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(u===d)return 0;let b=u.length,O=d.length;for(let U=0,W=Math.min(b,O);U<W;++U)if(u[U]!==d[U]){b=u[U],O=d[U];break}return b<O?-1:O<b?1:0},i.isEncoding=function(u){switch(String(u).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},i.concat=function(u,d){if(!Array.isArray(u))throw new TypeError('"list" argument must be an Array of Buffers');if(u.length===0)return i.alloc(0);let b;if(d===void 0)for(d=0,b=0;b<u.length;++b)d+=u[b].length;let O=i.allocUnsafe(d),U=0;for(b=0;b<u.length;++b){let W=u[b];if(xt(W,Uint8Array))U+W.length>O.length?(i.isBuffer(W)||(W=i.from(W)),W.copy(O,U)):Uint8Array.prototype.set.call(O,W,U);else if(i.isBuffer(W))W.copy(O,U);else throw new TypeError('"list" argument must be an Array of Buffers');U+=W.length}return O};function S(m,u){if(i.isBuffer(m))return m.length;if(ArrayBuffer.isView(m)||xt(m,ArrayBuffer))return m.byteLength;if(typeof m!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof m);let d=m.length,b=arguments.length>2&&arguments[2]===!0;if(!b&&d===0)return 0;let O=!1;for(;;)switch(u){case"ascii":case"latin1":case"binary":return d;case"utf8":case"utf-8":return Me(m).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d*2;case"hex":return d>>>1;case"base64":return Rt(m).length;default:if(O)return b?-1:Me(m).length;u=(""+u).toLowerCase(),O=!0}}i.byteLength=S;function E(m,u,d){let b=!1;if((u===void 0||u<0)&&(u=0),u>this.length||((d===void 0||d>this.length)&&(d=this.length),d<=0)||(d>>>=0,u>>>=0,d<=u))return"";for(m||(m="utf8");;)switch(m){case"hex":return xe(this,u,d);case"utf8":case"utf-8":return nt(this,u,d);case"ascii":return Tt(this,u,d);case"latin1":case"binary":return Ue(this,u,d);case"base64":return ze(this,u,d);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Se(this,u,d);default:if(b)throw new TypeError("Unknown encoding: "+m);m=(m+"").toLowerCase(),b=!0}}i.prototype._isBuffer=!0;function H(m,u,d){let b=m[u];m[u]=m[d],m[d]=b}i.prototype.swap16=function(){let u=this.length;if(u%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let d=0;d<u;d+=2)H(this,d,d+1);return this},i.prototype.swap32=function(){let u=this.length;if(u%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let d=0;d<u;d+=4)H(this,d,d+3),H(this,d+1,d+2);return this},i.prototype.swap64=function(){let u=this.length;if(u%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let d=0;d<u;d+=8)H(this,d,d+7),H(this,d+1,d+6),H(this,d+2,d+5),H(this,d+3,d+4);return this},i.prototype.toString=function(){let u=this.length;return u===0?"":arguments.length===0?nt(this,0,u):E.apply(this,arguments)},i.prototype.toLocaleString=i.prototype.toString,i.prototype.equals=function(u){if(!i.isBuffer(u))throw new TypeError("Argument must be a Buffer");return this===u?!0:i.compare(this,u)===0},i.prototype.inspect=function(){let u="",d=Pn.INSPECT_MAX_BYTES;return u=this.toString("hex",0,d).replace(/(.{2})/g,"$1 ").trim(),this.length>d&&(u+=" ... "),"<Buffer "+u+">"},n&&(i.prototype[n]=i.prototype.inspect),i.prototype.compare=function(u,d,b,O,U){if(xt(u,Uint8Array)&&(u=i.from(u,u.offset,u.byteLength)),!i.isBuffer(u))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof u);if(d===void 0&&(d=0),b===void 0&&(b=u?u.length:0),O===void 0&&(O=0),U===void 0&&(U=this.length),d<0||b>u.length||O<0||U>this.length)throw new RangeError("out of range index");if(O>=U&&d>=b)return 0;if(O>=U)return-1;if(d>=b)return 1;if(d>>>=0,b>>>=0,O>>>=0,U>>>=0,this===u)return 0;let W=U-O,Be=b-d,qe=Math.min(W,Be),$e=this.slice(O,U),Ge=u.slice(d,b);for(let He=0;He<qe;++He)if($e[He]!==Ge[He]){W=$e[He],Be=Ge[He];break}return W<Be?-1:Be<W?1:0};function Z(m,u,d,b,O){if(m.length===0)return-1;if(typeof d=="string"?(b=d,d=0):d>2147483647?d=2147483647:d<-2147483648&&(d=-2147483648),d=+d,wr(d)&&(d=O?0:m.length-1),d<0&&(d=m.length+d),d>=m.length){if(O)return-1;d=m.length-1}else if(d<0)if(O)d=0;else return-1;if(typeof u=="string"&&(u=i.from(u,b)),i.isBuffer(u))return u.length===0?-1:re(m,u,d,b,O);if(typeof u=="number")return u=u&255,typeof Uint8Array.prototype.indexOf=="function"?O?Uint8Array.prototype.indexOf.call(m,u,d):Uint8Array.prototype.lastIndexOf.call(m,u,d):re(m,[u],d,b,O);throw new TypeError("val must be string, number or Buffer")}function re(m,u,d,b,O){let U=1,W=m.length,Be=u.length;if(b!==void 0&&(b=String(b).toLowerCase(),b==="ucs2"||b==="ucs-2"||b==="utf16le"||b==="utf-16le")){if(m.length<2||u.length<2)return-1;U=2,W/=2,Be/=2,d/=2}function qe(Ge,He){return U===1?Ge[He]:Ge.readUInt16BE(He*U)}let $e;if(O){let Ge=-1;for($e=d;$e<W;$e++)if(qe(m,$e)===qe(u,Ge===-1?0:$e-Ge)){if(Ge===-1&&(Ge=$e),$e-Ge+1===Be)return Ge*U}else Ge!==-1&&($e-=$e-Ge),Ge=-1}else for(d+Be>W&&(d=W-Be),$e=d;$e>=0;$e--){let Ge=!0;for(let He=0;He<Be;He++)if(qe(m,$e+He)!==qe(u,He)){Ge=!1;break}if(Ge)return $e}return-1}i.prototype.includes=function(u,d,b){return this.indexOf(u,d,b)!==-1},i.prototype.indexOf=function(u,d,b){return Z(this,u,d,b,!0)},i.prototype.lastIndexOf=function(u,d,b){return Z(this,u,d,b,!1)};function ee(m,u,d,b){d=Number(d)||0;let O=m.length-d;b?(b=Number(b),b>O&&(b=O)):b=O;let U=u.length;b>U/2&&(b=U/2);let W;for(W=0;W<b;++W){let Be=parseInt(u.substr(W*2,2),16);if(wr(Be))return W;m[d+W]=Be}return W}function ge(m,u,d,b){return jt(Me(u,m.length-d),m,d,b)}function se(m,u,d,b){return jt(_e(u),m,d,b)}function ie(m,u,d,b){return jt(Rt(u),m,d,b)}function Oe(m,u,d,b){return jt(j(u,m.length-d),m,d,b)}i.prototype.write=function(u,d,b,O){if(d===void 0)O="utf8",b=this.length,d=0;else if(b===void 0&&typeof d=="string")O=d,b=this.length,d=0;else if(isFinite(d))d=d>>>0,isFinite(b)?(b=b>>>0,O===void 0&&(O="utf8")):(O=b,b=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let U=this.length-d;if((b===void 0||b>U)&&(b=U),u.length>0&&(b<0||d<0)||d>this.length)throw new RangeError("Attempt to write outside buffer bounds");O||(O="utf8");let W=!1;for(;;)switch(O){case"hex":return ee(this,u,d,b);case"utf8":case"utf-8":return ge(this,u,d,b);case"ascii":case"latin1":case"binary":return se(this,u,d,b);case"base64":return ie(this,u,d,b);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Oe(this,u,d,b);default:if(W)throw new TypeError("Unknown encoding: "+O);O=(""+O).toLowerCase(),W=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ze(m,u,d){return u===0&&d===m.length?t.fromByteArray(m):t.fromByteArray(m.slice(u,d))}function nt(m,u,d){d=Math.min(m.length,d);let b=[],O=u;for(;O<d;){let U=m[O],W=null,Be=U>239?4:U>223?3:U>191?2:1;if(O+Be<=d){let qe,$e,Ge,He;switch(Be){case 1:U<128&&(W=U);break;case 2:qe=m[O+1],(qe&192)===128&&(He=(U&31)<<6|qe&63,He>127&&(W=He));break;case 3:qe=m[O+1],$e=m[O+2],(qe&192)===128&&($e&192)===128&&(He=(U&15)<<12|(qe&63)<<6|$e&63,He>2047&&(He<55296||He>57343)&&(W=He));break;case 4:qe=m[O+1],$e=m[O+2],Ge=m[O+3],(qe&192)===128&&($e&192)===128&&(Ge&192)===128&&(He=(U&15)<<18|(qe&63)<<12|($e&63)<<6|Ge&63,He>65535&&He<1114112&&(W=He))}}W===null?(W=65533,Be=1):W>65535&&(W-=65536,b.push(W>>>10&1023|55296),W=56320|W&1023),b.push(W),O+=Be}return Je(b)}let Ve=4096;function Je(m){let u=m.length;if(u<=Ve)return String.fromCharCode.apply(String,m);let d="",b=0;for(;b<u;)d+=String.fromCharCode.apply(String,m.slice(b,b+=Ve));return d}function Tt(m,u,d){let b="";d=Math.min(m.length,d);for(let O=u;O<d;++O)b+=String.fromCharCode(m[O]&127);return b}function Ue(m,u,d){let b="";d=Math.min(m.length,d);for(let O=u;O<d;++O)b+=String.fromCharCode(m[O]);return b}function xe(m,u,d){let b=m.length;(!u||u<0)&&(u=0),(!d||d<0||d>b)&&(d=b);let O="";for(let U=u;U<d;++U)O+=yi[m[U]];return O}function Se(m,u,d){let b=m.slice(u,d),O="";for(let U=0;U<b.length-1;U+=2)O+=String.fromCharCode(b[U]+b[U+1]*256);return O}i.prototype.slice=function(u,d){let b=this.length;u=~~u,d=d===void 0?b:~~d,u<0?(u+=b,u<0&&(u=0)):u>b&&(u=b),d<0?(d+=b,d<0&&(d=0)):d>b&&(d=b),d<u&&(d=u);let O=this.subarray(u,d);return Object.setPrototypeOf(O,i.prototype),O};function de(m,u,d){if(m%1!==0||m<0)throw new RangeError("offset is not uint");if(m+u>d)throw new RangeError("Trying to access beyond buffer length")}i.prototype.readUintLE=i.prototype.readUIntLE=function(u,d,b){u=u>>>0,d=d>>>0,b||de(u,d,this.length);let O=this[u],U=1,W=0;for(;++W<d&&(U*=256);)O+=this[u+W]*U;return O},i.prototype.readUintBE=i.prototype.readUIntBE=function(u,d,b){u=u>>>0,d=d>>>0,b||de(u,d,this.length);let O=this[u+--d],U=1;for(;d>0&&(U*=256);)O+=this[u+--d]*U;return O},i.prototype.readUint8=i.prototype.readUInt8=function(u,d){return u=u>>>0,d||de(u,1,this.length),this[u]},i.prototype.readUint16LE=i.prototype.readUInt16LE=function(u,d){return u=u>>>0,d||de(u,2,this.length),this[u]|this[u+1]<<8},i.prototype.readUint16BE=i.prototype.readUInt16BE=function(u,d){return u=u>>>0,d||de(u,2,this.length),this[u]<<8|this[u+1]},i.prototype.readUint32LE=i.prototype.readUInt32LE=function(u,d){return u=u>>>0,d||de(u,4,this.length),(this[u]|this[u+1]<<8|this[u+2]<<16)+this[u+3]*16777216},i.prototype.readUint32BE=i.prototype.readUInt32BE=function(u,d){return u=u>>>0,d||de(u,4,this.length),this[u]*16777216+(this[u+1]<<16|this[u+2]<<8|this[u+3])},i.prototype.readBigUInt64LE=St(function(u){u=u>>>0,w(u,"offset");let d=this[u],b=this[u+7];(d===void 0||b===void 0)&&P(u,this.length-8);let O=d+this[++u]*2**8+this[++u]*2**16+this[++u]*2**24,U=this[++u]+this[++u]*2**8+this[++u]*2**16+b*2**24;return BigInt(O)+(BigInt(U)<<BigInt(32))}),i.prototype.readBigUInt64BE=St(function(u){u=u>>>0,w(u,"offset");let d=this[u],b=this[u+7];(d===void 0||b===void 0)&&P(u,this.length-8);let O=d*2**24+this[++u]*2**16+this[++u]*2**8+this[++u],U=this[++u]*2**24+this[++u]*2**16+this[++u]*2**8+b;return(BigInt(O)<<BigInt(32))+BigInt(U)}),i.prototype.readIntLE=function(u,d,b){u=u>>>0,d=d>>>0,b||de(u,d,this.length);let O=this[u],U=1,W=0;for(;++W<d&&(U*=256);)O+=this[u+W]*U;return U*=128,O>=U&&(O-=Math.pow(2,8*d)),O},i.prototype.readIntBE=function(u,d,b){u=u>>>0,d=d>>>0,b||de(u,d,this.length);let O=d,U=1,W=this[u+--O];for(;O>0&&(U*=256);)W+=this[u+--O]*U;return U*=128,W>=U&&(W-=Math.pow(2,8*d)),W},i.prototype.readInt8=function(u,d){return u=u>>>0,d||de(u,1,this.length),this[u]&128?(255-this[u]+1)*-1:this[u]},i.prototype.readInt16LE=function(u,d){u=u>>>0,d||de(u,2,this.length);let b=this[u]|this[u+1]<<8;return b&32768?b|4294901760:b},i.prototype.readInt16BE=function(u,d){u=u>>>0,d||de(u,2,this.length);let b=this[u+1]|this[u]<<8;return b&32768?b|4294901760:b},i.prototype.readInt32LE=function(u,d){return u=u>>>0,d||de(u,4,this.length),this[u]|this[u+1]<<8|this[u+2]<<16|this[u+3]<<24},i.prototype.readInt32BE=function(u,d){return u=u>>>0,d||de(u,4,this.length),this[u]<<24|this[u+1]<<16|this[u+2]<<8|this[u+3]},i.prototype.readBigInt64LE=St(function(u){u=u>>>0,w(u,"offset");let d=this[u],b=this[u+7];(d===void 0||b===void 0)&&P(u,this.length-8);let O=this[u+4]+this[u+5]*2**8+this[u+6]*2**16+(b<<24);return(BigInt(O)<<BigInt(32))+BigInt(d+this[++u]*2**8+this[++u]*2**16+this[++u]*2**24)}),i.prototype.readBigInt64BE=St(function(u){u=u>>>0,w(u,"offset");let d=this[u],b=this[u+7];(d===void 0||b===void 0)&&P(u,this.length-8);let O=(d<<24)+this[++u]*2**16+this[++u]*2**8+this[++u];return(BigInt(O)<<BigInt(32))+BigInt(this[++u]*2**24+this[++u]*2**16+this[++u]*2**8+b)}),i.prototype.readFloatLE=function(u,d){return u=u>>>0,d||de(u,4,this.length),e.read(this,u,!0,23,4)},i.prototype.readFloatBE=function(u,d){return u=u>>>0,d||de(u,4,this.length),e.read(this,u,!1,23,4)},i.prototype.readDoubleLE=function(u,d){return u=u>>>0,d||de(u,8,this.length),e.read(this,u,!0,52,8)},i.prototype.readDoubleBE=function(u,d){return u=u>>>0,d||de(u,8,this.length),e.read(this,u,!1,52,8)};function Te(m,u,d,b,O,U){if(!i.isBuffer(m))throw new TypeError('"buffer" argument must be a Buffer instance');if(u>O||u<U)throw new RangeError('"value" argument is out of bounds');if(d+b>m.length)throw new RangeError("Index out of range")}i.prototype.writeUintLE=i.prototype.writeUIntLE=function(u,d,b,O){if(u=+u,d=d>>>0,b=b>>>0,!O){let Be=Math.pow(2,8*b)-1;Te(this,u,d,b,Be,0)}let U=1,W=0;for(this[d]=u&255;++W<b&&(U*=256);)this[d+W]=u/U&255;return d+b},i.prototype.writeUintBE=i.prototype.writeUIntBE=function(u,d,b,O){if(u=+u,d=d>>>0,b=b>>>0,!O){let Be=Math.pow(2,8*b)-1;Te(this,u,d,b,Be,0)}let U=b-1,W=1;for(this[d+U]=u&255;--U>=0&&(W*=256);)this[d+U]=u/W&255;return d+b},i.prototype.writeUint8=i.prototype.writeUInt8=function(u,d,b){return u=+u,d=d>>>0,b||Te(this,u,d,1,255,0),this[d]=u&255,d+1},i.prototype.writeUint16LE=i.prototype.writeUInt16LE=function(u,d,b){return u=+u,d=d>>>0,b||Te(this,u,d,2,65535,0),this[d]=u&255,this[d+1]=u>>>8,d+2},i.prototype.writeUint16BE=i.prototype.writeUInt16BE=function(u,d,b){return u=+u,d=d>>>0,b||Te(this,u,d,2,65535,0),this[d]=u>>>8,this[d+1]=u&255,d+2},i.prototype.writeUint32LE=i.prototype.writeUInt32LE=function(u,d,b){return u=+u,d=d>>>0,b||Te(this,u,d,4,4294967295,0),this[d+3]=u>>>24,this[d+2]=u>>>16,this[d+1]=u>>>8,this[d]=u&255,d+4},i.prototype.writeUint32BE=i.prototype.writeUInt32BE=function(u,d,b){return u=+u,d=d>>>0,b||Te(this,u,d,4,4294967295,0),this[d]=u>>>24,this[d+1]=u>>>16,this[d+2]=u>>>8,this[d+3]=u&255,d+4};function D(m,u,d,b,O){oe(u,b,O,m,d,7);let U=Number(u&BigInt(4294967295));m[d++]=U,U=U>>8,m[d++]=U,U=U>>8,m[d++]=U,U=U>>8,m[d++]=U;let W=Number(u>>BigInt(32)&BigInt(4294967295));return m[d++]=W,W=W>>8,m[d++]=W,W=W>>8,m[d++]=W,W=W>>8,m[d++]=W,d}function K(m,u,d,b,O){oe(u,b,O,m,d,7);let U=Number(u&BigInt(4294967295));m[d+7]=U,U=U>>8,m[d+6]=U,U=U>>8,m[d+5]=U,U=U>>8,m[d+4]=U;let W=Number(u>>BigInt(32)&BigInt(4294967295));return m[d+3]=W,W=W>>8,m[d+2]=W,W=W>>8,m[d+1]=W,W=W>>8,m[d]=W,d+8}i.prototype.writeBigUInt64LE=St(function(u,d=0){return D(this,u,d,BigInt(0),BigInt("0xffffffffffffffff"))}),i.prototype.writeBigUInt64BE=St(function(u,d=0){return K(this,u,d,BigInt(0),BigInt("0xffffffffffffffff"))}),i.prototype.writeIntLE=function(u,d,b,O){if(u=+u,d=d>>>0,!O){let qe=Math.pow(2,8*b-1);Te(this,u,d,b,qe-1,-qe)}let U=0,W=1,Be=0;for(this[d]=u&255;++U<b&&(W*=256);)u<0&&Be===0&&this[d+U-1]!==0&&(Be=1),this[d+U]=(u/W>>0)-Be&255;return d+b},i.prototype.writeIntBE=function(u,d,b,O){if(u=+u,d=d>>>0,!O){let qe=Math.pow(2,8*b-1);Te(this,u,d,b,qe-1,-qe)}let U=b-1,W=1,Be=0;for(this[d+U]=u&255;--U>=0&&(W*=256);)u<0&&Be===0&&this[d+U+1]!==0&&(Be=1),this[d+U]=(u/W>>0)-Be&255;return d+b},i.prototype.writeInt8=function(u,d,b){return u=+u,d=d>>>0,b||Te(this,u,d,1,127,-128),u<0&&(u=255+u+1),this[d]=u&255,d+1},i.prototype.writeInt16LE=function(u,d,b){return u=+u,d=d>>>0,b||Te(this,u,d,2,32767,-32768),this[d]=u&255,this[d+1]=u>>>8,d+2},i.prototype.writeInt16BE=function(u,d,b){return u=+u,d=d>>>0,b||Te(this,u,d,2,32767,-32768),this[d]=u>>>8,this[d+1]=u&255,d+2},i.prototype.writeInt32LE=function(u,d,b){return u=+u,d=d>>>0,b||Te(this,u,d,4,2147483647,-2147483648),this[d]=u&255,this[d+1]=u>>>8,this[d+2]=u>>>16,this[d+3]=u>>>24,d+4},i.prototype.writeInt32BE=function(u,d,b){return u=+u,d=d>>>0,b||Te(this,u,d,4,2147483647,-2147483648),u<0&&(u=4294967295+u+1),this[d]=u>>>24,this[d+1]=u>>>16,this[d+2]=u>>>8,this[d+3]=u&255,d+4},i.prototype.writeBigInt64LE=St(function(u,d=0){return D(this,u,d,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),i.prototype.writeBigInt64BE=St(function(u,d=0){return K(this,u,d,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function F(m,u,d,b,O,U){if(d+b>m.length)throw new RangeError("Index out of range");if(d<0)throw new RangeError("Index out of range")}function fe(m,u,d,b,O){return u=+u,d=d>>>0,O||F(m,u,d,4),e.write(m,u,d,b,23,4),d+4}i.prototype.writeFloatLE=function(u,d,b){return fe(this,u,d,!0,b)},i.prototype.writeFloatBE=function(u,d,b){return fe(this,u,d,!1,b)};function ve(m,u,d,b,O){return u=+u,d=d>>>0,O||F(m,u,d,8),e.write(m,u,d,b,52,8),d+8}i.prototype.writeDoubleLE=function(u,d,b){return ve(this,u,d,!0,b)},i.prototype.writeDoubleBE=function(u,d,b){return ve(this,u,d,!1,b)},i.prototype.copy=function(u,d,b,O){if(!i.isBuffer(u))throw new TypeError("argument should be a Buffer");if(b||(b=0),!O&&O!==0&&(O=this.length),d>=u.length&&(d=u.length),d||(d=0),O>0&&O<b&&(O=b),O===b||u.length===0||this.length===0)return 0;if(d<0)throw new RangeError("targetStart out of bounds");if(b<0||b>=this.length)throw new RangeError("Index out of range");if(O<0)throw new RangeError("sourceEnd out of bounds");O>this.length&&(O=this.length),u.length-d<O-b&&(O=u.length-d+b);let U=O-b;return this===u&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(d,b,O):Uint8Array.prototype.set.call(u,this.subarray(b,O),d),U},i.prototype.fill=function(u,d,b,O){if(typeof u=="string"){if(typeof d=="string"?(O=d,d=0,b=this.length):typeof b=="string"&&(O=b,b=this.length),O!==void 0&&typeof O!="string")throw new TypeError("encoding must be a string");if(typeof O=="string"&&!i.isEncoding(O))throw new TypeError("Unknown encoding: "+O);if(u.length===1){let W=u.charCodeAt(0);(O==="utf8"&&W<128||O==="latin1")&&(u=W)}}else typeof u=="number"?u=u&255:typeof u=="boolean"&&(u=Number(u));if(d<0||this.length<d||this.length<b)throw new RangeError("Out of range index");if(b<=d)return this;d=d>>>0,b=b===void 0?this.length:b>>>0,u||(u=0);let U;if(typeof u=="number")for(U=d;U<b;++U)this[U]=u;else{let W=i.isBuffer(u)?u:i.from(u,O),Be=W.length;if(Be===0)throw new TypeError('The value "'+u+'" is invalid for argument "value"');for(U=0;U<b-d;++U)this[U+d]=W[U%Be]}return this};let M={};function C(m,u,d){M[m]=class extends d{constructor(){super(),Object.defineProperty(this,"message",{value:u.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${m}]`,this.stack,delete this.name}get code(){return m}set code(O){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:O,writable:!0})}toString(){return`${this.name} [${m}]: ${this.message}`}}}C("ERR_BUFFER_OUT_OF_BOUNDS",function(m){return m?`${m} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),C("ERR_INVALID_ARG_TYPE",function(m,u){return`The "${m}" argument must be of type number. Received type ${typeof u}`},TypeError),C("ERR_OUT_OF_RANGE",function(m,u,d){let b=`The value of "${m}" is out of range.`,O=d;return Number.isInteger(d)&&Math.abs(d)>2**32?O=$(String(d)):typeof d=="bigint"&&(O=String(d),(d>BigInt(2)**BigInt(32)||d<-(BigInt(2)**BigInt(32)))&&(O=$(O)),O+="n"),b+=` It must be ${u}. Received ${O}`,b},RangeError);function $(m){let u="",d=m.length,b=m[0]==="-"?1:0;for(;d>=b+4;d-=3)u=`_${m.slice(d-3,d)}${u}`;return`${m.slice(0,d)}${u}`}function Y(m,u,d){w(u,"offset"),(m[u]===void 0||m[u+d]===void 0)&&P(u,m.length-(d+1))}function oe(m,u,d,b,O,U){if(m>d||m<u){let W=typeof u=="bigint"?"n":"",Be;throw u===0||u===BigInt(0)?Be=`>= 0${W} and < 2${W} ** ${(U+1)*8}${W}`:Be=`>= -(2${W} ** ${(U+1)*8-1}${W}) and < 2 ** ${(U+1)*8-1}${W}`,new M.ERR_OUT_OF_RANGE("value",Be,m)}Y(b,O,U)}function w(m,u){if(typeof m!="number")throw new M.ERR_INVALID_ARG_TYPE(u,"number",m)}function P(m,u,d){throw Math.floor(m)!==m?(w(m,d),new M.ERR_OUT_OF_RANGE("offset","an integer",m)):u<0?new M.ERR_BUFFER_OUT_OF_BOUNDS:new M.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${u}`,m)}let z=/[^+/0-9A-Za-z-_]/g;function Q(m){if(m=m.split("=")[0],m=m.trim().replace(z,""),m.length<2)return"";for(;m.length%4!==0;)m=m+"=";return m}function Me(m,u){u=u||1/0;let d,b=m.length,O=null,U=[];for(let W=0;W<b;++W){if(d=m.charCodeAt(W),d>55295&&d<57344){if(!O){if(d>56319){(u-=3)>-1&&U.push(239,191,189);continue}else if(W+1===b){(u-=3)>-1&&U.push(239,191,189);continue}O=d;continue}if(d<56320){(u-=3)>-1&&U.push(239,191,189),O=d;continue}d=(O-55296<<10|d-56320)+65536}else O&&(u-=3)>-1&&U.push(239,191,189);if(O=null,d<128){if((u-=1)<0)break;U.push(d)}else if(d<2048){if((u-=2)<0)break;U.push(d>>6|192,d&63|128)}else if(d<65536){if((u-=3)<0)break;U.push(d>>12|224,d>>6&63|128,d&63|128)}else if(d<1114112){if((u-=4)<0)break;U.push(d>>18|240,d>>12&63|128,d>>6&63|128,d&63|128)}else throw new Error("Invalid code point")}return U}function _e(m){let u=[];for(let d=0;d<m.length;++d)u.push(m.charCodeAt(d)&255);return u}function j(m,u){let d,b,O,U=[];for(let W=0;W<m.length&&!((u-=2)<0);++W)d=m.charCodeAt(W),b=d>>8,O=d%256,U.push(O),U.push(b);return U}function Rt(m){return t.toByteArray(Q(m))}function jt(m,u,d,b){let O;for(O=0;O<b&&!(O+d>=u.length||O>=m.length);++O)u[O+d]=m[O];return O}function xt(m,u){return m instanceof u||m!=null&&m.constructor!=null&&m.constructor.name!=null&&m.constructor.name===u.name}function wr(m){return m!==m}let yi=(function(){let m="0123456789abcdef",u=new Array(256);for(let d=0;d<16;++d){let b=d*16;for(let O=0;O<16;++O)u[b+O]=m[d]+m[O]}return u})();function St(m){return typeof BigInt>"u"?Pr:m}function Pr(){throw new Error("BigInt not supported")}return Pn}var xr,bc,vi,wc,Pn,Pc,_i=st(()=>{I();A();k();xr={},bc=!1;vi={},wc=!1;Pn={},Pc=!1});var xn,q,BA,EA,xc=st(()=>{I();A();k();_i();xn=$t();xn.Buffer;xn.SlowBuffer;xn.INSPECT_MAX_BYTES;xn.kMaxLength;q=xn.Buffer,BA=xn.INSPECT_MAX_BYTES,EA=xn.kMaxLength});var A=st(()=>{xc()});function Zt(){return zy||(zy=!0,typeof Object.create=="function"?ko=function(e,n){n&&(e.super_=n,e.prototype=Object.create(n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:ko=function(e,n){if(n){e.super_=n;var r=function(){};r.prototype=n.prototype,e.prototype=new r,e.prototype.constructor=e}}),ko}var ko,zy,da=st(()=>{I();A();k();ko={},zy=!1});function Ne(){Ne.init.call(this)}function Ao(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function nm(t){return t._maxListeners===void 0?Ne.defaultMaxListeners:t._maxListeners}function Jy(t,e,n,r){var o,s,i,a;if(Ao(n),(s=t._events)===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,n.listener?n.listener:n),s=t._events),i=s[e]),i===void 0)i=s[e]=n,++t._eventsCount;else if(typeof i=="function"?i=s[e]=r?[n,i]:[i,n]:r?i.unshift(n):i.push(n),(o=nm(t))>0&&i.length>o&&!i.warned){i.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+i.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=i.length,a=l,console&&console.warn&&console.warn(a)}return t}function VB(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Yy(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},o=VB.bind(r);return o.listener=n,r.wrapFn=o,o}function Xy(t,e,n){var r=t._events;if(r===void 0)return[];var o=r[e];return o===void 0?[]:typeof o=="function"?n?[o.listener||o]:[o]:n?(function(s){for(var i=new Array(s.length),a=0;a<i.length;++a)i[a]=s[a].listener||s[a];return i})(o):rm(o,o.length)}function Qy(t){var e=this._events;if(e!==void 0){var n=e[t];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}function rm(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}var em,tm,cr,qy,Gy,Vy,bt,fa=st(()=>{I();A();k();cr=typeof Reflect=="object"?Reflect:null,qy=cr&&typeof cr.apply=="function"?cr.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};tm=cr&&typeof cr.ownKeys=="function"?cr.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};Gy=Number.isNaN||function(t){return t!=t};em=Ne,Ne.EventEmitter=Ne,Ne.prototype._events=void 0,Ne.prototype._eventsCount=0,Ne.prototype._maxListeners=void 0;Vy=10;Object.defineProperty(Ne,"defaultMaxListeners",{enumerable:!0,get:function(){return Vy},set:function(t){if(typeof t!="number"||t<0||Gy(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Vy=t}}),Ne.init=function(){this._events!==void 0&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Ne.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||Gy(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},Ne.prototype.getMaxListeners=function(){return nm(this)},Ne.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var r=t==="error",o=this._events;if(o!==void 0)r=r&&o.error===void 0;else if(!r)return!1;if(r){var s;if(e.length>0&&(s=e[0]),s instanceof Error)throw s;var i=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw i.context=s,i}var a=o[t];if(a===void 0)return!1;if(typeof a=="function")qy(a,this,e);else{var l=a.length,c=rm(a,l);for(n=0;n<l;++n)qy(c[n],this,e)}return!0},Ne.prototype.addListener=function(t,e){return Jy(this,t,e,!1)},Ne.prototype.on=Ne.prototype.addListener,Ne.prototype.prependListener=function(t,e){return Jy(this,t,e,!0)},Ne.prototype.once=function(t,e){return Ao(e),this.on(t,Yy(this,t,e)),this},Ne.prototype.prependOnceListener=function(t,e){return Ao(e),this.prependListener(t,Yy(this,t,e)),this},Ne.prototype.removeListener=function(t,e){var n,r,o,s,i;if(Ao(e),(r=this._events)===void 0)return this;if((n=r[t])===void 0)return this;if(n===e||n.listener===e)--this._eventsCount==0?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if(typeof n!="function"){for(o=-1,s=n.length-1;s>=0;s--)if(n[s]===e||n[s].listener===e){i=n[s].listener,o=s;break}if(o<0)return this;o===0?n.shift():(function(a,l){for(;l+1<a.length;l++)a[l]=a[l+1];a.pop()})(n,o),n.length===1&&(r[t]=n[0]),r.removeListener!==void 0&&this.emit("removeListener",t,i||e)}return this},Ne.prototype.off=Ne.prototype.removeListener,Ne.prototype.removeAllListeners=function(t){var e,n,r;if((n=this._events)===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[t]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete n[t]),this;if(arguments.length===0){var o,s=Object.keys(n);for(r=0;r<s.length;++r)(o=s[r])!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(typeof(e=n[t])=="function")this.removeListener(t,e);else if(e!==void 0)for(r=e.length-1;r>=0;r--)this.removeListener(t,e[r]);return this},Ne.prototype.listeners=function(t){return Xy(this,t,!0)},Ne.prototype.rawListeners=function(t){return Xy(this,t,!1)},Ne.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Qy.call(t,e)},Ne.prototype.listenerCount=Qy,Ne.prototype.eventNames=function(){return this._eventsCount>0?tm(this._events):[]};bt=em;bt.EventEmitter;bt.defaultMaxListeners;bt.init;bt.listenerCount;bt.EventEmitter;bt.defaultMaxListeners;bt.init;bt.listenerCount});var im=st(()=>{I();A();k();fa();bt.once=function(t,e){return new Promise((n,r)=>{function o(...i){s!==void 0&&t.removeListener("error",s),n(i)}let s;e!=="error"&&(s=i=>{t.removeListener(name,o),r(i)},t.once("error",s)),t.once(e,o)})};bt.on=function(t,e){let n=[],r=[],o=null,s=!1,i={async next(){let c=n.shift();if(c)return createIterResult(c,!1);if(o){let f=Promise.reject(o);return o=null,f}return s?createIterResult(void 0,!0):new Promise((f,y)=>r.push({resolve:f,reject:y}))},async return(){t.removeListener(e,a),t.removeListener("error",l),s=!0;for(let c of r)c.resolve(createIterResult(void 0,!0));return createIterResult(void 0,!0)},throw(c){o=c,t.removeListener(e,a),t.removeListener("error",l)},[Symbol.asyncIterator](){return this}};return t.on(e,a),t.on("error",l),i;function a(...c){let f=r.shift();f?f.resolve(createIterResult(c,!1)):n.push(c)}function l(c){s=!0;let f=r.shift();f?f.reject(c):o=c,i.return()}}});function ha(){throw new Error("setTimeout has not been defined")}function Ta(){throw new Error("clearTimeout has not been defined")}function Tm(t){if(nn===setTimeout)return setTimeout(t,0);if((nn===ha||!nn)&&setTimeout)return nn=setTimeout,setTimeout(t,0);try{return nn(t,0)}catch{try{return nn.call(null,t,0)}catch{return nn.call(this||fr,t,0)}}}function JB(){dr&&Kn&&(dr=!1,Kn.length?on=Kn.concat(on):Do=-1,on.length&&vm())}function vm(){if(!dr){var t=Tm(JB);dr=!0;for(var e=on.length;e;){for(Kn=on,on=[];++Do<e;)Kn&&Kn[Do].run();Do=-1,e=on.length}Kn=null,dr=!1,(function(n){if(rn===clearTimeout)return clearTimeout(n);if((rn===Ta||!rn)&&clearTimeout)return rn=clearTimeout,clearTimeout(n);try{rn(n)}catch{try{return rn.call(null,n)}catch{return rn.call(this||fr,n)}}})(t)}}function om(t,e){(this||fr).fun=t,(this||fr).array=e}function tn(){}function Fn(t){return t.call.bind(t)}function ri(t,e){if(typeof t!="object")return!1;try{return e(t),!0}catch{return!1}}function am(t){return wt&&Bt?It(t)!==void 0:Bm(t)||Em(t)||Sm(t)||Im(t)||km(t)||Am(t)||Cm(t)||Om(t)||Rm(t)||Mm(t)||Nm(t)}function Bm(t){return wt&&Bt?It(t)==="Uint8Array":We(t)==="[object Uint8Array]"||sE(t)&&t.buffer!==void 0}function Em(t){return wt&&Bt?It(t)==="Uint8ClampedArray":We(t)==="[object Uint8ClampedArray]"}function Sm(t){return wt&&Bt?It(t)==="Uint16Array":We(t)==="[object Uint16Array]"}function Im(t){return wt&&Bt?It(t)==="Uint32Array":We(t)==="[object Uint32Array]"}function km(t){return wt&&Bt?It(t)==="Int8Array":We(t)==="[object Int8Array]"}function Am(t){return wt&&Bt?It(t)==="Int16Array":We(t)==="[object Int16Array]"}function Cm(t){return wt&&Bt?It(t)==="Int32Array":We(t)==="[object Int32Array]"}function Om(t){return wt&&Bt?It(t)==="Float32Array":We(t)==="[object Float32Array]"}function Rm(t){return wt&&Bt?It(t)==="Float64Array":We(t)==="[object Float64Array]"}function Mm(t){return wt&&Bt?It(t)==="BigInt64Array":We(t)==="[object BigInt64Array]"}function Nm(t){return wt&&Bt?It(t)==="BigUint64Array":We(t)==="[object BigUint64Array]"}function Co(t){return We(t)==="[object Map]"}function Oo(t){return We(t)==="[object Set]"}function Ro(t){return We(t)==="[object WeakMap]"}function pa(t){return We(t)==="[object WeakSet]"}function Uo(t){return We(t)==="[object ArrayBuffer]"}function lm(t){return typeof ArrayBuffer<"u"&&(Uo.working?Uo(t):t instanceof ArrayBuffer)}function jo(t){return We(t)==="[object DataView]"}function um(t){return typeof DataView<"u"&&(jo.working?jo(t):t instanceof DataView)}function $o(t){return We(t)==="[object SharedArrayBuffer]"}function cm(t){return typeof SharedArrayBuffer<"u"&&($o.working?$o(t):t instanceof SharedArrayBuffer)}function dm(t){return ri(t,dE)}function fm(t){return ri(t,fE)}function pm(t){return ri(t,pE)}function gm(t){return xm&&ri(t,gE)}function ym(t){return _a&&ri(t,yE)}function hn(t,e){var n={seen:[],stylize:TE};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),ba(e)?n.showHidden=e:e&&L._extend(n,e),Ln(n.showHidden)&&(n.showHidden=!1),Ln(n.depth)&&(n.depth=2),Ln(n.colors)&&(n.colors=!1),Ln(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=hE),Zo(n,t,n.depth)}function hE(t,e){var n=hn.styles[e];return n?"\x1B["+hn.colors[n][0]+"m"+t+"\x1B["+hn.colors[n][1]+"m":t}function TE(t,e){return t}function Zo(t,e,n){if(t.customInspect&&e&&Ho(e.inspect)&&e.inspect!==L.inspect&&(!e.constructor||e.constructor.prototype!==e)){var r=e.inspect(n,t);return Ko(r)||(r=Zo(t,r,n)),r}var o=(function(g,h){if(Ln(h))return g.stylize("undefined","undefined");if(Ko(h)){var T="'"+JSON.stringify(h).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return g.stylize(T,"string")}if(Um(h))return g.stylize(""+h,"number");if(ba(h))return g.stylize(""+h,"boolean");if(Wo(h))return g.stylize("null","null")})(t,e);if(o)return o;var s=Object.keys(e),i=(function(g){var h={};return g.forEach((function(T,x){h[T]=!0})),h})(s);if(t.showHidden&&(s=Object.getOwnPropertyNames(e)),ni(e)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return ga(e);if(s.length===0){if(Ho(e)){var a=e.name?": "+e.name:"";return t.stylize("[Function"+a+"]","special")}if(ti(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(Lo(e))return t.stylize(Date.prototype.toString.call(e),"date");if(ni(e))return ga(e)}var l,c="",f=!1,y=["{","}"];return Hm(e)&&(f=!0,y=["[","]"]),Ho(e)&&(c=" [Function"+(e.name?": "+e.name:"")+"]"),ti(e)&&(c=" "+RegExp.prototype.toString.call(e)),Lo(e)&&(c=" "+Date.prototype.toUTCString.call(e)),ni(e)&&(c=" "+ga(e)),s.length!==0||f&&e.length!=0?n<0?ti(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),l=f?(function(g,h,T,x,B){for(var _=[],S=0,E=h.length;S<E;++S)jm(h,String(S))?_.push(ya(g,h,T,x,String(S),!0)):_.push("");return B.forEach((function(H){H.match(/^\d+$/)||_.push(ya(g,h,T,x,H,!0))})),_})(t,e,n,i,s):s.map((function(g){return ya(t,e,n,i,g,f)})),t.seen.pop(),(function(g,h,T){var x=0;return g.reduce((function(B,_){return x++,_.indexOf(`
2
2
  `)>=0&&x++,B+_.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60?T[0]+(h===""?"":h+`
3
3
  `)+" "+g.join(`,
4
4
  `)+" "+T[1]:T[0]+h+" "+g.join(", ")+" "+T[1]})(l,c,y)):y[0]+c+y[1]}function ga(t){return"["+Error.prototype.toString.call(t)+"]"}function ya(t,e,n,r,o,s){var i,a,l;if((l=Object.getOwnPropertyDescriptor(e,o)||{value:e[o]}).get?a=l.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):l.set&&(a=t.stylize("[Setter]","special")),jm(r,o)||(i="["+o+"]"),a||(t.seen.indexOf(l.value)<0?(a=Wo(n)?Zo(t,l.value,null):Zo(t,l.value,n-1)).indexOf(`
@@ -7,32 +7,25 @@ var ss=Object.defineProperty;var GT=Object.getOwnPropertyDescriptor;var VT=Objec
7
7
  `).substr(2):`
8
8
  `+a.split(`
9
9
  `).map((function(c){return" "+c})).join(`
10
- `)):a=t.stylize("[Circular]","special")),Ln(i)){if(s&&o.match(/^\d+$/))return a;(i=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(i=i.substr(1,i.length-2),i=t.stylize(i,"name")):(i=i.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),i=t.stylize(i,"string"))}return i+": "+a}function Hm(t){return Array.isArray(t)}function ba(t){return typeof t=="boolean"}function Wo(t){return t===null}function Um(t){return typeof t=="number"}function Ko(t){return typeof t=="string"}function Ln(t){return t===void 0}function ti(t){return pr(t)&&wa(t)==="[object RegExp]"}function pr(t){return typeof t=="object"&&t!==null}function Lo(t){return pr(t)&&wa(t)==="[object Date]"}function ni(t){return pr(t)&&(wa(t)==="[object Error]"||t instanceof Error)}function Ho(t){return typeof t=="function"}function wa(t){return Object.prototype.toString.call(t)}function ma(t){return t<10?"0"+t.toString(10):t.toString(10)}function _E(){var t=new Date,e=[ma(t.getHours()),ma(t.getMinutes()),ma(t.getSeconds())].join(":");return[t.getDate(),vE[t.getMonth()],e].join(" ")}function jm(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function bE(t,e){if(!t){var n=new Error("Promise was rejected with a falsy value");n.reason=t,t=n}return e(t)}var hm,nn,rn,fr,Qe,Kn,on,dr,Do,Ze,YB,va,Fo,_m,XB,QB,eE,tE,nE,bm,wm,sm,rE,iE,oE,Pm,Ee,sE,aE,lE,xm,_a,Bt,wt,uE,We,dE,fE,pE,ei,L,Kt,mm,mE,Mo,Dm,No,vE,Zn,DC,zo=st(()=>{I();A();k();fr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,Qe=hm={};(function(){try{nn=typeof setTimeout=="function"?setTimeout:ha}catch{nn=ha}try{rn=typeof clearTimeout=="function"?clearTimeout:Ta}catch{rn=Ta}})();on=[],dr=!1,Do=-1;Qe.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];on.push(new om(t,e)),on.length!==1||dr||Tm(vm)},om.prototype.run=function(){(this||fr).fun.apply(null,(this||fr).array)},Qe.title="browser",Qe.browser=!0,Qe.env={},Qe.argv=[],Qe.version="",Qe.versions={},Qe.on=tn,Qe.addListener=tn,Qe.once=tn,Qe.off=tn,Qe.removeListener=tn,Qe.removeAllListeners=tn,Qe.emit=tn,Qe.prependListener=tn,Qe.prependOnceListener=tn,Qe.listeners=function(t){return[]},Qe.binding=function(t){throw new Error("process.binding is not supported")},Qe.cwd=function(){return"/"},Qe.chdir=function(t){throw new Error("process.chdir is not supported")},Qe.umask=function(){return 0};Ze=hm;Ze.addListener;Ze.argv;Ze.binding;Ze.browser;Ze.chdir;Ze.cwd;Ze.emit;Ze.env;Ze.listeners;Ze.nextTick;Ze.off;Ze.on;Ze.once;Ze.prependListener;Ze.prependOnceListener;Ze.removeAllListeners;Ze.removeListener;Ze.title;Ze.umask;Ze.version;Ze.versions;YB=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",va=Object.prototype.toString,Fo=function(t){return!(YB&&t&&typeof t=="object"&&Symbol.toStringTag in t)&&va.call(t)==="[object Arguments]"},_m=function(t){return!!Fo(t)||t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&va.call(t)!=="[object Array]"&&va.call(t.callee)==="[object Function]"},XB=(function(){return Fo(arguments)})();Fo.isLegacyArguments=_m;QB=XB?Fo:_m,eE=Object.prototype.toString,tE=Function.prototype.toString,nE=/^\s*(?:function)?\*/,bm=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",wm=Object.getPrototypeOf,sm=(function(){if(!bm)return!1;try{return Function("return function*() {}")()}catch{}})(),rE=sm?wm(sm):{},iE=function(t){return typeof t=="function"&&(!!nE.test(tE.call(t))||(bm?wm(t)===rE:eE.call(t)==="[object GeneratorFunction]"))},oE=typeof Object.create=="function"?function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},Pm=function(t){return t&&typeof t=="object"&&typeof t.copy=="function"&&typeof t.fill=="function"&&typeof t.readUInt8=="function"},Ee={},sE=Pm,aE=QB,lE=iE;xm=typeof BigInt<"u",_a=typeof Symbol<"u",Bt=_a&&Symbol.toStringTag!==void 0,wt=typeof Uint8Array<"u",uE=typeof ArrayBuffer<"u";if(wt&&Bt)var cE=Object.getPrototypeOf(Uint8Array.prototype),It=Fn(Object.getOwnPropertyDescriptor(cE,Symbol.toStringTag).get);We=Fn(Object.prototype.toString),dE=Fn(Number.prototype.valueOf),fE=Fn(String.prototype.valueOf),pE=Fn(Boolean.prototype.valueOf);if(xm)var gE=Fn(BigInt.prototype.valueOf);if(_a)var yE=Fn(Symbol.prototype.valueOf);Ee.isArgumentsObject=aE,Ee.isGeneratorFunction=lE,Ee.isPromise=function(t){return typeof Promise<"u"&&t instanceof Promise||t!==null&&typeof t=="object"&&typeof t.then=="function"&&typeof t.catch=="function"},Ee.isArrayBufferView=function(t){return uE&&ArrayBuffer.isView?ArrayBuffer.isView(t):am(t)||um(t)},Ee.isTypedArray=am,Ee.isUint8Array=Bm,Ee.isUint8ClampedArray=Em,Ee.isUint16Array=Sm,Ee.isUint32Array=Im,Ee.isInt8Array=km,Ee.isInt16Array=Am,Ee.isInt32Array=Cm,Ee.isFloat32Array=Om,Ee.isFloat64Array=Rm,Ee.isBigInt64Array=Mm,Ee.isBigUint64Array=Nm,Co.working=typeof Map<"u"&&Co(new Map),Ee.isMap=function(t){return typeof Map<"u"&&(Co.working?Co(t):t instanceof Map)},Oo.working=typeof Set<"u"&&Oo(new Set),Ee.isSet=function(t){return typeof Set<"u"&&(Oo.working?Oo(t):t instanceof Set)},Ro.working=typeof WeakMap<"u"&&Ro(new WeakMap),Ee.isWeakMap=function(t){return typeof WeakMap<"u"&&(Ro.working?Ro(t):t instanceof WeakMap)},pa.working=typeof WeakSet<"u"&&pa(new WeakSet),Ee.isWeakSet=function(t){return pa(t)},Uo.working=typeof ArrayBuffer<"u"&&Uo(new ArrayBuffer),Ee.isArrayBuffer=lm,jo.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&jo(new DataView(new ArrayBuffer(1),0,1)),Ee.isDataView=um,$o.working=typeof SharedArrayBuffer<"u"&&$o(new SharedArrayBuffer),Ee.isSharedArrayBuffer=cm,Ee.isAsyncFunction=function(t){return We(t)==="[object AsyncFunction]"},Ee.isMapIterator=function(t){return We(t)==="[object Map Iterator]"},Ee.isSetIterator=function(t){return We(t)==="[object Set Iterator]"},Ee.isGeneratorObject=function(t){return We(t)==="[object Generator]"},Ee.isWebAssemblyCompiledModule=function(t){return We(t)==="[object WebAssembly.Module]"},Ee.isNumberObject=dm,Ee.isStringObject=fm,Ee.isBooleanObject=pm,Ee.isBigIntObject=gm,Ee.isSymbolObject=ym,Ee.isBoxedPrimitive=function(t){return dm(t)||fm(t)||pm(t)||gm(t)||ym(t)},Ee.isAnyArrayBuffer=function(t){return wt&&(lm(t)||cm(t))},["isProxy","isExternal","isModuleNamespaceObject"].forEach((function(t){Object.defineProperty(Ee,t,{enumerable:!1,value:function(){throw new Error(t+" is not supported in userland")}})}));ei=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,L={},Kt=Ze,mm=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),n={},r=0;r<e.length;r++)n[e[r]]=Object.getOwnPropertyDescriptor(t,e[r]);return n},mE=/%[sdj%]/g;L.format=function(t){if(!Ko(t)){for(var e=[],n=0;n<arguments.length;n++)e.push(hn(arguments[n]));return e.join(" ")}n=1;for(var r=arguments,o=r.length,s=String(t).replace(mE,(function(a){if(a==="%%")return"%";if(n>=o)return a;switch(a){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch{return"[Circular]"}default:return a}})),i=r[n];n<o;i=r[++n])Wo(i)||!pr(i)?s+=" "+i:s+=" "+hn(i);return s},L.deprecate=function(t,e){if(Kt!==void 0&&Kt.noDeprecation===!0)return t;if(Kt===void 0)return function(){return L.deprecate(t,e).apply(this||ei,arguments)};var n=!1;return function(){if(!n){if(Kt.throwDeprecation)throw new Error(e);Kt.traceDeprecation?console.trace(e):console.error(e),n=!0}return t.apply(this||ei,arguments)}};Mo={},Dm=/^$/;Kt.env.NODE_DEBUG&&(No=Kt.env.NODE_DEBUG,No=No.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),Dm=new RegExp("^"+No+"$","i"));L.debuglog=function(t){if(t=t.toUpperCase(),!Mo[t])if(Dm.test(t)){var e=Kt.pid;Mo[t]=function(){var n=L.format.apply(L,arguments);console.error("%s %d: %s",t,e,n)}}else Mo[t]=function(){};return Mo[t]},L.inspect=hn,hn.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},hn.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},L.types=Ee,L.isArray=Hm,L.isBoolean=ba,L.isNull=Wo,L.isNullOrUndefined=function(t){return t==null},L.isNumber=Um,L.isString=Ko,L.isSymbol=function(t){return typeof t=="symbol"},L.isUndefined=Ln,L.isRegExp=ti,L.types.isRegExp=ti,L.isObject=pr,L.isDate=Lo,L.types.isDate=Lo,L.isError=ni,L.types.isNativeError=ni,L.isFunction=Ho,L.isPrimitive=function(t){return t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||typeof t=="symbol"||t===void 0},L.isBuffer=Pm;vE=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];L.log=function(){console.log("%s - %s",_E(),L.format.apply(L,arguments))},L.inherits=oE,L._extend=function(t,e){if(!e||!pr(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t};Zn=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;L.promisify=function(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');if(Zn&&t[Zn]){var e;if(typeof(e=t[Zn])!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,Zn,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var n,r,o=new Promise((function(a,l){n=a,r=l})),s=[],i=0;i<arguments.length;i++)s.push(arguments[i]);s.push((function(a,l){a?r(a):n(l)}));try{t.apply(this||ei,s)}catch(a){r(a)}return o}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Zn&&Object.defineProperty(e,Zn,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,mm(t))},L.promisify.custom=Zn,L.callbackify=function(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');function e(){for(var n=[],r=0;r<arguments.length;r++)n.push(arguments[r]);var o=n.pop();if(typeof o!="function")throw new TypeError("The last argument must be of type Function");var s=this||ei,i=function(){return o.apply(s,arguments)};t.apply(this||ei,n).then((function(a){Kt.nextTick(i.bind(null,null,a))}),(function(a){Kt.nextTick(bE.bind(null,a,i))}))}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Object.defineProperties(e,mm(t)),e};L._extend;L.callbackify;L.debuglog;L.deprecate;L.format;L.inherits;L.inspect;L.isArray;L.isBoolean;L.isBuffer;L.isDate;L.isError;L.isFunction;L.isNull;L.isNullOrUndefined;L.isNumber;L.isObject;L.isPrimitive;L.isRegExp;L.isString;L.isSymbol;L.isUndefined;L.log;L.promisify;L._extend;L.callbackify;L.debuglog;L.deprecate;L.format;L.inherits;L.inspect;L.isArray;L.isBoolean;L.isBuffer;L.isDate;L.isError;L.isFunction;L.isNull;L.isNullOrUndefined;L.isNumber;L.isObject;L.isPrimitive;L.isRegExp;L.isString;L.isSymbol;L.isUndefined;L.log;DC=L.promisify;L.types});var KC,$m=st(()=>{I();A();k();zo();L._extend;L.callbackify;L.debuglog;L.deprecate;L.format;L.inherits;L.inspect;L.isArray;L.isBoolean;L.isBuffer;L.isDate;L.isError;L.isFunction;L.isNull;L.isNullOrUndefined;L.isNumber;L.isObject;L.isPrimitive;L.isRegExp;L.isString;L.isSymbol;L.isUndefined;L.log;KC=L.promisify;L.types;L.TextEncoder=globalThis.TextEncoder;L.TextDecoder=globalThis.TextDecoder});function Ea(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function wE(){!gr||!Wn||(gr=!1,Wn.length?sn=Wn.concat(sn):qo=-1,sn.length&&Zm())}function Zm(){if(!gr){var t=setTimeout(wE,0);gr=!0;for(var e=sn.length;e;){for(Wn=sn,sn=[];++qo<e;)Wn&&Wn[qo].run();qo=-1,e=sn.length}Wn=null,gr=!1,clearTimeout(t)}}function PE(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];sn.push(new Km(t,e)),sn.length===1&&!gr&&setTimeout(Zm,0)}function Km(t,e){this.fun=t,this.array=e}function ct(){}function $E(t){Ea("_linkedBinding")}function FE(t){Ea("dlopen")}function WE(){return[]}function zE(){return[]}function tS(t,e){if(!t)throw new Error(e||"assertion error")}function oS(){return!1}function wS(){return Tn.now()/1e3}function Ba(t){var e=Math.floor((Date.now()-Tn.now())*.001),n=Tn.now()*.001,r=Math.floor(n)+e,o=Math.floor(n%1*1e9);return t&&(r=r-t[0],o=o-t[1],o<0&&(r--,o+=xa)),[r,o]}function vn(){return Nt}function MS(t){return[]}var sn,gr,Wn,qo,xE,BE,EE,SE,IE,kE,AE,CE,OE,RE,ME,NE,DE,HE,UE,jE,ZE,KE,LE,qE,GE,Sa,VE,JE,YE,XE,QE,eS,nS,rS,iS,sS,aS,lS,uS,cS,dS,fS,pS,gS,yS,mS,hS,TS,vS,_S,bS,Tn,Pa,xa,PS,xS,BS,ES,SS,IS,kS,AS,CS,OS,RS,Nt,Ia=st(()=>{I();A();k();sn=[],gr=!1,qo=-1;Km.prototype.run=function(){this.fun.apply(null,this.array)};xE="browser",BE="x64",EE="browser",SE={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},IE=["/usr/bin/node"],kE=[],AE="v16.8.0",CE={},OE=function(t,e){console.warn((e?e+": ":"")+t)},RE=function(t){Ea("binding")},ME=function(t){return 0},NE=function(){return"/"},DE=function(t){},HE={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};UE=ct,jE=[];ZE={},KE=!1,LE={};qE=ct,GE=ct,Sa=function(){return{}},VE=Sa,JE=Sa,YE=ct,XE=ct,QE=ct,eS={};nS={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},rS=ct,iS=ct;sS=ct,aS=ct,lS=ct,uS=ct,cS=ct,dS=void 0,fS=void 0,pS=void 0,gS=ct,yS=2,mS=1,hS="/bin/usr/node",TS=9229,vS="node",_S=[],bS=ct,Tn={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};Tn.now===void 0&&(Pa=Date.now(),Tn.timing&&Tn.timing.navigationStart&&(Pa=Tn.timing.navigationStart),Tn.now=()=>Date.now()-Pa);xa=1e9;Ba.bigint=function(t){var e=Ba(t);return typeof BigInt>"u"?e[0]*xa+e[1]:BigInt(e[0]*xa)+BigInt(e[1])};PS=10,xS={},BS=0;ES=vn,SS=vn,IS=vn,kS=vn,AS=vn,CS=ct,OS=vn,RS=vn;Nt={version:AE,versions:CE,arch:BE,platform:EE,release:HE,_rawDebug:UE,moduleLoadList:jE,binding:RE,_linkedBinding:$E,_events:xS,_eventsCount:BS,_maxListeners:PS,on:vn,addListener:ES,once:SS,off:IS,removeListener:kS,removeAllListeners:AS,emit:CS,prependListener:OS,prependOnceListener:RS,listeners:MS,domain:ZE,_exiting:KE,config:LE,dlopen:FE,uptime:wS,_getActiveRequests:WE,_getActiveHandles:zE,reallyExit:qE,_kill:GE,cpuUsage:Sa,resourceUsage:VE,memoryUsage:JE,kill:YE,exit:XE,openStdin:QE,allowedNodeEnvironmentFlags:eS,assert:tS,features:nS,_fatalExceptions:rS,setUncaughtExceptionCaptureCallback:iS,hasUncaughtExceptionCaptureCallback:oS,emitWarning:OE,nextTick:PE,_tickCallback:sS,_debugProcess:aS,_debugEnd:lS,_startProfilerIdleNotifier:uS,_stopProfilerIdleNotifier:cS,stdout:dS,stdin:pS,stderr:fS,abort:gS,umask:ME,chdir:DE,cwd:NE,env:SE,title:xE,argv:IE,execArgv:kE,pid:yS,ppid:mS,execPath:hS,debugPort:TS,hrtime:Ba,argv0:vS,_preload_modules:_S,setSourceMapsEnabled:bS}});function Fm(){if(Lm)return ka;Lm=!0,ka=t;function t(n,r){if(e("noDeprecation"))return n;var o=!1;function s(){if(!o){if(e("throwDeprecation"))throw new Error(r);e("traceDeprecation")?console.trace(r):console.warn(r),o=!0}return n.apply(this||Aa,arguments)}return s}function e(n){try{if(!Aa.localStorage)return!1}catch{return!1}var r=Aa.localStorage[n];return r==null?!1:String(r).toLowerCase()==="true"}return ka}var ka,Lm,Aa,Wm=st(()=>{I();A();k();ka={},Lm=!1,Aa=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global});function NS(){if(zm)return ii;zm=!0;var t=$t(),e=t.Buffer;function n(o,s){for(var i in o)s[i]=o[i]}e.from&&e.alloc&&e.allocUnsafe&&e.allocUnsafeSlow?ii=t:(n(t,ii),ii.Buffer=r);function r(o,s,i){return e(o,s,i)}return r.prototype=Object.create(e.prototype),n(e,r),r.from=function(o,s,i){if(typeof o=="number")throw new TypeError("Argument must not be a number");return e(o,s,i)},r.alloc=function(o,s,i){if(typeof o!="number")throw new TypeError("Argument must be a number");var a=e(o);return s!==void 0?typeof i=="string"?a.fill(s,i):a.fill(s):a.fill(0),a},r.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return e(o)},r.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return t.SlowBuffer(o)},ii}function DS(){if(qm)return Ca;qm=!0;var t=NS().Buffer,e=t.isEncoding||function(_){switch(_=""+_,_&&_.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function n(_){if(!_)return"utf8";for(var S;;)switch(_){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return _;default:if(S)return;_=(""+_).toLowerCase(),S=!0}}function r(_){var S=n(_);if(typeof S!="string"&&(t.isEncoding===e||!e(_)))throw new Error("Unknown encoding: "+_);return S||_}Ca.StringDecoder=o;function o(_){this.encoding=r(_);var S;switch(this.encoding){case"utf16le":this.text=y,this.end=g,S=4;break;case"utf8":this.fillLast=l,S=4;break;case"base64":this.text=h,this.end=T,S=3;break;default:this.write=x,this.end=B;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(S)}o.prototype.write=function(_){if(_.length===0)return"";var S,E;if(this.lastNeed){if(S=this.fillLast(_),S===void 0)return"";E=this.lastNeed,this.lastNeed=0}else E=0;return E<_.length?S?S+this.text(_,E):this.text(_,E):S||""},o.prototype.end=p,o.prototype.text=c,o.prototype.fillLast=function(_){if(this.lastNeed<=_.length)return _.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);_.copy(this.lastChar,this.lastTotal-this.lastNeed,0,_.length),this.lastNeed-=_.length};function s(_){return _<=127?0:_>>5===6?2:_>>4===14?3:_>>3===30?4:_>>6===2?-1:-2}function i(_,S,E){var H=S.length-1;if(H<E)return 0;var Z=s(S[H]);return Z>=0?(Z>0&&(_.lastNeed=Z-1),Z):--H<E||Z===-2?0:(Z=s(S[H]),Z>=0?(Z>0&&(_.lastNeed=Z-2),Z):--H<E||Z===-2?0:(Z=s(S[H]),Z>=0?(Z>0&&(Z===2?Z=0:_.lastNeed=Z-3),Z):0))}function a(_,S,E){if((S[0]&192)!==128)return _.lastNeed=0,"\uFFFD";if(_.lastNeed>1&&S.length>1){if((S[1]&192)!==128)return _.lastNeed=1,"\uFFFD";if(_.lastNeed>2&&S.length>2&&(S[2]&192)!==128)return _.lastNeed=2,"\uFFFD"}}function l(_){var S=this.lastTotal-this.lastNeed,E=a(this,_);if(E!==void 0)return E;if(this.lastNeed<=_.length)return _.copy(this.lastChar,S,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);_.copy(this.lastChar,S,0,_.length),this.lastNeed-=_.length}function c(_,S){var E=i(this,_,S);if(!this.lastNeed)return _.toString("utf8",S);this.lastTotal=E;var H=_.length-(E-this.lastNeed);return _.copy(this.lastChar,0,H),_.toString("utf8",S,H)}function p(_){var S=_&&_.length?this.write(_):"";return this.lastNeed?S+"\uFFFD":S}function y(_,S){if((_.length-S)%2===0){var E=_.toString("utf16le",S);if(E){var H=E.charCodeAt(E.length-1);if(H>=55296&&H<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=_[_.length-2],this.lastChar[1]=_[_.length-1],E.slice(0,-1)}return E}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=_[_.length-1],_.toString("utf16le",S,_.length-1)}function g(_){var S=_&&_.length?this.write(_):"";if(this.lastNeed){var E=this.lastTotal-this.lastNeed;return S+this.lastChar.toString("utf16le",0,E)}return S}function h(_,S){var E=(_.length-S)%3;return E===0?_.toString("base64",S):(this.lastNeed=3-E,this.lastTotal=3,E===1?this.lastChar[0]=_[_.length-1]:(this.lastChar[0]=_[_.length-2],this.lastChar[1]=_[_.length-1]),_.toString("base64",S,_.length-E))}function T(_){var S=_&&_.length?this.write(_):"";return this.lastNeed?S+this.lastChar.toString("base64",0,3-this.lastNeed):S}function x(_){return _.toString(this.encoding)}function B(_){return _&&_.length?this.write(_):""}return Ca}var ii,zm,Ca,qm,oi,nO,Gm=st(()=>{I();A();k();_i();ii={},zm=!1;Ca={},qm=!1;oi=DS();oi.StringDecoder;nO=oi.StringDecoder});function HS(){if(Vm)return Oa;Vm=!0;var t=Oa={},e,n;function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?e=setTimeout:e=r}catch{e=r}try{typeof clearTimeout=="function"?n=clearTimeout:n=o}catch{n=o}})();function s(x){if(e===setTimeout)return setTimeout(x,0);if((e===r||!e)&&setTimeout)return e=setTimeout,setTimeout(x,0);try{return e(x,0)}catch{try{return e.call(null,x,0)}catch{return e.call(this||yr,x,0)}}}function i(x){if(n===clearTimeout)return clearTimeout(x);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(x);try{return n(x)}catch{try{return n.call(null,x)}catch{return n.call(this||yr,x)}}}var a=[],l=!1,c,p=-1;function y(){!l||!c||(l=!1,c.length?a=c.concat(a):p=-1,a.length&&g())}function g(){if(!l){var x=s(y);l=!0;for(var B=a.length;B;){for(c=a,a=[];++p<B;)c&&c[p].run();p=-1,B=a.length}c=null,l=!1,i(x)}}t.nextTick=function(x){var B=new Array(arguments.length-1);if(arguments.length>1)for(var _=1;_<arguments.length;_++)B[_-1]=arguments[_];a.push(new h(x,B)),a.length===1&&!l&&s(g)};function h(x,B){(this||yr).fun=x,(this||yr).array=B}h.prototype.run=function(){(this||yr).fun.apply(null,(this||yr).array)},t.title="browser",t.browser=!0,t.env={},t.argv=[],t.version="",t.versions={};function T(){}return t.on=T,t.addListener=T,t.once=T,t.off=T,t.removeListener=T,t.removeAllListeners=T,t.emit=T,t.prependListener=T,t.prependOnceListener=T,t.listeners=function(x){return[]},t.binding=function(x){throw new Error("process.binding is not supported")},t.cwd=function(){return"/"},t.chdir=function(x){throw new Error("process.chdir is not supported")},t.umask=function(){return 0},Oa}var Oa,Vm,yr,Ke,Ra=st(()=>{I();A();k();Oa={},Vm=!1,yr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ke=HS();Ke.platform="browser";Ke.addListener;Ke.argv;Ke.binding;Ke.browser;Ke.chdir;Ke.cwd;Ke.emit;Ke.env;Ke.listeners;Ke.nextTick;Ke.off;Ke.on;Ke.once;Ke.prependListener;Ke.prependOnceListener;Ke.removeAllListeners;Ke.removeListener;Ke.title;Ke.umask;Ke.version;Ke.versions});function US(){if(Jm)return Ma;Jm=!0;var t=Ke;function e(s){if(typeof s!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(s))}function n(s,i){for(var a="",l=0,c=-1,p=0,y,g=0;g<=s.length;++g){if(g<s.length)y=s.charCodeAt(g);else{if(y===47)break;y=47}if(y===47){if(!(c===g-1||p===1))if(c!==g-1&&p===2){if(a.length<2||l!==2||a.charCodeAt(a.length-1)!==46||a.charCodeAt(a.length-2)!==46){if(a.length>2){var h=a.lastIndexOf("/");if(h!==a.length-1){h===-1?(a="",l=0):(a=a.slice(0,h),l=a.length-1-a.lastIndexOf("/")),c=g,p=0;continue}}else if(a.length===2||a.length===1){a="",l=0,c=g,p=0;continue}}i&&(a.length>0?a+="/..":a="..",l=2)}else a.length>0?a+="/"+s.slice(c+1,g):a=s.slice(c+1,g),l=g-c-1;c=g,p=0}else y===46&&p!==-1?++p:p=-1}return a}function r(s,i){var a=i.dir||i.root,l=i.base||(i.name||"")+(i.ext||"");return a?a===i.root?a+l:a+s+l:l}var o={resolve:function(){for(var i="",a=!1,l,c=arguments.length-1;c>=-1&&!a;c--){var p;c>=0?p=arguments[c]:(l===void 0&&(l=t.cwd()),p=l),e(p),p.length!==0&&(i=p+"/"+i,a=p.charCodeAt(0)===47)}return i=n(i,!a),a?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(i){if(e(i),i.length===0)return".";var a=i.charCodeAt(0)===47,l=i.charCodeAt(i.length-1)===47;return i=n(i,!a),i.length===0&&!a&&(i="."),i.length>0&&l&&(i+="/"),a?"/"+i:i},isAbsolute:function(i){return e(i),i.length>0&&i.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var i,a=0;a<arguments.length;++a){var l=arguments[a];e(l),l.length>0&&(i===void 0?i=l:i+="/"+l)}return i===void 0?".":o.normalize(i)},relative:function(i,a){if(e(i),e(a),i===a||(i=o.resolve(i),a=o.resolve(a),i===a))return"";for(var l=1;l<i.length&&i.charCodeAt(l)===47;++l);for(var c=i.length,p=c-l,y=1;y<a.length&&a.charCodeAt(y)===47;++y);for(var g=a.length,h=g-y,T=p<h?p:h,x=-1,B=0;B<=T;++B){if(B===T){if(h>T){if(a.charCodeAt(y+B)===47)return a.slice(y+B+1);if(B===0)return a.slice(y+B)}else p>T&&(i.charCodeAt(l+B)===47?x=B:B===0&&(x=0));break}var _=i.charCodeAt(l+B),S=a.charCodeAt(y+B);if(_!==S)break;_===47&&(x=B)}var E="";for(B=l+x+1;B<=c;++B)(B===c||i.charCodeAt(B)===47)&&(E.length===0?E+="..":E+="/..");return E.length>0?E+a.slice(y+x):(y+=x,a.charCodeAt(y)===47&&++y,a.slice(y))},_makeLong:function(i){return i},dirname:function(i){if(e(i),i.length===0)return".";for(var a=i.charCodeAt(0),l=a===47,c=-1,p=!0,y=i.length-1;y>=1;--y)if(a=i.charCodeAt(y),a===47){if(!p){c=y;break}}else p=!1;return c===-1?l?"/":".":l&&c===1?"//":i.slice(0,c)},basename:function(i,a){if(a!==void 0&&typeof a!="string")throw new TypeError('"ext" argument must be a string');e(i);var l=0,c=-1,p=!0,y;if(a!==void 0&&a.length>0&&a.length<=i.length){if(a.length===i.length&&a===i)return"";var g=a.length-1,h=-1;for(y=i.length-1;y>=0;--y){var T=i.charCodeAt(y);if(T===47){if(!p){l=y+1;break}}else h===-1&&(p=!1,h=y+1),g>=0&&(T===a.charCodeAt(g)?--g===-1&&(c=y):(g=-1,c=h))}return l===c?c=h:c===-1&&(c=i.length),i.slice(l,c)}else{for(y=i.length-1;y>=0;--y)if(i.charCodeAt(y)===47){if(!p){l=y+1;break}}else c===-1&&(p=!1,c=y+1);return c===-1?"":i.slice(l,c)}},extname:function(i){e(i);for(var a=-1,l=0,c=-1,p=!0,y=0,g=i.length-1;g>=0;--g){var h=i.charCodeAt(g);if(h===47){if(!p){l=g+1;break}continue}c===-1&&(p=!1,c=g+1),h===46?a===-1?a=g:y!==1&&(y=1):a!==-1&&(y=-1)}return a===-1||c===-1||y===0||y===1&&a===c-1&&a===l+1?"":i.slice(a,c)},format:function(i){if(i===null||typeof i!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof i);return r("/",i)},parse:function(i){e(i);var a={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return a;var l=i.charCodeAt(0),c=l===47,p;c?(a.root="/",p=1):p=0;for(var y=-1,g=0,h=-1,T=!0,x=i.length-1,B=0;x>=p;--x){if(l=i.charCodeAt(x),l===47){if(!T){g=x+1;break}continue}h===-1&&(T=!1,h=x+1),l===46?y===-1?y=x:B!==1&&(B=1):y!==-1&&(B=-1)}return y===-1||h===-1||B===0||B===1&&y===h-1&&y===g+1?h!==-1&&(g===0&&c?a.base=a.name=i.slice(1,h):a.base=a.name=i.slice(g,h)):(g===0&&c?(a.name=i.slice(1,y),a.base=i.slice(1,h)):(a.name=i.slice(g,y),a.base=i.slice(g,h)),a.ext=i.slice(y,h)),g>0?a.dir=i.slice(0,g-1):c&&(a.dir="/"),a},sep:"/",delimiter:":",win32:null,posix:null};return o.posix=o,Ma=o,Ma}function zn(t){throw new RangeError(KS[t])}function Xm(t,e){let n=t.split("@"),r="";n.length>1&&(r=n[0]+"@",t=n[1]);let o=(function(s,i){let a=[],l=s.length;for(;l--;)a[l]=i(s[l]);return a})((t=t.replace(ZS,".")).split("."),e).join(".");return r+o}function ah(t){let e=[],n=0,r=t.length;for(;n<r;){let o=t.charCodeAt(n++);if(o>=55296&&o<=56319&&n<r){let s=t.charCodeAt(n++);(64512&s)==56320?e.push(((1023&o)<<10)+(1023&s)+65536):(e.push(o),n--)}else e.push(o)}return e}function FS(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function kt(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function ai(t,e,n){if(t&&Lt.isObject(t)&&t instanceof kt)return t;var r=new kt;return r.parse(t,e,n),r}function eI(){if(oh)return Ua;oh=!0;var t=Ze;function e(s){if(typeof s!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(s))}function n(s,i){for(var a="",l=0,c=-1,p=0,y,g=0;g<=s.length;++g){if(g<s.length)y=s.charCodeAt(g);else{if(y===47)break;y=47}if(y===47){if(!(c===g-1||p===1))if(c!==g-1&&p===2){if(a.length<2||l!==2||a.charCodeAt(a.length-1)!==46||a.charCodeAt(a.length-2)!==46){if(a.length>2){var h=a.lastIndexOf("/");if(h!==a.length-1){h===-1?(a="",l=0):(a=a.slice(0,h),l=a.length-1-a.lastIndexOf("/")),c=g,p=0;continue}}else if(a.length===2||a.length===1){a="",l=0,c=g,p=0;continue}}i&&(a.length>0?a+="/..":a="..",l=2)}else a.length>0?a+="/"+s.slice(c+1,g):a=s.slice(c+1,g),l=g-c-1;c=g,p=0}else y===46&&p!==-1?++p:p=-1}return a}function r(s,i){var a=i.dir||i.root,l=i.base||(i.name||"")+(i.ext||"");return a?a===i.root?a+l:a+s+l:l}var o={resolve:function(){for(var i="",a=!1,l,c=arguments.length-1;c>=-1&&!a;c--){var p;c>=0?p=arguments[c]:(l===void 0&&(l=t.cwd()),p=l),e(p),p.length!==0&&(i=p+"/"+i,a=p.charCodeAt(0)===47)}return i=n(i,!a),a?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(i){if(e(i),i.length===0)return".";var a=i.charCodeAt(0)===47,l=i.charCodeAt(i.length-1)===47;return i=n(i,!a),i.length===0&&!a&&(i="."),i.length>0&&l&&(i+="/"),a?"/"+i:i},isAbsolute:function(i){return e(i),i.length>0&&i.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var i,a=0;a<arguments.length;++a){var l=arguments[a];e(l),l.length>0&&(i===void 0?i=l:i+="/"+l)}return i===void 0?".":o.normalize(i)},relative:function(i,a){if(e(i),e(a),i===a||(i=o.resolve(i),a=o.resolve(a),i===a))return"";for(var l=1;l<i.length&&i.charCodeAt(l)===47;++l);for(var c=i.length,p=c-l,y=1;y<a.length&&a.charCodeAt(y)===47;++y);for(var g=a.length,h=g-y,T=p<h?p:h,x=-1,B=0;B<=T;++B){if(B===T){if(h>T){if(a.charCodeAt(y+B)===47)return a.slice(y+B+1);if(B===0)return a.slice(y+B)}else p>T&&(i.charCodeAt(l+B)===47?x=B:B===0&&(x=0));break}var _=i.charCodeAt(l+B),S=a.charCodeAt(y+B);if(_!==S)break;_===47&&(x=B)}var E="";for(B=l+x+1;B<=c;++B)(B===c||i.charCodeAt(B)===47)&&(E.length===0?E+="..":E+="/..");return E.length>0?E+a.slice(y+x):(y+=x,a.charCodeAt(y)===47&&++y,a.slice(y))},_makeLong:function(i){return i},dirname:function(i){if(e(i),i.length===0)return".";for(var a=i.charCodeAt(0),l=a===47,c=-1,p=!0,y=i.length-1;y>=1;--y)if(a=i.charCodeAt(y),a===47){if(!p){c=y;break}}else p=!1;return c===-1?l?"/":".":l&&c===1?"//":i.slice(0,c)},basename:function(i,a){if(a!==void 0&&typeof a!="string")throw new TypeError('"ext" argument must be a string');e(i);var l=0,c=-1,p=!0,y;if(a!==void 0&&a.length>0&&a.length<=i.length){if(a.length===i.length&&a===i)return"";var g=a.length-1,h=-1;for(y=i.length-1;y>=0;--y){var T=i.charCodeAt(y);if(T===47){if(!p){l=y+1;break}}else h===-1&&(p=!1,h=y+1),g>=0&&(T===a.charCodeAt(g)?--g===-1&&(c=y):(g=-1,c=h))}return l===c?c=h:c===-1&&(c=i.length),i.slice(l,c)}else{for(y=i.length-1;y>=0;--y)if(i.charCodeAt(y)===47){if(!p){l=y+1;break}}else c===-1&&(p=!1,c=y+1);return c===-1?"":i.slice(l,c)}},extname:function(i){e(i);for(var a=-1,l=0,c=-1,p=!0,y=0,g=i.length-1;g>=0;--g){var h=i.charCodeAt(g);if(h===47){if(!p){l=g+1;break}continue}c===-1&&(p=!1,c=g+1),h===46?a===-1?a=g:y!==1&&(y=1):a!==-1&&(y=-1)}return a===-1||c===-1||y===0||y===1&&a===c-1&&a===l+1?"":i.slice(a,c)},format:function(i){if(i===null||typeof i!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof i);return r("/",i)},parse:function(i){e(i);var a={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return a;var l=i.charCodeAt(0),c=l===47,p;c?(a.root="/",p=1):p=0;for(var y=-1,g=0,h=-1,T=!0,x=i.length-1,B=0;x>=p;--x){if(l=i.charCodeAt(x),l===47){if(!T){g=x+1;break}continue}h===-1&&(T=!1,h=x+1),l===46?y===-1?y=x:B!==1&&(B=1):y!==-1&&(B=-1)}return y===-1||h===-1||B===0||B===1&&y===h-1&&y===g+1?h!==-1&&(g===0&&c?a.base=a.name=i.slice(1,h):a.base=a.name=i.slice(g,h)):(g===0&&c?(a.name=i.slice(1,y),a.base=i.slice(1,h)):(a.name=i.slice(g,y),a.base=i.slice(g,h)),a.ext=i.slice(y,h)),g>0?a.dir=i.slice(0,g-1):c&&(a.dir="/"),a},sep:"/",delimiter:":",win32:null,posix:null};return o.posix=o,Ua=o,Ua}function fI(t){if(typeof t=="string")t=new URL(t);else if(!(t instanceof URL))throw new Deno.errors.InvalidData("invalid argument path , must be a string or URL");if(t.protocol!=="file:")throw new Deno.errors.InvalidData("invalid url scheme");return $a?pI(t):gI(t)}function pI(t){let e=t.hostname,n=t.pathname;for(let r=0;r<n.length;r++)if(n[r]==="%"){let o=n.codePointAt(r+2)||32;if(n[r+1]==="2"&&o===102||n[r+1]==="5"&&o===99)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(n=n.replace(sI,"\\"),n=decodeURIComponent(n),e!=="")return`\\\\${e}${n}`;{let r=n.codePointAt(1)|32,o=n[2];if(r<iI||r>oI||o!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return n.slice(1)}}function gI(t){if(t.hostname!=="")throw new Deno.errors.InvalidData("invalid file url hostname");let e=t.pathname;for(let n=0;n<e.length;n++)if(e[n]==="%"){let r=e.codePointAt(n+2)||32;if(e[n+1]==="2"&&r===102)throw new Deno.errors.InvalidData("must not include encoded / characters")}return decodeURIComponent(e)}function yI(t){let e=sh.resolve(t),n=t.charCodeAt(t.length-1);(n===rI||$a&&n===nI)&&e[e.length-1]!==sh.sep&&(e+="/");let r=new URL("file://");return e.includes("%")&&(e=e.replace(aI,"%25")),!$a&&e.includes("\\")&&(e=e.replace(lI,"%5C")),e.includes(`
10
+ `)):a=t.stylize("[Circular]","special")),Ln(i)){if(s&&o.match(/^\d+$/))return a;(i=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(i=i.substr(1,i.length-2),i=t.stylize(i,"name")):(i=i.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),i=t.stylize(i,"string"))}return i+": "+a}function Hm(t){return Array.isArray(t)}function ba(t){return typeof t=="boolean"}function Wo(t){return t===null}function Um(t){return typeof t=="number"}function Ko(t){return typeof t=="string"}function Ln(t){return t===void 0}function ti(t){return pr(t)&&wa(t)==="[object RegExp]"}function pr(t){return typeof t=="object"&&t!==null}function Lo(t){return pr(t)&&wa(t)==="[object Date]"}function ni(t){return pr(t)&&(wa(t)==="[object Error]"||t instanceof Error)}function Ho(t){return typeof t=="function"}function wa(t){return Object.prototype.toString.call(t)}function ma(t){return t<10?"0"+t.toString(10):t.toString(10)}function _E(){var t=new Date,e=[ma(t.getHours()),ma(t.getMinutes()),ma(t.getSeconds())].join(":");return[t.getDate(),vE[t.getMonth()],e].join(" ")}function jm(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function bE(t,e){if(!t){var n=new Error("Promise was rejected with a falsy value");n.reason=t,t=n}return e(t)}var hm,nn,rn,fr,Qe,Kn,on,dr,Do,Ze,YB,va,Fo,_m,XB,QB,eE,tE,nE,bm,wm,sm,rE,iE,oE,Pm,Ee,sE,aE,lE,xm,_a,Bt,wt,uE,We,dE,fE,pE,ei,L,Kt,mm,mE,Mo,Dm,No,vE,Zn,DC,zo=st(()=>{I();A();k();fr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,Qe=hm={};(function(){try{nn=typeof setTimeout=="function"?setTimeout:ha}catch{nn=ha}try{rn=typeof clearTimeout=="function"?clearTimeout:Ta}catch{rn=Ta}})();on=[],dr=!1,Do=-1;Qe.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];on.push(new om(t,e)),on.length!==1||dr||Tm(vm)},om.prototype.run=function(){(this||fr).fun.apply(null,(this||fr).array)},Qe.title="browser",Qe.browser=!0,Qe.env={},Qe.argv=[],Qe.version="",Qe.versions={},Qe.on=tn,Qe.addListener=tn,Qe.once=tn,Qe.off=tn,Qe.removeListener=tn,Qe.removeAllListeners=tn,Qe.emit=tn,Qe.prependListener=tn,Qe.prependOnceListener=tn,Qe.listeners=function(t){return[]},Qe.binding=function(t){throw new Error("process.binding is not supported")},Qe.cwd=function(){return"/"},Qe.chdir=function(t){throw new Error("process.chdir is not supported")},Qe.umask=function(){return 0};Ze=hm;Ze.addListener;Ze.argv;Ze.binding;Ze.browser;Ze.chdir;Ze.cwd;Ze.emit;Ze.env;Ze.listeners;Ze.nextTick;Ze.off;Ze.on;Ze.once;Ze.prependListener;Ze.prependOnceListener;Ze.removeAllListeners;Ze.removeListener;Ze.title;Ze.umask;Ze.version;Ze.versions;YB=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",va=Object.prototype.toString,Fo=function(t){return!(YB&&t&&typeof t=="object"&&Symbol.toStringTag in t)&&va.call(t)==="[object Arguments]"},_m=function(t){return!!Fo(t)||t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&va.call(t)!=="[object Array]"&&va.call(t.callee)==="[object Function]"},XB=(function(){return Fo(arguments)})();Fo.isLegacyArguments=_m;QB=XB?Fo:_m,eE=Object.prototype.toString,tE=Function.prototype.toString,nE=/^\s*(?:function)?\*/,bm=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",wm=Object.getPrototypeOf,sm=(function(){if(!bm)return!1;try{return Function("return function*() {}")()}catch{}})(),rE=sm?wm(sm):{},iE=function(t){return typeof t=="function"&&(!!nE.test(tE.call(t))||(bm?wm(t)===rE:eE.call(t)==="[object GeneratorFunction]"))},oE=typeof Object.create=="function"?function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},Pm=function(t){return t&&typeof t=="object"&&typeof t.copy=="function"&&typeof t.fill=="function"&&typeof t.readUInt8=="function"},Ee={},sE=Pm,aE=QB,lE=iE;xm=typeof BigInt<"u",_a=typeof Symbol<"u",Bt=_a&&Symbol.toStringTag!==void 0,wt=typeof Uint8Array<"u",uE=typeof ArrayBuffer<"u";if(wt&&Bt)var cE=Object.getPrototypeOf(Uint8Array.prototype),It=Fn(Object.getOwnPropertyDescriptor(cE,Symbol.toStringTag).get);We=Fn(Object.prototype.toString),dE=Fn(Number.prototype.valueOf),fE=Fn(String.prototype.valueOf),pE=Fn(Boolean.prototype.valueOf);if(xm)var gE=Fn(BigInt.prototype.valueOf);if(_a)var yE=Fn(Symbol.prototype.valueOf);Ee.isArgumentsObject=aE,Ee.isGeneratorFunction=lE,Ee.isPromise=function(t){return typeof Promise<"u"&&t instanceof Promise||t!==null&&typeof t=="object"&&typeof t.then=="function"&&typeof t.catch=="function"},Ee.isArrayBufferView=function(t){return uE&&ArrayBuffer.isView?ArrayBuffer.isView(t):am(t)||um(t)},Ee.isTypedArray=am,Ee.isUint8Array=Bm,Ee.isUint8ClampedArray=Em,Ee.isUint16Array=Sm,Ee.isUint32Array=Im,Ee.isInt8Array=km,Ee.isInt16Array=Am,Ee.isInt32Array=Cm,Ee.isFloat32Array=Om,Ee.isFloat64Array=Rm,Ee.isBigInt64Array=Mm,Ee.isBigUint64Array=Nm,Co.working=typeof Map<"u"&&Co(new Map),Ee.isMap=function(t){return typeof Map<"u"&&(Co.working?Co(t):t instanceof Map)},Oo.working=typeof Set<"u"&&Oo(new Set),Ee.isSet=function(t){return typeof Set<"u"&&(Oo.working?Oo(t):t instanceof Set)},Ro.working=typeof WeakMap<"u"&&Ro(new WeakMap),Ee.isWeakMap=function(t){return typeof WeakMap<"u"&&(Ro.working?Ro(t):t instanceof WeakMap)},pa.working=typeof WeakSet<"u"&&pa(new WeakSet),Ee.isWeakSet=function(t){return pa(t)},Uo.working=typeof ArrayBuffer<"u"&&Uo(new ArrayBuffer),Ee.isArrayBuffer=lm,jo.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&jo(new DataView(new ArrayBuffer(1),0,1)),Ee.isDataView=um,$o.working=typeof SharedArrayBuffer<"u"&&$o(new SharedArrayBuffer),Ee.isSharedArrayBuffer=cm,Ee.isAsyncFunction=function(t){return We(t)==="[object AsyncFunction]"},Ee.isMapIterator=function(t){return We(t)==="[object Map Iterator]"},Ee.isSetIterator=function(t){return We(t)==="[object Set Iterator]"},Ee.isGeneratorObject=function(t){return We(t)==="[object Generator]"},Ee.isWebAssemblyCompiledModule=function(t){return We(t)==="[object WebAssembly.Module]"},Ee.isNumberObject=dm,Ee.isStringObject=fm,Ee.isBooleanObject=pm,Ee.isBigIntObject=gm,Ee.isSymbolObject=ym,Ee.isBoxedPrimitive=function(t){return dm(t)||fm(t)||pm(t)||gm(t)||ym(t)},Ee.isAnyArrayBuffer=function(t){return wt&&(lm(t)||cm(t))},["isProxy","isExternal","isModuleNamespaceObject"].forEach((function(t){Object.defineProperty(Ee,t,{enumerable:!1,value:function(){throw new Error(t+" is not supported in userland")}})}));ei=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,L={},Kt=Ze,mm=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),n={},r=0;r<e.length;r++)n[e[r]]=Object.getOwnPropertyDescriptor(t,e[r]);return n},mE=/%[sdj%]/g;L.format=function(t){if(!Ko(t)){for(var e=[],n=0;n<arguments.length;n++)e.push(hn(arguments[n]));return e.join(" ")}n=1;for(var r=arguments,o=r.length,s=String(t).replace(mE,(function(a){if(a==="%%")return"%";if(n>=o)return a;switch(a){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch{return"[Circular]"}default:return a}})),i=r[n];n<o;i=r[++n])Wo(i)||!pr(i)?s+=" "+i:s+=" "+hn(i);return s},L.deprecate=function(t,e){if(Kt!==void 0&&Kt.noDeprecation===!0)return t;if(Kt===void 0)return function(){return L.deprecate(t,e).apply(this||ei,arguments)};var n=!1;return function(){if(!n){if(Kt.throwDeprecation)throw new Error(e);Kt.traceDeprecation?console.trace(e):console.error(e),n=!0}return t.apply(this||ei,arguments)}};Mo={},Dm=/^$/;Kt.env.NODE_DEBUG&&(No=Kt.env.NODE_DEBUG,No=No.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),Dm=new RegExp("^"+No+"$","i"));L.debuglog=function(t){if(t=t.toUpperCase(),!Mo[t])if(Dm.test(t)){var e=Kt.pid;Mo[t]=function(){var n=L.format.apply(L,arguments);console.error("%s %d: %s",t,e,n)}}else Mo[t]=function(){};return Mo[t]},L.inspect=hn,hn.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},hn.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},L.types=Ee,L.isArray=Hm,L.isBoolean=ba,L.isNull=Wo,L.isNullOrUndefined=function(t){return t==null},L.isNumber=Um,L.isString=Ko,L.isSymbol=function(t){return typeof t=="symbol"},L.isUndefined=Ln,L.isRegExp=ti,L.types.isRegExp=ti,L.isObject=pr,L.isDate=Lo,L.types.isDate=Lo,L.isError=ni,L.types.isNativeError=ni,L.isFunction=Ho,L.isPrimitive=function(t){return t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||typeof t=="symbol"||t===void 0},L.isBuffer=Pm;vE=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];L.log=function(){console.log("%s - %s",_E(),L.format.apply(L,arguments))},L.inherits=oE,L._extend=function(t,e){if(!e||!pr(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t};Zn=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;L.promisify=function(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');if(Zn&&t[Zn]){var e;if(typeof(e=t[Zn])!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,Zn,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var n,r,o=new Promise((function(a,l){n=a,r=l})),s=[],i=0;i<arguments.length;i++)s.push(arguments[i]);s.push((function(a,l){a?r(a):n(l)}));try{t.apply(this||ei,s)}catch(a){r(a)}return o}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Zn&&Object.defineProperty(e,Zn,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,mm(t))},L.promisify.custom=Zn,L.callbackify=function(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');function e(){for(var n=[],r=0;r<arguments.length;r++)n.push(arguments[r]);var o=n.pop();if(typeof o!="function")throw new TypeError("The last argument must be of type Function");var s=this||ei,i=function(){return o.apply(s,arguments)};t.apply(this||ei,n).then((function(a){Kt.nextTick(i.bind(null,null,a))}),(function(a){Kt.nextTick(bE.bind(null,a,i))}))}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Object.defineProperties(e,mm(t)),e};L._extend;L.callbackify;L.debuglog;L.deprecate;L.format;L.inherits;L.inspect;L.isArray;L.isBoolean;L.isBuffer;L.isDate;L.isError;L.isFunction;L.isNull;L.isNullOrUndefined;L.isNumber;L.isObject;L.isPrimitive;L.isRegExp;L.isString;L.isSymbol;L.isUndefined;L.log;L.promisify;L._extend;L.callbackify;L.debuglog;L.deprecate;L.format;L.inherits;L.inspect;L.isArray;L.isBoolean;L.isBuffer;L.isDate;L.isError;L.isFunction;L.isNull;L.isNullOrUndefined;L.isNumber;L.isObject;L.isPrimitive;L.isRegExp;L.isString;L.isSymbol;L.isUndefined;L.log;DC=L.promisify;L.types});var KC,$m=st(()=>{I();A();k();zo();L._extend;L.callbackify;L.debuglog;L.deprecate;L.format;L.inherits;L.inspect;L.isArray;L.isBoolean;L.isBuffer;L.isDate;L.isError;L.isFunction;L.isNull;L.isNullOrUndefined;L.isNumber;L.isObject;L.isPrimitive;L.isRegExp;L.isString;L.isSymbol;L.isUndefined;L.log;KC=L.promisify;L.types;L.TextEncoder=globalThis.TextEncoder;L.TextDecoder=globalThis.TextDecoder});function Ea(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function wE(){!gr||!Wn||(gr=!1,Wn.length?sn=Wn.concat(sn):qo=-1,sn.length&&Zm())}function Zm(){if(!gr){var t=setTimeout(wE,0);gr=!0;for(var e=sn.length;e;){for(Wn=sn,sn=[];++qo<e;)Wn&&Wn[qo].run();qo=-1,e=sn.length}Wn=null,gr=!1,clearTimeout(t)}}function PE(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];sn.push(new Km(t,e)),sn.length===1&&!gr&&setTimeout(Zm,0)}function Km(t,e){this.fun=t,this.array=e}function ct(){}function $E(t){Ea("_linkedBinding")}function FE(t){Ea("dlopen")}function WE(){return[]}function zE(){return[]}function tS(t,e){if(!t)throw new Error(e||"assertion error")}function oS(){return!1}function wS(){return Tn.now()/1e3}function Ba(t){var e=Math.floor((Date.now()-Tn.now())*.001),n=Tn.now()*.001,r=Math.floor(n)+e,o=Math.floor(n%1*1e9);return t&&(r=r-t[0],o=o-t[1],o<0&&(r--,o+=xa)),[r,o]}function vn(){return Nt}function MS(t){return[]}var sn,gr,Wn,qo,xE,BE,EE,SE,IE,kE,AE,CE,OE,RE,ME,NE,DE,HE,UE,jE,ZE,KE,LE,qE,GE,Sa,VE,JE,YE,XE,QE,eS,nS,rS,iS,sS,aS,lS,uS,cS,dS,fS,pS,gS,yS,mS,hS,TS,vS,_S,bS,Tn,Pa,xa,PS,xS,BS,ES,SS,IS,kS,AS,CS,OS,RS,Nt,Ia=st(()=>{I();A();k();sn=[],gr=!1,qo=-1;Km.prototype.run=function(){this.fun.apply(null,this.array)};xE="browser",BE="x64",EE="browser",SE={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},IE=["/usr/bin/node"],kE=[],AE="v16.8.0",CE={},OE=function(t,e){console.warn((e?e+": ":"")+t)},RE=function(t){Ea("binding")},ME=function(t){return 0},NE=function(){return"/"},DE=function(t){},HE={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};UE=ct,jE=[];ZE={},KE=!1,LE={};qE=ct,GE=ct,Sa=function(){return{}},VE=Sa,JE=Sa,YE=ct,XE=ct,QE=ct,eS={};nS={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},rS=ct,iS=ct;sS=ct,aS=ct,lS=ct,uS=ct,cS=ct,dS=void 0,fS=void 0,pS=void 0,gS=ct,yS=2,mS=1,hS="/bin/usr/node",TS=9229,vS="node",_S=[],bS=ct,Tn={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};Tn.now===void 0&&(Pa=Date.now(),Tn.timing&&Tn.timing.navigationStart&&(Pa=Tn.timing.navigationStart),Tn.now=()=>Date.now()-Pa);xa=1e9;Ba.bigint=function(t){var e=Ba(t);return typeof BigInt>"u"?e[0]*xa+e[1]:BigInt(e[0]*xa)+BigInt(e[1])};PS=10,xS={},BS=0;ES=vn,SS=vn,IS=vn,kS=vn,AS=vn,CS=ct,OS=vn,RS=vn;Nt={version:AE,versions:CE,arch:BE,platform:EE,release:HE,_rawDebug:UE,moduleLoadList:jE,binding:RE,_linkedBinding:$E,_events:xS,_eventsCount:BS,_maxListeners:PS,on:vn,addListener:ES,once:SS,off:IS,removeListener:kS,removeAllListeners:AS,emit:CS,prependListener:OS,prependOnceListener:RS,listeners:MS,domain:ZE,_exiting:KE,config:LE,dlopen:FE,uptime:wS,_getActiveRequests:WE,_getActiveHandles:zE,reallyExit:qE,_kill:GE,cpuUsage:Sa,resourceUsage:VE,memoryUsage:JE,kill:YE,exit:XE,openStdin:QE,allowedNodeEnvironmentFlags:eS,assert:tS,features:nS,_fatalExceptions:rS,setUncaughtExceptionCaptureCallback:iS,hasUncaughtExceptionCaptureCallback:oS,emitWarning:OE,nextTick:PE,_tickCallback:sS,_debugProcess:aS,_debugEnd:lS,_startProfilerIdleNotifier:uS,_stopProfilerIdleNotifier:cS,stdout:dS,stdin:pS,stderr:fS,abort:gS,umask:ME,chdir:DE,cwd:NE,env:SE,title:xE,argv:IE,execArgv:kE,pid:yS,ppid:mS,execPath:hS,debugPort:TS,hrtime:Ba,argv0:vS,_preload_modules:_S,setSourceMapsEnabled:bS}});function Fm(){if(Lm)return ka;Lm=!0,ka=t;function t(n,r){if(e("noDeprecation"))return n;var o=!1;function s(){if(!o){if(e("throwDeprecation"))throw new Error(r);e("traceDeprecation")?console.trace(r):console.warn(r),o=!0}return n.apply(this||Aa,arguments)}return s}function e(n){try{if(!Aa.localStorage)return!1}catch{return!1}var r=Aa.localStorage[n];return r==null?!1:String(r).toLowerCase()==="true"}return ka}var ka,Lm,Aa,Wm=st(()=>{I();A();k();ka={},Lm=!1,Aa=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global});function NS(){if(zm)return ii;zm=!0;var t=$t(),e=t.Buffer;function n(o,s){for(var i in o)s[i]=o[i]}e.from&&e.alloc&&e.allocUnsafe&&e.allocUnsafeSlow?ii=t:(n(t,ii),ii.Buffer=r);function r(o,s,i){return e(o,s,i)}return r.prototype=Object.create(e.prototype),n(e,r),r.from=function(o,s,i){if(typeof o=="number")throw new TypeError("Argument must not be a number");return e(o,s,i)},r.alloc=function(o,s,i){if(typeof o!="number")throw new TypeError("Argument must be a number");var a=e(o);return s!==void 0?typeof i=="string"?a.fill(s,i):a.fill(s):a.fill(0),a},r.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return e(o)},r.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return t.SlowBuffer(o)},ii}function DS(){if(qm)return Ca;qm=!0;var t=NS().Buffer,e=t.isEncoding||function(_){switch(_=""+_,_&&_.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function n(_){if(!_)return"utf8";for(var S;;)switch(_){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return _;default:if(S)return;_=(""+_).toLowerCase(),S=!0}}function r(_){var S=n(_);if(typeof S!="string"&&(t.isEncoding===e||!e(_)))throw new Error("Unknown encoding: "+_);return S||_}Ca.StringDecoder=o;function o(_){this.encoding=r(_);var S;switch(this.encoding){case"utf16le":this.text=y,this.end=g,S=4;break;case"utf8":this.fillLast=l,S=4;break;case"base64":this.text=h,this.end=T,S=3;break;default:this.write=x,this.end=B;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(S)}o.prototype.write=function(_){if(_.length===0)return"";var S,E;if(this.lastNeed){if(S=this.fillLast(_),S===void 0)return"";E=this.lastNeed,this.lastNeed=0}else E=0;return E<_.length?S?S+this.text(_,E):this.text(_,E):S||""},o.prototype.end=f,o.prototype.text=c,o.prototype.fillLast=function(_){if(this.lastNeed<=_.length)return _.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);_.copy(this.lastChar,this.lastTotal-this.lastNeed,0,_.length),this.lastNeed-=_.length};function s(_){return _<=127?0:_>>5===6?2:_>>4===14?3:_>>3===30?4:_>>6===2?-1:-2}function i(_,S,E){var H=S.length-1;if(H<E)return 0;var Z=s(S[H]);return Z>=0?(Z>0&&(_.lastNeed=Z-1),Z):--H<E||Z===-2?0:(Z=s(S[H]),Z>=0?(Z>0&&(_.lastNeed=Z-2),Z):--H<E||Z===-2?0:(Z=s(S[H]),Z>=0?(Z>0&&(Z===2?Z=0:_.lastNeed=Z-3),Z):0))}function a(_,S,E){if((S[0]&192)!==128)return _.lastNeed=0,"\uFFFD";if(_.lastNeed>1&&S.length>1){if((S[1]&192)!==128)return _.lastNeed=1,"\uFFFD";if(_.lastNeed>2&&S.length>2&&(S[2]&192)!==128)return _.lastNeed=2,"\uFFFD"}}function l(_){var S=this.lastTotal-this.lastNeed,E=a(this,_);if(E!==void 0)return E;if(this.lastNeed<=_.length)return _.copy(this.lastChar,S,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);_.copy(this.lastChar,S,0,_.length),this.lastNeed-=_.length}function c(_,S){var E=i(this,_,S);if(!this.lastNeed)return _.toString("utf8",S);this.lastTotal=E;var H=_.length-(E-this.lastNeed);return _.copy(this.lastChar,0,H),_.toString("utf8",S,H)}function f(_){var S=_&&_.length?this.write(_):"";return this.lastNeed?S+"\uFFFD":S}function y(_,S){if((_.length-S)%2===0){var E=_.toString("utf16le",S);if(E){var H=E.charCodeAt(E.length-1);if(H>=55296&&H<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=_[_.length-2],this.lastChar[1]=_[_.length-1],E.slice(0,-1)}return E}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=_[_.length-1],_.toString("utf16le",S,_.length-1)}function g(_){var S=_&&_.length?this.write(_):"";if(this.lastNeed){var E=this.lastTotal-this.lastNeed;return S+this.lastChar.toString("utf16le",0,E)}return S}function h(_,S){var E=(_.length-S)%3;return E===0?_.toString("base64",S):(this.lastNeed=3-E,this.lastTotal=3,E===1?this.lastChar[0]=_[_.length-1]:(this.lastChar[0]=_[_.length-2],this.lastChar[1]=_[_.length-1]),_.toString("base64",S,_.length-E))}function T(_){var S=_&&_.length?this.write(_):"";return this.lastNeed?S+this.lastChar.toString("base64",0,3-this.lastNeed):S}function x(_){return _.toString(this.encoding)}function B(_){return _&&_.length?this.write(_):""}return Ca}var ii,zm,Ca,qm,oi,nO,Gm=st(()=>{I();A();k();_i();ii={},zm=!1;Ca={},qm=!1;oi=DS();oi.StringDecoder;nO=oi.StringDecoder});function HS(){if(Vm)return Oa;Vm=!0;var t=Oa={},e,n;function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?e=setTimeout:e=r}catch{e=r}try{typeof clearTimeout=="function"?n=clearTimeout:n=o}catch{n=o}})();function s(x){if(e===setTimeout)return setTimeout(x,0);if((e===r||!e)&&setTimeout)return e=setTimeout,setTimeout(x,0);try{return e(x,0)}catch{try{return e.call(null,x,0)}catch{return e.call(this||yr,x,0)}}}function i(x){if(n===clearTimeout)return clearTimeout(x);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(x);try{return n(x)}catch{try{return n.call(null,x)}catch{return n.call(this||yr,x)}}}var a=[],l=!1,c,f=-1;function y(){!l||!c||(l=!1,c.length?a=c.concat(a):f=-1,a.length&&g())}function g(){if(!l){var x=s(y);l=!0;for(var B=a.length;B;){for(c=a,a=[];++f<B;)c&&c[f].run();f=-1,B=a.length}c=null,l=!1,i(x)}}t.nextTick=function(x){var B=new Array(arguments.length-1);if(arguments.length>1)for(var _=1;_<arguments.length;_++)B[_-1]=arguments[_];a.push(new h(x,B)),a.length===1&&!l&&s(g)};function h(x,B){(this||yr).fun=x,(this||yr).array=B}h.prototype.run=function(){(this||yr).fun.apply(null,(this||yr).array)},t.title="browser",t.browser=!0,t.env={},t.argv=[],t.version="",t.versions={};function T(){}return t.on=T,t.addListener=T,t.once=T,t.off=T,t.removeListener=T,t.removeAllListeners=T,t.emit=T,t.prependListener=T,t.prependOnceListener=T,t.listeners=function(x){return[]},t.binding=function(x){throw new Error("process.binding is not supported")},t.cwd=function(){return"/"},t.chdir=function(x){throw new Error("process.chdir is not supported")},t.umask=function(){return 0},Oa}var Oa,Vm,yr,Ke,Ra=st(()=>{I();A();k();Oa={},Vm=!1,yr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ke=HS();Ke.platform="browser";Ke.addListener;Ke.argv;Ke.binding;Ke.browser;Ke.chdir;Ke.cwd;Ke.emit;Ke.env;Ke.listeners;Ke.nextTick;Ke.off;Ke.on;Ke.once;Ke.prependListener;Ke.prependOnceListener;Ke.removeAllListeners;Ke.removeListener;Ke.title;Ke.umask;Ke.version;Ke.versions});function US(){if(Jm)return Ma;Jm=!0;var t=Ke;function e(s){if(typeof s!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(s))}function n(s,i){for(var a="",l=0,c=-1,f=0,y,g=0;g<=s.length;++g){if(g<s.length)y=s.charCodeAt(g);else{if(y===47)break;y=47}if(y===47){if(!(c===g-1||f===1))if(c!==g-1&&f===2){if(a.length<2||l!==2||a.charCodeAt(a.length-1)!==46||a.charCodeAt(a.length-2)!==46){if(a.length>2){var h=a.lastIndexOf("/");if(h!==a.length-1){h===-1?(a="",l=0):(a=a.slice(0,h),l=a.length-1-a.lastIndexOf("/")),c=g,f=0;continue}}else if(a.length===2||a.length===1){a="",l=0,c=g,f=0;continue}}i&&(a.length>0?a+="/..":a="..",l=2)}else a.length>0?a+="/"+s.slice(c+1,g):a=s.slice(c+1,g),l=g-c-1;c=g,f=0}else y===46&&f!==-1?++f:f=-1}return a}function r(s,i){var a=i.dir||i.root,l=i.base||(i.name||"")+(i.ext||"");return a?a===i.root?a+l:a+s+l:l}var o={resolve:function(){for(var i="",a=!1,l,c=arguments.length-1;c>=-1&&!a;c--){var f;c>=0?f=arguments[c]:(l===void 0&&(l=t.cwd()),f=l),e(f),f.length!==0&&(i=f+"/"+i,a=f.charCodeAt(0)===47)}return i=n(i,!a),a?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(i){if(e(i),i.length===0)return".";var a=i.charCodeAt(0)===47,l=i.charCodeAt(i.length-1)===47;return i=n(i,!a),i.length===0&&!a&&(i="."),i.length>0&&l&&(i+="/"),a?"/"+i:i},isAbsolute:function(i){return e(i),i.length>0&&i.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var i,a=0;a<arguments.length;++a){var l=arguments[a];e(l),l.length>0&&(i===void 0?i=l:i+="/"+l)}return i===void 0?".":o.normalize(i)},relative:function(i,a){if(e(i),e(a),i===a||(i=o.resolve(i),a=o.resolve(a),i===a))return"";for(var l=1;l<i.length&&i.charCodeAt(l)===47;++l);for(var c=i.length,f=c-l,y=1;y<a.length&&a.charCodeAt(y)===47;++y);for(var g=a.length,h=g-y,T=f<h?f:h,x=-1,B=0;B<=T;++B){if(B===T){if(h>T){if(a.charCodeAt(y+B)===47)return a.slice(y+B+1);if(B===0)return a.slice(y+B)}else f>T&&(i.charCodeAt(l+B)===47?x=B:B===0&&(x=0));break}var _=i.charCodeAt(l+B),S=a.charCodeAt(y+B);if(_!==S)break;_===47&&(x=B)}var E="";for(B=l+x+1;B<=c;++B)(B===c||i.charCodeAt(B)===47)&&(E.length===0?E+="..":E+="/..");return E.length>0?E+a.slice(y+x):(y+=x,a.charCodeAt(y)===47&&++y,a.slice(y))},_makeLong:function(i){return i},dirname:function(i){if(e(i),i.length===0)return".";for(var a=i.charCodeAt(0),l=a===47,c=-1,f=!0,y=i.length-1;y>=1;--y)if(a=i.charCodeAt(y),a===47){if(!f){c=y;break}}else f=!1;return c===-1?l?"/":".":l&&c===1?"//":i.slice(0,c)},basename:function(i,a){if(a!==void 0&&typeof a!="string")throw new TypeError('"ext" argument must be a string');e(i);var l=0,c=-1,f=!0,y;if(a!==void 0&&a.length>0&&a.length<=i.length){if(a.length===i.length&&a===i)return"";var g=a.length-1,h=-1;for(y=i.length-1;y>=0;--y){var T=i.charCodeAt(y);if(T===47){if(!f){l=y+1;break}}else h===-1&&(f=!1,h=y+1),g>=0&&(T===a.charCodeAt(g)?--g===-1&&(c=y):(g=-1,c=h))}return l===c?c=h:c===-1&&(c=i.length),i.slice(l,c)}else{for(y=i.length-1;y>=0;--y)if(i.charCodeAt(y)===47){if(!f){l=y+1;break}}else c===-1&&(f=!1,c=y+1);return c===-1?"":i.slice(l,c)}},extname:function(i){e(i);for(var a=-1,l=0,c=-1,f=!0,y=0,g=i.length-1;g>=0;--g){var h=i.charCodeAt(g);if(h===47){if(!f){l=g+1;break}continue}c===-1&&(f=!1,c=g+1),h===46?a===-1?a=g:y!==1&&(y=1):a!==-1&&(y=-1)}return a===-1||c===-1||y===0||y===1&&a===c-1&&a===l+1?"":i.slice(a,c)},format:function(i){if(i===null||typeof i!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof i);return r("/",i)},parse:function(i){e(i);var a={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return a;var l=i.charCodeAt(0),c=l===47,f;c?(a.root="/",f=1):f=0;for(var y=-1,g=0,h=-1,T=!0,x=i.length-1,B=0;x>=f;--x){if(l=i.charCodeAt(x),l===47){if(!T){g=x+1;break}continue}h===-1&&(T=!1,h=x+1),l===46?y===-1?y=x:B!==1&&(B=1):y!==-1&&(B=-1)}return y===-1||h===-1||B===0||B===1&&y===h-1&&y===g+1?h!==-1&&(g===0&&c?a.base=a.name=i.slice(1,h):a.base=a.name=i.slice(g,h)):(g===0&&c?(a.name=i.slice(1,y),a.base=i.slice(1,h)):(a.name=i.slice(g,y),a.base=i.slice(g,h)),a.ext=i.slice(y,h)),g>0?a.dir=i.slice(0,g-1):c&&(a.dir="/"),a},sep:"/",delimiter:":",win32:null,posix:null};return o.posix=o,Ma=o,Ma}function zn(t){throw new RangeError(KS[t])}function Xm(t,e){let n=t.split("@"),r="";n.length>1&&(r=n[0]+"@",t=n[1]);let o=(function(s,i){let a=[],l=s.length;for(;l--;)a[l]=i(s[l]);return a})((t=t.replace(ZS,".")).split("."),e).join(".");return r+o}function ah(t){let e=[],n=0,r=t.length;for(;n<r;){let o=t.charCodeAt(n++);if(o>=55296&&o<=56319&&n<r){let s=t.charCodeAt(n++);(64512&s)==56320?e.push(((1023&o)<<10)+(1023&s)+65536):(e.push(o),n--)}else e.push(o)}return e}function FS(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function kt(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function ai(t,e,n){if(t&&Lt.isObject(t)&&t instanceof kt)return t;var r=new kt;return r.parse(t,e,n),r}function eI(){if(oh)return Ua;oh=!0;var t=Ze;function e(s){if(typeof s!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(s))}function n(s,i){for(var a="",l=0,c=-1,f=0,y,g=0;g<=s.length;++g){if(g<s.length)y=s.charCodeAt(g);else{if(y===47)break;y=47}if(y===47){if(!(c===g-1||f===1))if(c!==g-1&&f===2){if(a.length<2||l!==2||a.charCodeAt(a.length-1)!==46||a.charCodeAt(a.length-2)!==46){if(a.length>2){var h=a.lastIndexOf("/");if(h!==a.length-1){h===-1?(a="",l=0):(a=a.slice(0,h),l=a.length-1-a.lastIndexOf("/")),c=g,f=0;continue}}else if(a.length===2||a.length===1){a="",l=0,c=g,f=0;continue}}i&&(a.length>0?a+="/..":a="..",l=2)}else a.length>0?a+="/"+s.slice(c+1,g):a=s.slice(c+1,g),l=g-c-1;c=g,f=0}else y===46&&f!==-1?++f:f=-1}return a}function r(s,i){var a=i.dir||i.root,l=i.base||(i.name||"")+(i.ext||"");return a?a===i.root?a+l:a+s+l:l}var o={resolve:function(){for(var i="",a=!1,l,c=arguments.length-1;c>=-1&&!a;c--){var f;c>=0?f=arguments[c]:(l===void 0&&(l=t.cwd()),f=l),e(f),f.length!==0&&(i=f+"/"+i,a=f.charCodeAt(0)===47)}return i=n(i,!a),a?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(i){if(e(i),i.length===0)return".";var a=i.charCodeAt(0)===47,l=i.charCodeAt(i.length-1)===47;return i=n(i,!a),i.length===0&&!a&&(i="."),i.length>0&&l&&(i+="/"),a?"/"+i:i},isAbsolute:function(i){return e(i),i.length>0&&i.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var i,a=0;a<arguments.length;++a){var l=arguments[a];e(l),l.length>0&&(i===void 0?i=l:i+="/"+l)}return i===void 0?".":o.normalize(i)},relative:function(i,a){if(e(i),e(a),i===a||(i=o.resolve(i),a=o.resolve(a),i===a))return"";for(var l=1;l<i.length&&i.charCodeAt(l)===47;++l);for(var c=i.length,f=c-l,y=1;y<a.length&&a.charCodeAt(y)===47;++y);for(var g=a.length,h=g-y,T=f<h?f:h,x=-1,B=0;B<=T;++B){if(B===T){if(h>T){if(a.charCodeAt(y+B)===47)return a.slice(y+B+1);if(B===0)return a.slice(y+B)}else f>T&&(i.charCodeAt(l+B)===47?x=B:B===0&&(x=0));break}var _=i.charCodeAt(l+B),S=a.charCodeAt(y+B);if(_!==S)break;_===47&&(x=B)}var E="";for(B=l+x+1;B<=c;++B)(B===c||i.charCodeAt(B)===47)&&(E.length===0?E+="..":E+="/..");return E.length>0?E+a.slice(y+x):(y+=x,a.charCodeAt(y)===47&&++y,a.slice(y))},_makeLong:function(i){return i},dirname:function(i){if(e(i),i.length===0)return".";for(var a=i.charCodeAt(0),l=a===47,c=-1,f=!0,y=i.length-1;y>=1;--y)if(a=i.charCodeAt(y),a===47){if(!f){c=y;break}}else f=!1;return c===-1?l?"/":".":l&&c===1?"//":i.slice(0,c)},basename:function(i,a){if(a!==void 0&&typeof a!="string")throw new TypeError('"ext" argument must be a string');e(i);var l=0,c=-1,f=!0,y;if(a!==void 0&&a.length>0&&a.length<=i.length){if(a.length===i.length&&a===i)return"";var g=a.length-1,h=-1;for(y=i.length-1;y>=0;--y){var T=i.charCodeAt(y);if(T===47){if(!f){l=y+1;break}}else h===-1&&(f=!1,h=y+1),g>=0&&(T===a.charCodeAt(g)?--g===-1&&(c=y):(g=-1,c=h))}return l===c?c=h:c===-1&&(c=i.length),i.slice(l,c)}else{for(y=i.length-1;y>=0;--y)if(i.charCodeAt(y)===47){if(!f){l=y+1;break}}else c===-1&&(f=!1,c=y+1);return c===-1?"":i.slice(l,c)}},extname:function(i){e(i);for(var a=-1,l=0,c=-1,f=!0,y=0,g=i.length-1;g>=0;--g){var h=i.charCodeAt(g);if(h===47){if(!f){l=g+1;break}continue}c===-1&&(f=!1,c=g+1),h===46?a===-1?a=g:y!==1&&(y=1):a!==-1&&(y=-1)}return a===-1||c===-1||y===0||y===1&&a===c-1&&a===l+1?"":i.slice(a,c)},format:function(i){if(i===null||typeof i!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof i);return r("/",i)},parse:function(i){e(i);var a={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return a;var l=i.charCodeAt(0),c=l===47,f;c?(a.root="/",f=1):f=0;for(var y=-1,g=0,h=-1,T=!0,x=i.length-1,B=0;x>=f;--x){if(l=i.charCodeAt(x),l===47){if(!T){g=x+1;break}continue}h===-1&&(T=!1,h=x+1),l===46?y===-1?y=x:B!==1&&(B=1):y!==-1&&(B=-1)}return y===-1||h===-1||B===0||B===1&&y===h-1&&y===g+1?h!==-1&&(g===0&&c?a.base=a.name=i.slice(1,h):a.base=a.name=i.slice(g,h)):(g===0&&c?(a.name=i.slice(1,y),a.base=i.slice(1,h)):(a.name=i.slice(g,y),a.base=i.slice(g,h)),a.ext=i.slice(y,h)),g>0?a.dir=i.slice(0,g-1):c&&(a.dir="/"),a},sep:"/",delimiter:":",win32:null,posix:null};return o.posix=o,Ua=o,Ua}function fI(t){if(typeof t=="string")t=new URL(t);else if(!(t instanceof URL))throw new Deno.errors.InvalidData("invalid argument path , must be a string or URL");if(t.protocol!=="file:")throw new Deno.errors.InvalidData("invalid url scheme");return $a?pI(t):gI(t)}function pI(t){let e=t.hostname,n=t.pathname;for(let r=0;r<n.length;r++)if(n[r]==="%"){let o=n.codePointAt(r+2)||32;if(n[r+1]==="2"&&o===102||n[r+1]==="5"&&o===99)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(n=n.replace(sI,"\\"),n=decodeURIComponent(n),e!=="")return`\\\\${e}${n}`;{let r=n.codePointAt(1)|32,o=n[2];if(r<iI||r>oI||o!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return n.slice(1)}}function gI(t){if(t.hostname!=="")throw new Deno.errors.InvalidData("invalid file url hostname");let e=t.pathname;for(let n=0;n<e.length;n++)if(e[n]==="%"){let r=e.codePointAt(n+2)||32;if(e[n+1]==="2"&&r===102)throw new Deno.errors.InvalidData("must not include encoded / characters")}return decodeURIComponent(e)}function yI(t){let e=sh.resolve(t),n=t.charCodeAt(t.length-1);(n===rI||$a&&n===nI)&&e[e.length-1]!==sh.sep&&(e+="/");let r=new URL("file://");return e.includes("%")&&(e=e.replace(aI,"%25")),!$a&&e.includes("\\")&&(e=e.replace(lI,"%5C")),e.includes(`
11
11
  `)&&(e=e.replace(uI,"%0A")),e.includes("\r")&&(e=e.replace(cI,"%0D")),e.includes(" ")&&(e=e.replace(dI,"%09")),r.pathname=e,r}function SI(t){if(typeof t=="string")t=new URL(t);else if(!(t instanceof URL))throw new Deno.errors.InvalidData("invalid argument path , must be a string or URL");if(t.protocol!=="file:")throw new Deno.errors.InvalidData("invalid url scheme");return Za?II(t):kI(t)}function II(t){let e=t.hostname,n=t.pathname;for(let r=0;r<n.length;r++)if(n[r]==="%"){let o=n.codePointAt(r+2)||32;if(n[r+1]==="2"&&o===102||n[r+1]==="5"&&o===99)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(n=n.replace(bI,"\\"),n=decodeURIComponent(n),e!=="")return`\\\\${e}${n}`;{let r=n.codePointAt(1)|32,o=n[2];if(r<vI||r>_I||o!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return n.slice(1)}}function kI(t){if(t.hostname!=="")throw new Deno.errors.InvalidData("invalid file url hostname");let e=t.pathname;for(let n=0;n<e.length;n++)if(e[n]==="%"){let r=e.codePointAt(n+2)||32;if(e[n+1]==="2"&&r===102)throw new Deno.errors.InvalidData("must not include encoded / characters")}return decodeURIComponent(e)}function AI(t){let e=Ym.resolve(t),n=t.charCodeAt(t.length-1);(n===TI||Za&&n===hI)&&e[e.length-1]!==Ym.sep&&(e+="/");let r=new URL("file://");return e.includes("%")&&(e=e.replace(wI,"%25")),!Za&&e.includes("\\")&&(e=e.replace(PI,"%5C")),e.includes(`
12
- `)&&(e=e.replace(xI,"%0A")),e.includes("\r")&&(e=e.replace(BI,"%0D")),e.includes(" ")&&(e=e.replace(EI,"%09")),r.pathname=e,r}var Ma,Jm,Ym,hr,jS,$S,ZS,KS,Ft,Na,Qm,lh,eh,th,LS,WS,si,zS,an,De,qS,Lt,GS,VS,JS,YS,ja,nh,rh,ih,XS,QS,Da,mr,Ha,Ua,oh,sh,tI,nI,rI,iI,oI,$a,sI,aI,lI,uI,cI,dI,mI,hI,TI,vI,_I,Za,bI,wI,PI,xI,BI,EI,uh=st(()=>{I();A();k();zo();Ra();Ma={},Jm=!1;Ym=US(),hr=2147483647,jS=/^xn--/,$S=/[^\0-\x7E]/,ZS=/[\x2E\u3002\uFF0E\uFF61]/g,KS={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Ft=Math.floor,Na=String.fromCharCode;Qm=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},lh=function(t,e,n){let r=0;for(t=n?Ft(t/700):t>>1,t+=Ft(t/e);t>455;r+=36)t=Ft(t/35);return Ft(r+36*t/(t+38))},eh=function(t){let e=[],n=t.length,r=0,o=128,s=72,i=t.lastIndexOf("-");i<0&&(i=0);for(let l=0;l<i;++l)t.charCodeAt(l)>=128&&zn("not-basic"),e.push(t.charCodeAt(l));for(let l=i>0?i+1:0;l<n;){let c=r;for(let y=1,g=36;;g+=36){l>=n&&zn("invalid-input");let h=(a=t.charCodeAt(l++))-48<10?a-22:a-65<26?a-65:a-97<26?a-97:36;(h>=36||h>Ft((hr-r)/y))&&zn("overflow"),r+=h*y;let T=g<=s?1:g>=s+26?26:g-s;if(h<T)break;let x=36-T;y>Ft(hr/x)&&zn("overflow"),y*=x}let p=e.length+1;s=lh(r-c,p,c==0),Ft(r/p)>hr-o&&zn("overflow"),o+=Ft(r/p),r%=p,e.splice(r++,0,o)}var a;return String.fromCodePoint(...e)},th=function(t){let e=[],n=(t=ah(t)).length,r=128,o=0,s=72;for(let l of t)l<128&&e.push(Na(l));let i=e.length,a=i;for(i&&e.push("-");a<n;){let l=hr;for(let p of t)p>=r&&p<l&&(l=p);let c=a+1;l-r>Ft((hr-o)/c)&&zn("overflow"),o+=(l-r)*c,r=l;for(let p of t)if(p<r&&++o>hr&&zn("overflow"),p==r){let y=o;for(let g=36;;g+=36){let h=g<=s?1:g>=s+26?26:g-s;if(y<h)break;let T=y-h,x=36-h;e.push(Na(Qm(h+T%x,0))),y=Ft(T/x)}e.push(Na(Qm(y,0))),s=lh(o,c,a==i),o=0,++a}++o,++r}return e.join("")},LS={version:"2.1.0",ucs2:{decode:ah,encode:t=>String.fromCodePoint(...t)},decode:eh,encode:th,toASCII:function(t){return Xm(t,(function(e){return $S.test(e)?"xn--"+th(e):e}))},toUnicode:function(t){return Xm(t,(function(e){return jS.test(e)?eh(e.slice(4).toLowerCase()):e}))}};WS=function(t,e,n,r){e=e||"&",n=n||"=";var o={};if(typeof t!="string"||t.length===0)return o;var s=/\+/g;t=t.split(e);var i=1e3;r&&typeof r.maxKeys=="number"&&(i=r.maxKeys);var a=t.length;i>0&&a>i&&(a=i);for(var l=0;l<a;++l){var c,p,y,g,h=t[l].replace(s,"%20"),T=h.indexOf(n);T>=0?(c=h.substr(0,T),p=h.substr(T+1)):(c=h,p=""),y=decodeURIComponent(c),g=decodeURIComponent(p),FS(o,y)?Array.isArray(o[y])?o[y].push(g):o[y]=[o[y],g]:o[y]=g}return o},si=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}},zS=function(t,e,n,r){return e=e||"&",n=n||"=",t===null&&(t=void 0),typeof t=="object"?Object.keys(t).map((function(o){var s=encodeURIComponent(si(o))+n;return Array.isArray(t[o])?t[o].map((function(i){return s+encodeURIComponent(si(i))})).join(e):s+encodeURIComponent(si(t[o]))})).join(e):r?encodeURIComponent(si(r))+n+encodeURIComponent(si(t)):""},an={};an.decode=an.parse=WS,an.encode=an.stringify=zS;an.decode;an.encode;an.parse;an.stringify;De={},qS=LS,Lt={isString:function(t){return typeof t=="string"},isObject:function(t){return typeof t=="object"&&t!==null},isNull:function(t){return t===null},isNullOrUndefined:function(t){return t==null}};De.parse=ai,De.resolve=function(t,e){return ai(t,!1,!0).resolve(e)},De.resolveObject=function(t,e){return t?ai(t,!1,!0).resolveObject(e):e},De.format=function(t){return Lt.isString(t)&&(t=ai(t)),t instanceof kt?t.format():kt.prototype.format.call(t)},De.Url=kt;GS=/^([a-z0-9.+-]+:)/i,VS=/:[0-9]*$/,JS=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,YS=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r",`
13
- `," "]),ja=["'"].concat(YS),nh=["%","/","?",";","#"].concat(ja),rh=["/","?","#"],ih=/^[+a-z0-9A-Z_-]{0,63}$/,XS=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,QS={javascript:!0,"javascript:":!0},Da={javascript:!0,"javascript:":!0},mr={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Ha=an;kt.prototype.parse=function(t,e,n){if(!Lt.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var r=t.indexOf("?"),o=r!==-1&&r<t.indexOf("#")?"?":"#",s=t.split(o);s[0]=s[0].replace(/\\/g,"/");var i=t=s.join(o);if(i=i.trim(),!n&&t.split("#").length===1){var a=JS.exec(i);if(a)return this.path=i,this.href=i,this.pathname=a[1],a[2]?(this.search=a[2],this.query=e?Ha.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var l=GS.exec(i);if(l){var c=(l=l[0]).toLowerCase();this.protocol=c,i=i.substr(l.length)}if(n||l||i.match(/^\/\/[^@\/]+@[^@\/]+/)){var p=i.substr(0,2)==="//";!p||l&&Da[l]||(i=i.substr(2),this.slashes=!0)}if(!Da[l]&&(p||l&&!mr[l])){for(var y,g,h=-1,T=0;T<rh.length;T++)(x=i.indexOf(rh[T]))!==-1&&(h===-1||x<h)&&(h=x);for((g=h===-1?i.lastIndexOf("@"):i.lastIndexOf("@",h))!==-1&&(y=i.slice(0,g),i=i.slice(g+1),this.auth=decodeURIComponent(y)),h=-1,T=0;T<nh.length;T++){var x;(x=i.indexOf(nh[T]))!==-1&&(h===-1||x<h)&&(h=x)}h===-1&&(h=i.length),this.host=i.slice(0,h),i=i.slice(h),this.parseHost(),this.hostname=this.hostname||"";var B=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!B)for(var _=this.hostname.split(/\./),S=(T=0,_.length);T<S;T++){var E=_[T];if(E&&!E.match(ih)){for(var H="",Z=0,re=E.length;Z<re;Z++)E.charCodeAt(Z)>127?H+="x":H+=E[Z];if(!H.match(ih)){var ee=_.slice(0,T),ge=_.slice(T+1),se=E.match(XS);se&&(ee.push(se[1]),ge.unshift(se[2])),ge.length&&(i="/"+ge.join(".")+i),this.hostname=ee.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),B||(this.hostname=qS.toASCII(this.hostname));var ie=this.port?":"+this.port:"",Oe=this.hostname||"";this.host=Oe+ie,this.href+=this.host,B&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),i[0]!=="/"&&(i="/"+i))}if(!QS[c])for(T=0,S=ja.length;T<S;T++){var ze=ja[T];if(i.indexOf(ze)!==-1){var nt=encodeURIComponent(ze);nt===ze&&(nt=escape(ze)),i=i.split(ze).join(nt)}}var Ve=i.indexOf("#");Ve!==-1&&(this.hash=i.substr(Ve),i=i.slice(0,Ve));var Je=i.indexOf("?");if(Je!==-1?(this.search=i.substr(Je),this.query=i.substr(Je+1),e&&(this.query=Ha.parse(this.query)),i=i.slice(0,Je)):e&&(this.search="",this.query={}),i&&(this.pathname=i),mr[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){ie=this.pathname||"";var Tt=this.search||"";this.path=ie+Tt}return this.href=this.format(),this},kt.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var e=this.protocol||"",n=this.pathname||"",r=this.hash||"",o=!1,s="";this.host?o=t+this.host:this.hostname&&(o=t+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&Lt.isObject(this.query)&&Object.keys(this.query).length&&(s=Ha.stringify(this.query));var i=this.search||s&&"?"+s||"";return e&&e.substr(-1)!==":"&&(e+=":"),this.slashes||(!e||mr[e])&&o!==!1?(o="//"+(o||""),n&&n.charAt(0)!=="/"&&(n="/"+n)):o||(o=""),r&&r.charAt(0)!=="#"&&(r="#"+r),i&&i.charAt(0)!=="?"&&(i="?"+i),e+o+(n=n.replace(/[?#]/g,(function(a){return encodeURIComponent(a)})))+(i=i.replace("#","%23"))+r},kt.prototype.resolve=function(t){return this.resolveObject(ai(t,!1,!0)).format()},kt.prototype.resolveObject=function(t){if(Lt.isString(t)){var e=new kt;e.parse(t,!1,!0),t=e}for(var n=new kt,r=Object.keys(this),o=0;o<r.length;o++){var s=r[o];n[s]=this[s]}if(n.hash=t.hash,t.href==="")return n.href=n.format(),n;if(t.slashes&&!t.protocol){for(var i=Object.keys(t),a=0;a<i.length;a++){var l=i[a];l!=="protocol"&&(n[l]=t[l])}return mr[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(t.protocol&&t.protocol!==n.protocol){if(!mr[t.protocol]){for(var c=Object.keys(t),p=0;p<c.length;p++){var y=c[p];n[y]=t[y]}return n.href=n.format(),n}if(n.protocol=t.protocol,t.host||Da[t.protocol])n.pathname=t.pathname;else{for(var g=(t.pathname||"").split("/");g.length&&!(t.host=g.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),g[0]!==""&&g.unshift(""),g.length<2&&g.unshift(""),n.pathname=g.join("/")}if(n.search=t.search,n.query=t.query,n.host=t.host||"",n.auth=t.auth,n.hostname=t.hostname||t.host,n.port=t.port,n.pathname||n.search){var h=n.pathname||"",T=n.search||"";n.path=h+T}return n.slashes=n.slashes||t.slashes,n.href=n.format(),n}var x=n.pathname&&n.pathname.charAt(0)==="/",B=t.host||t.pathname&&t.pathname.charAt(0)==="/",_=B||x||n.host&&t.pathname,S=_,E=n.pathname&&n.pathname.split("/")||[],H=(g=t.pathname&&t.pathname.split("/")||[],n.protocol&&!mr[n.protocol]);if(H&&(n.hostname="",n.port=null,n.host&&(E[0]===""?E[0]=n.host:E.unshift(n.host)),n.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(g[0]===""?g[0]=t.host:g.unshift(t.host)),t.host=null),_=_&&(g[0]===""||E[0]==="")),B)n.host=t.host||t.host===""?t.host:n.host,n.hostname=t.hostname||t.hostname===""?t.hostname:n.hostname,n.search=t.search,n.query=t.query,E=g;else if(g.length)E||(E=[]),E.pop(),E=E.concat(g),n.search=t.search,n.query=t.query;else if(!Lt.isNullOrUndefined(t.search))return H&&(n.hostname=n.host=E.shift(),(se=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=se.shift(),n.host=n.hostname=se.shift())),n.search=t.search,n.query=t.query,Lt.isNull(n.pathname)&&Lt.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n;if(!E.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var Z=E.slice(-1)[0],re=(n.host||t.host||E.length>1)&&(Z==="."||Z==="..")||Z==="",ee=0,ge=E.length;ge>=0;ge--)(Z=E[ge])==="."?E.splice(ge,1):Z===".."?(E.splice(ge,1),ee++):ee&&(E.splice(ge,1),ee--);if(!_&&!S)for(;ee--;ee)E.unshift("..");!_||E[0]===""||E[0]&&E[0].charAt(0)==="/"||E.unshift(""),re&&E.join("/").substr(-1)!=="/"&&E.push("");var se,ie=E[0]===""||E[0]&&E[0].charAt(0)==="/";return H&&(n.hostname=n.host=ie?"":E.length?E.shift():"",(se=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=se.shift(),n.host=n.hostname=se.shift())),(_=_||n.host&&E.length)&&!ie&&E.unshift(""),E.length?n.pathname=E.join("/"):(n.pathname=null,n.path=null),Lt.isNull(n.pathname)&&Lt.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=t.auth||n.auth,n.slashes=n.slashes||t.slashes,n.href=n.format(),n},kt.prototype.parseHost=function(){var t=this.host,e=VS.exec(t);e&&((e=e[0])!==":"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};De.Url;De.format;De.resolve;De.resolveObject;Ua={},oh=!1;sh=eI(),tI=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;De.URL=typeof URL<"u"?URL:null;De.pathToFileURL=yI;De.fileURLToPath=fI;De.Url;De.format;De.resolve;De.resolveObject;De.URL;nI=92,rI=47,iI=97,oI=122,$a=tI==="win32",sI=/\//g,aI=/%/g,lI=/\\/g,uI=/\n/g,cI=/\r/g,dI=/\t/g;mI=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;De.URL=typeof URL<"u"?URL:null;De.pathToFileURL=AI;De.fileURLToPath=SI;De.Url;De.format;De.resolve;De.resolveObject;De.parse;De.URL;hI=92,TI=47,vI=97,_I=122,Za=mI==="win32",bI=/\//g,wI=/%/g,PI=/\\/g,xI=/\n/g,BI=/\r/g,EI=/\t/g});var Kh={};bn(Kh,{Agent:()=>ZI,ClientRequest:()=>KI,IncomingMessage:()=>LI,METHODS:()=>FI,STATUS_CODES:()=>WI,default:()=>ln,get:()=>zI,globalAgent:()=>qI,request:()=>GI});function Rh(){if(ch)return Et;ch=!0,Et.fetch=r(qn.fetch)&&r(qn.ReadableStream),Et.writableStream=r(qn.WritableStream),Et.abortController=r(qn.AbortController);var t;function e(){if(t!==void 0)return t;if(qn.XMLHttpRequest){t=new qn.XMLHttpRequest;try{t.open("GET",qn.XDomainRequest?"/":"https://example.com")}catch{t=null}}else t=null;return t}function n(o){var s=e();if(!s)return!1;try{return s.responseType=o,s.responseType===o}catch{}return!1}Et.arraybuffer=Et.fetch||n("arraybuffer"),Et.msstream=!Et.fetch&&n("ms-stream"),Et.mozchunkedarraybuffer=!Et.fetch&&n("moz-chunked-arraybuffer"),Et.overrideMimeType=Et.fetch||(e()?r(e().overrideMimeType):!1);function r(o){return typeof o=="function"}return t=null,Et}function Mh(){return dh||(dh=!0,Ka=bt.EventEmitter),Ka}function CI(){if(fh)return La;fh=!0;function t(T,x){var B=Object.keys(T);if(Object.getOwnPropertySymbols){var _=Object.getOwnPropertySymbols(T);x&&(_=_.filter(function(S){return Object.getOwnPropertyDescriptor(T,S).enumerable})),B.push.apply(B,_)}return B}function e(T){for(var x=1;x<arguments.length;x++){var B=arguments[x]!=null?arguments[x]:{};x%2?t(Object(B),!0).forEach(function(_){n(T,_,B[_])}):Object.getOwnPropertyDescriptors?Object.defineProperties(T,Object.getOwnPropertyDescriptors(B)):t(Object(B)).forEach(function(_){Object.defineProperty(T,_,Object.getOwnPropertyDescriptor(B,_))})}return T}function n(T,x,B){return x=i(x),x in T?Object.defineProperty(T,x,{value:B,enumerable:!0,configurable:!0,writable:!0}):T[x]=B,T}function r(T,x){if(!(T instanceof x))throw new TypeError("Cannot call a class as a function")}function o(T,x){for(var B=0;B<x.length;B++){var _=x[B];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(T,i(_.key),_)}}function s(T,x,B){return x&&o(T.prototype,x),Object.defineProperty(T,"prototype",{writable:!1}),T}function i(T){var x=a(T,"string");return typeof x=="symbol"?x:String(x)}function a(T,x){if(typeof T!="object"||T===null)return T;var B=T[Symbol.toPrimitive];if(B!==void 0){var _=B.call(T,x||"default");if(typeof _!="object")return _;throw new TypeError("@@toPrimitive must return a primitive value.")}return(x==="string"?String:Number)(T)}var l=$t(),c=l.Buffer,p=L,y=p.inspect,g=y&&y.custom||"inspect";function h(T,x,B){c.prototype.copy.call(T,x,B)}return La=(function(){function T(){r(this,T),this.head=null,this.tail=null,this.length=0}return s(T,[{key:"push",value:function(B){var _={data:B,next:null};this.length>0?this.tail.next=_:this.head=_,this.tail=_,++this.length}},{key:"unshift",value:function(B){var _={data:B,next:this.head};this.length===0&&(this.tail=_),this.head=_,++this.length}},{key:"shift",value:function(){if(this.length!==0){var B=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,B}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(B){if(this.length===0)return"";for(var _=this.head,S=""+_.data;_=_.next;)S+=B+_.data;return S}},{key:"concat",value:function(B){if(this.length===0)return c.alloc(0);for(var _=c.allocUnsafe(B>>>0),S=this.head,E=0;S;)h(S.data,_,E),E+=S.data.length,S=S.next;return _}},{key:"consume",value:function(B,_){var S;return B<this.head.data.length?(S=this.head.data.slice(0,B),this.head.data=this.head.data.slice(B)):B===this.head.data.length?S=this.shift():S=_?this._getString(B):this._getBuffer(B),S}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(B){var _=this.head,S=1,E=_.data;for(B-=E.length;_=_.next;){var H=_.data,Z=B>H.length?H.length:B;if(Z===H.length?E+=H:E+=H.slice(0,B),B-=Z,B===0){Z===H.length?(++S,_.next?this.head=_.next:this.head=this.tail=null):(this.head=_,_.data=H.slice(Z));break}++S}return this.length-=S,E}},{key:"_getBuffer",value:function(B){var _=c.allocUnsafe(B),S=this.head,E=1;for(S.data.copy(_),B-=S.data.length;S=S.next;){var H=S.data,Z=B>H.length?H.length:B;if(H.copy(_,_.length-B,0,Z),B-=Z,B===0){Z===H.length?(++E,S.next?this.head=S.next:this.head=this.tail=null):(this.head=S,S.data=H.slice(Z));break}++E}return this.length-=E,_}},{key:g,value:function(B,_){return y(this,e(e({},_),{},{depth:0,customInspect:!1}))}}]),T})(),La}function Nh(){if(ph)return Fa;ph=!0;var t=Nt;function e(a,l){var c=this,p=this._readableState&&this._readableState.destroyed,y=this._writableState&&this._writableState.destroyed;return p||y?(l?l(a):a&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(s,this,a)):t.nextTick(s,this,a)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(a||null,function(g){!l&&g?c._writableState?c._writableState.errorEmitted?t.nextTick(r,c):(c._writableState.errorEmitted=!0,t.nextTick(n,c,g)):t.nextTick(n,c,g):l?(t.nextTick(r,c),l(g)):t.nextTick(r,c)}),this)}function n(a,l){s(a,l),r(a)}function r(a){a._writableState&&!a._writableState.emitClose||a._readableState&&!a._readableState.emitClose||a.emit("close")}function o(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function s(a,l){a.emit("error",l)}function i(a,l){var c=a._readableState,p=a._writableState;c&&c.autoDestroy||p&&p.autoDestroy?a.destroy(l):a.emit("error",l)}return Fa={destroy:e,undestroy:o,errorOrDestroy:i},Fa}function vr(){if(gh)return Wa;gh=!0;let t={};function e(i,a,l){l||(l=Error);function c(y,g,h){return typeof a=="string"?a:a(y,g,h)}class p extends l{constructor(g,h,T){super(c(g,h,T))}}p.prototype.name=l.name,p.prototype.code=i,t[i]=p}function n(i,a){if(Array.isArray(i)){let l=i.length;return i=i.map(c=>String(c)),l>2?`one of ${a} ${i.slice(0,l-1).join(", ")}, or `+i[l-1]:l===2?`one of ${a} ${i[0]} or ${i[1]}`:`of ${a} ${i[0]}`}else return`of ${a} ${String(i)}`}function r(i,a,l){return i.substr(0,a.length)===a}function o(i,a,l){return(l===void 0||l>i.length)&&(l=i.length),i.substring(l-a.length,l)===a}function s(i,a,l){return typeof l!="number"&&(l=0),l+a.length>i.length?!1:i.indexOf(a,l)!==-1}return e("ERR_INVALID_OPT_VALUE",function(i,a){return'The value "'+a+'" is invalid for option "'+i+'"'},TypeError),e("ERR_INVALID_ARG_TYPE",function(i,a,l){let c;typeof a=="string"&&r(a,"not ")?(c="must not be",a=a.replace(/^not /,"")):c="must be";let p;if(o(i," argument"))p=`The ${i} ${c} ${n(a,"type")}`;else{let y=s(i,".")?"property":"argument";p=`The "${i}" ${y} ${c} ${n(a,"type")}`}return p+=`. Received type ${typeof l}`,p},TypeError),e("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),e("ERR_METHOD_NOT_IMPLEMENTED",function(i){return"The "+i+" method is not implemented"}),e("ERR_STREAM_PREMATURE_CLOSE","Premature close"),e("ERR_STREAM_DESTROYED",function(i){return"Cannot call "+i+" after a stream was destroyed"}),e("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),e("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),e("ERR_STREAM_WRITE_AFTER_END","write after end"),e("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),e("ERR_UNKNOWN_ENCODING",function(i){return"Unknown encoding: "+i},TypeError),e("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),Wa.codes=t,Wa}function Dh(){if(yh)return za;yh=!0;var t=vr().codes.ERR_INVALID_OPT_VALUE;function e(r,o,s){return r.highWaterMark!=null?r.highWaterMark:o?r[s]:null}function n(r,o,s,i){var a=e(o,i,s);if(a!=null){if(!(isFinite(a)&&Math.floor(a)===a)||a<0){var l=i?s:"highWaterMark";throw new t(l,a)}return Math.floor(a)}return r.objectMode?16:16*1024}return za={getHighWaterMark:n},za}function Hh(){if(mh)return qa;mh=!0;var t=Nt;qa=se;function e(M){var C=this;this.next=null,this.entry=null,this.finish=function(){ve(C,M)}}var n;se.WritableState=ee;var r={deprecate:Fm()},o=Mh(),s=$t().Buffer,i=(typeof hh<"u"?hh:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function a(M){return s.from(M)}function l(M){return s.isBuffer(M)||M instanceof i}var c=Nh(),p=Dh(),y=p.getHighWaterMark,g=vr().codes,h=g.ERR_INVALID_ARG_TYPE,T=g.ERR_METHOD_NOT_IMPLEMENTED,x=g.ERR_MULTIPLE_CALLBACK,B=g.ERR_STREAM_CANNOT_PIPE,_=g.ERR_STREAM_DESTROYED,S=g.ERR_STREAM_NULL_VALUES,E=g.ERR_STREAM_WRITE_AFTER_END,H=g.ERR_UNKNOWN_ENCODING,Z=c.errorOrDestroy;Zt()(se,o);function re(){}function ee(M,C,$){n=n||Tr(),M=M||{},typeof $!="boolean"&&($=C instanceof n),this.objectMode=!!M.objectMode,$&&(this.objectMode=this.objectMode||!!M.writableObjectMode),this.highWaterMark=y(this,M,"writableHighWaterMark",$),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var Y=M.decodeStrings===!1;this.decodeStrings=!Y,this.defaultEncoding=M.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(oe){Ue(C,oe)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=M.emitClose!==!1,this.autoDestroy=!!M.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}ee.prototype.getBuffer=function(){for(var C=this.bufferedRequest,$=[];C;)$.push(C),C=C.next;return $},(function(){try{Object.defineProperty(ee.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var ge;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(ge=Function.prototype[Symbol.hasInstance],Object.defineProperty(se,Symbol.hasInstance,{value:function(C){return ge.call(this,C)?!0:this!==se?!1:C&&C._writableState instanceof ee}})):ge=function(C){return C instanceof this};function se(M){n=n||Tr();var C=this instanceof n;if(!C&&!ge.call(se,this))return new se(M);this._writableState=new ee(M,this,C),this.writable=!0,M&&(typeof M.write=="function"&&(this._write=M.write),typeof M.writev=="function"&&(this._writev=M.writev),typeof M.destroy=="function"&&(this._destroy=M.destroy),typeof M.final=="function"&&(this._final=M.final)),o.call(this)}se.prototype.pipe=function(){Z(this,new B)};function ie(M,C){var $=new E;Z(M,$),t.nextTick(C,$)}function Oe(M,C,$,Y){var oe;return $===null?oe=new S:typeof $!="string"&&!C.objectMode&&(oe=new h("chunk",["string","Buffer"],$)),oe?(Z(M,oe),t.nextTick(Y,oe),!1):!0}se.prototype.write=function(M,C,$){var Y=this._writableState,oe=!1,w=!Y.objectMode&&l(M);return w&&!s.isBuffer(M)&&(M=a(M)),typeof C=="function"&&($=C,C=null),w?C="buffer":C||(C=Y.defaultEncoding),typeof $!="function"&&($=re),Y.ending?ie(this,$):(w||Oe(this,Y,M,$))&&(Y.pendingcb++,oe=nt(this,Y,w,M,C,$)),oe},se.prototype.cork=function(){this._writableState.corked++},se.prototype.uncork=function(){var M=this._writableState;M.corked&&(M.corked--,!M.writing&&!M.corked&&!M.bufferProcessing&&M.bufferedRequest&&de(this,M))},se.prototype.setDefaultEncoding=function(C){if(typeof C=="string"&&(C=C.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((C+"").toLowerCase())>-1))throw new H(C);return this._writableState.defaultEncoding=C,this},Object.defineProperty(se.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function ze(M,C,$){return!M.objectMode&&M.decodeStrings!==!1&&typeof C=="string"&&(C=s.from(C,$)),C}Object.defineProperty(se.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function nt(M,C,$,Y,oe,w){if(!$){var P=ze(C,Y,oe);Y!==P&&($=!0,oe="buffer",Y=P)}var z=C.objectMode?1:Y.length;C.length+=z;var Q=C.length<C.highWaterMark;if(Q||(C.needDrain=!0),C.writing||C.corked){var Me=C.lastBufferedRequest;C.lastBufferedRequest={chunk:Y,encoding:oe,isBuf:$,callback:w,next:null},Me?Me.next=C.lastBufferedRequest:C.bufferedRequest=C.lastBufferedRequest,C.bufferedRequestCount+=1}else Ve(M,C,!1,z,Y,oe,w);return Q}function Ve(M,C,$,Y,oe,w,P){C.writelen=Y,C.writecb=P,C.writing=!0,C.sync=!0,C.destroyed?C.onwrite(new _("write")):$?M._writev(oe,C.onwrite):M._write(oe,w,C.onwrite),C.sync=!1}function Je(M,C,$,Y,oe){--C.pendingcb,$?(t.nextTick(oe,Y),t.nextTick(F,M,C),M._writableState.errorEmitted=!0,Z(M,Y)):(oe(Y),M._writableState.errorEmitted=!0,Z(M,Y),F(M,C))}function Tt(M){M.writing=!1,M.writecb=null,M.length-=M.writelen,M.writelen=0}function Ue(M,C){var $=M._writableState,Y=$.sync,oe=$.writecb;if(typeof oe!="function")throw new x;if(Tt($),C)Je(M,$,Y,C,oe);else{var w=Te($)||M.destroyed;!w&&!$.corked&&!$.bufferProcessing&&$.bufferedRequest&&de(M,$),Y?t.nextTick(xe,M,$,w,oe):xe(M,$,w,oe)}}function xe(M,C,$,Y){$||Se(M,C),C.pendingcb--,Y(),F(M,C)}function Se(M,C){C.length===0&&C.needDrain&&(C.needDrain=!1,M.emit("drain"))}function de(M,C){C.bufferProcessing=!0;var $=C.bufferedRequest;if(M._writev&&$&&$.next){var Y=C.bufferedRequestCount,oe=new Array(Y),w=C.corkedRequestsFree;w.entry=$;for(var P=0,z=!0;$;)oe[P]=$,$.isBuf||(z=!1),$=$.next,P+=1;oe.allBuffers=z,Ve(M,C,!0,C.length,oe,"",w.finish),C.pendingcb++,C.lastBufferedRequest=null,w.next?(C.corkedRequestsFree=w.next,w.next=null):C.corkedRequestsFree=new e(C),C.bufferedRequestCount=0}else{for(;$;){var Q=$.chunk,Me=$.encoding,_e=$.callback,j=C.objectMode?1:Q.length;if(Ve(M,C,!1,j,Q,Me,_e),$=$.next,C.bufferedRequestCount--,C.writing)break}$===null&&(C.lastBufferedRequest=null)}C.bufferedRequest=$,C.bufferProcessing=!1}se.prototype._write=function(M,C,$){$(new T("_write()"))},se.prototype._writev=null,se.prototype.end=function(M,C,$){var Y=this._writableState;return typeof M=="function"?($=M,M=null,C=null):typeof C=="function"&&($=C,C=null),M!=null&&this.write(M,C),Y.corked&&(Y.corked=1,this.uncork()),Y.ending||fe(this,Y,$),this},Object.defineProperty(se.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function Te(M){return M.ending&&M.length===0&&M.bufferedRequest===null&&!M.finished&&!M.writing}function D(M,C){M._final(function($){C.pendingcb--,$&&Z(M,$),C.prefinished=!0,M.emit("prefinish"),F(M,C)})}function K(M,C){!C.prefinished&&!C.finalCalled&&(typeof M._final=="function"&&!C.destroyed?(C.pendingcb++,C.finalCalled=!0,t.nextTick(D,M,C)):(C.prefinished=!0,M.emit("prefinish")))}function F(M,C){var $=Te(C);if($&&(K(M,C),C.pendingcb===0&&(C.finished=!0,M.emit("finish"),C.autoDestroy))){var Y=M._readableState;(!Y||Y.autoDestroy&&Y.endEmitted)&&M.destroy()}return $}function fe(M,C,$){C.ending=!0,F(M,C),$&&(C.finished?t.nextTick($):M.once("finish",$)),C.ended=!0,M.writable=!1}function ve(M,C,$){var Y=M.entry;for(M.entry=null;Y;){var oe=Y.callback;C.pendingcb--,oe($),Y=Y.next}C.corkedRequestsFree.next=M}return Object.defineProperty(se.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(C){this._writableState&&(this._writableState.destroyed=C)}}),se.prototype.destroy=c.destroy,se.prototype._undestroy=c.undestroy,se.prototype._destroy=function(M,C){C(M)},qa}function Tr(){if(Th)return Ga;Th=!0;var t=Nt,e=Object.keys||function(p){var y=[];for(var g in p)y.push(g);return y};Ga=a;var n=Uh(),r=Hh();Zt()(a,n);for(var o=e(r.prototype),s=0;s<o.length;s++){var i=o[s];a.prototype[i]||(a.prototype[i]=r.prototype[i])}function a(p){if(!(this instanceof a))return new a(p);n.call(this,p),r.call(this,p),this.allowHalfOpen=!0,p&&(p.readable===!1&&(this.readable=!1),p.writable===!1&&(this.writable=!1),p.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",l)))}Object.defineProperty(a.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(a.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(a.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function l(){this._writableState.ended||t.nextTick(c,this)}function c(p){p.end()}return Object.defineProperty(a.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(y){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=y,this._writableState.destroyed=y)}}),Ga}function sl(){if(vh)return Va;vh=!0;var t=vr().codes.ERR_STREAM_PREMATURE_CLOSE;function e(s){var i=!1;return function(){if(!i){i=!0;for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];s.apply(this,l)}}}function n(){}function r(s){return s.setHeader&&typeof s.abort=="function"}function o(s,i,a){if(typeof i=="function")return o(s,null,i);i||(i={}),a=e(a||n);var l=i.readable||i.readable!==!1&&s.readable,c=i.writable||i.writable!==!1&&s.writable,p=function(){s.writable||g()},y=s._writableState&&s._writableState.finished,g=function(){c=!1,y=!0,l||a.call(s)},h=s._readableState&&s._readableState.endEmitted,T=function(){l=!1,h=!0,c||a.call(s)},x=function(E){a.call(s,E)},B=function(){var E;if(l&&!h)return(!s._readableState||!s._readableState.ended)&&(E=new t),a.call(s,E);if(c&&!y)return(!s._writableState||!s._writableState.ended)&&(E=new t),a.call(s,E)},_=function(){s.req.on("finish",g)};return r(s)?(s.on("complete",g),s.on("abort",B),s.req?_():s.on("request",_)):c&&!s._writableState&&(s.on("end",p),s.on("close",p)),s.on("end",T),s.on("finish",g),i.error!==!1&&s.on("error",x),s.on("close",B),function(){s.removeListener("complete",g),s.removeListener("abort",B),s.removeListener("request",_),s.req&&s.req.removeListener("finish",g),s.removeListener("end",p),s.removeListener("close",p),s.removeListener("finish",g),s.removeListener("end",T),s.removeListener("error",x),s.removeListener("close",B)}}return Va=o,Va}function OI(){if(_h)return Ja;_h=!0;var t=Nt,e;function n(H,Z,re){return Z=r(Z),Z in H?Object.defineProperty(H,Z,{value:re,enumerable:!0,configurable:!0,writable:!0}):H[Z]=re,H}function r(H){var Z=o(H,"string");return typeof Z=="symbol"?Z:String(Z)}function o(H,Z){if(typeof H!="object"||H===null)return H;var re=H[Symbol.toPrimitive];if(re!==void 0){var ee=re.call(H,Z||"default");if(typeof ee!="object")return ee;throw new TypeError("@@toPrimitive must return a primitive value.")}return(Z==="string"?String:Number)(H)}var s=sl(),i=Symbol("lastResolve"),a=Symbol("lastReject"),l=Symbol("error"),c=Symbol("ended"),p=Symbol("lastPromise"),y=Symbol("handlePromise"),g=Symbol("stream");function h(H,Z){return{value:H,done:Z}}function T(H){var Z=H[i];if(Z!==null){var re=H[g].read();re!==null&&(H[p]=null,H[i]=null,H[a]=null,Z(h(re,!1)))}}function x(H){t.nextTick(T,H)}function B(H,Z){return function(re,ee){H.then(function(){if(Z[c]){re(h(void 0,!0));return}Z[y](re,ee)},ee)}}var _=Object.getPrototypeOf(function(){}),S=Object.setPrototypeOf((e={get stream(){return this[g]},next:function(){var Z=this,re=this[l];if(re!==null)return Promise.reject(re);if(this[c])return Promise.resolve(h(void 0,!0));if(this[g].destroyed)return new Promise(function(ie,Oe){t.nextTick(function(){Z[l]?Oe(Z[l]):ie(h(void 0,!0))})});var ee=this[p],ge;if(ee)ge=new Promise(B(ee,this));else{var se=this[g].read();if(se!==null)return Promise.resolve(h(se,!1));ge=new Promise(this[y])}return this[p]=ge,ge}},n(e,Symbol.asyncIterator,function(){return this}),n(e,"return",function(){var Z=this;return new Promise(function(re,ee){Z[g].destroy(null,function(ge){if(ge){ee(ge);return}re(h(void 0,!0))})})}),e),_),E=function(Z){var re,ee=Object.create(S,(re={},n(re,g,{value:Z,writable:!0}),n(re,i,{value:null,writable:!0}),n(re,a,{value:null,writable:!0}),n(re,l,{value:null,writable:!0}),n(re,c,{value:Z._readableState.endEmitted,writable:!0}),n(re,y,{value:function(se,ie){var Oe=ee[g].read();Oe?(ee[p]=null,ee[i]=null,ee[a]=null,se(h(Oe,!1))):(ee[i]=se,ee[a]=ie)},writable:!0}),re));return ee[p]=null,s(Z,function(ge){if(ge&&ge.code!=="ERR_STREAM_PREMATURE_CLOSE"){var se=ee[a];se!==null&&(ee[p]=null,ee[i]=null,ee[a]=null,se(ge)),ee[l]=ge;return}var ie=ee[i];ie!==null&&(ee[p]=null,ee[i]=null,ee[a]=null,ie(h(void 0,!0))),ee[c]=!0}),Z.on("readable",x.bind(null,ee)),ee};return Ja=E,Ja}function RI(){return bh||(bh=!0,Ya=function(){throw new Error("Readable.from is not available in the browser")}),Ya}function Uh(){if(wh)return Xa;wh=!0;var t=Nt;Xa=ie;var e;ie.ReadableState=se,bt.EventEmitter;var n=function(P,z){return P.listeners(z).length},r=Mh(),o=$t().Buffer,s=(typeof Ph<"u"?Ph:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function i(w){return o.from(w)}function a(w){return o.isBuffer(w)||w instanceof s}var l=L,c;l&&l.debuglog?c=l.debuglog("stream"):c=function(){};var p=CI(),y=Nh(),g=Dh(),h=g.getHighWaterMark,T=vr().codes,x=T.ERR_INVALID_ARG_TYPE,B=T.ERR_STREAM_PUSH_AFTER_EOF,_=T.ERR_METHOD_NOT_IMPLEMENTED,S=T.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,E,H,Z;Zt()(ie,r);var re=y.errorOrDestroy,ee=["error","close","destroy","pause","resume"];function ge(w,P,z){if(typeof w.prependListener=="function")return w.prependListener(P,z);!w._events||!w._events[P]?w.on(P,z):Array.isArray(w._events[P])?w._events[P].unshift(z):w._events[P]=[z,w._events[P]]}function se(w,P,z){e=e||Tr(),w=w||{},typeof z!="boolean"&&(z=P instanceof e),this.objectMode=!!w.objectMode,z&&(this.objectMode=this.objectMode||!!w.readableObjectMode),this.highWaterMark=h(this,w,"readableHighWaterMark",z),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=w.emitClose!==!1,this.autoDestroy=!!w.autoDestroy,this.destroyed=!1,this.defaultEncoding=w.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,w.encoding&&(E||(E=oi.StringDecoder),this.decoder=new E(w.encoding),this.encoding=w.encoding)}function ie(w){if(e=e||Tr(),!(this instanceof ie))return new ie(w);var P=this instanceof e;this._readableState=new se(w,this,P),this.readable=!0,w&&(typeof w.read=="function"&&(this._read=w.read),typeof w.destroy=="function"&&(this._destroy=w.destroy)),r.call(this)}Object.defineProperty(ie.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(P){this._readableState&&(this._readableState.destroyed=P)}}),ie.prototype.destroy=y.destroy,ie.prototype._undestroy=y.undestroy,ie.prototype._destroy=function(w,P){P(w)},ie.prototype.push=function(w,P){var z=this._readableState,Q;return z.objectMode?Q=!0:typeof w=="string"&&(P=P||z.defaultEncoding,P!==z.encoding&&(w=o.from(w,P),P=""),Q=!0),Oe(this,w,P,!1,Q)},ie.prototype.unshift=function(w){return Oe(this,w,null,!0,!1)};function Oe(w,P,z,Q,Me){c("readableAddChunk",P);var _e=w._readableState;if(P===null)_e.reading=!1,Ue(w,_e);else{var j;if(Me||(j=nt(_e,P)),j)re(w,j);else if(_e.objectMode||P&&P.length>0)if(typeof P!="string"&&!_e.objectMode&&Object.getPrototypeOf(P)!==o.prototype&&(P=i(P)),Q)_e.endEmitted?re(w,new S):ze(w,_e,P,!0);else if(_e.ended)re(w,new B);else{if(_e.destroyed)return!1;_e.reading=!1,_e.decoder&&!z?(P=_e.decoder.write(P),_e.objectMode||P.length!==0?ze(w,_e,P,!1):de(w,_e)):ze(w,_e,P,!1)}else Q||(_e.reading=!1,de(w,_e))}return!_e.ended&&(_e.length<_e.highWaterMark||_e.length===0)}function ze(w,P,z,Q){P.flowing&&P.length===0&&!P.sync?(P.awaitDrain=0,w.emit("data",z)):(P.length+=P.objectMode?1:z.length,Q?P.buffer.unshift(z):P.buffer.push(z),P.needReadable&&xe(w)),de(w,P)}function nt(w,P){var z;return!a(P)&&typeof P!="string"&&P!==void 0&&!w.objectMode&&(z=new x("chunk",["string","Buffer","Uint8Array"],P)),z}ie.prototype.isPaused=function(){return this._readableState.flowing===!1},ie.prototype.setEncoding=function(w){E||(E=oi.StringDecoder);var P=new E(w);this._readableState.decoder=P,this._readableState.encoding=this._readableState.decoder.encoding;for(var z=this._readableState.buffer.head,Q="";z!==null;)Q+=P.write(z.data),z=z.next;return this._readableState.buffer.clear(),Q!==""&&this._readableState.buffer.push(Q),this._readableState.length=Q.length,this};var Ve=1073741824;function Je(w){return w>=Ve?w=Ve:(w--,w|=w>>>1,w|=w>>>2,w|=w>>>4,w|=w>>>8,w|=w>>>16,w++),w}function Tt(w,P){return w<=0||P.length===0&&P.ended?0:P.objectMode?1:w!==w?P.flowing&&P.length?P.buffer.head.data.length:P.length:(w>P.highWaterMark&&(P.highWaterMark=Je(w)),w<=P.length?w:P.ended?P.length:(P.needReadable=!0,0))}ie.prototype.read=function(w){c("read",w),w=parseInt(w,10);var P=this._readableState,z=w;if(w!==0&&(P.emittedReadable=!1),w===0&&P.needReadable&&((P.highWaterMark!==0?P.length>=P.highWaterMark:P.length>0)||P.ended))return c("read: emitReadable",P.length,P.ended),P.length===0&&P.ended?$(this):xe(this),null;if(w=Tt(w,P),w===0&&P.ended)return P.length===0&&$(this),null;var Q=P.needReadable;c("need readable",Q),(P.length===0||P.length-w<P.highWaterMark)&&(Q=!0,c("length less than watermark",Q)),P.ended||P.reading?(Q=!1,c("reading or ended",Q)):Q&&(c("do read"),P.reading=!0,P.sync=!0,P.length===0&&(P.needReadable=!0),this._read(P.highWaterMark),P.sync=!1,P.reading||(w=Tt(z,P)));var Me;return w>0?Me=C(w,P):Me=null,Me===null?(P.needReadable=P.length<=P.highWaterMark,w=0):(P.length-=w,P.awaitDrain=0),P.length===0&&(P.ended||(P.needReadable=!0),z!==w&&P.ended&&$(this)),Me!==null&&this.emit("data",Me),Me};function Ue(w,P){if(c("onEofChunk"),!P.ended){if(P.decoder){var z=P.decoder.end();z&&z.length&&(P.buffer.push(z),P.length+=P.objectMode?1:z.length)}P.ended=!0,P.sync?xe(w):(P.needReadable=!1,P.emittedReadable||(P.emittedReadable=!0,Se(w)))}}function xe(w){var P=w._readableState;c("emitReadable",P.needReadable,P.emittedReadable),P.needReadable=!1,P.emittedReadable||(c("emitReadable",P.flowing),P.emittedReadable=!0,t.nextTick(Se,w))}function Se(w){var P=w._readableState;c("emitReadable_",P.destroyed,P.length,P.ended),!P.destroyed&&(P.length||P.ended)&&(w.emit("readable"),P.emittedReadable=!1),P.needReadable=!P.flowing&&!P.ended&&P.length<=P.highWaterMark,M(w)}function de(w,P){P.readingMore||(P.readingMore=!0,t.nextTick(Te,w,P))}function Te(w,P){for(;!P.reading&&!P.ended&&(P.length<P.highWaterMark||P.flowing&&P.length===0);){var z=P.length;if(c("maybeReadMore read 0"),w.read(0),z===P.length)break}P.readingMore=!1}ie.prototype._read=function(w){re(this,new _("_read()"))},ie.prototype.pipe=function(w,P){var z=this,Q=this._readableState;switch(Q.pipesCount){case 0:Q.pipes=w;break;case 1:Q.pipes=[Q.pipes,w];break;default:Q.pipes.push(w);break}Q.pipesCount+=1,c("pipe count=%d opts=%j",Q.pipesCount,P);var Me=(!P||P.end!==!1)&&w!==t.stdout&&w!==t.stderr,_e=Me?Rt:u;Q.endEmitted?t.nextTick(_e):z.once("end",_e),w.on("unpipe",j);function j(d,b){c("onunpipe"),d===z&&b&&b.hasUnpiped===!1&&(b.hasUnpiped=!0,wr())}function Rt(){c("onend"),w.end()}var jt=D(z);w.on("drain",jt);var xt=!1;function wr(){c("cleanup"),w.removeListener("close",Pr),w.removeListener("finish",m),w.removeListener("drain",jt),w.removeListener("error",St),w.removeListener("unpipe",j),z.removeListener("end",Rt),z.removeListener("end",u),z.removeListener("data",yi),xt=!0,Q.awaitDrain&&(!w._writableState||w._writableState.needDrain)&&jt()}z.on("data",yi);function yi(d){c("ondata");var b=w.write(d);c("dest.write",b),b===!1&&((Q.pipesCount===1&&Q.pipes===w||Q.pipesCount>1&&oe(Q.pipes,w)!==-1)&&!xt&&(c("false write response, pause",Q.awaitDrain),Q.awaitDrain++),z.pause())}function St(d){c("onerror",d),u(),w.removeListener("error",St),n(w,"error")===0&&re(w,d)}ge(w,"error",St);function Pr(){w.removeListener("finish",m),u()}w.once("close",Pr);function m(){c("onfinish"),w.removeListener("close",Pr),u()}w.once("finish",m);function u(){c("unpipe"),z.unpipe(w)}return w.emit("pipe",z),Q.flowing||(c("pipe resume"),z.resume()),w};function D(w){return function(){var z=w._readableState;c("pipeOnDrain",z.awaitDrain),z.awaitDrain&&z.awaitDrain--,z.awaitDrain===0&&n(w,"data")&&(z.flowing=!0,M(w))}}ie.prototype.unpipe=function(w){var P=this._readableState,z={hasUnpiped:!1};if(P.pipesCount===0)return this;if(P.pipesCount===1)return w&&w!==P.pipes?this:(w||(w=P.pipes),P.pipes=null,P.pipesCount=0,P.flowing=!1,w&&w.emit("unpipe",this,z),this);if(!w){var Q=P.pipes,Me=P.pipesCount;P.pipes=null,P.pipesCount=0,P.flowing=!1;for(var _e=0;_e<Me;_e++)Q[_e].emit("unpipe",this,{hasUnpiped:!1});return this}var j=oe(P.pipes,w);return j===-1?this:(P.pipes.splice(j,1),P.pipesCount-=1,P.pipesCount===1&&(P.pipes=P.pipes[0]),w.emit("unpipe",this,z),this)},ie.prototype.on=function(w,P){var z=r.prototype.on.call(this,w,P),Q=this._readableState;return w==="data"?(Q.readableListening=this.listenerCount("readable")>0,Q.flowing!==!1&&this.resume()):w==="readable"&&!Q.endEmitted&&!Q.readableListening&&(Q.readableListening=Q.needReadable=!0,Q.flowing=!1,Q.emittedReadable=!1,c("on readable",Q.length,Q.reading),Q.length?xe(this):Q.reading||t.nextTick(F,this)),z},ie.prototype.addListener=ie.prototype.on,ie.prototype.removeListener=function(w,P){var z=r.prototype.removeListener.call(this,w,P);return w==="readable"&&t.nextTick(K,this),z},ie.prototype.removeAllListeners=function(w){var P=r.prototype.removeAllListeners.apply(this,arguments);return(w==="readable"||w===void 0)&&t.nextTick(K,this),P};function K(w){var P=w._readableState;P.readableListening=w.listenerCount("readable")>0,P.resumeScheduled&&!P.paused?P.flowing=!0:w.listenerCount("data")>0&&w.resume()}function F(w){c("readable nexttick read 0"),w.read(0)}ie.prototype.resume=function(){var w=this._readableState;return w.flowing||(c("resume"),w.flowing=!w.readableListening,fe(this,w)),w.paused=!1,this};function fe(w,P){P.resumeScheduled||(P.resumeScheduled=!0,t.nextTick(ve,w,P))}function ve(w,P){c("resume",P.reading),P.reading||w.read(0),P.resumeScheduled=!1,w.emit("resume"),M(w),P.flowing&&!P.reading&&w.read(0)}ie.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function M(w){var P=w._readableState;for(c("flow",P.flowing);P.flowing&&w.read()!==null;);}ie.prototype.wrap=function(w){var P=this,z=this._readableState,Q=!1;w.on("end",function(){if(c("wrapped end"),z.decoder&&!z.ended){var j=z.decoder.end();j&&j.length&&P.push(j)}P.push(null)}),w.on("data",function(j){if(c("wrapped data"),z.decoder&&(j=z.decoder.write(j)),!(z.objectMode&&j==null)&&!(!z.objectMode&&(!j||!j.length))){var Rt=P.push(j);Rt||(Q=!0,w.pause())}});for(var Me in w)this[Me]===void 0&&typeof w[Me]=="function"&&(this[Me]=(function(Rt){return function(){return w[Rt].apply(w,arguments)}})(Me));for(var _e=0;_e<ee.length;_e++)w.on(ee[_e],this.emit.bind(this,ee[_e]));return this._read=function(j){c("wrapped _read",j),Q&&(Q=!1,w.resume())},this},typeof Symbol=="function"&&(ie.prototype[Symbol.asyncIterator]=function(){return H===void 0&&(H=OI()),H(this)}),Object.defineProperty(ie.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(ie.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(ie.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(P){this._readableState&&(this._readableState.flowing=P)}}),ie._fromList=C,Object.defineProperty(ie.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function C(w,P){if(P.length===0)return null;var z;return P.objectMode?z=P.buffer.shift():!w||w>=P.length?(P.decoder?z=P.buffer.join(""):P.buffer.length===1?z=P.buffer.first():z=P.buffer.concat(P.length),P.buffer.clear()):z=P.buffer.consume(w,P.decoder),z}function $(w){var P=w._readableState;c("endReadable",P.endEmitted),P.endEmitted||(P.ended=!0,t.nextTick(Y,P,w))}function Y(w,P){if(c("endReadableNT",w.endEmitted,w.length),!w.endEmitted&&w.length===0&&(w.endEmitted=!0,P.readable=!1,P.emit("end"),w.autoDestroy)){var z=P._writableState;(!z||z.autoDestroy&&z.finished)&&P.destroy()}}typeof Symbol=="function"&&(ie.from=function(w,P){return Z===void 0&&(Z=RI()),Z(ie,w,P)});function oe(w,P){for(var z=0,Q=w.length;z<Q;z++)if(w[z]===P)return z;return-1}return Xa}function jh(){if(xh)return Qa;xh=!0,Qa=a;var t=vr().codes,e=t.ERR_METHOD_NOT_IMPLEMENTED,n=t.ERR_MULTIPLE_CALLBACK,r=t.ERR_TRANSFORM_ALREADY_TRANSFORMING,o=t.ERR_TRANSFORM_WITH_LENGTH_0,s=Tr();Zt()(a,s);function i(p,y){var g=this._transformState;g.transforming=!1;var h=g.writecb;if(h===null)return this.emit("error",new n);g.writechunk=null,g.writecb=null,y!=null&&this.push(y),h(p);var T=this._readableState;T.reading=!1,(T.needReadable||T.length<T.highWaterMark)&&this._read(T.highWaterMark)}function a(p){if(!(this instanceof a))return new a(p);s.call(this,p),this._transformState={afterTransform:i.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,p&&(typeof p.transform=="function"&&(this._transform=p.transform),typeof p.flush=="function"&&(this._flush=p.flush)),this.on("prefinish",l)}function l(){var p=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(y,g){c(p,y,g)}):c(this,null,null)}a.prototype.push=function(p,y){return this._transformState.needTransform=!1,s.prototype.push.call(this,p,y)},a.prototype._transform=function(p,y,g){g(new e("_transform()"))},a.prototype._write=function(p,y,g){var h=this._transformState;if(h.writecb=g,h.writechunk=p,h.writeencoding=y,!h.transforming){var T=this._readableState;(h.needTransform||T.needReadable||T.length<T.highWaterMark)&&this._read(T.highWaterMark)}},a.prototype._read=function(p){var y=this._transformState;y.writechunk!==null&&!y.transforming?(y.transforming=!0,this._transform(y.writechunk,y.writeencoding,y.afterTransform)):y.needTransform=!0},a.prototype._destroy=function(p,y){s.prototype._destroy.call(this,p,function(g){y(g)})};function c(p,y,g){if(y)return p.emit("error",y);if(g!=null&&p.push(g),p._writableState.length)throw new o;if(p._transformState.transforming)throw new r;return p.push(null)}return Qa}function MI(){if(Bh)return el;Bh=!0,el=e;var t=jh();Zt()(e,t);function e(n){if(!(this instanceof e))return new e(n);t.call(this,n)}return e.prototype._transform=function(n,r,o){o(null,n)},el}function NI(){if(Eh)return tl;Eh=!0;var t;function e(g){var h=!1;return function(){h||(h=!0,g.apply(void 0,arguments))}}var n=vr().codes,r=n.ERR_MISSING_ARGS,o=n.ERR_STREAM_DESTROYED;function s(g){if(g)throw g}function i(g){return g.setHeader&&typeof g.abort=="function"}function a(g,h,T,x){x=e(x);var B=!1;g.on("close",function(){B=!0}),t===void 0&&(t=sl()),t(g,{readable:h,writable:T},function(S){if(S)return x(S);B=!0,x()});var _=!1;return function(S){if(!B&&!_){if(_=!0,i(g))return g.abort();if(typeof g.destroy=="function")return g.destroy();x(S||new o("pipe"))}}}function l(g){g()}function c(g,h){return g.pipe(h)}function p(g){return!g.length||typeof g[g.length-1]!="function"?s:g.pop()}function y(){for(var g=arguments.length,h=new Array(g),T=0;T<g;T++)h[T]=arguments[T];var x=p(h);if(Array.isArray(h[0])&&(h=h[0]),h.length<2)throw new r("streams");var B,_=h.map(function(S,E){var H=E<h.length-1,Z=E>0;return a(S,H,Z,function(re){B||(B=re),re&&_.forEach(l),!H&&(_.forEach(l),x(B))})});return h.reduce(c)}return tl=y,tl}function $h(){return Sh||(Sh=!0,Pt=Pt=Uh(),Pt.Stream=Pt,Pt.Readable=Pt,Pt.Writable=Hh(),Pt.Duplex=Tr(),Pt.Transform=jh(),Pt.PassThrough=MI(),Pt.finished=sl(),Pt.pipeline=NI()),Pt}function Zh(){if(Ih)return Go;Ih=!0;var t=$t().Buffer,e=Nt,n=Rh(),r=Zt(),o=$h(),s=Go.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},i=Go.IncomingMessage=function(a,l,c,p){var y=this||Vo;if(o.Readable.call(y),y._mode=c,y.headers={},y.rawHeaders=[],y.trailers={},y.rawTrailers=[],y.on("end",function(){e.nextTick(function(){y.emit("close")})}),c==="fetch"){let _=function(){h.read().then(function(S){if(!y._destroyed){if(p(S.done),S.done){y.push(null);return}y.push(t.from(S.value)),_()}}).catch(function(S){p(!0),y._destroyed||y.emit("error",S)})};if(y._fetchResponse=l,y.url=l.url,y.statusCode=l.status,y.statusMessage=l.statusText,l.headers.forEach(function(S,E){y.headers[E.toLowerCase()]=S,y.rawHeaders.push(E,S)}),n.writableStream){var g=new WritableStream({write:function(S){return p(!1),new Promise(function(E,H){y._destroyed?H():y.push(t.from(S))?E():y._resumeFetch=E})},close:function(){p(!0),y._destroyed||y.push(null)},abort:function(S){p(!0),y._destroyed||y.emit("error",S)}});try{l.body.pipeTo(g).catch(function(S){p(!0),y._destroyed||y.emit("error",S)});return}catch{}}var h=l.body.getReader();_()}else{y._xhr=a,y._pos=0,y.url=a.responseURL,y.statusCode=a.status,y.statusMessage=a.statusText;var T=a.getAllResponseHeaders().split(/\r?\n/);if(T.forEach(function(_){var S=_.match(/^([^:]+):\s*(.*)/);if(S){var E=S[1].toLowerCase();E==="set-cookie"?(y.headers[E]===void 0&&(y.headers[E]=[]),y.headers[E].push(S[2])):y.headers[E]!==void 0?y.headers[E]+=", "+S[2]:y.headers[E]=S[2],y.rawHeaders.push(S[1],S[2])}}),y._charset="x-user-defined",!n.overrideMimeType){var x=y.rawHeaders["mime-type"];if(x){var B=x.match(/;\s*charset=([^;])(;|$)/);B&&(y._charset=B[1].toLowerCase())}y._charset||(y._charset="utf-8")}}};return r(i,o.Readable),i.prototype._read=function(){var a=this||Vo,l=a._resumeFetch;l&&(a._resumeFetch=null,l())},i.prototype._onXHRProgress=function(a){var l=this||Vo,c=l._xhr,p=null;switch(l._mode){case"text":if(p=c.responseText,p.length>l._pos){var y=p.substr(l._pos);if(l._charset==="x-user-defined"){for(var g=t.alloc(y.length),h=0;h<y.length;h++)g[h]=y.charCodeAt(h)&255;l.push(g)}else l.push(y,l._charset);l._pos=p.length}break;case"arraybuffer":if(c.readyState!==s.DONE||!c.response)break;p=c.response,l.push(t.from(new Uint8Array(p)));break;case"moz-chunked-arraybuffer":if(p=c.response,c.readyState!==s.LOADING||!p)break;l.push(t.from(new Uint8Array(p)));break;case"ms-stream":if(p=c.response,c.readyState!==s.LOADING)break;var T=new Vo.MSStreamReader;T.onprogress=function(){T.result.byteLength>l._pos&&(l.push(t.from(new Uint8Array(T.result.slice(l._pos)))),l._pos=T.result.byteLength)},T.onload=function(){a(!0),l.push(null)},T.readAsArrayBuffer(p);break}l._xhr.readyState===s.DONE&&l._mode!=="ms-stream"&&(a(!0),l.push(null))},Go}function DI(){if(kh)return nl;kh=!0;var t=$t().Buffer,e=Nt,n=Rh(),r=Zt(),o=Zh(),s=$h(),i=o.IncomingMessage,a=o.readyStates;function l(g,h){return n.fetch&&h?"fetch":n.mozchunkedarraybuffer?"moz-chunked-arraybuffer":n.msstream?"ms-stream":n.arraybuffer&&g?"arraybuffer":"text"}var c=nl=function(g){var h=this||ot;s.Writable.call(h),h._opts=g,h._body=[],h._headers={},g.auth&&h.setHeader("Authorization","Basic "+t.from(g.auth).toString("base64")),Object.keys(g.headers).forEach(function(B){h.setHeader(B,g.headers[B])});var T,x=!0;if(g.mode==="disable-fetch"||"requestTimeout"in g&&!n.abortController)x=!1,T=!0;else if(g.mode==="prefer-streaming")T=!1;else if(g.mode==="allow-wrong-content-type")T=!n.overrideMimeType;else if(!g.mode||g.mode==="default"||g.mode==="prefer-fast")T=!0;else throw new Error("Invalid value for opts.mode");h._mode=l(T,x),h._fetchTimer=null,h._socketTimeout=null,h._socketTimer=null,h.on("finish",function(){h._onFinish()})};r(c,s.Writable),c.prototype.setHeader=function(g,h){var T=this||ot,x=g.toLowerCase();y.indexOf(x)===-1&&(T._headers[x]={name:g,value:h})},c.prototype.getHeader=function(g){var h=(this||ot)._headers[g.toLowerCase()];return h?h.value:null},c.prototype.removeHeader=function(g){var h=this||ot;delete h._headers[g.toLowerCase()]},c.prototype._onFinish=function(){var g=this||ot;if(!g._destroyed){var h=g._opts;"timeout"in h&&h.timeout!==0&&g.setTimeout(h.timeout);var T=g._headers,x=null;h.method!=="GET"&&h.method!=="HEAD"&&(x=new Blob(g._body,{type:(T["content-type"]||{}).value||""}));var B=[];if(Object.keys(T).forEach(function(H){var Z=T[H].name,re=T[H].value;Array.isArray(re)?re.forEach(function(ee){B.push([Z,ee])}):B.push([Z,re])}),g._mode==="fetch"){var _=null;if(n.abortController){var S=new AbortController;_=S.signal,g._fetchAbortController=S,"requestTimeout"in h&&h.requestTimeout!==0&&(g._fetchTimer=ot.setTimeout(function(){g.emit("requestTimeout"),g._fetchAbortController&&g._fetchAbortController.abort()},h.requestTimeout))}ot.fetch(g._opts.url,{method:g._opts.method,headers:B,body:x||void 0,mode:"cors",credentials:h.withCredentials?"include":"same-origin",signal:_}).then(function(H){g._fetchResponse=H,g._resetTimers(!1),g._connect()},function(H){g._resetTimers(!0),g._destroyed||g.emit("error",H)})}else{var E=g._xhr=new ot.XMLHttpRequest;try{E.open(g._opts.method,g._opts.url,!0)}catch(H){e.nextTick(function(){g.emit("error",H)});return}"responseType"in E&&(E.responseType=g._mode),"withCredentials"in E&&(E.withCredentials=!!h.withCredentials),g._mode==="text"&&"overrideMimeType"in E&&E.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in h&&(E.timeout=h.requestTimeout,E.ontimeout=function(){g.emit("requestTimeout")}),B.forEach(function(H){E.setRequestHeader(H[0],H[1])}),g._response=null,E.onreadystatechange=function(){switch(E.readyState){case a.LOADING:case a.DONE:g._onXHRProgress();break}},g._mode==="moz-chunked-arraybuffer"&&(E.onprogress=function(){g._onXHRProgress()}),E.onerror=function(){g._destroyed||(g._resetTimers(!0),g.emit("error",new Error("XHR error")))};try{E.send(x)}catch(H){e.nextTick(function(){g.emit("error",H)});return}}}};function p(g){try{var h=g.status;return h!==null&&h!==0}catch{return!1}}c.prototype._onXHRProgress=function(){var g=this||ot;g._resetTimers(!1),!(!p(g._xhr)||g._destroyed)&&(g._response||g._connect(),g._response._onXHRProgress(g._resetTimers.bind(g)))},c.prototype._connect=function(){var g=this||ot;g._destroyed||(g._response=new i(g._xhr,g._fetchResponse,g._mode,g._resetTimers.bind(g)),g._response.on("error",function(h){g.emit("error",h)}),g.emit("response",g._response))},c.prototype._write=function(g,h,T){var x=this||ot;x._body.push(g),T()},c.prototype._resetTimers=function(g){var h=this||ot;ot.clearTimeout(h._socketTimer),h._socketTimer=null,g?(ot.clearTimeout(h._fetchTimer),h._fetchTimer=null):h._socketTimeout&&(h._socketTimer=ot.setTimeout(function(){h.emit("timeout")},h._socketTimeout))},c.prototype.abort=c.prototype.destroy=function(g){var h=this||ot;h._destroyed=!0,h._resetTimers(!0),h._response&&(h._response._destroyed=!0),h._xhr?h._xhr.abort():h._fetchAbortController&&h._fetchAbortController.abort(),g&&h.emit("error",g)},c.prototype.end=function(g,h,T){var x=this||ot;typeof g=="function"&&(T=g,g=void 0),s.Writable.prototype.end.call(x,g,h,T)},c.prototype.setTimeout=function(g,h){var T=this||ot;h&&T.once("timeout",h),T._socketTimeout=g,T._resetTimers(!1)},c.prototype.flushHeaders=function(){},c.prototype.setNoDelay=function(){},c.prototype.setSocketKeepAlive=function(){};var y=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"];return nl}function HI(){if(Ah)return rl;Ah=!0,rl=e;var t=Object.prototype.hasOwnProperty;function e(){for(var n={},r=0;r<arguments.length;r++){var o=arguments[r];for(var s in o)t.call(o,s)&&(n[s]=o[s])}return n}return rl}function UI(){return Ch||(Ch=!0,il={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}),il}function $I(){if(Oh)return ol;Oh=!0;var t=DI(),e=Zh(),n=HI(),r=UI(),o=De,s=ol;return s.request=function(i,a){typeof i=="string"?i=o.parse(i):i=n(i);var l=jI.location.protocol.search(/^https?:$/)===-1?"http:":"",c=i.protocol||l,p=i.hostname||i.host,y=i.port,g=i.path||"/";p&&p.indexOf(":")!==-1&&(p="["+p+"]"),i.url=(p?c+"//"+p:"")+(y?":"+y:"")+g,i.method=(i.method||"GET").toUpperCase(),i.headers=i.headers||{};var h=new t(i);return a&&h.on("response",a),h},s.get=function(a,l){var c=s.request(a,l);return c.end(),c},s.ClientRequest=t,s.IncomingMessage=e.IncomingMessage,s.Agent=function(){},s.Agent.defaultMaxSockets=4,s.globalAgent=new s.Agent,s.STATUS_CODES=r,s.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"],ol}var Et,ch,qn,Ka,dh,La,fh,Fa,ph,Wa,gh,za,yh,qa,mh,hh,Ga,Th,Va,vh,Ja,_h,Ya,bh,Xa,wh,Ph,Qa,xh,el,Bh,tl,Eh,Pt,Sh,Go,Ih,Vo,nl,kh,ot,rl,Ah,il,Ch,ol,Oh,jI,ln,ZI,KI,LI,FI,WI,zI,qI,GI,Lh=st(()=>{I();A();k();da();im();fa();_i();$m();zo();Ia();Wm();Gm();uh();Ra();Et={},ch=!1,qn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ka={},dh=!1;La={},fh=!1;Fa={},ph=!1;Wa={},gh=!1;za={},yh=!1;qa={},mh=!1,hh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ga={},Th=!1;Va={},vh=!1;Ja={},_h=!1;Ya={},bh=!1;Xa={},wh=!1,Ph=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Qa={},xh=!1;el={},Bh=!1;tl={},Eh=!1;Pt={},Sh=!1;Go={},Ih=!1,Vo=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;nl={},kh=!1,ot=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;rl={},Ah=!1;il={},Ch=!1;ol={},Oh=!1,jI=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;ln=$I(),ZI=ln.Agent,KI=ln.ClientRequest,LI=ln.IncomingMessage,FI=ln.METHODS,WI=ln.STATUS_CODES,zI=ln.get,qI=ln.globalAgent,GI=ln.request});I();A();k();var Wy={};bn(Wy,{defaults:()=>GB,markdown:()=>zB,markdownBloc:()=>qB});I();A();k();I();A();k();I();A();k();var Os=Object.defineProperty,nv=Object.defineProperties,rv=Object.getOwnPropertyDescriptors,Ci=Object.getOwnPropertySymbols,ud=Object.prototype.hasOwnProperty,cd=Object.prototype.propertyIsEnumerable,Bc=(t,e,n)=>e in t?Os(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,v=(t,e)=>{for(var n in e||(e={}))ud.call(e,n)&&Bc(t,n,e[n]);if(Ci)for(var n of Ci(e))cd.call(e,n)&&Bc(t,n,e[n]);return t},N=(t,e)=>nv(t,rv(e)),f=(t,e)=>Os(t,"name",{value:e,configurable:!0}),dd=(t,e)=>{var n={};for(var r in t)ud.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Ci)for(var r of Ci(t))e.indexOf(r)<0&&cd.call(t,r)&&(n[r]=t[r]);return n},po=(t,e)=>{for(var n in e)Os(t,n,{get:e[n],enumerable:!0})},RA={},iv={};po(iv,{errors:()=>md,fromJSONSchema:()=>ly,fromJSONSchemaLegacy:()=>mB,fromObject:()=>As,toJSONSchema:()=>at,toJSONSchemaLegacy:()=>LB,toTypescriptSchema:()=>Fs,toTypescriptType:()=>Rs});var X={};po(X,{BRAND:()=>zP,DIRTY:()=>er,EMPTY_PATH:()=>KP,INVALID:()=>pe,NEVER:()=>zx,OK:()=>gt,ParseInputLazyPath:()=>Mt,ParseStatus:()=>_t,Schema:()=>he,ZodAny:()=>Gr,ZodArray:()=>Vr,ZodBigInt:()=>Gs,ZodBoolean:()=>Vs,ZodBranded:()=>Js,ZodCatch:()=>Ys,ZodDate:()=>Xs,ZodDefault:()=>xo,ZodDiscriminatedUnion:()=>xg,ZodEffects:()=>Rn,ZodEnum:()=>ur,ZodError:()=>Yt,ZodFirstPartyTypeKind:()=>dg,ZodFunction:()=>Eg,ZodIntersection:()=>ea,ZodIssueCode:()=>J,ZodLazy:()=>ta,ZodLiteral:()=>na,ZodMap:()=>Ig,ZodNaN:()=>Ag,ZodNativeEnum:()=>ra,ZodNever:()=>Xr,ZodNull:()=>ia,ZodNullable:()=>ir,ZodNumber:()=>oa,ZodObject:()=>or,ZodOptional:()=>gn,ZodParsedType:()=>ne,ZodPipeline:()=>sa,ZodPromise:()=>Eo,ZodReadonly:()=>So,ZodRecord:()=>Hg,ZodRef:()=>jg,ZodSchema:()=>he,ZodSet:()=>$g,ZodString:()=>yt,ZodSymbol:()=>Yg,ZodTransformer:()=>Rn,ZodTuple:()=>ar,ZodType:()=>he,ZodUndefined:()=>Io,ZodUnion:()=>aa,ZodUnknown:()=>Kr,ZodVoid:()=>ty,addIssueToContext:()=>te,agent:()=>QP,aimodel:()=>ix,any:()=>yx,array:()=>vx,bigint:()=>cx,boolean:()=>iy,coerce:()=>Wx,conversation:()=>JP,createZodEnum:()=>Bo,cuid2Regex:()=>Kg,cuidRegex:()=>Zg,custom:()=>wg,datasource:()=>ox,date:()=>dx,default:()=>jx,discriminatedUnion:()=>Px,effect:()=>sd,emailRegex:()=>Wg,enum:()=>Mx,errorUtil:()=>ue,event:()=>ex,function:()=>Cx,getErrorMap:()=>zr,getParsedType:()=>pn,instanceof:()=>lx,intent:()=>rx,intersection:()=>xx,ipv4Regex:()=>qg,ipv6Regex:()=>Gg,isAborted:()=>Ss,isAsync:()=>Mi,isDirty:()=>Is,isEmojiRegex:()=>qP,isValid:()=>qr,knowledgebase:()=>sx,late:()=>ax,lazy:()=>Ox,literal:()=>Rx,makeIssue:()=>Ri,map:()=>kx,message:()=>XP,nan:()=>ux,nativeEnum:()=>Nx,never:()=>hx,null:()=>gx,nullable:()=>Ux,number:()=>ry,object:()=>_x,objectUtil:()=>Es,oboolean:()=>Fx,onumber:()=>Lx,optional:()=>Hx,ostring:()=>Kx,pipeline:()=>Zx,preprocess:()=>$x,processCreateParams:()=>me,promise:()=>Dx,quotelessJson:()=>ZP,readonly:()=>Ix,record:()=>Ex,ref:()=>Sx,set:()=>Ax,setErrorMap:()=>gg,strictObject:()=>bx,string:()=>ny,symbol:()=>fx,table:()=>tx,tablerow:()=>nx,transformer:()=>sd,tuple:()=>Bx,ulidRegex:()=>Lg,undefined:()=>px,union:()=>wx,unknown:()=>mx,user:()=>YP,util:()=>be,uuidRegex:()=>Fg,variable:()=>VP,void:()=>Tx});var le="x-zui";function fd(t){return typeof t=="symbol"?"symbol":typeof t=="bigint"?`${t.toString()}n`:ae(t)}f(fd,"primitiveToTypscriptLiteralType");function ae(t){return typeof t>"u"?"undefined":typeof t=="symbol"?t.description?`Symbol(${ae(t.description)})`:"Symbol()":typeof t=="bigint"?`BigInt(${t.toString()})`:typeof t=="string"?yd(t):JSON.stringify(t)}f(ae,"primitiveToTypescriptValue");function tr(t){return typeof t>"u"?"undefined":JSON.stringify(t)}f(tr,"unknownToTypescriptValue");var pd=f((t,e)=>{let n=Object.entries(t),r=e?" as const":"";return`{ ${n.map(([o,s])=>`${hs(o)}: ${tr(s)}`).join(", ")} }${r}`},"recordOfUnknownToTypescriptRecord"),hs=f(t=>/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t)?t:ae(t),"toPropertyKey"),ov=f(t=>t.charAt(0).toUpperCase()+t.slice(1),"capitalize"),gd=f(t=>{let e=/[^a-zA-Z0-9_]/g;return t.split(e).map(ov).filter(r=>!!r).join("")},"toTypeArgumentName"),Ec=f(t=>{for(var e;t.length&&!((e=t[0])!=null&&e.trim());)t.shift();for(;t.length&&!t[t.length-1].trim();)t.pop()},"trimEmptyLinesInPlace"),rt=f(t=>{t=t?.replace(/(\n(\s*)?){3,}/g,`
12
+ `)&&(e=e.replace(xI,"%0A")),e.includes("\r")&&(e=e.replace(BI,"%0D")),e.includes(" ")&&(e=e.replace(EI,"%09")),r.pathname=e,r}var Ma,Jm,Ym,hr,jS,$S,ZS,KS,Ft,Na,Qm,lh,eh,th,LS,WS,si,zS,an,De,qS,Lt,GS,VS,JS,YS,ja,nh,rh,ih,XS,QS,Da,mr,Ha,Ua,oh,sh,tI,nI,rI,iI,oI,$a,sI,aI,lI,uI,cI,dI,mI,hI,TI,vI,_I,Za,bI,wI,PI,xI,BI,EI,uh=st(()=>{I();A();k();zo();Ra();Ma={},Jm=!1;Ym=US(),hr=2147483647,jS=/^xn--/,$S=/[^\0-\x7E]/,ZS=/[\x2E\u3002\uFF0E\uFF61]/g,KS={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Ft=Math.floor,Na=String.fromCharCode;Qm=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},lh=function(t,e,n){let r=0;for(t=n?Ft(t/700):t>>1,t+=Ft(t/e);t>455;r+=36)t=Ft(t/35);return Ft(r+36*t/(t+38))},eh=function(t){let e=[],n=t.length,r=0,o=128,s=72,i=t.lastIndexOf("-");i<0&&(i=0);for(let l=0;l<i;++l)t.charCodeAt(l)>=128&&zn("not-basic"),e.push(t.charCodeAt(l));for(let l=i>0?i+1:0;l<n;){let c=r;for(let y=1,g=36;;g+=36){l>=n&&zn("invalid-input");let h=(a=t.charCodeAt(l++))-48<10?a-22:a-65<26?a-65:a-97<26?a-97:36;(h>=36||h>Ft((hr-r)/y))&&zn("overflow"),r+=h*y;let T=g<=s?1:g>=s+26?26:g-s;if(h<T)break;let x=36-T;y>Ft(hr/x)&&zn("overflow"),y*=x}let f=e.length+1;s=lh(r-c,f,c==0),Ft(r/f)>hr-o&&zn("overflow"),o+=Ft(r/f),r%=f,e.splice(r++,0,o)}var a;return String.fromCodePoint(...e)},th=function(t){let e=[],n=(t=ah(t)).length,r=128,o=0,s=72;for(let l of t)l<128&&e.push(Na(l));let i=e.length,a=i;for(i&&e.push("-");a<n;){let l=hr;for(let f of t)f>=r&&f<l&&(l=f);let c=a+1;l-r>Ft((hr-o)/c)&&zn("overflow"),o+=(l-r)*c,r=l;for(let f of t)if(f<r&&++o>hr&&zn("overflow"),f==r){let y=o;for(let g=36;;g+=36){let h=g<=s?1:g>=s+26?26:g-s;if(y<h)break;let T=y-h,x=36-h;e.push(Na(Qm(h+T%x,0))),y=Ft(T/x)}e.push(Na(Qm(y,0))),s=lh(o,c,a==i),o=0,++a}++o,++r}return e.join("")},LS={version:"2.1.0",ucs2:{decode:ah,encode:t=>String.fromCodePoint(...t)},decode:eh,encode:th,toASCII:function(t){return Xm(t,(function(e){return $S.test(e)?"xn--"+th(e):e}))},toUnicode:function(t){return Xm(t,(function(e){return jS.test(e)?eh(e.slice(4).toLowerCase()):e}))}};WS=function(t,e,n,r){e=e||"&",n=n||"=";var o={};if(typeof t!="string"||t.length===0)return o;var s=/\+/g;t=t.split(e);var i=1e3;r&&typeof r.maxKeys=="number"&&(i=r.maxKeys);var a=t.length;i>0&&a>i&&(a=i);for(var l=0;l<a;++l){var c,f,y,g,h=t[l].replace(s,"%20"),T=h.indexOf(n);T>=0?(c=h.substr(0,T),f=h.substr(T+1)):(c=h,f=""),y=decodeURIComponent(c),g=decodeURIComponent(f),FS(o,y)?Array.isArray(o[y])?o[y].push(g):o[y]=[o[y],g]:o[y]=g}return o},si=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}},zS=function(t,e,n,r){return e=e||"&",n=n||"=",t===null&&(t=void 0),typeof t=="object"?Object.keys(t).map((function(o){var s=encodeURIComponent(si(o))+n;return Array.isArray(t[o])?t[o].map((function(i){return s+encodeURIComponent(si(i))})).join(e):s+encodeURIComponent(si(t[o]))})).join(e):r?encodeURIComponent(si(r))+n+encodeURIComponent(si(t)):""},an={};an.decode=an.parse=WS,an.encode=an.stringify=zS;an.decode;an.encode;an.parse;an.stringify;De={},qS=LS,Lt={isString:function(t){return typeof t=="string"},isObject:function(t){return typeof t=="object"&&t!==null},isNull:function(t){return t===null},isNullOrUndefined:function(t){return t==null}};De.parse=ai,De.resolve=function(t,e){return ai(t,!1,!0).resolve(e)},De.resolveObject=function(t,e){return t?ai(t,!1,!0).resolveObject(e):e},De.format=function(t){return Lt.isString(t)&&(t=ai(t)),t instanceof kt?t.format():kt.prototype.format.call(t)},De.Url=kt;GS=/^([a-z0-9.+-]+:)/i,VS=/:[0-9]*$/,JS=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,YS=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r",`
13
+ `," "]),ja=["'"].concat(YS),nh=["%","/","?",";","#"].concat(ja),rh=["/","?","#"],ih=/^[+a-z0-9A-Z_-]{0,63}$/,XS=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,QS={javascript:!0,"javascript:":!0},Da={javascript:!0,"javascript:":!0},mr={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Ha=an;kt.prototype.parse=function(t,e,n){if(!Lt.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var r=t.indexOf("?"),o=r!==-1&&r<t.indexOf("#")?"?":"#",s=t.split(o);s[0]=s[0].replace(/\\/g,"/");var i=t=s.join(o);if(i=i.trim(),!n&&t.split("#").length===1){var a=JS.exec(i);if(a)return this.path=i,this.href=i,this.pathname=a[1],a[2]?(this.search=a[2],this.query=e?Ha.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var l=GS.exec(i);if(l){var c=(l=l[0]).toLowerCase();this.protocol=c,i=i.substr(l.length)}if(n||l||i.match(/^\/\/[^@\/]+@[^@\/]+/)){var f=i.substr(0,2)==="//";!f||l&&Da[l]||(i=i.substr(2),this.slashes=!0)}if(!Da[l]&&(f||l&&!mr[l])){for(var y,g,h=-1,T=0;T<rh.length;T++)(x=i.indexOf(rh[T]))!==-1&&(h===-1||x<h)&&(h=x);for((g=h===-1?i.lastIndexOf("@"):i.lastIndexOf("@",h))!==-1&&(y=i.slice(0,g),i=i.slice(g+1),this.auth=decodeURIComponent(y)),h=-1,T=0;T<nh.length;T++){var x;(x=i.indexOf(nh[T]))!==-1&&(h===-1||x<h)&&(h=x)}h===-1&&(h=i.length),this.host=i.slice(0,h),i=i.slice(h),this.parseHost(),this.hostname=this.hostname||"";var B=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!B)for(var _=this.hostname.split(/\./),S=(T=0,_.length);T<S;T++){var E=_[T];if(E&&!E.match(ih)){for(var H="",Z=0,re=E.length;Z<re;Z++)E.charCodeAt(Z)>127?H+="x":H+=E[Z];if(!H.match(ih)){var ee=_.slice(0,T),ge=_.slice(T+1),se=E.match(XS);se&&(ee.push(se[1]),ge.unshift(se[2])),ge.length&&(i="/"+ge.join(".")+i),this.hostname=ee.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),B||(this.hostname=qS.toASCII(this.hostname));var ie=this.port?":"+this.port:"",Oe=this.hostname||"";this.host=Oe+ie,this.href+=this.host,B&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),i[0]!=="/"&&(i="/"+i))}if(!QS[c])for(T=0,S=ja.length;T<S;T++){var ze=ja[T];if(i.indexOf(ze)!==-1){var nt=encodeURIComponent(ze);nt===ze&&(nt=escape(ze)),i=i.split(ze).join(nt)}}var Ve=i.indexOf("#");Ve!==-1&&(this.hash=i.substr(Ve),i=i.slice(0,Ve));var Je=i.indexOf("?");if(Je!==-1?(this.search=i.substr(Je),this.query=i.substr(Je+1),e&&(this.query=Ha.parse(this.query)),i=i.slice(0,Je)):e&&(this.search="",this.query={}),i&&(this.pathname=i),mr[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){ie=this.pathname||"";var Tt=this.search||"";this.path=ie+Tt}return this.href=this.format(),this},kt.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var e=this.protocol||"",n=this.pathname||"",r=this.hash||"",o=!1,s="";this.host?o=t+this.host:this.hostname&&(o=t+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&Lt.isObject(this.query)&&Object.keys(this.query).length&&(s=Ha.stringify(this.query));var i=this.search||s&&"?"+s||"";return e&&e.substr(-1)!==":"&&(e+=":"),this.slashes||(!e||mr[e])&&o!==!1?(o="//"+(o||""),n&&n.charAt(0)!=="/"&&(n="/"+n)):o||(o=""),r&&r.charAt(0)!=="#"&&(r="#"+r),i&&i.charAt(0)!=="?"&&(i="?"+i),e+o+(n=n.replace(/[?#]/g,(function(a){return encodeURIComponent(a)})))+(i=i.replace("#","%23"))+r},kt.prototype.resolve=function(t){return this.resolveObject(ai(t,!1,!0)).format()},kt.prototype.resolveObject=function(t){if(Lt.isString(t)){var e=new kt;e.parse(t,!1,!0),t=e}for(var n=new kt,r=Object.keys(this),o=0;o<r.length;o++){var s=r[o];n[s]=this[s]}if(n.hash=t.hash,t.href==="")return n.href=n.format(),n;if(t.slashes&&!t.protocol){for(var i=Object.keys(t),a=0;a<i.length;a++){var l=i[a];l!=="protocol"&&(n[l]=t[l])}return mr[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(t.protocol&&t.protocol!==n.protocol){if(!mr[t.protocol]){for(var c=Object.keys(t),f=0;f<c.length;f++){var y=c[f];n[y]=t[y]}return n.href=n.format(),n}if(n.protocol=t.protocol,t.host||Da[t.protocol])n.pathname=t.pathname;else{for(var g=(t.pathname||"").split("/");g.length&&!(t.host=g.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),g[0]!==""&&g.unshift(""),g.length<2&&g.unshift(""),n.pathname=g.join("/")}if(n.search=t.search,n.query=t.query,n.host=t.host||"",n.auth=t.auth,n.hostname=t.hostname||t.host,n.port=t.port,n.pathname||n.search){var h=n.pathname||"",T=n.search||"";n.path=h+T}return n.slashes=n.slashes||t.slashes,n.href=n.format(),n}var x=n.pathname&&n.pathname.charAt(0)==="/",B=t.host||t.pathname&&t.pathname.charAt(0)==="/",_=B||x||n.host&&t.pathname,S=_,E=n.pathname&&n.pathname.split("/")||[],H=(g=t.pathname&&t.pathname.split("/")||[],n.protocol&&!mr[n.protocol]);if(H&&(n.hostname="",n.port=null,n.host&&(E[0]===""?E[0]=n.host:E.unshift(n.host)),n.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(g[0]===""?g[0]=t.host:g.unshift(t.host)),t.host=null),_=_&&(g[0]===""||E[0]==="")),B)n.host=t.host||t.host===""?t.host:n.host,n.hostname=t.hostname||t.hostname===""?t.hostname:n.hostname,n.search=t.search,n.query=t.query,E=g;else if(g.length)E||(E=[]),E.pop(),E=E.concat(g),n.search=t.search,n.query=t.query;else if(!Lt.isNullOrUndefined(t.search))return H&&(n.hostname=n.host=E.shift(),(se=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=se.shift(),n.host=n.hostname=se.shift())),n.search=t.search,n.query=t.query,Lt.isNull(n.pathname)&&Lt.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n;if(!E.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var Z=E.slice(-1)[0],re=(n.host||t.host||E.length>1)&&(Z==="."||Z==="..")||Z==="",ee=0,ge=E.length;ge>=0;ge--)(Z=E[ge])==="."?E.splice(ge,1):Z===".."?(E.splice(ge,1),ee++):ee&&(E.splice(ge,1),ee--);if(!_&&!S)for(;ee--;ee)E.unshift("..");!_||E[0]===""||E[0]&&E[0].charAt(0)==="/"||E.unshift(""),re&&E.join("/").substr(-1)!=="/"&&E.push("");var se,ie=E[0]===""||E[0]&&E[0].charAt(0)==="/";return H&&(n.hostname=n.host=ie?"":E.length?E.shift():"",(se=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=se.shift(),n.host=n.hostname=se.shift())),(_=_||n.host&&E.length)&&!ie&&E.unshift(""),E.length?n.pathname=E.join("/"):(n.pathname=null,n.path=null),Lt.isNull(n.pathname)&&Lt.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=t.auth||n.auth,n.slashes=n.slashes||t.slashes,n.href=n.format(),n},kt.prototype.parseHost=function(){var t=this.host,e=VS.exec(t);e&&((e=e[0])!==":"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};De.Url;De.format;De.resolve;De.resolveObject;Ua={},oh=!1;sh=eI(),tI=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;De.URL=typeof URL<"u"?URL:null;De.pathToFileURL=yI;De.fileURLToPath=fI;De.Url;De.format;De.resolve;De.resolveObject;De.URL;nI=92,rI=47,iI=97,oI=122,$a=tI==="win32",sI=/\//g,aI=/%/g,lI=/\\/g,uI=/\n/g,cI=/\r/g,dI=/\t/g;mI=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;De.URL=typeof URL<"u"?URL:null;De.pathToFileURL=AI;De.fileURLToPath=SI;De.Url;De.format;De.resolve;De.resolveObject;De.parse;De.URL;hI=92,TI=47,vI=97,_I=122,Za=mI==="win32",bI=/\//g,wI=/%/g,PI=/\\/g,xI=/\n/g,BI=/\r/g,EI=/\t/g});var Kh={};bn(Kh,{Agent:()=>ZI,ClientRequest:()=>KI,IncomingMessage:()=>LI,METHODS:()=>FI,STATUS_CODES:()=>WI,default:()=>ln,get:()=>zI,globalAgent:()=>qI,request:()=>GI});function Rh(){if(ch)return Et;ch=!0,Et.fetch=r(qn.fetch)&&r(qn.ReadableStream),Et.writableStream=r(qn.WritableStream),Et.abortController=r(qn.AbortController);var t;function e(){if(t!==void 0)return t;if(qn.XMLHttpRequest){t=new qn.XMLHttpRequest;try{t.open("GET",qn.XDomainRequest?"/":"https://example.com")}catch{t=null}}else t=null;return t}function n(o){var s=e();if(!s)return!1;try{return s.responseType=o,s.responseType===o}catch{}return!1}Et.arraybuffer=Et.fetch||n("arraybuffer"),Et.msstream=!Et.fetch&&n("ms-stream"),Et.mozchunkedarraybuffer=!Et.fetch&&n("moz-chunked-arraybuffer"),Et.overrideMimeType=Et.fetch||(e()?r(e().overrideMimeType):!1);function r(o){return typeof o=="function"}return t=null,Et}function Mh(){return dh||(dh=!0,Ka=bt.EventEmitter),Ka}function CI(){if(fh)return La;fh=!0;function t(T,x){var B=Object.keys(T);if(Object.getOwnPropertySymbols){var _=Object.getOwnPropertySymbols(T);x&&(_=_.filter(function(S){return Object.getOwnPropertyDescriptor(T,S).enumerable})),B.push.apply(B,_)}return B}function e(T){for(var x=1;x<arguments.length;x++){var B=arguments[x]!=null?arguments[x]:{};x%2?t(Object(B),!0).forEach(function(_){n(T,_,B[_])}):Object.getOwnPropertyDescriptors?Object.defineProperties(T,Object.getOwnPropertyDescriptors(B)):t(Object(B)).forEach(function(_){Object.defineProperty(T,_,Object.getOwnPropertyDescriptor(B,_))})}return T}function n(T,x,B){return x=i(x),x in T?Object.defineProperty(T,x,{value:B,enumerable:!0,configurable:!0,writable:!0}):T[x]=B,T}function r(T,x){if(!(T instanceof x))throw new TypeError("Cannot call a class as a function")}function o(T,x){for(var B=0;B<x.length;B++){var _=x[B];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(T,i(_.key),_)}}function s(T,x,B){return x&&o(T.prototype,x),Object.defineProperty(T,"prototype",{writable:!1}),T}function i(T){var x=a(T,"string");return typeof x=="symbol"?x:String(x)}function a(T,x){if(typeof T!="object"||T===null)return T;var B=T[Symbol.toPrimitive];if(B!==void 0){var _=B.call(T,x||"default");if(typeof _!="object")return _;throw new TypeError("@@toPrimitive must return a primitive value.")}return(x==="string"?String:Number)(T)}var l=$t(),c=l.Buffer,f=L,y=f.inspect,g=y&&y.custom||"inspect";function h(T,x,B){c.prototype.copy.call(T,x,B)}return La=(function(){function T(){r(this,T),this.head=null,this.tail=null,this.length=0}return s(T,[{key:"push",value:function(B){var _={data:B,next:null};this.length>0?this.tail.next=_:this.head=_,this.tail=_,++this.length}},{key:"unshift",value:function(B){var _={data:B,next:this.head};this.length===0&&(this.tail=_),this.head=_,++this.length}},{key:"shift",value:function(){if(this.length!==0){var B=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,B}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(B){if(this.length===0)return"";for(var _=this.head,S=""+_.data;_=_.next;)S+=B+_.data;return S}},{key:"concat",value:function(B){if(this.length===0)return c.alloc(0);for(var _=c.allocUnsafe(B>>>0),S=this.head,E=0;S;)h(S.data,_,E),E+=S.data.length,S=S.next;return _}},{key:"consume",value:function(B,_){var S;return B<this.head.data.length?(S=this.head.data.slice(0,B),this.head.data=this.head.data.slice(B)):B===this.head.data.length?S=this.shift():S=_?this._getString(B):this._getBuffer(B),S}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(B){var _=this.head,S=1,E=_.data;for(B-=E.length;_=_.next;){var H=_.data,Z=B>H.length?H.length:B;if(Z===H.length?E+=H:E+=H.slice(0,B),B-=Z,B===0){Z===H.length?(++S,_.next?this.head=_.next:this.head=this.tail=null):(this.head=_,_.data=H.slice(Z));break}++S}return this.length-=S,E}},{key:"_getBuffer",value:function(B){var _=c.allocUnsafe(B),S=this.head,E=1;for(S.data.copy(_),B-=S.data.length;S=S.next;){var H=S.data,Z=B>H.length?H.length:B;if(H.copy(_,_.length-B,0,Z),B-=Z,B===0){Z===H.length?(++E,S.next?this.head=S.next:this.head=this.tail=null):(this.head=S,S.data=H.slice(Z));break}++E}return this.length-=E,_}},{key:g,value:function(B,_){return y(this,e(e({},_),{},{depth:0,customInspect:!1}))}}]),T})(),La}function Nh(){if(ph)return Fa;ph=!0;var t=Nt;function e(a,l){var c=this,f=this._readableState&&this._readableState.destroyed,y=this._writableState&&this._writableState.destroyed;return f||y?(l?l(a):a&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(s,this,a)):t.nextTick(s,this,a)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(a||null,function(g){!l&&g?c._writableState?c._writableState.errorEmitted?t.nextTick(r,c):(c._writableState.errorEmitted=!0,t.nextTick(n,c,g)):t.nextTick(n,c,g):l?(t.nextTick(r,c),l(g)):t.nextTick(r,c)}),this)}function n(a,l){s(a,l),r(a)}function r(a){a._writableState&&!a._writableState.emitClose||a._readableState&&!a._readableState.emitClose||a.emit("close")}function o(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function s(a,l){a.emit("error",l)}function i(a,l){var c=a._readableState,f=a._writableState;c&&c.autoDestroy||f&&f.autoDestroy?a.destroy(l):a.emit("error",l)}return Fa={destroy:e,undestroy:o,errorOrDestroy:i},Fa}function vr(){if(gh)return Wa;gh=!0;let t={};function e(i,a,l){l||(l=Error);function c(y,g,h){return typeof a=="string"?a:a(y,g,h)}class f extends l{constructor(g,h,T){super(c(g,h,T))}}f.prototype.name=l.name,f.prototype.code=i,t[i]=f}function n(i,a){if(Array.isArray(i)){let l=i.length;return i=i.map(c=>String(c)),l>2?`one of ${a} ${i.slice(0,l-1).join(", ")}, or `+i[l-1]:l===2?`one of ${a} ${i[0]} or ${i[1]}`:`of ${a} ${i[0]}`}else return`of ${a} ${String(i)}`}function r(i,a,l){return i.substr(0,a.length)===a}function o(i,a,l){return(l===void 0||l>i.length)&&(l=i.length),i.substring(l-a.length,l)===a}function s(i,a,l){return typeof l!="number"&&(l=0),l+a.length>i.length?!1:i.indexOf(a,l)!==-1}return e("ERR_INVALID_OPT_VALUE",function(i,a){return'The value "'+a+'" is invalid for option "'+i+'"'},TypeError),e("ERR_INVALID_ARG_TYPE",function(i,a,l){let c;typeof a=="string"&&r(a,"not ")?(c="must not be",a=a.replace(/^not /,"")):c="must be";let f;if(o(i," argument"))f=`The ${i} ${c} ${n(a,"type")}`;else{let y=s(i,".")?"property":"argument";f=`The "${i}" ${y} ${c} ${n(a,"type")}`}return f+=`. Received type ${typeof l}`,f},TypeError),e("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),e("ERR_METHOD_NOT_IMPLEMENTED",function(i){return"The "+i+" method is not implemented"}),e("ERR_STREAM_PREMATURE_CLOSE","Premature close"),e("ERR_STREAM_DESTROYED",function(i){return"Cannot call "+i+" after a stream was destroyed"}),e("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),e("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),e("ERR_STREAM_WRITE_AFTER_END","write after end"),e("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),e("ERR_UNKNOWN_ENCODING",function(i){return"Unknown encoding: "+i},TypeError),e("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),Wa.codes=t,Wa}function Dh(){if(yh)return za;yh=!0;var t=vr().codes.ERR_INVALID_OPT_VALUE;function e(r,o,s){return r.highWaterMark!=null?r.highWaterMark:o?r[s]:null}function n(r,o,s,i){var a=e(o,i,s);if(a!=null){if(!(isFinite(a)&&Math.floor(a)===a)||a<0){var l=i?s:"highWaterMark";throw new t(l,a)}return Math.floor(a)}return r.objectMode?16:16*1024}return za={getHighWaterMark:n},za}function Hh(){if(mh)return qa;mh=!0;var t=Nt;qa=se;function e(M){var C=this;this.next=null,this.entry=null,this.finish=function(){ve(C,M)}}var n;se.WritableState=ee;var r={deprecate:Fm()},o=Mh(),s=$t().Buffer,i=(typeof hh<"u"?hh:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function a(M){return s.from(M)}function l(M){return s.isBuffer(M)||M instanceof i}var c=Nh(),f=Dh(),y=f.getHighWaterMark,g=vr().codes,h=g.ERR_INVALID_ARG_TYPE,T=g.ERR_METHOD_NOT_IMPLEMENTED,x=g.ERR_MULTIPLE_CALLBACK,B=g.ERR_STREAM_CANNOT_PIPE,_=g.ERR_STREAM_DESTROYED,S=g.ERR_STREAM_NULL_VALUES,E=g.ERR_STREAM_WRITE_AFTER_END,H=g.ERR_UNKNOWN_ENCODING,Z=c.errorOrDestroy;Zt()(se,o);function re(){}function ee(M,C,$){n=n||Tr(),M=M||{},typeof $!="boolean"&&($=C instanceof n),this.objectMode=!!M.objectMode,$&&(this.objectMode=this.objectMode||!!M.writableObjectMode),this.highWaterMark=y(this,M,"writableHighWaterMark",$),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var Y=M.decodeStrings===!1;this.decodeStrings=!Y,this.defaultEncoding=M.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(oe){Ue(C,oe)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=M.emitClose!==!1,this.autoDestroy=!!M.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}ee.prototype.getBuffer=function(){for(var C=this.bufferedRequest,$=[];C;)$.push(C),C=C.next;return $},(function(){try{Object.defineProperty(ee.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var ge;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(ge=Function.prototype[Symbol.hasInstance],Object.defineProperty(se,Symbol.hasInstance,{value:function(C){return ge.call(this,C)?!0:this!==se?!1:C&&C._writableState instanceof ee}})):ge=function(C){return C instanceof this};function se(M){n=n||Tr();var C=this instanceof n;if(!C&&!ge.call(se,this))return new se(M);this._writableState=new ee(M,this,C),this.writable=!0,M&&(typeof M.write=="function"&&(this._write=M.write),typeof M.writev=="function"&&(this._writev=M.writev),typeof M.destroy=="function"&&(this._destroy=M.destroy),typeof M.final=="function"&&(this._final=M.final)),o.call(this)}se.prototype.pipe=function(){Z(this,new B)};function ie(M,C){var $=new E;Z(M,$),t.nextTick(C,$)}function Oe(M,C,$,Y){var oe;return $===null?oe=new S:typeof $!="string"&&!C.objectMode&&(oe=new h("chunk",["string","Buffer"],$)),oe?(Z(M,oe),t.nextTick(Y,oe),!1):!0}se.prototype.write=function(M,C,$){var Y=this._writableState,oe=!1,w=!Y.objectMode&&l(M);return w&&!s.isBuffer(M)&&(M=a(M)),typeof C=="function"&&($=C,C=null),w?C="buffer":C||(C=Y.defaultEncoding),typeof $!="function"&&($=re),Y.ending?ie(this,$):(w||Oe(this,Y,M,$))&&(Y.pendingcb++,oe=nt(this,Y,w,M,C,$)),oe},se.prototype.cork=function(){this._writableState.corked++},se.prototype.uncork=function(){var M=this._writableState;M.corked&&(M.corked--,!M.writing&&!M.corked&&!M.bufferProcessing&&M.bufferedRequest&&de(this,M))},se.prototype.setDefaultEncoding=function(C){if(typeof C=="string"&&(C=C.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((C+"").toLowerCase())>-1))throw new H(C);return this._writableState.defaultEncoding=C,this},Object.defineProperty(se.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function ze(M,C,$){return!M.objectMode&&M.decodeStrings!==!1&&typeof C=="string"&&(C=s.from(C,$)),C}Object.defineProperty(se.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function nt(M,C,$,Y,oe,w){if(!$){var P=ze(C,Y,oe);Y!==P&&($=!0,oe="buffer",Y=P)}var z=C.objectMode?1:Y.length;C.length+=z;var Q=C.length<C.highWaterMark;if(Q||(C.needDrain=!0),C.writing||C.corked){var Me=C.lastBufferedRequest;C.lastBufferedRequest={chunk:Y,encoding:oe,isBuf:$,callback:w,next:null},Me?Me.next=C.lastBufferedRequest:C.bufferedRequest=C.lastBufferedRequest,C.bufferedRequestCount+=1}else Ve(M,C,!1,z,Y,oe,w);return Q}function Ve(M,C,$,Y,oe,w,P){C.writelen=Y,C.writecb=P,C.writing=!0,C.sync=!0,C.destroyed?C.onwrite(new _("write")):$?M._writev(oe,C.onwrite):M._write(oe,w,C.onwrite),C.sync=!1}function Je(M,C,$,Y,oe){--C.pendingcb,$?(t.nextTick(oe,Y),t.nextTick(F,M,C),M._writableState.errorEmitted=!0,Z(M,Y)):(oe(Y),M._writableState.errorEmitted=!0,Z(M,Y),F(M,C))}function Tt(M){M.writing=!1,M.writecb=null,M.length-=M.writelen,M.writelen=0}function Ue(M,C){var $=M._writableState,Y=$.sync,oe=$.writecb;if(typeof oe!="function")throw new x;if(Tt($),C)Je(M,$,Y,C,oe);else{var w=Te($)||M.destroyed;!w&&!$.corked&&!$.bufferProcessing&&$.bufferedRequest&&de(M,$),Y?t.nextTick(xe,M,$,w,oe):xe(M,$,w,oe)}}function xe(M,C,$,Y){$||Se(M,C),C.pendingcb--,Y(),F(M,C)}function Se(M,C){C.length===0&&C.needDrain&&(C.needDrain=!1,M.emit("drain"))}function de(M,C){C.bufferProcessing=!0;var $=C.bufferedRequest;if(M._writev&&$&&$.next){var Y=C.bufferedRequestCount,oe=new Array(Y),w=C.corkedRequestsFree;w.entry=$;for(var P=0,z=!0;$;)oe[P]=$,$.isBuf||(z=!1),$=$.next,P+=1;oe.allBuffers=z,Ve(M,C,!0,C.length,oe,"",w.finish),C.pendingcb++,C.lastBufferedRequest=null,w.next?(C.corkedRequestsFree=w.next,w.next=null):C.corkedRequestsFree=new e(C),C.bufferedRequestCount=0}else{for(;$;){var Q=$.chunk,Me=$.encoding,_e=$.callback,j=C.objectMode?1:Q.length;if(Ve(M,C,!1,j,Q,Me,_e),$=$.next,C.bufferedRequestCount--,C.writing)break}$===null&&(C.lastBufferedRequest=null)}C.bufferedRequest=$,C.bufferProcessing=!1}se.prototype._write=function(M,C,$){$(new T("_write()"))},se.prototype._writev=null,se.prototype.end=function(M,C,$){var Y=this._writableState;return typeof M=="function"?($=M,M=null,C=null):typeof C=="function"&&($=C,C=null),M!=null&&this.write(M,C),Y.corked&&(Y.corked=1,this.uncork()),Y.ending||fe(this,Y,$),this},Object.defineProperty(se.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function Te(M){return M.ending&&M.length===0&&M.bufferedRequest===null&&!M.finished&&!M.writing}function D(M,C){M._final(function($){C.pendingcb--,$&&Z(M,$),C.prefinished=!0,M.emit("prefinish"),F(M,C)})}function K(M,C){!C.prefinished&&!C.finalCalled&&(typeof M._final=="function"&&!C.destroyed?(C.pendingcb++,C.finalCalled=!0,t.nextTick(D,M,C)):(C.prefinished=!0,M.emit("prefinish")))}function F(M,C){var $=Te(C);if($&&(K(M,C),C.pendingcb===0&&(C.finished=!0,M.emit("finish"),C.autoDestroy))){var Y=M._readableState;(!Y||Y.autoDestroy&&Y.endEmitted)&&M.destroy()}return $}function fe(M,C,$){C.ending=!0,F(M,C),$&&(C.finished?t.nextTick($):M.once("finish",$)),C.ended=!0,M.writable=!1}function ve(M,C,$){var Y=M.entry;for(M.entry=null;Y;){var oe=Y.callback;C.pendingcb--,oe($),Y=Y.next}C.corkedRequestsFree.next=M}return Object.defineProperty(se.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(C){this._writableState&&(this._writableState.destroyed=C)}}),se.prototype.destroy=c.destroy,se.prototype._undestroy=c.undestroy,se.prototype._destroy=function(M,C){C(M)},qa}function Tr(){if(Th)return Ga;Th=!0;var t=Nt,e=Object.keys||function(f){var y=[];for(var g in f)y.push(g);return y};Ga=a;var n=Uh(),r=Hh();Zt()(a,n);for(var o=e(r.prototype),s=0;s<o.length;s++){var i=o[s];a.prototype[i]||(a.prototype[i]=r.prototype[i])}function a(f){if(!(this instanceof a))return new a(f);n.call(this,f),r.call(this,f),this.allowHalfOpen=!0,f&&(f.readable===!1&&(this.readable=!1),f.writable===!1&&(this.writable=!1),f.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",l)))}Object.defineProperty(a.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(a.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(a.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function l(){this._writableState.ended||t.nextTick(c,this)}function c(f){f.end()}return Object.defineProperty(a.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(y){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=y,this._writableState.destroyed=y)}}),Ga}function sl(){if(vh)return Va;vh=!0;var t=vr().codes.ERR_STREAM_PREMATURE_CLOSE;function e(s){var i=!1;return function(){if(!i){i=!0;for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];s.apply(this,l)}}}function n(){}function r(s){return s.setHeader&&typeof s.abort=="function"}function o(s,i,a){if(typeof i=="function")return o(s,null,i);i||(i={}),a=e(a||n);var l=i.readable||i.readable!==!1&&s.readable,c=i.writable||i.writable!==!1&&s.writable,f=function(){s.writable||g()},y=s._writableState&&s._writableState.finished,g=function(){c=!1,y=!0,l||a.call(s)},h=s._readableState&&s._readableState.endEmitted,T=function(){l=!1,h=!0,c||a.call(s)},x=function(E){a.call(s,E)},B=function(){var E;if(l&&!h)return(!s._readableState||!s._readableState.ended)&&(E=new t),a.call(s,E);if(c&&!y)return(!s._writableState||!s._writableState.ended)&&(E=new t),a.call(s,E)},_=function(){s.req.on("finish",g)};return r(s)?(s.on("complete",g),s.on("abort",B),s.req?_():s.on("request",_)):c&&!s._writableState&&(s.on("end",f),s.on("close",f)),s.on("end",T),s.on("finish",g),i.error!==!1&&s.on("error",x),s.on("close",B),function(){s.removeListener("complete",g),s.removeListener("abort",B),s.removeListener("request",_),s.req&&s.req.removeListener("finish",g),s.removeListener("end",f),s.removeListener("close",f),s.removeListener("finish",g),s.removeListener("end",T),s.removeListener("error",x),s.removeListener("close",B)}}return Va=o,Va}function OI(){if(_h)return Ja;_h=!0;var t=Nt,e;function n(H,Z,re){return Z=r(Z),Z in H?Object.defineProperty(H,Z,{value:re,enumerable:!0,configurable:!0,writable:!0}):H[Z]=re,H}function r(H){var Z=o(H,"string");return typeof Z=="symbol"?Z:String(Z)}function o(H,Z){if(typeof H!="object"||H===null)return H;var re=H[Symbol.toPrimitive];if(re!==void 0){var ee=re.call(H,Z||"default");if(typeof ee!="object")return ee;throw new TypeError("@@toPrimitive must return a primitive value.")}return(Z==="string"?String:Number)(H)}var s=sl(),i=Symbol("lastResolve"),a=Symbol("lastReject"),l=Symbol("error"),c=Symbol("ended"),f=Symbol("lastPromise"),y=Symbol("handlePromise"),g=Symbol("stream");function h(H,Z){return{value:H,done:Z}}function T(H){var Z=H[i];if(Z!==null){var re=H[g].read();re!==null&&(H[f]=null,H[i]=null,H[a]=null,Z(h(re,!1)))}}function x(H){t.nextTick(T,H)}function B(H,Z){return function(re,ee){H.then(function(){if(Z[c]){re(h(void 0,!0));return}Z[y](re,ee)},ee)}}var _=Object.getPrototypeOf(function(){}),S=Object.setPrototypeOf((e={get stream(){return this[g]},next:function(){var Z=this,re=this[l];if(re!==null)return Promise.reject(re);if(this[c])return Promise.resolve(h(void 0,!0));if(this[g].destroyed)return new Promise(function(ie,Oe){t.nextTick(function(){Z[l]?Oe(Z[l]):ie(h(void 0,!0))})});var ee=this[f],ge;if(ee)ge=new Promise(B(ee,this));else{var se=this[g].read();if(se!==null)return Promise.resolve(h(se,!1));ge=new Promise(this[y])}return this[f]=ge,ge}},n(e,Symbol.asyncIterator,function(){return this}),n(e,"return",function(){var Z=this;return new Promise(function(re,ee){Z[g].destroy(null,function(ge){if(ge){ee(ge);return}re(h(void 0,!0))})})}),e),_),E=function(Z){var re,ee=Object.create(S,(re={},n(re,g,{value:Z,writable:!0}),n(re,i,{value:null,writable:!0}),n(re,a,{value:null,writable:!0}),n(re,l,{value:null,writable:!0}),n(re,c,{value:Z._readableState.endEmitted,writable:!0}),n(re,y,{value:function(se,ie){var Oe=ee[g].read();Oe?(ee[f]=null,ee[i]=null,ee[a]=null,se(h(Oe,!1))):(ee[i]=se,ee[a]=ie)},writable:!0}),re));return ee[f]=null,s(Z,function(ge){if(ge&&ge.code!=="ERR_STREAM_PREMATURE_CLOSE"){var se=ee[a];se!==null&&(ee[f]=null,ee[i]=null,ee[a]=null,se(ge)),ee[l]=ge;return}var ie=ee[i];ie!==null&&(ee[f]=null,ee[i]=null,ee[a]=null,ie(h(void 0,!0))),ee[c]=!0}),Z.on("readable",x.bind(null,ee)),ee};return Ja=E,Ja}function RI(){return bh||(bh=!0,Ya=function(){throw new Error("Readable.from is not available in the browser")}),Ya}function Uh(){if(wh)return Xa;wh=!0;var t=Nt;Xa=ie;var e;ie.ReadableState=se,bt.EventEmitter;var n=function(P,z){return P.listeners(z).length},r=Mh(),o=$t().Buffer,s=(typeof Ph<"u"?Ph:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function i(w){return o.from(w)}function a(w){return o.isBuffer(w)||w instanceof s}var l=L,c;l&&l.debuglog?c=l.debuglog("stream"):c=function(){};var f=CI(),y=Nh(),g=Dh(),h=g.getHighWaterMark,T=vr().codes,x=T.ERR_INVALID_ARG_TYPE,B=T.ERR_STREAM_PUSH_AFTER_EOF,_=T.ERR_METHOD_NOT_IMPLEMENTED,S=T.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,E,H,Z;Zt()(ie,r);var re=y.errorOrDestroy,ee=["error","close","destroy","pause","resume"];function ge(w,P,z){if(typeof w.prependListener=="function")return w.prependListener(P,z);!w._events||!w._events[P]?w.on(P,z):Array.isArray(w._events[P])?w._events[P].unshift(z):w._events[P]=[z,w._events[P]]}function se(w,P,z){e=e||Tr(),w=w||{},typeof z!="boolean"&&(z=P instanceof e),this.objectMode=!!w.objectMode,z&&(this.objectMode=this.objectMode||!!w.readableObjectMode),this.highWaterMark=h(this,w,"readableHighWaterMark",z),this.buffer=new f,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=w.emitClose!==!1,this.autoDestroy=!!w.autoDestroy,this.destroyed=!1,this.defaultEncoding=w.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,w.encoding&&(E||(E=oi.StringDecoder),this.decoder=new E(w.encoding),this.encoding=w.encoding)}function ie(w){if(e=e||Tr(),!(this instanceof ie))return new ie(w);var P=this instanceof e;this._readableState=new se(w,this,P),this.readable=!0,w&&(typeof w.read=="function"&&(this._read=w.read),typeof w.destroy=="function"&&(this._destroy=w.destroy)),r.call(this)}Object.defineProperty(ie.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(P){this._readableState&&(this._readableState.destroyed=P)}}),ie.prototype.destroy=y.destroy,ie.prototype._undestroy=y.undestroy,ie.prototype._destroy=function(w,P){P(w)},ie.prototype.push=function(w,P){var z=this._readableState,Q;return z.objectMode?Q=!0:typeof w=="string"&&(P=P||z.defaultEncoding,P!==z.encoding&&(w=o.from(w,P),P=""),Q=!0),Oe(this,w,P,!1,Q)},ie.prototype.unshift=function(w){return Oe(this,w,null,!0,!1)};function Oe(w,P,z,Q,Me){c("readableAddChunk",P);var _e=w._readableState;if(P===null)_e.reading=!1,Ue(w,_e);else{var j;if(Me||(j=nt(_e,P)),j)re(w,j);else if(_e.objectMode||P&&P.length>0)if(typeof P!="string"&&!_e.objectMode&&Object.getPrototypeOf(P)!==o.prototype&&(P=i(P)),Q)_e.endEmitted?re(w,new S):ze(w,_e,P,!0);else if(_e.ended)re(w,new B);else{if(_e.destroyed)return!1;_e.reading=!1,_e.decoder&&!z?(P=_e.decoder.write(P),_e.objectMode||P.length!==0?ze(w,_e,P,!1):de(w,_e)):ze(w,_e,P,!1)}else Q||(_e.reading=!1,de(w,_e))}return!_e.ended&&(_e.length<_e.highWaterMark||_e.length===0)}function ze(w,P,z,Q){P.flowing&&P.length===0&&!P.sync?(P.awaitDrain=0,w.emit("data",z)):(P.length+=P.objectMode?1:z.length,Q?P.buffer.unshift(z):P.buffer.push(z),P.needReadable&&xe(w)),de(w,P)}function nt(w,P){var z;return!a(P)&&typeof P!="string"&&P!==void 0&&!w.objectMode&&(z=new x("chunk",["string","Buffer","Uint8Array"],P)),z}ie.prototype.isPaused=function(){return this._readableState.flowing===!1},ie.prototype.setEncoding=function(w){E||(E=oi.StringDecoder);var P=new E(w);this._readableState.decoder=P,this._readableState.encoding=this._readableState.decoder.encoding;for(var z=this._readableState.buffer.head,Q="";z!==null;)Q+=P.write(z.data),z=z.next;return this._readableState.buffer.clear(),Q!==""&&this._readableState.buffer.push(Q),this._readableState.length=Q.length,this};var Ve=1073741824;function Je(w){return w>=Ve?w=Ve:(w--,w|=w>>>1,w|=w>>>2,w|=w>>>4,w|=w>>>8,w|=w>>>16,w++),w}function Tt(w,P){return w<=0||P.length===0&&P.ended?0:P.objectMode?1:w!==w?P.flowing&&P.length?P.buffer.head.data.length:P.length:(w>P.highWaterMark&&(P.highWaterMark=Je(w)),w<=P.length?w:P.ended?P.length:(P.needReadable=!0,0))}ie.prototype.read=function(w){c("read",w),w=parseInt(w,10);var P=this._readableState,z=w;if(w!==0&&(P.emittedReadable=!1),w===0&&P.needReadable&&((P.highWaterMark!==0?P.length>=P.highWaterMark:P.length>0)||P.ended))return c("read: emitReadable",P.length,P.ended),P.length===0&&P.ended?$(this):xe(this),null;if(w=Tt(w,P),w===0&&P.ended)return P.length===0&&$(this),null;var Q=P.needReadable;c("need readable",Q),(P.length===0||P.length-w<P.highWaterMark)&&(Q=!0,c("length less than watermark",Q)),P.ended||P.reading?(Q=!1,c("reading or ended",Q)):Q&&(c("do read"),P.reading=!0,P.sync=!0,P.length===0&&(P.needReadable=!0),this._read(P.highWaterMark),P.sync=!1,P.reading||(w=Tt(z,P)));var Me;return w>0?Me=C(w,P):Me=null,Me===null?(P.needReadable=P.length<=P.highWaterMark,w=0):(P.length-=w,P.awaitDrain=0),P.length===0&&(P.ended||(P.needReadable=!0),z!==w&&P.ended&&$(this)),Me!==null&&this.emit("data",Me),Me};function Ue(w,P){if(c("onEofChunk"),!P.ended){if(P.decoder){var z=P.decoder.end();z&&z.length&&(P.buffer.push(z),P.length+=P.objectMode?1:z.length)}P.ended=!0,P.sync?xe(w):(P.needReadable=!1,P.emittedReadable||(P.emittedReadable=!0,Se(w)))}}function xe(w){var P=w._readableState;c("emitReadable",P.needReadable,P.emittedReadable),P.needReadable=!1,P.emittedReadable||(c("emitReadable",P.flowing),P.emittedReadable=!0,t.nextTick(Se,w))}function Se(w){var P=w._readableState;c("emitReadable_",P.destroyed,P.length,P.ended),!P.destroyed&&(P.length||P.ended)&&(w.emit("readable"),P.emittedReadable=!1),P.needReadable=!P.flowing&&!P.ended&&P.length<=P.highWaterMark,M(w)}function de(w,P){P.readingMore||(P.readingMore=!0,t.nextTick(Te,w,P))}function Te(w,P){for(;!P.reading&&!P.ended&&(P.length<P.highWaterMark||P.flowing&&P.length===0);){var z=P.length;if(c("maybeReadMore read 0"),w.read(0),z===P.length)break}P.readingMore=!1}ie.prototype._read=function(w){re(this,new _("_read()"))},ie.prototype.pipe=function(w,P){var z=this,Q=this._readableState;switch(Q.pipesCount){case 0:Q.pipes=w;break;case 1:Q.pipes=[Q.pipes,w];break;default:Q.pipes.push(w);break}Q.pipesCount+=1,c("pipe count=%d opts=%j",Q.pipesCount,P);var Me=(!P||P.end!==!1)&&w!==t.stdout&&w!==t.stderr,_e=Me?Rt:u;Q.endEmitted?t.nextTick(_e):z.once("end",_e),w.on("unpipe",j);function j(d,b){c("onunpipe"),d===z&&b&&b.hasUnpiped===!1&&(b.hasUnpiped=!0,wr())}function Rt(){c("onend"),w.end()}var jt=D(z);w.on("drain",jt);var xt=!1;function wr(){c("cleanup"),w.removeListener("close",Pr),w.removeListener("finish",m),w.removeListener("drain",jt),w.removeListener("error",St),w.removeListener("unpipe",j),z.removeListener("end",Rt),z.removeListener("end",u),z.removeListener("data",yi),xt=!0,Q.awaitDrain&&(!w._writableState||w._writableState.needDrain)&&jt()}z.on("data",yi);function yi(d){c("ondata");var b=w.write(d);c("dest.write",b),b===!1&&((Q.pipesCount===1&&Q.pipes===w||Q.pipesCount>1&&oe(Q.pipes,w)!==-1)&&!xt&&(c("false write response, pause",Q.awaitDrain),Q.awaitDrain++),z.pause())}function St(d){c("onerror",d),u(),w.removeListener("error",St),n(w,"error")===0&&re(w,d)}ge(w,"error",St);function Pr(){w.removeListener("finish",m),u()}w.once("close",Pr);function m(){c("onfinish"),w.removeListener("close",Pr),u()}w.once("finish",m);function u(){c("unpipe"),z.unpipe(w)}return w.emit("pipe",z),Q.flowing||(c("pipe resume"),z.resume()),w};function D(w){return function(){var z=w._readableState;c("pipeOnDrain",z.awaitDrain),z.awaitDrain&&z.awaitDrain--,z.awaitDrain===0&&n(w,"data")&&(z.flowing=!0,M(w))}}ie.prototype.unpipe=function(w){var P=this._readableState,z={hasUnpiped:!1};if(P.pipesCount===0)return this;if(P.pipesCount===1)return w&&w!==P.pipes?this:(w||(w=P.pipes),P.pipes=null,P.pipesCount=0,P.flowing=!1,w&&w.emit("unpipe",this,z),this);if(!w){var Q=P.pipes,Me=P.pipesCount;P.pipes=null,P.pipesCount=0,P.flowing=!1;for(var _e=0;_e<Me;_e++)Q[_e].emit("unpipe",this,{hasUnpiped:!1});return this}var j=oe(P.pipes,w);return j===-1?this:(P.pipes.splice(j,1),P.pipesCount-=1,P.pipesCount===1&&(P.pipes=P.pipes[0]),w.emit("unpipe",this,z),this)},ie.prototype.on=function(w,P){var z=r.prototype.on.call(this,w,P),Q=this._readableState;return w==="data"?(Q.readableListening=this.listenerCount("readable")>0,Q.flowing!==!1&&this.resume()):w==="readable"&&!Q.endEmitted&&!Q.readableListening&&(Q.readableListening=Q.needReadable=!0,Q.flowing=!1,Q.emittedReadable=!1,c("on readable",Q.length,Q.reading),Q.length?xe(this):Q.reading||t.nextTick(F,this)),z},ie.prototype.addListener=ie.prototype.on,ie.prototype.removeListener=function(w,P){var z=r.prototype.removeListener.call(this,w,P);return w==="readable"&&t.nextTick(K,this),z},ie.prototype.removeAllListeners=function(w){var P=r.prototype.removeAllListeners.apply(this,arguments);return(w==="readable"||w===void 0)&&t.nextTick(K,this),P};function K(w){var P=w._readableState;P.readableListening=w.listenerCount("readable")>0,P.resumeScheduled&&!P.paused?P.flowing=!0:w.listenerCount("data")>0&&w.resume()}function F(w){c("readable nexttick read 0"),w.read(0)}ie.prototype.resume=function(){var w=this._readableState;return w.flowing||(c("resume"),w.flowing=!w.readableListening,fe(this,w)),w.paused=!1,this};function fe(w,P){P.resumeScheduled||(P.resumeScheduled=!0,t.nextTick(ve,w,P))}function ve(w,P){c("resume",P.reading),P.reading||w.read(0),P.resumeScheduled=!1,w.emit("resume"),M(w),P.flowing&&!P.reading&&w.read(0)}ie.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function M(w){var P=w._readableState;for(c("flow",P.flowing);P.flowing&&w.read()!==null;);}ie.prototype.wrap=function(w){var P=this,z=this._readableState,Q=!1;w.on("end",function(){if(c("wrapped end"),z.decoder&&!z.ended){var j=z.decoder.end();j&&j.length&&P.push(j)}P.push(null)}),w.on("data",function(j){if(c("wrapped data"),z.decoder&&(j=z.decoder.write(j)),!(z.objectMode&&j==null)&&!(!z.objectMode&&(!j||!j.length))){var Rt=P.push(j);Rt||(Q=!0,w.pause())}});for(var Me in w)this[Me]===void 0&&typeof w[Me]=="function"&&(this[Me]=(function(Rt){return function(){return w[Rt].apply(w,arguments)}})(Me));for(var _e=0;_e<ee.length;_e++)w.on(ee[_e],this.emit.bind(this,ee[_e]));return this._read=function(j){c("wrapped _read",j),Q&&(Q=!1,w.resume())},this},typeof Symbol=="function"&&(ie.prototype[Symbol.asyncIterator]=function(){return H===void 0&&(H=OI()),H(this)}),Object.defineProperty(ie.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(ie.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(ie.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(P){this._readableState&&(this._readableState.flowing=P)}}),ie._fromList=C,Object.defineProperty(ie.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function C(w,P){if(P.length===0)return null;var z;return P.objectMode?z=P.buffer.shift():!w||w>=P.length?(P.decoder?z=P.buffer.join(""):P.buffer.length===1?z=P.buffer.first():z=P.buffer.concat(P.length),P.buffer.clear()):z=P.buffer.consume(w,P.decoder),z}function $(w){var P=w._readableState;c("endReadable",P.endEmitted),P.endEmitted||(P.ended=!0,t.nextTick(Y,P,w))}function Y(w,P){if(c("endReadableNT",w.endEmitted,w.length),!w.endEmitted&&w.length===0&&(w.endEmitted=!0,P.readable=!1,P.emit("end"),w.autoDestroy)){var z=P._writableState;(!z||z.autoDestroy&&z.finished)&&P.destroy()}}typeof Symbol=="function"&&(ie.from=function(w,P){return Z===void 0&&(Z=RI()),Z(ie,w,P)});function oe(w,P){for(var z=0,Q=w.length;z<Q;z++)if(w[z]===P)return z;return-1}return Xa}function jh(){if(xh)return Qa;xh=!0,Qa=a;var t=vr().codes,e=t.ERR_METHOD_NOT_IMPLEMENTED,n=t.ERR_MULTIPLE_CALLBACK,r=t.ERR_TRANSFORM_ALREADY_TRANSFORMING,o=t.ERR_TRANSFORM_WITH_LENGTH_0,s=Tr();Zt()(a,s);function i(f,y){var g=this._transformState;g.transforming=!1;var h=g.writecb;if(h===null)return this.emit("error",new n);g.writechunk=null,g.writecb=null,y!=null&&this.push(y),h(f);var T=this._readableState;T.reading=!1,(T.needReadable||T.length<T.highWaterMark)&&this._read(T.highWaterMark)}function a(f){if(!(this instanceof a))return new a(f);s.call(this,f),this._transformState={afterTransform:i.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,f&&(typeof f.transform=="function"&&(this._transform=f.transform),typeof f.flush=="function"&&(this._flush=f.flush)),this.on("prefinish",l)}function l(){var f=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(y,g){c(f,y,g)}):c(this,null,null)}a.prototype.push=function(f,y){return this._transformState.needTransform=!1,s.prototype.push.call(this,f,y)},a.prototype._transform=function(f,y,g){g(new e("_transform()"))},a.prototype._write=function(f,y,g){var h=this._transformState;if(h.writecb=g,h.writechunk=f,h.writeencoding=y,!h.transforming){var T=this._readableState;(h.needTransform||T.needReadable||T.length<T.highWaterMark)&&this._read(T.highWaterMark)}},a.prototype._read=function(f){var y=this._transformState;y.writechunk!==null&&!y.transforming?(y.transforming=!0,this._transform(y.writechunk,y.writeencoding,y.afterTransform)):y.needTransform=!0},a.prototype._destroy=function(f,y){s.prototype._destroy.call(this,f,function(g){y(g)})};function c(f,y,g){if(y)return f.emit("error",y);if(g!=null&&f.push(g),f._writableState.length)throw new o;if(f._transformState.transforming)throw new r;return f.push(null)}return Qa}function MI(){if(Bh)return el;Bh=!0,el=e;var t=jh();Zt()(e,t);function e(n){if(!(this instanceof e))return new e(n);t.call(this,n)}return e.prototype._transform=function(n,r,o){o(null,n)},el}function NI(){if(Eh)return tl;Eh=!0;var t;function e(g){var h=!1;return function(){h||(h=!0,g.apply(void 0,arguments))}}var n=vr().codes,r=n.ERR_MISSING_ARGS,o=n.ERR_STREAM_DESTROYED;function s(g){if(g)throw g}function i(g){return g.setHeader&&typeof g.abort=="function"}function a(g,h,T,x){x=e(x);var B=!1;g.on("close",function(){B=!0}),t===void 0&&(t=sl()),t(g,{readable:h,writable:T},function(S){if(S)return x(S);B=!0,x()});var _=!1;return function(S){if(!B&&!_){if(_=!0,i(g))return g.abort();if(typeof g.destroy=="function")return g.destroy();x(S||new o("pipe"))}}}function l(g){g()}function c(g,h){return g.pipe(h)}function f(g){return!g.length||typeof g[g.length-1]!="function"?s:g.pop()}function y(){for(var g=arguments.length,h=new Array(g),T=0;T<g;T++)h[T]=arguments[T];var x=f(h);if(Array.isArray(h[0])&&(h=h[0]),h.length<2)throw new r("streams");var B,_=h.map(function(S,E){var H=E<h.length-1,Z=E>0;return a(S,H,Z,function(re){B||(B=re),re&&_.forEach(l),!H&&(_.forEach(l),x(B))})});return h.reduce(c)}return tl=y,tl}function $h(){return Sh||(Sh=!0,Pt=Pt=Uh(),Pt.Stream=Pt,Pt.Readable=Pt,Pt.Writable=Hh(),Pt.Duplex=Tr(),Pt.Transform=jh(),Pt.PassThrough=MI(),Pt.finished=sl(),Pt.pipeline=NI()),Pt}function Zh(){if(Ih)return Go;Ih=!0;var t=$t().Buffer,e=Nt,n=Rh(),r=Zt(),o=$h(),s=Go.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},i=Go.IncomingMessage=function(a,l,c,f){var y=this||Vo;if(o.Readable.call(y),y._mode=c,y.headers={},y.rawHeaders=[],y.trailers={},y.rawTrailers=[],y.on("end",function(){e.nextTick(function(){y.emit("close")})}),c==="fetch"){let _=function(){h.read().then(function(S){if(!y._destroyed){if(f(S.done),S.done){y.push(null);return}y.push(t.from(S.value)),_()}}).catch(function(S){f(!0),y._destroyed||y.emit("error",S)})};if(y._fetchResponse=l,y.url=l.url,y.statusCode=l.status,y.statusMessage=l.statusText,l.headers.forEach(function(S,E){y.headers[E.toLowerCase()]=S,y.rawHeaders.push(E,S)}),n.writableStream){var g=new WritableStream({write:function(S){return f(!1),new Promise(function(E,H){y._destroyed?H():y.push(t.from(S))?E():y._resumeFetch=E})},close:function(){f(!0),y._destroyed||y.push(null)},abort:function(S){f(!0),y._destroyed||y.emit("error",S)}});try{l.body.pipeTo(g).catch(function(S){f(!0),y._destroyed||y.emit("error",S)});return}catch{}}var h=l.body.getReader();_()}else{y._xhr=a,y._pos=0,y.url=a.responseURL,y.statusCode=a.status,y.statusMessage=a.statusText;var T=a.getAllResponseHeaders().split(/\r?\n/);if(T.forEach(function(_){var S=_.match(/^([^:]+):\s*(.*)/);if(S){var E=S[1].toLowerCase();E==="set-cookie"?(y.headers[E]===void 0&&(y.headers[E]=[]),y.headers[E].push(S[2])):y.headers[E]!==void 0?y.headers[E]+=", "+S[2]:y.headers[E]=S[2],y.rawHeaders.push(S[1],S[2])}}),y._charset="x-user-defined",!n.overrideMimeType){var x=y.rawHeaders["mime-type"];if(x){var B=x.match(/;\s*charset=([^;])(;|$)/);B&&(y._charset=B[1].toLowerCase())}y._charset||(y._charset="utf-8")}}};return r(i,o.Readable),i.prototype._read=function(){var a=this||Vo,l=a._resumeFetch;l&&(a._resumeFetch=null,l())},i.prototype._onXHRProgress=function(a){var l=this||Vo,c=l._xhr,f=null;switch(l._mode){case"text":if(f=c.responseText,f.length>l._pos){var y=f.substr(l._pos);if(l._charset==="x-user-defined"){for(var g=t.alloc(y.length),h=0;h<y.length;h++)g[h]=y.charCodeAt(h)&255;l.push(g)}else l.push(y,l._charset);l._pos=f.length}break;case"arraybuffer":if(c.readyState!==s.DONE||!c.response)break;f=c.response,l.push(t.from(new Uint8Array(f)));break;case"moz-chunked-arraybuffer":if(f=c.response,c.readyState!==s.LOADING||!f)break;l.push(t.from(new Uint8Array(f)));break;case"ms-stream":if(f=c.response,c.readyState!==s.LOADING)break;var T=new Vo.MSStreamReader;T.onprogress=function(){T.result.byteLength>l._pos&&(l.push(t.from(new Uint8Array(T.result.slice(l._pos)))),l._pos=T.result.byteLength)},T.onload=function(){a(!0),l.push(null)},T.readAsArrayBuffer(f);break}l._xhr.readyState===s.DONE&&l._mode!=="ms-stream"&&(a(!0),l.push(null))},Go}function DI(){if(kh)return nl;kh=!0;var t=$t().Buffer,e=Nt,n=Rh(),r=Zt(),o=Zh(),s=$h(),i=o.IncomingMessage,a=o.readyStates;function l(g,h){return n.fetch&&h?"fetch":n.mozchunkedarraybuffer?"moz-chunked-arraybuffer":n.msstream?"ms-stream":n.arraybuffer&&g?"arraybuffer":"text"}var c=nl=function(g){var h=this||ot;s.Writable.call(h),h._opts=g,h._body=[],h._headers={},g.auth&&h.setHeader("Authorization","Basic "+t.from(g.auth).toString("base64")),Object.keys(g.headers).forEach(function(B){h.setHeader(B,g.headers[B])});var T,x=!0;if(g.mode==="disable-fetch"||"requestTimeout"in g&&!n.abortController)x=!1,T=!0;else if(g.mode==="prefer-streaming")T=!1;else if(g.mode==="allow-wrong-content-type")T=!n.overrideMimeType;else if(!g.mode||g.mode==="default"||g.mode==="prefer-fast")T=!0;else throw new Error("Invalid value for opts.mode");h._mode=l(T,x),h._fetchTimer=null,h._socketTimeout=null,h._socketTimer=null,h.on("finish",function(){h._onFinish()})};r(c,s.Writable),c.prototype.setHeader=function(g,h){var T=this||ot,x=g.toLowerCase();y.indexOf(x)===-1&&(T._headers[x]={name:g,value:h})},c.prototype.getHeader=function(g){var h=(this||ot)._headers[g.toLowerCase()];return h?h.value:null},c.prototype.removeHeader=function(g){var h=this||ot;delete h._headers[g.toLowerCase()]},c.prototype._onFinish=function(){var g=this||ot;if(!g._destroyed){var h=g._opts;"timeout"in h&&h.timeout!==0&&g.setTimeout(h.timeout);var T=g._headers,x=null;h.method!=="GET"&&h.method!=="HEAD"&&(x=new Blob(g._body,{type:(T["content-type"]||{}).value||""}));var B=[];if(Object.keys(T).forEach(function(H){var Z=T[H].name,re=T[H].value;Array.isArray(re)?re.forEach(function(ee){B.push([Z,ee])}):B.push([Z,re])}),g._mode==="fetch"){var _=null;if(n.abortController){var S=new AbortController;_=S.signal,g._fetchAbortController=S,"requestTimeout"in h&&h.requestTimeout!==0&&(g._fetchTimer=ot.setTimeout(function(){g.emit("requestTimeout"),g._fetchAbortController&&g._fetchAbortController.abort()},h.requestTimeout))}ot.fetch(g._opts.url,{method:g._opts.method,headers:B,body:x||void 0,mode:"cors",credentials:h.withCredentials?"include":"same-origin",signal:_}).then(function(H){g._fetchResponse=H,g._resetTimers(!1),g._connect()},function(H){g._resetTimers(!0),g._destroyed||g.emit("error",H)})}else{var E=g._xhr=new ot.XMLHttpRequest;try{E.open(g._opts.method,g._opts.url,!0)}catch(H){e.nextTick(function(){g.emit("error",H)});return}"responseType"in E&&(E.responseType=g._mode),"withCredentials"in E&&(E.withCredentials=!!h.withCredentials),g._mode==="text"&&"overrideMimeType"in E&&E.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in h&&(E.timeout=h.requestTimeout,E.ontimeout=function(){g.emit("requestTimeout")}),B.forEach(function(H){E.setRequestHeader(H[0],H[1])}),g._response=null,E.onreadystatechange=function(){switch(E.readyState){case a.LOADING:case a.DONE:g._onXHRProgress();break}},g._mode==="moz-chunked-arraybuffer"&&(E.onprogress=function(){g._onXHRProgress()}),E.onerror=function(){g._destroyed||(g._resetTimers(!0),g.emit("error",new Error("XHR error")))};try{E.send(x)}catch(H){e.nextTick(function(){g.emit("error",H)});return}}}};function f(g){try{var h=g.status;return h!==null&&h!==0}catch{return!1}}c.prototype._onXHRProgress=function(){var g=this||ot;g._resetTimers(!1),!(!f(g._xhr)||g._destroyed)&&(g._response||g._connect(),g._response._onXHRProgress(g._resetTimers.bind(g)))},c.prototype._connect=function(){var g=this||ot;g._destroyed||(g._response=new i(g._xhr,g._fetchResponse,g._mode,g._resetTimers.bind(g)),g._response.on("error",function(h){g.emit("error",h)}),g.emit("response",g._response))},c.prototype._write=function(g,h,T){var x=this||ot;x._body.push(g),T()},c.prototype._resetTimers=function(g){var h=this||ot;ot.clearTimeout(h._socketTimer),h._socketTimer=null,g?(ot.clearTimeout(h._fetchTimer),h._fetchTimer=null):h._socketTimeout&&(h._socketTimer=ot.setTimeout(function(){h.emit("timeout")},h._socketTimeout))},c.prototype.abort=c.prototype.destroy=function(g){var h=this||ot;h._destroyed=!0,h._resetTimers(!0),h._response&&(h._response._destroyed=!0),h._xhr?h._xhr.abort():h._fetchAbortController&&h._fetchAbortController.abort(),g&&h.emit("error",g)},c.prototype.end=function(g,h,T){var x=this||ot;typeof g=="function"&&(T=g,g=void 0),s.Writable.prototype.end.call(x,g,h,T)},c.prototype.setTimeout=function(g,h){var T=this||ot;h&&T.once("timeout",h),T._socketTimeout=g,T._resetTimers(!1)},c.prototype.flushHeaders=function(){},c.prototype.setNoDelay=function(){},c.prototype.setSocketKeepAlive=function(){};var y=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"];return nl}function HI(){if(Ah)return rl;Ah=!0,rl=e;var t=Object.prototype.hasOwnProperty;function e(){for(var n={},r=0;r<arguments.length;r++){var o=arguments[r];for(var s in o)t.call(o,s)&&(n[s]=o[s])}return n}return rl}function UI(){return Ch||(Ch=!0,il={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}),il}function $I(){if(Oh)return ol;Oh=!0;var t=DI(),e=Zh(),n=HI(),r=UI(),o=De,s=ol;return s.request=function(i,a){typeof i=="string"?i=o.parse(i):i=n(i);var l=jI.location.protocol.search(/^https?:$/)===-1?"http:":"",c=i.protocol||l,f=i.hostname||i.host,y=i.port,g=i.path||"/";f&&f.indexOf(":")!==-1&&(f="["+f+"]"),i.url=(f?c+"//"+f:"")+(y?":"+y:"")+g,i.method=(i.method||"GET").toUpperCase(),i.headers=i.headers||{};var h=new t(i);return a&&h.on("response",a),h},s.get=function(a,l){var c=s.request(a,l);return c.end(),c},s.ClientRequest=t,s.IncomingMessage=e.IncomingMessage,s.Agent=function(){},s.Agent.defaultMaxSockets=4,s.globalAgent=new s.Agent,s.STATUS_CODES=r,s.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"],ol}var Et,ch,qn,Ka,dh,La,fh,Fa,ph,Wa,gh,za,yh,qa,mh,hh,Ga,Th,Va,vh,Ja,_h,Ya,bh,Xa,wh,Ph,Qa,xh,el,Bh,tl,Eh,Pt,Sh,Go,Ih,Vo,nl,kh,ot,rl,Ah,il,Ch,ol,Oh,jI,ln,ZI,KI,LI,FI,WI,zI,qI,GI,Lh=st(()=>{I();A();k();da();im();fa();_i();$m();zo();Ia();Wm();Gm();uh();Ra();Et={},ch=!1,qn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ka={},dh=!1;La={},fh=!1;Fa={},ph=!1;Wa={},gh=!1;za={},yh=!1;qa={},mh=!1,hh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ga={},Th=!1;Va={},vh=!1;Ja={},_h=!1;Ya={},bh=!1;Xa={},wh=!1,Ph=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Qa={},xh=!1;el={},Bh=!1;tl={},Eh=!1;Pt={},Sh=!1;Go={},Ih=!1,Vo=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;nl={},kh=!1,ot=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;rl={},Ah=!1;il={},Ch=!1;ol={},Oh=!1,jI=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;ln=$I(),ZI=ln.Agent,KI=ln.ClientRequest,LI=ln.IncomingMessage,FI=ln.METHODS,WI=ln.STATUS_CODES,zI=ln.get,qI=ln.globalAgent,GI=ln.request});I();A();k();var Wy={};bn(Wy,{defaults:()=>GB,markdown:()=>zB,markdownBloc:()=>qB});I();A();k();I();A();k();I();A();k();var Os=Object.defineProperty,nv=Object.defineProperties,rv=Object.getOwnPropertyDescriptors,Ci=Object.getOwnPropertySymbols,ud=Object.prototype.hasOwnProperty,cd=Object.prototype.propertyIsEnumerable,Bc=(t,e,n)=>e in t?Os(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,v=(t,e)=>{for(var n in e||(e={}))ud.call(e,n)&&Bc(t,n,e[n]);if(Ci)for(var n of Ci(e))cd.call(e,n)&&Bc(t,n,e[n]);return t},N=(t,e)=>nv(t,rv(e)),p=(t,e)=>Os(t,"name",{value:e,configurable:!0}),dd=(t,e)=>{var n={};for(var r in t)ud.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Ci)for(var r of Ci(t))e.indexOf(r)<0&&cd.call(t,r)&&(n[r]=t[r]);return n},po=(t,e)=>{for(var n in e)Os(t,n,{get:e[n],enumerable:!0})},RA={},iv={};po(iv,{errors:()=>fd,fromJSONSchema:()=>ly,fromJSONSchemaLegacy:()=>mB,fromObject:()=>As,toJSONSchema:()=>at,toJSONSchemaLegacy:()=>LB,toTypescriptSchema:()=>Ws,toTypescriptType:()=>zs});var le="x-zui",X={};po(X,{BRAND:()=>zP,DIRTY:()=>er,EMPTY_PATH:()=>KP,INVALID:()=>pe,NEVER:()=>zx,OK:()=>gt,ParseInputLazyPath:()=>Mt,ParseStatus:()=>_t,Schema:()=>he,ZodAny:()=>Gr,ZodArray:()=>Vr,ZodBigInt:()=>Gs,ZodBoolean:()=>Vs,ZodBranded:()=>Js,ZodCatch:()=>Ys,ZodDate:()=>Xs,ZodDefault:()=>xo,ZodDiscriminatedUnion:()=>xg,ZodEffects:()=>Rn,ZodEnum:()=>ur,ZodError:()=>Yt,ZodFirstPartyTypeKind:()=>dg,ZodFunction:()=>Eg,ZodIntersection:()=>ea,ZodIssueCode:()=>J,ZodLazy:()=>ta,ZodLiteral:()=>na,ZodMap:()=>Ig,ZodNaN:()=>Ag,ZodNativeEnum:()=>ra,ZodNever:()=>Xr,ZodNull:()=>ia,ZodNullable:()=>ir,ZodNumber:()=>oa,ZodObject:()=>or,ZodOptional:()=>gn,ZodParsedType:()=>ne,ZodPipeline:()=>sa,ZodPromise:()=>Eo,ZodReadonly:()=>So,ZodRecord:()=>Hg,ZodRef:()=>jg,ZodSchema:()=>he,ZodSet:()=>$g,ZodString:()=>yt,ZodSymbol:()=>Yg,ZodTransformer:()=>Rn,ZodTuple:()=>ar,ZodType:()=>he,ZodUndefined:()=>Io,ZodUnion:()=>aa,ZodUnknown:()=>Kr,ZodVoid:()=>ty,addIssueToContext:()=>te,agent:()=>QP,aimodel:()=>ix,any:()=>yx,array:()=>vx,bigint:()=>cx,boolean:()=>iy,coerce:()=>Wx,conversation:()=>JP,createZodEnum:()=>Bo,cuid2Regex:()=>Kg,cuidRegex:()=>Zg,custom:()=>wg,datasource:()=>ox,date:()=>dx,default:()=>jx,discriminatedUnion:()=>Px,effect:()=>sd,emailRegex:()=>Wg,enum:()=>Mx,errorUtil:()=>ue,event:()=>ex,function:()=>Cx,getErrorMap:()=>zr,getParsedType:()=>pn,instanceof:()=>lx,intent:()=>rx,intersection:()=>xx,ipv4Regex:()=>qg,ipv6Regex:()=>Gg,isAborted:()=>Ss,isAsync:()=>Mi,isDirty:()=>Is,isEmojiRegex:()=>qP,isValid:()=>qr,knowledgebase:()=>sx,late:()=>ax,lazy:()=>Ox,literal:()=>Rx,makeIssue:()=>Ri,map:()=>kx,message:()=>XP,nan:()=>ux,nativeEnum:()=>Nx,never:()=>hx,null:()=>gx,nullable:()=>Ux,number:()=>ry,object:()=>_x,objectUtil:()=>Es,oboolean:()=>Fx,onumber:()=>Lx,optional:()=>Hx,ostring:()=>Kx,pipeline:()=>Zx,preprocess:()=>$x,processCreateParams:()=>me,promise:()=>Dx,quotelessJson:()=>ZP,readonly:()=>Ix,record:()=>Ex,ref:()=>Sx,set:()=>Ax,setErrorMap:()=>gg,strictObject:()=>bx,string:()=>ny,symbol:()=>fx,table:()=>tx,tablerow:()=>nx,transformer:()=>sd,tuple:()=>Bx,ulidRegex:()=>Lg,undefined:()=>px,union:()=>wx,unknown:()=>mx,user:()=>YP,util:()=>be,uuidRegex:()=>Fg,variable:()=>VP,void:()=>Tx});var fd={};po(fd,{JSONSchemaToZuiError:()=>go,ObjectToZuiError:()=>hs,UnrepresentableGenericError:()=>Ts,UnsupportedJSONSchemaToZuiError:()=>fn,UnsupportedZuiCheckToJSONSchemaError:()=>vd,UnsupportedZuiToJSONSchemaError:()=>pt,UnsupportedZuiToTypescriptSchemaError:()=>En,UnsupportedZuiToTypescriptTypeError:()=>Ed,UntitledDeclarationError:()=>Id,ZuiToJSONSchemaError:()=>yo,ZuiToTypescriptSchemaError:()=>wd,ZuiToTypescriptTypeError:()=>mo,ZuiTransformError:()=>lr});var pd=class extends Error{constructor(e,n){super(n),this.transform=e}};p(pd,"ZuiTransformError");var lr=pd,gd=class extends lr{constructor(e){super("json-schema-to-zui",e)}};p(gd,"JSONSchemaToZuiError");var go=gd,yd=class extends lr{constructor(e){super("object-to-zui",e)}};p(yd,"ObjectToZuiError");var hs=yd,md=class extends lr{constructor(e){super("zui-to-json-schema",e)}};p(md,"ZuiToJSONSchemaError");var yo=md,hd=class extends yo{constructor(e,{suggestedAlternative:n}={}){super(`Zod type ${e} cannot be transformed to JSON Schema.`+(n?` Suggested alternative: ${n}`:""))}};p(hd,"UnsupportedZuiToJSONSchemaError");var pt=hd,Td=class extends yo{constructor({zodType:e,checkKind:n}){super(`Zod check .${n}() of type ${e} cannot be transformed to JSON Schema.`)}};p(Td,"UnsupportedZuiCheckToJSONSchemaError");var vd=Td,_d=class extends go{constructor(e){super(`JSON Schema ${JSON.stringify(e)} cannot be transformed to ZUI type.`)}};p(_d,"UnsupportedJSONSchemaToZuiError");var fn=_d,bd=class extends lr{constructor(e){super("zui-to-typescript-schema",e)}};p(bd,"ZuiToTypescriptSchemaError");var wd=bd,Pd=class extends wd{constructor(e){super(`Zod type ${e} cannot be transformed to TypeScript schema.`)}};p(Pd,"UnsupportedZuiToTypescriptSchemaError");var En=Pd,xd=class extends lr{constructor(e){super("zui-to-typescript-type",e)}};p(xd,"ZuiToTypescriptTypeError");var mo=xd,Bd=class extends mo{constructor(e){super(`Zod type ${e} cannot be transformed to TypeScript type.`)}};p(Bd,"UnsupportedZuiToTypescriptTypeError");var Ed=Bd,Sd=class extends mo{constructor(){super("Schema must have a title to be transformed to a TypeScript type with a declaration.")}};p(Sd,"UntitledDeclarationError");var Id=Sd,kd=class extends mo{constructor(){super('ZodRef can only be transformed to a TypeScript type with a "type" declaration.')}};p(kd,"UnrepresentableGenericError");var Ts=kd,ov=p((t,e)=>{let n={type:"array",description:t.description,items:e(t._def.type),"x-zui":t._def["x-zui"]};return t._def[le]&&(n[le]=t._def[le]),t._def.minLength&&(n.minItems=t._def.minLength.value),t._def.maxLength&&(n.maxItems=t._def.maxLength.value),t._def.exactLength&&(n.minItems=t._def.exactLength.value,n.maxItems=t._def.exactLength.value),n},"zodArrayToJsonArray"),sv=p(t=>{let e={type:"number",description:t.description,"x-zui":t._def["x-zui"]};t._def[le]&&(e[le]=t._def[le]);for(let n of t._def.checks)switch(n.kind){case"min":{let r=n.inclusive?"minimum":"exclusiveMinimum",o=n.inclusive?"exclusiveMinimum":"minimum";e[r]=n.value,delete e[o];break}case"max":{let r=n.inclusive?"maximum":"exclusiveMaximum",o=n.inclusive?"exclusiveMaximum":"maximum";e[r]=n.value,delete e[o];break}case"int":e.type="integer";break;case"finite":{e.format="finite";break}case"multipleOf":e.multipleOf=n.value;break;default:}return e},"zodNumberToJsonNumber"),av=p((t,e)=>{let n={type:"array",description:t.description,uniqueItems:!0,items:e(t._def.valueType),"x-zui":t._def["x-zui"]};return t._def[le]&&(n[le]=t._def[le]),t._def.minSize&&(n.minItems=t._def.minSize.value),t._def.maxSize&&(n.maxItems=t._def.maxSize.value),n},"zodSetToJsonSet"),Ad="\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}",Cd="(([+-]\\d{2}(:?\\d{2})?)|Z)",lv="Z",Od="(\\.\\d+)?",vs="\\.\\d{",uv="}",Rd=p(t=>{let e=t.precision?vs+t.precision+uv:t.precision===0?"":Od,n=t.offset?Cd:lv;return new RegExp(`^${Ad}${e}${n}$`)},"generateDatetimeRegex"),cv=p(t=>({precision:dv(t),offset:t.endsWith(`${Cd}$`)}),"extractPrecisionAndOffset"),dv=p(t=>{let e=t.slice(1+Ad.length);return e.startsWith(Od)?null:e.startsWith(vs)?parseInt(e.slice(vs.length)):0},"_extractPrecision"),jr={};po(jr,{escapeSpecialChars:()=>fv});var fv=p(t=>t.replaceAll(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeSpecialChars");function Rs(t,e,n,r){r?.errorMessages&&n&&(t.errorMessage=N(v({},t.errorMessage),{[e]:n}))}p(Rs,"addErrorMessage");function Re(t,e,n,r,o){t[e]=n,Rs(t,e,r,o)}p(Re,"setResponseValueAndErrors");var Xe={cuid:"^[cC][^\\s-]{8,}$",cuid2:"^[a-z][a-z0-9]*$",ulid:"^[0-9A-HJKMNP-TV-Z]{26}$",email:"^(?!\\.)(?!.*\\.\\.)([a-zA-Z0-9_+-\\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\\-]*\\.)+[a-zA-Z]{2,}$",emoji:"^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",uuid:"^[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}$",ipv4:"^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$",ipv6:"^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$"};function Ms(t,e){let n=v({type:"string"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{});function r(o){return e.patternStrategy==="escape"?jr.escapeSpecialChars(o):o}if(p(r,"processPattern"),t.checks)for(let o of t.checks)switch(o.kind){case"min":Re(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,o.value):o.value,o.message,e);break;case"max":Re(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,o.value):o.value,o.message,e);break;case"email":switch(e.emailStrategy){case"format:email":Bn(n,"email",o.message,e);break;case"format:idn-email":Bn(n,"idn-email",o.message,e);break;case"pattern:zod":Vt(n,Xe.email,o.message,e);break}break;case"url":Bn(n,"uri",o.message,e);break;case"uuid":Bn(n,"uuid",o.message,e);break;case"regex":Vt(n,o.regex.source,o.message,e);break;case"cuid":Vt(n,Xe.cuid,o.message,e);break;case"cuid2":Vt(n,Xe.cuid2,o.message,e);break;case"startsWith":Vt(n,"^"+r(o.value),o.message,e);break;case"endsWith":Vt(n,r(o.value)+"$",o.message,e);break;case"datetime":Bn(n,"date-time",o.message,e);break;case"length":Re(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,o.value):o.value,o.message,e),Re(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,o.value):o.value,o.message,e);break;case"includes":{Vt(n,r(o.value),o.message,e);break}case"ip":{o.version!=="v6"&&Bn(n,"ipv4",o.message,e),o.version!=="v4"&&Bn(n,"ipv6",o.message,e);break}case"emoji":Vt(n,Xe.emoji,o.message,e);break;case"ulid":{Vt(n,Xe.ulid,o.message,e);break}case"toLowerCase":case"toUpperCase":case"trim":break;default:}return n}p(Ms,"parseStringDef");var Bn=p((t,e,n,r)=>{var o;t.format||(o=t.anyOf)!=null&&o.some(s=>s.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push(v({format:t.format},t.errorMessage&&r.errorMessages&&{errorMessage:{format:t.errorMessage.format}})),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push(v({format:e},n&&r.errorMessages&&{errorMessage:{format:n}}))):Re(t,"format",e,n,r)},"addFormat"),Vt=p((t,e,n,r)=>{var o;t.pattern||(o=t.allOf)!=null&&o.some(s=>s.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push(v({pattern:t.pattern},t.errorMessage&&r.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}})),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push(v({pattern:e},n&&r.errorMessages&&{errorMessage:{pattern:n}}))):Re(t,"pattern",e,n,r)},"addPattern"),pv=p(t=>{let e={type:"string",description:t.description,"x-zui":t._def["x-zui"]};t._def[le]&&(e[le]=t._def[le]);for(let n of t._def.checks)switch(n.kind){case"cuid":e.format="cuid",e.pattern=Xe.cuid;break;case"cuid2":e.format="cuid2",e.pattern=Xe.cuid2;break;case"ulid":e.format="ulid",e.pattern=Xe.ulid;break;case"uuid":e.format="uuid",e.pattern=Xe.uuid;break;case"emoji":e.format="emoji",e.pattern=Xe.emoji;break;case"email":e.format="email",e.pattern=Xe.email;break;case"ip":e.format=n.version==="v6"?"ipv6":"ipv4",e.pattern=n.version==="v6"?Xe.ipv6:Xe.ipv4;break;case"datetime":e.format="date-time",(n.precision!==null||n.offset)&&(e.pattern=Rd(n).source,e[le]=N(v({},e[le]),{precision:n.precision,offset:n.offset}));break;case"url":e.format="uri";break;case"endsWith":e.pattern=`${jr.escapeSpecialChars(n.value)}$`;break;case"startsWith":e.pattern=`^${jr.escapeSpecialChars(n.value)}`;break;case"includes":let r=n.position&&n.position>=1?`^(?:.{${n.position}}).*`:"";e.pattern=`${r}${jr.escapeSpecialChars(n.value)}`;break;case"regex":e.pattern=n.regex.source;break;case"length":e.minLength=e.maxLength=Math.max(0,n.value);break;case"min":e.minLength=Math.max(0,n.value);break;case"max":e.maxLength=Math.max(0,n.value);break;default:throw new vd({zodType:R.ZodFirstPartyTypeKind.ZodString,checkKind:n.kind})}return e},"zodStringToJsonString"),gv=p((t,e)=>{let n={type:"array",description:t.description,items:t._def.items.map(r=>e(r))};return t._def[le]&&(n[le]=t._def[le]),t._def.rest&&(n.additionalItems=e(t._def.rest)),n},"zodTupleToJsonTuple");function at(t){let e=t,n=e._def;switch(n.typeName){case R.ZodFirstPartyTypeKind.ZodString:return pv(e);case R.ZodFirstPartyTypeKind.ZodNumber:return sv(e);case R.ZodFirstPartyTypeKind.ZodNaN:throw new pt(R.ZodFirstPartyTypeKind.ZodNaN);case R.ZodFirstPartyTypeKind.ZodBigInt:throw new pt(R.ZodFirstPartyTypeKind.ZodBigInt,{suggestedAlternative:"serialize bigint to string"});case R.ZodFirstPartyTypeKind.ZodBoolean:return{type:"boolean",description:n.description,"x-zui":n["x-zui"]};case R.ZodFirstPartyTypeKind.ZodDate:throw new pt(R.ZodFirstPartyTypeKind.ZodDate,{suggestedAlternative:"use z.string().datetime() instead"});case R.ZodFirstPartyTypeKind.ZodUndefined:return cs(n);case R.ZodFirstPartyTypeKind.ZodNull:return ds(n);case R.ZodFirstPartyTypeKind.ZodAny:return{description:n.description,"x-zui":n["x-zui"]};case R.ZodFirstPartyTypeKind.ZodUnknown:return{description:n.description,"x-zui":N(v({},n["x-zui"]),{def:{typeName:R.ZodFirstPartyTypeKind.ZodUnknown}})};case R.ZodFirstPartyTypeKind.ZodNever:return{not:!0,description:n.description,"x-zui":n["x-zui"]};case R.ZodFirstPartyTypeKind.ZodVoid:throw new pt(R.ZodFirstPartyTypeKind.ZodVoid);case R.ZodFirstPartyTypeKind.ZodArray:return ov(e,at);case R.ZodFirstPartyTypeKind.ZodObject:let r=Object.entries(n.shape()),o=r.filter(([f,y])=>!y.isOptional()),s=o.length?o.map(([f])=>f):void 0,i=r.map(([f,y])=>[f,y.mandatory()]).map(([f,y])=>[f,at(y)]),a=!1;return n.unknownKeys instanceof R.ZodType?a=at(n.unknownKeys):n.unknownKeys==="passthrough"&&(a=!0),{type:"object",description:n.description,properties:Object.fromEntries(i),required:s,additionalProperties:a,"x-zui":n["x-zui"]};case R.ZodFirstPartyTypeKind.ZodUnion:return{description:n.description,anyOf:n.options.map(f=>at(f)),"x-zui":n["x-zui"]};case R.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:return{description:n.description,anyOf:n.options.map(f=>at(f)),"x-zui":N(v({},n["x-zui"]),{def:{typeName:R.ZodFirstPartyTypeKind.ZodDiscriminatedUnion,discriminator:n.discriminator}})};case R.ZodFirstPartyTypeKind.ZodIntersection:let l=at(n.left),c=at(n.right);return"additionalProperties"in l&&delete l.additionalProperties,"additionalProperties"in c&&delete c.additionalProperties,{description:n.description,allOf:[l,c],"x-zui":n["x-zui"]};case R.ZodFirstPartyTypeKind.ZodTuple:return gv(e,at);case R.ZodFirstPartyTypeKind.ZodRecord:return{type:"object",description:n.description,additionalProperties:at(n.valueType),"x-zui":n["x-zui"]};case R.ZodFirstPartyTypeKind.ZodMap:throw new pt(R.ZodFirstPartyTypeKind.ZodMap);case R.ZodFirstPartyTypeKind.ZodSet:return av(e,at);case R.ZodFirstPartyTypeKind.ZodFunction:throw new pt(R.ZodFirstPartyTypeKind.ZodFunction);case R.ZodFirstPartyTypeKind.ZodLazy:throw new pt(R.ZodFirstPartyTypeKind.ZodLazy);case R.ZodFirstPartyTypeKind.ZodLiteral:if(typeof n.value=="string")return{type:"string",description:n.description,const:n.value,"x-zui":n["x-zui"]};if(typeof n.value=="number")return{type:"number",description:n.description,const:n.value,"x-zui":n["x-zui"]};if(typeof n.value=="boolean")return{type:"boolean",description:n.description,const:n.value,"x-zui":n["x-zui"]};if(n.value===null)return ds(n);if(n.value===void 0)return cs(n);{R.util.assertEqual(!0);let f=typeof n.value;throw new yo(`Unsupported literal type: "${f}"`)}case R.ZodFirstPartyTypeKind.ZodEnum:return{type:"string",description:n.description,enum:n.values,"x-zui":n["x-zui"]};case R.ZodFirstPartyTypeKind.ZodEffects:throw new pt(R.ZodFirstPartyTypeKind.ZodEffects);case R.ZodFirstPartyTypeKind.ZodNativeEnum:throw new pt(R.ZodFirstPartyTypeKind.ZodNativeEnum);case R.ZodFirstPartyTypeKind.ZodOptional:return{description:n.description,anyOf:[at(n.innerType),cs()],"x-zui":N(v({},n["x-zui"]),{def:{typeName:R.ZodFirstPartyTypeKind.ZodOptional}})};case R.ZodFirstPartyTypeKind.ZodNullable:return{anyOf:[at(n.innerType),ds()],"x-zui":N(v({},n["x-zui"]),{def:{typeName:R.ZodFirstPartyTypeKind.ZodNullable}})};case R.ZodFirstPartyTypeKind.ZodDefault:return N(v({},at(n.innerType)),{default:n.defaultValue()});case R.ZodFirstPartyTypeKind.ZodCatch:throw new pt(R.ZodFirstPartyTypeKind.ZodCatch);case R.ZodFirstPartyTypeKind.ZodPromise:throw new pt(R.ZodFirstPartyTypeKind.ZodPromise);case R.ZodFirstPartyTypeKind.ZodBranded:throw new pt(R.ZodFirstPartyTypeKind.ZodBranded);case R.ZodFirstPartyTypeKind.ZodPipeline:throw new pt(R.ZodFirstPartyTypeKind.ZodPipeline);case R.ZodFirstPartyTypeKind.ZodSymbol:throw new pt(R.ZodFirstPartyTypeKind.ZodPipeline);case R.ZodFirstPartyTypeKind.ZodReadonly:return N(v({},at(n.innerType)),{readOnly:!0});case R.ZodFirstPartyTypeKind.ZodRef:return{$ref:n.uri,description:n.description,"x-zui":n["x-zui"]};default:R.util.assertNever(n)}}p(at,"toJSONSchema");var cs=p(t=>({not:!0,description:t?.description,"x-zui":N(v({},t?.["x-zui"]),{def:{typeName:R.ZodFirstPartyTypeKind.ZodUndefined}})}),"undefinedSchema"),ds=p(t=>({type:"null",description:t?.description,"x-zui":t?.["x-zui"]}),"nullSchema"),yv=typeof global=="object"&&global&&global.Object===Object&&global,Md=yv,mv=typeof self=="object"&&self&&self.Object===Object&&self,hv=Md||mv||Function("return this")(),Qt=hv,Tv=Qt.Symbol,yn=Tv,Nd=Object.prototype,vv=Nd.hasOwnProperty,_v=Nd.toString,Br=yn?yn.toStringTag:void 0;function Dd(t){var e=vv.call(t,Br),n=t[Br];try{t[Br]=void 0;var r=!0}catch{}var o=_v.call(t);return r&&(e?t[Br]=n:delete t[Br]),o}p(Dd,"getRawTag");var bv=Dd,wv=Object.prototype,Pv=wv.toString;function Hd(t){return Pv.call(t)}p(Hd,"objectToString");var xv=Hd,Bv="[object Null]",Ev="[object Undefined]",Ec=yn?yn.toStringTag:void 0;function Ud(t){return t==null?t===void 0?Ev:Bv:Ec&&Ec in Object(t)?bv(t):xv(t)}p(Ud,"baseGetTag");var Mn=Ud;function jd(t){return t!=null&&typeof t=="object"}p(jd,"isObjectLike");var On=jd,Sv="[object Symbol]";function $d(t){return typeof t=="symbol"||On(t)&&Mn(t)==Sv}p($d,"isSymbol");var Ns=$d;function Zd(t,e){for(var n=-1,r=t==null?0:t.length,o=Array(r);++n<r;)o[n]=e(t[n],n,t);return o}p(Zd,"arrayMap");var Kd=Zd,Iv=Array.isArray,Xt=Iv,kv=1/0,Sc=yn?yn.prototype:void 0,Ic=Sc?Sc.toString:void 0;function Ds(t){if(typeof t=="string")return t;if(Xt(t))return Kd(t,Ds)+"";if(Ns(t))return Ic?Ic.call(t):"";var e=t+"";return e=="0"&&1/t==-kv?"-0":e}p(Ds,"baseToString");var Av=Ds;function Ld(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}p(Ld,"isObject");var rr=Ld;function Fd(t){return t}p(Fd,"identity");var Cv=Fd,Ov="[object AsyncFunction]",Rv="[object Function]",Mv="[object GeneratorFunction]",Nv="[object Proxy]";function Wd(t){if(!rr(t))return!1;var e=Mn(t);return e==Rv||e==Mv||e==Ov||e==Nv}p(Wd,"isFunction");var zd=Wd,Dv=Qt["__core-js_shared__"],fs=Dv,kc=(function(){var t=/[^.]+$/.exec(fs&&fs.keys&&fs.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function qd(t){return!!kc&&kc in t}p(qd,"isMasked");var Hv=qd,Uv=Function.prototype,jv=Uv.toString;function Gd(t){if(t!=null){try{return jv.call(t)}catch{}try{return t+""}catch{}}return""}p(Gd,"toSource");var Nn=Gd,$v=/[\\^$.*+?()[\]{}|]/g,Zv=/^\[object .+?Constructor\]$/,Kv=Function.prototype,Lv=Object.prototype,Fv=Kv.toString,Wv=Lv.hasOwnProperty,zv=RegExp("^"+Fv.call(Wv).replace($v,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Vd(t){if(!rr(t)||Hv(t))return!1;var e=zd(t)?zv:Zv;return e.test(Nn(t))}p(Vd,"baseIsNative");var qv=Vd;function Jd(t,e){return t?.[e]}p(Jd,"getValue");var Gv=Jd;function Yd(t,e){var n=Gv(t,e);return qv(n)?n:void 0}p(Yd,"getNative");var Dn=Yd,Vv=Dn(Qt,"WeakMap"),_s=Vv,Jv=(function(){try{var t=Dn(Object,"defineProperty");return t({},"",{}),t}catch{}})(),Ac=Jv,Yv=9007199254740991,Xv=/^(?:0|[1-9]\d*)$/;function Xd(t,e){var n=typeof t;return e=e??Yv,!!e&&(n=="number"||n!="symbol"&&Xv.test(t))&&t>-1&&t%1==0&&t<e}p(Xd,"isIndex");var Hs=Xd;function Qd(t,e,n){e=="__proto__"&&Ac?Ac(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}p(Qd,"baseAssignValue");var ef=Qd;function tf(t,e){return t===e||t!==t&&e!==e}p(tf,"eq");var Us=tf,Qv=Object.prototype,e_=Qv.hasOwnProperty;function nf(t,e,n){var r=t[e];(!(e_.call(t,e)&&Us(r,n))||n===void 0&&!(e in t))&&ef(t,e,n)}p(nf,"assignValue");var t_=nf,n_=9007199254740991;function rf(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=n_}p(rf,"isLength");var js=rf;function of(t){return t!=null&&js(t.length)&&!zd(t)}p(of,"isArrayLike");var sf=of,r_=Object.prototype;function af(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||r_;return t===n}p(af,"isPrototype");var lf=af;function uf(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}p(uf,"baseTimes");var i_=uf,o_="[object Arguments]";function cf(t){return On(t)&&Mn(t)==o_}p(cf,"baseIsArguments");var Cc=cf,df=Object.prototype,s_=df.hasOwnProperty,a_=df.propertyIsEnumerable,l_=Cc((function(){return arguments})())?Cc:function(t){return On(t)&&s_.call(t,"callee")&&!a_.call(t,"callee")},ff=l_;function pf(){return!1}p(pf,"stubFalse");var u_=pf,gf=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Oc=gf&&typeof module=="object"&&module&&!module.nodeType&&module,c_=Oc&&Oc.exports===gf,Rc=c_?Qt.Buffer:void 0,d_=Rc?Rc.isBuffer:void 0,f_=d_||u_,bs=f_,p_="[object Arguments]",g_="[object Array]",y_="[object Boolean]",m_="[object Date]",h_="[object Error]",T_="[object Function]",v_="[object Map]",__="[object Number]",b_="[object Object]",w_="[object RegExp]",P_="[object Set]",x_="[object String]",B_="[object WeakMap]",E_="[object ArrayBuffer]",S_="[object DataView]",I_="[object Float32Array]",k_="[object Float64Array]",A_="[object Int8Array]",C_="[object Int16Array]",O_="[object Int32Array]",R_="[object Uint8Array]",M_="[object Uint8ClampedArray]",N_="[object Uint16Array]",D_="[object Uint32Array]",je={};je[I_]=je[k_]=je[A_]=je[C_]=je[O_]=je[R_]=je[M_]=je[N_]=je[D_]=!0;je[p_]=je[g_]=je[E_]=je[y_]=je[S_]=je[m_]=je[h_]=je[T_]=je[v_]=je[__]=je[b_]=je[w_]=je[P_]=je[x_]=je[B_]=!1;function yf(t){return On(t)&&js(t.length)&&!!je[Mn(t)]}p(yf,"baseIsTypedArray");var H_=yf;function mf(t){return function(e){return t(e)}}p(mf,"baseUnary");var U_=mf,hf=typeof exports=="object"&&exports&&!exports.nodeType&&exports,$r=hf&&typeof module=="object"&&module&&!module.nodeType&&module,j_=$r&&$r.exports===hf,ps=j_&&Md.process,$_=(function(){try{var t=$r&&$r.require&&$r.require("util").types;return t||ps&&ps.binding&&ps.binding("util")}catch{}})(),Mc=$_,Nc=Mc&&Mc.isTypedArray,Z_=Nc?U_(Nc):H_,Tf=Z_,K_=Object.prototype,L_=K_.hasOwnProperty;function vf(t,e){var n=Xt(t),r=!n&&ff(t),o=!n&&!r&&bs(t),s=!n&&!r&&!o&&Tf(t),i=n||r||o||s,a=i?i_(t.length,String):[],l=a.length;for(var c in t)(e||L_.call(t,c))&&!(i&&(c=="length"||o&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||Hs(c,l)))&&a.push(c);return a}p(vf,"arrayLikeKeys");var _f=vf;function bf(t,e){return function(n){return t(e(n))}}p(bf,"overArg");var wf=bf,F_=wf(Object.keys,Object),W_=F_,z_=Object.prototype,q_=z_.hasOwnProperty;function Pf(t){if(!lf(t))return W_(t);var e=[];for(var n in Object(t))q_.call(t,n)&&n!="constructor"&&e.push(n);return e}p(Pf,"baseKeys");var G_=Pf;function xf(t){return sf(t)?_f(t):G_(t)}p(xf,"keys");var $s=xf;function Bf(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}p(Bf,"nativeKeysIn");var V_=Bf,J_=Object.prototype,Y_=J_.hasOwnProperty;function Ef(t){if(!rr(t))return V_(t);var e=lf(t),n=[];for(var r in t)r=="constructor"&&(e||!Y_.call(t,r))||n.push(r);return n}p(Ef,"baseKeysIn");var X_=Ef;function Sf(t){return sf(t)?_f(t,!0):X_(t)}p(Sf,"keysIn");var Q_=Sf,eb=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,tb=/^\w*$/;function If(t,e){if(Xt(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||Ns(t)?!0:tb.test(t)||!eb.test(t)||e!=null&&t in Object(e)}p(If,"isKey");var Zs=If,nb=Dn(Object,"create"),Lr=nb;function kf(){this.__data__=Lr?Lr(null):{},this.size=0}p(kf,"hashClear");var rb=kf;function Af(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}p(Af,"hashDelete");var ib=Af,ob="__lodash_hash_undefined__",sb=Object.prototype,ab=sb.hasOwnProperty;function Cf(t){var e=this.__data__;if(Lr){var n=e[t];return n===ob?void 0:n}return ab.call(e,t)?e[t]:void 0}p(Cf,"hashGet");var lb=Cf,ub=Object.prototype,cb=ub.hasOwnProperty;function Of(t){var e=this.__data__;return Lr?e[t]!==void 0:cb.call(e,t)}p(Of,"hashHas");var db=Of,fb="__lodash_hash_undefined__";function Rf(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Lr&&e===void 0?fb:e,this}p(Rf,"hashSet");var pb=Rf;function Hn(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}p(Hn,"Hash");Hn.prototype.clear=rb;Hn.prototype.delete=ib;Hn.prototype.get=lb;Hn.prototype.has=db;Hn.prototype.set=pb;var Dc=Hn;function Mf(){this.__data__=[],this.size=0}p(Mf,"listCacheClear");var gb=Mf;function Nf(t,e){for(var n=t.length;n--;)if(Us(t[n][0],e))return n;return-1}p(Nf,"assocIndexOf");var ho=Nf,yb=Array.prototype,mb=yb.splice;function Df(t){var e=this.__data__,n=ho(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():mb.call(e,n,1),--this.size,!0}p(Df,"listCacheDelete");var hb=Df;function Hf(t){var e=this.__data__,n=ho(e,t);return n<0?void 0:e[n][1]}p(Hf,"listCacheGet");var Tb=Hf;function Uf(t){return ho(this.__data__,t)>-1}p(Uf,"listCacheHas");var vb=Uf;function jf(t,e){var n=this.__data__,r=ho(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}p(jf,"listCacheSet");var _b=jf;function Un(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}p(Un,"ListCache");Un.prototype.clear=gb;Un.prototype.delete=hb;Un.prototype.get=Tb;Un.prototype.has=vb;Un.prototype.set=_b;var To=Un,bb=Dn(Qt,"Map"),Fr=bb;function $f(){this.size=0,this.__data__={hash:new Dc,map:new(Fr||To),string:new Dc}}p($f,"mapCacheClear");var wb=$f;function Zf(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}p(Zf,"isKeyable");var Pb=Zf;function Kf(t,e){var n=t.__data__;return Pb(e)?n[typeof e=="string"?"string":"hash"]:n.map}p(Kf,"getMapData");var vo=Kf;function Lf(t){var e=vo(this,t).delete(t);return this.size-=e?1:0,e}p(Lf,"mapCacheDelete");var xb=Lf;function Ff(t){return vo(this,t).get(t)}p(Ff,"mapCacheGet");var Bb=Ff;function Wf(t){return vo(this,t).has(t)}p(Wf,"mapCacheHas");var Eb=Wf;function zf(t,e){var n=vo(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}p(zf,"mapCacheSet");var Sb=zf;function jn(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}p(jn,"MapCache");jn.prototype.clear=wb;jn.prototype.delete=xb;jn.prototype.get=Bb;jn.prototype.has=Eb;jn.prototype.set=Sb;var _o=jn,Ib="Expected a function";function bo(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(Ib);var n=p(function(){var r=arguments,o=e?e.apply(this,r):r[0],s=n.cache;if(s.has(o))return s.get(o);var i=t.apply(this,r);return n.cache=s.set(o,i)||s,i},"memoized");return n.cache=new(bo.Cache||_o),n}p(bo,"memoize");bo.Cache=_o;var kb=bo,Ab=500;function qf(t){var e=kb(t,function(r){return n.size===Ab&&n.clear(),r}),n=e.cache;return e}p(qf,"memoizeCapped");var Cb=qf,Ob=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Rb=/\\(\\)?/g,Mb=Cb(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Ob,function(n,r,o,s){e.push(o?s.replace(Rb,"$1"):r||n)}),e}),Nb=Mb;function Gf(t){return t==null?"":Av(t)}p(Gf,"toString");var Db=Gf;function Vf(t,e){return Xt(t)?t:Zs(t,e)?[t]:Nb(Db(t))}p(Vf,"castPath");var wo=Vf,Hb=1/0;function Jf(t){if(typeof t=="string"||Ns(t))return t;var e=t+"";return e=="0"&&1/t==-Hb?"-0":e}p(Jf,"toKey");var Yr=Jf;function Yf(t,e){e=wo(e,t);for(var n=0,r=e.length;t!=null&&n<r;)t=t[Yr(e[n++])];return n&&n==r?t:void 0}p(Yf,"baseGet");var Ks=Yf;function Xf(t,e,n){var r=t==null?void 0:Ks(t,e);return r===void 0?n:r}p(Xf,"get");var Ub=Xf;function Qf(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}p(Qf,"arrayPush");var ep=Qf,jb=wf(Object.getPrototypeOf,Object),tp=jb,$b="[object Object]",Zb=Function.prototype,Kb=Object.prototype,np=Zb.toString,Lb=Kb.hasOwnProperty,Fb=np.call(Object);function rp(t){if(!On(t)||Mn(t)!=$b)return!1;var e=tp(t);if(e===null)return!0;var n=Lb.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&np.call(n)==Fb}p(rp,"isPlainObject");var Hc=rp;function ip(){this.__data__=new To,this.size=0}p(ip,"stackClear");var Wb=ip;function op(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}p(op,"stackDelete");var zb=op;function sp(t){return this.__data__.get(t)}p(sp,"stackGet");var qb=sp;function ap(t){return this.__data__.has(t)}p(ap,"stackHas");var Gb=ap,Vb=200;function lp(t,e){var n=this.__data__;if(n instanceof To){var r=n.__data__;if(!Fr||r.length<Vb-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new _o(r)}return n.set(t,e),this.size=n.size,this}p(lp,"stackSet");var Jb=lp;function $n(t){var e=this.__data__=new To(t);this.size=e.size}p($n,"Stack");$n.prototype.clear=Wb;$n.prototype.delete=zb;$n.prototype.get=qb;$n.prototype.has=Gb;$n.prototype.set=Jb;var Pi=$n;function up(t,e){for(var n=-1,r=t==null?0:t.length,o=0,s=[];++n<r;){var i=t[n];e(i,n,t)&&(s[o++]=i)}return s}p(up,"arrayFilter");var Yb=up;function cp(){return[]}p(cp,"stubArray");var dp=cp,Xb=Object.prototype,Qb=Xb.propertyIsEnumerable,Uc=Object.getOwnPropertySymbols,ew=Uc?function(t){return t==null?[]:(t=Object(t),Yb(Uc(t),function(e){return Qb.call(t,e)}))}:dp,fp=ew,tw=Object.getOwnPropertySymbols,nw=tw?function(t){for(var e=[];t;)ep(e,fp(t)),t=tp(t);return e}:dp,rw=nw;function pp(t,e,n){var r=e(t);return Xt(t)?r:ep(r,n(t))}p(pp,"baseGetAllKeys");var gp=pp;function yp(t){return gp(t,$s,fp)}p(yp,"getAllKeys");var jc=yp;function mp(t){return gp(t,Q_,rw)}p(mp,"getAllKeysIn");var iw=mp,ow=Dn(Qt,"DataView"),ws=ow,sw=Dn(Qt,"Promise"),Ps=sw,aw=Dn(Qt,"Set"),xs=aw,$c="[object Map]",lw="[object Object]",Zc="[object Promise]",Kc="[object Set]",Lc="[object WeakMap]",Fc="[object DataView]",uw=Nn(ws),cw=Nn(Fr),dw=Nn(Ps),fw=Nn(xs),pw=Nn(_s),Sn=Mn;(ws&&Sn(new ws(new ArrayBuffer(1)))!=Fc||Fr&&Sn(new Fr)!=$c||Ps&&Sn(Ps.resolve())!=Zc||xs&&Sn(new xs)!=Kc||_s&&Sn(new _s)!=Lc)&&(Sn=p(function(t){var e=Mn(t),n=e==lw?t.constructor:void 0,r=n?Nn(n):"";if(r)switch(r){case uw:return Fc;case cw:return $c;case dw:return Zc;case fw:return Kc;case pw:return Lc}return e},"getTag"));var Wc=Sn,gw=Qt.Uint8Array,zc=gw,yw="__lodash_hash_undefined__";function hp(t){return this.__data__.set(t,yw),this}p(hp,"setCacheAdd");var mw=hp;function Tp(t){return this.__data__.has(t)}p(Tp,"setCacheHas");var hw=Tp;function Wr(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new _o;++e<n;)this.add(t[e])}p(Wr,"SetCache");Wr.prototype.add=Wr.prototype.push=mw;Wr.prototype.has=hw;var Tw=Wr;function vp(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}p(vp,"arraySome");var vw=vp;function _p(t,e){return t.has(e)}p(_p,"cacheHas");var _w=_p,bw=1,ww=2;function bp(t,e,n,r,o,s){var i=n&bw,a=t.length,l=e.length;if(a!=l&&!(i&&l>a))return!1;var c=s.get(t),f=s.get(e);if(c&&f)return c==e&&f==t;var y=-1,g=!0,h=n&ww?new Tw:void 0;for(s.set(t,e),s.set(e,t);++y<a;){var T=t[y],x=e[y];if(r)var B=i?r(x,T,y,e,t,s):r(T,x,y,t,e,s);if(B!==void 0){if(B)continue;g=!1;break}if(h){if(!vw(e,function(_,S){if(!_w(h,S)&&(T===_||o(T,_,n,r,s)))return h.push(S)})){g=!1;break}}else if(!(T===x||o(T,x,n,r,s))){g=!1;break}}return s.delete(t),s.delete(e),g}p(bp,"equalArrays");var wp=bp;function Pp(t){var e=-1,n=Array(t.size);return t.forEach(function(r,o){n[++e]=[o,r]}),n}p(Pp,"mapToArray");var Pw=Pp;function xp(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}p(xp,"setToArray");var xw=xp,Bw=1,Ew=2,Sw="[object Boolean]",Iw="[object Date]",kw="[object Error]",Aw="[object Map]",Cw="[object Number]",Ow="[object RegExp]",Rw="[object Set]",Mw="[object String]",Nw="[object Symbol]",Dw="[object ArrayBuffer]",Hw="[object DataView]",qc=yn?yn.prototype:void 0,gs=qc?qc.valueOf:void 0;function Bp(t,e,n,r,o,s,i){switch(n){case Hw:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Dw:return!(t.byteLength!=e.byteLength||!s(new zc(t),new zc(e)));case Sw:case Iw:case Cw:return Us(+t,+e);case kw:return t.name==e.name&&t.message==e.message;case Ow:case Mw:return t==e+"";case Aw:var a=Pw;case Rw:var l=r&Bw;if(a||(a=xw),t.size!=e.size&&!l)return!1;var c=i.get(t);if(c)return c==e;r|=Ew,i.set(t,e);var f=wp(a(t),a(e),r,o,s,i);return i.delete(t),f;case Nw:if(gs)return gs.call(t)==gs.call(e)}return!1}p(Bp,"equalByTag");var Uw=Bp,jw=1,$w=Object.prototype,Zw=$w.hasOwnProperty;function Ep(t,e,n,r,o,s){var i=n&jw,a=jc(t),l=a.length,c=jc(e),f=c.length;if(l!=f&&!i)return!1;for(var y=l;y--;){var g=a[y];if(!(i?g in e:Zw.call(e,g)))return!1}var h=s.get(t),T=s.get(e);if(h&&T)return h==e&&T==t;var x=!0;s.set(t,e),s.set(e,t);for(var B=i;++y<l;){g=a[y];var _=t[g],S=e[g];if(r)var E=i?r(S,_,g,e,t,s):r(_,S,g,t,e,s);if(!(E===void 0?_===S||o(_,S,n,r,s):E)){x=!1;break}B||(B=g=="constructor")}if(x&&!B){var H=t.constructor,Z=e.constructor;H!=Z&&"constructor"in t&&"constructor"in e&&!(typeof H=="function"&&H instanceof H&&typeof Z=="function"&&Z instanceof Z)&&(x=!1)}return s.delete(t),s.delete(e),x}p(Ep,"equalObjects");var Kw=Ep,Lw=1,Gc="[object Arguments]",Vc="[object Array]",bi="[object Object]",Fw=Object.prototype,Jc=Fw.hasOwnProperty;function Sp(t,e,n,r,o,s){var i=Xt(t),a=Xt(e),l=i?Vc:Wc(t),c=a?Vc:Wc(e);l=l==Gc?bi:l,c=c==Gc?bi:c;var f=l==bi,y=c==bi,g=l==c;if(g&&bs(t)){if(!bs(e))return!1;i=!0,f=!1}if(g&&!f)return s||(s=new Pi),i||Tf(t)?wp(t,e,n,r,o,s):Uw(t,e,l,n,r,o,s);if(!(n&Lw)){var h=f&&Jc.call(t,"__wrapped__"),T=y&&Jc.call(e,"__wrapped__");if(h||T){var x=h?t.value():t,B=T?e.value():e;return s||(s=new Pi),o(x,B,n,r,s)}}return g?(s||(s=new Pi),Kw(t,e,n,r,o,s)):!1}p(Sp,"baseIsEqualDeep");var Ww=Sp;function Ls(t,e,n,r,o){return t===e?!0:t==null||e==null||!On(t)&&!On(e)?t!==t&&e!==e:Ww(t,e,n,r,Ls,o)}p(Ls,"baseIsEqual");var Po=Ls,zw=1,qw=2;function Ip(t,e,n,r){var o=n.length,s=o,i=!r;if(t==null)return!s;for(t=Object(t);o--;){var a=n[o];if(i&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++o<s;){a=n[o];var l=a[0],c=t[l],f=a[1];if(i&&a[2]){if(c===void 0&&!(l in t))return!1}else{var y=new Pi;if(r)var g=r(c,f,l,t,e,y);if(!(g===void 0?Po(f,c,zw|qw,r,y):g))return!1}}return!0}p(Ip,"baseIsMatch");var Gw=Ip;function kp(t){return t===t&&!rr(t)}p(kp,"isStrictComparable");var Ap=kp;function Cp(t){for(var e=$s(t),n=e.length;n--;){var r=e[n],o=t[r];e[n]=[r,o,Ap(o)]}return e}p(Cp,"getMatchData");var Vw=Cp;function Op(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}p(Op,"matchesStrictComparable");var Rp=Op;function Mp(t){var e=Vw(t);return e.length==1&&e[0][2]?Rp(e[0][0],e[0][1]):function(n){return n===t||Gw(n,t,e)}}p(Mp,"baseMatches");var Jw=Mp;function Np(t,e){return t!=null&&e in Object(t)}p(Np,"baseHasIn");var Yw=Np;function Dp(t,e,n){e=wo(e,t);for(var r=-1,o=e.length,s=!1;++r<o;){var i=Yr(e[r]);if(!(s=t!=null&&n(t,i)))break;t=t[i]}return s||++r!=o?s:(o=t==null?0:t.length,!!o&&js(o)&&Hs(i,o)&&(Xt(t)||ff(t)))}p(Dp,"hasPath");var Xw=Dp;function Hp(t,e){return t!=null&&Xw(t,e,Yw)}p(Hp,"hasIn");var Qw=Hp,eP=1,tP=2;function Up(t,e){return Zs(t)&&Ap(e)?Rp(Yr(t),e):function(n){var r=Ub(n,t);return r===void 0&&r===e?Qw(n,t):Po(e,r,eP|tP)}}p(Up,"baseMatchesProperty");var nP=Up;function jp(t){return function(e){return e?.[t]}}p(jp,"baseProperty");var rP=jp;function $p(t){return function(e){return Ks(e,t)}}p($p,"basePropertyDeep");var iP=$p;function Zp(t){return Zs(t)?rP(Yr(t)):iP(t)}p(Zp,"property");var oP=Zp;function Kp(t){return typeof t=="function"?t:t==null?Cv:typeof t=="object"?Xt(t)?nP(t[0],t[1]):Jw(t):oP(t)}p(Kp,"baseIteratee");var Fs=Kp;function Lp(t){return function(e,n,r){for(var o=-1,s=Object(e),i=r(e),a=i.length;a--;){var l=i[t?a:++o];if(n(s[l],l,s)===!1)break}return e}}p(Lp,"createBaseFor");var sP=Lp,aP=sP(),lP=aP;function Fp(t,e){return t&&lP(t,e,$s)}p(Fp,"baseForOwn");var uP=Fp;function Wp(t,e){return Po(t,e)}p(Wp,"isEqual");var tr=Wp;function zp(t,e,n){n=typeof n=="function"?n:void 0;var r=n?n(t,e):void 0;return r===void 0?Po(t,e,void 0,n):!!r}p(zp,"isEqualWith");var cP=zp;function qp(t){return t===void 0}p(qp,"isUndefined");var Yc=qp;function Gp(t,e){var n={};return e=Fs(e,3),uP(t,function(r,o,s){ef(n,o,e(r,o,s))}),n}p(Gp,"mapValues");var dP=Gp,fP="Expected a function";function Vp(t){if(typeof t!="function")throw new TypeError(fP);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}p(Vp,"negate");var pP=Vp;function Jp(t,e,n,r){if(!rr(t))return t;e=wo(e,t);for(var o=-1,s=e.length,i=s-1,a=t;a!=null&&++o<s;){var l=Yr(e[o]),c=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return t;if(o!=i){var f=a[l];c=r?r(f,l,a):void 0,c===void 0&&(c=rr(f)?f:Hs(e[o+1])?[]:{})}t_(a,l,c),a=a[l]}return t}p(Jp,"baseSet");var gP=Jp;function Yp(t,e,n){for(var r=-1,o=e.length,s={};++r<o;){var i=e[r],a=Ks(t,i);n(a,i)&&gP(s,wo(i,t),a)}return s}p(Yp,"basePickBy");var yP=Yp;function Xp(t,e){if(t==null)return{};var n=Kd(iw(t),function(r){return[r]});return e=Fs(e),yP(t,n,function(r,o){return e(r,o[0])})}p(Xp,"pickBy");var mP=Xp;function Qp(t,e){return mP(t,pP(Fs(e)))}p(Qp,"omitBy");var Xc=Qp;function eg(t){return typeof t=="symbol"?"symbol":typeof t=="bigint"?`${t.toString()}n`:ae(t)}p(eg,"primitiveToTypscriptLiteralType");function ae(t){return typeof t>"u"?"undefined":typeof t=="symbol"?t.description?`Symbol(${ae(t.description)})`:"Symbol()":typeof t=="bigint"?`BigInt(${t.toString()})`:typeof t=="string"?rg(t):JSON.stringify(t)}p(ae,"primitiveToTypescriptValue");function nr(t){return typeof t>"u"?"undefined":JSON.stringify(t)}p(nr,"unknownToTypescriptValue");var tg=p((t,e)=>{let n=Object.entries(t),r=e?" as const":"";return`{ ${n.map(([o,s])=>`${Bs(o)}: ${nr(s)}`).join(", ")} }${r}`},"recordOfUnknownToTypescriptRecord"),Bs=p(t=>/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t)?t:ae(t),"toPropertyKey"),hP=p(t=>t.charAt(0).toUpperCase()+t.slice(1),"capitalize"),ng=p(t=>{let e=/[^a-zA-Z0-9_]/g;return t.split(e).map(hP).filter(r=>!!r).join("")},"toTypeArgumentName"),Qc=p(t=>{for(var e;t.length&&!((e=t[0])!=null&&e.trim());)t.shift();for(;t.length&&!t[t.length-1].trim();)t.pop()},"trimEmptyLinesInPlace"),rt=p(t=>{t=t?.replace(/(\n(\s*)?){3,}/g,`
14
14
 
15
- `);let e=f(o=>o.startsWith("* ")?` ${o}`:` * ${o}`,"ensureLineStartsWithAsterisk"),n=f(o=>o.replace(/\*\//g,"*\\/"),"escapeCommentEnd"),r=(t??"").split(`
16
- `).map(o=>o.trim());return Ec(r),r.length&&(r[0]=r[0].replace(/^\/\*\*?/,""),r[r.length-1]=r[r.length-1].replace(/\*\/$/,"")),Ec(r),r.length===0?"":r.length===1?`/** ${n(r[0])} */`:`/**
15
+ `);let e=p(o=>o.startsWith("* ")?` ${o}`:` * ${o}`,"ensureLineStartsWithAsterisk"),n=p(o=>o.replace(/\*\//g,"*\\/"),"escapeCommentEnd"),r=(t??"").split(`
16
+ `).map(o=>o.trim());return Qc(r),r.length&&(r[0]=r[0].replace(/^\/\*\*?/,""),r[r.length-1]=r[r.length-1].replace(/\*\/$/,"")),Qc(r),r.length===0?"":r.length===1?`/** ${n(r[0])} */`:`/**
17
17
  ${r.map(e).map(n).join(`
18
18
  `)}
19
- */`},"getMultilineComment");function yd(t){if(typeof t!="string")return"";let n=String.raw`${t}`.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/"/g,'\\"').replace(/'/g,"\\'");return n.includes("`")?`"${n}"`:n.includes("'")?`"${n}"`:`'${n}'`}f(yd,"escapeString");var md={};po(md,{JSONSchemaToZuiError:()=>go,ObjectToZuiError:()=>Ts,UnrepresentableGenericError:()=>vs,UnsupportedJSONSchemaToZuiError:()=>fn,UnsupportedZuiCheckToJSONSchemaError:()=>Pd,UnsupportedZuiToJSONSchemaError:()=>pt,UnsupportedZuiToTypescriptSchemaError:()=>En,UnsupportedZuiToTypescriptTypeError:()=>Ad,UntitledDeclarationError:()=>Od,ZuiToJSONSchemaError:()=>yo,ZuiToTypescriptSchemaError:()=>Ed,ZuiToTypescriptTypeError:()=>mo,ZuiTransformError:()=>lr});var hd=class extends Error{constructor(e,n){super(n),this.transform=e}};f(hd,"ZuiTransformError");var lr=hd,Td=class extends lr{constructor(e){super("json-schema-to-zui",e)}};f(Td,"JSONSchemaToZuiError");var go=Td,vd=class extends lr{constructor(e){super("object-to-zui",e)}};f(vd,"ObjectToZuiError");var Ts=vd,_d=class extends lr{constructor(e){super("zui-to-json-schema",e)}};f(_d,"ZuiToJSONSchemaError");var yo=_d,bd=class extends yo{constructor(e,{suggestedAlternative:n}={}){super(`Zod type ${e} cannot be transformed to JSON Schema.`+(n?` Suggested alternative: ${n}`:""))}};f(bd,"UnsupportedZuiToJSONSchemaError");var pt=bd,wd=class extends yo{constructor({zodType:e,checkKind:n}){super(`Zod check .${n}() of type ${e} cannot be transformed to JSON Schema.`)}};f(wd,"UnsupportedZuiCheckToJSONSchemaError");var Pd=wd,xd=class extends go{constructor(e){super(`JSON Schema ${JSON.stringify(e)} cannot be transformed to ZUI type.`)}};f(xd,"UnsupportedJSONSchemaToZuiError");var fn=xd,Bd=class extends lr{constructor(e){super("zui-to-typescript-schema",e)}};f(Bd,"ZuiToTypescriptSchemaError");var Ed=Bd,Sd=class extends Ed{constructor(e){super(`Zod type ${e} cannot be transformed to TypeScript schema.`)}};f(Sd,"UnsupportedZuiToTypescriptSchemaError");var En=Sd,Id=class extends lr{constructor(e){super("zui-to-typescript-type",e)}};f(Id,"ZuiToTypescriptTypeError");var mo=Id,kd=class extends mo{constructor(e){super(`Zod type ${e} cannot be transformed to TypeScript type.`)}};f(kd,"UnsupportedZuiToTypescriptTypeError");var Ad=kd,Cd=class extends mo{constructor(){super("Schema must have a title to be transformed to a TypeScript type with a declaration.")}};f(Cd,"UntitledDeclarationError");var Od=Cd,Rd=class extends mo{constructor(){super('ZodRef can only be transformed to a TypeScript type with a "type" declaration.')}};f(Rd,"UnrepresentableGenericError");var vs=Rd,Md=["string","number","boolean","unknown","void","any","null","undefined","never","bigint","symbol","object"],sv=5,av=f(t=>Md.includes(t),"isPrimitive"),lv=f(t=>Md.map(e=>`${e}[]`).includes(t),"isArrayOfPrimitives"),cs=f(t=>t.replace(/ +/g," ").trim(),"stripSpaces"),Nd=class{constructor(e,n){this.key=e,this.value=n}};f(Nd,"KeyValue");var bi=Nd,Dd=class{constructor(e){this.schema=e}};f(Dd,"FnParameters");var Sc=Dd,Hd=class{constructor(e){this.schema=e}};f(Hd,"FnReturn");var Ic=Hd,Ud=class{constructor(e){this.props=e}};f(Ud,"Declaration");var jr=Ud;function Rs(t,e={}){let n=dv(t,e),r=Ie(n,e);return e.formatter&&(r=e.formatter(r)),r}f(Rs,"toTypescriptType");var kc=f(t=>t.endsWith("?")?t:`${t}?`,"_optionalKey");function Ie(t,e){var n,r,o;let s=N(v({},e),{declaration:!1,parent:t});if(t===null)return"";if(t instanceof jr)return uv(t,s);if(t instanceof bi){let l;if(t.value instanceof R.ZodOptional?l=t.value:t.value instanceof R.ZodDefault&&e.treatDefaultAsOptional&&(l=t.value._def.innerType.optional()),l){let T=l._def.innerType;return T instanceof R.Schema&&!T.description&&l.description&&(T=T?.describe(l.description)),Ie(new bi(kc(t.key),T),s)}let c=rt(t.value._def.description||t.value.description),p=c?.trim().length>0?`
20
- `:"",y=t.value.describe(""),h=t.value instanceof R.ZodAny?kc(t.key):t.key;return`${p}${c}${p}${h}: ${Ie(y,s)}${p}`}if(t instanceof Sc){if(t.schema instanceof R.ZodTuple){let y="";for(let g=0;g<t.schema.items.length;g++){let h=(o=(r=(n=t.schema.items[g])==null?void 0:n.ui)==null?void 0:r.title)!=null?o:`arg${g}`,T=t.schema.items[g];y+=`${Ie(new bi(hs(h),T),s)}${g<t.schema.items.length-1?", ":""} `}return y}let l=t.schema.naked()instanceof R.ZodLiteral,c=Ie(t.schema,s).trim();return c.startsWith("{")&&c.endsWith("}")||c.startsWith("[")&&c.endsWith("]")||c.startsWith("(")&&c.endsWith(")")||c.startsWith("Array<")&&c.endsWith(">")||c.startsWith("Record<")&&c.endsWith(">")||lv(c)||l?`args: ${c}`:c}if(t instanceof Ic)return t.schema instanceof R.ZodOptional?`${Ie(t.schema.unwrap(),s)} | undefined`:Ie(t.schema,s);let i=t,a=i._def;switch(a.typeName){case R.ZodFirstPartyTypeKind.ZodString:return`${rt(i.description)} string`.trim();case R.ZodFirstPartyTypeKind.ZodNumber:case R.ZodFirstPartyTypeKind.ZodNaN:case R.ZodFirstPartyTypeKind.ZodBigInt:return`${rt(i.description)} number`.trim();case R.ZodFirstPartyTypeKind.ZodBoolean:return`${rt(i.description)} boolean`.trim();case R.ZodFirstPartyTypeKind.ZodDate:return`${rt(i.description)} Date`.trim();case R.ZodFirstPartyTypeKind.ZodUndefined:return`${rt(i.description)} undefined`.trim();case R.ZodFirstPartyTypeKind.ZodNull:return`${rt(i.description)} null`.trim();case R.ZodFirstPartyTypeKind.ZodAny:return`${rt(i.description)} any`.trim();case R.ZodFirstPartyTypeKind.ZodUnknown:return`${rt(i.description)} unknown`.trim();case R.ZodFirstPartyTypeKind.ZodNever:return`${rt(i.description)} never`.trim();case R.ZodFirstPartyTypeKind.ZodVoid:return`${rt(i.description)} void`.trim();case R.ZodFirstPartyTypeKind.ZodArray:let l=Ie(a.type,s);return av(l)?`${l}[]`:`Array<${l}>`;case R.ZodFirstPartyTypeKind.ZodObject:return`{ ${Object.entries(a.shape()).map(([Z,re])=>re instanceof R.Schema?Ie(new bi(hs(Z),re),s):`${Z}: unknown`).join("; ")} }`;case R.ZodFirstPartyTypeKind.ZodUnion:let p=a.options.map(Z=>Ie(Z,s));return`${rt(i.description)}
21
- ${p.join(" | ")}`;case R.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:let y=a.options.map(Z=>Ie(Z,s));return`${rt(i.description)}
22
- ${y.join(" | ")}`;case R.ZodFirstPartyTypeKind.ZodIntersection:return`${Ie(a.left,s)} & ${Ie(a.right,s)}`;case R.ZodFirstPartyTypeKind.ZodTuple:return a.items.length===0?"[]":`[${a.items.map(Z=>Ie(Z,s)).join(", ")}]`;case R.ZodFirstPartyTypeKind.ZodRecord:let h=Ie(a.keyType,s),T=Ie(a.valueType,s);return`${rt(i.description)} { [key: ${h}]: ${T} }`;case R.ZodFirstPartyTypeKind.ZodMap:return`Map<${Ie(a.keyType,s)}, ${Ie(a.valueType,s)}>`;case R.ZodFirstPartyTypeKind.ZodSet:return`Set<${Ie(a.valueType,s)}>`;case R.ZodFirstPartyTypeKind.ZodFunction:let x=Ie(new Sc(a.args),s),B=Ie(new Ic(a.returns),s),_=e?.parent instanceof jr&&e?.parent.props.type==="type";return e?.declaration&&!_?`${rt(i.description)}
19
+ */`},"getMultilineComment");function rg(t){if(typeof t!="string")return"";let n=String.raw`${t}`.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/"/g,'\\"').replace(/'/g,"\\'");return n.includes("`")?`"${n}"`:n.includes("'")?`"${n}"`:`'${n}'`}p(rg,"escapeString");var TP=p(t=>{let e=[];if(t.exactLength){let{value:n,message:r}=t.exactLength;e.push(`.length(${ae(n)}, ${ae(r)})`)}if(t.minLength){let{value:n,message:r}=t.minLength;e.push(`.min(${ae(n)}, ${ae(r)})`)}if(t.maxLength){let{value:n,message:r}=t.maxLength;e.push(`.max(${ae(n)}, ${ae(r)})`)}return e.join("")},"generateArrayChecks"),vP=p(t=>{let e=t.checks;return e.length===0?"":e.map(_P).join("")},"generateBigIntChecks"),_P=p(t=>{switch(t.kind){case"min":return`.min(${ae(t.value)}, ${ae(t.message)})`;case"max":return`.max(${ae(t.value)}, ${ae(t.message)})`;case"multipleOf":return`.multipleOf(${ae(t.value)}, ${ae(t.message)})`;default:return""}},"_generateBigIntCheck"),bP=p(t=>{let e=t.checks;return e.length===0?"":e.map(wP).join("")},"generateDateChecks"),wP=p(t=>{switch(t.kind){case"min":return`.min(${ed(t.value)}, ${ae(t.message)})`;case"max":return`.max(${ed(t.value)}, ${ae(t.message)})`;default:return""}},"_generateDateCheck"),ed=p(t=>`new Date(${t})`,"dateTs"),PP=p(t=>{let e=t.checks;return e.length===0?"":e.map(xP).join("")},"generateNumberChecks"),xP=p(t=>{switch(t.kind){case"min":return`.min(${ae(t.value)}, ${ae(t.message)})`;case"max":return`.max(${ae(t.value)}, ${ae(t.message)})`;case"int":return`.int(${ae(t.message)})`;case"multipleOf":return`.multipleOf(${ae(t.value)}, ${ae(t.message)})`;case"finite":return`.finite(${ae(t.message)})`;default:return""}},"_generateNumberCheck"),BP=p(t=>{let e=[];if(t.minSize){let{value:n,message:r}=t.minSize;e.push(`.min(${ae(n)}, ${ae(r)})`)}if(t.maxSize){let{value:n,message:r}=t.maxSize;e.push(`.max(${ae(n)}, ${ae(r)})`)}return e.join("")},"generateSetChecks"),EP=p(t=>{let e=t.checks;return e.length===0?"":e.map(SP).join("")},"generateStringChecks"),SP=p(t=>{switch(t.kind){case"min":return`.min(${ae(t.value)}, ${ae(t.message)})`;case"max":return`.max(${ae(t.value)}, ${ae(t.message)})`;case"length":return`.length(${ae(t.value)}, ${ae(t.message)})`;case"email":return`.email(${ae(t.message)})`;case"url":return`.url(${ae(t.message)})`;case"emoji":return`.emoji(${ae(t.message)})`;case"uuid":return`.uuid(${ae(t.message)})`;case"cuid":return`.cuid(${ae(t.message)})`;case"cuid2":return`.cuid2(${ae(t.message)})`;case"ulid":return`.ulid(${ae(t.message)})`;case"includes":let e=nr({message:t.message,position:t.position});return`.includes(${ae(t.value)}, ${e})`;case"startsWith":return`.startsWith(${ae(t.value)}, ${ae(t.message)})`;case"endsWith":return`.endsWith(${ae(t.value)}, ${ae(t.message)})`;case"regex":return`.regex(${String(t.regex)}, ${ae(t.message)})`;case"trim":return".trim()";case"toLowerCase":return".toLowerCase()";case"toUpperCase":return".toUpperCase()";case"datetime":let r=t.precision===null?void 0:t.precision;return`.datetime(${nr({message:t.message,precision:r,offset:t.offset})})`;case"ip":return`.ip(${nr({message:t.message,version:t.version})})`;default:return""}},"_generateStringCheck");function Ws(t){return Fe(t)}p(Ws,"toTypescriptSchema");function Fe(t){let n=t._def;switch(n.typeName){case R.ZodFirstPartyTypeKind.ZodString:return`z.string()${EP(n)}${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodNumber:return`z.number()${PP(n)}${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodNaN:return`z.nan()${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodBigInt:return`z.bigint()${vP(n)}${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodBoolean:return`z.boolean()${Ce(n)}${Ae(t._def)}`.trim();case R.ZodFirstPartyTypeKind.ZodDate:return`z.date()${bP(n)}${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodUndefined:return`z.undefined()${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodNull:return`z.null()${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodAny:return`z.any()${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodUnknown:return`z.unknown()${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodNever:return`z.never()${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodVoid:return`z.void()${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodArray:return`z.array(${Fe(n.type)})${TP(n)}${Ce(n)}${Ae(n)}`;case R.ZodFirstPartyTypeKind.ZodObject:let r=dP(n.shape(),Fe),o=t.additionalProperties(),s=o?`.catchall(${Fe(o)})`:"";return["z.object({",...Object.entries(r).map(([ee,ge])=>` ${ee}: ${ge},`),`})${s}${Ce(n)}${Ae(n)}`].join(`
20
+ `).trim();case R.ZodFirstPartyTypeKind.ZodUnion:return`z.union([${n.options.map(Fe).join(", ")}])${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:let a=n.options.map(Fe);return`z.discriminatedUnion(${ae(n.discriminator)}, [${a.join(", ")}])${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodIntersection:let c=Fe(n.left),f=Fe(n.right);return`z.intersection(${c}, ${f})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodTuple:return`z.tuple([${n.items.map(Fe).join(", ")}])${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodRecord:let g=Fe(n.keyType),h=Fe(n.valueType);return`z.record(${g}, ${h})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodMap:let T=Fe(n.keyType),x=Fe(n.valueType);return`z.map(${T}, ${x})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodSet:return`z.set(${Fe(n.valueType)})${BP(n)}${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodFunction:let B=n.args.items.map(Fe),_=B.length?`.args(${B.join(", ")})`:"",S=Fe(n.returns);return`z.function()${_}.returns(${S})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodLazy:return`z.lazy(() => ${Fe(n.getter())})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodLiteral:return`z.literal(${ae(n.value)})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodEnum:return`z.enum([${n.values.map(ae).join(", ")}])${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodEffects:throw new En(R.ZodFirstPartyTypeKind.ZodEffects);case R.ZodFirstPartyTypeKind.ZodNativeEnum:throw new En(R.ZodFirstPartyTypeKind.ZodNativeEnum);case R.ZodFirstPartyTypeKind.ZodOptional:return`z.optional(${Fe(n.innerType)})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodNullable:return`z.nullable(${Fe(n.innerType)})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodDefault:let Z=nr(n.defaultValue());return`z.default(${Fe(n.innerType)}, ${Z})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodCatch:throw new En(R.ZodFirstPartyTypeKind.ZodCatch);case R.ZodFirstPartyTypeKind.ZodPromise:return`z.promise(${Fe(n.type)})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodBranded:throw new En(R.ZodFirstPartyTypeKind.ZodBranded);case R.ZodFirstPartyTypeKind.ZodPipeline:throw new En(R.ZodFirstPartyTypeKind.ZodPipeline);case R.ZodFirstPartyTypeKind.ZodSymbol:throw new En(R.ZodFirstPartyTypeKind.ZodSymbol);case R.ZodFirstPartyTypeKind.ZodReadonly:return`z.readonly(${Fe(n.innerType)})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodRef:return`z.ref(${ae(n.uri)})${Ce(n)}${Ae(n)}`.trim();default:be.assertNever(n)}}p(Fe,"sUnwrapZod");var Ae=p(t=>t.description?`.describe(${ae(t.description)})`:"","_maybeDescribe"),Ce=p(t=>`${IP(t)}${kP(t)}${AP(t)}${CP(t)}${OP(t)}${RP(t)}${MP(t)}`,"_addZuiExtensions"),IP=p(t=>{var e;return(e=t[le])!=null&&e.title?`.title(${ae(t[le].title)})`:""},"_maybeTitle"),kP=p(t=>{var e;return(e=t[le])!=null&&e.displayAs?`.displayAs(${tg({id:t[le].displayAs[0],params:t[le].displayAs[1]})})`:""},"_maybeDisplayAs"),AP=p(t=>{var e;return(e=t[le])!=null&&e.disabled?`.disabled(${t[le].disabled})`:""},"_maybeDisabled"),CP=p(t=>{var e;return(e=t[le])!=null&&e.hidden?`.hidden(${t[le].hidden})`:""},"_maybeHidden"),OP=p(t=>{var e;return(e=t[le])!=null&&e.placeholder?`.placeholder(${ae(t[le].placeholder)})`:""},"_maybePlaceholder"),RP=p(t=>{var e;return(e=t[le])!=null&&e.secret?".secret()":""},"_maybeSecret"),MP=p(t=>{var e;let n=["title","tooltip","displayAs","disabled","hidden","placeholder","secret","coerce"],r=Object.entries((e=t[le])!=null?e:{}).filter(([o])=>!n.includes(o));return r.length>0?`.metadata(${tg(Object.fromEntries(r))})`:""},"_maybeSetMetadata"),ig=["string","number","boolean","unknown","void","any","null","undefined","never","bigint","symbol","object"],NP=5,DP=p(t=>ig.includes(t),"isPrimitive"),HP=p(t=>ig.map(e=>`${e}[]`).includes(t),"isArrayOfPrimitives"),ys=p(t=>t.replace(/ +/g," ").trim(),"stripSpaces"),og=class{constructor(e,n){this.key=e,this.value=n}};p(og,"KeyValue");var wi=og,sg=class{constructor(e){this.schema=e}};p(sg,"FnParameters");var td=sg,ag=class{constructor(e){this.schema=e}};p(ag,"FnReturn");var nd=ag,lg=class{constructor(e){this.props=e}};p(lg,"Declaration");var Zr=lg;function zs(t,e={}){let n=$P(t,e),r=Ie(n,e);return e.formatter&&(r=e.formatter(r)),r}p(zs,"toTypescriptType");var rd=p(t=>t.endsWith("?")?t:`${t}?`,"_optionalKey");function Ie(t,e){var n,r,o;let s=N(v({},e),{declaration:!1,parent:t});if(t===null)return"";if(t instanceof Zr)return UP(t,s);if(t instanceof wi){let l;if(t.value instanceof R.ZodOptional?l=t.value:t.value instanceof R.ZodDefault&&e.treatDefaultAsOptional&&(l=t.value._def.innerType.optional()),l){let T=l._def.innerType;return T instanceof R.Schema&&!T.description&&l.description&&(T=T?.describe(l.description)),Ie(new wi(rd(t.key),T),s)}let c=rt(t.value._def.description||t.value.description),f=c?.trim().length>0?`
21
+ `:"",y=t.value.describe(""),h=t.value instanceof R.ZodAny?rd(t.key):t.key;return`${f}${c}${f}${h}: ${Ie(y,s)}${f}`}if(t instanceof td){if(t.schema instanceof R.ZodTuple){let y="";for(let g=0;g<t.schema.items.length;g++){let h=(o=(r=(n=t.schema.items[g])==null?void 0:n.ui)==null?void 0:r.title)!=null?o:`arg${g}`,T=t.schema.items[g];y+=`${Ie(new wi(Bs(h),T),s)}${g<t.schema.items.length-1?", ":""} `}return y}let l=t.schema.naked()instanceof R.ZodLiteral,c=Ie(t.schema,s).trim();return c.startsWith("{")&&c.endsWith("}")||c.startsWith("[")&&c.endsWith("]")||c.startsWith("(")&&c.endsWith(")")||c.startsWith("Array<")&&c.endsWith(">")||c.startsWith("Record<")&&c.endsWith(">")||HP(c)||l?`args: ${c}`:c}if(t instanceof nd)return t.schema instanceof R.ZodOptional?`${Ie(t.schema.unwrap(),s)} | undefined`:Ie(t.schema,s);let i=t,a=i._def;switch(a.typeName){case R.ZodFirstPartyTypeKind.ZodString:return`${rt(i.description)} string`.trim();case R.ZodFirstPartyTypeKind.ZodNumber:case R.ZodFirstPartyTypeKind.ZodNaN:case R.ZodFirstPartyTypeKind.ZodBigInt:return`${rt(i.description)} number`.trim();case R.ZodFirstPartyTypeKind.ZodBoolean:return`${rt(i.description)} boolean`.trim();case R.ZodFirstPartyTypeKind.ZodDate:return`${rt(i.description)} Date`.trim();case R.ZodFirstPartyTypeKind.ZodUndefined:return`${rt(i.description)} undefined`.trim();case R.ZodFirstPartyTypeKind.ZodNull:return`${rt(i.description)} null`.trim();case R.ZodFirstPartyTypeKind.ZodAny:return`${rt(i.description)} any`.trim();case R.ZodFirstPartyTypeKind.ZodUnknown:return`${rt(i.description)} unknown`.trim();case R.ZodFirstPartyTypeKind.ZodNever:return`${rt(i.description)} never`.trim();case R.ZodFirstPartyTypeKind.ZodVoid:return`${rt(i.description)} void`.trim();case R.ZodFirstPartyTypeKind.ZodArray:let l=Ie(a.type,s);return DP(l)?`${l}[]`:`Array<${l}>`;case R.ZodFirstPartyTypeKind.ZodObject:return`{ ${Object.entries(a.shape()).map(([Z,re])=>re instanceof R.Schema?Ie(new wi(Bs(Z),re),s):`${Z}: unknown`).join("; ")} }`;case R.ZodFirstPartyTypeKind.ZodUnion:let f=a.options.map(Z=>Ie(Z,s));return`${rt(i.description)}
22
+ ${f.join(" | ")}`;case R.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:let y=a.options.map(Z=>Ie(Z,s));return`${rt(i.description)}
23
+ ${y.join(" | ")}`;case R.ZodFirstPartyTypeKind.ZodIntersection:return`${Ie(a.left,s)} & ${Ie(a.right,s)}`;case R.ZodFirstPartyTypeKind.ZodTuple:return a.items.length===0?"[]":`[${a.items.map(Z=>Ie(Z,s)).join(", ")}]`;case R.ZodFirstPartyTypeKind.ZodRecord:let h=Ie(a.keyType,s),T=Ie(a.valueType,s);return`${rt(i.description)} { [key: ${h}]: ${T} }`;case R.ZodFirstPartyTypeKind.ZodMap:return`Map<${Ie(a.keyType,s)}, ${Ie(a.valueType,s)}>`;case R.ZodFirstPartyTypeKind.ZodSet:return`Set<${Ie(a.valueType,s)}>`;case R.ZodFirstPartyTypeKind.ZodFunction:let x=Ie(new td(a.args),s),B=Ie(new nd(a.returns),s),_=e?.parent instanceof Zr&&e?.parent.props.type==="type";return e?.declaration&&!_?`${rt(i.description)}
23
24
  (${x}): ${B}`:`${rt(i.description)}
24
- (${x}) => ${B}`;case R.ZodFirstPartyTypeKind.ZodLazy:return Ie(a.getter(),s);case R.ZodFirstPartyTypeKind.ZodLiteral:let S=fd(a.value);return`${rt(i.description)}
25
- ${S}`.trim();case R.ZodFirstPartyTypeKind.ZodEnum:return a.values.map(ae).join(" | ");case R.ZodFirstPartyTypeKind.ZodEffects:return Ie(a.schema,s);case R.ZodFirstPartyTypeKind.ZodNativeEnum:throw new Ad(R.ZodFirstPartyTypeKind.ZodNativeEnum);case R.ZodFirstPartyTypeKind.ZodOptional:return`${Ie(a.innerType,s)} | undefined`;case R.ZodFirstPartyTypeKind.ZodNullable:return`${Ie(a.innerType,s)} | null`;case R.ZodFirstPartyTypeKind.ZodDefault:let H=e.treatDefaultAsOptional?a.innerType.optional():a.innerType;return Ie(H,s);case R.ZodFirstPartyTypeKind.ZodCatch:return Ie(a.innerType,s);case R.ZodFirstPartyTypeKind.ZodPromise:return`Promise<${Ie(a.type,s)}>`;case R.ZodFirstPartyTypeKind.ZodBranded:return Ie(a.type,s);case R.ZodFirstPartyTypeKind.ZodPipeline:return Ie(a.in,s);case R.ZodFirstPartyTypeKind.ZodSymbol:return`${rt(i.description)} symbol`.trim();case R.ZodFirstPartyTypeKind.ZodReadonly:return`Readonly<${Ie(a.innerType,s)}>`;case R.ZodFirstPartyTypeKind.ZodRef:return gd(a.uri);default:be.assertNever(a)}}f(Ie,"sUnwrapZod");var uv=f((t,e)=>{if(t.props.type==="none")return Ie(t.props.schema,e);let{schema:n,identifier:r}=t.props,o=rt(n.description),s=n.describe(""),i=Ie(s,N(v({},e),{declaration:!0})),l=i.split(`
26
- `).length>=sv&&e.includeClosingTags?`// end of ${r}`:"";if(t.props.type!=="type"&&n instanceof R.ZodFunction)return cs(`${o}
27
- declare function ${r}${i};${l}`);if(t.props.type==="variable")return cs(`${o}declare const ${r}: ${i};${l}`);let c=t.props.args.length>0?`<${t.props.args.map(gd).join(", ")}>`:"";return cs(`${o}type ${t.props.identifier}${c} = ${i};${l}`)},"unwrapDeclaration"),cv=f(t=>t.declaration?t.declaration===!0?"variable":t.declaration:"none","getDeclarationType"),dv=f((t,e)=>{let n=cv(e),r=t.getReferences();if(n==="none"){if(r.length>0)throw new vs;return new jr({type:"none",schema:t})}let o="title"in t.ui?t.ui.title:null;if(!o)throw new Od;if(n==="variable"){if(r.length>0)throw new vs;return new jr({type:"variable",identifier:o,schema:t})}return new jr({type:"type",identifier:o,schema:t,args:r})},"getDeclarationProps"),fv=typeof global=="object"&&global&&global.Object===Object&&global,jd=fv,pv=typeof self=="object"&&self&&self.Object===Object&&self,gv=jd||pv||Function("return this")(),Qt=gv,yv=Qt.Symbol,yn=yv,$d=Object.prototype,mv=$d.hasOwnProperty,hv=$d.toString,Br=yn?yn.toStringTag:void 0;function Zd(t){var e=mv.call(t,Br),n=t[Br];try{t[Br]=void 0;var r=!0}catch{}var o=hv.call(t);return r&&(e?t[Br]=n:delete t[Br]),o}f(Zd,"getRawTag");var Tv=Zd,vv=Object.prototype,_v=vv.toString;function Kd(t){return _v.call(t)}f(Kd,"objectToString");var bv=Kd,wv="[object Null]",Pv="[object Undefined]",Ac=yn?yn.toStringTag:void 0;function Ld(t){return t==null?t===void 0?Pv:wv:Ac&&Ac in Object(t)?Tv(t):bv(t)}f(Ld,"baseGetTag");var Mn=Ld;function Fd(t){return t!=null&&typeof t=="object"}f(Fd,"isObjectLike");var On=Fd,xv="[object Symbol]";function Wd(t){return typeof t=="symbol"||On(t)&&Mn(t)==xv}f(Wd,"isSymbol");var Ms=Wd;function zd(t,e){for(var n=-1,r=t==null?0:t.length,o=Array(r);++n<r;)o[n]=e(t[n],n,t);return o}f(zd,"arrayMap");var qd=zd,Bv=Array.isArray,Xt=Bv,Ev=1/0,Cc=yn?yn.prototype:void 0,Oc=Cc?Cc.toString:void 0;function Ns(t){if(typeof t=="string")return t;if(Xt(t))return qd(t,Ns)+"";if(Ms(t))return Oc?Oc.call(t):"";var e=t+"";return e=="0"&&1/t==-Ev?"-0":e}f(Ns,"baseToString");var Sv=Ns;function Gd(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}f(Gd,"isObject");var rr=Gd;function Vd(t){return t}f(Vd,"identity");var Iv=Vd,kv="[object AsyncFunction]",Av="[object Function]",Cv="[object GeneratorFunction]",Ov="[object Proxy]";function Jd(t){if(!rr(t))return!1;var e=Mn(t);return e==Av||e==Cv||e==kv||e==Ov}f(Jd,"isFunction");var Yd=Jd,Rv=Qt["__core-js_shared__"],ds=Rv,Rc=(function(){var t=/[^.]+$/.exec(ds&&ds.keys&&ds.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function Xd(t){return!!Rc&&Rc in t}f(Xd,"isMasked");var Mv=Xd,Nv=Function.prototype,Dv=Nv.toString;function Qd(t){if(t!=null){try{return Dv.call(t)}catch{}try{return t+""}catch{}}return""}f(Qd,"toSource");var Nn=Qd,Hv=/[\\^$.*+?()[\]{}|]/g,Uv=/^\[object .+?Constructor\]$/,jv=Function.prototype,$v=Object.prototype,Zv=jv.toString,Kv=$v.hasOwnProperty,Lv=RegExp("^"+Zv.call(Kv).replace(Hv,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ef(t){if(!rr(t)||Mv(t))return!1;var e=Yd(t)?Lv:Uv;return e.test(Nn(t))}f(ef,"baseIsNative");var Fv=ef;function tf(t,e){return t?.[e]}f(tf,"getValue");var Wv=tf;function nf(t,e){var n=Wv(t,e);return Fv(n)?n:void 0}f(nf,"getNative");var Dn=nf,zv=Dn(Qt,"WeakMap"),_s=zv,qv=(function(){try{var t=Dn(Object,"defineProperty");return t({},"",{}),t}catch{}})(),Mc=qv,Gv=9007199254740991,Vv=/^(?:0|[1-9]\d*)$/;function rf(t,e){var n=typeof t;return e=e??Gv,!!e&&(n=="number"||n!="symbol"&&Vv.test(t))&&t>-1&&t%1==0&&t<e}f(rf,"isIndex");var Ds=rf;function of(t,e,n){e=="__proto__"&&Mc?Mc(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}f(of,"baseAssignValue");var sf=of;function af(t,e){return t===e||t!==t&&e!==e}f(af,"eq");var Hs=af,Jv=Object.prototype,Yv=Jv.hasOwnProperty;function lf(t,e,n){var r=t[e];(!(Yv.call(t,e)&&Hs(r,n))||n===void 0&&!(e in t))&&sf(t,e,n)}f(lf,"assignValue");var Xv=lf,Qv=9007199254740991;function uf(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Qv}f(uf,"isLength");var Us=uf;function cf(t){return t!=null&&Us(t.length)&&!Yd(t)}f(cf,"isArrayLike");var df=cf,e_=Object.prototype;function ff(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||e_;return t===n}f(ff,"isPrototype");var pf=ff;function gf(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}f(gf,"baseTimes");var t_=gf,n_="[object Arguments]";function yf(t){return On(t)&&Mn(t)==n_}f(yf,"baseIsArguments");var Nc=yf,mf=Object.prototype,r_=mf.hasOwnProperty,i_=mf.propertyIsEnumerable,o_=Nc((function(){return arguments})())?Nc:function(t){return On(t)&&r_.call(t,"callee")&&!i_.call(t,"callee")},hf=o_;function Tf(){return!1}f(Tf,"stubFalse");var s_=Tf,vf=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Dc=vf&&typeof module=="object"&&module&&!module.nodeType&&module,a_=Dc&&Dc.exports===vf,Hc=a_?Qt.Buffer:void 0,l_=Hc?Hc.isBuffer:void 0,u_=l_||s_,bs=u_,c_="[object Arguments]",d_="[object Array]",f_="[object Boolean]",p_="[object Date]",g_="[object Error]",y_="[object Function]",m_="[object Map]",h_="[object Number]",T_="[object Object]",v_="[object RegExp]",__="[object Set]",b_="[object String]",w_="[object WeakMap]",P_="[object ArrayBuffer]",x_="[object DataView]",B_="[object Float32Array]",E_="[object Float64Array]",S_="[object Int8Array]",I_="[object Int16Array]",k_="[object Int32Array]",A_="[object Uint8Array]",C_="[object Uint8ClampedArray]",O_="[object Uint16Array]",R_="[object Uint32Array]",je={};je[B_]=je[E_]=je[S_]=je[I_]=je[k_]=je[A_]=je[C_]=je[O_]=je[R_]=!0;je[c_]=je[d_]=je[P_]=je[f_]=je[x_]=je[p_]=je[g_]=je[y_]=je[m_]=je[h_]=je[T_]=je[v_]=je[__]=je[b_]=je[w_]=!1;function _f(t){return On(t)&&Us(t.length)&&!!je[Mn(t)]}f(_f,"baseIsTypedArray");var M_=_f;function bf(t){return function(e){return t(e)}}f(bf,"baseUnary");var N_=bf,wf=typeof exports=="object"&&exports&&!exports.nodeType&&exports,$r=wf&&typeof module=="object"&&module&&!module.nodeType&&module,D_=$r&&$r.exports===wf,fs=D_&&jd.process,H_=(function(){try{var t=$r&&$r.require&&$r.require("util").types;return t||fs&&fs.binding&&fs.binding("util")}catch{}})(),Uc=H_,jc=Uc&&Uc.isTypedArray,U_=jc?N_(jc):M_,Pf=U_,j_=Object.prototype,$_=j_.hasOwnProperty;function xf(t,e){var n=Xt(t),r=!n&&hf(t),o=!n&&!r&&bs(t),s=!n&&!r&&!o&&Pf(t),i=n||r||o||s,a=i?t_(t.length,String):[],l=a.length;for(var c in t)(e||$_.call(t,c))&&!(i&&(c=="length"||o&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||Ds(c,l)))&&a.push(c);return a}f(xf,"arrayLikeKeys");var Bf=xf;function Ef(t,e){return function(n){return t(e(n))}}f(Ef,"overArg");var Sf=Ef,Z_=Sf(Object.keys,Object),K_=Z_,L_=Object.prototype,F_=L_.hasOwnProperty;function If(t){if(!pf(t))return K_(t);var e=[];for(var n in Object(t))F_.call(t,n)&&n!="constructor"&&e.push(n);return e}f(If,"baseKeys");var W_=If;function kf(t){return df(t)?Bf(t):W_(t)}f(kf,"keys");var js=kf;function Af(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}f(Af,"nativeKeysIn");var z_=Af,q_=Object.prototype,G_=q_.hasOwnProperty;function Cf(t){if(!rr(t))return z_(t);var e=pf(t),n=[];for(var r in t)r=="constructor"&&(e||!G_.call(t,r))||n.push(r);return n}f(Cf,"baseKeysIn");var V_=Cf;function Of(t){return df(t)?Bf(t,!0):V_(t)}f(Of,"keysIn");var J_=Of,Y_=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,X_=/^\w*$/;function Rf(t,e){if(Xt(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||Ms(t)?!0:X_.test(t)||!Y_.test(t)||e!=null&&t in Object(e)}f(Rf,"isKey");var $s=Rf,Q_=Dn(Object,"create"),Lr=Q_;function Mf(){this.__data__=Lr?Lr(null):{},this.size=0}f(Mf,"hashClear");var eb=Mf;function Nf(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}f(Nf,"hashDelete");var tb=Nf,nb="__lodash_hash_undefined__",rb=Object.prototype,ib=rb.hasOwnProperty;function Df(t){var e=this.__data__;if(Lr){var n=e[t];return n===nb?void 0:n}return ib.call(e,t)?e[t]:void 0}f(Df,"hashGet");var ob=Df,sb=Object.prototype,ab=sb.hasOwnProperty;function Hf(t){var e=this.__data__;return Lr?e[t]!==void 0:ab.call(e,t)}f(Hf,"hashHas");var lb=Hf,ub="__lodash_hash_undefined__";function Uf(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Lr&&e===void 0?ub:e,this}f(Uf,"hashSet");var cb=Uf;function Hn(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}f(Hn,"Hash");Hn.prototype.clear=eb;Hn.prototype.delete=tb;Hn.prototype.get=ob;Hn.prototype.has=lb;Hn.prototype.set=cb;var $c=Hn;function jf(){this.__data__=[],this.size=0}f(jf,"listCacheClear");var db=jf;function $f(t,e){for(var n=t.length;n--;)if(Hs(t[n][0],e))return n;return-1}f($f,"assocIndexOf");var ho=$f,fb=Array.prototype,pb=fb.splice;function Zf(t){var e=this.__data__,n=ho(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():pb.call(e,n,1),--this.size,!0}f(Zf,"listCacheDelete");var gb=Zf;function Kf(t){var e=this.__data__,n=ho(e,t);return n<0?void 0:e[n][1]}f(Kf,"listCacheGet");var yb=Kf;function Lf(t){return ho(this.__data__,t)>-1}f(Lf,"listCacheHas");var mb=Lf;function Ff(t,e){var n=this.__data__,r=ho(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}f(Ff,"listCacheSet");var hb=Ff;function Un(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}f(Un,"ListCache");Un.prototype.clear=db;Un.prototype.delete=gb;Un.prototype.get=yb;Un.prototype.has=mb;Un.prototype.set=hb;var To=Un,Tb=Dn(Qt,"Map"),Fr=Tb;function Wf(){this.size=0,this.__data__={hash:new $c,map:new(Fr||To),string:new $c}}f(Wf,"mapCacheClear");var vb=Wf;function zf(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}f(zf,"isKeyable");var _b=zf;function qf(t,e){var n=t.__data__;return _b(e)?n[typeof e=="string"?"string":"hash"]:n.map}f(qf,"getMapData");var vo=qf;function Gf(t){var e=vo(this,t).delete(t);return this.size-=e?1:0,e}f(Gf,"mapCacheDelete");var bb=Gf;function Vf(t){return vo(this,t).get(t)}f(Vf,"mapCacheGet");var wb=Vf;function Jf(t){return vo(this,t).has(t)}f(Jf,"mapCacheHas");var Pb=Jf;function Yf(t,e){var n=vo(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}f(Yf,"mapCacheSet");var xb=Yf;function jn(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}f(jn,"MapCache");jn.prototype.clear=vb;jn.prototype.delete=bb;jn.prototype.get=wb;jn.prototype.has=Pb;jn.prototype.set=xb;var _o=jn,Bb="Expected a function";function bo(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(Bb);var n=f(function(){var r=arguments,o=e?e.apply(this,r):r[0],s=n.cache;if(s.has(o))return s.get(o);var i=t.apply(this,r);return n.cache=s.set(o,i)||s,i},"memoized");return n.cache=new(bo.Cache||_o),n}f(bo,"memoize");bo.Cache=_o;var Eb=bo,Sb=500;function Xf(t){var e=Eb(t,function(r){return n.size===Sb&&n.clear(),r}),n=e.cache;return e}f(Xf,"memoizeCapped");var Ib=Xf,kb=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ab=/\\(\\)?/g,Cb=Ib(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(kb,function(n,r,o,s){e.push(o?s.replace(Ab,"$1"):r||n)}),e}),Ob=Cb;function Qf(t){return t==null?"":Sv(t)}f(Qf,"toString");var Rb=Qf;function ep(t,e){return Xt(t)?t:$s(t,e)?[t]:Ob(Rb(t))}f(ep,"castPath");var wo=ep,Mb=1/0;function tp(t){if(typeof t=="string"||Ms(t))return t;var e=t+"";return e=="0"&&1/t==-Mb?"-0":e}f(tp,"toKey");var Yr=tp;function np(t,e){e=wo(e,t);for(var n=0,r=e.length;t!=null&&n<r;)t=t[Yr(e[n++])];return n&&n==r?t:void 0}f(np,"baseGet");var Zs=np;function rp(t,e,n){var r=t==null?void 0:Zs(t,e);return r===void 0?n:r}f(rp,"get");var Nb=rp;function ip(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}f(ip,"arrayPush");var op=ip,Db=Sf(Object.getPrototypeOf,Object),sp=Db,Hb="[object Object]",Ub=Function.prototype,jb=Object.prototype,ap=Ub.toString,$b=jb.hasOwnProperty,Zb=ap.call(Object);function lp(t){if(!On(t)||Mn(t)!=Hb)return!1;var e=sp(t);if(e===null)return!0;var n=$b.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&ap.call(n)==Zb}f(lp,"isPlainObject");var Zc=lp;function up(){this.__data__=new To,this.size=0}f(up,"stackClear");var Kb=up;function cp(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}f(cp,"stackDelete");var Lb=cp;function dp(t){return this.__data__.get(t)}f(dp,"stackGet");var Fb=dp;function fp(t){return this.__data__.has(t)}f(fp,"stackHas");var Wb=fp,zb=200;function pp(t,e){var n=this.__data__;if(n instanceof To){var r=n.__data__;if(!Fr||r.length<zb-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new _o(r)}return n.set(t,e),this.size=n.size,this}f(pp,"stackSet");var qb=pp;function $n(t){var e=this.__data__=new To(t);this.size=e.size}f($n,"Stack");$n.prototype.clear=Kb;$n.prototype.delete=Lb;$n.prototype.get=Fb;$n.prototype.has=Wb;$n.prototype.set=qb;var Pi=$n;function gp(t,e){for(var n=-1,r=t==null?0:t.length,o=0,s=[];++n<r;){var i=t[n];e(i,n,t)&&(s[o++]=i)}return s}f(gp,"arrayFilter");var Gb=gp;function yp(){return[]}f(yp,"stubArray");var mp=yp,Vb=Object.prototype,Jb=Vb.propertyIsEnumerable,Kc=Object.getOwnPropertySymbols,Yb=Kc?function(t){return t==null?[]:(t=Object(t),Gb(Kc(t),function(e){return Jb.call(t,e)}))}:mp,hp=Yb,Xb=Object.getOwnPropertySymbols,Qb=Xb?function(t){for(var e=[];t;)op(e,hp(t)),t=sp(t);return e}:mp,ew=Qb;function Tp(t,e,n){var r=e(t);return Xt(t)?r:op(r,n(t))}f(Tp,"baseGetAllKeys");var vp=Tp;function _p(t){return vp(t,js,hp)}f(_p,"getAllKeys");var Lc=_p;function bp(t){return vp(t,J_,ew)}f(bp,"getAllKeysIn");var tw=bp,nw=Dn(Qt,"DataView"),ws=nw,rw=Dn(Qt,"Promise"),Ps=rw,iw=Dn(Qt,"Set"),xs=iw,Fc="[object Map]",ow="[object Object]",Wc="[object Promise]",zc="[object Set]",qc="[object WeakMap]",Gc="[object DataView]",sw=Nn(ws),aw=Nn(Fr),lw=Nn(Ps),uw=Nn(xs),cw=Nn(_s),Sn=Mn;(ws&&Sn(new ws(new ArrayBuffer(1)))!=Gc||Fr&&Sn(new Fr)!=Fc||Ps&&Sn(Ps.resolve())!=Wc||xs&&Sn(new xs)!=zc||_s&&Sn(new _s)!=qc)&&(Sn=f(function(t){var e=Mn(t),n=e==ow?t.constructor:void 0,r=n?Nn(n):"";if(r)switch(r){case sw:return Gc;case aw:return Fc;case lw:return Wc;case uw:return zc;case cw:return qc}return e},"getTag"));var Vc=Sn,dw=Qt.Uint8Array,Jc=dw,fw="__lodash_hash_undefined__";function wp(t){return this.__data__.set(t,fw),this}f(wp,"setCacheAdd");var pw=wp;function Pp(t){return this.__data__.has(t)}f(Pp,"setCacheHas");var gw=Pp;function Wr(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new _o;++e<n;)this.add(t[e])}f(Wr,"SetCache");Wr.prototype.add=Wr.prototype.push=pw;Wr.prototype.has=gw;var yw=Wr;function xp(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}f(xp,"arraySome");var mw=xp;function Bp(t,e){return t.has(e)}f(Bp,"cacheHas");var hw=Bp,Tw=1,vw=2;function Ep(t,e,n,r,o,s){var i=n&Tw,a=t.length,l=e.length;if(a!=l&&!(i&&l>a))return!1;var c=s.get(t),p=s.get(e);if(c&&p)return c==e&&p==t;var y=-1,g=!0,h=n&vw?new yw:void 0;for(s.set(t,e),s.set(e,t);++y<a;){var T=t[y],x=e[y];if(r)var B=i?r(x,T,y,e,t,s):r(T,x,y,t,e,s);if(B!==void 0){if(B)continue;g=!1;break}if(h){if(!mw(e,function(_,S){if(!hw(h,S)&&(T===_||o(T,_,n,r,s)))return h.push(S)})){g=!1;break}}else if(!(T===x||o(T,x,n,r,s))){g=!1;break}}return s.delete(t),s.delete(e),g}f(Ep,"equalArrays");var Sp=Ep;function Ip(t){var e=-1,n=Array(t.size);return t.forEach(function(r,o){n[++e]=[o,r]}),n}f(Ip,"mapToArray");var _w=Ip;function kp(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}f(kp,"setToArray");var bw=kp,ww=1,Pw=2,xw="[object Boolean]",Bw="[object Date]",Ew="[object Error]",Sw="[object Map]",Iw="[object Number]",kw="[object RegExp]",Aw="[object Set]",Cw="[object String]",Ow="[object Symbol]",Rw="[object ArrayBuffer]",Mw="[object DataView]",Yc=yn?yn.prototype:void 0,ps=Yc?Yc.valueOf:void 0;function Ap(t,e,n,r,o,s,i){switch(n){case Mw:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Rw:return!(t.byteLength!=e.byteLength||!s(new Jc(t),new Jc(e)));case xw:case Bw:case Iw:return Hs(+t,+e);case Ew:return t.name==e.name&&t.message==e.message;case kw:case Cw:return t==e+"";case Sw:var a=_w;case Aw:var l=r&ww;if(a||(a=bw),t.size!=e.size&&!l)return!1;var c=i.get(t);if(c)return c==e;r|=Pw,i.set(t,e);var p=Sp(a(t),a(e),r,o,s,i);return i.delete(t),p;case Ow:if(ps)return ps.call(t)==ps.call(e)}return!1}f(Ap,"equalByTag");var Nw=Ap,Dw=1,Hw=Object.prototype,Uw=Hw.hasOwnProperty;function Cp(t,e,n,r,o,s){var i=n&Dw,a=Lc(t),l=a.length,c=Lc(e),p=c.length;if(l!=p&&!i)return!1;for(var y=l;y--;){var g=a[y];if(!(i?g in e:Uw.call(e,g)))return!1}var h=s.get(t),T=s.get(e);if(h&&T)return h==e&&T==t;var x=!0;s.set(t,e),s.set(e,t);for(var B=i;++y<l;){g=a[y];var _=t[g],S=e[g];if(r)var E=i?r(S,_,g,e,t,s):r(_,S,g,t,e,s);if(!(E===void 0?_===S||o(_,S,n,r,s):E)){x=!1;break}B||(B=g=="constructor")}if(x&&!B){var H=t.constructor,Z=e.constructor;H!=Z&&"constructor"in t&&"constructor"in e&&!(typeof H=="function"&&H instanceof H&&typeof Z=="function"&&Z instanceof Z)&&(x=!1)}return s.delete(t),s.delete(e),x}f(Cp,"equalObjects");var jw=Cp,$w=1,Xc="[object Arguments]",Qc="[object Array]",wi="[object Object]",Zw=Object.prototype,ed=Zw.hasOwnProperty;function Op(t,e,n,r,o,s){var i=Xt(t),a=Xt(e),l=i?Qc:Vc(t),c=a?Qc:Vc(e);l=l==Xc?wi:l,c=c==Xc?wi:c;var p=l==wi,y=c==wi,g=l==c;if(g&&bs(t)){if(!bs(e))return!1;i=!0,p=!1}if(g&&!p)return s||(s=new Pi),i||Pf(t)?Sp(t,e,n,r,o,s):Nw(t,e,l,n,r,o,s);if(!(n&$w)){var h=p&&ed.call(t,"__wrapped__"),T=y&&ed.call(e,"__wrapped__");if(h||T){var x=h?t.value():t,B=T?e.value():e;return s||(s=new Pi),o(x,B,n,r,s)}}return g?(s||(s=new Pi),jw(t,e,n,r,o,s)):!1}f(Op,"baseIsEqualDeep");var Kw=Op;function Ks(t,e,n,r,o){return t===e?!0:t==null||e==null||!On(t)&&!On(e)?t!==t&&e!==e:Kw(t,e,n,r,Ks,o)}f(Ks,"baseIsEqual");var Po=Ks,Lw=1,Fw=2;function Rp(t,e,n,r){var o=n.length,s=o,i=!r;if(t==null)return!s;for(t=Object(t);o--;){var a=n[o];if(i&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++o<s;){a=n[o];var l=a[0],c=t[l],p=a[1];if(i&&a[2]){if(c===void 0&&!(l in t))return!1}else{var y=new Pi;if(r)var g=r(c,p,l,t,e,y);if(!(g===void 0?Po(p,c,Lw|Fw,r,y):g))return!1}}return!0}f(Rp,"baseIsMatch");var Ww=Rp;function Mp(t){return t===t&&!rr(t)}f(Mp,"isStrictComparable");var Np=Mp;function Dp(t){for(var e=js(t),n=e.length;n--;){var r=e[n],o=t[r];e[n]=[r,o,Np(o)]}return e}f(Dp,"getMatchData");var zw=Dp;function Hp(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}f(Hp,"matchesStrictComparable");var Up=Hp;function jp(t){var e=zw(t);return e.length==1&&e[0][2]?Up(e[0][0],e[0][1]):function(n){return n===t||Ww(n,t,e)}}f(jp,"baseMatches");var qw=jp;function $p(t,e){return t!=null&&e in Object(t)}f($p,"baseHasIn");var Gw=$p;function Zp(t,e,n){e=wo(e,t);for(var r=-1,o=e.length,s=!1;++r<o;){var i=Yr(e[r]);if(!(s=t!=null&&n(t,i)))break;t=t[i]}return s||++r!=o?s:(o=t==null?0:t.length,!!o&&Us(o)&&Ds(i,o)&&(Xt(t)||hf(t)))}f(Zp,"hasPath");var Vw=Zp;function Kp(t,e){return t!=null&&Vw(t,e,Gw)}f(Kp,"hasIn");var Jw=Kp,Yw=1,Xw=2;function Lp(t,e){return $s(t)&&Np(e)?Up(Yr(t),e):function(n){var r=Nb(n,t);return r===void 0&&r===e?Jw(n,t):Po(e,r,Yw|Xw)}}f(Lp,"baseMatchesProperty");var Qw=Lp;function Fp(t){return function(e){return e?.[t]}}f(Fp,"baseProperty");var eP=Fp;function Wp(t){return function(e){return Zs(e,t)}}f(Wp,"basePropertyDeep");var tP=Wp;function zp(t){return $s(t)?eP(Yr(t)):tP(t)}f(zp,"property");var nP=zp;function qp(t){return typeof t=="function"?t:t==null?Iv:typeof t=="object"?Xt(t)?Qw(t[0],t[1]):qw(t):nP(t)}f(qp,"baseIteratee");var Ls=qp;function Gp(t){return function(e,n,r){for(var o=-1,s=Object(e),i=r(e),a=i.length;a--;){var l=i[t?a:++o];if(n(s[l],l,s)===!1)break}return e}}f(Gp,"createBaseFor");var rP=Gp,iP=rP(),oP=iP;function Vp(t,e){return t&&oP(t,e,js)}f(Vp,"baseForOwn");var sP=Vp;function Jp(t,e){return Po(t,e)}f(Jp,"isEqual");var nr=Jp;function Yp(t,e,n){n=typeof n=="function"?n:void 0;var r=n?n(t,e):void 0;return r===void 0?Po(t,e,void 0,n):!!r}f(Yp,"isEqualWith");var aP=Yp;function Xp(t){return t===void 0}f(Xp,"isUndefined");var td=Xp;function Qp(t,e){var n={};return e=Ls(e,3),sP(t,function(r,o,s){sf(n,o,e(r,o,s))}),n}f(Qp,"mapValues");var lP=Qp,uP="Expected a function";function eg(t){if(typeof t!="function")throw new TypeError(uP);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}f(eg,"negate");var cP=eg;function tg(t,e,n,r){if(!rr(t))return t;e=wo(e,t);for(var o=-1,s=e.length,i=s-1,a=t;a!=null&&++o<s;){var l=Yr(e[o]),c=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return t;if(o!=i){var p=a[l];c=r?r(p,l,a):void 0,c===void 0&&(c=rr(p)?p:Ds(e[o+1])?[]:{})}Xv(a,l,c),a=a[l]}return t}f(tg,"baseSet");var dP=tg;function ng(t,e,n){for(var r=-1,o=e.length,s={};++r<o;){var i=e[r],a=Zs(t,i);n(a,i)&&dP(s,wo(i,t),a)}return s}f(ng,"basePickBy");var fP=ng;function rg(t,e){if(t==null)return{};var n=qd(tw(t),function(r){return[r]});return e=Ls(e),fP(t,n,function(r,o){return e(r,o[0])})}f(rg,"pickBy");var pP=rg;function ig(t,e){return pP(t,cP(Ls(e)))}f(ig,"omitBy");var nd=ig,gP=f(t=>{let e=t.checks;return e.length===0?"":e.map(yP).join("")},"generateStringChecks"),yP=f(t=>{switch(t.kind){case"min":return`.min(${ae(t.value)}, ${ae(t.message)})`;case"max":return`.max(${ae(t.value)}, ${ae(t.message)})`;case"length":return`.length(${ae(t.value)}, ${ae(t.message)})`;case"email":return`.email(${ae(t.message)})`;case"url":return`.url(${ae(t.message)})`;case"emoji":return`.emoji(${ae(t.message)})`;case"uuid":return`.uuid(${ae(t.message)})`;case"cuid":return`.cuid(${ae(t.message)})`;case"cuid2":return`.cuid2(${ae(t.message)})`;case"ulid":return`.ulid(${ae(t.message)})`;case"includes":let e=tr({message:t.message,position:t.position});return`.includes(${ae(t.value)}, ${e})`;case"startsWith":return`.startsWith(${ae(t.value)}, ${ae(t.message)})`;case"endsWith":return`.endsWith(${ae(t.value)}, ${ae(t.message)})`;case"regex":return`.regex(${String(t.regex)}, ${ae(t.message)})`;case"trim":return".trim()";case"toLowerCase":return".toLowerCase()";case"toUpperCase":return".toUpperCase()";case"datetime":let r=t.precision===null?void 0:t.precision;return`.datetime(${tr({message:t.message,precision:r,offset:t.offset})})`;case"ip":return`.ip(${tr({message:t.message,version:t.version})})`;default:return""}},"_generateStringCheck"),mP=f(t=>{let e=t.checks;return e.length===0?"":e.map(hP).join("")},"generateNumberChecks"),hP=f(t=>{switch(t.kind){case"min":return`.min(${ae(t.value)}, ${ae(t.message)})`;case"max":return`.max(${ae(t.value)}, ${ae(t.message)})`;case"int":return`.int(${ae(t.message)})`;case"multipleOf":return`.multipleOf(${ae(t.value)}, ${ae(t.message)})`;case"finite":return`.finite(${ae(t.message)})`;default:return""}},"_generateNumberCheck"),TP=f(t=>{let e=t.checks;return e.length===0?"":e.map(vP).join("")},"generateBigIntChecks"),vP=f(t=>{switch(t.kind){case"min":return`.min(${ae(t.value)}, ${ae(t.message)})`;case"max":return`.max(${ae(t.value)}, ${ae(t.message)})`;case"multipleOf":return`.multipleOf(${ae(t.value)}, ${ae(t.message)})`;default:return""}},"_generateBigIntCheck"),_P=f(t=>{let e=t.checks;return e.length===0?"":e.map(bP).join("")},"generateDateChecks"),bP=f(t=>{switch(t.kind){case"min":return`.min(${rd(t.value)}, ${ae(t.message)})`;case"max":return`.max(${rd(t.value)}, ${ae(t.message)})`;default:return""}},"_generateDateCheck"),rd=f(t=>`new Date(${t})`,"dateTs"),wP=f(t=>{let e=[];if(t.exactLength){let{value:n,message:r}=t.exactLength;e.push(`.length(${ae(n)}, ${ae(r)})`)}if(t.minLength){let{value:n,message:r}=t.minLength;e.push(`.min(${ae(n)}, ${ae(r)})`)}if(t.maxLength){let{value:n,message:r}=t.maxLength;e.push(`.max(${ae(n)}, ${ae(r)})`)}return e.join("")},"generateArrayChecks"),PP=f(t=>{let e=[];if(t.minSize){let{value:n,message:r}=t.minSize;e.push(`.min(${ae(n)}, ${ae(r)})`)}if(t.maxSize){let{value:n,message:r}=t.maxSize;e.push(`.max(${ae(n)}, ${ae(r)})`)}return e.join("")},"generateSetChecks");function Fs(t){return Fe(t)}f(Fs,"toTypescriptSchema");function Fe(t){let n=t._def;switch(n.typeName){case R.ZodFirstPartyTypeKind.ZodString:return`z.string()${gP(n)}${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodNumber:return`z.number()${mP(n)}${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodNaN:return`z.nan()${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodBigInt:return`z.bigint()${TP(n)}${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodBoolean:return`z.boolean()${Ce(n)}${Ae(t._def)}`.trim();case R.ZodFirstPartyTypeKind.ZodDate:return`z.date()${_P(n)}${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodUndefined:return`z.undefined()${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodNull:return`z.null()${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodAny:return`z.any()${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodUnknown:return`z.unknown()${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodNever:return`z.never()${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodVoid:return`z.void()${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodArray:return`z.array(${Fe(n.type)})${wP(n)}${Ce(n)}${Ae(n)}`;case R.ZodFirstPartyTypeKind.ZodObject:let r=lP(n.shape(),Fe),o=t.additionalProperties(),s=o?`.catchall(${Fe(o)})`:"";return["z.object({",...Object.entries(r).map(([ee,ge])=>` ${ee}: ${ge},`),`})${s}${Ce(n)}${Ae(n)}`].join(`
28
- `).trim();case R.ZodFirstPartyTypeKind.ZodUnion:return`z.union([${n.options.map(Fe).join(", ")}])${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:let a=n.options.map(Fe);return`z.discriminatedUnion(${ae(n.discriminator)}, [${a.join(", ")}])${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodIntersection:let c=Fe(n.left),p=Fe(n.right);return`z.intersection(${c}, ${p})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodTuple:return`z.tuple([${n.items.map(Fe).join(", ")}])${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodRecord:let g=Fe(n.keyType),h=Fe(n.valueType);return`z.record(${g}, ${h})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodMap:let T=Fe(n.keyType),x=Fe(n.valueType);return`z.map(${T}, ${x})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodSet:return`z.set(${Fe(n.valueType)})${PP(n)}${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodFunction:let B=n.args.items.map(Fe),_=B.length?`.args(${B.join(", ")})`:"",S=Fe(n.returns);return`z.function()${_}.returns(${S})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodLazy:return`z.lazy(() => ${Fe(n.getter())})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodLiteral:return`z.literal(${ae(n.value)})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodEnum:return`z.enum([${n.values.map(ae).join(", ")}])${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodEffects:throw new En(R.ZodFirstPartyTypeKind.ZodEffects);case R.ZodFirstPartyTypeKind.ZodNativeEnum:throw new En(R.ZodFirstPartyTypeKind.ZodNativeEnum);case R.ZodFirstPartyTypeKind.ZodOptional:return`z.optional(${Fe(n.innerType)})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodNullable:return`z.nullable(${Fe(n.innerType)})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodDefault:let Z=tr(n.defaultValue());return`z.default(${Fe(n.innerType)}, ${Z})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodCatch:throw new En(R.ZodFirstPartyTypeKind.ZodCatch);case R.ZodFirstPartyTypeKind.ZodPromise:return`z.promise(${Fe(n.type)})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodBranded:throw new En(R.ZodFirstPartyTypeKind.ZodBranded);case R.ZodFirstPartyTypeKind.ZodPipeline:throw new En(R.ZodFirstPartyTypeKind.ZodPipeline);case R.ZodFirstPartyTypeKind.ZodSymbol:throw new En(R.ZodFirstPartyTypeKind.ZodSymbol);case R.ZodFirstPartyTypeKind.ZodReadonly:return`z.readonly(${Fe(n.innerType)})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodRef:return`z.ref(${ae(n.uri)})${Ce(n)}${Ae(n)}`.trim();default:be.assertNever(n)}}f(Fe,"sUnwrapZod");var Ae=f(t=>t.description?`.describe(${ae(t.description)})`:"","_maybeDescribe"),Ce=f(t=>`${xP(t)}${BP(t)}${EP(t)}${SP(t)}${IP(t)}${kP(t)}${AP(t)}`,"_addZuiExtensions"),xP=f(t=>{var e;return(e=t[le])!=null&&e.title?`.title(${ae(t[le].title)})`:""},"_maybeTitle"),BP=f(t=>{var e;return(e=t[le])!=null&&e.displayAs?`.displayAs(${pd({id:t[le].displayAs[0],params:t[le].displayAs[1]})})`:""},"_maybeDisplayAs"),EP=f(t=>{var e;return(e=t[le])!=null&&e.disabled?`.disabled(${t[le].disabled})`:""},"_maybeDisabled"),SP=f(t=>{var e;return(e=t[le])!=null&&e.hidden?`.hidden(${t[le].hidden})`:""},"_maybeHidden"),IP=f(t=>{var e;return(e=t[le])!=null&&e.placeholder?`.placeholder(${ae(t[le].placeholder)})`:""},"_maybePlaceholder"),kP=f(t=>{var e;return(e=t[le])!=null&&e.secret?".secret()":""},"_maybeSecret"),AP=f(t=>{var e;let n=["title","tooltip","displayAs","disabled","hidden","placeholder","secret","coerce"],r=Object.entries((e=t[le])!=null?e:{}).filter(([o])=>!n.includes(o));return r.length>0?`.metadata(${pd(Object.fromEntries(r))})`:""},"_maybeSetMetadata"),CP=f(t=>{let e={type:"number",description:t.description,"x-zui":t._def["x-zui"]};t._def[le]&&(e[le]=t._def[le]);for(let n of t._def.checks)switch(n.kind){case"min":{let r=n.inclusive?"minimum":"exclusiveMinimum",o=n.inclusive?"exclusiveMinimum":"minimum";e[r]=n.value,delete e[o];break}case"max":{let r=n.inclusive?"maximum":"exclusiveMaximum",o=n.inclusive?"exclusiveMaximum":"maximum";e[r]=n.value,delete e[o];break}case"int":e.type="integer";break;case"finite":{e.format="finite";break}case"multipleOf":e.multipleOf=n.value;break;default:}return e},"zodNumberToJsonNumber"),og="\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}",sg="(([+-]\\d{2}(:?\\d{2})?)|Z)",OP="Z",ag="(\\.\\d+)?",Bs="\\.\\d{",RP="}",lg=f(t=>{let e=t.precision?Bs+t.precision+RP:t.precision===0?"":ag,n=t.offset?sg:OP;return new RegExp(`^${og}${e}${n}$`)},"generateDatetimeRegex"),MP=f(t=>({precision:NP(t),offset:t.endsWith(`${sg}$`)}),"extractPrecisionAndOffset"),NP=f(t=>{let e=t.slice(1+og.length);return e.startsWith(ag)?null:e.startsWith(Bs)?parseInt(e.slice(Bs.length)):0},"_extractPrecision"),Zr={};po(Zr,{escapeSpecialChars:()=>DP});var DP=f(t=>t.replaceAll(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeSpecialChars");function Ws(t,e,n,r){r?.errorMessages&&n&&(t.errorMessage=N(v({},t.errorMessage),{[e]:n}))}f(Ws,"addErrorMessage");function Re(t,e,n,r,o){t[e]=n,Ws(t,e,r,o)}f(Re,"setResponseValueAndErrors");var Xe={cuid:"^[cC][^\\s-]{8,}$",cuid2:"^[a-z][a-z0-9]*$",ulid:"^[0-9A-HJKMNP-TV-Z]{26}$",email:"^(?!\\.)(?!.*\\.\\.)([a-zA-Z0-9_+-\\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\\-]*\\.)+[a-zA-Z]{2,}$",emoji:"^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",uuid:"^[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}$",ipv4:"^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$",ipv6:"^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$"};function zs(t,e){let n=v({type:"string"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{});function r(o){return e.patternStrategy==="escape"?Zr.escapeSpecialChars(o):o}if(f(r,"processPattern"),t.checks)for(let o of t.checks)switch(o.kind){case"min":Re(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,o.value):o.value,o.message,e);break;case"max":Re(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,o.value):o.value,o.message,e);break;case"email":switch(e.emailStrategy){case"format:email":Bn(n,"email",o.message,e);break;case"format:idn-email":Bn(n,"idn-email",o.message,e);break;case"pattern:zod":Vt(n,Xe.email,o.message,e);break}break;case"url":Bn(n,"uri",o.message,e);break;case"uuid":Bn(n,"uuid",o.message,e);break;case"regex":Vt(n,o.regex.source,o.message,e);break;case"cuid":Vt(n,Xe.cuid,o.message,e);break;case"cuid2":Vt(n,Xe.cuid2,o.message,e);break;case"startsWith":Vt(n,"^"+r(o.value),o.message,e);break;case"endsWith":Vt(n,r(o.value)+"$",o.message,e);break;case"datetime":Bn(n,"date-time",o.message,e);break;case"length":Re(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,o.value):o.value,o.message,e),Re(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,o.value):o.value,o.message,e);break;case"includes":{Vt(n,r(o.value),o.message,e);break}case"ip":{o.version!=="v6"&&Bn(n,"ipv4",o.message,e),o.version!=="v4"&&Bn(n,"ipv6",o.message,e);break}case"emoji":Vt(n,Xe.emoji,o.message,e);break;case"ulid":{Vt(n,Xe.ulid,o.message,e);break}case"toLowerCase":case"toUpperCase":case"trim":break;default:}return n}f(zs,"parseStringDef");var Bn=f((t,e,n,r)=>{var o;t.format||(o=t.anyOf)!=null&&o.some(s=>s.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push(v({format:t.format},t.errorMessage&&r.errorMessages&&{errorMessage:{format:t.errorMessage.format}})),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push(v({format:e},n&&r.errorMessages&&{errorMessage:{format:n}}))):Re(t,"format",e,n,r)},"addFormat"),Vt=f((t,e,n,r)=>{var o;t.pattern||(o=t.allOf)!=null&&o.some(s=>s.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push(v({pattern:t.pattern},t.errorMessage&&r.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}})),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push(v({pattern:e},n&&r.errorMessages&&{errorMessage:{pattern:n}}))):Re(t,"pattern",e,n,r)},"addPattern"),HP=f(t=>{let e={type:"string",description:t.description,"x-zui":t._def["x-zui"]};t._def[le]&&(e[le]=t._def[le]);for(let n of t._def.checks)switch(n.kind){case"cuid":e.format="cuid",e.pattern=Xe.cuid;break;case"cuid2":e.format="cuid2",e.pattern=Xe.cuid2;break;case"ulid":e.format="ulid",e.pattern=Xe.ulid;break;case"uuid":e.format="uuid",e.pattern=Xe.uuid;break;case"emoji":e.format="emoji",e.pattern=Xe.emoji;break;case"email":e.format="email",e.pattern=Xe.email;break;case"ip":e.format=n.version==="v6"?"ipv6":"ipv4",e.pattern=n.version==="v6"?Xe.ipv6:Xe.ipv4;break;case"datetime":e.format="date-time",(n.precision!==null||n.offset)&&(e.pattern=lg(n).source,e[le]=N(v({},e[le]),{precision:n.precision,offset:n.offset}));break;case"url":e.format="uri";break;case"endsWith":e.pattern=`${Zr.escapeSpecialChars(n.value)}$`;break;case"startsWith":e.pattern=`^${Zr.escapeSpecialChars(n.value)}`;break;case"includes":let r=n.position&&n.position>=1?`^(?:.{${n.position}}).*`:"";e.pattern=`${r}${Zr.escapeSpecialChars(n.value)}`;break;case"regex":e.pattern=n.regex.source;break;case"length":e.minLength=e.maxLength=Math.max(0,n.value);break;case"min":e.minLength=Math.max(0,n.value);break;case"max":e.maxLength=Math.max(0,n.value);break;default:throw new Pd({zodType:R.ZodFirstPartyTypeKind.ZodString,checkKind:n.kind})}return e},"zodStringToJsonString"),UP=f((t,e)=>{let n={type:"array",description:t.description,items:e(t._def.type),"x-zui":t._def["x-zui"]};return t._def[le]&&(n[le]=t._def[le]),t._def.minLength&&(n.minItems=t._def.minLength.value),t._def.maxLength&&(n.maxItems=t._def.maxLength.value),t._def.exactLength&&(n.minItems=t._def.exactLength.value,n.maxItems=t._def.exactLength.value),n},"zodArrayToJsonArray"),jP=f((t,e)=>{let n={type:"array",description:t.description,uniqueItems:!0,items:e(t._def.valueType),"x-zui":t._def["x-zui"]};return t._def[le]&&(n[le]=t._def[le]),t._def.minSize&&(n.minItems=t._def.minSize.value),t._def.maxSize&&(n.maxItems=t._def.maxSize.value),n},"zodSetToJsonSet"),$P=f((t,e)=>{let n={type:"array",description:t.description,items:t._def.items.map(r=>e(r))};return t._def[le]&&(n[le]=t._def[le]),t._def.rest&&(n.additionalItems=e(t._def.rest)),n},"zodTupleToJsonTuple");function at(t){let e=t,n=e._def;switch(n.typeName){case R.ZodFirstPartyTypeKind.ZodString:return HP(e);case R.ZodFirstPartyTypeKind.ZodNumber:return CP(e);case R.ZodFirstPartyTypeKind.ZodNaN:throw new pt(R.ZodFirstPartyTypeKind.ZodNaN);case R.ZodFirstPartyTypeKind.ZodBigInt:throw new pt(R.ZodFirstPartyTypeKind.ZodBigInt,{suggestedAlternative:"serialize bigint to string"});case R.ZodFirstPartyTypeKind.ZodBoolean:return{type:"boolean",description:n.description,"x-zui":n["x-zui"]};case R.ZodFirstPartyTypeKind.ZodDate:throw new pt(R.ZodFirstPartyTypeKind.ZodDate,{suggestedAlternative:"use z.string().datetime() instead"});case R.ZodFirstPartyTypeKind.ZodUndefined:return gs(n);case R.ZodFirstPartyTypeKind.ZodNull:return ys(n);case R.ZodFirstPartyTypeKind.ZodAny:return{description:n.description,"x-zui":n["x-zui"]};case R.ZodFirstPartyTypeKind.ZodUnknown:return{description:n.description,"x-zui":N(v({},n["x-zui"]),{def:{typeName:R.ZodFirstPartyTypeKind.ZodUnknown}})};case R.ZodFirstPartyTypeKind.ZodNever:return{not:!0,description:n.description,"x-zui":n["x-zui"]};case R.ZodFirstPartyTypeKind.ZodVoid:throw new pt(R.ZodFirstPartyTypeKind.ZodVoid);case R.ZodFirstPartyTypeKind.ZodArray:return UP(e,at);case R.ZodFirstPartyTypeKind.ZodObject:let r=Object.entries(n.shape()),o=r.filter(([p,y])=>!y.isOptional()),s=o.length?o.map(([p])=>p):void 0,i=r.map(([p,y])=>[p,y.mandatory()]).map(([p,y])=>[p,at(y)]),a=!1;return n.unknownKeys instanceof R.ZodType?a=at(n.unknownKeys):n.unknownKeys==="passthrough"&&(a=!0),{type:"object",description:n.description,properties:Object.fromEntries(i),required:s,additionalProperties:a,"x-zui":n["x-zui"]};case R.ZodFirstPartyTypeKind.ZodUnion:return{description:n.description,anyOf:n.options.map(p=>at(p)),"x-zui":n["x-zui"]};case R.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:return{description:n.description,anyOf:n.options.map(p=>at(p)),"x-zui":N(v({},n["x-zui"]),{def:{typeName:R.ZodFirstPartyTypeKind.ZodDiscriminatedUnion,discriminator:n.discriminator}})};case R.ZodFirstPartyTypeKind.ZodIntersection:let l=at(n.left),c=at(n.right);return"additionalProperties"in l&&delete l.additionalProperties,"additionalProperties"in c&&delete c.additionalProperties,{description:n.description,allOf:[l,c],"x-zui":n["x-zui"]};case R.ZodFirstPartyTypeKind.ZodTuple:return $P(e,at);case R.ZodFirstPartyTypeKind.ZodRecord:return{type:"object",description:n.description,additionalProperties:at(n.valueType),"x-zui":n["x-zui"]};case R.ZodFirstPartyTypeKind.ZodMap:throw new pt(R.ZodFirstPartyTypeKind.ZodMap);case R.ZodFirstPartyTypeKind.ZodSet:return jP(e,at);case R.ZodFirstPartyTypeKind.ZodFunction:throw new pt(R.ZodFirstPartyTypeKind.ZodFunction);case R.ZodFirstPartyTypeKind.ZodLazy:throw new pt(R.ZodFirstPartyTypeKind.ZodLazy);case R.ZodFirstPartyTypeKind.ZodLiteral:if(typeof n.value=="string")return{type:"string",description:n.description,const:n.value,"x-zui":n["x-zui"]};if(typeof n.value=="number")return{type:"number",description:n.description,const:n.value,"x-zui":n["x-zui"]};if(typeof n.value=="boolean")return{type:"boolean",description:n.description,const:n.value,"x-zui":n["x-zui"]};if(n.value===null)return ys(n);if(n.value===void 0)return gs(n);{R.util.assertEqual(!0);let p=typeof n.value;throw new yo(`Unsupported literal type: "${p}"`)}case R.ZodFirstPartyTypeKind.ZodEnum:return{type:"string",description:n.description,enum:n.values,"x-zui":n["x-zui"]};case R.ZodFirstPartyTypeKind.ZodEffects:throw new pt(R.ZodFirstPartyTypeKind.ZodEffects);case R.ZodFirstPartyTypeKind.ZodNativeEnum:throw new pt(R.ZodFirstPartyTypeKind.ZodNativeEnum);case R.ZodFirstPartyTypeKind.ZodOptional:return{description:n.description,anyOf:[at(n.innerType),gs()],"x-zui":N(v({},n["x-zui"]),{def:{typeName:R.ZodFirstPartyTypeKind.ZodOptional}})};case R.ZodFirstPartyTypeKind.ZodNullable:return{anyOf:[at(n.innerType),ys()],"x-zui":N(v({},n["x-zui"]),{def:{typeName:R.ZodFirstPartyTypeKind.ZodNullable}})};case R.ZodFirstPartyTypeKind.ZodDefault:return N(v({},at(n.innerType)),{default:n.defaultValue()});case R.ZodFirstPartyTypeKind.ZodCatch:throw new pt(R.ZodFirstPartyTypeKind.ZodCatch);case R.ZodFirstPartyTypeKind.ZodPromise:throw new pt(R.ZodFirstPartyTypeKind.ZodPromise);case R.ZodFirstPartyTypeKind.ZodBranded:throw new pt(R.ZodFirstPartyTypeKind.ZodBranded);case R.ZodFirstPartyTypeKind.ZodPipeline:throw new pt(R.ZodFirstPartyTypeKind.ZodPipeline);case R.ZodFirstPartyTypeKind.ZodSymbol:throw new pt(R.ZodFirstPartyTypeKind.ZodPipeline);case R.ZodFirstPartyTypeKind.ZodReadonly:return N(v({},at(n.innerType)),{readOnly:!0});case R.ZodFirstPartyTypeKind.ZodRef:return{$ref:n.uri,description:n.description,"x-zui":n["x-zui"]};default:R.util.assertNever(n)}}f(at,"toJSONSchema");var gs=f(t=>({not:!0,description:t?.description,"x-zui":N(v({},t?.["x-zui"]),{def:{typeName:R.ZodFirstPartyTypeKind.ZodUndefined}})}),"undefinedSchema"),ys=f(t=>({type:"null",description:t?.description,"x-zui":t?.["x-zui"]}),"nullSchema"),ug=class{constructor(e,n,r,o){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};f(ug,"ParseInputLazyPath");var Mt=ug,id=f((t,e)=>{if(qr(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new Yt(t.common.issues);return this._error=n,this._error}}},"handleResult"),cg=class{constructor(e){this.__type__="ZuiType",this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._metadataRoot._def.description}dereference(e){return this}getReferences(){return[]}clone(){let e=this.constructor;return new e(v({},this._def))}_getType(e){return pn(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:pn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new _t,ctx:{common:e.parent.common,data:e.data,parsedType:pn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(Mi(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){var r;let o={common:{issues:[],async:(r=n?.async)!=null?r:!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:pn(e)},s=this._parseSync({data:e,path:o.path,parent:o});return id(o,s)}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:pn(e)},o=this._parse({data:e,path:r.path,parent:r}),s=await(Mi(o)?o:Promise.resolve(o));return id(r,s)}refine(e,n){let r=f(o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n,"getIssueProperties");return this._refinement((o,s)=>{let i=e(o),a=f(()=>s.addIssue(v({code:J.custom},r(o))),"setError");return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,n){return this._refinement((r,o)=>e(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(e){return new Rn({schema:this,typeName:"ZodEffects",effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return gn.create(this,this._def)}nullable(){return ir.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Vr.create(this,this._def)}promise(){return Eo.create(this,this._def)}mandatory(){return this}or(e){return aa.create([this,e],this._def)}and(e){return ea.create(this,e,this._def)}transform(e){return new Rn(N(v({},me(this._def)),{schema:this,typeName:"ZodEffects",effect:{type:"transform",transform:e}}))}default(e){let n=typeof e=="function"?e:()=>e;return new xo(N(v({},me(this._def)),{innerType:this,defaultValue:n,typeName:"ZodDefault"}))}brand(){return new Js(v({typeName:"ZodBranded",type:this},me(this._def)))}catch(e){let n=typeof e=="function"?e:()=>e;return new Ys(N(v({},me(this._def)),{innerType:this,catchValue:n,typeName:"ZodCatch"}))}describe(e){let n=this.clone();return n._metadataRoot._def.description=e,n}pipe(e){return sa.create(this,e)}readonly(){return So.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}metadata(e){var n,r,o;let s=this.clone(),i=s._metadataRoot;(o=(n=i._def)[r=le])!=null||(n[r]={});for(let[a,l]of Object.entries(e))i._def[le]=N(v({},i._def[le]),{[a]:l});return s}getMetadata(){return v({},this._metadataRoot._def[le])}setMetadata(e){this._metadataRoot._def[le]=v({},e)}get ui(){return v({},this._metadataRoot._def[le])}get _metadataRoot(){return this.naked()}displayAs(e){return this.metadata({displayAs:[e.id,e.params]})}title(e){return this.metadata({title:e})}hidden(e){let n;return e===void 0?n=!0:typeof e=="function"?n=e.toString():n=e,this.metadata({hidden:n})}disabled(e){let n;return e===void 0?n=!0:typeof e=="function"?n=e.toString():n=e,this.metadata({disabled:n})}placeholder(e){return this.metadata({placeholder:e})}toJSONSchema(){return at(this)}toTypescriptType(e){return Rs(this,e)}toTypescriptSchema(){return Fs(this)}naked(){return this}};f(cg,"ZodType");var he=cg,dg=(t=>(t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodRef="ZodRef",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly",t))(dg||{}),be;(t=>{t.assertEqual=f(o=>o,"assertEqual");function e(o){}t.assertIs=e,f(e,"assertIs");function n(o){throw new Error("assertNever called")}t.assertNever=n,f(n,"assertNever"),t.arrayToEnum=f(o=>{let s={};for(let i of o)s[i]=i;return s},"arrayToEnum"),t.getValidEnumValues=f(o=>{let s=(0,t.objectKeys)(o).filter(a=>typeof o[o[a]]!="number"),i={};for(let a of s)i[a]=o[a];return(0,t.objectValues)(i)},"getValidEnumValues"),t.objectValues=f(o=>(0,t.objectKeys)(o).map(function(s){return o[s]}),"objectValues"),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let s=[];for(let i in o)Object.prototype.hasOwnProperty.call(o,i)&&s.push(i);return s},t.find=f((o,s)=>{for(let i of o)if(s(i))return i},"find"),t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function r(o,s=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}t.joinValues=r,f(r,"joinValues"),t.jsonStringifyReplacer=f((o,s)=>typeof s=="bigint"?s.toString():s,"jsonStringifyReplacer"),t.compareFunctions=f((o,s)=>o.toString()===s.toString(),"compareFunctions"),t.mock=f(()=>({}),"mock")})(be||(be={}));var Es;(t=>{t.mergeShapes=f((e,n)=>v(v({},e),n),"mergeShapes")})(Es||(Es={}));var ne=be.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),pn=f(t=>{switch(typeof t){case"undefined":return ne.undefined;case"string":return ne.string;case"number":return isNaN(t)?ne.nan:ne.number;case"boolean":return ne.boolean;case"function":return ne.function;case"bigint":return ne.bigint;case"symbol":return ne.symbol;case"object":return Array.isArray(t)?ne.array:t===null?ne.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ne.promise:typeof Map<"u"&&t instanceof Map?ne.map:typeof Set<"u"&&t instanceof Set?ne.set:typeof Date<"u"&&t instanceof Date?ne.date:ne.object;default:return ne.unknown}},"getParsedType");function me(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:o,supportsExtensions:s,[le]:i}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);let a=i?Object.fromEntries(Object.entries(i).filter(([c])=>c!=="secret"||s?.includes("secret"))):void 0;return e?{errorMap:e,description:o,[le]:a}:{errorMap:f((c,p)=>c.code!=="invalid_type"?{message:p.defaultError}:typeof p.data>"u"?{message:r??p.defaultError}:{message:n??p.defaultError},"customMap"),description:o,[le]:a}}f(me,"processCreateParams");var qs=f((t,e)=>{let n;switch(t.code){case J.invalid_type:t.received===ne.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case J.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,be.jsonStringifyReplacer)}`;break;case J.unrecognized_keys:n=`Unrecognized key(s) in object: ${be.joinValues(t.keys,", ")}`;break;case J.invalid_union:n="Invalid input";break;case J.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${be.joinValues(t.options)}`;break;case J.invalid_enum_value:n=`Invalid enum value. Expected ${be.joinValues(t.options)}, received '${t.received}'`;break;case J.invalid_arguments:n="Invalid function arguments";break;case J.invalid_return_type:n="Invalid function return type";break;case J.invalid_date:n="Invalid date";break;case J.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:be.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case J.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case J.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case J.custom:n="Invalid input";break;case J.invalid_intersection_types:n="Intersection results could not be merged";break;case J.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case J.not_finite:n="Number must be finite";break;case J.unresolved_reference:n="Unresolved reference";break;default:n=e.defaultError,be.assertNever(t)}return{message:n}},"errorMap"),od=qs,J=be.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","unresolved_reference"]),ZP=f(t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),Oi=class fg extends Error{constructor(e){super(),this.issues=[],this.addIssue=f(r=>{this.issues=[...this.issues,r]},"addIssue"),this.addIssues=f((r=[])=>{this.issues=[...this.issues,...r]},"addIssues");let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let n=e||function(s){return s.message},r={_errors:[]},o=f(s=>{for(let i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let a=r,l=0;for(;l<i.path.length;){let c=i.path[l];l===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(i))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}},"processError");return o(this),r}static assert(e){if(!(e instanceof fg))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,be.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n={},r=[];for(let o of this.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(e(o))):r.push(e(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};f(Oi,"ZodError");Oi.create=f(t=>new Oi(t),"create");var Yt=Oi,pg=qs;function gg(t){pg=t}f(gg,"setErrorMap");function zr(){return pg}f(zr,"getErrorMap");var Ri=f(t=>{var e;let{data:n,path:r,errorMaps:o,issueData:s}=t,i=[...r,...s.path||[]],a=N(v({},s),{path:i}),l="",c=o.filter(p=>!!p).slice().reverse();for(let p of c)l=p(a,{data:n,defaultError:l}).message;return N(v({},s),{path:i,message:(e=s.message)!=null?e:l})},"makeIssue"),KP=[];function te(t,e){let n=Ri({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,zr(),qs].filter(r=>!!r)});t.common.issues.push(n)}f(te,"addIssueToContext");var yg=class mg{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let o of n){if(o.status==="aborted")return pe;o.status==="dirty"&&e.dirty(),r.push(o.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let o of n)r.push({key:await o.key,value:await o.value});return mg.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let o of n){let{key:s,value:i}=o;if(s.status==="aborted"||i.status==="aborted")return pe;s.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(r[s.value]=i.value)}return{status:e.value,value:r}}};f(yg,"ParseStatus");var _t=yg,pe=Object.freeze({status:"aborted"}),er=f(t=>({status:"dirty",value:t}),"DIRTY"),gt=f(t=>({status:"valid",value:t}),"OK"),Ss=f(t=>t.status==="aborted","isAborted"),Is=f(t=>t.status==="dirty","isDirty"),qr=f(t=>t.status==="valid","isValid"),Mi=f(t=>typeof Promise<"u"&&t instanceof Promise,"isAsync"),ue;(t=>{t.errToObj=f(e=>typeof e=="string"?{message:e}:e||{},"errToObj"),t.toString=f(e=>typeof e=="string"?e:e?.message,"toString")})(ue||(ue={}));var Ni=class hg extends he{constructor(){super(...arguments),this._any=!0}_parse(e){return gt(e.data)}isEqual(e){return e instanceof hg}};f(Ni,"ZodAny");Ni.create=f(t=>new Ni(v({typeName:"ZodAny"},me(t))),"create");var Gr=Ni,Di=class In extends he{dereference(e){return new In(N(v({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new In(N(v({},this._def),{type:this._def.type.clone()}))}isEqual(e){var n,r,o,s,i,a;return e instanceof In?nr((n=this._def.exactLength)==null?void 0:n.value,(r=e._def.exactLength)==null?void 0:r.value)&&nr((o=this._def.maxLength)==null?void 0:o.value,(s=e._def.maxLength)==null?void 0:s.value)&&nr((i=this._def.minLength)==null?void 0:i.value,(a=e._def.minLength)==null?void 0:a.value)&&this._def.type.isEqual(e._def.type):!1}_parse(e){let{ctx:n,status:r}=this._processInputParams(e),o=this._def;if(n.parsedType!==ne.array)return te(n,{code:J.invalid_type,expected:ne.array,received:n.parsedType}),pe;if(o.exactLength!==null){let i=n.data.length>o.exactLength.value,a=n.data.length<o.exactLength.value;(i||a)&&(te(n,{code:i?J.too_big:J.too_small,minimum:a?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(te(n,{code:J.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(te(n,{code:J.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,a)=>o.type._parseAsync(new Mt(n,i,n.path,a)))).then(i=>_t.mergeArray(r,i));let s=[...n.data].map((i,a)=>o.type._parseSync(new Mt(n,i,n.path,a)));return _t.mergeArray(r,s)}get element(){return this._def.type}min(e,n){return new In(N(v({},this._def),{minLength:{value:e,message:ue.toString(n)}}))}max(e,n){return new In(N(v({},this._def),{maxLength:{value:e,message:ue.toString(n)}}))}length(e,n){return new In(N(v({},this._def),{exactLength:{value:e,message:ue.toString(n)}}))}nonempty(e){return this.min(1,e)}};f(Di,"ZodArray");Di.create=f((t,e)=>new Di(v({type:t,minLength:null,maxLength:null,exactLength:null,typeName:"ZodArray"},me(e))),"create");var Vr=Di,LP=f((t,e)=>Tg(t,e,new WeakSet),"isEqual"),Tg=f((t,e,n)=>aP(t,e,FP(n)),"_isEqualWithVisitedTracking"),FP=f(t=>(e,n)=>{if(Zc(e)&&!t.has(e)&&Zc(n)&&!t.has(n)){let r=nd(e,td),o=nd(n,td);return t.add(r).add(o).add(e).add(n),Tg(r,o,t)}},"_customizerWithVisitedTracking"),WP={compare:LP},vg=class{constructor(e=[],n={}){this._options=v(v({},WP),n),this._items=[];for(let r of e)this.add(r)}get items(){return[...this._items]}get size(){return this._items.length}has(e){return this._items.some(n=>this._options.compare(n,e))}add(e){this.has(e)||this._items.push(e)}isEqual(e){return this.size!==e.size?!1:this.isSubsetOf(e)&&e.isSubsetOf(this)}isSubsetOf(e){return this.size>e.size?!1:this._items.every(n=>e.has(n))}};f(vg,"CustomSet");var tt=vg,Hi=class xi extends he{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==ne.bigint){let s=this._getOrReturnCtx(e);return te(s,{code:J.invalid_type,expected:ne.bigint,received:s.parsedType}),pe}let r,o=new _t;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:J.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:J.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),te(r,{code:J.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):be.assertNever(s);return{status:o.value,value:e.data}}isEqual(e){if(!(e instanceof xi)||this._def.coerce!==e._def.coerce)return!1;let n=new tt(this._def.checks),r=new tt(e._def.checks);return n.isEqual(r)}gte(e,n){return this.setLimit("min",e,!0,ue.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ue.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ue.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ue.toString(n))}setLimit(e,n,r,o){return new xi(N(v({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ue.toString(o)}]}))}_addCheck(e){return new xi(N(v({},this._def),{checks:[...this._def.checks,e]}))}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ue.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ue.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ue.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ue.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ue.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};f(Hi,"ZodBigInt");Hi.create=f(t=>{var e;return new Hi(v({checks:[],typeName:"ZodBigInt",coerce:(e=t?.coerce)!=null?e:!1},me(t)))},"create");var Gs=Hi,Ui=class _g extends he{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ne.boolean){let r=this._getOrReturnCtx(e);return te(r,{code:J.invalid_type,expected:ne.boolean,received:r.parsedType}),pe}return gt(e.data)}isEqual(e){return e instanceof _g?this._def.coerce===e._def.coerce:!1}};f(Ui,"ZodBoolean");Ui.create=f(t=>new Ui(v({typeName:"ZodBoolean",coerce:t?.coerce||!1},me(t))),"create");var Vs=Ui,zP=Symbol("zod_brand"),bg=class Sr extends he{dereference(e){return new Sr(N(v({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new Sr(N(v({},this._def),{type:this._def.type.clone()}))}_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}isEqual(e){return e instanceof Sr?this._def.type.isEqual(e._def.type):!1}naked(){return this._def.type.naked()}mandatory(){return new Sr(N(v({},this._def),{type:this._def.type.mandatory()}))}};f(bg,"ZodBranded");var Js=bg,ji=class Ir extends he{_parse(e){let{ctx:n}=this._processInputParams(e),r=N(v({},n),{common:N(v({},n.common),{issues:[]})}),o=this._def.innerType._parse({data:r.data,path:r.path,parent:v({},r)});return Mi(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Yt(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Yt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}isEqual(e){return e instanceof Ir?this._def.innerType.isEqual(e._def.innerType)&&be.compareFunctions(this._def.catchValue,e._def.catchValue):!1}dereference(e){return new Ir(N(v({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Ir(N(v({},this._def),{innerType:this._def.innerType.clone()}))}naked(){return this._def.innerType.naked()}mandatory(){return new Ir(N(v({},this._def),{innerType:this._def.innerType.mandatory()}))}};f(ji,"ZodCatch");ji.create=f((t,e)=>new ji(v({innerType:t,typeName:"ZodCatch",catchValue:typeof e.catch=="function"?e.catch:()=>e.catch},me(e))),"create");var Ys=ji,wg=f((t,e={},n)=>t?Gr.create().superRefine((r,o)=>{var s,i;if(!t(r)){let a=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e,l=(i=(s=a.fatal)!=null?s:n)!=null?i:!0,c=typeof a=="string"?{message:a}:a;o.addIssue(N(v({code:"custom"},c),{fatal:l}))}}):Gr.create(),"custom"),$i=class ks extends he{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ne.date){let s=this._getOrReturnCtx(e);return te(s,{code:J.invalid_type,expected:ne.date,received:s.parsedType}),pe}if(isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return te(s,{code:J.invalid_date}),pe}let r=new _t,o;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(o=this._getOrReturnCtx(e,o),te(o,{code:J.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(o=this._getOrReturnCtx(e,o),te(o,{code:J.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):be.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ks(N(v({},this._def),{checks:[...this._def.checks,e]}))}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:ue.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:ue.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}isEqual(e){if(!(e instanceof ks))return!1;let n=new tt(this._def.checks),r=new tt(e._def.checks);return n.isEqual(r)&&this._def.coerce===e._def.coerce}};f($i,"ZodDate");$i.create=f(t=>new $i(v({checks:[],coerce:t?.coerce||!1,typeName:"ZodDate"},me(t))),"create");var Xs=$i,Zi=class kr extends he{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===ne.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}dereference(e){return new kr(N(v({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new kr(N(v({},this._def),{innerType:this._def.innerType.clone()}))}isEqual(e){return e instanceof kr?this._def.innerType.isEqual(e._def.innerType)&&nr(this._def.defaultValue(),e._def.defaultValue()):!1}unwrap(){return this._def.innerType}naked(){return this._def.innerType.naked()}mandatory(){return new kr(N(v({},this._def),{innerType:this._def.innerType.mandatory()}))}};f(Zi,"ZodDefault");Zi.create=f((t,e,n)=>new Zi(v({innerType:t,typeName:"ZodDefault",defaultValue:typeof e=="function"?e:()=>e},me(n))),"create");var xo=Zi,en=f(t=>Array.from(new Set(t)),"unique"),Jt=f(t=>t instanceof ta?Jt(t.schema):t instanceof Rn?Jt(t.innerType()):t instanceof na?[t.value]:t instanceof ur?t.options:t instanceof ra?be.objectValues(t.enum):t instanceof xo?Jt(t._def.innerType):t instanceof Io?[void 0]:t instanceof ia?[null]:t instanceof gn?[void 0,...Jt(t.unwrap())]:t instanceof ir?[null,...Jt(t.unwrap())]:t instanceof Js||t instanceof So?Jt(t.unwrap()):t instanceof Ys?Jt(t._def.innerType):[],"getDiscriminator"),Pg=class kn extends he{dereference(e){let n=this.options.map(o=>o.dereference(e)),r=kn._getOptionsMap(this.discriminator,n);return new kn(N(v({},this._def),{options:n,optionsMap:r}))}getReferences(){return en(this.options.flatMap(e=>e.getReferences()))}clone(){let e=this.options.map(n=>n.clone());return new kn(N(v({},this._def),{options:e}))}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==ne.object)return te(n,{code:J.invalid_type,expected:ne.object,received:n.parsedType}),pe;let r=this.discriminator,o=n.data[r],s=this.optionsMap.get(o);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(te(n,{code:J.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),pe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let o=kn._getOptionsMap(e,n);return new kn(v({typeName:"ZodDiscriminatedUnion",discriminator:e,options:n,optionsMap:o},me(r)))}static _getOptionsMap(e,n){let r=new Map;for(let o of n){let s=Jt(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of s){if(r.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);r.set(i,o)}}return r}isEqual(e){if(!(e instanceof kn)||this._def.discriminator!==e._def.discriminator)return!1;let n=f((s,i)=>s.isEqual(i),"compare"),r=new tt(this._def.options,{compare:n}),o=new tt(e._def.options,{compare:n});return r.isEqual(o)}};f(Pg,"ZodDiscriminatedUnion");var xg=Pg;function Bo(t,e){return new ur(v({values:t,typeName:"ZodEnum"},me(e)))}f(Bo,"createZodEnum");var Qs=class Bi extends he{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return te(n,{expected:be.joinValues(r),received:n.parsedType,code:J.invalid_type}),pe}if(this._def.values.indexOf(e.data)===-1){let n=this._getOrReturnCtx(e),r=this._def.values;return te(n,{received:n.data,code:J.invalid_enum_value,options:r}),pe}return gt(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return Bi.create(e,v(v({},this._def),n))}exclude(e,n=this._def){return Bi.create(this.options.filter(r=>!e.includes(r)),v(v({},this._def),n))}isEqual(e){if(!(e instanceof Bi))return!1;let n=new tt(this._def.values),r=new tt(e._def.values);return n.isEqual(r)}};f(Qs,"ZodEnum");Qs.create=Bo;var ur=Qs,Bg=class An extends he{constructor(){super(...arguments),this.validate=this.implement}dereference(e){let n=this._def.args.dereference(e),r=this._def.returns.dereference(e);return new An(N(v({},this._def),{args:n,returns:r}))}getReferences(){return en([...this._def.args.getReferences(),...this._def.returns.getReferences()])}clone(){return new An(N(v({},this._def),{args:this._def.args.clone(),returns:this._def.returns.clone()}))}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==ne.function)return te(n,{code:J.invalid_type,expected:ne.function,received:n.parsedType}),pe;function r(a,l){return Ri({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,zr(),od].filter(c=>!!c),issueData:{code:J.invalid_arguments,argumentsError:l}})}f(r,"makeArgsIssue");function o(a,l){return Ri({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,zr(),od].filter(c=>!!c),issueData:{code:J.invalid_return_type,returnTypeError:l}})}f(o,"makeReturnsIssue");let s={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof Eo){let a=this;return gt(async function(...l){let c=new Yt([]),p=await a._def.args.parseAsync(l,s).catch(h=>{throw c.addIssue(r(l,h)),c}),y=await Reflect.apply(i,this,p);return await a._def.returns._def.type.parseAsync(y,s).catch(h=>{throw c.addIssue(o(y,h)),c})})}else{let a=this;return gt(function(...l){let c=a._def.args.safeParse(l,s);if(!c.success)throw new Yt([r(l,c.error)]);let p=Reflect.apply(i,this,c.data),y=a._def.returns.safeParse(p,s);if(!y.success)throw new Yt([o(p,y.error)]);return y.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new An(N(v({},this._def),{args:ar.create(e).rest(Kr.create())}))}returns(e){return new An(N(v({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new An(v({args:e||ar.create([]).rest(Kr.create()),returns:n||Kr.create(),typeName:"ZodFunction"},me(r)))}isEqual(e){return e instanceof An&&this._def.args.isEqual(e._def.args)&&this._def.returns.isEqual(e._def.returns)}};f(Bg,"ZodFunction");var Eg=Bg;function Ki(t,e){let n=pn(t),r=pn(e);if(t===e)return{valid:!0,data:t};if(n===ne.object&&r===ne.object){let o=be.objectKeys(e),s=be.objectKeys(t).filter(a=>o.indexOf(a)!==-1),i=v(v({},t),e);for(let a of s){let l=Ki(t[a],e[a]);if(!l.valid)return{valid:!1};i[a]=l.data}return{valid:!0,data:i}}else if(n===ne.array&&r===ne.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let s=0;s<t.length;s++){let i=t[s],a=e[s],l=Ki(i,a);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return n===ne.date&&r===ne.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}f(Ki,"mergeValues");var Li=class Ei extends he{dereference(e){return new Ei(N(v({},this._def),{left:this._def.left.dereference(e),right:this._def.right.dereference(e)}))}getReferences(){return en([...this._def.left.getReferences(),...this._def.right.getReferences()])}clone(){return new Ei(N(v({},this._def),{left:this._def.left.clone(),right:this._def.right.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),o=f((s,i)=>{if(Ss(s)||Ss(i))return pe;let a=Ki(s.value,i.value);return a.valid?((Is(s)||Is(i))&&n.dirty(),{status:n.value,value:a.data}):(te(r,{code:J.invalid_intersection_types}),pe)},"handleParsed");return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,i])=>o(s,i)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}isEqual(e){if(!(e instanceof Ei))return!1;let n=f((s,i)=>s.isEqual(i),"compare"),r=new tt([this._def.left,this._def.right],{compare:n}),o=new tt([e._def.left,e._def.right],{compare:n});return r.isEqual(o)}};f(Li,"ZodIntersection");Li.create=f((t,e,n)=>new Li(v({left:t,right:e,typeName:"ZodIntersection"},me(n))),"create");var ea=Li,Fi=class Ar extends he{get schema(){return this._def.getter()}dereference(e){return new Ar(N(v({},this._def),{getter:f(()=>this._def.getter().dereference(e),"getter")}))}getReferences(){return this._def.getter().getReferences()}clone(){return new Ar(N(v({},this._def),{getter:f(()=>this._def.getter().clone(),"getter")}))}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}isEqual(e){return e instanceof Ar?this._def.getter().isEqual(e._def.getter()):!1}naked(){return this._def.getter().naked()}mandatory(){return new Ar(N(v({},this._def),{getter:f(()=>this._def.getter().mandatory(),"getter")}))}};f(Fi,"ZodLazy");Fi.create=f((t,e)=>new Fi(v({getter:t,typeName:"ZodLazy"},me(e))),"create");var ta=Fi,Wi=class Sg extends he{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return te(n,{received:n.data,code:J.invalid_literal,expected:this._def.value}),pe}return{status:"valid",value:e.data}}get value(){return this._def.value}isEqual(e){return e instanceof Sg?nr(this._def.value,e._def.value):!1}};f(Wi,"ZodLiteral");Wi.create=f((t,e)=>new Wi(v({value:t,typeName:"ZodLiteral"},me(e))),"create");var na=Wi,zi=class Si extends he{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}dereference(e){let n=this._def.keyType.dereference(e),r=this._def.valueType.dereference(e);return new Si(N(v({},this._def),{keyType:n,valueType:r}))}getReferences(){return en([...this._def.keyType.getReferences(),...this._def.valueType.getReferences()])}clone(){return new Si(N(v({},this._def),{keyType:this._def.keyType.clone(),valueType:this._def.valueType.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ne.map)return te(r,{code:J.invalid_type,expected:ne.map,received:r.parsedType}),pe;let o=this._def.keyType,s=this._def.valueType,i=[...r.data.entries()].map(([a,l],c)=>({key:o._parse(new Mt(r,a,r.path,[c,"key"])),value:s._parse(new Mt(r,l,r.path,[c,"value"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let l of i){let c=await l.key,p=await l.value;if(c.status==="aborted"||p.status==="aborted")return pe;(c.status==="dirty"||p.status==="dirty")&&n.dirty(),a.set(c.value,p.value)}return{status:n.value,value:a}})}else{let a=new Map;for(let l of i){let c=l.key,p=l.value;if(c.status==="aborted"||p.status==="aborted")return pe;(c.status==="dirty"||p.status==="dirty")&&n.dirty(),a.set(c.value,p.value)}return{status:n.value,value:a}}}isEqual(e){return!(!(e instanceof Si)||!this._def.keyType.isEqual(e._def.keyType)||!this._def.valueType.isEqual(e._def.valueType))}};f(zi,"ZodMap");zi.create=f((t,e,n)=>new zi(v({valueType:e,keyType:t,typeName:"ZodMap"},me(n))),"create");var Ig=zi,qi=class kg extends he{_parse(e){if(this._getType(e)!==ne.nan){let r=this._getOrReturnCtx(e);return te(r,{code:J.invalid_type,expected:ne.nan,received:r.parsedType}),pe}return{status:"valid",value:e.data}}isEqual(e){return e instanceof kg}};f(qi,"ZodNaN");qi.create=f(t=>new qi(v({typeName:"ZodNaN"},me(t))),"create");var Ag=qi,Gi=class Cg extends he{_parse(e){let n=be.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==ne.string&&r.parsedType!==ne.number){let o=be.objectValues(n);return te(r,{expected:be.joinValues(o),received:r.parsedType,code:J.invalid_type}),pe}if(n.indexOf(e.data)===-1){let o=be.objectValues(n);return te(r,{received:r.data,code:J.invalid_enum_value,options:o}),pe}return gt(e.data)}get enum(){return this._def.values}isEqual(e){return e instanceof Cg?nr(this._def.values,e._def.values):!1}};f(Gi,"ZodNativeEnum");Gi.create=f((t,e)=>new Gi(v({values:t,typeName:"ZodNativeEnum"},me(e))),"create");var ra=Gi,Vi=class Og extends he{_parse(e){let n=this._getOrReturnCtx(e);return te(n,{code:J.invalid_type,expected:ne.never,received:n.parsedType}),pe}isEqual(e){return e instanceof Og}};f(Vi,"ZodNever");Vi.create=f(t=>new Vi(v({typeName:"ZodNever"},me(t))),"create");var Xr=Vi,Ji=class Rg extends he{_parse(e){if(this._getType(e)!==ne.null){let r=this._getOrReturnCtx(e);return te(r,{code:J.invalid_type,expected:ne.null,received:r.parsedType}),pe}return gt(e.data)}isEqual(e){return e instanceof Rg}};f(Ji,"ZodNull");Ji.create=f(t=>new Ji(v({typeName:"ZodNull"},me(t))),"create");var ia=Ji,Yi=class Cr extends he{dereference(e){return new Cr(N(v({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Cr(N(v({},this._def),{innerType:this._def.innerType.clone()}))}_parse(e){return this._getType(e)===ne.null?gt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}isEqual(e){return e instanceof Cr?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return new Cr(N(v({},this._def),{innerType:this._def.innerType.mandatory()}))}};f(Yi,"ZodNullable");Yi.create=f((t,e)=>new Yi(v({innerType:t,typeName:"ZodNullable"},me(e))),"create");var ir=Yi;function Mg(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,o=n>r?n:r,s=parseInt(t.toFixed(o).replace(".","")),i=parseInt(e.toFixed(o).replace(".",""));return s%i/Math.pow(10,o)}f(Mg,"floatSafeRemainder");var Xi=class Ii extends he{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ne.number){let s=this._getOrReturnCtx(e);return te(s,{code:J.invalid_type,expected:ne.number,received:s.parsedType}),pe}let r,o=new _t;for(let s of this._def.checks)s.kind==="int"?be.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),te(r,{code:J.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:J.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:J.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?Mg(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),te(r,{code:J.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),te(r,{code:J.not_finite,message:s.message}),o.dirty()):be.assertNever(s);return{status:o.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,ue.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ue.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ue.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ue.toString(n))}setLimit(e,n,r,o){return new Ii(N(v({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ue.toString(o)}]}))}_addCheck(e){return new Ii(N(v({},this._def),{checks:[...this._def.checks,e]}))}int(e){return this._addCheck({kind:"int",message:ue.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ue.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ue.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ue.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ue.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ue.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:ue.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ue.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ue.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&be.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}isEqual(e){if(!(e instanceof Ii))return!1;let n=new tt(this._def.checks),r=new tt(e._def.checks);return n.isEqual(r)}};f(Xi,"ZodNumber");Xi.create=f(t=>new Xi(v({checks:[],typeName:"ZodNumber",coerce:t?.coerce||!1},me(t))),"create");var oa=Xi;function Cn(t){if(t instanceof or){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=gn.create(Cn(r))}return new or(N(v({},t._def),{shape:f(()=>e,"shape")}))}else return t instanceof Vr?new Vr(N(v({},t._def),{type:Cn(t.element)})):t instanceof gn?gn.create(Cn(t.unwrap())):t instanceof ir?ir.create(Cn(t.unwrap())):t instanceof ar?ar.create(t.items.map(e=>Cn(e))):t}f(Cn,"deepPartialify");var mn=class vt extends he{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=be.objectKeys(e);return this._cached={shape:e,keys:n}}dereference(e){let n=this._def.shape(),r={};for(let o in n)r[o]=n[o].dereference(e);return new vt(N(v({},this._def),{shape:f(()=>r,"shape")}))}getReferences(){let e=this._def.shape(),n=[];for(let r in e)n.push(...e[r].getReferences());return en(n)}clone(){let e={},n=this._def.shape();for(let[r,o]of Object.entries(n))e[r]=o.clone();return new vt(N(v({},this._def),{shape:f(()=>e,"shape")}))}_parse(e){if(this._getType(e)!==ne.object){let p=this._getOrReturnCtx(e);return te(p,{code:J.invalid_type,expected:ne.object,received:p.parsedType}),pe}let{status:r,ctx:o}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),a=[];if(this._def.unknownKeys!=="strip")for(let p in o.data)i.includes(p)||a.push(p);let l=[];for(let p of i){let y=s[p],g=o.data[p];l.push({key:{status:"valid",value:p},value:y._parse(new Mt(o,g,o.path,p)),alwaysSet:p in o.data})}let c=this._def.unknownKeys;if(c==="passthrough")for(let p of a)l.push({key:{status:"valid",value:p},value:{status:"valid",value:o.data[p]}});else if(c==="strict")a.length>0&&(te(o,{code:J.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")for(let p of a){let y=o.data[p];l.push({key:{status:"valid",value:p},value:c._parse(new Mt(o,y,o.path,p)),alwaysSet:p in o.data})}return o.common.async?Promise.resolve().then(async()=>{let p=[];for(let y of l){let g=await y.key;p.push({key:g,value:await y.value,alwaysSet:y.alwaysSet})}return p}).then(p=>_t.mergeObjectSync(r,p)):_t.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return ue.errToObj,new vt(v(N(v({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:f((n,r)=>{var o,s,i,a;let l=(i=(s=(o=this._def).errorMap)==null?void 0:s.call(o,n,r).message)!=null?i:r.defaultError;return n.code==="unrecognized_keys"?{message:(a=ue.errToObj(e).message)!=null?a:l}:{message:l}},"errorMap")}:{}))}strip(){return new vt(N(v({},this._def),{unknownKeys:"strip"}))}passthrough(){return new vt(N(v({},this._def),{unknownKeys:"passthrough"}))}additionalProperties(){if(this._def.unknownKeys instanceof he)return this._def.unknownKeys;if(this._def.unknownKeys==="passthrough")return Gr.create();if(this._def.unknownKeys==="strict")return Xr.create()}extend(e){return new vt(N(v({},this._def),{shape:f(()=>v(v({},this._def.shape()),e),"shape")}))}merge(e){return new vt({unknownKeys:e._def.unknownKeys,shape:f(()=>v(v({},this._def.shape()),e._def.shape()),"shape"),typeName:"ZodObject"})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new vt(N(v({},this._def),{unknownKeys:e}))}pick(e){let n={};return be.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new vt(N(v({},this._def),{shape:f(()=>n,"shape")}))}omit(e){let n={};return be.objectKeys(this.shape).forEach(r=>{e[r]||(n[r]=this.shape[r])}),new vt(N(v({},this._def),{shape:f(()=>n,"shape")}))}deepPartial(){return Cn(this)}partial(e){let n={};return be.objectKeys(this.shape).forEach(r=>{let o=this.shape[r];e&&!e[r]?n[r]=o:n[r]=o?.optional()}),new vt(N(v({},this._def),{shape:f(()=>n,"shape")}))}required(e){let n={};return be.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof gn;)s=s._def.innerType;n[r]=s}}),new vt(N(v({},this._def),{shape:f(()=>n,"shape")}))}keyof(){return Bo(be.objectKeys(this.shape))}isEqual(e){if(!(e instanceof vt)||!this._unknownKeysEqual(e))return!1;let n=this._def.shape(),r=e._def.shape(),o=f((a,l)=>a[0]===l[0]&&a[1].isEqual(l[1]),"compare"),s=new tt(Object.entries(n),{compare:o}),i=new tt(Object.entries(r),{compare:o});return s.isEqual(i)}_unknownKeysEqual(e){let n=this.additionalProperties(),r=e.additionalProperties();return n===void 0||r===void 0?n===r:n.isEqual(r)}};f(mn,"ZodObject");mn.create=f((t,e)=>new mn(v({shape:f(()=>t,"shape"),unknownKeys:"strip",typeName:"ZodObject"},me(e))),"create");mn.strictCreate=f((t,e)=>new mn(v({shape:f(()=>t,"shape"),unknownKeys:"strict",typeName:"ZodObject"},me(e))),"strictCreate");mn.lazycreate=f((t,e)=>new mn(v({shape:t,unknownKeys:"strip",typeName:"ZodObject"},me(e))),"lazycreate");var or=mn,Qi=class ki extends he{dereference(e){return new ki(N(v({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new ki(N(v({},this._def),{innerType:this._def.innerType.clone()}))}_parse(e){return this._getType(e)===ne.undefined?gt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}isEqual(e){return e instanceof ki?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return this._def.innerType.mandatory()}};f(Qi,"ZodOptional");Qi.create=f((t,e)=>new Qi(v({innerType:t,typeName:"ZodOptional"},me(e))),"create");var gn=Qi,Ng=class Or extends he{dereference(e){return new Or(N(v({},this._def),{in:this._def.in.dereference(e),out:this._def.out.dereference(e)}))}getReferences(){return en([...this._def.in.getReferences(),...this._def.out.getReferences()])}clone(){return new Or(N(v({},this._def),{in:this._def.in.clone(),out:this._def.out.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return f(async()=>{let s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?pe:s.status==="dirty"?(n.dirty(),er(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})},"handleAsync")();{let o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?pe:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(e,n){return new Or({in:e,out:n,typeName:"ZodPipeline"})}isEqual(e){return!(!(e instanceof Or)||!this._def.in.isEqual(e._def.in)||!this._def.out.isEqual(e._def.out))}};f(Ng,"ZodPipeline");var sa=Ng,eo=class Ai extends he{unwrap(){return this._def.type}dereference(e){return new Ai(N(v({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new Ai(N(v({},this._def),{type:this._def.type.clone()}))}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==ne.promise&&n.common.async===!1)return te(n,{code:J.invalid_type,expected:ne.promise,received:n.parsedType}),pe;let r=n.parsedType===ne.promise?n.data:Promise.resolve(n.data);return gt(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}isEqual(e){return e instanceof Ai?this._def.type.isEqual(e._def.type):!1}naked(){return this._def.type.naked()}};f(eo,"ZodPromise");eo.create=f((t,e)=>new eo(v({type:t,typeName:"ZodPromise"},me(e))),"create");var Eo=eo,to=class Rr extends he{dereference(e){return new Rr(N(v({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Rr(N(v({},this._def),{innerType:this._def.innerType.clone()}))}_parse(e){let n=this._def.innerType._parse(e);return qr(n)&&(n.value=Object.freeze(n.value)),n}unwrap(){return this._def.innerType}isEqual(e){return e instanceof Rr?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return new Rr(N(v({},this._def),{innerType:this._def.innerType.mandatory()}))}};f(to,"ZodReadonly");to.create=f((t,e)=>new to(v({innerType:t,typeName:"ZodReadonly"},me(e))),"create");var So=to,Dg=class Yn extends he{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}dereference(e){let n=this._def.keyType.dereference(e),r=this._def.valueType.dereference(e);return new Yn(N(v({},this._def),{keyType:n,valueType:r}))}getReferences(){return en([...this._def.keyType.getReferences(),...this._def.valueType.getReferences()])}clone(){return new Yn(N(v({},this._def),{keyType:this._def.keyType.clone(),valueType:this._def.valueType.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ne.object)return te(r,{code:J.invalid_type,expected:ne.object,received:r.parsedType}),pe;let o=[],s=this._def.keyType,i=this._def.valueType;for(let a in r.data)o.push({key:s._parse(new Mt(r,a,r.path,a)),value:i._parse(new Mt(r,r.data[a],r.path,a))});return r.common.async?_t.mergeObjectAsync(n,o):_t.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof he?new Yn(v({keyType:e,valueType:n,typeName:"ZodRecord"},me(r))):new Yn(v({keyType:yt.create(),valueType:e,typeName:"ZodRecord"},me(n)))}isEqual(e){return!(!(e instanceof Yn)||!this._def.keyType.isEqual(e._def.keyType)||!this._def.valueType.isEqual(e._def.valueType))}};f(Dg,"ZodRecord");var Hg=Dg,no=class Ug extends he{dereference(e){let n=e[this._def.uri];return n||this}getReferences(){return[this._def.uri]}_parse(e){let n=this._getOrReturnCtx(e);return te(n,{code:J.unresolved_reference}),pe}isOptional(){return!1}isNullable(){return!1}isEqual(e){return e instanceof Ug?this._def.uri===e._def.uri:!1}};f(no,"ZodRef");no.create=f(t=>new no({typeName:"ZodRef",uri:t}),"create");var jg=no,ro=class Xn extends he{dereference(e){return new Xn(N(v({},this._def),{valueType:this._def.valueType.dereference(e)}))}getReferences(){return this._def.valueType.getReferences()}clone(){return new Xn(N(v({},this._def),{valueType:this._def.valueType.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ne.set)return te(r,{code:J.invalid_type,expected:ne.set,received:r.parsedType}),pe;let o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(te(r,{code:J.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(te(r,{code:J.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());let s=this._def.valueType;function i(l){let c=new Set;for(let p of l){if(p.status==="aborted")return pe;p.status==="dirty"&&n.dirty(),c.add(p.value)}return{status:n.value,value:c}}f(i,"finalizeSet");let a=[...r.data.values()].map((l,c)=>s._parse(new Mt(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>i(l)):i(a)}min(e,n){return new Xn(N(v({},this._def),{minSize:{value:e,message:ue.toString(n)}}))}max(e,n){return new Xn(N(v({},this._def),{maxSize:{value:e,message:ue.toString(n)}}))}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}isEqual(e){var n,r,o,s;if(!(e instanceof Xn))return!1;let i=(n=this._def.minSize)==null?void 0:n.value,a=(r=e._def.minSize)==null?void 0:r.value;if(i!==a)return!1;let l=(o=this._def.maxSize)==null?void 0:o.value,c=(s=e._def.maxSize)==null?void 0:s.value;return l!==c?!1:this._def.valueType.isEqual(e._def.valueType)}};f(ro,"ZodSet");ro.create=f((t,e)=>new ro(v({valueType:t,minSize:null,maxSize:null,typeName:"ZodSet"},me(e))),"create");var $g=ro,Zg=/^c[^\s-]{8,}$/i,Kg=/^[a-z][a-z0-9]*$/,Lg=/^[0-9A-HJKMNP-TV-Z]{26}$/,Fg=/^[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,Wg=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,zg="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",qP=f(t=>t===zg,"isEmojiRegex"),ms,qg=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,Gg=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;function Vg(t,e){return!!((e==="v4"||!e)&&qg.test(t)||(e==="v6"||!e)&&Gg.test(t))}f(Vg,"isValidIP");var io=class Qn extends he{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ne.string){let s=this._getOrReturnCtx(e);return te(s,{code:J.invalid_type,expected:ne.string,received:s.parsedType}),pe}let r=new _t,o;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(o=this._getOrReturnCtx(e,o),te(o,{code:J.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(o=this._getOrReturnCtx(e,o),te(o,{code:J.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){let i=e.data.length>s.value,a=e.data.length<s.value;(i||a)&&(o=this._getOrReturnCtx(e,o),i?te(o,{code:J.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&te(o,{code:J.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")Wg.test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"email",code:J.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")ms||(ms=new RegExp(zg,"u")),ms.test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"emoji",code:J.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")Fg.test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"uuid",code:J.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")Zg.test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"cuid",code:J.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")Kg.test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"cuid2",code:J.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")Lg.test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"ulid",code:J.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),te(o,{validation:"url",code:J.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"regex",code:J.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(o=this._getOrReturnCtx(e,o),te(o,{code:J.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(o=this._getOrReturnCtx(e,o),te(o,{code:J.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(o=this._getOrReturnCtx(e,o),te(o,{code:J.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?lg(s).test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{code:J.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="ip"?Vg(e.data,s.version)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"ip",code:J.invalid_string,message:s.message}),r.dirty()):be.assertNever(s);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(o=>e.test(o),v({validation:n,code:J.invalid_string},ue.errToObj(r)))}_addCheck(e){return new Qn(N(v({},this._def),{checks:[...this._def.checks,e]}))}email(e){return this._addCheck(v({kind:"email"},ue.errToObj(e)))}url(e){return this._addCheck(v({kind:"url"},ue.errToObj(e)))}emoji(e){return this._addCheck(v({kind:"emoji"},ue.errToObj(e)))}uuid(e){return this._addCheck(v({kind:"uuid"},ue.errToObj(e)))}cuid(e){return this._addCheck(v({kind:"cuid"},ue.errToObj(e)))}cuid2(e){return this._addCheck(v({kind:"cuid2"},ue.errToObj(e)))}ulid(e){return this._addCheck(v({kind:"ulid"},ue.errToObj(e)))}ip(e){return this._addCheck(v({kind:"ip"},ue.errToObj(e)))}datetime(e){var n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck(v({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(n=e?.offset)!=null?n:!1},ue.errToObj(e?.message)))}regex(e,n){return this._addCheck(v({kind:"regex",regex:e},ue.errToObj(n)))}includes(e,n){return this._addCheck(v({kind:"includes",value:e,position:n?.position},ue.errToObj(n?.message)))}startsWith(e,n){return this._addCheck(v({kind:"startsWith",value:e},ue.errToObj(n)))}endsWith(e,n){return this._addCheck(v({kind:"endsWith",value:e},ue.errToObj(n)))}min(e,n){return this._addCheck(v({kind:"min",value:e},ue.errToObj(n)))}max(e,n){return this._addCheck(v({kind:"max",value:e},ue.errToObj(n)))}length(e,n){return this._addCheck(v({kind:"length",value:e},ue.errToObj(n)))}nonempty(e){return this.min(1,ue.errToObj(e))}trim(){return new Qn(N(v({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}secret(){return this._def[le]=N(v({},this._def[le]),{secret:!0}),this}toLowerCase(){return new Qn(N(v({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new Qn(N(v({},this._def),{checks:[...this._def.checks,{kind:"toUpperCase"}]}))}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}isEqual(e){if(!(e instanceof Qn))return!1;let n=new tt(this._def.checks),r=new tt(e._def.checks);return n.isEqual(r)}};f(io,"ZodString");io.create=f(t=>{var e;return new io(v({checks:[],typeName:"ZodString",coerce:(e=t?.coerce)!=null?e:!1},me(N(v({},t),{supportsExtensions:["secret"]}))))},"create");var yt=io,oo=class Jg extends he{_parse(e){if(this._getType(e)!==ne.symbol){let r=this._getOrReturnCtx(e);return te(r,{code:J.invalid_type,expected:ne.symbol,received:r.parsedType}),pe}return gt(e.data)}isEqual(e){return e instanceof Jg}};f(oo,"ZodSymbol");oo.create=f(t=>new oo(v({typeName:"ZodSymbol"},me(t))),"create");var Yg=oo,sr=class Mr extends he{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName==="ZodEffects"?this._def.schema.sourceType():this._def.schema}dereference(e){return new Mr(N(v({},this._def),{schema:this._def.schema.dereference(e)}))}getReferences(){return this._def.schema.getReferences()}clone(){return new Mr(N(v({},this._def),{schema:this._def.schema.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),o=this._def.effect||null,s={addIssue:f(i=>{te(r,i),i.fatal?n.abort():n.dirty()},"addIssue"),get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){let i=o.transform(r.data,s);if(r.common.async)return Promise.resolve(i).then(async a=>{if(n.value==="aborted")return pe;let l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?pe:l.status==="dirty"||n.value==="dirty"?er(l.value):l});{if(n.value==="aborted")return pe;let a=this._def.schema._parseSync({data:i,path:r.path,parent:r});return a.status==="aborted"?pe:a.status==="dirty"||n.value==="dirty"?er(a.value):a}}if(o.type==="refinement"){let i=f(a=>{let l=o.refinement(a,s);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a},"executeRefinement");if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?pe:(a.status==="dirty"&&n.dirty(),i(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?pe:(a.status==="dirty"&&n.dirty(),i(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!qr(i))return i;let a=o.transform(i.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>qr(i)?Promise.resolve(o.transform(i.value,s)).then(a=>({status:n.value,value:a})):i);be.assertNever(o)}isEqual(e){return!(e instanceof Mr)||!this._def.schema.isEqual(e._def.schema)?!1:this._def.effect.type==="refinement"?e._def.effect.type!=="refinement"?!1:be.compareFunctions(this._def.effect.refinement,e._def.effect.refinement):this._def.effect.type==="transform"?e._def.effect.type!=="transform"?!1:be.compareFunctions(this._def.effect.transform,e._def.effect.transform):this._def.effect.type==="preprocess"?e._def.effect.type!=="preprocess"?!1:be.compareFunctions(this._def.effect.transform,e._def.effect.transform):!1}naked(){return this._def.schema.naked()}mandatory(){return new Mr(N(v({},this._def),{schema:this._def.schema.mandatory()}))}};f(sr,"ZodEffects");sr.create=f((t,e,n)=>new sr(v({schema:t,typeName:"ZodEffects",effect:e},me(n))),"create");sr.createWithPreprocess=f((t,e,n)=>new sr(v({schema:e,effect:{type:"preprocess",transform:t},typeName:"ZodEffects"},me(n))),"createWithPreprocess");var Rn=sr,so=class Nr extends he{dereference(e){let n=this._def.items.map(o=>o.dereference(e)),r=this._def.rest?this._def.rest.dereference(e):null;return new Nr(N(v({},this._def),{items:n,rest:r}))}getReferences(){return en([...this._def.items.flatMap(e=>e.getReferences()),...this._def.rest?this._def.rest.getReferences():[]])}clone(){let e=this._def.items.map(r=>r.clone()),n=this._def.rest?this._def.rest.clone():null;return new Nr(N(v({},this._def),{items:e,rest:n}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ne.array)return te(r,{code:J.invalid_type,expected:ne.array,received:r.parsedType}),pe;if(r.data.length<this._def.items.length)return te(r,{code:J.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),pe;!this._def.rest&&r.data.length>this._def.items.length&&(te(r,{code:J.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let s=[...r.data].map((i,a)=>{let l=this._def.items[a]||this._def.rest;return l?l._parse(new Mt(r,i,r.path,a)):null}).filter(i=>!!i);return r.common.async?Promise.all(s).then(i=>_t.mergeArray(n,i)):_t.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new Nr(N(v({},this._def),{rest:e}))}isEqual(e){if(!(e instanceof Nr)||!this._restEquals(e))return!1;let n=f((s,i)=>s.isEqual(i),"compare"),r=new tt(this._def.items,{compare:n}),o=new tt(e._def.items,{compare:n});return r.isEqual(o)}_restEquals(e){return this._def.rest===null?e._def.rest===null:e._def.rest!==null&&this._def.rest.isEqual(e._def.rest)}};f(so,"ZodTuple");so.create=f((t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new so(v({items:t,typeName:"ZodTuple",rest:null},me(e)))},"create");var ar=so,ao=class Xg extends he{_parse(e){if(this._getType(e)!==ne.undefined){let r=this._getOrReturnCtx(e);return te(r,{code:J.invalid_type,expected:ne.undefined,received:r.parsedType}),pe}return gt(e.data)}isEqual(e){return e instanceof Xg}mandatory(){return Xr.create(v({},this._def))}};f(ao,"ZodUndefined");ao.create=f(t=>new ao(v({typeName:"ZodUndefined"},me(t))),"create");var Io=ao,lo=class Dr extends he{dereference(e){let n=this._def.options.map(r=>r.dereference(e));return new Dr(N(v({},this._def),{options:n}))}getReferences(){return en(this._def.options.reduce((e,n)=>[...e,...n.getReferences()],[]))}clone(){let e=this._def.options.map(n=>n.clone());return new Dr(N(v({},this._def),{options:e}))}_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function o(s){for(let a of s)if(a.result.status==="valid")return a.result;for(let a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;let i=s.map(a=>new Yt(a.ctx.common.issues));return te(n,{code:J.invalid_union,unionErrors:i}),pe}if(f(o,"handleResults"),n.common.async)return Promise.all(r.map(async s=>{let i=N(v({},n),{common:N(v({},n.common),{issues:[]}),parent:null});return{result:await s._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(o);{let s,i=[];for(let l of r){let c=N(v({},n),{common:N(v({},n.common),{issues:[]}),parent:null}),p=l._parseSync({data:n.data,path:n.path,parent:c});if(p.status==="valid")return p;p.status==="dirty"&&!s&&(s={result:p,ctx:c}),c.common.issues.length&&i.push(c.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(l=>new Yt(l));return te(n,{code:J.invalid_union,unionErrors:a}),pe}}get options(){return this._def.options}isEqual(e){if(!(e instanceof Dr))return!1;let n=f((s,i)=>s.isEqual(i),"compare"),r=new tt([...this._def.options],{compare:n}),o=new tt([...e._def.options],{compare:n});return r.isEqual(o)}mandatory(){let e=this._def.options.filter(s=>!(s instanceof Io)).map(s=>s.mandatory()),[n,r,...o]=e;return n?r?new Dr(N(v({},this._def),{options:[n,r,...o]})):n:Xr.create(v({},this._def))}};f(lo,"ZodUnion");lo.create=f((t,e)=>new lo(v({options:t,typeName:"ZodUnion"},me(e))),"create");var aa=lo,uo=class Qg extends he{constructor(){super(...arguments),this._unknown=!0}_parse(e){return gt(e.data)}isEqual(e){return e instanceof Qg}};f(uo,"ZodUnknown");uo.create=f(t=>new uo(v({typeName:"ZodUnknown"},me(t))),"create");var Kr=uo,co=class ey extends he{_parse(e){if(this._getType(e)!==ne.undefined){let r=this._getOrReturnCtx(e);return te(r,{code:J.invalid_type,expected:ne.void,received:r.parsedType}),pe}return gt(e.data)}isEqual(e){return e instanceof ey}};f(co,"ZodVoid");co.create=f(t=>new co(v({typeName:"ZodVoid"},me(t))),"create");var ty=co,GP=["gpt-3.5-turbo","gpt-3.5-turbo-16k","gpt-4","gpt-4-1106-preview","gpt-4-vision-preview","gpt-4-0125-preview","gpt-4-turbo-preview","gpt-4-turbo","gpt-4o","gpt-3.5-turbo-0125","gpt-3.5-turbo-1106"],eC=ur.create(["any","string","number","boolean","object","pattern","date","array","target","time","enum"]),VP=f(t=>yt.create().displayAs({id:"variable",params:v({type:t?.type||"any"},t?.params)}),"variable"),JP=f(t=>yt.create().displayAs({id:"conversation",params:v({},t?.params)}),"conversation"),YP=f(t=>yt.create().displayAs({id:"user",params:v({},t?.params)}),"user"),XP=f(t=>yt.create().displayAs({id:"message",params:v({},t?.params)}),"message"),QP=f(t=>yt.create().displayAs({id:"agent",params:v({},t?.params)}),"agent"),ex=f(t=>yt.create().displayAs({id:"event",params:v({},t?.params)}),"event"),tx=f(t=>yt.create().displayAs({id:"table",params:v({},t?.params)}),"table"),nx=f(t=>yt.create().displayAs({id:"tablerow",params:v({},t?.params)}),"tablerow"),rx=f(t=>yt.create().displayAs({id:"intent",params:v({},t?.params)}),"intent"),ix=f(()=>ur.create(GP).displayAs({id:"dropdown",params:{}}),"aimodel"),ox=f(t=>yt.create().displayAs({id:"datasource",params:v({},t)}),"datasource"),sx=f(t=>yt.create().displayAs({id:"knowledgebase",params:v({},t)}),"knowledgebase"),ax={object:or.lazycreate},lx=f((t,e={message:`Input not instance of ${t.name}`})=>wg(n=>n instanceof t,e),"instanceOfType"),ny=yt.create,ry=oa.create,ux=Ag.create,cx=Gs.create,iy=Vs.create,dx=Xs.create,fx=Yg.create,px=Io.create,gx=ia.create,yx=Gr.create,mx=Kr.create,hx=Xr.create,Tx=ty.create,vx=Vr.create,_x=or.create,bx=or.strictCreate,wx=aa.create,Px=xg.create,xx=ea.create,Bx=ar.create,Ex=Hg.create,Sx=jg.create,Ix=So.create,kx=Ig.create,Ax=$g.create,Cx=Eg.create,Ox=ta.create,Rx=na.create,Mx=ur.create,Nx=ra.create,Dx=Eo.create,sd=Rn.create,Hx=gn.create,Ux=ir.create,jx=xo.create,$x=Rn.createWithPreprocess,Zx=sa.create,Kx=f(()=>ny().optional(),"ostring"),Lx=f(()=>ry().optional(),"onumber"),Fx=f(()=>iy().optional(),"oboolean"),Wx={string:f(t=>yt.create(N(v({},t),{coerce:!0})),"string"),number:f(t=>oa.create(N(v({},t),{coerce:!0})),"number"),boolean:f(t=>Vs.create(N(v({},t),{coerce:!0})),"boolean"),bigint:f(t=>Gs.create(N(v({},t),{coerce:!0})),"bigint"),date:f(t=>Xs.create(N(v({},t),{coerce:!0})),"date")},zx=pe,R=X,oy=f((t,e)=>t.anyOf.length?t.anyOf.length===1?it(t.anyOf[0],N(v({},e),{path:[...e.path,"anyOf",0]})):`z.union([${t.anyOf.map((n,r)=>it(n,N(v({},e),{path:[...e.path,"anyOf",r]}))).join(", ")}])`:"z.any()","parseAnyOf"),qx=f(t=>{var e;return(e=t[le])!=null&&e.coerce?"z.coerce.boolean()":"z.boolean()"},"parseBoolean"),Gx=f(t=>"z.any()","parseDefault"),Vx=f((t,e)=>`z.union([${t.type.map(n=>it(N(v({},t),{type:n}),e)).join(", ")}])`,"parseMultipleType"),Jx=f((t,e)=>`z.any().refine((value) => !${it(t.not,N(v({},e),{path:[...e.path,"not"]}))}.safeParse(value).success, "Invalid input: Should NOT be valid against schema")`,"parseNot"),Yx=f(t=>"z.null()","parseNull"),Xx=f(t=>[t.slice(0,t.length/2),t.slice(t.length/2)],"half"),Qx=f((t,...e)=>Object.keys(t).reduce((n,r)=>(e.includes(r)||(n[r]=t[r]),n),{}),"omit");function ut(t,e,n){var r;let o=t[e],s="";if(o!==void 0){let i=n({value:o,json:JSON.stringify(o)});if(i){let a=i[0],l=i.length===3?i[1]:"",c=i.length===3?i[2]:i[1];s+=a,((r=t.errorMessage)==null?void 0:r[e])!==void 0&&(s+=l+JSON.stringify(t.errorMessage[e])),s+=c}}return s}f(ut,"withMessage");var Hr=Symbol("Original index"),eB=f(t=>{let e=[];for(let n=0;n<t.length;n++){let r=t[n];if(typeof r=="boolean")e.push(r?{[Hr]:n}:{[Hr]:n,not:{}});else{if(Hr in r)return t;e.push(N(v({},r),{[Hr]:n}))}}return e},"ensureOriginalIndex");function Jr(t,e){if(t.allOf.length===0)return"z.never()";if(t.allOf.length===1){let n=t.allOf[0];return it(n,N(v({},e),{path:[...e.path,"allOf",n[Hr]]}))}else{let[n,r]=Xx(eB(t.allOf));return`z.intersection(${Jr({allOf:n},e)}, ${Jr({allOf:r},e)})`}}f(Jr,"parseAllOf");var tB=f((t,e)=>{if(Array.isArray(t.items))return`z.tuple([${t.items.map((r,o)=>it(r,N(v({},e),{path:[...e.path,"items",o]})))}])`;let n=t.items?`z.array(${it(t.items,N(v({},e),{path:[...e.path,"items"]}))})`:"z.array(z.any())";return n+=ut(t,"minItems",({json:r})=>[`.min(${r}`,", ",")"]),n+=ut(t,"maxItems",({json:r})=>[`.max(${r}`,", ",")"]),n},"parseArray"),nB=f(t=>`z.literal(${JSON.stringify(t.const)})`,"parseConst"),rB=f(t=>t.enum.length===0?"z.never()":t.enum.length===1?`z.literal(${JSON.stringify(t.enum[0])})`:t.enum.every(e=>typeof e=="string")?`z.enum([${t.enum.map(e=>JSON.stringify(e))}])`:`z.union([${t.enum.map(e=>`z.literal(${JSON.stringify(e)})`).join(", ")}])`,"parseEnum"),iB=f((t,e)=>{let n=it(t.if,N(v({},e),{path:[...e.path,"if"]})),r=it(t.then,N(v({},e),{path:[...e.path,"then"]})),o=it(t.else,N(v({},e),{path:[...e.path,"else"]}));return`z.union([${r}, ${o}]).superRefine((value,ctx) => {
29
- const result = ${n}.safeParse(value).success
30
- ? ${r}.safeParse(value)
31
- : ${o}.safeParse(value);
32
- if (!result.success) {
33
- result.error.errors.forEach((error) => ctx.addIssue(error))
34
- }
35
- })`},"parseIfThenElse"),oB=f(t=>{var e;let n="z.number()";return(e=t[le])!=null&&e.coerce&&(n="z.coerce.number()"),t.type==="integer"?n+=ut(t,"type",()=>[".int(",")"]):n+=ut(t,"format",({value:r})=>{if(r==="int64")return[".int(",")"]}),n+=ut(t,"multipleOf",({value:r,json:o})=>r===1?n.startsWith("z.number().int(")?void 0:[".int(",")"]:[`.multipleOf(${o}`,", ",")"]),typeof t.minimum=="number"?t.exclusiveMinimum===!0?n+=ut(t,"minimum",({json:r})=>[`.gt(${r}`,", ",")"]):n+=ut(t,"minimum",({json:r})=>[`.gte(${r}`,", ",")"]):typeof t.exclusiveMinimum=="number"&&(n+=ut(t,"exclusiveMinimum",({json:r})=>[`.gt(${r}`,", ",")"])),typeof t.maximum=="number"?t.exclusiveMaximum===!0?n+=ut(t,"maximum",({json:r})=>[`.lt(${r}`,", ",")"]):n+=ut(t,"maximum",({json:r})=>[`.lte(${r}`,", ",")"]):typeof t.exclusiveMaximum=="number"&&(n+=ut(t,"exclusiveMaximum",({json:r})=>[`.lt(${r}`,", ",")"])),n},"parseNumber"),la=f((t,e)=>t.oneOf.length?t.oneOf.length===1?it(t.oneOf[0],N(v({},e),{path:[...e.path,"oneOf",0]})):`z.any().superRefine((x, ctx) => {
25
+ (${x}) => ${B}`;case R.ZodFirstPartyTypeKind.ZodLazy:return Ie(a.getter(),s);case R.ZodFirstPartyTypeKind.ZodLiteral:let S=eg(a.value);return`${rt(i.description)}
26
+ ${S}`.trim();case R.ZodFirstPartyTypeKind.ZodEnum:return a.values.map(ae).join(" | ");case R.ZodFirstPartyTypeKind.ZodEffects:return Ie(a.schema,s);case R.ZodFirstPartyTypeKind.ZodNativeEnum:throw new Ed(R.ZodFirstPartyTypeKind.ZodNativeEnum);case R.ZodFirstPartyTypeKind.ZodOptional:return`${Ie(a.innerType,s)} | undefined`;case R.ZodFirstPartyTypeKind.ZodNullable:return`${Ie(a.innerType,s)} | null`;case R.ZodFirstPartyTypeKind.ZodDefault:let H=e.treatDefaultAsOptional?a.innerType.optional():a.innerType;return Ie(H,s);case R.ZodFirstPartyTypeKind.ZodCatch:return Ie(a.innerType,s);case R.ZodFirstPartyTypeKind.ZodPromise:return`Promise<${Ie(a.type,s)}>`;case R.ZodFirstPartyTypeKind.ZodBranded:return Ie(a.type,s);case R.ZodFirstPartyTypeKind.ZodPipeline:return Ie(a.in,s);case R.ZodFirstPartyTypeKind.ZodSymbol:return`${rt(i.description)} symbol`.trim();case R.ZodFirstPartyTypeKind.ZodReadonly:return`Readonly<${Ie(a.innerType,s)}>`;case R.ZodFirstPartyTypeKind.ZodRef:return ng(a.uri);default:be.assertNever(a)}}p(Ie,"sUnwrapZod");var UP=p((t,e)=>{if(t.props.type==="none")return Ie(t.props.schema,e);let{schema:n,identifier:r}=t.props,o=rt(n.description),s=n.describe(""),i=Ie(s,N(v({},e),{declaration:!0})),l=i.split(`
27
+ `).length>=NP&&e.includeClosingTags?`// end of ${r}`:"";if(t.props.type!=="type"&&n instanceof R.ZodFunction)return ys(`${o}
28
+ declare function ${r}${i};${l}`);if(t.props.type==="variable")return ys(`${o}declare const ${r}: ${i};${l}`);let c=t.props.args.length>0?`<${t.props.args.map(ng).join(", ")}>`:"";return ys(`${o}type ${t.props.identifier}${c} = ${i};${l}`)},"unwrapDeclaration"),jP=p(t=>t.declaration?t.declaration===!0?"variable":t.declaration:"none","getDeclarationType"),$P=p((t,e)=>{let n=jP(e),r=t.getReferences();if(n==="none"){if(r.length>0)throw new Ts;return new Zr({type:"none",schema:t})}let o="title"in t.ui?t.ui.title:null;if(!o)throw new Id;if(n==="variable"){if(r.length>0)throw new Ts;return new Zr({type:"variable",identifier:o,schema:t})}return new Zr({type:"type",identifier:o,schema:t,args:r})},"getDeclarationProps"),ug=class{constructor(e,n,r,o){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};p(ug,"ParseInputLazyPath");var Mt=ug,id=p((t,e)=>{if(qr(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new Yt(t.common.issues);return this._error=n,this._error}}},"handleResult"),cg=class{constructor(e){this.__type__="ZuiType",this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._metadataRoot._def.description}dereference(e){return this}getReferences(){return[]}clone(){let e=this.constructor;return new e(v({},this._def))}_getType(e){return pn(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:pn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new _t,ctx:{common:e.parent.common,data:e.data,parsedType:pn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(Mi(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){var r;let o={common:{issues:[],async:(r=n?.async)!=null?r:!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:pn(e)},s=this._parseSync({data:e,path:o.path,parent:o});return id(o,s)}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:pn(e)},o=this._parse({data:e,path:r.path,parent:r}),s=await(Mi(o)?o:Promise.resolve(o));return id(r,s)}refine(e,n){let r=p(o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n,"getIssueProperties");return this._refinement((o,s)=>{let i=e(o),a=p(()=>s.addIssue(v({code:J.custom},r(o))),"setError");return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,n){return this._refinement((r,o)=>e(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(e){return new Rn({schema:this,typeName:"ZodEffects",effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return gn.create(this,this._def)}nullable(){return ir.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Vr.create(this,this._def)}promise(){return Eo.create(this,this._def)}mandatory(){return this}or(e){return aa.create([this,e],this._def)}and(e){return ea.create(this,e,this._def)}transform(e){return new Rn(N(v({},me(this._def)),{schema:this,typeName:"ZodEffects",effect:{type:"transform",transform:e}}))}default(e){let n=typeof e=="function"?e:()=>e;return new xo(N(v({},me(this._def)),{innerType:this,defaultValue:n,typeName:"ZodDefault"}))}brand(){return new Js(v({typeName:"ZodBranded",type:this},me(this._def)))}catch(e){let n=typeof e=="function"?e:()=>e;return new Ys(N(v({},me(this._def)),{innerType:this,catchValue:n,typeName:"ZodCatch"}))}describe(e){let n=this.clone();return n._metadataRoot._def.description=e,n}pipe(e){return sa.create(this,e)}readonly(){return So.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}metadata(e){var n,r,o;let s=this.clone(),i=s._metadataRoot;(o=(n=i._def)[r=le])!=null||(n[r]={});for(let[a,l]of Object.entries(e))i._def[le]=N(v({},i._def[le]),{[a]:l});return s}getMetadata(){return v({},this._metadataRoot._def[le])}setMetadata(e){this._metadataRoot._def[le]=v({},e)}get ui(){return v({},this._metadataRoot._def[le])}get _metadataRoot(){return this.naked()}displayAs(e){return this.metadata({displayAs:[e.id,e.params]})}title(e){return this.metadata({title:e})}hidden(e){let n;return e===void 0?n=!0:typeof e=="function"?n=e.toString():n=e,this.metadata({hidden:n})}disabled(e){let n;return e===void 0?n=!0:typeof e=="function"?n=e.toString():n=e,this.metadata({disabled:n})}placeholder(e){return this.metadata({placeholder:e})}toJSONSchema(){return at(this)}toTypescriptType(e){return zs(this,e)}toTypescriptSchema(){return Ws(this)}naked(){return this}};p(cg,"ZodType");var he=cg,dg=(t=>(t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodRef="ZodRef",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly",t))(dg||{}),be;(t=>{t.assertEqual=p(o=>o,"assertEqual");function e(o){}t.assertIs=e,p(e,"assertIs");function n(o){throw new Error("assertNever called")}t.assertNever=n,p(n,"assertNever"),t.arrayToEnum=p(o=>{let s={};for(let i of o)s[i]=i;return s},"arrayToEnum"),t.getValidEnumValues=p(o=>{let s=(0,t.objectKeys)(o).filter(a=>typeof o[o[a]]!="number"),i={};for(let a of s)i[a]=o[a];return(0,t.objectValues)(i)},"getValidEnumValues"),t.objectValues=p(o=>(0,t.objectKeys)(o).map(function(s){return o[s]}),"objectValues"),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let s=[];for(let i in o)Object.prototype.hasOwnProperty.call(o,i)&&s.push(i);return s},t.find=p((o,s)=>{for(let i of o)if(s(i))return i},"find"),t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function r(o,s=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}t.joinValues=r,p(r,"joinValues"),t.jsonStringifyReplacer=p((o,s)=>typeof s=="bigint"?s.toString():s,"jsonStringifyReplacer"),t.compareFunctions=p((o,s)=>o.toString()===s.toString(),"compareFunctions"),t.mock=p(()=>({}),"mock")})(be||(be={}));var Es;(t=>{t.mergeShapes=p((e,n)=>v(v({},e),n),"mergeShapes")})(Es||(Es={}));var ne=be.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),pn=p(t=>{switch(typeof t){case"undefined":return ne.undefined;case"string":return ne.string;case"number":return isNaN(t)?ne.nan:ne.number;case"boolean":return ne.boolean;case"function":return ne.function;case"bigint":return ne.bigint;case"symbol":return ne.symbol;case"object":return Array.isArray(t)?ne.array:t===null?ne.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ne.promise:typeof Map<"u"&&t instanceof Map?ne.map:typeof Set<"u"&&t instanceof Set?ne.set:typeof Date<"u"&&t instanceof Date?ne.date:ne.object;default:return ne.unknown}},"getParsedType");function me(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:o,supportsExtensions:s,[le]:i}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);let a=i?Object.fromEntries(Object.entries(i).filter(([c])=>c!=="secret"||s?.includes("secret"))):void 0;return e?{errorMap:e,description:o,[le]:a}:{errorMap:p((c,f)=>c.code!=="invalid_type"?{message:f.defaultError}:typeof f.data>"u"?{message:r??f.defaultError}:{message:n??f.defaultError},"customMap"),description:o,[le]:a}}p(me,"processCreateParams");var qs=p((t,e)=>{let n;switch(t.code){case J.invalid_type:t.received===ne.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case J.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,be.jsonStringifyReplacer)}`;break;case J.unrecognized_keys:n=`Unrecognized key(s) in object: ${be.joinValues(t.keys,", ")}`;break;case J.invalid_union:n="Invalid input";break;case J.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${be.joinValues(t.options)}`;break;case J.invalid_enum_value:n=`Invalid enum value. Expected ${be.joinValues(t.options)}, received '${t.received}'`;break;case J.invalid_arguments:n="Invalid function arguments";break;case J.invalid_return_type:n="Invalid function return type";break;case J.invalid_date:n="Invalid date";break;case J.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:be.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case J.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case J.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case J.custom:n="Invalid input";break;case J.invalid_intersection_types:n="Intersection results could not be merged";break;case J.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case J.not_finite:n="Number must be finite";break;case J.unresolved_reference:n="Unresolved reference";break;default:n=e.defaultError,be.assertNever(t)}return{message:n}},"errorMap"),od=qs,J=be.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","unresolved_reference"]),ZP=p(t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),Oi=class fg extends Error{constructor(e){super(),this.issues=[],this.addIssue=p(r=>{this.issues=[...this.issues,r]},"addIssue"),this.addIssues=p((r=[])=>{this.issues=[...this.issues,...r]},"addIssues");let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let n=e||function(s){return s.message},r={_errors:[]},o=p(s=>{for(let i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let a=r,l=0;for(;l<i.path.length;){let c=i.path[l];l===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(i))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}},"processError");return o(this),r}static assert(e){if(!(e instanceof fg))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,be.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n={},r=[];for(let o of this.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(e(o))):r.push(e(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};p(Oi,"ZodError");Oi.create=p(t=>new Oi(t),"create");var Yt=Oi,pg=qs;function gg(t){pg=t}p(gg,"setErrorMap");function zr(){return pg}p(zr,"getErrorMap");var Ri=p(t=>{var e;let{data:n,path:r,errorMaps:o,issueData:s}=t,i=[...r,...s.path||[]],a=N(v({},s),{path:i}),l="",c=o.filter(f=>!!f).slice().reverse();for(let f of c)l=f(a,{data:n,defaultError:l}).message;return N(v({},s),{path:i,message:(e=s.message)!=null?e:l})},"makeIssue"),KP=[];function te(t,e){let n=Ri({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,zr(),qs].filter(r=>!!r)});t.common.issues.push(n)}p(te,"addIssueToContext");var yg=class mg{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let o of n){if(o.status==="aborted")return pe;o.status==="dirty"&&e.dirty(),r.push(o.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let o of n)r.push({key:await o.key,value:await o.value});return mg.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let o of n){let{key:s,value:i}=o;if(s.status==="aborted"||i.status==="aborted")return pe;s.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(r[s.value]=i.value)}return{status:e.value,value:r}}};p(yg,"ParseStatus");var _t=yg,pe=Object.freeze({status:"aborted"}),er=p(t=>({status:"dirty",value:t}),"DIRTY"),gt=p(t=>({status:"valid",value:t}),"OK"),Ss=p(t=>t.status==="aborted","isAborted"),Is=p(t=>t.status==="dirty","isDirty"),qr=p(t=>t.status==="valid","isValid"),Mi=p(t=>typeof Promise<"u"&&t instanceof Promise,"isAsync"),ue;(t=>{t.errToObj=p(e=>typeof e=="string"?{message:e}:e||{},"errToObj"),t.toString=p(e=>typeof e=="string"?e:e?.message,"toString")})(ue||(ue={}));var Ni=class hg extends he{constructor(){super(...arguments),this._any=!0}_parse(e){return gt(e.data)}isEqual(e){return e instanceof hg}};p(Ni,"ZodAny");Ni.create=p(t=>new Ni(v({typeName:"ZodAny"},me(t))),"create");var Gr=Ni,Di=class In extends he{dereference(e){return new In(N(v({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new In(N(v({},this._def),{type:this._def.type.clone()}))}isEqual(e){var n,r,o,s,i,a;return e instanceof In?tr((n=this._def.exactLength)==null?void 0:n.value,(r=e._def.exactLength)==null?void 0:r.value)&&tr((o=this._def.maxLength)==null?void 0:o.value,(s=e._def.maxLength)==null?void 0:s.value)&&tr((i=this._def.minLength)==null?void 0:i.value,(a=e._def.minLength)==null?void 0:a.value)&&this._def.type.isEqual(e._def.type):!1}_parse(e){let{ctx:n,status:r}=this._processInputParams(e),o=this._def;if(n.parsedType!==ne.array)return te(n,{code:J.invalid_type,expected:ne.array,received:n.parsedType}),pe;if(o.exactLength!==null){let i=n.data.length>o.exactLength.value,a=n.data.length<o.exactLength.value;(i||a)&&(te(n,{code:i?J.too_big:J.too_small,minimum:a?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(te(n,{code:J.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(te(n,{code:J.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,a)=>o.type._parseAsync(new Mt(n,i,n.path,a)))).then(i=>_t.mergeArray(r,i));let s=[...n.data].map((i,a)=>o.type._parseSync(new Mt(n,i,n.path,a)));return _t.mergeArray(r,s)}get element(){return this._def.type}min(e,n){return new In(N(v({},this._def),{minLength:{value:e,message:ue.toString(n)}}))}max(e,n){return new In(N(v({},this._def),{maxLength:{value:e,message:ue.toString(n)}}))}length(e,n){return new In(N(v({},this._def),{exactLength:{value:e,message:ue.toString(n)}}))}nonempty(e){return this.min(1,e)}};p(Di,"ZodArray");Di.create=p((t,e)=>new Di(v({type:t,minLength:null,maxLength:null,exactLength:null,typeName:"ZodArray"},me(e))),"create");var Vr=Di,LP=p((t,e)=>Tg(t,e,new WeakSet),"isEqual"),Tg=p((t,e,n)=>cP(t,e,FP(n)),"_isEqualWithVisitedTracking"),FP=p(t=>(e,n)=>{if(Hc(e)&&!t.has(e)&&Hc(n)&&!t.has(n)){let r=Xc(e,Yc),o=Xc(n,Yc);return t.add(r).add(o).add(e).add(n),Tg(r,o,t)}},"_customizerWithVisitedTracking"),WP={compare:LP},vg=class{constructor(e=[],n={}){this._options=v(v({},WP),n),this._items=[];for(let r of e)this.add(r)}get items(){return[...this._items]}get size(){return this._items.length}has(e){return this._items.some(n=>this._options.compare(n,e))}add(e){this.has(e)||this._items.push(e)}isEqual(e){return this.size!==e.size?!1:this.isSubsetOf(e)&&e.isSubsetOf(this)}isSubsetOf(e){return this.size>e.size?!1:this._items.every(n=>e.has(n))}};p(vg,"CustomSet");var tt=vg,Hi=class xi extends he{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==ne.bigint){let s=this._getOrReturnCtx(e);return te(s,{code:J.invalid_type,expected:ne.bigint,received:s.parsedType}),pe}let r,o=new _t;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:J.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:J.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),te(r,{code:J.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):be.assertNever(s);return{status:o.value,value:e.data}}isEqual(e){if(!(e instanceof xi)||this._def.coerce!==e._def.coerce)return!1;let n=new tt(this._def.checks),r=new tt(e._def.checks);return n.isEqual(r)}gte(e,n){return this.setLimit("min",e,!0,ue.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ue.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ue.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ue.toString(n))}setLimit(e,n,r,o){return new xi(N(v({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ue.toString(o)}]}))}_addCheck(e){return new xi(N(v({},this._def),{checks:[...this._def.checks,e]}))}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ue.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ue.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ue.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ue.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ue.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};p(Hi,"ZodBigInt");Hi.create=p(t=>{var e;return new Hi(v({checks:[],typeName:"ZodBigInt",coerce:(e=t?.coerce)!=null?e:!1},me(t)))},"create");var Gs=Hi,Ui=class _g extends he{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ne.boolean){let r=this._getOrReturnCtx(e);return te(r,{code:J.invalid_type,expected:ne.boolean,received:r.parsedType}),pe}return gt(e.data)}isEqual(e){return e instanceof _g?this._def.coerce===e._def.coerce:!1}};p(Ui,"ZodBoolean");Ui.create=p(t=>new Ui(v({typeName:"ZodBoolean",coerce:t?.coerce||!1},me(t))),"create");var Vs=Ui,zP=Symbol("zod_brand"),bg=class Sr extends he{dereference(e){return new Sr(N(v({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new Sr(N(v({},this._def),{type:this._def.type.clone()}))}_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}isEqual(e){return e instanceof Sr?this._def.type.isEqual(e._def.type):!1}naked(){return this._def.type.naked()}mandatory(){return new Sr(N(v({},this._def),{type:this._def.type.mandatory()}))}};p(bg,"ZodBranded");var Js=bg,ji=class Ir extends he{_parse(e){let{ctx:n}=this._processInputParams(e),r=N(v({},n),{common:N(v({},n.common),{issues:[]})}),o=this._def.innerType._parse({data:r.data,path:r.path,parent:v({},r)});return Mi(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Yt(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Yt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}isEqual(e){return e instanceof Ir?this._def.innerType.isEqual(e._def.innerType)&&be.compareFunctions(this._def.catchValue,e._def.catchValue):!1}dereference(e){return new Ir(N(v({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Ir(N(v({},this._def),{innerType:this._def.innerType.clone()}))}naked(){return this._def.innerType.naked()}mandatory(){return new Ir(N(v({},this._def),{innerType:this._def.innerType.mandatory()}))}};p(ji,"ZodCatch");ji.create=p((t,e)=>new ji(v({innerType:t,typeName:"ZodCatch",catchValue:typeof e.catch=="function"?e.catch:()=>e.catch},me(e))),"create");var Ys=ji,wg=p((t,e={},n)=>t?Gr.create().superRefine((r,o)=>{var s,i;if(!t(r)){let a=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e,l=(i=(s=a.fatal)!=null?s:n)!=null?i:!0,c=typeof a=="string"?{message:a}:a;o.addIssue(N(v({code:"custom"},c),{fatal:l}))}}):Gr.create(),"custom"),$i=class ks extends he{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ne.date){let s=this._getOrReturnCtx(e);return te(s,{code:J.invalid_type,expected:ne.date,received:s.parsedType}),pe}if(isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return te(s,{code:J.invalid_date}),pe}let r=new _t,o;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(o=this._getOrReturnCtx(e,o),te(o,{code:J.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(o=this._getOrReturnCtx(e,o),te(o,{code:J.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):be.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ks(N(v({},this._def),{checks:[...this._def.checks,e]}))}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:ue.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:ue.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}isEqual(e){if(!(e instanceof ks))return!1;let n=new tt(this._def.checks),r=new tt(e._def.checks);return n.isEqual(r)&&this._def.coerce===e._def.coerce}};p($i,"ZodDate");$i.create=p(t=>new $i(v({checks:[],coerce:t?.coerce||!1,typeName:"ZodDate"},me(t))),"create");var Xs=$i,Zi=class kr extends he{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===ne.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}dereference(e){return new kr(N(v({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new kr(N(v({},this._def),{innerType:this._def.innerType.clone()}))}isEqual(e){return e instanceof kr?this._def.innerType.isEqual(e._def.innerType)&&tr(this._def.defaultValue(),e._def.defaultValue()):!1}unwrap(){return this._def.innerType}naked(){return this._def.innerType.naked()}mandatory(){return new kr(N(v({},this._def),{innerType:this._def.innerType.mandatory()}))}};p(Zi,"ZodDefault");Zi.create=p((t,e,n)=>new Zi(v({innerType:t,typeName:"ZodDefault",defaultValue:typeof e=="function"?e:()=>e},me(n))),"create");var xo=Zi,en=p(t=>Array.from(new Set(t)),"unique"),Jt=p(t=>t instanceof ta?Jt(t.schema):t instanceof Rn?Jt(t.innerType()):t instanceof na?[t.value]:t instanceof ur?t.options:t instanceof ra?be.objectValues(t.enum):t instanceof xo?Jt(t._def.innerType):t instanceof Io?[void 0]:t instanceof ia?[null]:t instanceof gn?[void 0,...Jt(t.unwrap())]:t instanceof ir?[null,...Jt(t.unwrap())]:t instanceof Js||t instanceof So?Jt(t.unwrap()):t instanceof Ys?Jt(t._def.innerType):[],"getDiscriminator"),Pg=class kn extends he{dereference(e){let n=this.options.map(o=>o.dereference(e)),r=kn._getOptionsMap(this.discriminator,n);return new kn(N(v({},this._def),{options:n,optionsMap:r}))}getReferences(){return en(this.options.flatMap(e=>e.getReferences()))}clone(){let e=this.options.map(n=>n.clone());return new kn(N(v({},this._def),{options:e}))}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==ne.object)return te(n,{code:J.invalid_type,expected:ne.object,received:n.parsedType}),pe;let r=this.discriminator,o=n.data[r],s=this.optionsMap.get(o);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(te(n,{code:J.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),pe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let o=kn._getOptionsMap(e,n);return new kn(v({typeName:"ZodDiscriminatedUnion",discriminator:e,options:n,optionsMap:o},me(r)))}static _getOptionsMap(e,n){let r=new Map;for(let o of n){let s=Jt(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of s){if(r.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);r.set(i,o)}}return r}isEqual(e){if(!(e instanceof kn)||this._def.discriminator!==e._def.discriminator)return!1;let n=p((s,i)=>s.isEqual(i),"compare"),r=new tt(this._def.options,{compare:n}),o=new tt(e._def.options,{compare:n});return r.isEqual(o)}};p(Pg,"ZodDiscriminatedUnion");var xg=Pg;function Bo(t,e){return new ur(v({values:t,typeName:"ZodEnum"},me(e)))}p(Bo,"createZodEnum");var Qs=class Bi extends he{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return te(n,{expected:be.joinValues(r),received:n.parsedType,code:J.invalid_type}),pe}if(this._def.values.indexOf(e.data)===-1){let n=this._getOrReturnCtx(e),r=this._def.values;return te(n,{received:n.data,code:J.invalid_enum_value,options:r}),pe}return gt(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return Bi.create(e,v(v({},this._def),n))}exclude(e,n=this._def){return Bi.create(this.options.filter(r=>!e.includes(r)),v(v({},this._def),n))}isEqual(e){if(!(e instanceof Bi))return!1;let n=new tt(this._def.values),r=new tt(e._def.values);return n.isEqual(r)}};p(Qs,"ZodEnum");Qs.create=Bo;var ur=Qs,Bg=class An extends he{constructor(){super(...arguments),this.validate=this.implement}dereference(e){let n=this._def.args.dereference(e),r=this._def.returns.dereference(e);return new An(N(v({},this._def),{args:n,returns:r}))}getReferences(){return en([...this._def.args.getReferences(),...this._def.returns.getReferences()])}clone(){return new An(N(v({},this._def),{args:this._def.args.clone(),returns:this._def.returns.clone()}))}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==ne.function)return te(n,{code:J.invalid_type,expected:ne.function,received:n.parsedType}),pe;function r(a,l){return Ri({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,zr(),od].filter(c=>!!c),issueData:{code:J.invalid_arguments,argumentsError:l}})}p(r,"makeArgsIssue");function o(a,l){return Ri({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,zr(),od].filter(c=>!!c),issueData:{code:J.invalid_return_type,returnTypeError:l}})}p(o,"makeReturnsIssue");let s={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof Eo){let a=this;return gt(async function(...l){let c=new Yt([]),f=await a._def.args.parseAsync(l,s).catch(h=>{throw c.addIssue(r(l,h)),c}),y=await Reflect.apply(i,this,f);return await a._def.returns._def.type.parseAsync(y,s).catch(h=>{throw c.addIssue(o(y,h)),c})})}else{let a=this;return gt(function(...l){let c=a._def.args.safeParse(l,s);if(!c.success)throw new Yt([r(l,c.error)]);let f=Reflect.apply(i,this,c.data),y=a._def.returns.safeParse(f,s);if(!y.success)throw new Yt([o(f,y.error)]);return y.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new An(N(v({},this._def),{args:ar.create(e).rest(Kr.create())}))}returns(e){return new An(N(v({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new An(v({args:e||ar.create([]).rest(Kr.create()),returns:n||Kr.create(),typeName:"ZodFunction"},me(r)))}isEqual(e){return e instanceof An&&this._def.args.isEqual(e._def.args)&&this._def.returns.isEqual(e._def.returns)}};p(Bg,"ZodFunction");var Eg=Bg;function Ki(t,e){let n=pn(t),r=pn(e);if(t===e)return{valid:!0,data:t};if(n===ne.object&&r===ne.object){let o=be.objectKeys(e),s=be.objectKeys(t).filter(a=>o.indexOf(a)!==-1),i=v(v({},t),e);for(let a of s){let l=Ki(t[a],e[a]);if(!l.valid)return{valid:!1};i[a]=l.data}return{valid:!0,data:i}}else if(n===ne.array&&r===ne.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let s=0;s<t.length;s++){let i=t[s],a=e[s],l=Ki(i,a);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return n===ne.date&&r===ne.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}p(Ki,"mergeValues");var Li=class Ei extends he{dereference(e){return new Ei(N(v({},this._def),{left:this._def.left.dereference(e),right:this._def.right.dereference(e)}))}getReferences(){return en([...this._def.left.getReferences(),...this._def.right.getReferences()])}clone(){return new Ei(N(v({},this._def),{left:this._def.left.clone(),right:this._def.right.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),o=p((s,i)=>{if(Ss(s)||Ss(i))return pe;let a=Ki(s.value,i.value);return a.valid?((Is(s)||Is(i))&&n.dirty(),{status:n.value,value:a.data}):(te(r,{code:J.invalid_intersection_types}),pe)},"handleParsed");return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,i])=>o(s,i)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}isEqual(e){if(!(e instanceof Ei))return!1;let n=p((s,i)=>s.isEqual(i),"compare"),r=new tt([this._def.left,this._def.right],{compare:n}),o=new tt([e._def.left,e._def.right],{compare:n});return r.isEqual(o)}};p(Li,"ZodIntersection");Li.create=p((t,e,n)=>new Li(v({left:t,right:e,typeName:"ZodIntersection"},me(n))),"create");var ea=Li,Fi=class Ar extends he{get schema(){return this._def.getter()}dereference(e){return new Ar(N(v({},this._def),{getter:()=>this._def.getter().dereference(e)}))}getReferences(){return this._def.getter().getReferences()}clone(){return new Ar(N(v({},this._def),{getter:()=>this._def.getter().clone()}))}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}isEqual(e){return e instanceof Ar?this._def.getter().isEqual(e._def.getter()):!1}naked(){return this._def.getter().naked()}mandatory(){return new Ar(N(v({},this._def),{getter:()=>this._def.getter().mandatory()}))}};p(Fi,"ZodLazy");Fi.create=p((t,e)=>new Fi(v({getter:t,typeName:"ZodLazy"},me(e))),"create");var ta=Fi,Wi=class Sg extends he{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return te(n,{received:n.data,code:J.invalid_literal,expected:this._def.value}),pe}return{status:"valid",value:e.data}}get value(){return this._def.value}isEqual(e){return e instanceof Sg?tr(this._def.value,e._def.value):!1}};p(Wi,"ZodLiteral");Wi.create=p((t,e)=>new Wi(v({value:t,typeName:"ZodLiteral"},me(e))),"create");var na=Wi,zi=class Si extends he{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}dereference(e){let n=this._def.keyType.dereference(e),r=this._def.valueType.dereference(e);return new Si(N(v({},this._def),{keyType:n,valueType:r}))}getReferences(){return en([...this._def.keyType.getReferences(),...this._def.valueType.getReferences()])}clone(){return new Si(N(v({},this._def),{keyType:this._def.keyType.clone(),valueType:this._def.valueType.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ne.map)return te(r,{code:J.invalid_type,expected:ne.map,received:r.parsedType}),pe;let o=this._def.keyType,s=this._def.valueType,i=[...r.data.entries()].map(([a,l],c)=>({key:o._parse(new Mt(r,a,r.path,[c,"key"])),value:s._parse(new Mt(r,l,r.path,[c,"value"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let l of i){let c=await l.key,f=await l.value;if(c.status==="aborted"||f.status==="aborted")return pe;(c.status==="dirty"||f.status==="dirty")&&n.dirty(),a.set(c.value,f.value)}return{status:n.value,value:a}})}else{let a=new Map;for(let l of i){let c=l.key,f=l.value;if(c.status==="aborted"||f.status==="aborted")return pe;(c.status==="dirty"||f.status==="dirty")&&n.dirty(),a.set(c.value,f.value)}return{status:n.value,value:a}}}isEqual(e){return!(!(e instanceof Si)||!this._def.keyType.isEqual(e._def.keyType)||!this._def.valueType.isEqual(e._def.valueType))}};p(zi,"ZodMap");zi.create=p((t,e,n)=>new zi(v({valueType:e,keyType:t,typeName:"ZodMap"},me(n))),"create");var Ig=zi,qi=class kg extends he{_parse(e){if(this._getType(e)!==ne.nan){let r=this._getOrReturnCtx(e);return te(r,{code:J.invalid_type,expected:ne.nan,received:r.parsedType}),pe}return{status:"valid",value:e.data}}isEqual(e){return e instanceof kg}};p(qi,"ZodNaN");qi.create=p(t=>new qi(v({typeName:"ZodNaN"},me(t))),"create");var Ag=qi,Gi=class Cg extends he{_parse(e){let n=be.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==ne.string&&r.parsedType!==ne.number){let o=be.objectValues(n);return te(r,{expected:be.joinValues(o),received:r.parsedType,code:J.invalid_type}),pe}if(n.indexOf(e.data)===-1){let o=be.objectValues(n);return te(r,{received:r.data,code:J.invalid_enum_value,options:o}),pe}return gt(e.data)}get enum(){return this._def.values}isEqual(e){return e instanceof Cg?tr(this._def.values,e._def.values):!1}};p(Gi,"ZodNativeEnum");Gi.create=p((t,e)=>new Gi(v({values:t,typeName:"ZodNativeEnum"},me(e))),"create");var ra=Gi,Vi=class Og extends he{_parse(e){let n=this._getOrReturnCtx(e);return te(n,{code:J.invalid_type,expected:ne.never,received:n.parsedType}),pe}isEqual(e){return e instanceof Og}};p(Vi,"ZodNever");Vi.create=p(t=>new Vi(v({typeName:"ZodNever"},me(t))),"create");var Xr=Vi,Ji=class Rg extends he{_parse(e){if(this._getType(e)!==ne.null){let r=this._getOrReturnCtx(e);return te(r,{code:J.invalid_type,expected:ne.null,received:r.parsedType}),pe}return gt(e.data)}isEqual(e){return e instanceof Rg}};p(Ji,"ZodNull");Ji.create=p(t=>new Ji(v({typeName:"ZodNull"},me(t))),"create");var ia=Ji,Yi=class Cr extends he{dereference(e){return new Cr(N(v({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Cr(N(v({},this._def),{innerType:this._def.innerType.clone()}))}_parse(e){return this._getType(e)===ne.null?gt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}isEqual(e){return e instanceof Cr?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return new Cr(N(v({},this._def),{innerType:this._def.innerType.mandatory()}))}};p(Yi,"ZodNullable");Yi.create=p((t,e)=>new Yi(v({innerType:t,typeName:"ZodNullable"},me(e))),"create");var ir=Yi;function Mg(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,o=n>r?n:r,s=parseInt(t.toFixed(o).replace(".","")),i=parseInt(e.toFixed(o).replace(".",""));return s%i/Math.pow(10,o)}p(Mg,"floatSafeRemainder");var Xi=class Ii extends he{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ne.number){let s=this._getOrReturnCtx(e);return te(s,{code:J.invalid_type,expected:ne.number,received:s.parsedType}),pe}let r,o=new _t;for(let s of this._def.checks)s.kind==="int"?be.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),te(r,{code:J.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:J.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:J.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?Mg(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),te(r,{code:J.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),te(r,{code:J.not_finite,message:s.message}),o.dirty()):be.assertNever(s);return{status:o.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,ue.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ue.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ue.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ue.toString(n))}setLimit(e,n,r,o){return new Ii(N(v({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ue.toString(o)}]}))}_addCheck(e){return new Ii(N(v({},this._def),{checks:[...this._def.checks,e]}))}int(e){return this._addCheck({kind:"int",message:ue.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ue.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ue.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ue.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ue.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ue.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:ue.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ue.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ue.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&be.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}isEqual(e){if(!(e instanceof Ii))return!1;let n=new tt(this._def.checks),r=new tt(e._def.checks);return n.isEqual(r)}};p(Xi,"ZodNumber");Xi.create=p(t=>new Xi(v({checks:[],typeName:"ZodNumber",coerce:t?.coerce||!1},me(t))),"create");var oa=Xi;function Cn(t){if(t instanceof or){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=gn.create(Cn(r))}return new or(N(v({},t._def),{shape:()=>e}))}else return t instanceof Vr?new Vr(N(v({},t._def),{type:Cn(t.element)})):t instanceof gn?gn.create(Cn(t.unwrap())):t instanceof ir?ir.create(Cn(t.unwrap())):t instanceof ar?ar.create(t.items.map(e=>Cn(e))):t}p(Cn,"deepPartialify");var mn=class vt extends he{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=be.objectKeys(e);return this._cached={shape:e,keys:n}}dereference(e){let n=this._def.shape(),r={};for(let o in n)r[o]=n[o].dereference(e);return new vt(N(v({},this._def),{shape:()=>r}))}getReferences(){let e=this._def.shape(),n=[];for(let r in e)n.push(...e[r].getReferences());return en(n)}clone(){let e={},n=this._def.shape();for(let[r,o]of Object.entries(n))e[r]=o.clone();return new vt(N(v({},this._def),{shape:()=>e}))}_parse(e){if(this._getType(e)!==ne.object){let f=this._getOrReturnCtx(e);return te(f,{code:J.invalid_type,expected:ne.object,received:f.parsedType}),pe}let{status:r,ctx:o}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),a=[];if(this._def.unknownKeys!=="strip")for(let f in o.data)i.includes(f)||a.push(f);let l=[];for(let f of i){let y=s[f],g=o.data[f];l.push({key:{status:"valid",value:f},value:y._parse(new Mt(o,g,o.path,f)),alwaysSet:f in o.data})}let c=this._def.unknownKeys;if(c==="passthrough")for(let f of a)l.push({key:{status:"valid",value:f},value:{status:"valid",value:o.data[f]}});else if(c==="strict")a.length>0&&(te(o,{code:J.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")for(let f of a){let y=o.data[f];l.push({key:{status:"valid",value:f},value:c._parse(new Mt(o,y,o.path,f)),alwaysSet:f in o.data})}return o.common.async?Promise.resolve().then(async()=>{let f=[];for(let y of l){let g=await y.key;f.push({key:g,value:await y.value,alwaysSet:y.alwaysSet})}return f}).then(f=>_t.mergeObjectSync(r,f)):_t.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return ue.errToObj,new vt(v(N(v({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:(n,r)=>{var o,s,i,a;let l=(i=(s=(o=this._def).errorMap)==null?void 0:s.call(o,n,r).message)!=null?i:r.defaultError;return n.code==="unrecognized_keys"?{message:(a=ue.errToObj(e).message)!=null?a:l}:{message:l}}}:{}))}strip(){return new vt(N(v({},this._def),{unknownKeys:"strip"}))}passthrough(){return new vt(N(v({},this._def),{unknownKeys:"passthrough"}))}additionalProperties(){if(this._def.unknownKeys instanceof he)return this._def.unknownKeys;if(this._def.unknownKeys==="passthrough")return Gr.create();if(this._def.unknownKeys==="strict")return Xr.create()}extend(e){return new vt(N(v({},this._def),{shape:()=>v(v({},this._def.shape()),e)}))}merge(e){return new vt({unknownKeys:e._def.unknownKeys,shape:()=>v(v({},this._def.shape()),e._def.shape()),typeName:"ZodObject"})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new vt(N(v({},this._def),{unknownKeys:e}))}pick(e){let n={};return be.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new vt(N(v({},this._def),{shape:()=>n}))}omit(e){let n={};return be.objectKeys(this.shape).forEach(r=>{e[r]||(n[r]=this.shape[r])}),new vt(N(v({},this._def),{shape:()=>n}))}deepPartial(){return Cn(this)}partial(e){let n={};return be.objectKeys(this.shape).forEach(r=>{let o=this.shape[r];e&&!e[r]?n[r]=o:n[r]=o?.optional()}),new vt(N(v({},this._def),{shape:()=>n}))}required(e){let n={};return be.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof gn;)s=s._def.innerType;n[r]=s}}),new vt(N(v({},this._def),{shape:()=>n}))}keyof(){return Bo(be.objectKeys(this.shape))}isEqual(e){if(!(e instanceof vt)||!this._unknownKeysEqual(e))return!1;let n=this._def.shape(),r=e._def.shape(),o=p((a,l)=>a[0]===l[0]&&a[1].isEqual(l[1]),"compare"),s=new tt(Object.entries(n),{compare:o}),i=new tt(Object.entries(r),{compare:o});return s.isEqual(i)}_unknownKeysEqual(e){let n=this.additionalProperties(),r=e.additionalProperties();return n===void 0||r===void 0?n===r:n.isEqual(r)}};p(mn,"ZodObject");mn.create=p((t,e)=>new mn(v({shape:()=>t,unknownKeys:"strip",typeName:"ZodObject"},me(e))),"create");mn.strictCreate=p((t,e)=>new mn(v({shape:()=>t,unknownKeys:"strict",typeName:"ZodObject"},me(e))),"strictCreate");mn.lazycreate=p((t,e)=>new mn(v({shape:t,unknownKeys:"strip",typeName:"ZodObject"},me(e))),"lazycreate");var or=mn,Qi=class ki extends he{dereference(e){return new ki(N(v({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new ki(N(v({},this._def),{innerType:this._def.innerType.clone()}))}_parse(e){return this._getType(e)===ne.undefined?gt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}isEqual(e){return e instanceof ki?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return this._def.innerType.mandatory()}};p(Qi,"ZodOptional");Qi.create=p((t,e)=>new Qi(v({innerType:t,typeName:"ZodOptional"},me(e))),"create");var gn=Qi,Ng=class Or extends he{dereference(e){return new Or(N(v({},this._def),{in:this._def.in.dereference(e),out:this._def.out.dereference(e)}))}getReferences(){return en([...this._def.in.getReferences(),...this._def.out.getReferences()])}clone(){return new Or(N(v({},this._def),{in:this._def.in.clone(),out:this._def.out.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return p(async()=>{let s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?pe:s.status==="dirty"?(n.dirty(),er(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})},"handleAsync")();{let o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?pe:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(e,n){return new Or({in:e,out:n,typeName:"ZodPipeline"})}isEqual(e){return!(!(e instanceof Or)||!this._def.in.isEqual(e._def.in)||!this._def.out.isEqual(e._def.out))}};p(Ng,"ZodPipeline");var sa=Ng,eo=class Ai extends he{unwrap(){return this._def.type}dereference(e){return new Ai(N(v({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new Ai(N(v({},this._def),{type:this._def.type.clone()}))}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==ne.promise&&n.common.async===!1)return te(n,{code:J.invalid_type,expected:ne.promise,received:n.parsedType}),pe;let r=n.parsedType===ne.promise?n.data:Promise.resolve(n.data);return gt(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}isEqual(e){return e instanceof Ai?this._def.type.isEqual(e._def.type):!1}naked(){return this._def.type.naked()}};p(eo,"ZodPromise");eo.create=p((t,e)=>new eo(v({type:t,typeName:"ZodPromise"},me(e))),"create");var Eo=eo,to=class Rr extends he{dereference(e){return new Rr(N(v({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Rr(N(v({},this._def),{innerType:this._def.innerType.clone()}))}_parse(e){let n=this._def.innerType._parse(e);return qr(n)&&(n.value=Object.freeze(n.value)),n}unwrap(){return this._def.innerType}isEqual(e){return e instanceof Rr?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return new Rr(N(v({},this._def),{innerType:this._def.innerType.mandatory()}))}};p(to,"ZodReadonly");to.create=p((t,e)=>new to(v({innerType:t,typeName:"ZodReadonly"},me(e))),"create");var So=to,Dg=class Yn extends he{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}dereference(e){let n=this._def.keyType.dereference(e),r=this._def.valueType.dereference(e);return new Yn(N(v({},this._def),{keyType:n,valueType:r}))}getReferences(){return en([...this._def.keyType.getReferences(),...this._def.valueType.getReferences()])}clone(){return new Yn(N(v({},this._def),{keyType:this._def.keyType.clone(),valueType:this._def.valueType.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ne.object)return te(r,{code:J.invalid_type,expected:ne.object,received:r.parsedType}),pe;let o=[],s=this._def.keyType,i=this._def.valueType;for(let a in r.data)o.push({key:s._parse(new Mt(r,a,r.path,a)),value:i._parse(new Mt(r,r.data[a],r.path,a))});return r.common.async?_t.mergeObjectAsync(n,o):_t.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof he?new Yn(v({keyType:e,valueType:n,typeName:"ZodRecord"},me(r))):new Yn(v({keyType:yt.create(),valueType:e,typeName:"ZodRecord"},me(n)))}isEqual(e){return!(!(e instanceof Yn)||!this._def.keyType.isEqual(e._def.keyType)||!this._def.valueType.isEqual(e._def.valueType))}};p(Dg,"ZodRecord");var Hg=Dg,no=class Ug extends he{dereference(e){let n=e[this._def.uri];return n||this}getReferences(){return[this._def.uri]}_parse(e){let n=this._getOrReturnCtx(e);return te(n,{code:J.unresolved_reference}),pe}isOptional(){return!1}isNullable(){return!1}isEqual(e){return e instanceof Ug?this._def.uri===e._def.uri:!1}};p(no,"ZodRef");no.create=p(t=>new no({typeName:"ZodRef",uri:t}),"create");var jg=no,ro=class Xn extends he{dereference(e){return new Xn(N(v({},this._def),{valueType:this._def.valueType.dereference(e)}))}getReferences(){return this._def.valueType.getReferences()}clone(){return new Xn(N(v({},this._def),{valueType:this._def.valueType.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ne.set)return te(r,{code:J.invalid_type,expected:ne.set,received:r.parsedType}),pe;let o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(te(r,{code:J.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(te(r,{code:J.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());let s=this._def.valueType;function i(l){let c=new Set;for(let f of l){if(f.status==="aborted")return pe;f.status==="dirty"&&n.dirty(),c.add(f.value)}return{status:n.value,value:c}}p(i,"finalizeSet");let a=[...r.data.values()].map((l,c)=>s._parse(new Mt(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>i(l)):i(a)}min(e,n){return new Xn(N(v({},this._def),{minSize:{value:e,message:ue.toString(n)}}))}max(e,n){return new Xn(N(v({},this._def),{maxSize:{value:e,message:ue.toString(n)}}))}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}isEqual(e){var n,r,o,s;if(!(e instanceof Xn))return!1;let i=(n=this._def.minSize)==null?void 0:n.value,a=(r=e._def.minSize)==null?void 0:r.value;if(i!==a)return!1;let l=(o=this._def.maxSize)==null?void 0:o.value,c=(s=e._def.maxSize)==null?void 0:s.value;return l!==c?!1:this._def.valueType.isEqual(e._def.valueType)}};p(ro,"ZodSet");ro.create=p((t,e)=>new ro(v({valueType:t,minSize:null,maxSize:null,typeName:"ZodSet"},me(e))),"create");var $g=ro,Zg=/^c[^\s-]{8,}$/i,Kg=/^[a-z][a-z0-9]*$/,Lg=/^[0-9A-HJKMNP-TV-Z]{26}$/,Fg=/^[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,Wg=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,zg="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",qP=p(t=>t===zg,"isEmojiRegex"),ms,qg=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,Gg=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;function Vg(t,e){return!!((e==="v4"||!e)&&qg.test(t)||(e==="v6"||!e)&&Gg.test(t))}p(Vg,"isValidIP");var io=class Qn extends he{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ne.string){let s=this._getOrReturnCtx(e);return te(s,{code:J.invalid_type,expected:ne.string,received:s.parsedType}),pe}let r=new _t,o;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(o=this._getOrReturnCtx(e,o),te(o,{code:J.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(o=this._getOrReturnCtx(e,o),te(o,{code:J.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){let i=e.data.length>s.value,a=e.data.length<s.value;(i||a)&&(o=this._getOrReturnCtx(e,o),i?te(o,{code:J.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&te(o,{code:J.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")Wg.test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"email",code:J.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")ms||(ms=new RegExp(zg,"u")),ms.test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"emoji",code:J.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")Fg.test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"uuid",code:J.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")Zg.test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"cuid",code:J.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")Kg.test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"cuid2",code:J.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")Lg.test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"ulid",code:J.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),te(o,{validation:"url",code:J.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"regex",code:J.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(o=this._getOrReturnCtx(e,o),te(o,{code:J.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(o=this._getOrReturnCtx(e,o),te(o,{code:J.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(o=this._getOrReturnCtx(e,o),te(o,{code:J.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?Rd(s).test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{code:J.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="ip"?Vg(e.data,s.version)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"ip",code:J.invalid_string,message:s.message}),r.dirty()):be.assertNever(s);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(o=>e.test(o),v({validation:n,code:J.invalid_string},ue.errToObj(r)))}_addCheck(e){return new Qn(N(v({},this._def),{checks:[...this._def.checks,e]}))}email(e){return this._addCheck(v({kind:"email"},ue.errToObj(e)))}url(e){return this._addCheck(v({kind:"url"},ue.errToObj(e)))}emoji(e){return this._addCheck(v({kind:"emoji"},ue.errToObj(e)))}uuid(e){return this._addCheck(v({kind:"uuid"},ue.errToObj(e)))}cuid(e){return this._addCheck(v({kind:"cuid"},ue.errToObj(e)))}cuid2(e){return this._addCheck(v({kind:"cuid2"},ue.errToObj(e)))}ulid(e){return this._addCheck(v({kind:"ulid"},ue.errToObj(e)))}ip(e){return this._addCheck(v({kind:"ip"},ue.errToObj(e)))}datetime(e){var n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck(v({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(n=e?.offset)!=null?n:!1},ue.errToObj(e?.message)))}regex(e,n){return this._addCheck(v({kind:"regex",regex:e},ue.errToObj(n)))}includes(e,n){return this._addCheck(v({kind:"includes",value:e,position:n?.position},ue.errToObj(n?.message)))}startsWith(e,n){return this._addCheck(v({kind:"startsWith",value:e},ue.errToObj(n)))}endsWith(e,n){return this._addCheck(v({kind:"endsWith",value:e},ue.errToObj(n)))}min(e,n){return this._addCheck(v({kind:"min",value:e},ue.errToObj(n)))}max(e,n){return this._addCheck(v({kind:"max",value:e},ue.errToObj(n)))}length(e,n){return this._addCheck(v({kind:"length",value:e},ue.errToObj(n)))}nonempty(e){return this.min(1,ue.errToObj(e))}trim(){return new Qn(N(v({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}secret(){return this._def[le]=N(v({},this._def[le]),{secret:!0}),this}toLowerCase(){return new Qn(N(v({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new Qn(N(v({},this._def),{checks:[...this._def.checks,{kind:"toUpperCase"}]}))}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}isEqual(e){if(!(e instanceof Qn))return!1;let n=new tt(this._def.checks),r=new tt(e._def.checks);return n.isEqual(r)}};p(io,"ZodString");io.create=p(t=>{var e;return new io(v({checks:[],typeName:"ZodString",coerce:(e=t?.coerce)!=null?e:!1},me(N(v({},t),{supportsExtensions:["secret"]}))))},"create");var yt=io,oo=class Jg extends he{_parse(e){if(this._getType(e)!==ne.symbol){let r=this._getOrReturnCtx(e);return te(r,{code:J.invalid_type,expected:ne.symbol,received:r.parsedType}),pe}return gt(e.data)}isEqual(e){return e instanceof Jg}};p(oo,"ZodSymbol");oo.create=p(t=>new oo(v({typeName:"ZodSymbol"},me(t))),"create");var Yg=oo,sr=class Mr extends he{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName==="ZodEffects"?this._def.schema.sourceType():this._def.schema}dereference(e){return new Mr(N(v({},this._def),{schema:this._def.schema.dereference(e)}))}getReferences(){return this._def.schema.getReferences()}clone(){return new Mr(N(v({},this._def),{schema:this._def.schema.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),o=this._def.effect||null,s={addIssue:i=>{te(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){let i=o.transform(r.data,s);if(r.common.async)return Promise.resolve(i).then(async a=>{if(n.value==="aborted")return pe;let l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?pe:l.status==="dirty"||n.value==="dirty"?er(l.value):l});{if(n.value==="aborted")return pe;let a=this._def.schema._parseSync({data:i,path:r.path,parent:r});return a.status==="aborted"?pe:a.status==="dirty"||n.value==="dirty"?er(a.value):a}}if(o.type==="refinement"){let i=p(a=>{let l=o.refinement(a,s);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a},"executeRefinement");if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?pe:(a.status==="dirty"&&n.dirty(),i(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?pe:(a.status==="dirty"&&n.dirty(),i(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!qr(i))return i;let a=o.transform(i.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>qr(i)?Promise.resolve(o.transform(i.value,s)).then(a=>({status:n.value,value:a})):i);be.assertNever(o)}isEqual(e){return!(e instanceof Mr)||!this._def.schema.isEqual(e._def.schema)?!1:this._def.effect.type==="refinement"?e._def.effect.type!=="refinement"?!1:be.compareFunctions(this._def.effect.refinement,e._def.effect.refinement):this._def.effect.type==="transform"?e._def.effect.type!=="transform"?!1:be.compareFunctions(this._def.effect.transform,e._def.effect.transform):this._def.effect.type==="preprocess"?e._def.effect.type!=="preprocess"?!1:be.compareFunctions(this._def.effect.transform,e._def.effect.transform):!1}naked(){return this._def.schema.naked()}mandatory(){return new Mr(N(v({},this._def),{schema:this._def.schema.mandatory()}))}};p(sr,"ZodEffects");sr.create=p((t,e,n)=>new sr(v({schema:t,typeName:"ZodEffects",effect:e},me(n))),"create");sr.createWithPreprocess=p((t,e,n)=>new sr(v({schema:e,effect:{type:"preprocess",transform:t},typeName:"ZodEffects"},me(n))),"createWithPreprocess");var Rn=sr,so=class Nr extends he{dereference(e){let n=this._def.items.map(o=>o.dereference(e)),r=this._def.rest?this._def.rest.dereference(e):null;return new Nr(N(v({},this._def),{items:n,rest:r}))}getReferences(){return en([...this._def.items.flatMap(e=>e.getReferences()),...this._def.rest?this._def.rest.getReferences():[]])}clone(){let e=this._def.items.map(r=>r.clone()),n=this._def.rest?this._def.rest.clone():null;return new Nr(N(v({},this._def),{items:e,rest:n}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ne.array)return te(r,{code:J.invalid_type,expected:ne.array,received:r.parsedType}),pe;if(r.data.length<this._def.items.length)return te(r,{code:J.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),pe;!this._def.rest&&r.data.length>this._def.items.length&&(te(r,{code:J.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let s=[...r.data].map((i,a)=>{let l=this._def.items[a]||this._def.rest;return l?l._parse(new Mt(r,i,r.path,a)):null}).filter(i=>!!i);return r.common.async?Promise.all(s).then(i=>_t.mergeArray(n,i)):_t.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new Nr(N(v({},this._def),{rest:e}))}isEqual(e){if(!(e instanceof Nr)||!this._restEquals(e))return!1;let n=p((s,i)=>s.isEqual(i),"compare"),r=new tt(this._def.items,{compare:n}),o=new tt(e._def.items,{compare:n});return r.isEqual(o)}_restEquals(e){return this._def.rest===null?e._def.rest===null:e._def.rest!==null&&this._def.rest.isEqual(e._def.rest)}};p(so,"ZodTuple");so.create=p((t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new so(v({items:t,typeName:"ZodTuple",rest:null},me(e)))},"create");var ar=so,ao=class Xg extends he{_parse(e){if(this._getType(e)!==ne.undefined){let r=this._getOrReturnCtx(e);return te(r,{code:J.invalid_type,expected:ne.undefined,received:r.parsedType}),pe}return gt(e.data)}isEqual(e){return e instanceof Xg}mandatory(){return Xr.create(v({},this._def))}};p(ao,"ZodUndefined");ao.create=p(t=>new ao(v({typeName:"ZodUndefined"},me(t))),"create");var Io=ao,lo=class Dr extends he{dereference(e){let n=this._def.options.map(r=>r.dereference(e));return new Dr(N(v({},this._def),{options:n}))}getReferences(){return en(this._def.options.reduce((e,n)=>[...e,...n.getReferences()],[]))}clone(){let e=this._def.options.map(n=>n.clone());return new Dr(N(v({},this._def),{options:e}))}_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function o(s){for(let a of s)if(a.result.status==="valid")return a.result;for(let a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;let i=s.map(a=>new Yt(a.ctx.common.issues));return te(n,{code:J.invalid_union,unionErrors:i}),pe}if(p(o,"handleResults"),n.common.async)return Promise.all(r.map(async s=>{let i=N(v({},n),{common:N(v({},n.common),{issues:[]}),parent:null});return{result:await s._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(o);{let s,i=[];for(let l of r){let c=N(v({},n),{common:N(v({},n.common),{issues:[]}),parent:null}),f=l._parseSync({data:n.data,path:n.path,parent:c});if(f.status==="valid")return f;f.status==="dirty"&&!s&&(s={result:f,ctx:c}),c.common.issues.length&&i.push(c.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(l=>new Yt(l));return te(n,{code:J.invalid_union,unionErrors:a}),pe}}get options(){return this._def.options}isEqual(e){if(!(e instanceof Dr))return!1;let n=p((s,i)=>s.isEqual(i),"compare"),r=new tt([...this._def.options],{compare:n}),o=new tt([...e._def.options],{compare:n});return r.isEqual(o)}mandatory(){let e=this._def.options.filter(s=>!(s instanceof Io)).map(s=>s.mandatory()),[n,r,...o]=e;return n?r?new Dr(N(v({},this._def),{options:[n,r,...o]})):n:Xr.create(v({},this._def))}};p(lo,"ZodUnion");lo.create=p((t,e)=>new lo(v({options:t,typeName:"ZodUnion"},me(e))),"create");var aa=lo,uo=class Qg extends he{constructor(){super(...arguments),this._unknown=!0}_parse(e){return gt(e.data)}isEqual(e){return e instanceof Qg}};p(uo,"ZodUnknown");uo.create=p(t=>new uo(v({typeName:"ZodUnknown"},me(t))),"create");var Kr=uo,co=class ey extends he{_parse(e){if(this._getType(e)!==ne.undefined){let r=this._getOrReturnCtx(e);return te(r,{code:J.invalid_type,expected:ne.void,received:r.parsedType}),pe}return gt(e.data)}isEqual(e){return e instanceof ey}};p(co,"ZodVoid");co.create=p(t=>new co(v({typeName:"ZodVoid"},me(t))),"create");var ty=co,GP=["gpt-3.5-turbo","gpt-3.5-turbo-16k","gpt-4","gpt-4-1106-preview","gpt-4-vision-preview","gpt-4-0125-preview","gpt-4-turbo-preview","gpt-4-turbo","gpt-4o","gpt-3.5-turbo-0125","gpt-3.5-turbo-1106"],eC=ur.create(["any","string","number","boolean","object","pattern","date","array","target","time","enum"]),VP=p(t=>yt.create().displayAs({id:"variable",params:v({type:t?.type||"any"},t?.params)}),"variable"),JP=p(t=>yt.create().displayAs({id:"conversation",params:v({},t?.params)}),"conversation"),YP=p(t=>yt.create().displayAs({id:"user",params:v({},t?.params)}),"user"),XP=p(t=>yt.create().displayAs({id:"message",params:v({},t?.params)}),"message"),QP=p(t=>yt.create().displayAs({id:"agent",params:v({},t?.params)}),"agent"),ex=p(t=>yt.create().displayAs({id:"event",params:v({},t?.params)}),"event"),tx=p(t=>yt.create().displayAs({id:"table",params:v({},t?.params)}),"table"),nx=p(t=>yt.create().displayAs({id:"tablerow",params:v({},t?.params)}),"tablerow"),rx=p(t=>yt.create().displayAs({id:"intent",params:v({},t?.params)}),"intent"),ix=p(()=>ur.create(GP).displayAs({id:"dropdown",params:{}}),"aimodel"),ox=p(t=>yt.create().displayAs({id:"datasource",params:v({},t)}),"datasource"),sx=p(t=>yt.create().displayAs({id:"knowledgebase",params:v({},t)}),"knowledgebase"),ax={object:or.lazycreate},lx=p((t,e={message:`Input not instance of ${t.name}`})=>wg(n=>n instanceof t,e),"instanceOfType"),ny=yt.create,ry=oa.create,ux=Ag.create,cx=Gs.create,iy=Vs.create,dx=Xs.create,fx=Yg.create,px=Io.create,gx=ia.create,yx=Gr.create,mx=Kr.create,hx=Xr.create,Tx=ty.create,vx=Vr.create,_x=or.create,bx=or.strictCreate,wx=aa.create,Px=xg.create,xx=ea.create,Bx=ar.create,Ex=Hg.create,Sx=jg.create,Ix=So.create,kx=Ig.create,Ax=$g.create,Cx=Eg.create,Ox=ta.create,Rx=na.create,Mx=ur.create,Nx=ra.create,Dx=Eo.create,sd=Rn.create,Hx=gn.create,Ux=ir.create,jx=xo.create,$x=Rn.createWithPreprocess,Zx=sa.create,Kx=p(()=>ny().optional(),"ostring"),Lx=p(()=>ry().optional(),"onumber"),Fx=p(()=>iy().optional(),"oboolean"),Wx={string:t=>yt.create(N(v({},t),{coerce:!0})),number:t=>oa.create(N(v({},t),{coerce:!0})),boolean:t=>Vs.create(N(v({},t),{coerce:!0})),bigint:t=>Gs.create(N(v({},t),{coerce:!0})),date:t=>Xs.create(N(v({},t),{coerce:!0}))},zx=pe,R=X,qx=p(t=>{let e;try{e=new Function("z",`return ${t}`)(R)}catch(n){return{sucess:!1,error:`Failed to evaluate schema: ${(n instanceof Error?n:new Error(String(n))).message}`}}return e instanceof R.ZodType?{sucess:!0,value:e}:{sucess:!1,error:`String "${t}" does not evaluate to a Zod schema`}},"evalZuiString"),Gx=p(t=>[t.slice(0,t.length/2),t.slice(t.length/2)],"half"),Vx=p((t,...e)=>Object.keys(t).reduce((n,r)=>(e.includes(r)||(n[r]=t[r]),n),{}),"omit");function ut(t,e,n){var r;let o=t[e],s="";if(o!==void 0){let i=n({value:o,json:JSON.stringify(o)});if(i){let a=i[0],l=i.length===3?i[1]:"",c=i.length===3?i[2]:i[1];s+=a,((r=t.errorMessage)==null?void 0:r[e])!==void 0&&(s+=l+JSON.stringify(t.errorMessage[e])),s+=c}}return s}p(ut,"withMessage");var Hr=Symbol("Original index"),Jx=p(t=>{let e=[];for(let n=0;n<t.length;n++){let r=t[n];if(typeof r=="boolean")e.push(r?{[Hr]:n}:{[Hr]:n,not:{}});else{if(Hr in r)return t;e.push(N(v({},r),{[Hr]:n}))}}return e},"ensureOriginalIndex");function Jr(t,e){if(t.allOf.length===0)return"z.never()";if(t.allOf.length===1){let n=t.allOf[0];return it(n,N(v({},e),{path:[...e.path,"allOf",n[Hr]]}))}else{let[n,r]=Gx(Jx(t.allOf));return`z.intersection(${Jr({allOf:n},e)}, ${Jr({allOf:r},e)})`}}p(Jr,"parseAllOf");var oy=p((t,e)=>t.anyOf.length?t.anyOf.length===1?it(t.anyOf[0],N(v({},e),{path:[...e.path,"anyOf",0]})):`z.union([${t.anyOf.map((n,r)=>it(n,N(v({},e),{path:[...e.path,"anyOf",r]}))).join(", ")}])`:"z.any()","parseAnyOf"),Yx=p((t,e)=>{if(Array.isArray(t.items))return`z.tuple([${t.items.map((r,o)=>it(r,N(v({},e),{path:[...e.path,"items",o]})))}])`;let n=t.items?`z.array(${it(t.items,N(v({},e),{path:[...e.path,"items"]}))})`:"z.array(z.any())";return n+=ut(t,"minItems",({json:r})=>[`.min(${r}`,", ",")"]),n+=ut(t,"maxItems",({json:r})=>[`.max(${r}`,", ",")"]),n},"parseArray"),Xx=p(t=>{var e;return(e=t[le])!=null&&e.coerce?"z.coerce.boolean()":"z.boolean()"},"parseBoolean"),Qx=p(t=>`z.literal(${JSON.stringify(t.const)})`,"parseConst"),eB=p(t=>"z.any()","parseDefault"),la=p((t,e)=>t.oneOf.length?t.oneOf.length===1?it(t.oneOf[0],N(v({},e),{path:[...e.path,"oneOf",0]})):`z.any().superRefine((x, ctx) => {
36
29
  const schemas = [${t.oneOf.map((n,r)=>it(n,N(v({},e),{path:[...e.path,"oneOf",r]}))).join(", ")}];
37
30
  const errors = schemas.reduce(
38
31
  (errors: z.ZodError[], schema) =>
@@ -49,7 +42,14 @@ declare function ${r}${i};${l}`);if(t.props.type==="variable")return cs(`${o}dec
49
42
  message: "Invalid input: Should pass single schema",
50
43
  });
51
44
  }
52
- })`:"z.any()","parseOneOf");function sy(t,e){let n;t.properties&&(Object.keys(t.properties).length?(n="z.object({ ",n+=Object.keys(t.properties).map(i=>{let a=t.properties[i],l=`${JSON.stringify(i)}: ${it(a,N(v({},e),{path:[...e.path,"properties",i]}))}`,c=typeof a=="object"&&a.default!==void 0||typeof t.default=="object"&&t.default!==null&&i in t.default,p=Array.isArray(t.required)?t.required.includes(i):typeof a=="object"&&a.required===!0;return!c&&!p?`${l}.optional()`:l}).join(", "),n+=" })"):n="z.object({})");let r=t.additionalProperties!==void 0?it(t.additionalProperties,N(v({},e),{path:[...e.path,"additionalProperties"]})):void 0,o;if(t.patternProperties){let i=Object.fromEntries(Object.entries(t.patternProperties).map(([a,l])=>[a,it(l,N(v({},e),{path:[...e.path,"patternProperties",a]}))],{}));o="",n?r?o+=`.catchall(z.union([${[...Object.values(i),r].join(", ")}]))`:Object.keys(i).length>1?o+=`.catchall(z.union([${Object.values(i).join(", ")}]))`:o+=`.catchall(${Object.values(i)})`:r?o+=`z.record(z.union([${[...Object.values(i),r].join(", ")}]))`:Object.keys(i).length>1?o+=`z.record(z.union([${Object.values(i).join(", ")}]))`:o+=`z.record(${Object.values(i)})`,o+=`.superRefine((value, ctx) => {
45
+ })`:"z.any()","parseOneOf"),tB=p((t,e)=>{var n,r;if(t.oneOf.length<=1||!((n=t.discriminator)!=null&&n.propertyName))return la(t,e);let o=t.oneOf.map((s,i)=>it(s,N(v({},e),{path:[...e.path,"oneOf",i]})));return`z.discriminatedUnion("${(r=t.discriminator)==null?void 0:r.propertyName}", [${o.join(", ")}])`},"parseDiscriminator"),nB=p(t=>t.enum.length===0?"z.never()":t.enum.length===1?`z.literal(${JSON.stringify(t.enum[0])})`:t.enum.every(e=>typeof e=="string")?`z.enum([${t.enum.map(e=>JSON.stringify(e))}])`:`z.union([${t.enum.map(e=>`z.literal(${JSON.stringify(e)})`).join(", ")}])`,"parseEnum"),rB=p((t,e)=>{let n=it(t.if,N(v({},e),{path:[...e.path,"if"]})),r=it(t.then,N(v({},e),{path:[...e.path,"then"]})),o=it(t.else,N(v({},e),{path:[...e.path,"else"]}));return`z.union([${r}, ${o}]).superRefine((value,ctx) => {
46
+ const result = ${n}.safeParse(value).success
47
+ ? ${r}.safeParse(value)
48
+ : ${o}.safeParse(value);
49
+ if (!result.success) {
50
+ result.error.errors.forEach((error) => ctx.addIssue(error))
51
+ }
52
+ })`},"parseIfThenElse"),iB=p((t,e)=>`z.union([${t.type.map(n=>it(N(v({},t),{type:n}),e)).join(", ")}])`,"parseMultipleType"),oB=p((t,e)=>`z.any().refine((value) => !${it(t.not,N(v({},e),{path:[...e.path,"not"]}))}.safeParse(value).success, "Invalid input: Should NOT be valid against schema")`,"parseNot"),sB=p(t=>"z.null()","parseNull"),aB=p((t,e)=>`${it(Vx(t,"nullable"),e,!0)}.nullable()`,"parseNullable"),lB=p(t=>{var e;let n="z.number()";return(e=t[le])!=null&&e.coerce&&(n="z.coerce.number()"),t.type==="integer"?n+=ut(t,"type",()=>[".int(",")"]):n+=ut(t,"format",({value:r})=>{if(r==="int64")return[".int(",")"]}),n+=ut(t,"multipleOf",({value:r,json:o})=>r===1?n.startsWith("z.number().int(")?void 0:[".int(",")"]:[`.multipleOf(${o}`,", ",")"]),typeof t.minimum=="number"?t.exclusiveMinimum===!0?n+=ut(t,"minimum",({json:r})=>[`.gt(${r}`,", ",")"]):n+=ut(t,"minimum",({json:r})=>[`.gte(${r}`,", ",")"]):typeof t.exclusiveMinimum=="number"&&(n+=ut(t,"exclusiveMinimum",({json:r})=>[`.gt(${r}`,", ",")"])),typeof t.maximum=="number"?t.exclusiveMaximum===!0?n+=ut(t,"maximum",({json:r})=>[`.lt(${r}`,", ",")"]):n+=ut(t,"maximum",({json:r})=>[`.lte(${r}`,", ",")"]):typeof t.exclusiveMaximum=="number"&&(n+=ut(t,"exclusiveMaximum",({json:r})=>[`.lt(${r}`,", ",")"])),n},"parseNumber");function sy(t,e){let n;t.properties&&(Object.keys(t.properties).length?(n="z.object({ ",n+=Object.keys(t.properties).map(i=>{let a=t.properties[i],l=`${JSON.stringify(i)}: ${it(a,N(v({},e),{path:[...e.path,"properties",i]}))}`,c=typeof a=="object"&&a.default!==void 0||typeof t.default=="object"&&t.default!==null&&i in t.default,f=Array.isArray(t.required)?t.required.includes(i):typeof a=="object"&&a.required===!0;return!c&&!f?`${l}.optional()`:l}).join(", "),n+=" })"):n="z.object({})");let r=t.additionalProperties!==void 0?it(t.additionalProperties,N(v({},e),{path:[...e.path,"additionalProperties"]})):void 0,o;if(t.patternProperties){let i=Object.fromEntries(Object.entries(t.patternProperties).map(([a,l])=>[a,it(l,N(v({},e),{path:[...e.path,"patternProperties",a]}))],{}));o="",n?r?o+=`.catchall(z.union([${[...Object.values(i),r].join(", ")}]))`:Object.keys(i).length>1?o+=`.catchall(z.union([${Object.values(i).join(", ")}]))`:o+=`.catchall(${Object.values(i)})`:r?o+=`z.record(z.union([${[...Object.values(i),r].join(", ")}]))`:Object.keys(i).length>1?o+=`z.record(z.union([${Object.values(i).join(", ")}]))`:o+=`z.record(${Object.values(i)})`,o+=`.superRefine((value, ctx) => {
53
53
  `,o+=`for (const key in value) {
54
54
  `,r&&(t.properties?o+=`let evaluated = [${Object.keys(t.properties).map(a=>JSON.stringify(a)).join(", ")}].includes(key)
55
55
  `:o+=`let evaluated = false
@@ -81,7 +81,7 @@ declare function ${r}${i};${l}`);if(t.props.type==="variable")return cs(`${o}dec
81
81
  `,o+=`}
82
82
  `,o+=`}
83
83
  `),o+=`}
84
- `,o+="})"}let s=n?o?n+o:r?r==="z.never()"?n+".strict()":n+`.catchall(${r})`:n:o||(r?`z.record(${r})`:"z.record(z.any())");return Ye.an.anyOf(t)&&(s+=`.and(${oy(N(v({},t),{anyOf:t.anyOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?N(v({},i),{type:"object"}):i)}),e)})`),Ye.a.oneOf(t)&&(s+=`.and(${la(N(v({},t),{oneOf:t.oneOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?N(v({},i),{type:"object"}):i)}),e)})`),Ye.an.allOf(t)&&(s+=`.and(${Jr(N(v({},t),{allOf:t.allOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?N(v({},i),{type:"object"}):i)}),e)})`),s}f(sy,"parseObject");var sB=f(t=>{var e;let n="z.string()";if((e=t[le])!=null&&e.coerce){if(t.format==="date-time")return"z.coerce.date()";n="z.coerce.string()"}return n+=ut(t,"format",({value:r})=>{switch(r){case"email":return[".email(",")"];case"ip":return[".ip(",")"];case"ipv4":return['.ip({ version: "v4"',", message: "," })"];case"ipv6":return['.ip({ version: "v6"',", message: "," })"];case"uri":return[".url(",")"];case"uuid":return[".uuid(",")"];case"date-time":return[".datetime(",")"]}}),n+=ut(t,"pattern",({json:r})=>[`.regex(new RegExp(${r})`,", ",")"]),n+=ut(t,"minLength",({json:r})=>[`.min(${r}`,", ",")"]),n+=ut(t,"maxLength",({json:r})=>[`.max(${r}`,", ",")"]),n},"parseString"),aB=f((t,e)=>`${it(Qx(t,"nullable"),e,!0)}.nullable()`,"parseNullable"),lB=f(t=>`z.ref('${t.$ref}')`,"parseRef"),uB=f((t,e)=>{var n,r;if(t.oneOf.length<=1||!((n=t.discriminator)!=null&&n.propertyName))return la(t,e);let o=t.oneOf.map((s,i)=>it(s,N(v({},e),{path:[...e.path,"oneOf",i]})));return`z.discriminatedUnion("${(r=t.discriminator)==null?void 0:r.propertyName}", [${o.join(", ")}])`},"parseDiscriminator"),it=f((t,e={seen:new Map,path:[]},n)=>{if(typeof t!="object")return t?"z.any()":"z.never()";if(e.parserOverride){let s=e.parserOverride(t,e);if(typeof s=="string")return s}let r=e.seen.get(t);if(r){if(r.r!==void 0)return r.r;if(e.depth===void 0||r.n>=e.depth)return"z.any()";r.n+=1}else r={r:void 0,n:0},e.seen.set(t,r);let o=fB(t,e);return n||(o=cB(t,o),e.withoutDefaults||(o=dB(t,o))),r.r=o,o},"parseSchema"),cB=f((t,e)=>(t.description&&(e+=`.describe(${JSON.stringify(t.description)})`),e),"addMeta"),dB=f((t,e)=>(t.default!==void 0&&(e+=`.default(${JSON.stringify(t.default)})`),e),"addDefaults"),fB=f((t,e)=>Ye.a.nullable(t)?aB(t,e):Ye.an.object(t)?sy(t,e):Ye.an.array(t)?tB(t,e):Ye.an.anyOf(t)?oy(t,e):Ye.an.allOf(t)?Jr(t,e):Ye.a.discriminator(t)?uB(t,e):Ye.a.oneOf(t)?la(t,e):Ye.a.not(t)?Jx(t,e):Ye.an.enum(t)?rB(t):Ye.a.const(t)?nB(t):Ye.a.multipleType(t)?Vx(t,e):Ye.a.primitive(t,"string")?sB(t):Ye.a.primitive(t,"number")||Ye.a.primitive(t,"integer")?oB(t):Ye.a.primitive(t,"boolean")?qx(t):Ye.a.primitive(t,"null")?Yx(t):Ye.a.conditional(t)?iB(t,e):Ye.a.ref(t)?lB(t):Gx(t),"selectParser"),Ye={an:{object:f(t=>t.type==="object","object"),array:f(t=>t.type==="array","array"),anyOf:f(t=>t.anyOf!==void 0,"anyOf"),allOf:f(t=>t.allOf!==void 0,"allOf"),enum:f(t=>t.enum!==void 0,"enum")},a:{nullable:f(t=>t.nullable===!0,"nullable"),multipleType:f(t=>Array.isArray(t.type),"multipleType"),not:f(t=>t.not!==void 0,"not"),const:f(t=>t.const!==void 0,"const"),primitive:f((t,e)=>t.type===e,"primitive"),conditional:f(t=>!!("if"in t&&t.if&&"then"in t&&"else"in t&&t.then&&t.else),"conditional"),discriminator:f(t=>{var e;return t.oneOf!==void 0&&((e=t.discriminator)==null?void 0:e.propertyName)!==void 0},"discriminator"),oneOf:f(t=>t.oneOf!==void 0,"oneOf"),ref:f(t=>t.$ref!==void 0,"ref")}},pB=f(t=>{let e;try{e=new Function("z",`return ${t}`)(R)}catch(n){return{sucess:!1,error:`Failed to evaluate schema: ${(n instanceof Error?n:new Error(String(n))).message}`}}return e instanceof R.ZodType?{sucess:!0,value:e}:{sucess:!1,error:`String "${t}" does not evaluate to a Zod schema`}},"evalZuiString"),gB=f(t=>it(t,{seen:new Map,path:[]}),"jsonSchemaToZodStr"),yB=f(t=>{let e=gB(t);e=e.replaceAll("errors: z.ZodError[]","errors");let n=pB(e);if(!n.sucess)throw new go(n.error);return n.value},"jsonSchemaToZod"),Ur=f((t,e)=>{var n,r;if(e[le]&&t._def&&(t.naked()._def[le]=e[le]),((n=t._def)==null?void 0:n.typeName)==="ZodObject"&&e.type==="object"&&e.properties&&Object.entries(e.properties).forEach(([o,s])=>{let i=typeof t._def.shape=="function"?t._def.shape():t._def.shape;i[o]&&Ur(i[o],s)}),((r=t._def)==null?void 0:r.typeName)==="ZodRecord"&&e.type==="object"&&e.additionalProperties&&Ur(t._def.valueType,e.additionalProperties),e.type==="array"&&e.items){let o=e.items;if(typeof o=="object"&&!Array.isArray(o)){let s=t._def.type;s&&Ur(s,o)}else Array.isArray(o)&&o.forEach((s,i)=>{let a=t._def;a.typeName===X.ZodFirstPartyTypeKind.ZodTuple&&Ur(a.items[i],s)})}},"applyZuiPropsRecursively"),mB=f(t=>{let e=yB(t);return Ur(e,t),e},"fromJSONSchemaLegacy"),hB=f(t=>{var e,n;return t.anyOf!==void 0&&t.anyOf.length===2&&t.anyOf.some(r=>typeof r!="boolean"&&ay(r))&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)===R.ZodFirstPartyTypeKind.ZodOptional},"isOptionalSchema"),TB=f(t=>{var e,n;return t.anyOf!==void 0&&t.anyOf.length===2&&t.anyOf.some(r=>typeof r!="boolean"&&r.type==="null")&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)===R.ZodFirstPartyTypeKind.ZodNullable},"isNullableSchema"),ay=f(t=>{var e,n;return t.not===!0&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)===R.ZodFirstPartyTypeKind.ZodUndefined},"isUndefinedSchema"),vB=f(t=>{var e,n;return!t.not&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)===R.ZodFirstPartyTypeKind.ZodUnknown},"isUnknownSchema"),_B=f(t=>{var e,n;return t.anyOf!==void 0&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)===R.ZodFirstPartyTypeKind.ZodDiscriminatedUnion},"isDiscriminatedUnionSchema"),bB=f(({type:t,minimum:e,exclusiveMinimum:n,maximum:r,exclusiveMaximum:o,multipleOf:s,format:i})=>{let a=R.number();return t==="integer"&&(a=a.int()),i==="finite"&&(a=a.finite()),n!==void 0?a=a.gt(n):e!==void 0&&(a=a.gte(e)),o!==void 0?a=a.lt(o):r!==void 0&&(a=a.lte(r)),s!==void 0&&(a=a.multipleOf(s)),a},"numberJSONSchemaToZuiNumber"),wB=f(({format:t,pattern:e,minLength:n,maxLength:r})=>{let o=R.string();if(n&&r&&n===r?o=o.length(n):(n&&(o=o.min(n)),r&&(o=o.max(r))),t==="cuid"||e===Xe.cuid)o=o.cuid();else if(t==="cuid2"||e===Xe.cuid2)o=o.cuid2();else if(t==="emoji"||e===Xe.emoji)o=o.emoji();else if(t==="ulid"||e===Xe.ulid)o=o.ulid();else if(t==="date-time"){let{precision:s,offset:i}=e?MP(e):{};o=o.datetime({precision:s,offset:i})}else t==="email"||e===Xe.email?o=o.email():t==="ipv4"||e===Xe.ipv4?o=o.ip():t==="ipv6"||e===Xe.ipv6?o=o.ip("v6"):t==="uri"?o=o.url():t==="uuid"||e===Xe.uuid?o=o.uuid():e&&(o=o.regex(new RegExp(e)));return o},"stringJSONSchemaToZuiString"),Er=f((t,e)=>{let n=[];e.enum!==void 0&&n.push(...e.enum),e.const!==void 0&&n.push(e.const);let r,o=n.filter(i=>typeof i===t),[s]=o;if(s)if(o.length===1)r=R.literal(s);else{let i=o.map(a=>R.literal(a));r=R.union(i)}else if(t==="string"&&e.type==="string"&&(r=wB(e)),t==="number"&&(e.type==="number"||e.type==="integer")&&(r=bB(e)),t==="boolean"&&(r=R.boolean()),t==="null"&&(r=R.null()),!r)throw new go(`Unknown primitive type: "${t}"`);return e.description&&(r=r.describe(e.description)),r},"toZuiPrimitive"),PB=f((t,e)=>xB(t)?EB(t,e):BB(t)?SB(t,e):IB(t,e),"arrayJSONSchemaToZuiArray"),xB=f(t=>Array.isArray(t.items),"_isTuple"),BB=f(t=>t.items!==void 0&&t.uniqueItems,"_isSet"),EB=f(({items:t,additionalItems:e},n)=>{let r=t.map(n),o=R.tuple(r);return e!==void 0&&(o=o.rest(n(e))),o},"_handleTuple"),SB=f(({items:t,minItems:e,maxItems:n},r)=>{let o=R.set(r(t));return e&&(o=o.min(e)),n&&(o=o.max(n)),o},"_handleSet"),IB=f(({minItems:t,maxItems:e,items:n},r)=>{let o=R.array(r(n));return t&&t===e?o.length(t):(t&&(o=o.min(t)),e&&(o=o.max(e)),o)},"_handleArray"),Jn=R.any();function ly(t){return et(t)}f(ly,"fromJSONSchema");function et(t){var e,n,r;if(t===void 0)return Jn;if(t===!0)return R.any();if(t===!1)return R.never();if(t.default!==void 0)return et(N(v({},t),{default:void 0})).default(t.default);if(t.readOnly)return et(N(v({},t),{readOnly:void 0})).readonly();if(t.description!==void 0)return et(N(v({},t),{description:void 0})).describe(t.description);if(t.oneOf!==void 0)throw new fn({oneOf:t.oneOf});if(t.patternProperties!==void 0)throw new fn({patternProperties:t.patternProperties});if(t.propertyNames!==void 0)throw new fn({propertyNames:t.propertyNames});if(t.if!==void 0)throw new fn({if:t.if});if(t.then!==void 0)throw new fn({then:t.then});if(t.else!==void 0)throw new fn({else:t.else});if(t.$ref!==void 0)return R.ref(t.$ref);if(t.not!==void 0){if(ay(t))return R.undefined();if(t.not===!0)return R.never();throw new fn({not:t.not})}if(Array.isArray(t.type)){if(t.type.length===0)return Jn;if(t.type.length===1)return et(N(v({},t),{type:t.type[0]}));let o=t,{type:s}=o,i=dd(o,["type"]),a=t.type.map(l=>et(N(v({},i),{type:l})));return R.union(a)}if(t.type==="string")return t.enum&&t.enum.length>0?R.enum(t.enum):Er("string",t);if(t.type==="integer"){let o=Er("number",t);return o instanceof R.ZodNumber?o.int():o}if(t.type==="number")return Er("number",t);if(t.type==="boolean")return Er("boolean",t);if(t.type==="null")return Er("null",t);if(t.type==="array")return PB(t,et);if(t.type==="object"){if(t.additionalProperties!==void 0&&t.properties!==void 0){let o=et(t.additionalProperties);return et(N(v({},t),{additionalProperties:void 0})).catchall(o)}if(t.properties!==void 0){let o={};for(let[s,i]of Object.entries(t.properties)){let a=et(i),l=(e=t.required)!=null?e:[];o[s]=l.includes(s)||a.isOptional()?a:a.optional()}return R.object(o)}if(t.additionalProperties!==void 0){let o=et(t.additionalProperties);return R.record(o)}return R.record(Jn)}if(t.anyOf!==void 0){if(t.anyOf.length===0)return Jn;if(t.anyOf.length===1)return et(t.anyOf[0]);if(hB(t))return et(t.anyOf[0]).optional();if(TB(t))return et(t.anyOf[0]).nullable();if(_B(t)&&((r=(n=t["x-zui"])==null?void 0:n.def)!=null&&r.discriminator)){let{discriminator:s}=t["x-zui"].def,i=t.anyOf.map(et);return R.discriminatedUnion(s,i)}let o=t.anyOf.map(et);return R.union(o)}if(t.allOf!==void 0){if(t.allOf.length===0)return Jn;if(t.allOf.length===1)return et(t.allOf[0]);let[o,...s]=t.allOf,i=et(o),a=et({allOf:s});return R.intersection(i,a)}return vB(t)?R.unknown():Jn}f(et,"_fromJSONSchema");var kB=/^\d{4}-\d{2}-\d{2}(T|\s)?((\d{2}:\d{2}:\d{2}(\.\d{1,3})?)|(\d{2}:\d{2}))?(\s?([+-]\d{2}:\d{2}|Z))?$/,As=f((t,e,n=!0)=>{if(typeof t!="object")throw new Ts("Input must be an object");let r=f(i=>{let a=i;return e?.nullable&&(a=a.nullable()),e?.optional&&(a=a.optional()),e?.passtrough&&typeof a.passthrough=="function"&&(a=a.passthrough()),a},"applyOptions"),o=Object.entries(t).reduce((i,[a,l])=>{if(l===null)i[a]=r(X.null());else switch(typeof l){case"string":i[a]=kB.test(l)?r(X.string().datetime()):r(X.string());break;case"number":i[a]=r(X.number());break;case"boolean":i[a]=r(X.boolean());break;case"object":Array.isArray(l)?l.length===0?i[a]=r(X.array(X.unknown())):typeof l[0]=="object"?i[a]=r(X.array(As(l[0],e,!1))):["string","number","boolean"].includes(typeof l[0])&&(i[a]=r(X.array(X[typeof l[0]]()))):i[a]=r(As(l,e,!1));break;default:throw new Ts(`Unsupported type for key ${a}`)}return i},{}),s=Object.keys(o).length>0;return e?.passtrough||!n&&!s?X.object(o).passthrough():X.object(o)},"fromObject");function uy(){return{}}f(uy,"parseAnyDef");function cy(t,e){var n,r;let o={type:"array"};return((r=(n=t.type)==null?void 0:n._def)==null?void 0:r.typeName)!=="ZodAny"&&(o.items=ke(t.type._def,N(v({},e),{currentPath:[...e.currentPath,"items"]}))),t.minLength&&Re(o,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Re(o,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Re(o,"minItems",t.exactLength.value,t.exactLength.message,e),Re(o,"maxItems",t.exactLength.value,t.exactLength.message,e)),o}f(cy,"parseArrayDef");function dy(t,e){let n=v({type:"integer",format:"int64"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{});if(!t.checks)return n;for(let r of t.checks)switch(r.kind){case"min":e.target==="jsonSchema7"?r.inclusive?Re(n,"minimum",r.value,r.message,e):Re(n,"exclusiveMinimum",r.value,r.message,e):(r.inclusive||(n.exclusiveMinimum=!0),Re(n,"minimum",r.value,r.message,e));break;case"max":e.target==="jsonSchema7"?r.inclusive?Re(n,"maximum",r.value,r.message,e):Re(n,"exclusiveMaximum",r.value,r.message,e):(r.inclusive||(n.exclusiveMaximum=!0),Re(n,"maximum",r.value,r.message,e));break;case"multipleOf":Re(n,"multipleOf",r.value,r.message,e);break}return n}f(dy,"parseBigintDef");function fy(t){return v({type:"boolean"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{})}f(fy,"parseBooleanDef");function py(t,e){return ke(t.type._def,e)}f(py,"parseBrandedDef");var AB=f((t,e)=>ke(t.innerType._def,e),"parseCatchDef");function gy(t,e){return e.dateStrategy=="integer"?CB(t,e):v({type:"string",format:"date-time"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{})}f(gy,"parseDateDef");var CB=f((t,e)=>{let n=v({type:"integer",format:"unix-time"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{});for(let r of t.checks)switch(r.kind){case"min":e.target==="jsonSchema7"&&Re(n,"minimum",r.value,r.message,e);break;case"max":e.target==="jsonSchema7"&&Re(n,"maximum",r.value,r.message,e);break}return n},"integerDateParser");function yy(t,e){return N(v({},ke(t.innerType._def,e)),{default:t.defaultValue()})}f(yy,"parseDefaultDef");function my(t,e){return e.effectStrategy==="input"?ke(t.schema._def,e):{}}f(my,"parseEffectsDef");function hy(t){return{type:"string",enum:t.values}}f(hy,"parseEnumDef");var OB=f(t=>"type"in t&&t.type==="string"?!1:"allOf"in t,"isJsonSchema7AllOfType");function Ty(t,e){let n=[ke(t.left._def,N(v({},e),{currentPath:[...e.currentPath,"allOf","0"]})),ke(t.right._def,N(v({},e),{currentPath:[...e.currentPath,"allOf","1"]}))].filter(s=>!!s),r=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return n.forEach(s=>{if(OB(s))o.push(...s.allOf),s.unevaluatedProperties===void 0&&(r=void 0);else{let i=s;if("additionalProperties"in s&&s.additionalProperties===!1){let a=s,{additionalProperties:l}=a;i=dd(a,["additionalProperties"])}else r=void 0;o.push(i)}}),o.length?v({allOf:o},r):void 0}f(Ty,"parseIntersectionDef");function vy(t,e){let n=typeof t.value;return n!=="bigint"&&n!=="number"&&n!=="boolean"&&n!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:n==="bigint"?"integer":n,enum:[t.value]}:{type:n==="bigint"?"integer":n,const:t.value}}f(vy,"parseLiteralDef");function ua(t,e){var n,r,o,s,i;if(e.target==="openApi3"&&((n=t.keyType)==null?void 0:n._def.typeName)==="ZodEnum")return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((l,c)=>{var p;return N(v({},l),{[c]:(p=ke(t.valueType._def,N(v({},e),{currentPath:[...e.currentPath,"properties",c]})))!=null?p:{}})},{}),additionalProperties:!1};let a={type:"object",additionalProperties:(r=ke(t.valueType._def,N(v({},e),{currentPath:[...e.currentPath,"additionalProperties"]})))!=null?r:{}};if(e.target==="openApi3")return a;if(((o=t.keyType)==null?void 0:o._def.typeName)==="ZodString"&&((s=t.keyType._def.checks)!=null&&s.length)){let l=Object.entries(zs(t.keyType._def,e)).reduce((c,[p,y])=>p==="type"?c:N(v({},c),{[p]:y}),{});return N(v({},a),{propertyNames:l})}else if(((i=t.keyType)==null?void 0:i._def.typeName)==="ZodEnum")return N(v({},a),{propertyNames:{enum:t.keyType._def.values}});return a}f(ua,"parseRecordDef");function _y(t,e){if(e.mapStrategy==="record")return ua(t,e);let n=ke(t.keyType._def,N(v({},e),{currentPath:[...e.currentPath,"items","items","0"]}))||{},r=ke(t.valueType._def,N(v({},e),{currentPath:[...e.currentPath,"items","items","1"]}))||{};return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}f(_y,"parseMapDef");function by(t){let e=t.values,r=Object.keys(t.values).filter(s=>typeof e[e[s]]!="number").map(s=>e[s]),o=Array.from(new Set(r.map(s=>typeof s)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:r.filter(s=>typeof s=="string"||typeof s=="number")}}f(by,"parseNativeEnumDef");function wy(){return{not:{}}}f(wy,"parseNeverDef");function Py(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}f(Py,"parseNullDef");var fo={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function xy(t,e){if(e.target==="openApi3")return ad(t,e);let n=t.options instanceof Map?Array.from(t.options.values()):t.options;if(n.every(r=>r._def.typeName in fo&&(!r._def.checks||!r._def.checks.length))){let r=n.reduce((o,s)=>{let i=fo[s._def.typeName];return i&&!o.includes(i)?[...o,i]:o},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){let r=n.reduce((o,s)=>{let i=typeof s._def.value;switch(i){case"string":case"number":case"boolean":return[...o,i];case"bigint":return[...o,"integer"];case"object":if(s._def.value===null)return[...o,"null"];case"symbol":case"undefined":case"function":default:return o}},[]);if(r.length===n.length){let o=r.filter((s,i,a)=>a.indexOf(s)===i);return{type:o.length>1?o:o[0],enum:n.reduce((s,i)=>s.includes(i._def.value)?s:[...s,i._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,o)=>[...r,...o._def.values.filter(s=>!r.includes(s))],[])};return ad(t,e)}f(xy,"parseUnionDef");var ad=f((t,e)=>{let n=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((o,s)=>ke(o._def,N(v({},e),{currentPath:[...e.currentPath,e.unionStrategy,`${s}`]}))).filter(o=>!!o&&(!e.strictUnions||typeof o=="object"&&Object.keys(o).length>0)),r=e.discriminator&&t.typeName==="ZodDiscriminatedUnion"&&typeof t.discriminator=="string"?{discriminator:{propertyName:t.discriminator}}:{};if(n.length)return e.unionStrategy==="anyOf"?v({anyOf:n},r):v({oneOf:n},r)},"asUnionOf");function By(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length)){let r=t.innerType;if(e.target==="openApi3"){let s={type:fo[r._def.typeName],nullable:!0};return Cs(r._def,e,s)}let o={type:[fo[r._def.typeName],"null"]};return Cs(r._def,e,o)}if(e.target==="openApi3"){let r=ke(t.innerType._def,N(v({},e),{currentPath:[...e.currentPath]}));return r&&N(v({},r),{nullable:!0})}let n=ke(t.innerType._def,N(v({},e),{currentPath:[...e.currentPath,"anyOf","0"]}));return n&&{anyOf:[n,{type:"null"}]}}f(By,"parseNullableDef");function Ey(t,e){let n=v({type:"number"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{});if(!t.checks)return n;for(let r of t.checks)switch(r.kind){case"int":n.type="integer",Ws(n,"type",r.message,e);break;case"min":e.target==="jsonSchema7"?r.inclusive?Re(n,"minimum",r.value,r.message,e):Re(n,"exclusiveMinimum",r.value,r.message,e):(r.inclusive||(n.exclusiveMinimum=!0),Re(n,"minimum",r.value,r.message,e));break;case"max":e.target==="jsonSchema7"?r.inclusive?Re(n,"maximum",r.value,r.message,e):Re(n,"exclusiveMaximum",r.value,r.message,e):(r.inclusive||(n.exclusiveMaximum=!0),Re(n,"maximum",r.value,r.message,e));break;case"multipleOf":Re(n,"multipleOf",r.value,r.message,e);break}return n}f(Ey,"parseNumberDef");var RB=f((t,e)=>{var n;return t.unknownKeys instanceof he?(n=ke(t.unknownKeys._def,N(v({},e),{currentPath:[...e.currentPath,"additionalProperties"]})))!=null?n:!0:t.unknownKeys==="passthrough"},"getAdditionalProperties");function Sy(t,e){let n=N(v({type:"object"},Object.entries(t.shape()).reduce((r,[o,s])=>{if(s===void 0||s._def===void 0)return r;let i=ke(s._def,N(v({},e),{currentPath:[...e.currentPath,"properties",o],propertyPath:[...e.currentPath,"properties",o]}));return i===void 0?r:{properties:N(v({},r.properties),{[o]:i}),required:s.isOptional()?r.required:[...r.required,o]}},{properties:{},required:[]})),{additionalProperties:RB(t,e)});return n.required.length||delete n.required,n}f(Sy,"parseObjectDef");var MB=f((t,e)=>{var n;if(e.currentPath.toString()===((n=e.propertyPath)==null?void 0:n.toString()))return ke(t.innerType._def,e);let r=ke(t.innerType._def,N(v({},e),{currentPath:[...e.currentPath,"anyOf","1"]}));return r?{anyOf:[{not:{}},r]}:{}},"parseOptionalDef"),NB=f((t,e)=>{if(e.pipeStrategy==="input")return ke(t.in._def,e);if(e.pipeStrategy==="output")return ke(t.out._def,e);let n=ke(t.in._def,N(v({},e),{currentPath:[...e.currentPath,"allOf","0"]})),r=ke(t.out._def,N(v({},e),{currentPath:[...e.currentPath,"allOf",n?"1":"0"]}));return{allOf:[n,r].filter(o=>o!==void 0)}},"parsePipelineDef");function Iy(t,e){return ke(t.type._def,e)}f(Iy,"parsePromiseDef");function ky(t,e){let r={type:"array",uniqueItems:!0,items:ke(t.valueType._def,N(v({},e),{currentPath:[...e.currentPath,"items"]}))};return t.minSize&&Re(r,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&Re(r,"maxItems",t.maxSize.value,t.maxSize.message,e),r}f(ky,"parseSetDef");function Ay(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((n,r)=>ke(n._def,N(v({},e),{currentPath:[...e.currentPath,"items",`${r}`]}))).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:ke(t.rest._def,N(v({},e),{currentPath:[...e.currentPath,"additionalItems"]}))}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((n,r)=>ke(n._def,N(v({},e),{currentPath:[...e.currentPath,"items",`${r}`]}))).reduce((n,r)=>r===void 0?n:[...n,r],[])}}f(Ay,"parseTupleDef");function Cy(){return{not:{}}}f(Cy,"parseUndefinedDef");function Oy(){return{}}f(Oy,"parseUnknownDef");var DB=f((t,e)=>ke(t.innerType._def,e),"parseReadonlyDef");function Ry(t){return{$ref:t.uri}}f(Ry,"parseRefDef");function ke(t,e,n=!1){let r=e.seen.get(t);if(r&&!n){let i=HB(r,e);if(i!==void 0)return i}let o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);let s=jB(t,t.typeName,e);return s&&Cs(t,e,s),o.jsonSchema=s,s}f(ke,"parseDef");var HB=f((t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:UB(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((n,r)=>e.currentPath[r]===n)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),{}):e.$refStrategy==="seen"?{}:void 0}},"get$ref"),UB=f((t,e)=>{let n=0;for(;n<t.length&&n<e.length&&t[n]===e[n];n++);return[(t.length-n).toString(),...e.slice(n)].join("/")},"getRelativePath"),jB=f((t,e,n)=>{switch(e){case"ZodString":return zs(t,n);case"ZodNumber":return Ey(t,n);case"ZodObject":return Sy(t,n);case"ZodBigInt":return dy(t,n);case"ZodBoolean":return fy(t);case"ZodDate":return gy(t,n);case"ZodUndefined":return Cy();case"ZodNull":return Py(n);case"ZodArray":return cy(t,n);case"ZodUnion":case"ZodDiscriminatedUnion":return xy(t,n);case"ZodIntersection":return Ty(t,n);case"ZodTuple":return Ay(t,n);case"ZodRecord":return ua(t,n);case"ZodRef":return Ry(t);case"ZodLiteral":return vy(t,n);case"ZodEnum":return hy(t);case"ZodNativeEnum":return by(t);case"ZodNullable":return By(t,n);case"ZodOptional":return MB(t,n);case"ZodMap":return _y(t,n);case"ZodSet":return ky(t,n);case"ZodLazy":return ke(t.getter()._def,n);case"ZodPromise":return Iy(t,n);case"ZodNaN":case"ZodNever":return wy();case"ZodEffects":return my(t,n);case"ZodAny":return uy();case"ZodUnknown":return Oy();case"ZodDefault":return yy(t,n);case"ZodBranded":return py(t,n);case"ZodReadonly":return DB(t,n);case"ZodCatch":return AB(t,n);case"ZodPipeline":return NB(t,n);case"ZodFunction":case"ZodVoid":case"ZodSymbol":return;default:return(r=>{})(e)}},"selectParser"),Cs=f((t,e,n)=>(t.description&&(n.description=t.description,e.markdownDescription&&(n.markdownDescription=t.description)),Object.assign(n,{[le]:v(v({},t[le]),n[le])}),n),"addMeta"),ld={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"string",mapStrategy:"entries",definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",emailStrategy:"format:email",discriminator:!1,unionStrategy:"anyOf"},$B=f(t=>typeof t=="string"?N(v({},ld),{name:t}):v(v({},ld),t),"getDefaultOptions"),ZB=f(t=>{let e=$B(t),n=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return N(v({},e),{currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([r,o])=>[o._def,{def:o._def,path:[...e.basePath,e.definitionPath,r],jsonSchema:void 0}]))})},"getRefs"),KB=f((t,e)=>{var n;let r=ZB(e),o=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[c,p])=>{var y;return N(v({},l),{[c]:(y=ke(p._def,N(v({},r),{currentPath:[...r.basePath,r.definitionPath,c]}),!0))!=null?y:{}})},{}):void 0,s=typeof e=="string"?e:e?.name,i=(n=ke(t._def,s===void 0?r:N(v({},r),{currentPath:[...r.basePath,r.definitionPath,s]}),!1))!=null?n:{},a=s===void 0?o?N(v({},i),{[r.definitionPath]:o}):i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,s].join("/"),[r.definitionPath]:N(v({},o),{[s]:i})};return r.target==="jsonSchema7"?a.$schema="http://json-schema.org/draft-07/schema#":r.target==="jsonSchema2019-09"&&(a.$schema="https://json-schema.org/draft/2019-09/schema#"),a},"zodToJsonSchema"),LB=f((t,e={target:"openApi3"})=>{let n=KB(t,e);return e.$schemaUrl===!1?delete n.$schema:typeof e.$schemaUrl=="string"&&(n.$schema=e.$schemaUrl),n},"toJSONSchemaLegacy");var Qr=(t,e)=>{let n=t._def,r=e._def;if(n.typeName===X.ZodFirstPartyTypeKind.ZodObject&&r.typeName===X.ZodFirstPartyTypeKind.ZodObject){let o=n.shape(),s=r.shape();return X.object({...o,...s})}if(n.typeName===X.ZodFirstPartyTypeKind.ZodRecord&&r.typeName===X.ZodFirstPartyTypeKind.ZodRecord)return X.record(X.intersection(n.valueType,r.valueType));throw new Error("Cannot merge object schemas with record schemas")},My=X;var mt=X.string().min(1),Dy=X.object({text:mt}),Hy=X.object({markdown:mt}),Uy=X.object({imageUrl:mt}),jy=X.object({audioUrl:mt}),$y=X.object({videoUrl:mt}),Zy=X.object({fileUrl:mt,title:mt.optional()}),Ky=X.object({latitude:X.number(),longitude:X.number(),address:X.string().optional(),title:X.string().optional()}),Ly=X.object({title:mt,subtitle:mt.optional(),imageUrl:mt.optional(),actions:X.array(X.object({action:X.enum(["postback","url","say"]),label:mt,value:mt}))}),Ny=X.object({text:mt,options:X.array(X.object({label:mt,value:mt}))}),FB=X.object({items:X.array(Ly)}),Fy=X.union([X.object({type:X.literal("text"),payload:Dy}),X.object({type:X.literal("image"),payload:Uy}),X.object({type:X.literal("audio"),payload:jy}),X.object({type:X.literal("video"),payload:$y}),X.object({type:X.literal("file"),payload:Zy}),X.object({type:X.literal("location"),payload:Ky})]),WB=X.object({items:X.array(Fy)}),zB={schema:Hy},qB={schema:X.object({items:X.array(X.union([...Fy.options,X.object({type:X.literal("markdown"),payload:Hy})]))})},GB={text:{schema:Dy},image:{schema:Uy},audio:{schema:jy},video:{schema:$y},file:{schema:Zy},location:{schema:Ky},carousel:{schema:FB},card:{schema:Ly},dropdown:{schema:Ny},choice:{schema:Ny},bloc:{schema:WB}};I();A();k();var yC={HIDDEN_IN_STUDIO:{bpActionHiddenInStudio:"true"},AWAIT_RETURN:{bpActionAwaitReturn:"true"}};I();A();k();import{isNode as VI}from"browser-or-node";I();A();k();var ca=console;function Dt(t){if(!t.body)throw new Error("Missing body");return JSON.parse(t.body)}async function Jo(t,e=8072,n=QI){if(!VI)throw new Error("This function can only be called in Node.js");let o=(Lh(),XT(Kh)).createServer(async(s,i)=>{try{let a=await JI(s);if(a.path==="/health"){i.writeHead(200).end("ok");return}let l=await t(a);i.writeHead(l?.status??200,l?.headers??{}).end(l?.body??"{}")}catch(a){let l=a instanceof Error?a.message:String(a);ca.error("Error while handling request",{error:l??"Internal error occured"}),i.writeHead(500).end(JSON.stringify({error:l??"Internal error occured"}))}});return o.listen(e,()=>n(e)),o}async function JI(t){let e=await XI(t),n={};for(let o=0;o<t.rawHeaders.length;o+=2){let s=t.rawHeaders[o].toLowerCase(),i=t.rawHeaders[o+1];n[s]=i}let r=new URL(t.url??"",t.headers.host?`http://${t.headers.host}`:"http://botpress.cloud");return{body:e,path:r.pathname,query:YI(r.search,"?"),headers:n,method:t.method?.toUpperCase()??"GET"}}function YI(t,e){return t.indexOf(e)===0?t.slice(e.length):t}async function XI(t){return new Promise((e,n)=>{if(t.method!=="POST"&&t.method!=="PUT"&&t.method!=="PATCH")return e(void 0);let r="";t.on("data",o=>r+=o.toString()),t.on("error",o=>n(o)),t.on("end",()=>e(r))})}function QI(t){ca.info(`Listening on port ${t}`)}import{isApiError as Lj,RuntimeError as Fj}from"@botpress/client";I();A();k();I();A();k();I();A();k();I();A();k();var Le={};bn(Le,{mapKeys:()=>nk,mapValues:()=>tk,mergeRecords:()=>ik,pairs:()=>Yo,stripUndefinedProps:()=>rk,values:()=>ek});I();A();k();var Yo=t=>Object.entries(t),ek=t=>Object.values(t),tk=(t,e)=>Object.fromEntries(Yo(t).map(([n,r])=>[n,e(r,n)])),nk=(t,e)=>Object.fromEntries(Yo(t).map(([n,r])=>[e(n),r])),rk=t=>Object.fromEntries(Yo(t).filter(([,e])=>e!==void 0)),ik=(t,e,n)=>{let r=[...Object.keys(t),...Object.keys(e)],o=[...new Set(r)],s={};for(let i of o){let a=t[i],l=e[i];a&&l?s[i]=n(a,l):a?s[i]=a:l&&(s[i]=l)}return s};var ye={};bn(ye,{safePush:()=>ok,unique:()=>sk});I();A();k();var ok=(t,...e)=>t?[...t,...e]:[...e],sk=t=>Array.from(new Set(t));I();A();k();var dt={};bn(dt,{setName:()=>ak});I();A();k();var ak=(t,e)=>(Object.defineProperty(t,"name",{value:e}),t);var Fh=t=>{let{name:e,version:n}=t,r={actions:{},events:{},channels:{}},o={name:e,version:n,entities:Le.mapValues(t.entities,i=>({name:i.name})),actions:{},events:{},channels:{}},s=Le.mapValues(t.entities,i=>i.schema);for(let[i,a]of Object.entries(t.definition.actions??{})){let l=a.input.schema.dereference(s),c=a.output.schema.dereference(s),p=t.actions?.[i]?.name??i;r.actions[p]={...a,...t.actions?.[i]??{},input:{schema:l},output:{schema:c}},o.actions[i]={name:p}}for(let[i,a]of Object.entries(t.definition.events??{})){let l=a.schema.dereference(s),c=t.events?.[i]?.name??i;r.events[c]={...a,...t.events?.[i]??{},schema:l},o.events[i]={name:c}}for(let[i,a]of Object.entries(t.definition.channels??{})){let l={};for(let[p,y]of Object.entries(a.messages)){let g=y.schema.dereference(s);l[p]={...y,schema:g}}let c=t.channels?.[i]?.name??i;r.channels[c]={...a,...t.channels?.[i]??{},message:{...a.message??{},tags:{...a.message?.tags??{},...t.channels?.[i]?.message?.tags??{}}},conversation:{...a.conversation??{},tags:{...a.conversation?.tags??{},...t.channels?.[i]?.conversation?.tags??{}}},messages:l},o.channels[i]={name:c}}return{resolved:r,statement:o}};I();A();k();var Wh="5.0.2";var _n=Wh;I();A();k();var Xo=Symbol("schemaName"),zh=t=>t?Le.mapValues(t,(n,r)=>({...n,[Xo]:r})):{},qh=t=>Xo in t&&t[Xo]!==void 0,Gh=t=>t[Xo];I();A();k();var al=class{constructor(e){this.props=e;this.name=e.name,this.version=e.version,this.icon=e.icon,this.readme=e.readme,this.title=e.title,this.identifier=e.identifier,this.description=e.description,this.configuration=e.configuration,this.configurations=e.configurations,this.events=e.events,this.actions=e.actions,this.channels=e.channels,this.states=e.states,this.user=e.user,this.secrets=e.secrets,this.entities=e.entities,this.interfaces=e.interfaces,this.__advanced=e.__advanced,this.attributes=e.attributes}name;version;title;description;icon;readme;configuration;configurations;events;actions;channels;states;user;secrets;identifier;entities;interfaces;__advanced;attributes;get metadata(){return{sdkVersion:_n}}extend(e,n){let{entities:r,actions:o,events:s,channels:i}=this._callBuilder(e,n),a=this;a.interfaces??={};let l=Object.values(r).map(g=>g.name),c=l.length===0?e.name:`${e.name}<${l.join(",")}>`,{resolved:p,statement:y}=Fh({...e,entities:r,actions:Le.stripUndefinedProps(o),events:Le.stripUndefinedProps(s),channels:Le.stripUndefinedProps(i)});return a.actions=Le.mergeRecords(a.actions??{},p.actions,this._mergeActions),a.channels=Le.mergeRecords(a.channels??{},p.channels,this._mergeChannels),a.events=Le.mergeRecords(a.events??{},p.events,this._mergeEvents),a.interfaces[c]={id:e.id,...y},this}_callBuilder(e,n){let o={entities:zh(this.entities)},s=n(o),i=Le.pairs(s.entities).find(([l,c])=>!qh(c));if(i)throw new Error(`Cannot extend interface "${e.name}" with entity "${i[0]}"; the provided schema is not part of the integration's entities.`);return{entities:Le.mapValues(s.entities,l=>({name:Gh(l),schema:l.schema})),actions:s.actions??{},events:s.events??{},channels:s.channels??{}}}_mergeActions=(e,n)=>({...e,...n,input:{schema:Qr(e.input.schema,n.input.schema)},output:{schema:Qr(e.output.schema,n.output.schema)}});_mergeEvents=(e,n)=>({...e,...n,schema:Qr(e.schema,n.schema)});_mergeChannels=(e,n)=>{let r=Le.mergeRecords(e.messages,n.messages,this._mergeMessage),o;(e.conversation||n.conversation)&&(o={tags:{...e.conversation?.tags,...n.conversation?.tags}});let s;return(e.message||n.message)&&(s={tags:{...e.message?.tags,...n.message?.tags}}),{...e,...n,messages:r,conversation:o,message:s}};_mergeMessage=(e,n)=>({schema:Qr(e.schema,n.schema)})};I();A();k();I();A();k();import{isApiError as Uk,Client as jk,RuntimeError as UT,InvalidPayloadError as $k}from"@botpress/client";I();A();k();import*as Vh from"@botpress/client";var Qo={retries:3,retryCondition:t=>Vh.axiosRetry.isNetworkOrIdempotentRequestError(t)||[429,502].includes(t.response?.status??0),retryDelay:(t,e)=>(uk(e.response?.headers??{})??t)*1e3},uk=t=>{let e=["RateLimit-Reset","X-RateLimit-Reset","Retry-After","ratelimit-reset","x-ratelimit-reset","retry-after"];for(let n of e){let r=t[n];if(r!==void 0)return ck(String(r))}},ck=t=>{let e=dk(t)?fk(t):t.length>0?parseInt(t,10):void 0;return e===void 0||isNaN(e)?void 0:e},dk=t=>t.includes(" "),fk=t=>{let e=pk(t);if(!e)return;let n=new Date;return Math.max(0,Math.floor((e.getTime()-n.getTime())/1e3))},pk=t=>{let e=new Date(t);return isNaN(e.getTime())?void 0:e};I();A();k();I();A();k();var li=class{constructor(e){this._client=e}get _inner(){return this._client}createConversation=(e=>this._client.createConversation(e));getConversation=(e=>this._client.getConversation(e));listConversations=(e=>this._client.listConversations(e));getOrCreateConversation=(e=>this._client.getOrCreateConversation(e));updateConversation=(e=>this._client.updateConversation(e));deleteConversation=(e=>this._client.deleteConversation(e));listParticipants=(e=>this._client.listParticipants(e));addParticipant=(e=>this._client.addParticipant(e));getParticipant=(e=>this._client.getParticipant(e));removeParticipant=(e=>this._client.removeParticipant(e));createEvent=(e=>this._client.createEvent(e));getEvent=(e=>this._client.getEvent(e));listEvents=(e=>this._client.listEvents(e));createMessage=(e=>this._client.createMessage(e));getOrCreateMessage=(e=>this._client.getOrCreateMessage(e));getMessage=(e=>this._client.getMessage(e).then(n=>n));updateMessage=(e=>this._client.updateMessage(e).then(n=>n));listMessages=(e=>this._client.listMessages(e));deleteMessage=(e=>this._client.deleteMessage(e));createUser=(e=>this._client.createUser(e));getUser=(e=>this._client.getUser(e));listUsers=e=>this._client.listUsers(e);getOrCreateUser=(e=>this._client.getOrCreateUser(e));updateUser=(e=>this._client.updateUser(e));deleteUser=e=>this._client.deleteUser(e);getState=(e=>this._client.getState(e));setState=(e=>this._client.setState(e));getOrSetState=(e=>this._client.getOrSetState(e));patchState=(e=>this._client.patchState(e));configureIntegration=e=>this._client.configureIntegration(e);uploadFile=e=>this._client.uploadFile(e);upsertFile=e=>this._client.upsertFile(e);deleteFile=e=>this._client.deleteFile(e);listFiles=e=>this._client.listFiles(e);getFile=e=>this._client.getFile(e);updateFileMetadata=e=>this._client.updateFileMetadata(e);trackAnalytics=e=>this._client.trackAnalytics(e)};I();A();k();var es=class{_cost=0;get cost(){return this._cost}setCost(e){this._cost=e}toJSON(){return{cost:this.cost}}};I();A();k();I();A();k();var Ht="#",ts="x-bot-id",Jh="x-bot-user-id",Yh="x-integration-id",Xh="x-integration-alias",Qh="x-webhook-id",eT="x-bp-configuration-type",ns="x-bp-configuration",rs="x-bp-operation",tT="x-bp-type";I();A();k();var At=t=>{throw t instanceof Error?t:new Error(t)};var t0=X.enum(["webhook_received","message_created","action_triggered","register","unregister","ping","create_user","create_conversation"]),nT=t=>({botId:t[ts]||At("Missing bot header"),botUserId:t[Jh]||At("Missing bot user header"),integrationId:t[Yh]||At("Missing integration header"),integrationAlias:t[Xh]||At("Missing integration alias header"),webhookId:t[Qh]||At("Missing webhook header"),operation:t[rs]||At("Missing operation header"),configurationType:t[eT]??null,configuration:JSON.parse(q.from(t[ns]||At("Missing configuration header"),"base64").toString("utf-8"))});I();A();k();I();A();k();I();A();k();I();A();k();var ul={},rT=!1;function kl(){return rT||(rT=!0,ul=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},n=Symbol("test"),r=Object(n);if(typeof n=="string"||Object.prototype.toString.call(n)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var o=42;e[n]=o;for(n in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==n||!Object.prototype.propertyIsEnumerable.call(e,n))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var i=Object.getOwnPropertyDescriptor(e,n);if(i.value!==o||i.enumerable!==!0)return!1}return!0}),ul}var cl={},iT=!1;function gk(){return iT||(iT=!0,cl=Error),cl}var dl={},oT=!1;function yk(){return oT||(oT=!0,dl=EvalError),dl}var fl={},sT=!1;function mk(){return sT||(sT=!0,fl=RangeError),fl}var pl={},aT=!1;function hk(){return aT||(aT=!0,pl=ReferenceError),pl}var gl={},lT=!1;function xT(){return lT||(lT=!0,gl=SyntaxError),gl}var yl={},uT=!1;function is(){return uT||(uT=!0,yl=TypeError),yl}var ml={},cT=!1;function Tk(){return cT||(cT=!0,ml=URIError),ml}var hl={},dT=!1;function vk(){if(dT)return hl;dT=!0;var t=typeof Symbol<"u"&&Symbol,e=kl();return hl=function(){return typeof t!="function"||typeof Symbol!="function"||typeof t("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},hl}var Tl={},fT=!1;function _k(){if(fT)return Tl;fT=!0;var t={__proto__:null,foo:{}},e=Object;return Tl=function(){return{__proto__:t}.foo===t.foo&&!(t instanceof e)},Tl}var vl={},pT=!1;function bk(){if(pT)return vl;pT=!0;var t="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,n=Math.max,r="[object Function]",o=function(l,c){for(var p=[],y=0;y<l.length;y+=1)p[y]=l[y];for(var g=0;g<c.length;g+=1)p[g+l.length]=c[g];return p},s=function(l,c){for(var p=[],y=c,g=0;y<l.length;y+=1,g+=1)p[g]=l[y];return p},i=function(a,l){for(var c="",p=0;p<a.length;p+=1)c+=a[p],p+1<a.length&&(c+=l);return c};return vl=function(l){var c=this;if(typeof c!="function"||e.apply(c)!==r)throw new TypeError(t+c);for(var p=s(arguments,1),y,g=function(){if(this instanceof y){var _=c.apply(this,o(p,arguments));return Object(_)===_?_:this}return c.apply(l,o(p,arguments))},h=n(0,c.length-p.length),T=[],x=0;x<h;x++)T[x]="$"+x;if(y=Function("binder","return function ("+i(T,",")+"){ return binder.apply(this,arguments); }")(g),c.prototype){var B=function(){};B.prototype=c.prototype,y.prototype=new B,B.prototype=null}return y},vl}var _l={},gT=!1;function Al(){if(gT)return _l;gT=!0;var t=bk();return _l=Function.prototype.bind||t,_l}var bl={},yT=!1;function wk(){if(yT)return bl;yT=!0;var t=Function.prototype.call,e=Object.prototype.hasOwnProperty,n=Al();return bl=n.call(t,e),bl}var wl={},mT=!1;function ci(){if(mT)return wl;mT=!0;var t,e=gk(),n=yk(),r=mk(),o=hk(),s=xT(),i=is(),a=Tk(),l=Function,c=function(Ue){try{return l('"use strict"; return ('+Ue+").constructor;")()}catch{}},p=Object.getOwnPropertyDescriptor;if(p)try{p({},"")}catch{p=null}var y=function(){throw new i},g=p?(function(){try{return arguments.callee,y}catch{try{return p(arguments,"callee").get}catch{return y}}})():y,h=vk()(),T=_k()(),x=Object.getPrototypeOf||(T?function(Ue){return Ue.__proto__}:null),B={},_=typeof Uint8Array>"u"||!x?t:x(Uint8Array),S={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?t:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?t:ArrayBuffer,"%ArrayIteratorPrototype%":h&&x?x([][Symbol.iterator]()):t,"%AsyncFromSyncIteratorPrototype%":t,"%AsyncFunction%":B,"%AsyncGenerator%":B,"%AsyncGeneratorFunction%":B,"%AsyncIteratorPrototype%":B,"%Atomics%":typeof Atomics>"u"?t:Atomics,"%BigInt%":typeof BigInt>"u"?t:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?t:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?t:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?t:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":e,"%eval%":eval,"%EvalError%":n,"%Float32Array%":typeof Float32Array>"u"?t:Float32Array,"%Float64Array%":typeof Float64Array>"u"?t:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?t:FinalizationRegistry,"%Function%":l,"%GeneratorFunction%":B,"%Int8Array%":typeof Int8Array>"u"?t:Int8Array,"%Int16Array%":typeof Int16Array>"u"?t:Int16Array,"%Int32Array%":typeof Int32Array>"u"?t:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":h&&x?x(x([][Symbol.iterator]())):t,"%JSON%":typeof JSON=="object"?JSON:t,"%Map%":typeof Map>"u"?t:Map,"%MapIteratorPrototype%":typeof Map>"u"||!h||!x?t:x(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?t:Promise,"%Proxy%":typeof Proxy>"u"?t:Proxy,"%RangeError%":r,"%ReferenceError%":o,"%Reflect%":typeof Reflect>"u"?t:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?t:Set,"%SetIteratorPrototype%":typeof Set>"u"||!h||!x?t:x(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?t:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":h&&x?x(""[Symbol.iterator]()):t,"%Symbol%":h?Symbol:t,"%SyntaxError%":s,"%ThrowTypeError%":g,"%TypedArray%":_,"%TypeError%":i,"%Uint8Array%":typeof Uint8Array>"u"?t:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?t:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?t:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?t:Uint32Array,"%URIError%":a,"%WeakMap%":typeof WeakMap>"u"?t:WeakMap,"%WeakRef%":typeof WeakRef>"u"?t:WeakRef,"%WeakSet%":typeof WeakSet>"u"?t:WeakSet};if(x)try{null.error}catch(Ue){var E=x(x(Ue));S["%Error.prototype%"]=E}var H=function Ue(xe){var Se;if(xe==="%AsyncFunction%")Se=c("async function () {}");else if(xe==="%GeneratorFunction%")Se=c("function* () {}");else if(xe==="%AsyncGeneratorFunction%")Se=c("async function* () {}");else if(xe==="%AsyncGenerator%"){var de=Ue("%AsyncGeneratorFunction%");de&&(Se=de.prototype)}else if(xe==="%AsyncIteratorPrototype%"){var Te=Ue("%AsyncGenerator%");Te&&x&&(Se=x(Te.prototype))}return S[xe]=Se,Se},Z={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},re=Al(),ee=wk(),ge=re.call(Function.call,Array.prototype.concat),se=re.call(Function.apply,Array.prototype.splice),ie=re.call(Function.call,String.prototype.replace),Oe=re.call(Function.call,String.prototype.slice),ze=re.call(Function.call,RegExp.prototype.exec),nt=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Ve=/\\(\\)?/g,Je=function(xe){var Se=Oe(xe,0,1),de=Oe(xe,-1);if(Se==="%"&&de!=="%")throw new s("invalid intrinsic syntax, expected closing `%`");if(de==="%"&&Se!=="%")throw new s("invalid intrinsic syntax, expected opening `%`");var Te=[];return ie(xe,nt,function(D,K,F,fe){Te[Te.length]=F?ie(fe,Ve,"$1"):K||D}),Te},Tt=function(xe,Se){var de=xe,Te;if(ee(Z,de)&&(Te=Z[de],de="%"+Te[0]+"%"),ee(S,de)){var D=S[de];if(D===B&&(D=H(de)),typeof D>"u"&&!Se)throw new i("intrinsic "+xe+" exists, but is not available. Please file an issue!");return{alias:Te,name:de,value:D}}throw new s("intrinsic "+xe+" does not exist!")};return wl=function(xe,Se){if(typeof xe!="string"||xe.length===0)throw new i("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof Se!="boolean")throw new i('"allowMissing" argument must be a boolean');if(ze(/^%?[^%]*%?$/,xe)===null)throw new s("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var de=Je(xe),Te=de.length>0?de[0]:"",D=Tt("%"+Te+"%",Se),K=D.name,F=D.value,fe=!1,ve=D.alias;ve&&(Te=ve[0],se(de,ge([0,1],ve)));for(var M=1,C=!0;M<de.length;M+=1){var $=de[M],Y=Oe($,0,1),oe=Oe($,-1);if((Y==='"'||Y==="'"||Y==="`"||oe==='"'||oe==="'"||oe==="`")&&Y!==oe)throw new s("property names with quotes must have matching quotes");if(($==="constructor"||!C)&&(fe=!0),Te+="."+$,K="%"+Te+"%",ee(S,K))F=S[K];else if(F!=null){if(!($ in F)){if(!Se)throw new i("base intrinsic for "+xe+" exists, but the property is not available.");return}if(p&&M+1>=de.length){var w=p(F,$);C=!!w,C&&"get"in w&&!("originalValue"in w.get)?F=w.get:F=F[$]}else C=ee(F,$),F=F[$];C&&!fe&&(S[K]=F)}}return F},wl}var Pl={},hT=!1;function Cl(){if(hT)return Pl;hT=!0;var t=ci(),e=t("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return Pl=e,Pl}var xl={},TT=!1;function os(){if(TT)return xl;TT=!0;var t=ci(),e=t("%Object.getOwnPropertyDescriptor%",!0);if(e)try{e([],"length")}catch{e=null}return xl=e,xl}var Bl={},vT=!1;function Pk(){if(vT)return Bl;vT=!0;var t=Cl(),e=xT(),n=is(),r=os();return Bl=function(s,i,a){if(!s||typeof s!="object"&&typeof s!="function")throw new n("`obj` must be an object or a function`");if(typeof i!="string"&&typeof i!="symbol")throw new n("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new n("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new n("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new n("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new n("`loose`, if provided, must be a boolean");var l=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,p=arguments.length>5?arguments[5]:null,y=arguments.length>6?arguments[6]:!1,g=!!r&&r(s,i);if(t)t(s,i,{configurable:p===null&&g?g.configurable:!p,enumerable:l===null&&g?g.enumerable:!l,value:a,writable:c===null&&g?g.writable:!c});else if(y||!l&&!c&&!p)s[i]=a;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Bl}var El={},_T=!1;function xk(){if(_T)return El;_T=!0;var t=Cl(),e=function(){return!!t};return e.hasArrayLengthDefineBug=function(){if(!t)return null;try{return t([],"length",{value:1}).length!==1}catch{return!0}},El=e,El}var Sl={},bT=!1;function Bk(){if(bT)return Sl;bT=!0;var t=ci(),e=Pk(),n=xk()(),r=os(),o=is(),s=t("%Math.floor%");return Sl=function(a,l){if(typeof a!="function")throw new o("`fn` is not a function");if(typeof l!="number"||l<0||l>4294967295||s(l)!==l)throw new o("`length` must be a positive 32-bit integer");var c=arguments.length>2&&!!arguments[2],p=!0,y=!0;if("length"in a&&r){var g=r(a,"length");g&&!g.configurable&&(p=!1),g&&!g.writable&&(y=!1)}return(p||y||!c)&&(n?e(a,"length",l,!0,!0):e(a,"length",l)),a},Sl}var ui={},wT=!1;function Ol(){if(wT)return ui;wT=!0;var t=Al(),e=ci(),n=Bk(),r=is(),o=e("%Function.prototype.apply%"),s=e("%Function.prototype.call%"),i=e("%Reflect.apply%",!0)||t.call(s,o),a=Cl(),l=e("%Math.max%");ui=function(y){if(typeof y!="function")throw new r("a function is required");var g=i(t,s,arguments);return n(g,1+l(0,y.length-(arguments.length-1)),!0)};var c=function(){return i(t,o,arguments)};return a?a(ui,"apply",{value:c}):ui.apply=c,ui}var Il={},PT=!1;function Rl(){if(PT)return Il;PT=!0;var t=ci(),e=Ol(),n=e(t("String.prototype.indexOf"));return Il=function(o,s){var i=t(o,!!s);return typeof i=="function"&&n(o,".prototype.")>-1?e(i):i},Il}da();Ia();var Ml={},BT=!1;function Fl(){if(BT)return Ml;BT=!0;var t=kl();return Ml=function(){return t()&&!!Symbol.toStringTag},Ml}var Nl={},ET=!1;function Ek(){if(ET)return Nl;ET=!0;var t=Fl()(),e=Rl(),n=e("Object.prototype.toString"),r=function(a){return t&&a&&typeof a=="object"&&Symbol.toStringTag in a?!1:n(a)==="[object Arguments]"},o=function(a){return r(a)?!0:a!==null&&typeof a=="object"&&typeof a.length=="number"&&a.length>=0&&n(a)!=="[object Array]"&&n(a.callee)==="[object Function]"},s=(function(){return r(arguments)})();return r.isLegacyArguments=o,Nl=s?r:o,Nl}var Dl={},ST=!1;function Sk(){if(ST)return Dl;ST=!0;var t=Object.prototype.toString,e=Function.prototype.toString,n=/^\s*(?:function)?\*/,r=Fl()(),o=Object.getPrototypeOf,s=function(){if(!r)return!1;try{return Function("return function*() {}")()}catch{}},i;return Dl=function(l){if(typeof l!="function")return!1;if(n.test(e.call(l)))return!0;if(!r){var c=t.call(l);return c==="[object GeneratorFunction]"}if(!o)return!1;if(typeof i>"u"){var p=s();i=p?o(p):!1}return o(l)===i},Dl}var Hl={},IT=!1;function Ik(){if(IT)return Hl;IT=!0;var t=Function.prototype.toString,e=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,n,r;if(typeof e=="function"&&typeof Object.defineProperty=="function")try{n=Object.defineProperty({},"length",{get:function(){throw r}}),r={},e(function(){throw 42},null,n)}catch(S){S!==r&&(e=null)}else e=null;var o=/^\s*class\b/,s=function(E){try{var H=t.call(E);return o.test(H)}catch{return!1}},i=function(E){try{return s(E)?!1:(t.call(E),!0)}catch{return!1}},a=Object.prototype.toString,l="[object Object]",c="[object Function]",p="[object GeneratorFunction]",y="[object HTMLAllCollection]",g="[object HTML document.all class]",h="[object HTMLCollection]",T=typeof Symbol=="function"&&!!Symbol.toStringTag,x=!(0 in[,]),B=function(){return!1};if(typeof document=="object"){var _=document.all;a.call(_)===a.call(document.all)&&(B=function(E){if((x||!E)&&(typeof E>"u"||typeof E=="object"))try{var H=a.call(E);return(H===y||H===g||H===h||H===l)&&E("")==null}catch{}return!1})}return Hl=e?function(E){if(B(E))return!0;if(!E||typeof E!="function"&&typeof E!="object")return!1;try{e(E,null,n)}catch(H){if(H!==r)return!1}return!s(E)&&i(E)}:function(E){if(B(E))return!0;if(!E||typeof E!="function"&&typeof E!="object")return!1;if(T)return i(E);if(s(E))return!1;var H=a.call(E);return H!==c&&H!==p&&!/^\[object HTML/.test(H)?!1:i(E)},Hl}var Ul={},kT=!1;function kk(){if(kT)return Ul;kT=!0;var t=Ik(),e=Object.prototype.toString,n=Object.prototype.hasOwnProperty,r=function(l,c,p){for(var y=0,g=l.length;y<g;y++)n.call(l,y)&&(p==null?c(l[y],y,l):c.call(p,l[y],y,l))},o=function(l,c,p){for(var y=0,g=l.length;y<g;y++)p==null?c(l.charAt(y),y,l):c.call(p,l.charAt(y),y,l)},s=function(l,c,p){for(var y in l)n.call(l,y)&&(p==null?c(l[y],y,l):c.call(p,l[y],y,l))},i=function(l,c,p){if(!t(c))throw new TypeError("iterator must be a function");var y;arguments.length>=3&&(y=p),e.call(l)==="[object Array]"?r(l,c,y):typeof l=="string"?o(l,c,y):s(l,c,y)};return Ul=i,Ul}var jl={},AT=!1;function Ak(){return AT||(AT=!0,jl=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),jl}var $l={},CT=!1,Ck=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function Ok(){if(CT)return $l;CT=!0;var t=Ak(),e=typeof globalThis>"u"?Ck:globalThis;return $l=function(){for(var r=[],o=0;o<t.length;o++)typeof e[t[o]]=="function"&&(r[r.length]=t[o]);return r},$l}var Zl={},OT=!1,Rk=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function HT(){if(OT)return Zl;OT=!0;var t=kk(),e=Ok(),n=Ol(),r=Rl(),o=os(),s=r("Object.prototype.toString"),i=Fl()(),a=typeof globalThis>"u"?Rk:globalThis,l=e(),c=r("String.prototype.slice"),p=Object.getPrototypeOf,y=r("Array.prototype.indexOf",!0)||function(B,_){for(var S=0;S<B.length;S+=1)if(B[S]===_)return S;return-1},g={__proto__:null};i&&o&&p?t(l,function(x){var B=new a[x];if(Symbol.toStringTag in B){var _=p(B),S=o(_,Symbol.toStringTag);if(!S){var E=p(_);S=o(E,Symbol.toStringTag)}g["$"+x]=n(S.get)}}):t(l,function(x){var B=new a[x],_=B.slice||B.set;_&&(g["$"+x]=n(_))});var h=function(B){var _=!1;return t(g,function(S,E){if(!_)try{"$"+S(B)===E&&(_=c(E,1))}catch{}}),_},T=function(B){var _=!1;return t(g,function(S,E){if(!_)try{S(B),_=c(E,1)}catch{}}),_};return Zl=function(B){if(!B||typeof B!="object")return!1;if(!i){var _=c(s(B),8,-1);return y(l,_)>-1?_:_!=="Object"?!1:T(B)}return o?h(B):null},Zl}var Kl={},RT=!1;function Mk(){if(RT)return Kl;RT=!0;var t=HT();return Kl=function(n){return!!t(n)},Kl}var we={},MT=!1;function Nk(){if(MT)return we;MT=!0;var t=Ek(),e=Sk(),n=HT(),r=Mk();function o(j){return j.call.bind(j)}var s=typeof BigInt<"u",i=typeof Symbol<"u",a=o(Object.prototype.toString),l=o(Number.prototype.valueOf),c=o(String.prototype.valueOf),p=o(Boolean.prototype.valueOf);if(s)var y=o(BigInt.prototype.valueOf);if(i)var g=o(Symbol.prototype.valueOf);function h(j,Rt){if(typeof j!="object")return!1;try{return Rt(j),!0}catch{return!1}}we.isArgumentsObject=t,we.isGeneratorFunction=e,we.isTypedArray=r;function T(j){return typeof Promise<"u"&&j instanceof Promise||j!==null&&typeof j=="object"&&typeof j.then=="function"&&typeof j.catch=="function"}we.isPromise=T;function x(j){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(j):r(j)||D(j)}we.isArrayBufferView=x;function B(j){return n(j)==="Uint8Array"}we.isUint8Array=B;function _(j){return n(j)==="Uint8ClampedArray"}we.isUint8ClampedArray=_;function S(j){return n(j)==="Uint16Array"}we.isUint16Array=S;function E(j){return n(j)==="Uint32Array"}we.isUint32Array=E;function H(j){return n(j)==="Int8Array"}we.isInt8Array=H;function Z(j){return n(j)==="Int16Array"}we.isInt16Array=Z;function re(j){return n(j)==="Int32Array"}we.isInt32Array=re;function ee(j){return n(j)==="Float32Array"}we.isFloat32Array=ee;function ge(j){return n(j)==="Float64Array"}we.isFloat64Array=ge;function se(j){return n(j)==="BigInt64Array"}we.isBigInt64Array=se;function ie(j){return n(j)==="BigUint64Array"}we.isBigUint64Array=ie;function Oe(j){return a(j)==="[object Map]"}Oe.working=typeof Map<"u"&&Oe(new Map);function ze(j){return typeof Map>"u"?!1:Oe.working?Oe(j):j instanceof Map}we.isMap=ze;function nt(j){return a(j)==="[object Set]"}nt.working=typeof Set<"u"&&nt(new Set);function Ve(j){return typeof Set>"u"?!1:nt.working?nt(j):j instanceof Set}we.isSet=Ve;function Je(j){return a(j)==="[object WeakMap]"}Je.working=typeof WeakMap<"u"&&Je(new WeakMap);function Tt(j){return typeof WeakMap>"u"?!1:Je.working?Je(j):j instanceof WeakMap}we.isWeakMap=Tt;function Ue(j){return a(j)==="[object WeakSet]"}Ue.working=typeof WeakSet<"u"&&Ue(new WeakSet);function xe(j){return Ue(j)}we.isWeakSet=xe;function Se(j){return a(j)==="[object ArrayBuffer]"}Se.working=typeof ArrayBuffer<"u"&&Se(new ArrayBuffer);function de(j){return typeof ArrayBuffer>"u"?!1:Se.working?Se(j):j instanceof ArrayBuffer}we.isArrayBuffer=de;function Te(j){return a(j)==="[object DataView]"}Te.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&Te(new DataView(new ArrayBuffer(1),0,1));function D(j){return typeof DataView>"u"?!1:Te.working?Te(j):j instanceof DataView}we.isDataView=D;var K=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function F(j){return a(j)==="[object SharedArrayBuffer]"}function fe(j){return typeof K>"u"?!1:(typeof F.working>"u"&&(F.working=F(new K)),F.working?F(j):j instanceof K)}we.isSharedArrayBuffer=fe;function ve(j){return a(j)==="[object AsyncFunction]"}we.isAsyncFunction=ve;function M(j){return a(j)==="[object Map Iterator]"}we.isMapIterator=M;function C(j){return a(j)==="[object Set Iterator]"}we.isSetIterator=C;function $(j){return a(j)==="[object Generator]"}we.isGeneratorObject=$;function Y(j){return a(j)==="[object WebAssembly.Module]"}we.isWebAssemblyCompiledModule=Y;function oe(j){return h(j,l)}we.isNumberObject=oe;function w(j){return h(j,c)}we.isStringObject=w;function P(j){return h(j,p)}we.isBooleanObject=P;function z(j){return s&&h(j,y)}we.isBigIntObject=z;function Q(j){return i&&h(j,g)}we.isSymbolObject=Q;function Me(j){return oe(j)||w(j)||P(j)||z(j)||Q(j)}we.isBoxedPrimitive=Me;function _e(j){return typeof Uint8Array<"u"&&(de(j)||fe(j))}return we.isAnyArrayBuffer=_e,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(j){Object.defineProperty(we,j,{enumerable:!1,value:function(){throw new Error(j+" is not supported in userland")}})}),we}var Ll={},NT=!1;function Dk(){return NT||(NT=!0,Ll=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"}),Ll}var Pe={},DT=!1,di=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function Hk(){if(DT)return Pe;DT=!0;var t=Nt,e=Object.getOwnPropertyDescriptors||function(K){for(var F=Object.keys(K),fe={},ve=0;ve<F.length;ve++)fe[F[ve]]=Object.getOwnPropertyDescriptor(K,F[ve]);return fe},n=/%[sdj%]/g;Pe.format=function(D){if(!Z(D)){for(var K=[],F=0;F<arguments.length;F++)K.push(i(arguments[F]));return K.join(" ")}for(var F=1,fe=arguments,ve=fe.length,M=String(D).replace(n,function($){if($==="%%")return"%";if(F>=ve)return $;switch($){case"%s":return String(fe[F++]);case"%d":return Number(fe[F++]);case"%j":try{return JSON.stringify(fe[F++])}catch{return"[Circular]"}default:return $}}),C=fe[F];F<ve;C=fe[++F])S(C)||!se(C)?M+=" "+C:M+=" "+i(C);return M},Pe.deprecate=function(D,K){if(typeof t<"u"&&t.noDeprecation===!0)return D;if(typeof t>"u")return function(){return Pe.deprecate(D,K).apply(this||di,arguments)};var F=!1;function fe(){if(!F){if(t.throwDeprecation)throw new Error(K);t.traceDeprecation?console.trace(K):console.error(K),F=!0}return D.apply(this||di,arguments)}return fe};var r={},o=/^$/;if(t.env.NODE_DEBUG){var s=t.env.NODE_DEBUG;s=s.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),o=new RegExp("^"+s+"$","i")}Pe.debuglog=function(D){if(D=D.toUpperCase(),!r[D])if(o.test(D)){var K=t.pid;r[D]=function(){var F=Pe.format.apply(Pe,arguments);console.error("%s %d: %s",D,K,F)}}else r[D]=function(){};return r[D]};function i(D,K){var F={seen:[],stylize:l};return arguments.length>=3&&(F.depth=arguments[2]),arguments.length>=4&&(F.colors=arguments[3]),_(K)?F.showHidden=K:K&&Pe._extend(F,K),ee(F.showHidden)&&(F.showHidden=!1),ee(F.depth)&&(F.depth=2),ee(F.colors)&&(F.colors=!1),ee(F.customInspect)&&(F.customInspect=!0),F.colors&&(F.stylize=a),p(F,D,F.depth)}Pe.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function a(D,K){var F=i.styles[K];return F?"\x1B["+i.colors[F][0]+"m"+D+"\x1B["+i.colors[F][1]+"m":D}function l(D,K){return D}function c(D){var K={};return D.forEach(function(F,fe){K[F]=!0}),K}function p(D,K,F){if(D.customInspect&&K&&ze(K.inspect)&&K.inspect!==Pe.inspect&&!(K.constructor&&K.constructor.prototype===K)){var fe=K.inspect(F,D);return Z(fe)||(fe=p(D,fe,F)),fe}var ve=y(D,K);if(ve)return ve;var M=Object.keys(K),C=c(M);if(D.showHidden&&(M=Object.getOwnPropertyNames(K)),Oe(K)&&(M.indexOf("message")>=0||M.indexOf("description")>=0))return g(K);if(M.length===0){if(ze(K)){var $=K.name?": "+K.name:"";return D.stylize("[Function"+$+"]","special")}if(ge(K))return D.stylize(RegExp.prototype.toString.call(K),"regexp");if(ie(K))return D.stylize(Date.prototype.toString.call(K),"date");if(Oe(K))return g(K)}var Y="",oe=!1,w=["{","}"];if(B(K)&&(oe=!0,w=["[","]"]),ze(K)){var P=K.name?": "+K.name:"";Y=" [Function"+P+"]"}if(ge(K)&&(Y=" "+RegExp.prototype.toString.call(K)),ie(K)&&(Y=" "+Date.prototype.toUTCString.call(K)),Oe(K)&&(Y=" "+g(K)),M.length===0&&(!oe||K.length==0))return w[0]+Y+w[1];if(F<0)return ge(K)?D.stylize(RegExp.prototype.toString.call(K),"regexp"):D.stylize("[Object]","special");D.seen.push(K);var z;return oe?z=h(D,K,F,C,M):z=M.map(function(Q){return T(D,K,F,C,Q,oe)}),D.seen.pop(),x(z,Y,w)}function y(D,K){if(ee(K))return D.stylize("undefined","undefined");if(Z(K)){var F="'"+JSON.stringify(K).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return D.stylize(F,"string")}if(H(K))return D.stylize(""+K,"number");if(_(K))return D.stylize(""+K,"boolean");if(S(K))return D.stylize("null","null")}function g(D){return"["+Error.prototype.toString.call(D)+"]"}function h(D,K,F,fe,ve){for(var M=[],C=0,$=K.length;C<$;++C)xe(K,String(C))?M.push(T(D,K,F,fe,String(C),!0)):M.push("");return ve.forEach(function(Y){Y.match(/^\d+$/)||M.push(T(D,K,F,fe,Y,!0))}),M}function T(D,K,F,fe,ve,M){var C,$,Y;if(Y=Object.getOwnPropertyDescriptor(K,ve)||{value:K[ve]},Y.get?Y.set?$=D.stylize("[Getter/Setter]","special"):$=D.stylize("[Getter]","special"):Y.set&&($=D.stylize("[Setter]","special")),xe(fe,ve)||(C="["+ve+"]"),$||(D.seen.indexOf(Y.value)<0?(S(F)?$=p(D,Y.value,null):$=p(D,Y.value,F-1),$.indexOf(`
84
+ `,o+="})"}let s=n?o?n+o:r?r==="z.never()"?n+".strict()":n+`.catchall(${r})`:n:o||(r?`z.record(${r})`:"z.record(z.any())");return Ye.an.anyOf(t)&&(s+=`.and(${oy(N(v({},t),{anyOf:t.anyOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?N(v({},i),{type:"object"}):i)}),e)})`),Ye.a.oneOf(t)&&(s+=`.and(${la(N(v({},t),{oneOf:t.oneOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?N(v({},i),{type:"object"}):i)}),e)})`),Ye.an.allOf(t)&&(s+=`.and(${Jr(N(v({},t),{allOf:t.allOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?N(v({},i),{type:"object"}):i)}),e)})`),s}p(sy,"parseObject");var uB=p(t=>`z.ref('${t.$ref}')`,"parseRef"),cB=p(t=>{var e;let n="z.string()";if((e=t[le])!=null&&e.coerce){if(t.format==="date-time")return"z.coerce.date()";n="z.coerce.string()"}return n+=ut(t,"format",({value:r})=>{switch(r){case"email":return[".email(",")"];case"ip":return[".ip(",")"];case"ipv4":return['.ip({ version: "v4"',", message: "," })"];case"ipv6":return['.ip({ version: "v6"',", message: "," })"];case"uri":return[".url(",")"];case"uuid":return[".uuid(",")"];case"date-time":return[".datetime(",")"]}}),n+=ut(t,"pattern",({json:r})=>[`.regex(new RegExp(${r})`,", ",")"]),n+=ut(t,"minLength",({json:r})=>[`.min(${r}`,", ",")"]),n+=ut(t,"maxLength",({json:r})=>[`.max(${r}`,", ",")"]),n},"parseString"),it=p((t,e={seen:new Map,path:[]},n)=>{if(typeof t!="object")return t?"z.any()":"z.never()";if(e.parserOverride){let s=e.parserOverride(t,e);if(typeof s=="string")return s}let r=e.seen.get(t);if(r){if(r.r!==void 0)return r.r;if(e.depth===void 0||r.n>=e.depth)return"z.any()";r.n+=1}else r={r:void 0,n:0},e.seen.set(t,r);let o=pB(t,e);return n||(o=dB(t,o),e.withoutDefaults||(o=fB(t,o))),r.r=o,o},"parseSchema"),dB=p((t,e)=>(t.description&&(e+=`.describe(${JSON.stringify(t.description)})`),e),"addMeta"),fB=p((t,e)=>(t.default!==void 0&&(e+=`.default(${JSON.stringify(t.default)})`),e),"addDefaults"),pB=p((t,e)=>Ye.a.nullable(t)?aB(t,e):Ye.an.object(t)?sy(t,e):Ye.an.array(t)?Yx(t,e):Ye.an.anyOf(t)?oy(t,e):Ye.an.allOf(t)?Jr(t,e):Ye.a.discriminator(t)?tB(t,e):Ye.a.oneOf(t)?la(t,e):Ye.a.not(t)?oB(t,e):Ye.an.enum(t)?nB(t):Ye.a.const(t)?Qx(t):Ye.a.multipleType(t)?iB(t,e):Ye.a.primitive(t,"string")?cB(t):Ye.a.primitive(t,"number")||Ye.a.primitive(t,"integer")?lB(t):Ye.a.primitive(t,"boolean")?Xx(t):Ye.a.primitive(t,"null")?sB(t):Ye.a.conditional(t)?rB(t,e):Ye.a.ref(t)?uB(t):eB(t),"selectParser"),Ye={an:{object:t=>t.type==="object",array:t=>t.type==="array",anyOf:t=>t.anyOf!==void 0,allOf:t=>t.allOf!==void 0,enum:t=>t.enum!==void 0},a:{nullable:t=>t.nullable===!0,multipleType:t=>Array.isArray(t.type),not:t=>t.not!==void 0,const:t=>t.const!==void 0,primitive:(t,e)=>t.type===e,conditional:t=>!!("if"in t&&t.if&&"then"in t&&"else"in t&&t.then&&t.else),discriminator:t=>{var e;return t.oneOf!==void 0&&((e=t.discriminator)==null?void 0:e.propertyName)!==void 0},oneOf:t=>t.oneOf!==void 0,ref:t=>t.$ref!==void 0}},gB=p(t=>it(t,{seen:new Map,path:[]}),"jsonSchemaToZodStr"),yB=p(t=>{let e=gB(t);e=e.replaceAll("errors: z.ZodError[]","errors");let n=qx(e);if(!n.sucess)throw new go(n.error);return n.value},"jsonSchemaToZod"),Ur=p((t,e)=>{var n,r;if(e[le]&&t._def&&(t.naked()._def[le]=e[le]),((n=t._def)==null?void 0:n.typeName)==="ZodObject"&&e.type==="object"&&e.properties&&Object.entries(e.properties).forEach(([o,s])=>{let i=typeof t._def.shape=="function"?t._def.shape():t._def.shape;i[o]&&Ur(i[o],s)}),((r=t._def)==null?void 0:r.typeName)==="ZodRecord"&&e.type==="object"&&e.additionalProperties&&Ur(t._def.valueType,e.additionalProperties),e.type==="array"&&e.items){let o=e.items;if(typeof o=="object"&&!Array.isArray(o)){let s=t._def.type;s&&Ur(s,o)}else Array.isArray(o)&&o.forEach((s,i)=>{let a=t._def;a.typeName===X.ZodFirstPartyTypeKind.ZodTuple&&Ur(a.items[i],s)})}},"applyZuiPropsRecursively"),mB=p(t=>{let e=yB(t);return Ur(e,t),e},"fromJSONSchemaLegacy"),hB=p(t=>{var e,n;return t.anyOf!==void 0&&t.anyOf.length===2&&t.anyOf.some(r=>typeof r!="boolean"&&ay(r))&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)===R.ZodFirstPartyTypeKind.ZodOptional},"isOptionalSchema"),TB=p(t=>{var e,n;return t.anyOf!==void 0&&t.anyOf.length===2&&t.anyOf.some(r=>typeof r!="boolean"&&r.type==="null")&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)===R.ZodFirstPartyTypeKind.ZodNullable},"isNullableSchema"),ay=p(t=>{var e,n;return t.not===!0&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)===R.ZodFirstPartyTypeKind.ZodUndefined},"isUndefinedSchema"),vB=p(t=>{var e,n;return!t.not&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)===R.ZodFirstPartyTypeKind.ZodUnknown},"isUnknownSchema"),_B=p(t=>{var e,n;return t.anyOf!==void 0&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)===R.ZodFirstPartyTypeKind.ZodDiscriminatedUnion},"isDiscriminatedUnionSchema"),bB=p((t,e)=>wB(t)?xB(t,e):PB(t)?BB(t,e):EB(t,e),"arrayJSONSchemaToZuiArray"),wB=p(t=>Array.isArray(t.items),"_isTuple"),PB=p(t=>t.items!==void 0&&t.uniqueItems,"_isSet"),xB=p(({items:t,additionalItems:e},n)=>{let r=t.map(n),o=R.tuple(r);return e!==void 0&&(o=o.rest(n(e))),o},"_handleTuple"),BB=p(({items:t,minItems:e,maxItems:n},r)=>{let o=R.set(r(t));return e&&(o=o.min(e)),n&&(o=o.max(n)),o},"_handleSet"),EB=p(({minItems:t,maxItems:e,items:n},r)=>{let o=R.array(r(n));return t&&t===e?o.length(t):(t&&(o=o.min(t)),e&&(o=o.max(e)),o)},"_handleArray"),SB=p(({type:t,minimum:e,exclusiveMinimum:n,maximum:r,exclusiveMaximum:o,multipleOf:s,format:i})=>{let a=R.number();return t==="integer"&&(a=a.int()),i==="finite"&&(a=a.finite()),n!==void 0?a=a.gt(n):e!==void 0&&(a=a.gte(e)),o!==void 0?a=a.lt(o):r!==void 0&&(a=a.lte(r)),s!==void 0&&(a=a.multipleOf(s)),a},"numberJSONSchemaToZuiNumber"),IB=p(({format:t,pattern:e,minLength:n,maxLength:r})=>{let o=R.string();if(n&&r&&n===r?o=o.length(n):(n&&(o=o.min(n)),r&&(o=o.max(r))),t==="cuid"||e===Xe.cuid)o=o.cuid();else if(t==="cuid2"||e===Xe.cuid2)o=o.cuid2();else if(t==="emoji"||e===Xe.emoji)o=o.emoji();else if(t==="ulid"||e===Xe.ulid)o=o.ulid();else if(t==="date-time"){let{precision:s,offset:i}=e?cv(e):{};o=o.datetime({precision:s,offset:i})}else t==="email"||e===Xe.email?o=o.email():t==="ipv4"||e===Xe.ipv4?o=o.ip():t==="ipv6"||e===Xe.ipv6?o=o.ip("v6"):t==="uri"?o=o.url():t==="uuid"||e===Xe.uuid?o=o.uuid():e&&(o=o.regex(new RegExp(e)));return o},"stringJSONSchemaToZuiString"),Er=p((t,e)=>{let n=[];e.enum!==void 0&&n.push(...e.enum),e.const!==void 0&&n.push(e.const);let r,o=n.filter(i=>typeof i===t),[s]=o;if(s)if(o.length===1)r=R.literal(s);else{let i=o.map(a=>R.literal(a));r=R.union(i)}else if(t==="string"&&e.type==="string"&&(r=IB(e)),t==="number"&&(e.type==="number"||e.type==="integer")&&(r=SB(e)),t==="boolean"&&(r=R.boolean()),t==="null"&&(r=R.null()),!r)throw new go(`Unknown primitive type: "${t}"`);return e.description&&(r=r.describe(e.description)),r},"toZuiPrimitive"),Jn=R.any();function ly(t){return et(t)}p(ly,"fromJSONSchema");function et(t){var e,n,r;if(t===void 0)return Jn;if(t===!0)return R.any();if(t===!1)return R.never();if(t.default!==void 0)return et(N(v({},t),{default:void 0})).default(t.default);if(t.readOnly)return et(N(v({},t),{readOnly:void 0})).readonly();if(t.description!==void 0)return et(N(v({},t),{description:void 0})).describe(t.description);if(t.oneOf!==void 0)throw new fn({oneOf:t.oneOf});if(t.patternProperties!==void 0)throw new fn({patternProperties:t.patternProperties});if(t.propertyNames!==void 0)throw new fn({propertyNames:t.propertyNames});if(t.if!==void 0)throw new fn({if:t.if});if(t.then!==void 0)throw new fn({then:t.then});if(t.else!==void 0)throw new fn({else:t.else});if(t.$ref!==void 0)return R.ref(t.$ref);if(t.not!==void 0){if(ay(t))return R.undefined();if(t.not===!0)return R.never();throw new fn({not:t.not})}if(Array.isArray(t.type)){if(t.type.length===0)return Jn;if(t.type.length===1)return et(N(v({},t),{type:t.type[0]}));let o=t,{type:s}=o,i=dd(o,["type"]),a=t.type.map(l=>et(N(v({},i),{type:l})));return R.union(a)}if(t.type==="string")return t.enum&&t.enum.length>0?R.enum(t.enum):Er("string",t);if(t.type==="integer"){let o=Er("number",t);return o instanceof R.ZodNumber?o.int():o}if(t.type==="number")return Er("number",t);if(t.type==="boolean")return Er("boolean",t);if(t.type==="null")return Er("null",t);if(t.type==="array")return bB(t,et);if(t.type==="object"){if(t.additionalProperties!==void 0&&t.properties!==void 0){let o=et(t.additionalProperties);return et(N(v({},t),{additionalProperties:void 0})).catchall(o)}if(t.properties!==void 0){let o={};for(let[s,i]of Object.entries(t.properties)){let a=et(i),l=(e=t.required)!=null?e:[];o[s]=l.includes(s)||a.isOptional()?a:a.optional()}return R.object(o)}if(t.additionalProperties!==void 0){let o=et(t.additionalProperties);return R.record(o)}return R.record(Jn)}if(t.anyOf!==void 0){if(t.anyOf.length===0)return Jn;if(t.anyOf.length===1)return et(t.anyOf[0]);if(hB(t))return et(t.anyOf[0]).optional();if(TB(t))return et(t.anyOf[0]).nullable();if(_B(t)&&((r=(n=t["x-zui"])==null?void 0:n.def)!=null&&r.discriminator)){let{discriminator:s}=t["x-zui"].def,i=t.anyOf.map(et);return R.discriminatedUnion(s,i)}let o=t.anyOf.map(et);return R.union(o)}if(t.allOf!==void 0){if(t.allOf.length===0)return Jn;if(t.allOf.length===1)return et(t.allOf[0]);let[o,...s]=t.allOf,i=et(o),a=et({allOf:s});return R.intersection(i,a)}return vB(t)?R.unknown():Jn}p(et,"_fromJSONSchema");var kB=/^\d{4}-\d{2}-\d{2}(T|\s)?((\d{2}:\d{2}:\d{2}(\.\d{1,3})?)|(\d{2}:\d{2}))?(\s?([+-]\d{2}:\d{2}|Z))?$/,As=p((t,e,n=!0)=>{if(typeof t!="object")throw new hs("Input must be an object");let r=p(i=>{let a=i;return e?.nullable&&(a=a.nullable()),e?.optional&&(a=a.optional()),e?.passtrough&&typeof a.passthrough=="function"&&(a=a.passthrough()),a},"applyOptions"),o=Object.entries(t).reduce((i,[a,l])=>{if(l===null)i[a]=r(X.null());else switch(typeof l){case"string":i[a]=kB.test(l)?r(X.string().datetime()):r(X.string());break;case"number":i[a]=r(X.number());break;case"boolean":i[a]=r(X.boolean());break;case"object":Array.isArray(l)?l.length===0?i[a]=r(X.array(X.unknown())):typeof l[0]=="object"?i[a]=r(X.array(As(l[0],e,!1))):["string","number","boolean"].includes(typeof l[0])&&(i[a]=r(X.array(X[typeof l[0]]()))):i[a]=r(As(l,e,!1));break;default:throw new hs(`Unsupported type for key ${a}`)}return i},{}),s=Object.keys(o).length>0;return e?.passtrough||!n&&!s?X.object(o).passthrough():X.object(o)},"fromObject");function uy(){return{}}p(uy,"parseAnyDef");function cy(t,e){var n,r;let o={type:"array"};return((r=(n=t.type)==null?void 0:n._def)==null?void 0:r.typeName)!=="ZodAny"&&(o.items=ke(t.type._def,N(v({},e),{currentPath:[...e.currentPath,"items"]}))),t.minLength&&Re(o,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Re(o,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Re(o,"minItems",t.exactLength.value,t.exactLength.message,e),Re(o,"maxItems",t.exactLength.value,t.exactLength.message,e)),o}p(cy,"parseArrayDef");function dy(t,e){let n=v({type:"integer",format:"int64"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{});if(!t.checks)return n;for(let r of t.checks)switch(r.kind){case"min":e.target==="jsonSchema7"?r.inclusive?Re(n,"minimum",r.value,r.message,e):Re(n,"exclusiveMinimum",r.value,r.message,e):(r.inclusive||(n.exclusiveMinimum=!0),Re(n,"minimum",r.value,r.message,e));break;case"max":e.target==="jsonSchema7"?r.inclusive?Re(n,"maximum",r.value,r.message,e):Re(n,"exclusiveMaximum",r.value,r.message,e):(r.inclusive||(n.exclusiveMaximum=!0),Re(n,"maximum",r.value,r.message,e));break;case"multipleOf":Re(n,"multipleOf",r.value,r.message,e);break}return n}p(dy,"parseBigintDef");function fy(t){return v({type:"boolean"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{})}p(fy,"parseBooleanDef");function py(t,e){return ke(t.type._def,e)}p(py,"parseBrandedDef");var AB=p((t,e)=>ke(t.innerType._def,e),"parseCatchDef");function gy(t,e){return e.dateStrategy==="integer"?CB(t,e):v({type:"string",format:"date-time"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{})}p(gy,"parseDateDef");var CB=p((t,e)=>{let n=v({type:"integer",format:"unix-time"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{});for(let r of t.checks)switch(r.kind){case"min":e.target==="jsonSchema7"&&Re(n,"minimum",r.value,r.message,e);break;case"max":e.target==="jsonSchema7"&&Re(n,"maximum",r.value,r.message,e);break}return n},"integerDateParser");function yy(t,e){return N(v({},ke(t.innerType._def,e)),{default:t.defaultValue()})}p(yy,"parseDefaultDef");function my(t,e){return e.effectStrategy==="input"?ke(t.schema._def,e):{}}p(my,"parseEffectsDef");function hy(t){return{type:"string",enum:t.values}}p(hy,"parseEnumDef");var OB=p(t=>"type"in t&&t.type==="string"?!1:"allOf"in t,"isJsonSchema7AllOfType");function Ty(t,e){let n=[ke(t.left._def,N(v({},e),{currentPath:[...e.currentPath,"allOf","0"]})),ke(t.right._def,N(v({},e),{currentPath:[...e.currentPath,"allOf","1"]}))].filter(s=>!!s),r=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return n.forEach(s=>{if(OB(s))o.push(...s.allOf),s.unevaluatedProperties===void 0&&(r=void 0);else{let i=s;if("additionalProperties"in s&&s.additionalProperties===!1){let a=s,{additionalProperties:l}=a;i=dd(a,["additionalProperties"])}else r=void 0;o.push(i)}}),o.length?v({allOf:o},r):void 0}p(Ty,"parseIntersectionDef");function vy(t,e){let n=typeof t.value;return n!=="bigint"&&n!=="number"&&n!=="boolean"&&n!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:n==="bigint"?"integer":n,enum:[t.value]}:{type:n==="bigint"?"integer":n,const:t.value}}p(vy,"parseLiteralDef");function ua(t,e){var n,r,o,s,i;if(e.target==="openApi3"&&((n=t.keyType)==null?void 0:n._def.typeName)==="ZodEnum")return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((l,c)=>{var f;return N(v({},l),{[c]:(f=ke(t.valueType._def,N(v({},e),{currentPath:[...e.currentPath,"properties",c]})))!=null?f:{}})},{}),additionalProperties:!1};let a={type:"object",additionalProperties:(r=ke(t.valueType._def,N(v({},e),{currentPath:[...e.currentPath,"additionalProperties"]})))!=null?r:{}};if(e.target==="openApi3")return a;if(((o=t.keyType)==null?void 0:o._def.typeName)==="ZodString"&&((s=t.keyType._def.checks)!=null&&s.length)){let l=Object.entries(Ms(t.keyType._def,e)).reduce((c,[f,y])=>f==="type"?c:N(v({},c),{[f]:y}),{});return N(v({},a),{propertyNames:l})}else if(((i=t.keyType)==null?void 0:i._def.typeName)==="ZodEnum")return N(v({},a),{propertyNames:{enum:t.keyType._def.values}});return a}p(ua,"parseRecordDef");function _y(t,e){if(e.mapStrategy==="record")return ua(t,e);let n=ke(t.keyType._def,N(v({},e),{currentPath:[...e.currentPath,"items","items","0"]}))||{},r=ke(t.valueType._def,N(v({},e),{currentPath:[...e.currentPath,"items","items","1"]}))||{};return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}p(_y,"parseMapDef");function by(t){let e=t.values,r=Object.keys(t.values).filter(s=>typeof e[e[s]]!="number").map(s=>e[s]),o=Array.from(new Set(r.map(s=>typeof s)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:r.filter(s=>typeof s=="string"||typeof s=="number")}}p(by,"parseNativeEnumDef");function wy(){return{not:{}}}p(wy,"parseNeverDef");function Py(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}p(Py,"parseNullDef");var fo={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function xy(t,e){if(e.target==="openApi3")return ad(t,e);let n=t.options instanceof Map?Array.from(t.options.values()):t.options;if(n.every(r=>r._def.typeName in fo&&(!r._def.checks||!r._def.checks.length))){let r=n.reduce((o,s)=>{let i=fo[s._def.typeName];return i&&!o.includes(i)?[...o,i]:o},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){let r=n.reduce((o,s)=>{let i=typeof s._def.value;switch(i){case"string":case"number":case"boolean":return[...o,i];case"bigint":return[...o,"integer"];case"object":if(s._def.value===null)return[...o,"null"];case"symbol":case"undefined":case"function":default:return o}},[]);if(r.length===n.length){let o=r.filter((s,i,a)=>a.indexOf(s)===i);return{type:o.length>1?o:o[0],enum:n.reduce((s,i)=>s.includes(i._def.value)?s:[...s,i._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,o)=>[...r,...o._def.values.filter(s=>!r.includes(s))],[])};return ad(t,e)}p(xy,"parseUnionDef");var ad=p((t,e)=>{let n=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((o,s)=>ke(o._def,N(v({},e),{currentPath:[...e.currentPath,e.unionStrategy,`${s}`]}))).filter(o=>!!o&&(!e.strictUnions||typeof o=="object"&&Object.keys(o).length>0)),r=e.discriminator&&t.typeName==="ZodDiscriminatedUnion"&&typeof t.discriminator=="string"?{discriminator:{propertyName:t.discriminator}}:{};if(n.length)return e.unionStrategy==="anyOf"?v({anyOf:n},r):v({oneOf:n},r)},"asUnionOf");function By(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length)){let r=t.innerType;if(e.target==="openApi3"){let s={type:fo[r._def.typeName],nullable:!0};return Cs(r._def,e,s)}let o={type:[fo[r._def.typeName],"null"]};return Cs(r._def,e,o)}if(e.target==="openApi3"){let r=ke(t.innerType._def,N(v({},e),{currentPath:[...e.currentPath]}));return r&&N(v({},r),{nullable:!0})}let n=ke(t.innerType._def,N(v({},e),{currentPath:[...e.currentPath,"anyOf","0"]}));return n&&{anyOf:[n,{type:"null"}]}}p(By,"parseNullableDef");function Ey(t,e){let n=v({type:"number"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{});if(!t.checks)return n;for(let r of t.checks)switch(r.kind){case"int":n.type="integer",Rs(n,"type",r.message,e);break;case"min":e.target==="jsonSchema7"?r.inclusive?Re(n,"minimum",r.value,r.message,e):Re(n,"exclusiveMinimum",r.value,r.message,e):(r.inclusive||(n.exclusiveMinimum=!0),Re(n,"minimum",r.value,r.message,e));break;case"max":e.target==="jsonSchema7"?r.inclusive?Re(n,"maximum",r.value,r.message,e):Re(n,"exclusiveMaximum",r.value,r.message,e):(r.inclusive||(n.exclusiveMaximum=!0),Re(n,"maximum",r.value,r.message,e));break;case"multipleOf":Re(n,"multipleOf",r.value,r.message,e);break}return n}p(Ey,"parseNumberDef");var RB=p((t,e)=>{var n;return t.unknownKeys instanceof he?(n=ke(t.unknownKeys._def,N(v({},e),{currentPath:[...e.currentPath,"additionalProperties"]})))!=null?n:!0:t.unknownKeys==="passthrough"},"getAdditionalProperties");function Sy(t,e){let n=N(v({type:"object"},Object.entries(t.shape()).reduce((r,[o,s])=>{if(s===void 0||s._def===void 0)return r;let i=ke(s._def,N(v({},e),{currentPath:[...e.currentPath,"properties",o],propertyPath:[...e.currentPath,"properties",o]}));return i===void 0?r:{properties:N(v({},r.properties),{[o]:i}),required:s.isOptional()?r.required:[...r.required,o]}},{properties:{},required:[]})),{additionalProperties:RB(t,e)});return n.required.length||delete n.required,n}p(Sy,"parseObjectDef");var MB=p((t,e)=>{var n;if(e.currentPath.toString()===((n=e.propertyPath)==null?void 0:n.toString()))return ke(t.innerType._def,e);let r=ke(t.innerType._def,N(v({},e),{currentPath:[...e.currentPath,"anyOf","1"]}));return r?{anyOf:[{not:{}},r]}:{}},"parseOptionalDef"),NB=p((t,e)=>{if(e.pipeStrategy==="input")return ke(t.in._def,e);if(e.pipeStrategy==="output")return ke(t.out._def,e);let n=ke(t.in._def,N(v({},e),{currentPath:[...e.currentPath,"allOf","0"]})),r=ke(t.out._def,N(v({},e),{currentPath:[...e.currentPath,"allOf",n?"1":"0"]}));return{allOf:[n,r].filter(o=>o!==void 0)}},"parsePipelineDef");function Iy(t,e){return ke(t.type._def,e)}p(Iy,"parsePromiseDef");var DB=p((t,e)=>ke(t.innerType._def,e),"parseReadonlyDef");function ky(t){return{$ref:t.uri}}p(ky,"parseRefDef");function Ay(t,e){let r={type:"array",uniqueItems:!0,items:ke(t.valueType._def,N(v({},e),{currentPath:[...e.currentPath,"items"]}))};return t.minSize&&Re(r,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&Re(r,"maxItems",t.maxSize.value,t.maxSize.message,e),r}p(Ay,"parseSetDef");function Cy(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((n,r)=>ke(n._def,N(v({},e),{currentPath:[...e.currentPath,"items",`${r}`]}))).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:ke(t.rest._def,N(v({},e),{currentPath:[...e.currentPath,"additionalItems"]}))}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((n,r)=>ke(n._def,N(v({},e),{currentPath:[...e.currentPath,"items",`${r}`]}))).reduce((n,r)=>r===void 0?n:[...n,r],[])}}p(Cy,"parseTupleDef");function Oy(){return{not:{}}}p(Oy,"parseUndefinedDef");function Ry(){return{}}p(Ry,"parseUnknownDef");function ke(t,e,n=!1){let r=e.seen.get(t);if(r&&!n){let i=HB(r,e);if(i!==void 0)return i}let o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);let s=jB(t,t.typeName,e);return s&&Cs(t,e,s),o.jsonSchema=s,s}p(ke,"parseDef");var HB=p((t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:UB(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((n,r)=>e.currentPath[r]===n)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),{}):e.$refStrategy==="seen"?{}:void 0}},"get$ref"),UB=p((t,e)=>{let n=0;for(;n<t.length&&n<e.length&&t[n]===e[n];n++);return[(t.length-n).toString(),...e.slice(n)].join("/")},"getRelativePath"),jB=p((t,e,n)=>{switch(e){case"ZodString":return Ms(t,n);case"ZodNumber":return Ey(t,n);case"ZodObject":return Sy(t,n);case"ZodBigInt":return dy(t,n);case"ZodBoolean":return fy(t);case"ZodDate":return gy(t,n);case"ZodUndefined":return Oy();case"ZodNull":return Py(n);case"ZodArray":return cy(t,n);case"ZodUnion":case"ZodDiscriminatedUnion":return xy(t,n);case"ZodIntersection":return Ty(t,n);case"ZodTuple":return Cy(t,n);case"ZodRecord":return ua(t,n);case"ZodRef":return ky(t);case"ZodLiteral":return vy(t,n);case"ZodEnum":return hy(t);case"ZodNativeEnum":return by(t);case"ZodNullable":return By(t,n);case"ZodOptional":return MB(t,n);case"ZodMap":return _y(t,n);case"ZodSet":return Ay(t,n);case"ZodLazy":return ke(t.getter()._def,n);case"ZodPromise":return Iy(t,n);case"ZodNaN":case"ZodNever":return wy();case"ZodEffects":return my(t,n);case"ZodAny":return uy();case"ZodUnknown":return Ry();case"ZodDefault":return yy(t,n);case"ZodBranded":return py(t,n);case"ZodReadonly":return DB(t,n);case"ZodCatch":return AB(t,n);case"ZodPipeline":return NB(t,n);case"ZodFunction":case"ZodVoid":case"ZodSymbol":return;default:return(r=>{})(e)}},"selectParser"),Cs=p((t,e,n)=>(t.description&&(n.description=t.description,e.markdownDescription&&(n.markdownDescription=t.description)),Object.assign(n,{[le]:v(v({},t[le]),n[le])}),n),"addMeta"),ld={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"string",mapStrategy:"entries",definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",emailStrategy:"format:email",discriminator:!1,unionStrategy:"anyOf"},$B=p(t=>typeof t=="string"?N(v({},ld),{name:t}):v(v({},ld),t),"getDefaultOptions"),ZB=p(t=>{let e=$B(t),n=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return N(v({},e),{currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([r,o])=>[o._def,{def:o._def,path:[...e.basePath,e.definitionPath,r],jsonSchema:void 0}]))})},"getRefs"),KB=p((t,e)=>{var n;let r=ZB(e),o=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[c,f])=>{var y;return N(v({},l),{[c]:(y=ke(f._def,N(v({},r),{currentPath:[...r.basePath,r.definitionPath,c]}),!0))!=null?y:{}})},{}):void 0,s=typeof e=="string"?e:e?.name,i=(n=ke(t._def,s===void 0?r:N(v({},r),{currentPath:[...r.basePath,r.definitionPath,s]}),!1))!=null?n:{},a=s===void 0?o?N(v({},i),{[r.definitionPath]:o}):i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,s].join("/"),[r.definitionPath]:N(v({},o),{[s]:i})};return r.target==="jsonSchema7"?a.$schema="http://json-schema.org/draft-07/schema#":r.target==="jsonSchema2019-09"&&(a.$schema="https://json-schema.org/draft/2019-09/schema#"),a},"zodToJsonSchema"),LB=p((t,e={target:"openApi3"})=>{let n=KB(t,e);return e.$schemaUrl===!1?delete n.$schema:typeof e.$schemaUrl=="string"&&(n.$schema=e.$schemaUrl),n},"toJSONSchemaLegacy");var Qr=(t,e)=>{let n=t._def,r=e._def;if(n.typeName===X.ZodFirstPartyTypeKind.ZodObject&&r.typeName===X.ZodFirstPartyTypeKind.ZodObject){let o=n.shape(),s=r.shape();return X.object({...o,...s})}if(n.typeName===X.ZodFirstPartyTypeKind.ZodRecord&&r.typeName===X.ZodFirstPartyTypeKind.ZodRecord)return X.record(X.intersection(n.valueType,r.valueType));throw new Error("Cannot merge object schemas with record schemas")},My=X;var mt=X.string().min(1),Dy=X.object({text:mt}),Hy=X.object({markdown:mt}),Uy=X.object({imageUrl:mt}),jy=X.object({audioUrl:mt}),$y=X.object({videoUrl:mt}),Zy=X.object({fileUrl:mt,title:mt.optional()}),Ky=X.object({latitude:X.number(),longitude:X.number(),address:X.string().optional(),title:X.string().optional()}),Ly=X.object({title:mt,subtitle:mt.optional(),imageUrl:mt.optional(),actions:X.array(X.object({action:X.enum(["postback","url","say"]),label:mt,value:mt}))}),Ny=X.object({text:mt,options:X.array(X.object({label:mt,value:mt}))}),FB=X.object({items:X.array(Ly)}),Fy=X.union([X.object({type:X.literal("text"),payload:Dy}),X.object({type:X.literal("image"),payload:Uy}),X.object({type:X.literal("audio"),payload:jy}),X.object({type:X.literal("video"),payload:$y}),X.object({type:X.literal("file"),payload:Zy}),X.object({type:X.literal("location"),payload:Ky})]),WB=X.object({items:X.array(Fy)}),zB={schema:Hy},qB={schema:X.object({items:X.array(X.union([...Fy.options,X.object({type:X.literal("markdown"),payload:Hy})]))})},GB={text:{schema:Dy},image:{schema:Uy},audio:{schema:jy},video:{schema:$y},file:{schema:Zy},location:{schema:Ky},carousel:{schema:FB},card:{schema:Ly},dropdown:{schema:Ny},choice:{schema:Ny},bloc:{schema:WB}};I();A();k();var yC={HIDDEN_IN_STUDIO:{bpActionHiddenInStudio:"true"},AWAIT_RETURN:{bpActionAwaitReturn:"true"}};I();A();k();import{isNode as VI}from"browser-or-node";I();A();k();var ca=console;function Dt(t){if(!t.body)throw new Error("Missing body");return JSON.parse(t.body)}async function Jo(t,e=8072,n=QI){if(!VI)throw new Error("This function can only be called in Node.js");let o=(Lh(),XT(Kh)).createServer(async(s,i)=>{try{let a=await JI(s);if(a.path==="/health"){i.writeHead(200).end("ok");return}let l=await t(a);i.writeHead(l?.status??200,l?.headers??{}).end(l?.body??"{}")}catch(a){let l=a instanceof Error?a.message:String(a);ca.error("Error while handling request",{error:l??"Internal error occured"}),i.writeHead(500).end(JSON.stringify({error:l??"Internal error occured"}))}});return o.listen(e,()=>n(e)),o}async function JI(t){let e=await XI(t),n={};for(let o=0;o<t.rawHeaders.length;o+=2){let s=t.rawHeaders[o].toLowerCase(),i=t.rawHeaders[o+1];n[s]=i}let r=new URL(t.url??"",t.headers.host?`http://${t.headers.host}`:"http://botpress.cloud");return{body:e,path:r.pathname,query:YI(r.search,"?"),headers:n,method:t.method?.toUpperCase()??"GET"}}function YI(t,e){return t.indexOf(e)===0?t.slice(e.length):t}async function XI(t){return new Promise((e,n)=>{if(t.method!=="POST"&&t.method!=="PUT"&&t.method!=="PATCH")return e(void 0);let r="";t.on("data",o=>r+=o.toString()),t.on("error",o=>n(o)),t.on("end",()=>e(r))})}function QI(t){ca.info(`Listening on port ${t}`)}import{isApiError as Fj,RuntimeError as Wj}from"@botpress/client";I();A();k();I();A();k();I();A();k();I();A();k();var Le={};bn(Le,{mapKeys:()=>nk,mapValues:()=>tk,mergeRecords:()=>ik,pairs:()=>Yo,stripUndefinedProps:()=>rk,values:()=>ek});I();A();k();var Yo=t=>Object.entries(t),ek=t=>Object.values(t),tk=(t,e)=>Object.fromEntries(Yo(t).map(([n,r])=>[n,e(r,n)])),nk=(t,e)=>Object.fromEntries(Yo(t).map(([n,r])=>[e(n),r])),rk=t=>Object.fromEntries(Yo(t).filter(([,e])=>e!==void 0)),ik=(t,e,n)=>{let r=[...Object.keys(t),...Object.keys(e)],o=[...new Set(r)],s={};for(let i of o){let a=t[i],l=e[i];a&&l?s[i]=n(a,l):a?s[i]=a:l&&(s[i]=l)}return s};var ye={};bn(ye,{safePush:()=>ok,unique:()=>sk});I();A();k();var ok=(t,...e)=>t?[...t,...e]:[...e],sk=t=>Array.from(new Set(t));I();A();k();var dt={};bn(dt,{setName:()=>ak});I();A();k();var ak=(t,e)=>(Object.defineProperty(t,"name",{value:e}),t);var Fh=t=>{let{name:e,version:n}=t,r={actions:{},events:{},channels:{}},o={name:e,version:n,entities:Le.mapValues(t.entities,i=>({name:i.name})),actions:{},events:{},channels:{}},s=Le.mapValues(t.entities,i=>i.schema);for(let[i,a]of Object.entries(t.definition.actions??{})){let l=a.input.schema.dereference(s),c=a.output.schema.dereference(s),f=t.actions?.[i]?.name??i;r.actions[f]={...a,...t.actions?.[i]??{},input:{schema:l},output:{schema:c}},o.actions[i]={name:f}}for(let[i,a]of Object.entries(t.definition.events??{})){let l=a.schema.dereference(s),c=t.events?.[i]?.name??i;r.events[c]={...a,...t.events?.[i]??{},schema:l},o.events[i]={name:c}}for(let[i,a]of Object.entries(t.definition.channels??{})){let l={};for(let[f,y]of Object.entries(a.messages)){let g=y.schema.dereference(s);l[f]={...y,schema:g}}let c=t.channels?.[i]?.name??i;r.channels[c]={...a,...t.channels?.[i]??{},message:{...a.message??{},tags:{...a.message?.tags??{},...t.channels?.[i]?.message?.tags??{}}},conversation:{...a.conversation??{},tags:{...a.conversation?.tags??{},...t.channels?.[i]?.conversation?.tags??{}}},messages:l},o.channels[i]={name:c}}return{resolved:r,statement:o}};I();A();k();var Wh="5.1.1";var _n=Wh;I();A();k();var Xo=Symbol("schemaName"),zh=t=>t?Le.mapValues(t,(n,r)=>({...n,[Xo]:r})):{},qh=t=>Xo in t&&t[Xo]!==void 0,Gh=t=>t[Xo];I();A();k();var al=class{constructor(e){this.props=e;this.name=e.name,this.version=e.version,this.icon=e.icon,this.readme=e.readme,this.title=e.title,this.identifier=e.identifier,this.description=e.description,this.configuration=e.configuration,this.configurations=e.configurations,this.events=e.events,this.actions=e.actions,this.channels=e.channels,this.states=e.states,this.user=e.user,this.secrets=e.secrets,this.entities=e.entities,this.interfaces=e.interfaces,this.__advanced=e.__advanced,this.attributes=e.attributes}name;version;title;description;icon;readme;configuration;configurations;events;actions;channels;states;user;secrets;identifier;entities;interfaces;__advanced;attributes;get metadata(){return{sdkVersion:_n}}extend(e,n){let{entities:r,actions:o,events:s,channels:i}=this._callBuilder(e,n),a=this;a.interfaces??={};let l=Object.values(r).map(g=>g.name),c=l.length===0?e.name:`${e.name}<${l.join(",")}>`,{resolved:f,statement:y}=Fh({...e,entities:r,actions:Le.stripUndefinedProps(o),events:Le.stripUndefinedProps(s),channels:Le.stripUndefinedProps(i)});return a.actions=Le.mergeRecords(a.actions??{},f.actions,this._mergeActions),a.channels=Le.mergeRecords(a.channels??{},f.channels,this._mergeChannels),a.events=Le.mergeRecords(a.events??{},f.events,this._mergeEvents),a.interfaces[c]={id:e.id,...y},this}_callBuilder(e,n){let o={entities:zh(this.entities)},s=n(o),i=Le.pairs(s.entities).find(([l,c])=>!qh(c));if(i)throw new Error(`Cannot extend interface "${e.name}" with entity "${i[0]}"; the provided schema is not part of the integration's entities.`);return{entities:Le.mapValues(s.entities,l=>({name:Gh(l),schema:l.schema})),actions:s.actions??{},events:s.events??{},channels:s.channels??{}}}_mergeActions=(e,n)=>({...e,...n,input:{schema:Qr(e.input.schema,n.input.schema)},output:{schema:Qr(e.output.schema,n.output.schema)}});_mergeEvents=(e,n)=>({...e,...n,schema:Qr(e.schema,n.schema)});_mergeChannels=(e,n)=>{let r=Le.mergeRecords(e.messages,n.messages,this._mergeMessage),o;(e.conversation||n.conversation)&&(o={tags:{...e.conversation?.tags,...n.conversation?.tags}});let s;return(e.message||n.message)&&(s={tags:{...e.message?.tags,...n.message?.tags}}),{...e,...n,messages:r,conversation:o,message:s}};_mergeMessage=(e,n)=>({schema:Qr(e.schema,n.schema)})};I();A();k();I();A();k();import{isApiError as Uk,Client as jk,RuntimeError as UT,InvalidPayloadError as $k}from"@botpress/client";I();A();k();import*as Vh from"@botpress/client";var Qo={retries:3,retryCondition:t=>Vh.axiosRetry.isNetworkOrIdempotentRequestError(t)||[429,502].includes(t.response?.status??0),retryDelay:(t,e)=>(uk(e.response?.headers??{})??t)*1e3},uk=t=>{let e=["RateLimit-Reset","X-RateLimit-Reset","Retry-After","ratelimit-reset","x-ratelimit-reset","retry-after"];for(let n of e){let r=t[n];if(r!==void 0)return ck(String(r))}},ck=t=>{let e=dk(t)?fk(t):t.length>0?parseInt(t,10):void 0;return e===void 0||isNaN(e)?void 0:e},dk=t=>t.includes(" "),fk=t=>{let e=pk(t);if(!e)return;let n=new Date;return Math.max(0,Math.floor((e.getTime()-n.getTime())/1e3))},pk=t=>{let e=new Date(t);return isNaN(e.getTime())?void 0:e};I();A();k();I();A();k();var li=class{constructor(e){this._client=e}get _inner(){return this._client}createConversation=(e=>this._client.createConversation(e));getConversation=(e=>this._client.getConversation(e));listConversations=(e=>this._client.listConversations(e));getOrCreateConversation=(e=>this._client.getOrCreateConversation(e));updateConversation=(e=>this._client.updateConversation(e));deleteConversation=(e=>this._client.deleteConversation(e));listParticipants=(e=>this._client.listParticipants(e));addParticipant=(e=>this._client.addParticipant(e));getParticipant=(e=>this._client.getParticipant(e));removeParticipant=(e=>this._client.removeParticipant(e));createEvent=(e=>this._client.createEvent(e));getEvent=(e=>this._client.getEvent(e));listEvents=(e=>this._client.listEvents(e));createMessage=(e=>this._client.createMessage(e));getOrCreateMessage=(e=>this._client.getOrCreateMessage(e));getMessage=(e=>this._client.getMessage(e).then(n=>n));updateMessage=(e=>this._client.updateMessage(e).then(n=>n));listMessages=(e=>this._client.listMessages(e));deleteMessage=(e=>this._client.deleteMessage(e));createUser=(e=>this._client.createUser(e));getUser=(e=>this._client.getUser(e));listUsers=e=>this._client.listUsers(e);getOrCreateUser=(e=>this._client.getOrCreateUser(e));updateUser=(e=>this._client.updateUser(e));deleteUser=e=>this._client.deleteUser(e);getState=(e=>this._client.getState(e));setState=(e=>this._client.setState(e));getOrSetState=(e=>this._client.getOrSetState(e));patchState=(e=>this._client.patchState(e));configureIntegration=e=>this._client.configureIntegration(e);uploadFile=e=>this._client.uploadFile(e);upsertFile=e=>this._client.upsertFile(e);deleteFile=e=>this._client.deleteFile(e);listFiles=e=>this._client.listFiles(e);getFile=e=>this._client.getFile(e);updateFileMetadata=e=>this._client.updateFileMetadata(e);trackAnalytics=e=>this._client.trackAnalytics(e)};I();A();k();var es=class{_cost=0;get cost(){return this._cost}setCost(e){this._cost=e}toJSON(){return{cost:this.cost}}};I();A();k();I();A();k();var Ht="#",ts="x-bot-id",Jh="x-bot-user-id",Yh="x-integration-id",Xh="x-integration-alias",Qh="x-webhook-id",eT="x-bp-configuration-type",ns="x-bp-configuration",rs="x-bp-operation",tT="x-bp-type";I();A();k();var At=t=>{throw t instanceof Error?t:new Error(t)};var t0=X.enum(["webhook_received","message_created","action_triggered","register","unregister","ping","create_user","create_conversation"]),nT=t=>({botId:t[ts]||At("Missing bot header"),botUserId:t[Jh]||At("Missing bot user header"),integrationId:t[Yh]||At("Missing integration header"),integrationAlias:t[Xh]||At("Missing integration alias header"),webhookId:t[Qh]||At("Missing webhook header"),operation:t[rs]||At("Missing operation header"),configurationType:t[eT]??null,configuration:JSON.parse(q.from(t[ns]||At("Missing configuration header"),"base64").toString("utf-8"))});I();A();k();I();A();k();I();A();k();I();A();k();var ul={},rT=!1;function kl(){return rT||(rT=!0,ul=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},n=Symbol("test"),r=Object(n);if(typeof n=="string"||Object.prototype.toString.call(n)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var o=42;e[n]=o;for(n in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==n||!Object.prototype.propertyIsEnumerable.call(e,n))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var i=Object.getOwnPropertyDescriptor(e,n);if(i.value!==o||i.enumerable!==!0)return!1}return!0}),ul}var cl={},iT=!1;function gk(){return iT||(iT=!0,cl=Error),cl}var dl={},oT=!1;function yk(){return oT||(oT=!0,dl=EvalError),dl}var fl={},sT=!1;function mk(){return sT||(sT=!0,fl=RangeError),fl}var pl={},aT=!1;function hk(){return aT||(aT=!0,pl=ReferenceError),pl}var gl={},lT=!1;function xT(){return lT||(lT=!0,gl=SyntaxError),gl}var yl={},uT=!1;function is(){return uT||(uT=!0,yl=TypeError),yl}var ml={},cT=!1;function Tk(){return cT||(cT=!0,ml=URIError),ml}var hl={},dT=!1;function vk(){if(dT)return hl;dT=!0;var t=typeof Symbol<"u"&&Symbol,e=kl();return hl=function(){return typeof t!="function"||typeof Symbol!="function"||typeof t("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},hl}var Tl={},fT=!1;function _k(){if(fT)return Tl;fT=!0;var t={__proto__:null,foo:{}},e=Object;return Tl=function(){return{__proto__:t}.foo===t.foo&&!(t instanceof e)},Tl}var vl={},pT=!1;function bk(){if(pT)return vl;pT=!0;var t="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,n=Math.max,r="[object Function]",o=function(l,c){for(var f=[],y=0;y<l.length;y+=1)f[y]=l[y];for(var g=0;g<c.length;g+=1)f[g+l.length]=c[g];return f},s=function(l,c){for(var f=[],y=c,g=0;y<l.length;y+=1,g+=1)f[g]=l[y];return f},i=function(a,l){for(var c="",f=0;f<a.length;f+=1)c+=a[f],f+1<a.length&&(c+=l);return c};return vl=function(l){var c=this;if(typeof c!="function"||e.apply(c)!==r)throw new TypeError(t+c);for(var f=s(arguments,1),y,g=function(){if(this instanceof y){var _=c.apply(this,o(f,arguments));return Object(_)===_?_:this}return c.apply(l,o(f,arguments))},h=n(0,c.length-f.length),T=[],x=0;x<h;x++)T[x]="$"+x;if(y=Function("binder","return function ("+i(T,",")+"){ return binder.apply(this,arguments); }")(g),c.prototype){var B=function(){};B.prototype=c.prototype,y.prototype=new B,B.prototype=null}return y},vl}var _l={},gT=!1;function Al(){if(gT)return _l;gT=!0;var t=bk();return _l=Function.prototype.bind||t,_l}var bl={},yT=!1;function wk(){if(yT)return bl;yT=!0;var t=Function.prototype.call,e=Object.prototype.hasOwnProperty,n=Al();return bl=n.call(t,e),bl}var wl={},mT=!1;function ci(){if(mT)return wl;mT=!0;var t,e=gk(),n=yk(),r=mk(),o=hk(),s=xT(),i=is(),a=Tk(),l=Function,c=function(Ue){try{return l('"use strict"; return ('+Ue+").constructor;")()}catch{}},f=Object.getOwnPropertyDescriptor;if(f)try{f({},"")}catch{f=null}var y=function(){throw new i},g=f?(function(){try{return arguments.callee,y}catch{try{return f(arguments,"callee").get}catch{return y}}})():y,h=vk()(),T=_k()(),x=Object.getPrototypeOf||(T?function(Ue){return Ue.__proto__}:null),B={},_=typeof Uint8Array>"u"||!x?t:x(Uint8Array),S={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?t:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?t:ArrayBuffer,"%ArrayIteratorPrototype%":h&&x?x([][Symbol.iterator]()):t,"%AsyncFromSyncIteratorPrototype%":t,"%AsyncFunction%":B,"%AsyncGenerator%":B,"%AsyncGeneratorFunction%":B,"%AsyncIteratorPrototype%":B,"%Atomics%":typeof Atomics>"u"?t:Atomics,"%BigInt%":typeof BigInt>"u"?t:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?t:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?t:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?t:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":e,"%eval%":eval,"%EvalError%":n,"%Float32Array%":typeof Float32Array>"u"?t:Float32Array,"%Float64Array%":typeof Float64Array>"u"?t:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?t:FinalizationRegistry,"%Function%":l,"%GeneratorFunction%":B,"%Int8Array%":typeof Int8Array>"u"?t:Int8Array,"%Int16Array%":typeof Int16Array>"u"?t:Int16Array,"%Int32Array%":typeof Int32Array>"u"?t:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":h&&x?x(x([][Symbol.iterator]())):t,"%JSON%":typeof JSON=="object"?JSON:t,"%Map%":typeof Map>"u"?t:Map,"%MapIteratorPrototype%":typeof Map>"u"||!h||!x?t:x(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?t:Promise,"%Proxy%":typeof Proxy>"u"?t:Proxy,"%RangeError%":r,"%ReferenceError%":o,"%Reflect%":typeof Reflect>"u"?t:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?t:Set,"%SetIteratorPrototype%":typeof Set>"u"||!h||!x?t:x(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?t:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":h&&x?x(""[Symbol.iterator]()):t,"%Symbol%":h?Symbol:t,"%SyntaxError%":s,"%ThrowTypeError%":g,"%TypedArray%":_,"%TypeError%":i,"%Uint8Array%":typeof Uint8Array>"u"?t:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?t:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?t:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?t:Uint32Array,"%URIError%":a,"%WeakMap%":typeof WeakMap>"u"?t:WeakMap,"%WeakRef%":typeof WeakRef>"u"?t:WeakRef,"%WeakSet%":typeof WeakSet>"u"?t:WeakSet};if(x)try{null.error}catch(Ue){var E=x(x(Ue));S["%Error.prototype%"]=E}var H=function Ue(xe){var Se;if(xe==="%AsyncFunction%")Se=c("async function () {}");else if(xe==="%GeneratorFunction%")Se=c("function* () {}");else if(xe==="%AsyncGeneratorFunction%")Se=c("async function* () {}");else if(xe==="%AsyncGenerator%"){var de=Ue("%AsyncGeneratorFunction%");de&&(Se=de.prototype)}else if(xe==="%AsyncIteratorPrototype%"){var Te=Ue("%AsyncGenerator%");Te&&x&&(Se=x(Te.prototype))}return S[xe]=Se,Se},Z={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},re=Al(),ee=wk(),ge=re.call(Function.call,Array.prototype.concat),se=re.call(Function.apply,Array.prototype.splice),ie=re.call(Function.call,String.prototype.replace),Oe=re.call(Function.call,String.prototype.slice),ze=re.call(Function.call,RegExp.prototype.exec),nt=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Ve=/\\(\\)?/g,Je=function(xe){var Se=Oe(xe,0,1),de=Oe(xe,-1);if(Se==="%"&&de!=="%")throw new s("invalid intrinsic syntax, expected closing `%`");if(de==="%"&&Se!=="%")throw new s("invalid intrinsic syntax, expected opening `%`");var Te=[];return ie(xe,nt,function(D,K,F,fe){Te[Te.length]=F?ie(fe,Ve,"$1"):K||D}),Te},Tt=function(xe,Se){var de=xe,Te;if(ee(Z,de)&&(Te=Z[de],de="%"+Te[0]+"%"),ee(S,de)){var D=S[de];if(D===B&&(D=H(de)),typeof D>"u"&&!Se)throw new i("intrinsic "+xe+" exists, but is not available. Please file an issue!");return{alias:Te,name:de,value:D}}throw new s("intrinsic "+xe+" does not exist!")};return wl=function(xe,Se){if(typeof xe!="string"||xe.length===0)throw new i("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof Se!="boolean")throw new i('"allowMissing" argument must be a boolean');if(ze(/^%?[^%]*%?$/,xe)===null)throw new s("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var de=Je(xe),Te=de.length>0?de[0]:"",D=Tt("%"+Te+"%",Se),K=D.name,F=D.value,fe=!1,ve=D.alias;ve&&(Te=ve[0],se(de,ge([0,1],ve)));for(var M=1,C=!0;M<de.length;M+=1){var $=de[M],Y=Oe($,0,1),oe=Oe($,-1);if((Y==='"'||Y==="'"||Y==="`"||oe==='"'||oe==="'"||oe==="`")&&Y!==oe)throw new s("property names with quotes must have matching quotes");if(($==="constructor"||!C)&&(fe=!0),Te+="."+$,K="%"+Te+"%",ee(S,K))F=S[K];else if(F!=null){if(!($ in F)){if(!Se)throw new i("base intrinsic for "+xe+" exists, but the property is not available.");return}if(f&&M+1>=de.length){var w=f(F,$);C=!!w,C&&"get"in w&&!("originalValue"in w.get)?F=w.get:F=F[$]}else C=ee(F,$),F=F[$];C&&!fe&&(S[K]=F)}}return F},wl}var Pl={},hT=!1;function Cl(){if(hT)return Pl;hT=!0;var t=ci(),e=t("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return Pl=e,Pl}var xl={},TT=!1;function os(){if(TT)return xl;TT=!0;var t=ci(),e=t("%Object.getOwnPropertyDescriptor%",!0);if(e)try{e([],"length")}catch{e=null}return xl=e,xl}var Bl={},vT=!1;function Pk(){if(vT)return Bl;vT=!0;var t=Cl(),e=xT(),n=is(),r=os();return Bl=function(s,i,a){if(!s||typeof s!="object"&&typeof s!="function")throw new n("`obj` must be an object or a function`");if(typeof i!="string"&&typeof i!="symbol")throw new n("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new n("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new n("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new n("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new n("`loose`, if provided, must be a boolean");var l=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,f=arguments.length>5?arguments[5]:null,y=arguments.length>6?arguments[6]:!1,g=!!r&&r(s,i);if(t)t(s,i,{configurable:f===null&&g?g.configurable:!f,enumerable:l===null&&g?g.enumerable:!l,value:a,writable:c===null&&g?g.writable:!c});else if(y||!l&&!c&&!f)s[i]=a;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Bl}var El={},_T=!1;function xk(){if(_T)return El;_T=!0;var t=Cl(),e=function(){return!!t};return e.hasArrayLengthDefineBug=function(){if(!t)return null;try{return t([],"length",{value:1}).length!==1}catch{return!0}},El=e,El}var Sl={},bT=!1;function Bk(){if(bT)return Sl;bT=!0;var t=ci(),e=Pk(),n=xk()(),r=os(),o=is(),s=t("%Math.floor%");return Sl=function(a,l){if(typeof a!="function")throw new o("`fn` is not a function");if(typeof l!="number"||l<0||l>4294967295||s(l)!==l)throw new o("`length` must be a positive 32-bit integer");var c=arguments.length>2&&!!arguments[2],f=!0,y=!0;if("length"in a&&r){var g=r(a,"length");g&&!g.configurable&&(f=!1),g&&!g.writable&&(y=!1)}return(f||y||!c)&&(n?e(a,"length",l,!0,!0):e(a,"length",l)),a},Sl}var ui={},wT=!1;function Ol(){if(wT)return ui;wT=!0;var t=Al(),e=ci(),n=Bk(),r=is(),o=e("%Function.prototype.apply%"),s=e("%Function.prototype.call%"),i=e("%Reflect.apply%",!0)||t.call(s,o),a=Cl(),l=e("%Math.max%");ui=function(y){if(typeof y!="function")throw new r("a function is required");var g=i(t,s,arguments);return n(g,1+l(0,y.length-(arguments.length-1)),!0)};var c=function(){return i(t,o,arguments)};return a?a(ui,"apply",{value:c}):ui.apply=c,ui}var Il={},PT=!1;function Rl(){if(PT)return Il;PT=!0;var t=ci(),e=Ol(),n=e(t("String.prototype.indexOf"));return Il=function(o,s){var i=t(o,!!s);return typeof i=="function"&&n(o,".prototype.")>-1?e(i):i},Il}da();Ia();var Ml={},BT=!1;function Fl(){if(BT)return Ml;BT=!0;var t=kl();return Ml=function(){return t()&&!!Symbol.toStringTag},Ml}var Nl={},ET=!1;function Ek(){if(ET)return Nl;ET=!0;var t=Fl()(),e=Rl(),n=e("Object.prototype.toString"),r=function(a){return t&&a&&typeof a=="object"&&Symbol.toStringTag in a?!1:n(a)==="[object Arguments]"},o=function(a){return r(a)?!0:a!==null&&typeof a=="object"&&typeof a.length=="number"&&a.length>=0&&n(a)!=="[object Array]"&&n(a.callee)==="[object Function]"},s=(function(){return r(arguments)})();return r.isLegacyArguments=o,Nl=s?r:o,Nl}var Dl={},ST=!1;function Sk(){if(ST)return Dl;ST=!0;var t=Object.prototype.toString,e=Function.prototype.toString,n=/^\s*(?:function)?\*/,r=Fl()(),o=Object.getPrototypeOf,s=function(){if(!r)return!1;try{return Function("return function*() {}")()}catch{}},i;return Dl=function(l){if(typeof l!="function")return!1;if(n.test(e.call(l)))return!0;if(!r){var c=t.call(l);return c==="[object GeneratorFunction]"}if(!o)return!1;if(typeof i>"u"){var f=s();i=f?o(f):!1}return o(l)===i},Dl}var Hl={},IT=!1;function Ik(){if(IT)return Hl;IT=!0;var t=Function.prototype.toString,e=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,n,r;if(typeof e=="function"&&typeof Object.defineProperty=="function")try{n=Object.defineProperty({},"length",{get:function(){throw r}}),r={},e(function(){throw 42},null,n)}catch(S){S!==r&&(e=null)}else e=null;var o=/^\s*class\b/,s=function(E){try{var H=t.call(E);return o.test(H)}catch{return!1}},i=function(E){try{return s(E)?!1:(t.call(E),!0)}catch{return!1}},a=Object.prototype.toString,l="[object Object]",c="[object Function]",f="[object GeneratorFunction]",y="[object HTMLAllCollection]",g="[object HTML document.all class]",h="[object HTMLCollection]",T=typeof Symbol=="function"&&!!Symbol.toStringTag,x=!(0 in[,]),B=function(){return!1};if(typeof document=="object"){var _=document.all;a.call(_)===a.call(document.all)&&(B=function(E){if((x||!E)&&(typeof E>"u"||typeof E=="object"))try{var H=a.call(E);return(H===y||H===g||H===h||H===l)&&E("")==null}catch{}return!1})}return Hl=e?function(E){if(B(E))return!0;if(!E||typeof E!="function"&&typeof E!="object")return!1;try{e(E,null,n)}catch(H){if(H!==r)return!1}return!s(E)&&i(E)}:function(E){if(B(E))return!0;if(!E||typeof E!="function"&&typeof E!="object")return!1;if(T)return i(E);if(s(E))return!1;var H=a.call(E);return H!==c&&H!==f&&!/^\[object HTML/.test(H)?!1:i(E)},Hl}var Ul={},kT=!1;function kk(){if(kT)return Ul;kT=!0;var t=Ik(),e=Object.prototype.toString,n=Object.prototype.hasOwnProperty,r=function(l,c,f){for(var y=0,g=l.length;y<g;y++)n.call(l,y)&&(f==null?c(l[y],y,l):c.call(f,l[y],y,l))},o=function(l,c,f){for(var y=0,g=l.length;y<g;y++)f==null?c(l.charAt(y),y,l):c.call(f,l.charAt(y),y,l)},s=function(l,c,f){for(var y in l)n.call(l,y)&&(f==null?c(l[y],y,l):c.call(f,l[y],y,l))},i=function(l,c,f){if(!t(c))throw new TypeError("iterator must be a function");var y;arguments.length>=3&&(y=f),e.call(l)==="[object Array]"?r(l,c,y):typeof l=="string"?o(l,c,y):s(l,c,y)};return Ul=i,Ul}var jl={},AT=!1;function Ak(){return AT||(AT=!0,jl=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),jl}var $l={},CT=!1,Ck=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function Ok(){if(CT)return $l;CT=!0;var t=Ak(),e=typeof globalThis>"u"?Ck:globalThis;return $l=function(){for(var r=[],o=0;o<t.length;o++)typeof e[t[o]]=="function"&&(r[r.length]=t[o]);return r},$l}var Zl={},OT=!1,Rk=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function HT(){if(OT)return Zl;OT=!0;var t=kk(),e=Ok(),n=Ol(),r=Rl(),o=os(),s=r("Object.prototype.toString"),i=Fl()(),a=typeof globalThis>"u"?Rk:globalThis,l=e(),c=r("String.prototype.slice"),f=Object.getPrototypeOf,y=r("Array.prototype.indexOf",!0)||function(B,_){for(var S=0;S<B.length;S+=1)if(B[S]===_)return S;return-1},g={__proto__:null};i&&o&&f?t(l,function(x){var B=new a[x];if(Symbol.toStringTag in B){var _=f(B),S=o(_,Symbol.toStringTag);if(!S){var E=f(_);S=o(E,Symbol.toStringTag)}g["$"+x]=n(S.get)}}):t(l,function(x){var B=new a[x],_=B.slice||B.set;_&&(g["$"+x]=n(_))});var h=function(B){var _=!1;return t(g,function(S,E){if(!_)try{"$"+S(B)===E&&(_=c(E,1))}catch{}}),_},T=function(B){var _=!1;return t(g,function(S,E){if(!_)try{S(B),_=c(E,1)}catch{}}),_};return Zl=function(B){if(!B||typeof B!="object")return!1;if(!i){var _=c(s(B),8,-1);return y(l,_)>-1?_:_!=="Object"?!1:T(B)}return o?h(B):null},Zl}var Kl={},RT=!1;function Mk(){if(RT)return Kl;RT=!0;var t=HT();return Kl=function(n){return!!t(n)},Kl}var we={},MT=!1;function Nk(){if(MT)return we;MT=!0;var t=Ek(),e=Sk(),n=HT(),r=Mk();function o(j){return j.call.bind(j)}var s=typeof BigInt<"u",i=typeof Symbol<"u",a=o(Object.prototype.toString),l=o(Number.prototype.valueOf),c=o(String.prototype.valueOf),f=o(Boolean.prototype.valueOf);if(s)var y=o(BigInt.prototype.valueOf);if(i)var g=o(Symbol.prototype.valueOf);function h(j,Rt){if(typeof j!="object")return!1;try{return Rt(j),!0}catch{return!1}}we.isArgumentsObject=t,we.isGeneratorFunction=e,we.isTypedArray=r;function T(j){return typeof Promise<"u"&&j instanceof Promise||j!==null&&typeof j=="object"&&typeof j.then=="function"&&typeof j.catch=="function"}we.isPromise=T;function x(j){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(j):r(j)||D(j)}we.isArrayBufferView=x;function B(j){return n(j)==="Uint8Array"}we.isUint8Array=B;function _(j){return n(j)==="Uint8ClampedArray"}we.isUint8ClampedArray=_;function S(j){return n(j)==="Uint16Array"}we.isUint16Array=S;function E(j){return n(j)==="Uint32Array"}we.isUint32Array=E;function H(j){return n(j)==="Int8Array"}we.isInt8Array=H;function Z(j){return n(j)==="Int16Array"}we.isInt16Array=Z;function re(j){return n(j)==="Int32Array"}we.isInt32Array=re;function ee(j){return n(j)==="Float32Array"}we.isFloat32Array=ee;function ge(j){return n(j)==="Float64Array"}we.isFloat64Array=ge;function se(j){return n(j)==="BigInt64Array"}we.isBigInt64Array=se;function ie(j){return n(j)==="BigUint64Array"}we.isBigUint64Array=ie;function Oe(j){return a(j)==="[object Map]"}Oe.working=typeof Map<"u"&&Oe(new Map);function ze(j){return typeof Map>"u"?!1:Oe.working?Oe(j):j instanceof Map}we.isMap=ze;function nt(j){return a(j)==="[object Set]"}nt.working=typeof Set<"u"&&nt(new Set);function Ve(j){return typeof Set>"u"?!1:nt.working?nt(j):j instanceof Set}we.isSet=Ve;function Je(j){return a(j)==="[object WeakMap]"}Je.working=typeof WeakMap<"u"&&Je(new WeakMap);function Tt(j){return typeof WeakMap>"u"?!1:Je.working?Je(j):j instanceof WeakMap}we.isWeakMap=Tt;function Ue(j){return a(j)==="[object WeakSet]"}Ue.working=typeof WeakSet<"u"&&Ue(new WeakSet);function xe(j){return Ue(j)}we.isWeakSet=xe;function Se(j){return a(j)==="[object ArrayBuffer]"}Se.working=typeof ArrayBuffer<"u"&&Se(new ArrayBuffer);function de(j){return typeof ArrayBuffer>"u"?!1:Se.working?Se(j):j instanceof ArrayBuffer}we.isArrayBuffer=de;function Te(j){return a(j)==="[object DataView]"}Te.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&Te(new DataView(new ArrayBuffer(1),0,1));function D(j){return typeof DataView>"u"?!1:Te.working?Te(j):j instanceof DataView}we.isDataView=D;var K=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function F(j){return a(j)==="[object SharedArrayBuffer]"}function fe(j){return typeof K>"u"?!1:(typeof F.working>"u"&&(F.working=F(new K)),F.working?F(j):j instanceof K)}we.isSharedArrayBuffer=fe;function ve(j){return a(j)==="[object AsyncFunction]"}we.isAsyncFunction=ve;function M(j){return a(j)==="[object Map Iterator]"}we.isMapIterator=M;function C(j){return a(j)==="[object Set Iterator]"}we.isSetIterator=C;function $(j){return a(j)==="[object Generator]"}we.isGeneratorObject=$;function Y(j){return a(j)==="[object WebAssembly.Module]"}we.isWebAssemblyCompiledModule=Y;function oe(j){return h(j,l)}we.isNumberObject=oe;function w(j){return h(j,c)}we.isStringObject=w;function P(j){return h(j,f)}we.isBooleanObject=P;function z(j){return s&&h(j,y)}we.isBigIntObject=z;function Q(j){return i&&h(j,g)}we.isSymbolObject=Q;function Me(j){return oe(j)||w(j)||P(j)||z(j)||Q(j)}we.isBoxedPrimitive=Me;function _e(j){return typeof Uint8Array<"u"&&(de(j)||fe(j))}return we.isAnyArrayBuffer=_e,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(j){Object.defineProperty(we,j,{enumerable:!1,value:function(){throw new Error(j+" is not supported in userland")}})}),we}var Ll={},NT=!1;function Dk(){return NT||(NT=!0,Ll=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"}),Ll}var Pe={},DT=!1,di=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function Hk(){if(DT)return Pe;DT=!0;var t=Nt,e=Object.getOwnPropertyDescriptors||function(K){for(var F=Object.keys(K),fe={},ve=0;ve<F.length;ve++)fe[F[ve]]=Object.getOwnPropertyDescriptor(K,F[ve]);return fe},n=/%[sdj%]/g;Pe.format=function(D){if(!Z(D)){for(var K=[],F=0;F<arguments.length;F++)K.push(i(arguments[F]));return K.join(" ")}for(var F=1,fe=arguments,ve=fe.length,M=String(D).replace(n,function($){if($==="%%")return"%";if(F>=ve)return $;switch($){case"%s":return String(fe[F++]);case"%d":return Number(fe[F++]);case"%j":try{return JSON.stringify(fe[F++])}catch{return"[Circular]"}default:return $}}),C=fe[F];F<ve;C=fe[++F])S(C)||!se(C)?M+=" "+C:M+=" "+i(C);return M},Pe.deprecate=function(D,K){if(typeof t<"u"&&t.noDeprecation===!0)return D;if(typeof t>"u")return function(){return Pe.deprecate(D,K).apply(this||di,arguments)};var F=!1;function fe(){if(!F){if(t.throwDeprecation)throw new Error(K);t.traceDeprecation?console.trace(K):console.error(K),F=!0}return D.apply(this||di,arguments)}return fe};var r={},o=/^$/;if(t.env.NODE_DEBUG){var s=t.env.NODE_DEBUG;s=s.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),o=new RegExp("^"+s+"$","i")}Pe.debuglog=function(D){if(D=D.toUpperCase(),!r[D])if(o.test(D)){var K=t.pid;r[D]=function(){var F=Pe.format.apply(Pe,arguments);console.error("%s %d: %s",D,K,F)}}else r[D]=function(){};return r[D]};function i(D,K){var F={seen:[],stylize:l};return arguments.length>=3&&(F.depth=arguments[2]),arguments.length>=4&&(F.colors=arguments[3]),_(K)?F.showHidden=K:K&&Pe._extend(F,K),ee(F.showHidden)&&(F.showHidden=!1),ee(F.depth)&&(F.depth=2),ee(F.colors)&&(F.colors=!1),ee(F.customInspect)&&(F.customInspect=!0),F.colors&&(F.stylize=a),f(F,D,F.depth)}Pe.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function a(D,K){var F=i.styles[K];return F?"\x1B["+i.colors[F][0]+"m"+D+"\x1B["+i.colors[F][1]+"m":D}function l(D,K){return D}function c(D){var K={};return D.forEach(function(F,fe){K[F]=!0}),K}function f(D,K,F){if(D.customInspect&&K&&ze(K.inspect)&&K.inspect!==Pe.inspect&&!(K.constructor&&K.constructor.prototype===K)){var fe=K.inspect(F,D);return Z(fe)||(fe=f(D,fe,F)),fe}var ve=y(D,K);if(ve)return ve;var M=Object.keys(K),C=c(M);if(D.showHidden&&(M=Object.getOwnPropertyNames(K)),Oe(K)&&(M.indexOf("message")>=0||M.indexOf("description")>=0))return g(K);if(M.length===0){if(ze(K)){var $=K.name?": "+K.name:"";return D.stylize("[Function"+$+"]","special")}if(ge(K))return D.stylize(RegExp.prototype.toString.call(K),"regexp");if(ie(K))return D.stylize(Date.prototype.toString.call(K),"date");if(Oe(K))return g(K)}var Y="",oe=!1,w=["{","}"];if(B(K)&&(oe=!0,w=["[","]"]),ze(K)){var P=K.name?": "+K.name:"";Y=" [Function"+P+"]"}if(ge(K)&&(Y=" "+RegExp.prototype.toString.call(K)),ie(K)&&(Y=" "+Date.prototype.toUTCString.call(K)),Oe(K)&&(Y=" "+g(K)),M.length===0&&(!oe||K.length==0))return w[0]+Y+w[1];if(F<0)return ge(K)?D.stylize(RegExp.prototype.toString.call(K),"regexp"):D.stylize("[Object]","special");D.seen.push(K);var z;return oe?z=h(D,K,F,C,M):z=M.map(function(Q){return T(D,K,F,C,Q,oe)}),D.seen.pop(),x(z,Y,w)}function y(D,K){if(ee(K))return D.stylize("undefined","undefined");if(Z(K)){var F="'"+JSON.stringify(K).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return D.stylize(F,"string")}if(H(K))return D.stylize(""+K,"number");if(_(K))return D.stylize(""+K,"boolean");if(S(K))return D.stylize("null","null")}function g(D){return"["+Error.prototype.toString.call(D)+"]"}function h(D,K,F,fe,ve){for(var M=[],C=0,$=K.length;C<$;++C)xe(K,String(C))?M.push(T(D,K,F,fe,String(C),!0)):M.push("");return ve.forEach(function(Y){Y.match(/^\d+$/)||M.push(T(D,K,F,fe,Y,!0))}),M}function T(D,K,F,fe,ve,M){var C,$,Y;if(Y=Object.getOwnPropertyDescriptor(K,ve)||{value:K[ve]},Y.get?Y.set?$=D.stylize("[Getter/Setter]","special"):$=D.stylize("[Getter]","special"):Y.set&&($=D.stylize("[Setter]","special")),xe(fe,ve)||(C="["+ve+"]"),$||(D.seen.indexOf(Y.value)<0?(S(F)?$=f(D,Y.value,null):$=f(D,Y.value,F-1),$.indexOf(`
85
85
  `)>-1&&(M?$=$.split(`
86
86
  `).map(function(oe){return" "+oe}).join(`
87
87
  `).slice(2):$=`
@@ -90,10 +90,23 @@ declare function ${r}${i};${l}`);if(t.props.type==="variable")return cs(`${o}dec
90
90
  `))):$=D.stylize("[Circular]","special")),ee(C)){if(M&&ve.match(/^\d+$/))return $;C=JSON.stringify(""+ve),C.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(C=C.slice(1,-1),C=D.stylize(C,"name")):(C=C.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),C=D.stylize(C,"string"))}return C+": "+$}function x(D,K,F){var fe=D.reduce(function(ve,M){return M.indexOf(`
91
91
  `)>=0,ve+M.replace(/\u001b\[\d\d?m/g,"").length+1},0);return fe>60?F[0]+(K===""?"":K+`
92
92
  `)+" "+D.join(`,
93
- `)+" "+F[1]:F[0]+K+" "+D.join(", ")+" "+F[1]}Pe.types=Nk();function B(D){return Array.isArray(D)}Pe.isArray=B;function _(D){return typeof D=="boolean"}Pe.isBoolean=_;function S(D){return D===null}Pe.isNull=S;function E(D){return D==null}Pe.isNullOrUndefined=E;function H(D){return typeof D=="number"}Pe.isNumber=H;function Z(D){return typeof D=="string"}Pe.isString=Z;function re(D){return typeof D=="symbol"}Pe.isSymbol=re;function ee(D){return D===void 0}Pe.isUndefined=ee;function ge(D){return se(D)&&Ve(D)==="[object RegExp]"}Pe.isRegExp=ge,Pe.types.isRegExp=ge;function se(D){return typeof D=="object"&&D!==null}Pe.isObject=se;function ie(D){return se(D)&&Ve(D)==="[object Date]"}Pe.isDate=ie,Pe.types.isDate=ie;function Oe(D){return se(D)&&(Ve(D)==="[object Error]"||D instanceof Error)}Pe.isError=Oe,Pe.types.isNativeError=Oe;function ze(D){return typeof D=="function"}Pe.isFunction=ze;function nt(D){return D===null||typeof D=="boolean"||typeof D=="number"||typeof D=="string"||typeof D=="symbol"||typeof D>"u"}Pe.isPrimitive=nt,Pe.isBuffer=Dk();function Ve(D){return Object.prototype.toString.call(D)}function Je(D){return D<10?"0"+D.toString(10):D.toString(10)}var Tt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ue(){var D=new Date,K=[Je(D.getHours()),Je(D.getMinutes()),Je(D.getSeconds())].join(":");return[D.getDate(),Tt[D.getMonth()],K].join(" ")}Pe.log=function(){console.log("%s - %s",Ue(),Pe.format.apply(Pe,arguments))},Pe.inherits=Zt(),Pe._extend=function(D,K){if(!K||!se(K))return D;for(var F=Object.keys(K),fe=F.length;fe--;)D[F[fe]]=K[F[fe]];return D};function xe(D,K){return Object.prototype.hasOwnProperty.call(D,K)}var Se=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;Pe.promisify=function(K){if(typeof K!="function")throw new TypeError('The "original" argument must be of type Function');if(Se&&K[Se]){if(F=K[Se],typeof F!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(F,Se,{value:F,enumerable:!1,writable:!1,configurable:!0}),F}function F(){for(var fe,ve,M=new Promise(function(Y,oe){fe=Y,ve=oe}),C=[],$=0;$<arguments.length;$++)C.push(arguments[$]);C.push(function(Y,oe){Y?ve(Y):fe(oe)});try{K.apply(this||di,C)}catch(Y){ve(Y)}return M}return Object.setPrototypeOf(F,Object.getPrototypeOf(K)),Se&&Object.defineProperty(F,Se,{value:F,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(F,e(K))},Pe.promisify.custom=Se;function de(D,K){if(!D){var F=new Error("Promise was rejected with a falsy value");F.reason=D,D=F}return K(D)}function Te(D){if(typeof D!="function")throw new TypeError('The "original" argument must be of type Function');function K(){for(var F=[],fe=0;fe<arguments.length;fe++)F.push(arguments[fe]);var ve=F.pop();if(typeof ve!="function")throw new TypeError("The last argument must be of type Function");var M=this||di,C=function(){return ve.apply(M,arguments)};D.apply(this||di,F).then(function($){t.nextTick(C.bind(null,null,$))},function($){t.nextTick(de.bind(null,$,C))})}return Object.setPrototypeOf(K,Object.getPrototypeOf(D)),Object.defineProperties(K,e(D)),K}return Pe.callbackify=Te,Pe}var ce=Hk();ce.format;ce.deprecate;ce.debuglog;ce.inspect;ce.types;ce.isArray;ce.isBoolean;ce.isNull;ce.isNullOrUndefined;ce.isNumber;ce.isString;ce.isSymbol;ce.isUndefined;ce.isRegExp;ce.isObject;ce.isDate;ce.isError;ce.isFunction;ce.isPrimitive;ce.isBuffer;ce.log;ce.inherits;ce._extend;ce.promisify;ce.callbackify;var p0=ce._extend,g0=ce.callbackify,y0=ce.debuglog,m0=ce.deprecate,h0=ce.format,T0=ce.inherits,v0=ce.inspect,_0=ce.isArray,b0=ce.isBoolean,w0=ce.isBuffer,P0=ce.isDate,x0=ce.isError,B0=ce.isFunction,E0=ce.isNull,S0=ce.isNullOrUndefined,I0=ce.isNumber,k0=ce.isObject,A0=ce.isPrimitive,C0=ce.isRegExp,O0=ce.isString,R0=ce.isSymbol,M0=ce.isUndefined,N0=ce.log,D0=ce.promisify,H0=ce.types,U0=ce.TextEncoder=globalThis.TextEncoder,j0=ce.TextDecoder=globalThis.TextDecoder;var _r=class{defaultOptions;constructor(e){this.defaultOptions=e}info(...e){this._log("info",e)}debug(...e){this._log("debug",e)}warn(...e){this._log("warn",e)}error(...e){this._log("error",e)}_log(e,n){this._getConsoleMethod(e)(this._serializeMessage(n))}_serializeMessage(e){let n=ce.format(...e);return V.env.BP_LOG_FORMAT==="json"?this.getJsonMessage(n):n}getJsonMessage(e){return JSON.stringify({msg:e,options:this.defaultOptions})}_getConsoleMethod(e){switch(e){case"debug":return console.debug;case"warn":return console.warn;case"error":return console.error;default:return console.info}}};var fi=class t extends _r{constructor(e){super({visibleToBotOwners:!0,...e})}with(e){return new t({...this.defaultOptions,...e})}withUserId(e){return this.with({userId:e})}withConversationId(e){return this.with({conversationId:e})}withVisibleToBotOwners(e){return this.with({visibleToBotOwners:e})}forBot(){return this.withVisibleToBotOwners(!0)}getJsonMessage(e){return JSON.stringify({msg:e,visible_to_bot_owner:this.defaultOptions.visibleToBotOwners,options:this.defaultOptions})}};I();A();k();var Zk=t=>["traceparent","tracestate","sentry-trace"].reduce((e,n)=>(t[n]&&(e[n]=t[n]),e),{}),Kk=(t,e,n)=>{let[,r]=(e.headers.traceparent||"").split("-"),o=new jk({botId:t.botId,integrationId:t.integrationId,integrationAlias:t.integrationAlias,retry:Qo,headers:Zk(e.headers)}),s=new li(o),i=new fi({traceId:r});return{ctx:t,req:e,client:s,logger:i,instance:n}},Lk=async t=>{let{ctx:e}=t;switch(e.operation){case"webhook_received":return await Wk(t);case"register":return await zk(t);case"unregister":return await qk(t);case"message_created":return await Jk(t);case"action_triggered":return await Yk(t);case"ping":return await Fk(t);case"create_user":return await Gk(t);case"create_conversation":return await Vk(t);default:throw new $k(`Unknown operation ${e.operation}`)}},jT=t=>async e=>{let n=nT(e.headers),r=Kk(n,e,t),{logger:o}=r;try{let s;return s=await Xk(r),s?{...s,status:s.status??200}:(s=await Lk(r),s?{...s,status:s.status??200}:{status:200})}catch(s){if(Uk(s)){let a=s.type==="Runtime"?s:new UT(s.message,s);return o.forBot().error(a.message),{status:a.code,body:JSON.stringify(a.toJSON())}}console.error(s);let i=new UT("An unexpected error occurred in the integration. Bot owners: Check logs for more informations. Integration owners: throw a RuntimeError to return a custom error message instead.");return o.forBot().error(i.message),{status:i.code,body:JSON.stringify(i.toJSON())}}},Fk=async t=>{},Wk=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{let{req:s}=Dt(n);return o.webhook({client:t,ctx:e,req:s,logger:r})},zk=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{if(!o.register)return;let{webhookUrl:s}=Dt(n);await o.register({client:t,ctx:e,webhookUrl:s,logger:r})},qk=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{if(!o.unregister)return;let{webhookUrl:s}=Dt(n);await o.unregister({ctx:e,webhookUrl:s,client:t,logger:r})},Gk=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{if(!o.createUser)return;let{tags:s}=Dt(n);return await o.createUser({ctx:e,client:t,tags:s,logger:r})},Vk=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{if(!o.createConversation)return;let{channel:s,tags:i}=Dt(n);return await o.createConversation({ctx:e,client:t,channel:s,tags:i,logger:r})},Jk=async({ctx:t,req:e,client:n,logger:r,instance:o})=>{let{conversation:s,user:i,type:a,payload:l,message:c}=Dt(e),p=o.channels[s.channel];if(!p)throw new Error(`Channel ${s.channel} not found`);let y=p.messages[a];if(!y)throw new Error(`Message of type ${a} not found in channel ${s.channel}`);await y({ctx:t,conversation:s,message:c,user:i,type:a,client:n,payload:l,ack:async({tags:h})=>{await n.updateMessage({id:c.id,tags:h})},logger:r})},Yk=async({req:t,ctx:e,client:n,logger:r,instance:o})=>{let{input:s,type:i}=Dt(t);if(!i)throw new Error("Missing action type");let a=o.actions[i];if(!a)throw new Error(`Action ${i} not found`);let l=new es,p={output:await a({ctx:e,input:s,client:n,type:i,logger:r,metadata:l}),meta:l.toJSON()};return{body:JSON.stringify(p)}},Xk=async({instance:t,client:e,ctx:n,logger:r,req:o})=>{let s=t.unknownOperationHandler;if(s)return await s({client:e,ctx:n,logger:r,req:o})};var Wl=class{constructor(e){this.props=e;this.actions=e.actions,this.channels=e.channels,this.register=e.register,this.unregister=e.unregister,this.createUser=e.createUser,this.createConversation=e.createConversation,this.webhook=e.handler,this.unknownOperationHandler=e.__advanced?.unknownOperationHandler}actions;channels;register;unregister;createUser;createConversation;webhook;unknownOperationHandler;handler=jT(this);start=e=>Jo(this.handler,e)};I();A();k();I();A();k();I();A();k();I();A();k();var zl=class{constructor(e){this.props=e;this.integrations=e.integrations,this.plugins=e.plugins,this.user=e.user,this.conversation=e.conversation,this.message=e.message,this.states=e.states,this.configuration=e.configuration,this.events=e.events,this.recurringEvents=e.recurringEvents,this.actions=e.actions,this.tables=e.tables,this.workflows=e.workflows,this.attributes=e.attributes,this.__advanced=e.__advanced,this.withPlugins={user:e.user,conversation:e.conversation,message:e.message,states:e.states,events:e.events,recurringEvents:e.recurringEvents,actions:e.actions,tables:e.tables,workflows:e.workflows}}integrations;plugins;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;workflows;attributes;__advanced;withPlugins;get metadata(){return{sdkVersion:_n}}addIntegration(e,n){let r=this;r.integrations||(r.integrations={});let o=n?.alias??e.name;if(r.integrations[o])throw new Error(`Another integration with alias "${o}" is already installed in the bot`);return r.integrations[o]={...e,alias:o,enabled:n?.enabled,configurationType:n&&"configurationType"in n?n.configurationType:void 0,configuration:n&&"configuration"in n?n.configuration??{}:{},disabledChannels:n?.disabledChannels},this}addPlugin(e,n){let r=this;r.plugins||(r.plugins={});let o=n.alias??e.name;if(r.plugins[o])throw new Error(`Another plugin with alias "${o}" is already installed in the bot`);let s=Object.fromEntries(Object.entries(n.dependencies??{}).filter(([a,l])=>"integrationInterfaceAlias"in l).map(([a,l])=>{let c=this.integrations?.[l.integrationAlias];if(!c){let y=Object.keys(this.integrations??{}).join(", ")||"(none)";throw new Error(`Interface with alias "${a}" of plugin with alias "${o}" references integration with alias "${l.integrationAlias}" which is not installed. Please make sure to add the integration via addIntegration() before calling addPlugin().
94
- Available integration aliases: ${y}`)}let p=c.definition.interfaces?.[l.integrationInterfaceAlias];if(!p){let y=Object.keys(c.definition.interfaces??{}).join(", ")||"(none)";throw new Error(`Interface with alias "${l.integrationInterfaceAlias}" does not exist in integration "${c.name}" referenced by interface with alias "${a}" of plugin with alias "${o}".
95
- Available interface aliases: ${y}`)}return[a,{...p,id:c.id,name:c.name,version:c.version,...l}]})),i=Object.fromEntries(Object.entries(n.dependencies??{}).filter(([a,l])=>!("integrationInterfaceAlias"in l)).map(([a,l])=>{let c=this.integrations?.[l.integrationAlias];if(!c){let p=Object.keys(this.integrations??{}).join(", ")||"(none)";throw new Error(`Integration with alias "${a}" of plugin with alias "${o}" references integration with alias "${l.integrationAlias}" which is not installed. Please make sure to add the integration via addIntegration() before calling addPlugin().
96
- Available integration aliases: ${p}`)}return[a,{...c,...l}]}));return r.plugins[o]={...e,alias:o,configuration:n.configuration??{},interfaces:s,integrations:i},r.withPlugins.user=this._mergeUser(r.withPlugins.user,e.definition.user),r.withPlugins.conversation=this._mergeConversation(r.withPlugins.conversation,e.definition.conversation),r.withPlugins.message=this._mergeMessage(r.withPlugins.message,e.definition.message),r.withPlugins.recurringEvents=this._mergeRecurringEvents(r.withPlugins.recurringEvents,e.definition.recurringEvents),r.withPlugins.tables=this._mergeTables(r.withPlugins.tables,e.definition.tables),r.withPlugins.workflows=this._mergeWorkflows(r.withPlugins.workflows,e.definition.workflows),r.withPlugins.states=this._mergeStates(r.withPlugins.states,this._prefixKeysWithPluginAlias(e.definition.states,o)),r.withPlugins.events=this._mergeEvents(r.withPlugins.events,this._prefixKeysWithPluginAlias(e.definition.events,o)),r.withPlugins.actions=this._mergeActions(r.withPlugins.actions,this._prefixKeysWithPluginAlias(e.definition.actions,o)),this}_mergeUser=(e,n)=>({tags:{...e?.tags,...n?.tags}});_mergeConversation=(e,n)=>({tags:{...e?.tags,...n?.tags}});_mergeMessage=(e,n)=>({tags:{...e?.tags,...n?.tags}});_mergeStates=(e,n)=>({...e,...n});_mergeEvents=(e,n)=>({...e,...n});_mergeRecurringEvents=(e,n)=>({...e,...n});_mergeActions=(e,n)=>({...e,...n});_mergeTables=(e,n)=>({...e,...n});_mergeWorkflows=(e,n)=>({...e,...n});_prefixKeysWithPluginAlias=(e,n)=>Le.mapKeys(e??{},r=>`${n}${Ht}${r}`);dereferencePluginEntities(){let e=this._buildZuiReferenceMap();return{...this,withPlugins:{...this.withPlugins,events:this._dereferenceDefinitionSchemas(this.withPlugins.events,e),states:this._dereferenceDefinitionSchemas(this.withPlugins.states,e),tables:this._dereferenceDefinitionSchemas(this.withPlugins.tables,e),actions:this._dereferenceActionDefinitionSchemas(this.withPlugins.actions,e)},plugins:Object.fromEntries(Object.entries(this.plugins??{}).map(([n,r])=>[n,{...r,definition:{...r.definition,configuration:this._dereferenceDefinitionSchema(r.definition.configuration,e),events:this._dereferenceDefinitionSchemas(r.definition.events,e),states:this._dereferenceDefinitionSchemas(r.definition.states,e),tables:this._dereferenceDefinitionSchemas(r.definition.tables,e),actions:this._dereferenceActionDefinitionSchemas(r.definition.actions,e)}}]))}}_buildZuiReferenceMap(){let e={},n=Object.entries(this.plugins??{});for(let[r,o]of n){let s=Object.entries(o.interfaces??{});for(let[i,a]of s){let l=this.integrations?.[a.integrationAlias];if(!l)throw new Error(`Interface with alias "${i}" of plugin with alias "${r}" references integration "${a.name}" which is not installed`);let c=Object.entries(a.entities??{});for(let[p,{name:y}]of c){let g=l.definition.entities?.[y]?.schema;if(!g)throw new Error(`Interface entity "${y}" does not exist in integration "${l.name}"`);e[`interface:${i}/entities/${p}`]=g}}}return e}_dereferenceZuiSchema(e,n){return e.dereference(n)}_dereferenceDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,o])=>[r,this._dereferenceDefinitionSchema(o,n)]))}_dereferenceDefinitionSchema(e,n){return e&&{...e,schema:this._dereferenceZuiSchema(e.schema,n)}}_dereferenceActionDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,o])=>[r,{...o,input:{schema:this._dereferenceZuiSchema(o.input.schema,n)},output:{schema:this._dereferenceZuiSchema(o.output.schema,n)}}]))}};I();A();k();I();A();k();import{isApiError as iA,Client as oA,RuntimeError as KT}from"@botpress/client";I();A();k();var pi=class t extends _r{constructor(e){super({...e})}with(e){return new t({...this.defaultOptions,...e})}withUserId(e){return this.with({userId:e})}withConversationId(e){return this.with({conversationId:e})}withWorkflowId(e){return this.with({workflowId:e})}withEventId(e){return this.with({eventId:e})}withMessageId(e){return this.with({messageId:e})}};I();A();k();I();A();k();var un=class{constructor(e,n={before:{},after:{}}){this._client=e;this._hooks=n}get _inner(){return this._client}getConversation=(e=>this._run("getConversation",e));listConversations=(e=>this._run("listConversations",e));updateConversation=(e=>this._run("updateConversation",e));deleteConversation=(e=>this._run("deleteConversation",e));listParticipants=(e=>this._run("listParticipants",e));addParticipant=(e=>this._run("addParticipant",e));getParticipant=(e=>this._run("getParticipant",e));removeParticipant=(e=>this._run("removeParticipant",e));createEvent=(e=>this._run("createEvent",e));getEvent=(e=>this._run("getEvent",e));listEvents=(e=>this._run("listEvents",e));createMessage=(e=>this._run("createMessage",e));getOrCreateMessage=(e=>this._run("getOrCreateMessage",e));getMessage=(e=>this._run("getMessage",e));updateMessage=(e=>this._run("updateMessage",e));listMessages=(e=>this._run("listMessages",e));deleteMessage=(e=>this._run("deleteMessage",e));getUser=(e=>this._run("getUser",e));listUsers=(e=>this._run("listUsers",e));updateUser=(e=>this._run("updateUser",e));deleteUser=(e=>this._run("deleteUser",e));getState=(e=>this._run("getState",e));setState=(e=>this._run("setState",e));getOrSetState=(e=>this._run("getOrSetState",e));patchState=(e=>this._run("patchState",e));callAction=(e=>this._run("callAction",e));uploadFile=(e=>this._run("uploadFile",e));upsertFile=(e=>this._run("upsertFile",e));deleteFile=(e=>this._run("deleteFile",e));listFiles=(e=>this._run("listFiles",e));getFile=(e=>this._run("getFile",e));updateFileMetadata=(e=>this._run("updateFileMetadata",e));searchFiles=(e=>this._run("searchFiles",e));trackAnalytics=(e=>this._run("trackAnalytics",e));getTableRow=(e=>this._run("getTableRow",e));createTableRows=(e=>this._run("createTableRows",e));findTableRows=(e=>this._run("findTableRows",e));deleteTableRows=(e=>this._run("deleteTableRows",e));updateTableRows=(e=>this._run("updateTableRows",e));upsertTableRows=(e=>this._run("upsertTableRows",e));createWorkflow=(e=>this._run("createWorkflow",e));getOrCreateWorkflow=(e=>this._run("getOrCreateWorkflow",e));getWorkflow=(e=>this._run("getWorkflow",e));updateWorkflow=(e=>this._run("updateWorkflow",e));deleteWorkflow=(e=>this._run("deleteWorkflow",e));listWorkflows=(e=>this._run("listWorkflows",e));createConversation=e=>this._client.createConversation(e);getOrCreateConversation=e=>this._client.getOrCreateConversation(e);createUser=e=>this._client.createUser(e);getOrCreateUser=e=>this._client.getOrCreateUser(e);_run=async(e,n)=>{let r=this._hooks.before[e];r&&(n=await r(n));let o=await this._client[e](n),s=this._hooks.after[e];return s&&(o=await s(o,n)),o}};I();A();k();var Qk=X.enum(["event_received","register","unregister","ping","action_triggered"]),$T=t=>({botId:t[ts]||At("Missing bot id header"),operation:Qk.parse(t[rs]),type:t[tT]||At("Missing type header"),configuration:JSON.parse(q.from(t[ns]||At("Missing configuration header"),"base64").toString("utf-8"))});I();A();k();var ft={status:200};I();A();k();I();A();k();var ql=t=>{switch(t){case"workflow_continued":return"continued";case"workflow_started":return"started";case"workflow_timedout":return"timed_out";default:throw new Error(`Unsupported workflow update type: ${t}`)}};var eA=["child_workflow_deleted","child_workflow_finished","workflow_timedout","workflow_started","workflow_continued"],ZT=async(t,e)=>{if(t.ctx.type!=="workflow_update"||!eA.includes(e.payload.type))throw new Error("Unexpected event type");let n={...t,logger:tA(t,e)};if(!e.payload.workflow.name)return n.logger.warn("Received workflow update event without a workflow name. Assuming this workflow was not defined by the bot.",e.payload.workflow),ft;switch(e.payload.type){case"child_workflow_deleted":case"child_workflow_finished":n.logger.info(`Received child workflow event "${e.payload.type}", but child workflows are not yet supported`);break;case"workflow_timedout":case"workflow_started":case"workflow_continued":return await nA(n,e);default:e.payload.type}return ft},tA=(t,e)=>t.logger.with({eventId:e.id,workflowId:e.payload.workflow.id,conversationId:e.payload.conversation?.id,userId:e.payload.user?.id}),nA=async(t,e)=>{let n=ql(e.payload.type),r=t.self.workflowHandlers[n]?.[e.payload.workflow.name];if(!r||r.length===0)return t.logger.warn(`No ${n} handler found for workflow "${e.payload.workflow.name}"`),ft;let{updatedWorkflow:o}=await rA(t,e);return o.status==="pending"&&t.logger.warn(`Workflow "${e.payload.workflow.name}" is still in pending status after processing "${n}" event. This may indicate that the workflow was not properly acknowledged or terminated by the handler. `),ft},rA=async(t,e)=>{let n=ql(e.payload.type),r=t.self.workflowHandlers[n]?.[e.payload.workflow.name],o=structuredClone(e.payload.workflow);for(let s of r??[])o=await s({...t,event:e,conversation:e.payload.conversation,user:e.payload.user,workflow:o});return{updatedWorkflow:o}};I();A();k();var LT=t=>async e=>{let n=$T(e.headers),r=new pi,o=new oA({botId:n.botId,retry:Qo}),s=new un(o,{before:{createMessage:async a=>{let l=t.hookHandlers.before_outgoing_message[a.type]??[];for(let c of l){let p=new un(o);a=(await c({client:p,ctx:n,logger:r.with({conversationId:a.conversationId,userId:a.userId}),data:a}))?.data??a}return a},callAction:async a=>{let l=t.hookHandlers.before_outgoing_call_action[a.type]??[];for(let c of l){let p=new un(o);a=(await c({client:p,ctx:n,logger:r,data:a}))?.data??a}return a}},after:{createMessage:async a=>{let l=t.hookHandlers.after_outgoing_message[a.message.type]??[];for(let c of l){let p=new un(o);a=(await c({client:p,ctx:n,logger:r.with({messageId:a.message.id,conversationId:a.message.conversationId,userId:a.message.userId}),data:a}))?.data??a}return a},callAction:async(a,l)=>{let{type:c}=l,p=t.hookHandlers.after_outgoing_call_action[c]??[];for(let y of p){let g=new un(o);a=(await y({client:g,ctx:n,logger:r,data:{type:c,...a}}))?.data??a}return a}}}),i={req:e,ctx:n,logger:r,client:s,self:t};try{switch(n.operation){case"action_triggered":return await cA(i);case"event_received":return await uA(i);case"register":return await aA(i);case"unregister":return await lA(i);case"ping":return await sA(i);default:throw new Error(`Unknown operation ${n.operation}`)}}catch(a){let l=a instanceof Error?a:new Error(String(a));if(iA(l)){let p=l.type==="Runtime"?l:new KT(l.message,l);return r.error(p.message),{status:p.code,body:JSON.stringify(p.toJSON())}}let c=new KT("An unexpected error occurred in the bot.",l);return r.error(c.message,l),{status:c.code,body:JSON.stringify(c.toJSON())}}},sA=async t=>ft,aA=async t=>ft,lA=async t=>ft,uA=async t=>{let{ctx:e,logger:n,req:r,client:o,self:s}=t,i={client:o,ctx:e,logger:n},a=Dt(r);if(i.logger=i.logger.with({eventId:a.event.id,messageId:a.event.messageId,conversationId:a.event.conversationId,userId:a.event.userId}),e.type==="workflow_update")return await ZT(t,a.event);if(e.type==="message_created"){let h=a.event,T=h.payload.message;i.logger=i.logger.with({messageId:T.id,conversationId:T.conversationId,userId:T.userId});let x=s.hookHandlers.before_incoming_message[T.type]??[];for(let E of x){let H=await E({...i,data:T});if(T=H?.data??T,H?.stop)return ft}let B={...i,user:h.payload.user,conversation:h.payload.conversation,message:T,event:h},_=s.messageHandlers[T.type]??[];for(let E of _)await E(B);let S=s.hookHandlers.after_incoming_message[T.type]??[];for(let E of S){let H=await E({...i,data:T});if(T=H?.data??T,H?.stop)return ft}return ft}if(e.type==="state_expired"){let T=a.event.payload.state,x={...i,state:T},B=s.stateExpiredHandlers[T.name]??[];for(let _ of B)await _(x);return ft}let l=a.event,c=s.hookHandlers.before_incoming_event[l.type]??[];for(let h of c){let T=await h({...i,data:l});if(l=T?.data??l,T?.stop)return ft}let p={...i,event:l},y=s.eventHandlers[l.type]??[];for(let h of y)await h(p);let g=s.hookHandlers.after_incoming_event[l.type]??[];for(let h of g){let T=await h({...i,data:l});if(l=T?.data??l,T?.stop)return ft}return ft},cA=async({ctx:t,logger:e,req:n,client:r,self:o})=>{let{input:s,type:i}=Dt(n);if(!i)throw new Error("Missing action type");let a=o.hookHandlers.before_incoming_call_action[i]??[];for(let g of a){let h=await g({ctx:t,logger:e,client:r,data:{type:i,input:s}});s=h?.data?.input??s,i=h?.data?.type??i}let l=o.actionHandlers[i];if(!l)throw new Error(`Action ${i} not found`);let c=await l({ctx:t,logger:e,input:s,client:r,type:i}),p=o.hookHandlers.after_incoming_call_action[i]??[];for(let g of p){let h=await g({ctx:t,logger:e,client:r,data:{type:i,output:c}});i=h?.data?.type??i,c=h?.data?.output??c}return{status:200,body:JSON.stringify({output:c})}};I();A();k();I();A();k();I();A();k();var Wt=(t,{alias:e})=>{if(!("tags"in t)||!e)return t;let n=`${e}${Ht}`,r=Object.fromEntries(Object.entries(t.tags??{}).flatMap(([o,s])=>o.startsWith(n)?[[o.slice(n.length),s]]:[]));return{...t,tags:r}},ht=(t,{alias:e})=>{if(!("tags"in t)||!e)return t;let n=`${e}${Ht}`,r=Object.fromEntries(Object.entries(t.tags??{}).map(([o,s])=>[o.startsWith(n)?o:`${n}${o}`,s]));return{...t,tags:r}};I();A();k();var Gl=class{constructor(e){this._list=e}_nextToken;_elementsBuffer=[];_isExhausted=!1;[Symbol.asyncIterator](){return this}async next(){return this._bufferIsEmpty&&!this._isExhausted&&await this._fetchNextPageIntoBuffer(),this._bufferIsEmpty?{done:!0,value:void 0}:{done:!1,value:this._elementsBuffer.shift()}}async take(e){let n=[];for(let r=0;r<e;++r){let o=await this.next();if(o.done)break;n.push(o.value)}return n}async takePage(e){for(let r=0;r<e;++r)this._isExhausted||await this._fetchNextPageIntoBuffer();let n=[...this._elementsBuffer];return this._elementsBuffer.length=0,n}async takeAll(){return this.take(Number.POSITIVE_INFINITY)}get isExhausted(){return this._isExhausted}async _fetchNextPageIntoBuffer(){let{items:e,meta:n}=await this._list({nextToken:this._nextToken});this._elementsBuffer.push(...e),this._nextToken=n.nextToken,n.nextToken||(this._isExhausted=!0)}get _bufferIsEmpty(){return this._elementsBuffer.length===0}},Ct=t=>new Gl(t);var cn=t=>new Proxy({},{get:(e,n)=>({listInstances:r=>Ct(({nextToken:o})=>t.client.listWorkflows({...r,name:n,nextToken:o}).then(({meta:s,workflows:i})=>({meta:s,items:i.map(a=>Ot({...t,workflow:a}))}))),startNewInstance:async r=>{let{workflow:o}=await t.client.createWorkflow({name:n,status:"pending",...ht(r,{alias:void 0})});return{workflow:Ot({...t,workflow:o})}}})}),Ot=t=>{let e=!1;return{...Wt(t.workflow,{alias:void 0}),async update(n){let{workflow:r}=await t.client.updateWorkflow({id:t.workflow.id,...ht(n,{alias:void 0})});return await t.onWorkflowUpdate?.(r),{workflow:Ot({...t,workflow:r})}},async acknowledgeStartOfProcessing(){if(!t.event||t.workflow.status!=="pending"||e)return{workflow:Ot(t)};let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,status:"in_progress",eventId:t.event.id});return e=!0,await t.onWorkflowUpdate?.(n),{workflow:Ot({...t,workflow:n})}},async setFailed({failureReason:n}){let{workflow:r}=await t.client.updateWorkflow({id:t.workflow.id,status:"failed",failureReason:n});return await t.onWorkflowUpdate?.(r),{workflow:Ot({...t,workflow:r})}},async setCompleted({output:n}={}){let{workflow:r}=await t.client.updateWorkflow({id:t.workflow.id,status:"completed",output:n});return await t.onWorkflowUpdate?.(r),{workflow:Ot({...t,workflow:r})}},async cancel(){let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,status:"cancelled"});return await t.onWorkflowUpdate?.(n),{workflow:Ot({...t,workflow:n})}}}};I();A();k();var Vl=class{constructor(e){this.props=e;this._actionHandlers=e.actions,this._plugins=e.plugins}_actionHandlers;_messageHandlers={};_eventHandlers={};_stateExpiredHandlers={};_hookHandlers={before_incoming_event:{},before_incoming_message:{},before_outgoing_message:{},before_outgoing_call_action:{},before_incoming_call_action:{},after_incoming_event:{},after_incoming_message:{},after_outgoing_message:{},after_outgoing_call_action:{},after_incoming_call_action:{}};_workflowHandlers={started:{},continued:{},timed_out:{}};_plugins={};_registerOrder=0;get actionHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._actionHandlers[n];if(r)return dt.setName(o=>r({...o,workflows:cn(o)}),r.name);for(let[o,s]of Object.entries(this._plugins)){let[i,a]=n.split(Ht);if(!(i!==o||!a))return s.actionHandlers[a]}}})}get messageHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(a=>a.messageHandlers[n]??[]),o=n==="*"?[]:this._messageHandlers[n]??[],s=this._messageHandlers["*"]??[],i=[...o,...s].sort((a,l)=>a.order-l.order).map(({handler:a})=>dt.setName(l=>a({...l,workflows:cn(l)}),a.name));return ye.unique([...r,...i])}})}get eventHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(a=>a.eventHandlers[n]??[]),o=n==="*"?[]:this._eventHandlers[n]??[],s=this._eventHandlers["*"]??[],i=[...o,...s].sort((a,l)=>a.order-l.order).map(({handler:a})=>dt.setName(l=>a({...l,workflows:cn(l)}),a.name));return ye.unique([...r,...i])}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(a=>a.stateExpiredHandlers[n]??[]),o=n==="*"?[]:this._stateExpiredHandlers[n]??[],s=this._stateExpiredHandlers["*"]??[],i=[...o,...s].sort((a,l)=>a.order-l.order).map(({handler:a})=>dt.setName(l=>a({...l,workflows:cn(l)}),a.name));return ye.unique([...r,...i])}})}get hookHandlers(){return new Proxy({},{get:(e,n)=>{if(this._hookHandlers[n])return new Proxy({},{get:(o,s)=>{let i=Object.values(this._plugins).flatMap(y=>y.hookHandlers[n]?.[s]??[]),a=this._hookHandlers[n]??{},l=s==="*"?[]:a[s]??[],c=a["*"]??[],p=[...l,...c].sort((y,g)=>y.order-g.order).map(({handler:y})=>dt.setName(g=>y({...g,workflows:cn(g)}),y.name));return ye.unique([...i,...p])}})}})}get workflowHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._workflowHandlers[n];if(r)return new Proxy({},{get:(o,s)=>{let i=r[s]?.sort((l,c)=>l.order-c.order).map(({handler:l})=>dt.setName(async c=>{let p=c.workflow;return await l({...c,workflow:Ot({...c,onWorkflowUpdate(y){p=y}}),workflows:cn(c)}),p},l.name))??[],a=Object.values(this._plugins).flatMap(l=>l.workflowHandlers[n]?.[s]??[]);return ye.unique([...i,...a])}})}})}on={message:(e,n)=>{this._messageHandlers[e]=ye.safePush(this._messageHandlers[e],{handler:n,order:this._registerOrder++})},event:(e,n)=>{this._eventHandlers[e]=ye.safePush(this._eventHandlers[e],{handler:n,order:this._registerOrder++})},stateExpired:(e,n)=>{this._stateExpiredHandlers[e]=ye.safePush(this._stateExpiredHandlers[e],{handler:n,order:this._registerOrder++})},beforeIncomingEvent:(e,n)=>{this._hookHandlers.before_incoming_event[e]=ye.safePush(this._hookHandlers.before_incoming_event[e],{handler:n,order:this._registerOrder++})},beforeIncomingMessage:(e,n)=>{this._hookHandlers.before_incoming_message[e]=ye.safePush(this._hookHandlers.before_incoming_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingMessage:(e,n)=>{this._hookHandlers.before_outgoing_message[e]=ye.safePush(this._hookHandlers.before_outgoing_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingCallAction:(e,n)=>{this._hookHandlers.before_outgoing_call_action[e]=ye.safePush(this._hookHandlers.before_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},beforeIncomingCallAction:(e,n)=>{this._hookHandlers.before_incoming_call_action[e]=ye.safePush(this._hookHandlers.before_incoming_call_action[e],{handler:n,order:this._registerOrder++})},afterIncomingEvent:(e,n)=>{this._hookHandlers.after_incoming_event[e]=ye.safePush(this._hookHandlers.after_incoming_event[e],{handler:n,order:this._registerOrder++})},afterIncomingMessage:(e,n)=>{this._hookHandlers.after_incoming_message[e]=ye.safePush(this._hookHandlers.after_incoming_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingMessage:(e,n)=>{this._hookHandlers.after_outgoing_message[e]=ye.safePush(this._hookHandlers.after_outgoing_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingCallAction:(e,n)=>{this._hookHandlers.after_outgoing_call_action[e]=ye.safePush(this._hookHandlers.after_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},afterIncomingCallAction:(e,n)=>{this._hookHandlers.after_incoming_call_action[e]=ye.safePush(this._hookHandlers.after_incoming_call_action[e],{handler:n,order:this._registerOrder++})},workflowStart:(e,n)=>{this._workflowHandlers.started[e]=ye.safePush(this._workflowHandlers.started[e],{handler:n,order:this._registerOrder++})},workflowContinue:(e,n)=>{this._workflowHandlers.continued[e]=ye.safePush(this._workflowHandlers.continued[e],{handler:n,order:this._registerOrder++})},workflowTimeout:(e,n)=>{this._workflowHandlers.timed_out[e]=ye.safePush(this._workflowHandlers.timed_out[e],{handler:n,order:this._registerOrder++})}};handler=LT(this);start=e=>Jo(this.handler,e)};I();A();k();I();A();k();I();A();k();I();A();k();I();A();k();var Jl=class{constructor(e){this.props=e;this.name=e.name,this.version=e.version,this.icon=e.icon,this.title=e.title,this.description=e.description,this.readme=e.readme,this.entities=e.entities??{},this.attributes=e.attributes,this.__advanced=e.__advanced;let n=this._getEntityReference(this.entities),r=e.events===void 0?{}:Le.mapValues(e.events,i=>({...i,schema:i.schema(n)})),o=e.actions===void 0?{}:Le.mapValues(e.actions,i=>({...i,input:{...i.input,schema:i.input.schema(n)},output:{...i.output,schema:i.output.schema(n)}})),s=e.channels===void 0?{}:Le.mapValues(e.channels,i=>({...i,messages:Le.mapValues(i.messages,a=>({...a,schema:a.schema(n)}))}));this.events=r,this.actions=o,this.channels=s}name;version;title;description;icon;readme;attributes;entities;events;actions;channels;__advanced;get metadata(){return{sdkVersion:_n}}_getEntityReference=e=>{let n={};for(let[r,o]of Object.entries(e)){let s=o.schema._def["x-zui"]?.title,i=o.schema._def.description,a=My.ref(r);s&&a.title(s),i&&a.describe(i),n[r]=a}return n}};I();A();k();I();A();k();I();A();k();I();A();k();var Yl=class{constructor(e){this.props=e;let n=Object.fromEntries(Object.entries(e.interfaces??{}).map(([o,s])=>[o,Object.fromEntries(Object.entries(s.definition.entities??{}).map(([i])=>[i,X.ref(`interface:${o}/entities/${i}`)]))]));this.name=e.name,this.version=e.version,this.icon=e.icon,this.readme=e.readme,this.title=e.title,this.description=e.description,this.integrations=e.integrations,this.interfaces=e.interfaces,this.user=e.user,this.conversation=e.conversation,this.message=e.message,this.recurringEvents=e.recurringEvents,this.workflows=e.workflows,this.attributes=e.attributes,this.__advanced=e.__advanced;let r=new Set;for(let o of[...Object.keys(e.integrations??{}),...Object.keys(e.interfaces??{})]){if(r.has(o))throw new Error(`Duplicate interface or integration alias detected in plugin definition: '${o}'. Please use unique aliases for each interface and integration.`);r.add(o)}this.configuration=e.configuration?{...e.configuration,schema:typeof e.configuration.schema=="object"?e.configuration.schema:e.configuration.schema({entities:n})}:void 0,this.states=Object.fromEntries(Object.entries(e.states??{}).map(([o,s])=>[o,{...s,schema:typeof s.schema=="object"?s.schema:s.schema({entities:n})}])),this.events=Object.fromEntries(Object.entries(e.events??{}).map(([o,s])=>[o,{...s,schema:typeof s.schema=="object"?s.schema:s.schema({entities:n})}])),this.actions=Object.fromEntries(Object.entries(e.actions??{}).map(([o,s])=>[o,{...s,input:{...s.input,schema:typeof s.input.schema=="object"?s.input.schema:s.input.schema({entities:n})},output:{...s.output,schema:typeof s.output.schema=="object"?s.output.schema:s.output.schema({entities:n})}}])),this.tables=Object.fromEntries(Object.entries(e.tables??{}).map(([o,s])=>[o,{...s,schema:typeof s.schema=="object"?s.schema:s.schema({entities:n})}]))}name;version;title;description;icon;readme;attributes;integrations;interfaces;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;workflows;__advanced;get metadata(){return{sdkVersion:_n}}dereferenceEntities({intersectWithUnknownRecord:e}={intersectWithUnknownRecord:!0}){let n=this._buildZuiReferenceMap(e);return{...this,configuration:this.configuration?{...this.configuration,schema:this._dereferenceZuiSchema(this.configuration.schema,n)}:void 0,events:this._dereferenceDefinitionSchemas(this.events,n),states:this._dereferenceDefinitionSchemas(this.states,n),tables:this._dereferenceDefinitionSchemas(this.tables,n),actions:this._dereferenceActionDefinitionSchemas(this.actions,n)}}_buildZuiReferenceMap(e){return Object.fromEntries(Object.entries(this.interfaces??{}).flatMap(([n,r])=>Object.entries(r.definition.entities??{}).map(([o,s])=>[`interface:${n}/entities/${o}`,e?s.schema.and(X.record(X.string(),X.unknown())):s.schema])))}_dereferenceZuiSchema(e,n){return e.dereference(n)}_dereferenceDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,o])=>[r,{...o,schema:this._dereferenceZuiSchema(o.schema,n)}]))}_dereferenceActionDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,o])=>[r,{...o,input:{schema:this._dereferenceZuiSchema(o.input.schema,n)},output:{schema:this._dereferenceZuiSchema(o.output.schema,n)}}]))}};I();A();k();I();A();k();I();A();k();var FT=(t,e)=>new Proxy({},{get:(n,r)=>new Proxy({},{get:(o,s)=>i=>{let a=(e.integrations[r]??e.interfaces[r])?.integrationAlias,l=e.interfaces[r]?.actions?.[s]?.name??s;return t.callAction({type:`${a}:${l}`,input:i}).then(c=>c.output)}})});I();A();k();I();A();k();I();A();k();I();A();k();var Xl=t=>({async getById({id:e}){let n=await t.client.getMessage({id:e});return Ut({...t,message:n.message})},list(e){return Ct(({nextToken:n})=>t.client.listMessages({...ht(e??{},{alias:t.plugin?.alias}),nextToken:n}).then(({meta:r,messages:o})=>({meta:r,items:o.map(s=>Ut({...t,message:s}))})))}}),Ut=t=>({...Wt(t.message,{alias:t.plugin?.alias}),async delete(){await t.client.deleteMessage({id:t.message.id})},async update(e){let{message:n}=await t.client.updateMessage({...ht(e,{alias:t.plugin?.alias}),id:t.message.id});return Ut({...t,message:n})}});I();A();k();I();A();k();var Ql=t=>({list(e){return Ct(({nextToken:n})=>t.client.listUsers({...ht(e??{},{alias:t.pluginAlias}),nextToken:n}).then(({meta:r,users:o})=>({meta:r,items:o.map(s=>zt({...t,conversationId:e?.conversationId,user:s}))})))},async getById({id:e}){let n=await t.client.getUser({id:e});return zt({...t,user:n.user,conversationId:void 0})}}),zt=t=>{let e={...Wt(t.user,{alias:t.pluginAlias}),async update(n){let{user:r}=await t.client.updateUser({...ht(n,{alias:t.pluginAlias}),id:t.user.id});return zt({...t,user:r})}};return t.conversationId?{...e,async removeFromConversation(){return await t.client.removeParticipant({id:t.conversationId,userId:t.user.id}),zt({...t,conversationId:void 0})}}:{...e,async addToConversation({conversationId:n}){let{participant:r}=await t.client.addParticipant({id:n,userId:t.user.id});return zt({...t,user:r,conversationId:n})}}};I();A();k();var eu=t=>new Proxy({},{get:(e,n)=>new Proxy({},{get:(r,o)=>({list(s){let i=t.plugin?.interfaces[n]?.integrationAlias??t.plugin?.integrations[n]?.integrationAlias,a=t.plugin?.interfaces[n]?.channels?.[o]?.name??o;return Ct(({nextToken:l})=>t.client.listConversations({...ht(s??{},{alias:t.plugin?.alias}),channel:a==="*"?void 0:a,integrationName:i==="*"?void 0:i,nextToken:l}).then(({meta:c,conversations:p})=>({meta:c,items:p.map(y=>br({...t,conversation:y}))})))},async getById({id:s}){let i=await t.client.getConversation({id:s});return br({...t,conversation:i.conversation})}})})}),br=t=>{let e=t.client;return{...Wt(t.conversation,{alias:t.plugin?.alias}),async delete(){await e.deleteConversation({id:t.conversation.id})},async update(n){let{conversation:r}=await e.updateConversation({...ht(n,{alias:t.plugin?.alias}),id:t.conversation.id});return br({...t,conversation:r})},async getMessage({id:n}){let r=await e.getMessage({id:n});return Ut({...t,message:r.message})},async getOrCreateMessage(n){let{message:r}=await e.getOrCreateMessage({...ht(n,{alias:t.plugin?.alias}),conversationId:t.conversation.id});return Ut({...t,message:r})},async createMessage(n){let{message:r}=await e.createMessage({...ht(n,{alias:t.plugin?.alias}),conversationId:t.conversation.id});return Ut({...t,message:r})},listMessages(n){return Ct(({nextToken:r})=>e.listMessages({...ht(n??{},{alias:t.plugin?.alias}),conversationId:t.conversation.id,nextToken:r}).then(({meta:o,messages:s})=>({meta:o,items:s.map(i=>Ut({...t,message:i}))})))},listParticipants(){return Ct(({nextToken:n})=>e.listParticipants({id:t.conversation.id,nextToken:n}).then(({meta:r,participants:o})=>({meta:r,items:o.map(s=>zt({...t,user:s,conversationId:t.conversation.id}))})))}}};I();A();k();I();A();k();I();A();k();var tu=class t{constructor(e){this._props=e}async emit(e){let{conversationId:n,userId:r,messageId:o}=this._props,{event:s}=await this._props.client.createEvent({type:this._props.eventName,payload:e,conversationId:n,userId:r,messageId:o});return s}async schedule(e,n){let{conversationId:r,userId:o,messageId:s}=this._props,{event:i}=await this._props.client.createEvent({type:this._props.eventName,payload:e,conversationId:r,userId:o,messageId:s,schedule:n});return i}withConversationId(e){return new t({...this._props,conversationId:e})}withUserId(e){return new t({...this._props,userId:e})}withMessageId(e){return new t({...this._props,messageId:e})}async getById(e){return(await this._props.client.getEvent({id:e.id})).event}list(e){return Ct(({nextToken:n})=>this._props.client.listEvents({...e,type:this._props.eventName,conversationId:this._props.conversationId,userId:this._props.userId,messageId:this._props.messageId,nextToken:n}).then(({meta:r,events:o})=>({meta:r,items:o})))}},WT=(t,e)=>new Proxy({},{get:(n,r)=>{let o=e.alias!==void 0?`${e.alias}${Ht}${r}`:r;return new tu({client:t,eventName:o})}});I();A();k();I();A();k();I();A();k();I();A();k();I();A();k();var nu=class{constructor(e,n,r){this._client=e;this._stateType=n;this._stateName=r}async get(e){return await this._client.getState({type:this._stateType,name:this._stateName,id:e}).then(n=>n.state.payload)}async set(e,n,r){await this._client.setState({type:this._stateType,name:this._stateName,id:e,payload:n,expiry:r?.expiryMs})}async getOrSet(e,n,r){return await this._client.getOrSetState({type:this._stateType,name:this._stateName,id:e,payload:n,expiry:r?.expiryMs}).then(o=>o.state.payload)}async delete(e){await this._client.setState({type:this._stateType,name:this._stateName,id:e,payload:null})}async patch(e,n){await this._client.patchState({type:this._stateType,name:this._stateName,id:e,payload:n})}},zT=(t,e)=>new Proxy({},{get:(n,r)=>new Proxy({},{get:(o,s)=>{let i=e.alias!==void 0?`${e.alias}${Ht}${s}`:s;return new nu(t,r,i)}})});I();A();k();var ru=class{constructor(e){this.props=e;this._actionHandlers=e.actions}_runtimeProps;_actionHandlers;_messageHandlers={};_eventHandlers={};_stateExpiredHandlers={};_hookHandlers={before_incoming_event:{},before_incoming_message:{},before_outgoing_message:{},before_outgoing_call_action:{},before_incoming_call_action:{},after_incoming_event:{},after_incoming_message:{},after_outgoing_message:{},after_outgoing_call_action:{},after_incoming_call_action:{}};_workflowHandlers={started:{},continued:{},timed_out:{}};_registerOrder=0;initialize(e){return this._runtimeProps=e,this}get _runtime(){if(!this._runtimeProps)throw new Error("Plugin not correctly initialized. This is likely because you access your plugin config outside of an handler.");return this._runtimeProps}_getTools(e){let{configuration:n,interfaces:r,integrations:o,alias:s}=this._runtime,i=FT(e,this._runtime),a=zT(e,this._runtime),l=cn({client:e,pluginAlias:this._runtime.alias}),c=WT(e,this._runtime),p=Ql({client:e,pluginAlias:this._runtime.alias}),y=eu({client:e,plugin:this._runtime}),g=Xl({client:e,plugin:this._runtime});return{configuration:n,interfaces:r,integrations:o,actions:i,states:a,alias:s,workflows:l,events:c,users:p,conversations:y,messages:g}}get actionHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._actionHandlers[n];if(r)return dt.setName(o=>r({...o,...this._getTools(o.client)}),r.name)}})}get messageHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=n==="*"?[]:this._messageHandlers[n]??[],o=this._messageHandlers["*"]??[];return ye.unique([...r,...o]).sort((i,a)=>i.order-a.order).map(({handler:i})=>dt.setName(a=>i({...a,user:zt({...a,conversationId:a.conversation.id,pluginAlias:this._runtime.alias}),message:Ut({...a,plugin:this._runtime,message:a.message}),conversation:br({...a,plugin:this._runtime,conversation:a.conversation}),...this._getTools(a.client)}),i.name))}})}get eventHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=n==="*"?[]:this._eventHandlers[n]??[],o=Object.entries(this._eventHandlers).filter(([a])=>this._eventResolvesTo(a,n)).flatMap(([,a])=>a??[]),s=this._eventHandlers["*"]??[];return ye.unique([...r,...o,...s]).sort((a,l)=>a.order-l.order).map(({handler:a})=>dt.setName(l=>a({...l,...this._getTools(l.client)}),a.name))}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=n==="*"?[]:this._stateExpiredHandlers[n]??[],o=this._stateExpiredHandlers["*"]??[];return ye.unique([...r,...o]).sort((i,a)=>i.order-a.order).map(({handler:i})=>dt.setName(a=>i({...a,...this._getTools(a.client)}),i.name))}})}get hookHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._hookHandlers[n];if(r)return new Proxy({},{get:(o,s)=>{s=this._stripAliasPrefix(s);let i=s==="*"?[]:r[s]??[],a=Object.entries(r).filter(([p])=>this._eventResolvesTo(p,s)).flatMap(([,p])=>p??[]),l=r["*"]??[];return ye.unique([...i,...a,...l]).sort((p,y)=>p.order-y.order).map(({handler:p})=>dt.setName(y=>p({...y,data:Wt(y.data,{alias:this._runtime.alias}),...this._getTools(y.client)}),p.name))}})}})}get workflowHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._workflowHandlers[n];if(r)return new Proxy({},{get:(o,s)=>(r[s]?.sort((a,l)=>a.order-l.order)??[]).map(({handler:a})=>dt.setName(async l=>{let c=l.workflow;return await a({...l,workflow:Ot({...l,workflow:c,onWorkflowUpdate(p){c=p},pluginAlias:this._runtime.alias}),...this._getTools(l.client)}),c},a.name))})}})}on={message:(e,n)=>{this._messageHandlers[e]=ye.safePush(this._messageHandlers[e],{handler:n,order:this._registerOrder++})},event:(e,n)=>{this._eventHandlers[e]=ye.safePush(this._eventHandlers[e],{handler:n,order:this._registerOrder++})},stateExpired:(e,n)=>{this._stateExpiredHandlers[e]=ye.safePush(this._stateExpiredHandlers[e],{handler:n,order:this._registerOrder++})},beforeIncomingEvent:(e,n)=>{this._hookHandlers.before_incoming_event[e]=ye.safePush(this._hookHandlers.before_incoming_event[e],{handler:n,order:this._registerOrder++})},beforeIncomingMessage:(e,n)=>{this._hookHandlers.before_incoming_message[e]=ye.safePush(this._hookHandlers.before_incoming_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingMessage:(e,n)=>{this._hookHandlers.before_outgoing_message[e]=ye.safePush(this._hookHandlers.before_outgoing_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingCallAction:(e,n)=>{this._hookHandlers.before_outgoing_call_action[e]=ye.safePush(this._hookHandlers.before_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},beforeIncomingCallAction:(e,n)=>{this._hookHandlers.before_incoming_call_action[e]=ye.safePush(this._hookHandlers.before_incoming_call_action[e],{handler:n,order:this._registerOrder++})},afterIncomingEvent:(e,n)=>{this._hookHandlers.after_incoming_event[e]=ye.safePush(this._hookHandlers.after_incoming_event[e],{handler:n,order:this._registerOrder++})},afterIncomingMessage:(e,n)=>{this._hookHandlers.after_incoming_message[e]=ye.safePush(this._hookHandlers.after_incoming_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingMessage:(e,n)=>{this._hookHandlers.after_outgoing_message[e]=ye.safePush(this._hookHandlers.after_outgoing_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingCallAction:(e,n)=>{this._hookHandlers.after_outgoing_call_action[e]=ye.safePush(this._hookHandlers.after_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},afterIncomingCallAction:(e,n)=>{this._hookHandlers.after_incoming_call_action[e]=ye.safePush(this._hookHandlers.after_incoming_call_action[e],{handler:n,order:this._registerOrder++})},workflowStart:(e,n)=>{this._workflowHandlers.started[e]=ye.safePush(this._workflowHandlers.started[e],{handler:n,order:this._registerOrder++})},workflowContinue:(e,n)=>{this._workflowHandlers.continued[e]=ye.safePush(this._workflowHandlers.continued[e],{handler:n,order:this._registerOrder++})},workflowTimeout:(e,n)=>{this._workflowHandlers.timed_out[e]=ye.safePush(this._workflowHandlers.timed_out[e],{handler:n,order:this._registerOrder++})}};_eventResolvesTo=(e,n)=>{let[o,s]=e.split(":");if(!o||!s)return!1;let i=this._runtime.interfaces[o];if(i&&n===`${i.integrationAlias}:${i?.events?.[s]?.name}`)return!0;let a=this._runtime.integrations[o];return!!(a&&n===`${a.integrationAlias}:${s}`)};_stripAliasPrefix=e=>{let{alias:n}=this._runtime;if(!n)return e;let r=`${n}#`;return e.startsWith(r)?e.slice(r.length):e}};I();A();k();I();A();k();I();A();k();I();A();k();I();A();k();var qT={};bn(qT,{allWithinMajorOf:()=>dA,allWithinMinorOf:()=>fA});I();A();k();import*as gi from"semver";function dA(t){let e=gi.major(t.version);return{...t,version:`>=${e}.0.0 <${e+1}.0.0`}}function fA(t){let e=gi.major(t.version),n=gi.minor(t.version);return{...t,version:`>=${e}.${n}.0 <${e}.${n+1}.0`}}I();A();k();export{zP as BRAND,Vl as Bot,zl as BotDefinition,pi as BotLogger,un as BotSpecificClient,er as DIRTY,KP as EMPTY_PATH,pe as INVALID,Wl as Integration,al as IntegrationDefinition,fi as IntegrationLogger,li as IntegrationSpecificClient,Jl as InterfaceDefinition,zx as NEVER,gt as OK,Mt as ParseInputLazyPath,_t as ParseStatus,ru as Plugin,Yl as PluginDefinition,Fj as RuntimeError,he as Schema,yC as WELL_KNOWN_ATTRIBUTES,Gr as ZodAny,Vr as ZodArray,Gs as ZodBigInt,Vs as ZodBoolean,Js as ZodBranded,Ys as ZodCatch,Xs as ZodDate,xo as ZodDefault,xg as ZodDiscriminatedUnion,Rn as ZodEffects,ur as ZodEnum,Yt as ZodError,dg as ZodFirstPartyTypeKind,Eg as ZodFunction,ea as ZodIntersection,J as ZodIssueCode,ta as ZodLazy,na as ZodLiteral,Ig as ZodMap,Ag as ZodNaN,ra as ZodNativeEnum,Xr as ZodNever,ia as ZodNull,ir as ZodNullable,oa as ZodNumber,or as ZodObject,gn as ZodOptional,ne as ZodParsedType,sa as ZodPipeline,Eo as ZodPromise,So as ZodReadonly,Hg as ZodRecord,jg as ZodRef,he as ZodSchema,$g as ZodSet,yt as ZodString,Yg as ZodSymbol,Rn as ZodTransformer,ar as ZodTuple,he as ZodType,Io as ZodUndefined,aa as ZodUnion,Kr as ZodUnknown,ty as ZodVoid,te as addIssueToContext,QP as agent,ix as aimodel,yx as any,vx as array,cx as bigint,iy as boolean,Wx as coerce,JP as conversation,Bo as createZodEnum,Kg as cuid2Regex,Zg as cuidRegex,wg as custom,ox as datasource,dx as date,Px as discriminatedUnion,sd as effect,Wg as emailRegex,Mx as enum,ue as errorUtil,ex as event,Cx as function,zr as getErrorMap,pn as getParsedType,lx as instanceof,rx as intent,xx as intersection,qg as ipv4Regex,Gg as ipv6Regex,Ss as isAborted,Lj as isApiError,Mi as isAsync,Is as isDirty,qP as isEmojiRegex,qr as isValid,RA as json,sx as knowledgebase,ax as late,Ox as lazy,Rx as literal,Ri as makeIssue,kx as map,Qr as mergeObjectSchemas,XP as message,Wy as messages,ux as nan,Nx as nativeEnum,hx as never,gx as null,Ux as nullable,ry as number,_x as object,Es as objectUtil,Fx as oboolean,Lx as onumber,Hx as optional,Kx as ostring,Dt as parseBody,Zx as pipeline,$x as preprocess,me as processCreateParams,Dx as promise,ZP as quotelessJson,Ix as readonly,Ex as record,Sx as ref,Jo as serve,Ax as set,gg as setErrorMap,bx as strictObject,ny as string,fx as symbol,tx as table,nx as tablerow,sd as transformer,iv as transforms,Bx as tuple,Lg as ulidRegex,px as undefined,wx as union,mx as unknown,YP as user,be as util,Fg as uuidRegex,VP as variable,qT as version,Tx as void,X as z};
93
+ `)+" "+F[1]:F[0]+K+" "+D.join(", ")+" "+F[1]}Pe.types=Nk();function B(D){return Array.isArray(D)}Pe.isArray=B;function _(D){return typeof D=="boolean"}Pe.isBoolean=_;function S(D){return D===null}Pe.isNull=S;function E(D){return D==null}Pe.isNullOrUndefined=E;function H(D){return typeof D=="number"}Pe.isNumber=H;function Z(D){return typeof D=="string"}Pe.isString=Z;function re(D){return typeof D=="symbol"}Pe.isSymbol=re;function ee(D){return D===void 0}Pe.isUndefined=ee;function ge(D){return se(D)&&Ve(D)==="[object RegExp]"}Pe.isRegExp=ge,Pe.types.isRegExp=ge;function se(D){return typeof D=="object"&&D!==null}Pe.isObject=se;function ie(D){return se(D)&&Ve(D)==="[object Date]"}Pe.isDate=ie,Pe.types.isDate=ie;function Oe(D){return se(D)&&(Ve(D)==="[object Error]"||D instanceof Error)}Pe.isError=Oe,Pe.types.isNativeError=Oe;function ze(D){return typeof D=="function"}Pe.isFunction=ze;function nt(D){return D===null||typeof D=="boolean"||typeof D=="number"||typeof D=="string"||typeof D=="symbol"||typeof D>"u"}Pe.isPrimitive=nt,Pe.isBuffer=Dk();function Ve(D){return Object.prototype.toString.call(D)}function Je(D){return D<10?"0"+D.toString(10):D.toString(10)}var Tt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ue(){var D=new Date,K=[Je(D.getHours()),Je(D.getMinutes()),Je(D.getSeconds())].join(":");return[D.getDate(),Tt[D.getMonth()],K].join(" ")}Pe.log=function(){console.log("%s - %s",Ue(),Pe.format.apply(Pe,arguments))},Pe.inherits=Zt(),Pe._extend=function(D,K){if(!K||!se(K))return D;for(var F=Object.keys(K),fe=F.length;fe--;)D[F[fe]]=K[F[fe]];return D};function xe(D,K){return Object.prototype.hasOwnProperty.call(D,K)}var Se=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;Pe.promisify=function(K){if(typeof K!="function")throw new TypeError('The "original" argument must be of type Function');if(Se&&K[Se]){if(F=K[Se],typeof F!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(F,Se,{value:F,enumerable:!1,writable:!1,configurable:!0}),F}function F(){for(var fe,ve,M=new Promise(function(Y,oe){fe=Y,ve=oe}),C=[],$=0;$<arguments.length;$++)C.push(arguments[$]);C.push(function(Y,oe){Y?ve(Y):fe(oe)});try{K.apply(this||di,C)}catch(Y){ve(Y)}return M}return Object.setPrototypeOf(F,Object.getPrototypeOf(K)),Se&&Object.defineProperty(F,Se,{value:F,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(F,e(K))},Pe.promisify.custom=Se;function de(D,K){if(!D){var F=new Error("Promise was rejected with a falsy value");F.reason=D,D=F}return K(D)}function Te(D){if(typeof D!="function")throw new TypeError('The "original" argument must be of type Function');function K(){for(var F=[],fe=0;fe<arguments.length;fe++)F.push(arguments[fe]);var ve=F.pop();if(typeof ve!="function")throw new TypeError("The last argument must be of type Function");var M=this||di,C=function(){return ve.apply(M,arguments)};D.apply(this||di,F).then(function($){t.nextTick(C.bind(null,null,$))},function($){t.nextTick(de.bind(null,$,C))})}return Object.setPrototypeOf(K,Object.getPrototypeOf(D)),Object.defineProperties(K,e(D)),K}return Pe.callbackify=Te,Pe}var ce=Hk();ce.format;ce.deprecate;ce.debuglog;ce.inspect;ce.types;ce.isArray;ce.isBoolean;ce.isNull;ce.isNullOrUndefined;ce.isNumber;ce.isString;ce.isSymbol;ce.isUndefined;ce.isRegExp;ce.isObject;ce.isDate;ce.isError;ce.isFunction;ce.isPrimitive;ce.isBuffer;ce.log;ce.inherits;ce._extend;ce.promisify;ce.callbackify;var p0=ce._extend,g0=ce.callbackify,y0=ce.debuglog,m0=ce.deprecate,h0=ce.format,T0=ce.inherits,v0=ce.inspect,_0=ce.isArray,b0=ce.isBoolean,w0=ce.isBuffer,P0=ce.isDate,x0=ce.isError,B0=ce.isFunction,E0=ce.isNull,S0=ce.isNullOrUndefined,I0=ce.isNumber,k0=ce.isObject,A0=ce.isPrimitive,C0=ce.isRegExp,O0=ce.isString,R0=ce.isSymbol,M0=ce.isUndefined,N0=ce.log,D0=ce.promisify,H0=ce.types,U0=ce.TextEncoder=globalThis.TextEncoder,j0=ce.TextDecoder=globalThis.TextDecoder;var _r=class{defaultOptions;constructor(e){this.defaultOptions=e}info(...e){this._log("info",e)}debug(...e){this._log("debug",e)}warn(...e){this._log("warn",e)}error(...e){this._log("error",e)}_log(e,n){this._getConsoleMethod(e)(this._serializeMessage(n))}_serializeMessage(e){let n=ce.format(...e);return V.env.BP_LOG_FORMAT==="json"?this.getJsonMessage(n):n}getJsonMessage(e){return JSON.stringify({msg:e,options:this.defaultOptions})}_getConsoleMethod(e){switch(e){case"debug":return console.debug;case"warn":return console.warn;case"error":return console.error;default:return console.info}}};var fi=class t extends _r{constructor(e){super({visibleToBotOwners:!1,hiddenToIntegrationOwners:!1,...e})}with(e){return new t({...this.defaultOptions,...e})}withUserId(e){return this.with({userId:e})}withConversationId(e){return this.with({conversationId:e})}withVisibleToBotOwners(e){return this.with({visibleToBotOwners:e})}withHiddenToIntegrationOwners(e){return this.with({hiddenToIntegrationOwners:e})}forBot(){return this.with({hiddenToIntegrationOwners:!1,visibleToBotOwners:!0})}forBotOnly(){return this.with({hiddenToIntegrationOwners:!0,visibleToBotOwners:!0})}getJsonMessage(e){return JSON.stringify({msg:e,visible_to_bot_owner:this.defaultOptions.visibleToBotOwners,hidden_to_integration_owner:this.defaultOptions.hiddenToIntegrationOwners,options:this.defaultOptions})}};I();A();k();var Zk=t=>["traceparent","tracestate","sentry-trace"].reduce((e,n)=>(t[n]&&(e[n]=t[n]),e),{}),Kk=(t,e,n)=>{let[,r]=(e.headers.traceparent||"").split("-"),o=new jk({botId:t.botId,integrationId:t.integrationId,integrationAlias:t.integrationAlias,retry:Qo,headers:Zk(e.headers)}),s=new li(o),i=new fi({traceId:r});return{ctx:t,req:e,client:s,logger:i,instance:n}},Lk=async t=>{let{ctx:e}=t;switch(e.operation){case"webhook_received":return await Wk(t);case"register":return await zk(t);case"unregister":return await qk(t);case"message_created":return await Jk(t);case"action_triggered":return await Yk(t);case"ping":return await Fk(t);case"create_user":return await Gk(t);case"create_conversation":return await Vk(t);default:throw new $k(`Unknown operation ${e.operation}`)}},jT=t=>async e=>{let n=nT(e.headers),r=Kk(n,e,t),{logger:o}=r;try{let s;return s=await Xk(r),s?{...s,status:s.status??200}:(s=await Lk(r),s?{...s,status:s.status??200}:{status:200})}catch(s){if(Uk(s)){let a=s.type==="Runtime"?s:new UT(s.message,s);return o.forBot().error(a.message),{status:a.code,body:JSON.stringify(a.toJSON())}}console.error(s);let i=new UT("An unexpected error occurred in the integration. Bot owners: Check logs for more informations. Integration owners: throw a RuntimeError to return a custom error message instead.");return o.forBot().error(i.message),{status:i.code,body:JSON.stringify(i.toJSON())}}},Fk=async t=>{},Wk=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{let{req:s}=Dt(n);return o.webhook({client:t,ctx:e,req:s,logger:r})},zk=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{if(!o.register)return;let{webhookUrl:s}=Dt(n);await o.register({client:t,ctx:e,webhookUrl:s,logger:r})},qk=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{if(!o.unregister)return;let{webhookUrl:s}=Dt(n);await o.unregister({ctx:e,webhookUrl:s,client:t,logger:r})},Gk=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{if(!o.createUser)return;let{tags:s}=Dt(n);return await o.createUser({ctx:e,client:t,tags:s,logger:r})},Vk=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{if(!o.createConversation)return;let{channel:s,tags:i}=Dt(n);return await o.createConversation({ctx:e,client:t,channel:s,tags:i,logger:r})},Jk=async({ctx:t,req:e,client:n,logger:r,instance:o})=>{let{conversation:s,user:i,type:a,payload:l,message:c}=Dt(e),f=o.channels[s.channel];if(!f)throw new Error(`Channel ${s.channel} not found`);let y=f.messages[a];if(!y)throw new Error(`Message of type ${a} not found in channel ${s.channel}`);await y({ctx:t,conversation:s,message:c,user:i,type:a,client:n,payload:l,ack:async({tags:h})=>{await n.updateMessage({id:c.id,tags:h})},logger:r})},Yk=async({req:t,ctx:e,client:n,logger:r,instance:o})=>{let{input:s,type:i}=Dt(t);if(!i)throw new Error("Missing action type");let a=o.actions[i];if(!a)throw new Error(`Action ${i} not found`);let l=new es,f={output:await a({ctx:e,input:s,client:n,type:i,logger:r,metadata:l}),meta:l.toJSON()};return{body:JSON.stringify(f)}},Xk=async({instance:t,client:e,ctx:n,logger:r,req:o})=>{let s=t.unknownOperationHandler;if(s)return await s({client:e,ctx:n,logger:r,req:o})};var Wl=class{constructor(e){this.props=e;this.actions=e.actions,this.channels=e.channels,this.register=e.register,this.unregister=e.unregister,this.createUser=e.createUser,this.createConversation=e.createConversation,this.webhook=e.handler,this.unknownOperationHandler=e.__advanced?.unknownOperationHandler}actions;channels;register;unregister;createUser;createConversation;webhook;unknownOperationHandler;handler=jT(this);start=e=>Jo(this.handler,e)};I();A();k();I();A();k();I();A();k();I();A();k();var zl=class{constructor(e){this.props=e;this.integrations=e.integrations,this.plugins=e.plugins,this.user=e.user,this.conversation=e.conversation,this.message=e.message,this.states=e.states,this.configuration=e.configuration,this.events=e.events,this.recurringEvents=e.recurringEvents,this.actions=e.actions,this.tables=e.tables,this.workflows=e.workflows,this.attributes=e.attributes,this.__advanced=e.__advanced,this.withPlugins={user:e.user,conversation:e.conversation,message:e.message,states:e.states,events:e.events,recurringEvents:e.recurringEvents,actions:e.actions,tables:e.tables,workflows:e.workflows}}integrations;plugins;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;workflows;attributes;__advanced;withPlugins;get metadata(){return{sdkVersion:_n}}addIntegration(e,n){let r=this;r.integrations||(r.integrations={});let o=n?.alias??e.name;if(r.integrations[o])throw new Error(`Another integration with alias "${o}" is already installed in the bot`);return r.integrations[o]={...e,alias:o,enabled:n?.enabled,configurationType:n&&"configurationType"in n?n.configurationType:void 0,configuration:n&&"configuration"in n?n.configuration??{}:{},disabledChannels:n?.disabledChannels},this}addPlugin(e,n){let r=this;r.plugins||(r.plugins={});let o=n.alias??e.name;if(r.plugins[o])throw new Error(`Another plugin with alias "${o}" is already installed in the bot`);let s=Object.fromEntries(Object.entries(n.dependencies??{}).filter(([a,l])=>"integrationInterfaceAlias"in l).map(([a,l])=>{let c=this.integrations?.[l.integrationAlias];if(!c){let y=Object.keys(this.integrations??{}).join(", ")||"(none)";throw new Error(`Interface with alias "${a}" of plugin with alias "${o}" references integration with alias "${l.integrationAlias}" which is not installed. Please make sure to add the integration via addIntegration() before calling addPlugin().
94
+ Available integration aliases: ${y}`)}let f=c.definition.interfaces?.[l.integrationInterfaceAlias];if(!f){let y=Object.keys(c.definition.interfaces??{}).join(", ")||"(none)";throw new Error(`Interface with alias "${l.integrationInterfaceAlias}" does not exist in integration "${c.name}" referenced by interface with alias "${a}" of plugin with alias "${o}".
95
+ Available interface aliases: ${y}`)}return[a,{...f,id:c.id,name:c.name,version:c.version,...l}]})),i=Object.fromEntries(Object.entries(n.dependencies??{}).filter(([a,l])=>!("integrationInterfaceAlias"in l)).map(([a,l])=>{let c=this.integrations?.[l.integrationAlias];if(!c){let f=Object.keys(this.integrations??{}).join(", ")||"(none)";throw new Error(`Integration with alias "${a}" of plugin with alias "${o}" references integration with alias "${l.integrationAlias}" which is not installed. Please make sure to add the integration via addIntegration() before calling addPlugin().
96
+ Available integration aliases: ${f}`)}return[a,{...c,...l}]}));return r.plugins[o]={...e,alias:o,configuration:n.configuration??{},interfaces:s,integrations:i},r.withPlugins.user=this._mergeUser(r.withPlugins.user,e.definition.user),r.withPlugins.conversation=this._mergeConversation(r.withPlugins.conversation,e.definition.conversation),r.withPlugins.message=this._mergeMessage(r.withPlugins.message,e.definition.message),r.withPlugins.recurringEvents=this._mergeRecurringEvents(r.withPlugins.recurringEvents,e.definition.recurringEvents),r.withPlugins.tables=this._mergeTables(r.withPlugins.tables,e.definition.tables),r.withPlugins.workflows=this._mergeWorkflows(r.withPlugins.workflows,e.definition.workflows),r.withPlugins.states=this._mergeStates(r.withPlugins.states,this._prefixKeysWithPluginAlias(e.definition.states,o)),r.withPlugins.events=this._mergeEvents(r.withPlugins.events,this._prefixKeysWithPluginAlias(e.definition.events,o)),r.withPlugins.actions=this._mergeActions(r.withPlugins.actions,this._prefixKeysWithPluginAlias(e.definition.actions,o)),this}_mergeUser=(e,n)=>({tags:{...e?.tags,...n?.tags}});_mergeConversation=(e,n)=>({tags:{...e?.tags,...n?.tags}});_mergeMessage=(e,n)=>({tags:{...e?.tags,...n?.tags}});_mergeStates=(e,n)=>({...e,...n});_mergeEvents=(e,n)=>({...e,...n});_mergeRecurringEvents=(e,n)=>({...e,...n});_mergeActions=(e,n)=>({...e,...n});_mergeTables=(e,n)=>({...e,...n});_mergeWorkflows=(e,n)=>({...e,...n});_prefixKeysWithPluginAlias=(e,n)=>Le.mapKeys(e??{},r=>`${n}${Ht}${r}`);dereferencePluginEntities(){let e=this._buildZuiReferenceMap();return{...this,withPlugins:{...this.withPlugins,events:this._dereferenceDefinitionSchemas(this.withPlugins.events,e),states:this._dereferenceDefinitionSchemas(this.withPlugins.states,e),tables:this._dereferenceDefinitionSchemas(this.withPlugins.tables,e),actions:this._dereferenceActionDefinitionSchemas(this.withPlugins.actions,e)},plugins:Object.fromEntries(Object.entries(this.plugins??{}).map(([n,r])=>[n,{...r,definition:{...r.definition,configuration:this._dereferenceDefinitionSchema(r.definition.configuration,e),events:this._dereferenceDefinitionSchemas(r.definition.events,e),states:this._dereferenceDefinitionSchemas(r.definition.states,e),tables:this._dereferenceDefinitionSchemas(r.definition.tables,e),actions:this._dereferenceActionDefinitionSchemas(r.definition.actions,e)}}]))}}_buildZuiReferenceMap(){let e={},n=Object.entries(this.plugins??{});for(let[r,o]of n){let s=Object.entries(o.interfaces??{});for(let[i,a]of s){let l=this.integrations?.[a.integrationAlias];if(!l)throw new Error(`Interface with alias "${i}" of plugin with alias "${r}" references integration "${a.name}" which is not installed`);let c=Object.entries(a.entities??{});for(let[f,{name:y}]of c){let g=l.definition.entities?.[y]?.schema;if(!g)throw new Error(`Interface entity "${y}" does not exist in integration "${l.name}"`);e[`interface:${i}/entities/${f}`]=g}}}return e}_dereferenceZuiSchema(e,n){return e.dereference(n)}_dereferenceDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,o])=>[r,this._dereferenceDefinitionSchema(o,n)]))}_dereferenceDefinitionSchema(e,n){return e&&{...e,schema:this._dereferenceZuiSchema(e.schema,n)}}_dereferenceActionDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,o])=>[r,{...o,input:{schema:this._dereferenceZuiSchema(o.input.schema,n)},output:{schema:this._dereferenceZuiSchema(o.output.schema,n)}}]))}};I();A();k();I();A();k();import{isApiError as iA,Client as oA,RuntimeError as KT}from"@botpress/client";I();A();k();var pi=class t extends _r{constructor(e){super({...e})}with(e){return new t({...this.defaultOptions,...e})}withUserId(e){return this.with({userId:e})}withConversationId(e){return this.with({conversationId:e})}withWorkflowId(e){return this.with({workflowId:e})}withEventId(e){return this.with({eventId:e})}withMessageId(e){return this.with({messageId:e})}};I();A();k();I();A();k();var un=class{constructor(e,n={before:{},after:{}}){this._client=e;this._hooks=n}get _inner(){return this._client}getConversation=(e=>this._run("getConversation",e));listConversations=(e=>this._run("listConversations",e));updateConversation=(e=>this._run("updateConversation",e));deleteConversation=(e=>this._run("deleteConversation",e));listParticipants=(e=>this._run("listParticipants",e));addParticipant=(e=>this._run("addParticipant",e));getParticipant=(e=>this._run("getParticipant",e));removeParticipant=(e=>this._run("removeParticipant",e));createEvent=(e=>this._run("createEvent",e));getEvent=(e=>this._run("getEvent",e));listEvents=(e=>this._run("listEvents",e));createMessage=(e=>this._run("createMessage",e));getOrCreateMessage=(e=>this._run("getOrCreateMessage",e));getMessage=(e=>this._run("getMessage",e));updateMessage=(e=>this._run("updateMessage",e));listMessages=(e=>this._run("listMessages",e));deleteMessage=(e=>this._run("deleteMessage",e));getUser=(e=>this._run("getUser",e));listUsers=(e=>this._run("listUsers",e));updateUser=(e=>this._run("updateUser",e));deleteUser=(e=>this._run("deleteUser",e));getState=(e=>this._run("getState",e));setState=(e=>this._run("setState",e));getOrSetState=(e=>this._run("getOrSetState",e));patchState=(e=>this._run("patchState",e));callAction=(e=>this._run("callAction",e));uploadFile=(e=>this._run("uploadFile",e));upsertFile=(e=>this._run("upsertFile",e));deleteFile=(e=>this._run("deleteFile",e));listFiles=(e=>this._run("listFiles",e));getFile=(e=>this._run("getFile",e));updateFileMetadata=(e=>this._run("updateFileMetadata",e));searchFiles=(e=>this._run("searchFiles",e));trackAnalytics=(e=>this._run("trackAnalytics",e));getTableRow=(e=>this._run("getTableRow",e));createTableRows=(e=>this._run("createTableRows",e));findTableRows=(e=>this._run("findTableRows",e));deleteTableRows=(e=>this._run("deleteTableRows",e));updateTableRows=(e=>this._run("updateTableRows",e));upsertTableRows=(e=>this._run("upsertTableRows",e));createWorkflow=(e=>this._run("createWorkflow",e));getOrCreateWorkflow=(e=>this._run("getOrCreateWorkflow",e));getWorkflow=(e=>this._run("getWorkflow",e));updateWorkflow=(e=>this._run("updateWorkflow",e));deleteWorkflow=(e=>this._run("deleteWorkflow",e));listWorkflows=(e=>this._run("listWorkflows",e));createConversation=e=>this._client.createConversation(e);getOrCreateConversation=e=>this._client.getOrCreateConversation(e);createUser=e=>this._client.createUser(e);getOrCreateUser=e=>this._client.getOrCreateUser(e);_run=async(e,n)=>{let r=this._hooks.before[e];r&&(n=await r(n));let o=await this._client[e](n),s=this._hooks.after[e];return s&&(o=await s(o,n)),o}};I();A();k();var Qk=X.enum(["event_received","register","unregister","ping","action_triggered"]),$T=t=>({botId:t[ts]||At("Missing bot id header"),operation:Qk.parse(t[rs]),type:t[tT]||At("Missing type header"),configuration:JSON.parse(q.from(t[ns]||At("Missing configuration header"),"base64").toString("utf-8"))});I();A();k();var ft={status:200};I();A();k();I();A();k();var ql=t=>{switch(t){case"workflow_continued":return"continued";case"workflow_started":return"started";case"workflow_timedout":return"timed_out";default:throw new Error(`Unsupported workflow update type: ${t}`)}};var eA=["child_workflow_deleted","child_workflow_finished","workflow_timedout","workflow_started","workflow_continued"],ZT=async(t,e)=>{if(t.ctx.type!=="workflow_update"||!eA.includes(e.payload.type))throw new Error("Unexpected event type");let n={...t,logger:tA(t,e)};if(!e.payload.workflow.name)return n.logger.warn("Received workflow update event without a workflow name. Assuming this workflow was not defined by the bot.",e.payload.workflow),ft;switch(e.payload.type){case"child_workflow_deleted":case"child_workflow_finished":n.logger.info(`Received child workflow event "${e.payload.type}", but child workflows are not yet supported`);break;case"workflow_timedout":case"workflow_started":case"workflow_continued":return await nA(n,e);default:e.payload.type}return ft},tA=(t,e)=>t.logger.with({eventId:e.id,workflowId:e.payload.workflow.id,conversationId:e.payload.conversation?.id,userId:e.payload.user?.id}),nA=async(t,e)=>{let n=ql(e.payload.type),r=t.self.workflowHandlers[n]?.[e.payload.workflow.name];if(!r||r.length===0)return t.logger.warn(`No ${n} handler found for workflow "${e.payload.workflow.name}"`),ft;let{updatedWorkflow:o}=await rA(t,e);return o.status==="pending"&&t.logger.warn(`Workflow "${e.payload.workflow.name}" is still in pending status after processing "${n}" event. This may indicate that the workflow was not properly acknowledged or terminated by the handler. `),ft},rA=async(t,e)=>{let n=ql(e.payload.type),r=t.self.workflowHandlers[n]?.[e.payload.workflow.name],o=structuredClone(e.payload.workflow);for(let s of r??[])o=await s({...t,event:e,conversation:e.payload.conversation,user:e.payload.user,workflow:o});return{updatedWorkflow:o}};I();A();k();var LT=t=>async e=>{let n=$T(e.headers),r=new pi,o=new oA({botId:n.botId,retry:Qo}),s=new un(o,{before:{createMessage:async a=>{let l=t.hookHandlers.before_outgoing_message[a.type]??[];for(let c of l){let f=new un(o);a=(await c({client:f,ctx:n,logger:r.with({conversationId:a.conversationId,userId:a.userId}),data:a}))?.data??a}return a},callAction:async a=>{let l=t.hookHandlers.before_outgoing_call_action[a.type]??[];for(let c of l){let f=new un(o);a=(await c({client:f,ctx:n,logger:r,data:a}))?.data??a}return a}},after:{createMessage:async a=>{let l=t.hookHandlers.after_outgoing_message[a.message.type]??[];for(let c of l){let f=new un(o);a=(await c({client:f,ctx:n,logger:r.with({messageId:a.message.id,conversationId:a.message.conversationId,userId:a.message.userId}),data:a}))?.data??a}return a},callAction:async(a,l)=>{let{type:c}=l,f=t.hookHandlers.after_outgoing_call_action[c]??[];for(let y of f){let g=new un(o);a=(await y({client:g,ctx:n,logger:r,data:{type:c,...a}}))?.data??a}return a}}}),i={req:e,ctx:n,logger:r,client:s,self:t};try{switch(n.operation){case"action_triggered":return await cA(i);case"event_received":return await uA(i);case"register":return await aA(i);case"unregister":return await lA(i);case"ping":return await sA(i);default:throw new Error(`Unknown operation ${n.operation}`)}}catch(a){let l=a instanceof Error?a:new Error(String(a));if(iA(l)){let f=l.type==="Runtime"?l:new KT(l.message,l);return r.error(f.message),{status:f.code,body:JSON.stringify(f.toJSON())}}let c=new KT("An unexpected error occurred in the bot.",l);return r.error(c.message,l),{status:c.code,body:JSON.stringify(c.toJSON())}}},sA=async t=>ft,aA=async t=>(await t.self.registerHandler?.({client:t.client,ctx:t.ctx,logger:t.logger}),ft),lA=async t=>ft,uA=async t=>{let{ctx:e,logger:n,req:r,client:o,self:s}=t,i={client:o,ctx:e,logger:n},a=Dt(r);if(i.logger=i.logger.with({eventId:a.event.id,messageId:a.event.messageId,conversationId:a.event.conversationId,userId:a.event.userId}),e.type==="workflow_update")return await ZT(t,a.event);if(e.type==="message_created"){let h=a.event,T=h.payload.message;i.logger=i.logger.with({messageId:T.id,conversationId:T.conversationId,userId:T.userId});let x=s.hookHandlers.before_incoming_message[T.type]??[];for(let E of x){let H=await E({...i,data:T});if(T=H?.data??T,H?.stop)return ft}let B={...i,user:h.payload.user,conversation:h.payload.conversation,message:T,event:h},_=s.messageHandlers[T.type]??[];for(let E of _)await E(B);let S=s.hookHandlers.after_incoming_message[T.type]??[];for(let E of S){let H=await E({...i,data:T});if(T=H?.data??T,H?.stop)return ft}return ft}if(e.type==="state_expired"){let T=a.event.payload.state,x={...i,state:T},B=s.stateExpiredHandlers[T.name]??[];for(let _ of B)await _(x);return ft}let l=a.event,c=s.hookHandlers.before_incoming_event[l.type]??[];for(let h of c){let T=await h({...i,data:l});if(l=T?.data??l,T?.stop)return ft}let f={...i,event:l},y=s.eventHandlers[l.type]??[];for(let h of y)await h(f);let g=s.hookHandlers.after_incoming_event[l.type]??[];for(let h of g){let T=await h({...i,data:l});if(l=T?.data??l,T?.stop)return ft}return ft},cA=async({ctx:t,logger:e,req:n,client:r,self:o})=>{let{input:s,type:i}=Dt(n);if(!i)throw new Error("Missing action type");let a=o.hookHandlers.before_incoming_call_action[i]??[];for(let g of a){let h=await g({ctx:t,logger:e,client:r,data:{type:i,input:s}});s=h?.data?.input??s,i=h?.data?.type??i}let l=o.actionHandlers[i];if(!l)throw new Error(`Action ${i} not found`);let c=await l({ctx:t,logger:e,input:s,client:r,type:i}),f=o.hookHandlers.after_incoming_call_action[i]??[];for(let g of f){let h=await g({ctx:t,logger:e,client:r,data:{type:i,output:c}});i=h?.data?.type??i,c=h?.data?.output??c}return{status:200,body:JSON.stringify({output:c})}};I();A();k();I();A();k();I();A();k();var Wt=(t,{alias:e})=>{if(!("tags"in t)||!e)return t;let n=`${e}${Ht}`,r=Object.fromEntries(Object.entries(t.tags??{}).flatMap(([o,s])=>o.startsWith(n)?[[o.slice(n.length),s]]:[]));return{...t,tags:r}},ht=(t,{alias:e})=>{if(!("tags"in t)||!e)return t;let n=`${e}${Ht}`,r=Object.fromEntries(Object.entries(t.tags??{}).map(([o,s])=>[o.startsWith(n)?o:`${n}${o}`,s]));return{...t,tags:r}};I();A();k();var Gl=class{constructor(e){this._list=e}_nextToken;_elementsBuffer=[];_isExhausted=!1;[Symbol.asyncIterator](){return this}async next(){return this._bufferIsEmpty&&!this._isExhausted&&await this._fetchNextPageIntoBuffer(),this._bufferIsEmpty?{done:!0,value:void 0}:{done:!1,value:this._elementsBuffer.shift()}}async take(e){let n=[];for(let r=0;r<e;++r){let o=await this.next();if(o.done)break;n.push(o.value)}return n}async takePage(e){for(let r=0;r<e;++r)this._isExhausted||await this._fetchNextPageIntoBuffer();let n=[...this._elementsBuffer];return this._elementsBuffer.length=0,n}async takeAll(){return this.take(Number.POSITIVE_INFINITY)}get isExhausted(){return this._isExhausted}async _fetchNextPageIntoBuffer(){let{items:e,meta:n}=await this._list({nextToken:this._nextToken});this._elementsBuffer.push(...e),this._nextToken=n.nextToken,n.nextToken||(this._isExhausted=!0)}get _bufferIsEmpty(){return this._elementsBuffer.length===0}},Ct=t=>new Gl(t);var cn=t=>new Proxy({},{get:(e,n)=>({listInstances:r=>Ct(({nextToken:o})=>t.client.listWorkflows({...r,name:n,nextToken:o}).then(({meta:s,workflows:i})=>({meta:s,items:i.map(a=>Ot({...t,workflow:a}))}))),startNewInstance:async r=>{let{workflow:o}=await t.client.createWorkflow({name:n,status:"pending",...ht(r,{alias:void 0})});return{workflow:Ot({...t,workflow:o})}}})}),Ot=t=>{let e=!1;return{...Wt(t.workflow,{alias:void 0}),async update(n){let{workflow:r}=await t.client.updateWorkflow({id:t.workflow.id,...ht(n,{alias:void 0})});return await t.onWorkflowUpdate?.(r),{workflow:Ot({...t,workflow:r})}},async acknowledgeStartOfProcessing(){if(!t.event||t.workflow.status!=="pending"||e)return{workflow:Ot(t)};let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,status:"in_progress",eventId:t.event.id});return e=!0,await t.onWorkflowUpdate?.(n),{workflow:Ot({...t,workflow:n})}},async setFailed({failureReason:n}){let{workflow:r}=await t.client.updateWorkflow({id:t.workflow.id,status:"failed",failureReason:n});return await t.onWorkflowUpdate?.(r),{workflow:Ot({...t,workflow:r})}},async setCompleted({output:n}={}){let{workflow:r}=await t.client.updateWorkflow({id:t.workflow.id,status:"completed",output:n});return await t.onWorkflowUpdate?.(r),{workflow:Ot({...t,workflow:r})}},async cancel(){let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,status:"cancelled"});return await t.onWorkflowUpdate?.(n),{workflow:Ot({...t,workflow:n})}}}};I();A();k();var Vl=class{constructor(e){this.props=e;this._registerHandler=e.register,this._actionHandlers=e.actions,this._plugins=e.plugins}_registerHandler;_actionHandlers;_messageHandlers={};_eventHandlers={};_stateExpiredHandlers={};_hookHandlers={before_incoming_event:{},before_incoming_message:{},before_outgoing_message:{},before_outgoing_call_action:{},before_incoming_call_action:{},after_incoming_event:{},after_incoming_message:{},after_outgoing_message:{},after_outgoing_call_action:{},after_incoming_call_action:{}};_workflowHandlers={started:{},continued:{},timed_out:{}};_plugins={};_registerOrder=0;get registerHandler(){return this._registerHandler}get actionHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._actionHandlers[n];if(r)return dt.setName(o=>r({...o,workflows:cn(o)}),r.name);for(let[o,s]of Object.entries(this._plugins)){let[i,a]=n.split(Ht);if(!(i!==o||!a))return s.actionHandlers[a]}}})}get messageHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(a=>a.messageHandlers[n]??[]),o=n==="*"?[]:this._messageHandlers[n]??[],s=this._messageHandlers["*"]??[],i=[...o,...s].sort((a,l)=>a.order-l.order).map(({handler:a})=>dt.setName(l=>a({...l,workflows:cn(l)}),a.name));return ye.unique([...r,...i])}})}get eventHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(a=>a.eventHandlers[n]??[]),o=n==="*"?[]:this._eventHandlers[n]??[],s=this._eventHandlers["*"]??[],i=[...o,...s].sort((a,l)=>a.order-l.order).map(({handler:a})=>dt.setName(l=>a({...l,workflows:cn(l)}),a.name));return ye.unique([...r,...i])}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(a=>a.stateExpiredHandlers[n]??[]),o=n==="*"?[]:this._stateExpiredHandlers[n]??[],s=this._stateExpiredHandlers["*"]??[],i=[...o,...s].sort((a,l)=>a.order-l.order).map(({handler:a})=>dt.setName(l=>a({...l,workflows:cn(l)}),a.name));return ye.unique([...r,...i])}})}get hookHandlers(){return new Proxy({},{get:(e,n)=>{if(this._hookHandlers[n])return new Proxy({},{get:(o,s)=>{let i=Object.values(this._plugins).flatMap(y=>y.hookHandlers[n]?.[s]??[]),a=this._hookHandlers[n]??{},l=s==="*"?[]:a[s]??[],c=a["*"]??[],f=[...l,...c].sort((y,g)=>y.order-g.order).map(({handler:y})=>dt.setName(g=>y({...g,workflows:cn(g)}),y.name));return ye.unique([...i,...f])}})}})}get workflowHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._workflowHandlers[n];if(r)return new Proxy({},{get:(o,s)=>{let i=r[s]?.sort((l,c)=>l.order-c.order).map(({handler:l})=>dt.setName(async c=>{let f=c.workflow;return await l({...c,workflow:Ot({...c,onWorkflowUpdate(y){f=y}}),workflows:cn(c)}),f},l.name))??[],a=Object.values(this._plugins).flatMap(l=>l.workflowHandlers[n]?.[s]??[]);return ye.unique([...i,...a])}})}})}on={message:(e,n)=>{this._messageHandlers[e]=ye.safePush(this._messageHandlers[e],{handler:n,order:this._registerOrder++})},event:(e,n)=>{this._eventHandlers[e]=ye.safePush(this._eventHandlers[e],{handler:n,order:this._registerOrder++})},stateExpired:(e,n)=>{this._stateExpiredHandlers[e]=ye.safePush(this._stateExpiredHandlers[e],{handler:n,order:this._registerOrder++})},beforeIncomingEvent:(e,n)=>{this._hookHandlers.before_incoming_event[e]=ye.safePush(this._hookHandlers.before_incoming_event[e],{handler:n,order:this._registerOrder++})},beforeIncomingMessage:(e,n)=>{this._hookHandlers.before_incoming_message[e]=ye.safePush(this._hookHandlers.before_incoming_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingMessage:(e,n)=>{this._hookHandlers.before_outgoing_message[e]=ye.safePush(this._hookHandlers.before_outgoing_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingCallAction:(e,n)=>{this._hookHandlers.before_outgoing_call_action[e]=ye.safePush(this._hookHandlers.before_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},beforeIncomingCallAction:(e,n)=>{this._hookHandlers.before_incoming_call_action[e]=ye.safePush(this._hookHandlers.before_incoming_call_action[e],{handler:n,order:this._registerOrder++})},afterIncomingEvent:(e,n)=>{this._hookHandlers.after_incoming_event[e]=ye.safePush(this._hookHandlers.after_incoming_event[e],{handler:n,order:this._registerOrder++})},afterIncomingMessage:(e,n)=>{this._hookHandlers.after_incoming_message[e]=ye.safePush(this._hookHandlers.after_incoming_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingMessage:(e,n)=>{this._hookHandlers.after_outgoing_message[e]=ye.safePush(this._hookHandlers.after_outgoing_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingCallAction:(e,n)=>{this._hookHandlers.after_outgoing_call_action[e]=ye.safePush(this._hookHandlers.after_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},afterIncomingCallAction:(e,n)=>{this._hookHandlers.after_incoming_call_action[e]=ye.safePush(this._hookHandlers.after_incoming_call_action[e],{handler:n,order:this._registerOrder++})},workflowStart:(e,n)=>{this._workflowHandlers.started[e]=ye.safePush(this._workflowHandlers.started[e],{handler:n,order:this._registerOrder++})},workflowContinue:(e,n)=>{this._workflowHandlers.continued[e]=ye.safePush(this._workflowHandlers.continued[e],{handler:n,order:this._registerOrder++})},workflowTimeout:(e,n)=>{this._workflowHandlers.timed_out[e]=ye.safePush(this._workflowHandlers.timed_out[e],{handler:n,order:this._registerOrder++})}};handler=LT(this);start=e=>Jo(this.handler,e)};I();A();k();I();A();k();I();A();k();I();A();k();I();A();k();var Jl=class{constructor(e){this.props=e;this.name=e.name,this.version=e.version,this.icon=e.icon,this.title=e.title,this.description=e.description,this.readme=e.readme,this.entities=e.entities??{},this.attributes=e.attributes,this.__advanced=e.__advanced;let n=this._getEntityReference(this.entities),r=e.events===void 0?{}:Le.mapValues(e.events,i=>({...i,schema:i.schema(n)})),o=e.actions===void 0?{}:Le.mapValues(e.actions,i=>({...i,input:{...i.input,schema:i.input.schema(n)},output:{...i.output,schema:i.output.schema(n)}})),s=e.channels===void 0?{}:Le.mapValues(e.channels,i=>({...i,messages:Le.mapValues(i.messages,a=>({...a,schema:a.schema(n)}))}));this.events=r,this.actions=o,this.channels=s}name;version;title;description;icon;readme;attributes;entities;events;actions;channels;__advanced;get metadata(){return{sdkVersion:_n}}_getEntityReference=e=>{let n={};for(let[r,o]of Object.entries(e)){let s=o.schema._def["x-zui"]?.title,i=o.schema._def.description,a=My.ref(r);s&&a.title(s),i&&a.describe(i),n[r]=a}return n}};I();A();k();I();A();k();I();A();k();I();A();k();var Yl=class{constructor(e){this.props=e;let n=Object.fromEntries(Object.entries(e.interfaces??{}).map(([o,s])=>[o,Object.fromEntries(Object.entries(s.definition.entities??{}).map(([i])=>[i,X.ref(`interface:${o}/entities/${i}`)]))]));this.name=e.name,this.version=e.version,this.icon=e.icon,this.readme=e.readme,this.title=e.title,this.description=e.description,this.integrations=e.integrations,this.interfaces=e.interfaces,this.user=e.user,this.conversation=e.conversation,this.message=e.message,this.recurringEvents=e.recurringEvents,this.workflows=e.workflows,this.attributes=e.attributes,this.__advanced=e.__advanced;let r=new Set;for(let o of[...Object.keys(e.integrations??{}),...Object.keys(e.interfaces??{})]){if(r.has(o))throw new Error(`Duplicate interface or integration alias detected in plugin definition: '${o}'. Please use unique aliases for each interface and integration.`);r.add(o)}this.configuration=e.configuration?{...e.configuration,schema:typeof e.configuration.schema=="object"?e.configuration.schema:e.configuration.schema({entities:n})}:void 0,this.states=Object.fromEntries(Object.entries(e.states??{}).map(([o,s])=>[o,{...s,schema:typeof s.schema=="object"?s.schema:s.schema({entities:n})}])),this.events=Object.fromEntries(Object.entries(e.events??{}).map(([o,s])=>[o,{...s,schema:typeof s.schema=="object"?s.schema:s.schema({entities:n})}])),this.actions=Object.fromEntries(Object.entries(e.actions??{}).map(([o,s])=>[o,{...s,input:{...s.input,schema:typeof s.input.schema=="object"?s.input.schema:s.input.schema({entities:n})},output:{...s.output,schema:typeof s.output.schema=="object"?s.output.schema:s.output.schema({entities:n})}}])),this.tables=Object.fromEntries(Object.entries(e.tables??{}).map(([o,s])=>[o,{...s,schema:typeof s.schema=="object"?s.schema:s.schema({entities:n})}]))}name;version;title;description;icon;readme;attributes;integrations;interfaces;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;workflows;__advanced;get metadata(){return{sdkVersion:_n}}dereferenceEntities({intersectWithUnknownRecord:e}={intersectWithUnknownRecord:!0}){let n=this._buildZuiReferenceMap(e);return{...this,configuration:this.configuration?{...this.configuration,schema:this._dereferenceZuiSchema(this.configuration.schema,n)}:void 0,events:this._dereferenceDefinitionSchemas(this.events,n),states:this._dereferenceDefinitionSchemas(this.states,n),tables:this._dereferenceDefinitionSchemas(this.tables,n),actions:this._dereferenceActionDefinitionSchemas(this.actions,n)}}_buildZuiReferenceMap(e){return Object.fromEntries(Object.entries(this.interfaces??{}).flatMap(([n,r])=>Object.entries(r.definition.entities??{}).map(([o,s])=>[`interface:${n}/entities/${o}`,e?s.schema.and(X.record(X.string(),X.unknown())):s.schema])))}_dereferenceZuiSchema(e,n){return e.dereference(n)}_dereferenceDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,o])=>[r,{...o,schema:this._dereferenceZuiSchema(o.schema,n)}]))}_dereferenceActionDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,o])=>[r,{...o,input:{schema:this._dereferenceZuiSchema(o.input.schema,n)},output:{schema:this._dereferenceZuiSchema(o.output.schema,n)}}]))}};I();A();k();I();A();k();I();A();k();var FT=(t,e)=>new Proxy({},{get:(n,r)=>new Proxy({},{get:(o,s)=>i=>{let a=(e.integrations[r]??e.interfaces[r])?.integrationAlias,l=e.interfaces[r]?.actions?.[s]?.name??s;return t.callAction({type:`${a}:${l}`,input:i}).then(c=>c.output)}})});I();A();k();I();A();k();I();A();k();I();A();k();var Xl=t=>({async getById({id:e}){let n=await t.client.getMessage({id:e});return Ut({...t,message:n.message})},list(e){return Ct(({nextToken:n})=>t.client.listMessages({...ht(e??{},{alias:t.plugin?.alias}),nextToken:n}).then(({meta:r,messages:o})=>({meta:r,items:o.map(s=>Ut({...t,message:s}))})))}}),Ut=t=>({...Wt(t.message,{alias:t.plugin?.alias}),async delete(){await t.client.deleteMessage({id:t.message.id})},async update(e){let{message:n}=await t.client.updateMessage({...ht(e,{alias:t.plugin?.alias}),id:t.message.id});return Ut({...t,message:n})}});I();A();k();I();A();k();var Ql=t=>({list(e){return Ct(({nextToken:n})=>t.client.listUsers({...ht(e??{},{alias:t.pluginAlias}),nextToken:n}).then(({meta:r,users:o})=>({meta:r,items:o.map(s=>zt({...t,conversationId:e?.conversationId,user:s}))})))},async getById({id:e}){let n=await t.client.getUser({id:e});return zt({...t,user:n.user,conversationId:void 0})}}),zt=t=>{let e={...Wt(t.user,{alias:t.pluginAlias}),async update(n){let{user:r}=await t.client.updateUser({...ht(n,{alias:t.pluginAlias}),id:t.user.id});return zt({...t,user:r})}};return t.conversationId?{...e,async removeFromConversation(){return await t.client.removeParticipant({id:t.conversationId,userId:t.user.id}),zt({...t,conversationId:void 0})}}:{...e,async addToConversation({conversationId:n}){let{participant:r}=await t.client.addParticipant({id:n,userId:t.user.id});return zt({...t,user:r,conversationId:n})}}};I();A();k();var eu=t=>new Proxy({},{get:(e,n)=>new Proxy({},{get:(r,o)=>({list(s){let i=t.plugin?.interfaces[n]?.integrationAlias??t.plugin?.integrations[n]?.integrationAlias,a=t.plugin?.interfaces[n]?.channels?.[o]?.name??o;return Ct(({nextToken:l})=>t.client.listConversations({...ht(s??{},{alias:t.plugin?.alias}),channel:a==="*"?void 0:a,integrationName:i==="*"?void 0:i,nextToken:l}).then(({meta:c,conversations:f})=>({meta:c,items:f.map(y=>br({...t,conversation:y}))})))},async getById({id:s}){let i=await t.client.getConversation({id:s});return br({...t,conversation:i.conversation})}})})}),br=t=>{let e=t.client;return{...Wt(t.conversation,{alias:t.plugin?.alias}),async delete(){await e.deleteConversation({id:t.conversation.id})},async update(n){let{conversation:r}=await e.updateConversation({...ht(n,{alias:t.plugin?.alias}),id:t.conversation.id});return br({...t,conversation:r})},async getMessage({id:n}){let r=await e.getMessage({id:n});return Ut({...t,message:r.message})},async getOrCreateMessage(n){let{message:r}=await e.getOrCreateMessage({...ht(n,{alias:t.plugin?.alias}),conversationId:t.conversation.id});return Ut({...t,message:r})},async createMessage(n){let{message:r}=await e.createMessage({...ht(n,{alias:t.plugin?.alias}),conversationId:t.conversation.id});return Ut({...t,message:r})},listMessages(n){return Ct(({nextToken:r})=>e.listMessages({...ht(n??{},{alias:t.plugin?.alias}),conversationId:t.conversation.id,nextToken:r}).then(({meta:o,messages:s})=>({meta:o,items:s.map(i=>Ut({...t,message:i}))})))},listParticipants(){return Ct(({nextToken:n})=>e.listParticipants({id:t.conversation.id,nextToken:n}).then(({meta:r,participants:o})=>({meta:r,items:o.map(s=>zt({...t,user:s,conversationId:t.conversation.id}))})))}}};I();A();k();I();A();k();I();A();k();var tu=class t{constructor(e){this._props=e}async emit(e){let{conversationId:n,userId:r,messageId:o}=this._props,{event:s}=await this._props.client.createEvent({type:this._props.eventName,payload:e,conversationId:n,userId:r,messageId:o});return s}async schedule(e,n){let{conversationId:r,userId:o,messageId:s}=this._props,{event:i}=await this._props.client.createEvent({type:this._props.eventName,payload:e,conversationId:r,userId:o,messageId:s,schedule:n});return i}withConversationId(e){return new t({...this._props,conversationId:e})}withUserId(e){return new t({...this._props,userId:e})}withMessageId(e){return new t({...this._props,messageId:e})}async getById(e){return(await this._props.client.getEvent({id:e.id})).event}list(e){return Ct(({nextToken:n})=>this._props.client.listEvents({...e,type:this._props.eventName,conversationId:this._props.conversationId,userId:this._props.userId,messageId:this._props.messageId,nextToken:n}).then(({meta:r,events:o})=>({meta:r,items:o})))}},WT=(t,e)=>new Proxy({},{get:(n,r)=>{let o=e.alias!==void 0?`${e.alias}${Ht}${r}`:r;return new tu({client:t,eventName:o})}});I();A();k();I();A();k();I();A();k();I();A();k();I();A();k();var nu=class{constructor(e,n,r){this._client=e;this._stateType=n;this._stateName=r}async get(e){return await this._client.getState({type:this._stateType,name:this._stateName,id:e}).then(n=>n.state.payload)}async set(e,n,r){await this._client.setState({type:this._stateType,name:this._stateName,id:e,payload:n,expiry:r?.expiryMs})}async getOrSet(e,n,r){return await this._client.getOrSetState({type:this._stateType,name:this._stateName,id:e,payload:n,expiry:r?.expiryMs}).then(o=>o.state.payload)}async delete(e){await this._client.setState({type:this._stateType,name:this._stateName,id:e,payload:null})}async patch(e,n){await this._client.patchState({type:this._stateType,name:this._stateName,id:e,payload:n})}},zT=(t,e)=>new Proxy({},{get:(n,r)=>new Proxy({},{get:(o,s)=>{let i=e.alias!==void 0?`${e.alias}${Ht}${s}`:s;return new nu(t,r,i)}})});I();A();k();var ru=class{constructor(e){this.props=e;this._actionHandlers=e.actions}_runtimeProps;_actionHandlers;_messageHandlers={};_eventHandlers={};_stateExpiredHandlers={};_hookHandlers={before_incoming_event:{},before_incoming_message:{},before_outgoing_message:{},before_outgoing_call_action:{},before_incoming_call_action:{},after_incoming_event:{},after_incoming_message:{},after_outgoing_message:{},after_outgoing_call_action:{},after_incoming_call_action:{}};_workflowHandlers={started:{},continued:{},timed_out:{}};_registerOrder=0;initialize(e){return this._runtimeProps=e,this}get _runtime(){if(!this._runtimeProps)throw new Error("Plugin not correctly initialized. This is likely because you access your plugin config outside of an handler.");return this._runtimeProps}_getTools(e){let{configuration:n,interfaces:r,integrations:o,alias:s}=this._runtime,i=FT(e,this._runtime),a=zT(e,this._runtime),l=cn({client:e,pluginAlias:this._runtime.alias}),c=WT(e,this._runtime),f=Ql({client:e,pluginAlias:this._runtime.alias}),y=eu({client:e,plugin:this._runtime}),g=Xl({client:e,plugin:this._runtime});return{configuration:n,interfaces:r,integrations:o,actions:i,states:a,alias:s,workflows:l,events:c,users:f,conversations:y,messages:g}}get actionHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._actionHandlers[n];if(r)return dt.setName(o=>r({...o,...this._getTools(o.client)}),r.name)}})}get messageHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=n==="*"?[]:this._messageHandlers[n]??[],o=this._messageHandlers["*"]??[];return ye.unique([...r,...o]).sort((i,a)=>i.order-a.order).map(({handler:i})=>dt.setName(a=>i({...a,user:zt({...a,conversationId:a.conversation.id,pluginAlias:this._runtime.alias}),message:Ut({...a,plugin:this._runtime,message:a.message}),conversation:br({...a,plugin:this._runtime,conversation:a.conversation}),...this._getTools(a.client)}),i.name))}})}get eventHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=n==="*"?[]:this._eventHandlers[n]??[],o=Object.entries(this._eventHandlers).filter(([a])=>this._eventResolvesTo(a,n)).flatMap(([,a])=>a??[]),s=this._eventHandlers["*"]??[];return ye.unique([...r,...o,...s]).sort((a,l)=>a.order-l.order).map(({handler:a})=>dt.setName(l=>a({...l,...this._getTools(l.client)}),a.name))}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=n==="*"?[]:this._stateExpiredHandlers[n]??[],o=this._stateExpiredHandlers["*"]??[];return ye.unique([...r,...o]).sort((i,a)=>i.order-a.order).map(({handler:i})=>dt.setName(a=>i({...a,...this._getTools(a.client)}),i.name))}})}get hookHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._hookHandlers[n];if(r)return new Proxy({},{get:(o,s)=>{s=this._stripAliasPrefix(s);let i=s==="*"?[]:r[s]??[],a=Object.entries(r).filter(([f])=>this._eventResolvesTo(f,s)).flatMap(([,f])=>f??[]),l=r["*"]??[];return ye.unique([...i,...a,...l]).sort((f,y)=>f.order-y.order).map(({handler:f})=>dt.setName(y=>f({...y,data:Wt(y.data,{alias:this._runtime.alias}),...this._getTools(y.client)}),f.name))}})}})}get workflowHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._workflowHandlers[n];if(r)return new Proxy({},{get:(o,s)=>(r[s]?.sort((a,l)=>a.order-l.order)??[]).map(({handler:a})=>dt.setName(async l=>{let c=l.workflow;return await a({...l,workflow:Ot({...l,workflow:c,onWorkflowUpdate(f){c=f},pluginAlias:this._runtime.alias}),...this._getTools(l.client)}),c},a.name))})}})}on={message:(e,n)=>{this._messageHandlers[e]=ye.safePush(this._messageHandlers[e],{handler:n,order:this._registerOrder++})},event:(e,n)=>{this._eventHandlers[e]=ye.safePush(this._eventHandlers[e],{handler:n,order:this._registerOrder++})},stateExpired:(e,n)=>{this._stateExpiredHandlers[e]=ye.safePush(this._stateExpiredHandlers[e],{handler:n,order:this._registerOrder++})},beforeIncomingEvent:(e,n)=>{this._hookHandlers.before_incoming_event[e]=ye.safePush(this._hookHandlers.before_incoming_event[e],{handler:n,order:this._registerOrder++})},beforeIncomingMessage:(e,n)=>{this._hookHandlers.before_incoming_message[e]=ye.safePush(this._hookHandlers.before_incoming_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingMessage:(e,n)=>{this._hookHandlers.before_outgoing_message[e]=ye.safePush(this._hookHandlers.before_outgoing_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingCallAction:(e,n)=>{this._hookHandlers.before_outgoing_call_action[e]=ye.safePush(this._hookHandlers.before_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},beforeIncomingCallAction:(e,n)=>{this._hookHandlers.before_incoming_call_action[e]=ye.safePush(this._hookHandlers.before_incoming_call_action[e],{handler:n,order:this._registerOrder++})},afterIncomingEvent:(e,n)=>{this._hookHandlers.after_incoming_event[e]=ye.safePush(this._hookHandlers.after_incoming_event[e],{handler:n,order:this._registerOrder++})},afterIncomingMessage:(e,n)=>{this._hookHandlers.after_incoming_message[e]=ye.safePush(this._hookHandlers.after_incoming_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingMessage:(e,n)=>{this._hookHandlers.after_outgoing_message[e]=ye.safePush(this._hookHandlers.after_outgoing_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingCallAction:(e,n)=>{this._hookHandlers.after_outgoing_call_action[e]=ye.safePush(this._hookHandlers.after_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},afterIncomingCallAction:(e,n)=>{this._hookHandlers.after_incoming_call_action[e]=ye.safePush(this._hookHandlers.after_incoming_call_action[e],{handler:n,order:this._registerOrder++})},workflowStart:(e,n)=>{this._workflowHandlers.started[e]=ye.safePush(this._workflowHandlers.started[e],{handler:n,order:this._registerOrder++})},workflowContinue:(e,n)=>{this._workflowHandlers.continued[e]=ye.safePush(this._workflowHandlers.continued[e],{handler:n,order:this._registerOrder++})},workflowTimeout:(e,n)=>{this._workflowHandlers.timed_out[e]=ye.safePush(this._workflowHandlers.timed_out[e],{handler:n,order:this._registerOrder++})}};_eventResolvesTo=(e,n)=>{let[o,s]=e.split(":");if(!o||!s)return!1;let i=this._runtime.interfaces[o];if(i&&n===`${i.integrationAlias}:${i?.events?.[s]?.name}`)return!0;let a=this._runtime.integrations[o];return!!(a&&n===`${a.integrationAlias}:${s}`)};_stripAliasPrefix=e=>{let{alias:n}=this._runtime;if(!n)return e;let r=`${n}#`;return e.startsWith(r)?e.slice(r.length):e}};I();A();k();I();A();k();I();A();k();I();A();k();I();A();k();var qT={};bn(qT,{allWithinMajorOf:()=>dA,allWithinMinorOf:()=>fA});I();A();k();import*as gi from"semver";function dA(t){let e=gi.major(t.version);return{...t,version:`>=${e}.0.0 <${e+1}.0.0`}}function fA(t){let e=gi.major(t.version),n=gi.minor(t.version);return{...t,version:`>=${e}.${n}.0 <${e}.${n+1}.0`}}I();A();k();export{zP as BRAND,Vl as Bot,zl as BotDefinition,pi as BotLogger,un as BotSpecificClient,er as DIRTY,KP as EMPTY_PATH,pe as INVALID,Wl as Integration,al as IntegrationDefinition,fi as IntegrationLogger,li as IntegrationSpecificClient,Jl as InterfaceDefinition,zx as NEVER,gt as OK,Mt as ParseInputLazyPath,_t as ParseStatus,ru as Plugin,Yl as PluginDefinition,Wj as RuntimeError,he as Schema,yC as WELL_KNOWN_ATTRIBUTES,Gr as ZodAny,Vr as ZodArray,Gs as ZodBigInt,Vs as ZodBoolean,Js as ZodBranded,Ys as ZodCatch,Xs as ZodDate,xo as ZodDefault,xg as ZodDiscriminatedUnion,Rn as ZodEffects,ur as ZodEnum,Yt as ZodError,dg as ZodFirstPartyTypeKind,Eg as ZodFunction,ea as ZodIntersection,J as ZodIssueCode,ta as ZodLazy,na as ZodLiteral,Ig as ZodMap,Ag as ZodNaN,ra as ZodNativeEnum,Xr as ZodNever,ia as ZodNull,ir as ZodNullable,oa as ZodNumber,or as ZodObject,gn as ZodOptional,ne as ZodParsedType,sa as ZodPipeline,Eo as ZodPromise,So as ZodReadonly,Hg as ZodRecord,jg as ZodRef,he as ZodSchema,$g as ZodSet,yt as ZodString,Yg as ZodSymbol,Rn as ZodTransformer,ar as ZodTuple,he as ZodType,Io as ZodUndefined,aa as ZodUnion,Kr as ZodUnknown,ty as ZodVoid,te as addIssueToContext,QP as agent,ix as aimodel,yx as any,vx as array,cx as bigint,iy as boolean,Wx as coerce,JP as conversation,Bo as createZodEnum,Kg as cuid2Regex,Zg as cuidRegex,wg as custom,ox as datasource,dx as date,Px as discriminatedUnion,sd as effect,Wg as emailRegex,Mx as enum,ue as errorUtil,ex as event,Cx as function,zr as getErrorMap,pn as getParsedType,lx as instanceof,rx as intent,xx as intersection,qg as ipv4Regex,Gg as ipv6Regex,Ss as isAborted,Fj as isApiError,Mi as isAsync,Is as isDirty,qP as isEmojiRegex,qr as isValid,RA as json,sx as knowledgebase,ax as late,Ox as lazy,Rx as literal,Ri as makeIssue,kx as map,Qr as mergeObjectSchemas,XP as message,Wy as messages,ux as nan,Nx as nativeEnum,hx as never,gx as null,Ux as nullable,ry as number,_x as object,Es as objectUtil,Fx as oboolean,Lx as onumber,Hx as optional,Kx as ostring,Dt as parseBody,Zx as pipeline,$x as preprocess,me as processCreateParams,Dx as promise,ZP as quotelessJson,Ix as readonly,Ex as record,Sx as ref,Jo as serve,Ax as set,gg as setErrorMap,bx as strictObject,ny as string,fx as symbol,tx as table,nx as tablerow,sd as transformer,iv as transforms,Bx as tuple,Lg as ulidRegex,px as undefined,wx as union,mx as unknown,YP as user,be as util,Fg as uuidRegex,VP as variable,qT as version,Tx as void,X as z};
97
+ /*! Bundled license information:
98
+
99
+ lodash-es/lodash.js:
100
+ (**
101
+ * @license
102
+ * Lodash (Custom Build) <https://lodash.com/>
103
+ * Build: `lodash modularize exports="es" -o ./`
104
+ * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
105
+ * Released under MIT license <https://lodash.com/license>
106
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
107
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
108
+ *)
109
+ */
97
110
  /*! Bundled license information:
98
111
 
99
112
  @jspm/core/nodelibs/browser/chunk-DtuTasat.js:
@@ -101,20 +114,5 @@ Available integration aliases: ${p}`)}return[a,{...c,...l}]}));return r.plugins[
101
114
 
102
115
  @jspm/core/nodelibs/browser/chunk-CcCWfKp1.js:
103
116
  (*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
104
-
105
- @bpinternal/zui/dist/index.js:
106
- (*! Bundled license information:
107
-
108
- lodash-es/lodash.js:
109
- (**
110
- * @license
111
- * Lodash (Custom Build) <https://lodash.com/>
112
- * Build: `lodash modularize exports="es" -o ./`
113
- * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
114
- * Released under MIT license <https://lodash.com/license>
115
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
116
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
117
- *)
118
- *)
119
117
  */
120
118
  //# sourceMappingURL=index.mjs.map