@botpress/sdk 4.15.8 → 4.15.9

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,33 +1,33 @@
1
- var Qa=Object.defineProperty;var Dv=Object.getOwnPropertyDescriptor;var Hv=Object.getOwnPropertyNames;var Uv=Object.prototype.hasOwnProperty;var ot=(t,e)=>()=>(t&&(e=t(t=0)),e);var Wn=(t,e)=>{for(var n in e)Qa(t,n,{get:e[n],enumerable:!0})},Zv=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Hv(e))!Uv.call(t,a)&&a!==n&&Qa(t,a,{get:()=>e[a],enumerable:!(r=Dv(e,a))||r.enumerable});return t};var $v=t=>Zv(Qa({},"__esModule",{value:!0}),t);var C=ot(()=>{});var J={};Wn(J,{_debugEnd:()=>Nu,_debugProcess:()=>Mu,_events:()=>Xu,_eventsCount:()=>Yu,_exiting:()=>yu,_fatalExceptions:()=>Au,_getActiveHandles:()=>Tu,_getActiveRequests:()=>vu,_kill:()=>bu,_linkedBinding:()=>pu,_maxListeners:()=>Ju,_preload_modules:()=>qu,_rawDebug:()=>fu,_startProfilerIdleNotifier:()=>Du,_stopProfilerIdleNotifier:()=>Hu,_tickCallback:()=>Ru,abort:()=>ju,addListener:()=>Qu,allowedNodeEnvironmentFlags:()=>Su,arch:()=>Xl,argv:()=>eu,argv0:()=>zu,assert:()=>ku,binding:()=>au,browser:()=>cu,chdir:()=>lu,config:()=>mu,cpuUsage:()=>fi,cwd:()=>su,debugPort:()=>Wu,default:()=>lc,dlopen:()=>hu,domain:()=>gu,emit:()=>ic,emitWarning:()=>iu,env:()=>Ql,execArgv:()=>tu,execPath:()=>Fu,exit:()=>Bu,features:()=>Iu,hasUncaughtExceptionCaptureCallback:()=>Ou,hrtime:()=>ci,kill:()=>Pu,listeners:()=>sc,memoryUsage:()=>xu,moduleLoadList:()=>du,nextTick:()=>Gl,off:()=>tc,on:()=>Zt,once:()=>ec,openStdin:()=>Eu,pid:()=>Ku,platform:()=>Yl,ppid:()=>Lu,prependListener:()=>ac,prependOnceListener:()=>oc,reallyExit:()=>_u,release:()=>uu,removeAllListeners:()=>rc,removeListener:()=>nc,resourceUsage:()=>wu,setSourceMapsEnabled:()=>Gu,setUncaughtExceptionCaptureCallback:()=>Cu,stderr:()=>Zu,stdin:()=>$u,stdout:()=>Uu,title:()=>Jl,umask:()=>ou,uptime:()=>Vu,version:()=>nu,versions:()=>ru});function no(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function jv(){!zn||!yn||(zn=!1,yn.length?Ut=yn.concat(Ut):ui=-1,Ut.length&&ql())}function ql(){if(!zn){var t=setTimeout(jv,0);zn=!0;for(var e=Ut.length;e;){for(yn=Ut,Ut=[];++ui<e;)yn&&yn[ui].run();ui=-1,e=Ut.length}yn=null,zn=!1,clearTimeout(t)}}function Gl(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];Ut.push(new Vl(t,e)),Ut.length===1&&!zn&&setTimeout(ql,0)}function Vl(t,e){this.fun=t,this.array=e}function lt(){}function pu(t){no("_linkedBinding")}function hu(t){no("dlopen")}function vu(){return[]}function Tu(){return[]}function ku(t,e){if(!t)throw new Error(e||"assertion error")}function Ou(){return!1}function Vu(){return tn.now()/1e3}function ci(t){var e=Math.floor((Date.now()-tn.now())*.001),n=tn.now()*.001,r=Math.floor(n)+e,a=Math.floor(n%1*1e9);return t&&(r=r-t[0],a=a-t[1],a<0&&(r--,a+=to)),[r,a]}function Zt(){return lc}function sc(t){return[]}var Ut,zn,yn,ui,Jl,Xl,Yl,Ql,eu,tu,nu,ru,iu,au,ou,su,lu,uu,cu,fu,du,gu,yu,mu,_u,bu,fi,wu,xu,Pu,Bu,Eu,Su,Iu,Au,Cu,Ru,Mu,Nu,Du,Hu,Uu,Zu,$u,ju,Ku,Lu,Fu,Wu,zu,qu,Gu,tn,eo,to,Ju,Xu,Yu,Qu,ec,tc,nc,rc,ic,ac,oc,lc,uc=ot(()=>{C();R();O();Ut=[],zn=!1,ui=-1;Vl.prototype.run=function(){this.fun.apply(null,this.array)};Jl="browser",Xl="x64",Yl="browser",Ql={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},eu=["/usr/bin/node"],tu=[],nu="v16.8.0",ru={},iu=function(t,e){console.warn((e?e+": ":"")+t)},au=function(t){no("binding")},ou=function(t){return 0},su=function(){return"/"},lu=function(t){},uu={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};cu=!0,fu=lt,du=[];gu={},yu=!1,mu={};_u=lt,bu=lt,fi=function(){return{}},wu=fi,xu=fi,Pu=lt,Bu=lt,Eu=lt,Su={};Iu={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Au=lt,Cu=lt;Ru=lt,Mu=lt,Nu=lt,Du=lt,Hu=lt,Uu=void 0,Zu=void 0,$u=void 0,ju=lt,Ku=2,Lu=1,Fu="/bin/usr/node",Wu=9229,zu="node",qu=[],Gu=lt,tn={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};tn.now===void 0&&(eo=Date.now(),tn.timing&&tn.timing.navigationStart&&(eo=tn.timing.navigationStart),tn.now=()=>Date.now()-eo);to=1e9;ci.bigint=function(t){var e=ci(t);return typeof BigInt>"u"?e[0]*to+e[1]:BigInt(e[0]*to)+BigInt(e[1])};Ju=10,Xu={},Yu=0;Qu=Zt,ec=Zt,tc=Zt,nc=Zt,rc=Zt,ic=lt,ac=Zt,oc=Zt;lc={version:nu,versions:ru,arch:Xl,platform:Yl,browser:cu,release:uu,_rawDebug:fu,moduleLoadList:du,binding:au,_linkedBinding:pu,_events:Xu,_eventsCount:Yu,_maxListeners:Ju,on:Zt,addListener:Qu,once:ec,off:tc,removeListener:nc,removeAllListeners:rc,emit:ic,prependListener:ac,prependOnceListener:oc,listeners:sc,domain:gu,_exiting:yu,config:mu,dlopen:hu,uptime:Vu,_getActiveRequests:vu,_getActiveHandles:Tu,reallyExit:_u,_kill:bu,cpuUsage:fi,resourceUsage:wu,memoryUsage:xu,kill:Pu,exit:Bu,openStdin:Eu,allowedNodeEnvironmentFlags:Su,assert:ku,features:Iu,_fatalExceptions:Au,setUncaughtExceptionCaptureCallback:Cu,hasUncaughtExceptionCaptureCallback:Ou,emitWarning:iu,nextTick:Gl,_tickCallback:Ru,_debugProcess:Mu,_debugEnd:Nu,_startProfilerIdleNotifier:Du,_stopProfilerIdleNotifier:Hu,stdout:Uu,stdin:$u,stderr:Zu,abort:ju,umask:ou,chdir:lu,cwd:su,env:Ql,title:Jl,argv:eu,execArgv:tu,pid:Ku,ppid:Lu,execPath:Fu,debugPort:Wu,hrtime:ci,argv0:zu,_preload_modules:qu,setSourceMapsEnabled:Gu}});var O=ot(()=>{uc()});function Kv(){if(cc)return br;cc=!0,br.byteLength=s,br.toByteArray=f,br.fromByteArray=g;for(var t=[],e=[],n=typeof Uint8Array<"u"?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,o=r.length;a<o;++a)t[a]=r[a],e[r.charCodeAt(a)]=a;e["-".charCodeAt(0)]=62,e["_".charCodeAt(0)]=63;function i(h){var w=h.length;if(w%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var P=h.indexOf("=");P===-1&&(P=w);var B=P===w?0:4-P%4;return[P,B]}function s(h){var w=i(h),P=w[0],B=w[1];return(P+B)*3/4-B}function l(h,w,P){return(w+P)*3/4-P}function f(h){var w,P=i(h),B=P[0],v=P[1],S=new n(l(h,B,v)),E=0,H=v>0?B-4:B,K;for(K=0;K<H;K+=4)w=e[h.charCodeAt(K)]<<18|e[h.charCodeAt(K+1)]<<12|e[h.charCodeAt(K+2)]<<6|e[h.charCodeAt(K+3)],S[E++]=w>>16&255,S[E++]=w>>8&255,S[E++]=w&255;return v===2&&(w=e[h.charCodeAt(K)]<<2|e[h.charCodeAt(K+1)]>>4,S[E++]=w&255),v===1&&(w=e[h.charCodeAt(K)]<<10|e[h.charCodeAt(K+1)]<<4|e[h.charCodeAt(K+2)]>>2,S[E++]=w>>8&255,S[E++]=w&255),S}function p(h){return t[h>>18&63]+t[h>>12&63]+t[h>>6&63]+t[h&63]}function y(h,w,P){for(var B,v=[],S=w;S<P;S+=3)B=(h[S]<<16&16711680)+(h[S+1]<<8&65280)+(h[S+2]&255),v.push(p(B));return v.join("")}function g(h){for(var w,P=h.length,B=P%3,v=[],S=16383,E=0,H=P-B;E<H;E+=S)v.push(y(h,E,E+S>H?H:E+S));return B===1?(w=h[P-1],v.push(t[w>>2]+t[w<<4&63]+"==")):B===2&&(w=(h[P-2]<<8)+h[P-1],v.push(t[w>>10]+t[w>>4&63]+t[w<<2&63]+"=")),v.join("")}return br}function Lv(){if(fc)return di;fc=!0;return di.read=function(t,e,n,r,a){var o,i,s=a*8-r-1,l=(1<<s)-1,f=l>>1,p=-7,y=n?a-1:0,g=n?-1:1,h=t[e+y];for(y+=g,o=h&(1<<-p)-1,h>>=-p,p+=s;p>0;o=o*256+t[e+y],y+=g,p-=8);for(i=o&(1<<-p)-1,o>>=-p,p+=r;p>0;i=i*256+t[e+y],y+=g,p-=8);if(o===0)o=1-f;else{if(o===l)return i?NaN:(h?-1:1)*(1/0);i=i+Math.pow(2,r),o=o-f}return(h?-1:1)*i*Math.pow(2,o-r)},di.write=function(t,e,n,r,a,o){var i,s,l,f=o*8-a-1,p=(1<<f)-1,y=p>>1,g=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:o-1,w=r?1:-1,P=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=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?(s=0,i=p):i+y>=1?(s=(e*l-1)*Math.pow(2,a),i=i+y):(s=e*Math.pow(2,y-1)*Math.pow(2,a),i=0));a>=8;t[n+h]=s&255,h+=w,s/=256,a-=8);for(i=i<<a|s,f+=a;f>0;t[n+h]=i&255,h+=w,i/=256,f-=8);t[n+h-w]|=P*128},di}function Rt(){if(dc)return mn;dc=!0;let t=Kv(),e=Lv(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;mn.Buffer=i,mn.SlowBuffer=v,mn.INSPECT_MAX_BYTES=50;let r=2147483647;mn.kMaxLength=r,i.TYPED_ARRAY_SUPPORT=a(),!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 a(){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 o(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,c){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 s(m,u,c)}i.poolSize=8192;function s(m,u,c){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(wt(m,ArrayBuffer)||m&&wt(m.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(wt(m,SharedArrayBuffer)||m&&wt(m.buffer,SharedArrayBuffer)))return w(m,u,c);if(typeof m=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let T=m.valueOf&&m.valueOf();if(T!=null&&T!==m)return i.from(T,u,c);let I=P(m);if(I)return I;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof m[Symbol.toPrimitive]=="function")return i.from(m[Symbol.toPrimitive]("string"),u,c);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,c){return s(m,u,c)},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 f(m,u,c){return l(m),m<=0?o(m):u!==void 0?typeof c=="string"?o(m).fill(u,c):o(m).fill(u):o(m)}i.alloc=function(m,u,c){return f(m,u,c)};function p(m){return l(m),o(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 c=S(m,u)|0,T=o(c),I=T.write(m,u);return I!==c&&(T=T.slice(0,I)),T}function g(m){let u=m.length<0?0:B(m.length)|0,c=o(u);for(let T=0;T<u;T+=1)c[T]=m[T]&255;return c}function h(m){if(wt(m,Uint8Array)){let u=new Uint8Array(m);return w(u.buffer,u.byteOffset,u.byteLength)}return g(m)}function w(m,u,c){if(u<0||m.byteLength<u)throw new RangeError('"offset" is outside of buffer bounds');if(m.byteLength<u+(c||0))throw new RangeError('"length" is outside of buffer bounds');let T;return u===void 0&&c===void 0?T=new Uint8Array(m):c===void 0?T=new Uint8Array(m,u):T=new Uint8Array(m,u,c),Object.setPrototypeOf(T,i.prototype),T}function P(m){if(i.isBuffer(m)){let u=B(m.length)|0,c=o(u);return c.length===0||m.copy(c,0,0,u),c}if(m.length!==void 0)return typeof m.length!="number"||Tr(m.length)?o(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 v(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,c){if(wt(u,Uint8Array)&&(u=i.from(u,u.offset,u.byteLength)),wt(c,Uint8Array)&&(c=i.from(c,c.offset,c.byteLength)),!i.isBuffer(u)||!i.isBuffer(c))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(u===c)return 0;let T=u.length,I=c.length;for(let U=0,W=Math.min(T,I);U<W;++U)if(u[U]!==c[U]){T=u[U],I=c[U];break}return T<I?-1:I<T?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,c){if(!Array.isArray(u))throw new TypeError('"list" argument must be an Array of Buffers');if(u.length===0)return i.alloc(0);let T;if(c===void 0)for(c=0,T=0;T<u.length;++T)c+=u[T].length;let I=i.allocUnsafe(c),U=0;for(T=0;T<u.length;++T){let W=u[T];if(wt(W,Uint8Array))U+W.length>I.length?(i.isBuffer(W)||(W=i.from(W)),W.copy(I,U)):Uint8Array.prototype.set.call(I,W,U);else if(i.isBuffer(W))W.copy(I,U);else throw new TypeError('"list" argument must be an Array of Buffers');U+=W.length}return I};function S(m,u){if(i.isBuffer(m))return m.length;if(ArrayBuffer.isView(m)||wt(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 c=m.length,T=arguments.length>2&&arguments[2]===!0;if(!T&&c===0)return 0;let I=!1;for(;;)switch(u){case"ascii":case"latin1":case"binary":return c;case"utf8":case"utf-8":return Me(m).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c*2;case"hex":return c>>>1;case"base64":return kt(m).length;default:if(I)return T?-1:Me(m).length;u=(""+u).toLowerCase(),I=!0}}i.byteLength=S;function E(m,u,c){let T=!1;if((u===void 0||u<0)&&(u=0),u>this.length||((c===void 0||c>this.length)&&(c=this.length),c<=0)||(c>>>=0,u>>>=0,c<=u))return"";for(m||(m="utf8");;)switch(m){case"hex":return Pe(this,u,c);case"utf8":case"utf-8":return tt(this,u,c);case"ascii":return mt(this,u,c);case"latin1":case"binary":return Ue(this,u,c);case"base64":return ze(this,u,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Se(this,u,c);default:if(T)throw new TypeError("Unknown encoding: "+m);m=(m+"").toLowerCase(),T=!0}}i.prototype._isBuffer=!0;function H(m,u,c){let T=m[u];m[u]=m[c],m[c]=T}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 c=0;c<u;c+=2)H(this,c,c+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 c=0;c<u;c+=4)H(this,c,c+3),H(this,c+1,c+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 c=0;c<u;c+=8)H(this,c,c+7),H(this,c+1,c+6),H(this,c+2,c+5),H(this,c+3,c+4);return this},i.prototype.toString=function(){let u=this.length;return u===0?"":arguments.length===0?tt(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="",c=mn.INSPECT_MAX_BYTES;return u=this.toString("hex",0,c).replace(/(.{2})/g,"$1 ").trim(),this.length>c&&(u+=" ... "),"<Buffer "+u+">"},n&&(i.prototype[n]=i.prototype.inspect),i.prototype.compare=function(u,c,T,I,U){if(wt(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(c===void 0&&(c=0),T===void 0&&(T=u?u.length:0),I===void 0&&(I=0),U===void 0&&(U=this.length),c<0||T>u.length||I<0||U>this.length)throw new RangeError("out of range index");if(I>=U&&c>=T)return 0;if(I>=U)return-1;if(c>=T)return 1;if(c>>>=0,T>>>=0,I>>>=0,U>>>=0,this===u)return 0;let W=U-I,Be=T-c,qe=Math.min(W,Be),$e=this.slice(I,U),Ge=u.slice(c,T);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 K(m,u,c,T,I){if(m.length===0)return-1;if(typeof c=="string"?(T=c,c=0):c>2147483647?c=2147483647:c<-2147483648&&(c=-2147483648),c=+c,Tr(c)&&(c=I?0:m.length-1),c<0&&(c=m.length+c),c>=m.length){if(I)return-1;c=m.length-1}else if(c<0)if(I)c=0;else return-1;if(typeof u=="string"&&(u=i.from(u,T)),i.isBuffer(u))return u.length===0?-1:ae(m,u,c,T,I);if(typeof u=="number")return u=u&255,typeof Uint8Array.prototype.indexOf=="function"?I?Uint8Array.prototype.indexOf.call(m,u,c):Uint8Array.prototype.lastIndexOf.call(m,u,c):ae(m,[u],c,T,I);throw new TypeError("val must be string, number or Buffer")}function ae(m,u,c,T,I){let U=1,W=m.length,Be=u.length;if(T!==void 0&&(T=String(T).toLowerCase(),T==="ucs2"||T==="ucs-2"||T==="utf16le"||T==="utf-16le")){if(m.length<2||u.length<2)return-1;U=2,W/=2,Be/=2,c/=2}function qe(Ge,He){return U===1?Ge[He]:Ge.readUInt16BE(He*U)}let $e;if(I){let Ge=-1;for($e=c;$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(c+Be>W&&(c=W-Be),$e=c;$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,c,T){return this.indexOf(u,c,T)!==-1},i.prototype.indexOf=function(u,c,T){return K(this,u,c,T,!0)},i.prototype.lastIndexOf=function(u,c,T){return K(this,u,c,T,!1)};function ee(m,u,c,T){c=Number(c)||0;let I=m.length-c;T?(T=Number(T),T>I&&(T=I)):T=I;let U=u.length;T>U/2&&(T=U/2);let W;for(W=0;W<T;++W){let Be=parseInt(u.substr(W*2,2),16);if(Tr(Be))return W;m[c+W]=Be}return W}function ge(m,u,c,T){return Ot(Me(u,m.length-c),m,c,T)}function oe(m,u,c,T){return Ot(_e(u),m,c,T)}function re(m,u,c,T){return Ot(kt(u),m,c,T)}function Oe(m,u,c,T){return Ot(Z(u,m.length-c),m,c,T)}i.prototype.write=function(u,c,T,I){if(c===void 0)I="utf8",T=this.length,c=0;else if(T===void 0&&typeof c=="string")I=c,T=this.length,c=0;else if(isFinite(c))c=c>>>0,isFinite(T)?(T=T>>>0,I===void 0&&(I="utf8")):(I=T,T=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let U=this.length-c;if((T===void 0||T>U)&&(T=U),u.length>0&&(T<0||c<0)||c>this.length)throw new RangeError("Attempt to write outside buffer bounds");I||(I="utf8");let W=!1;for(;;)switch(I){case"hex":return ee(this,u,c,T);case"utf8":case"utf-8":return ge(this,u,c,T);case"ascii":case"latin1":case"binary":return oe(this,u,c,T);case"base64":return re(this,u,c,T);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Oe(this,u,c,T);default:if(W)throw new TypeError("Unknown encoding: "+I);I=(""+I).toLowerCase(),W=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ze(m,u,c){return u===0&&c===m.length?t.fromByteArray(m):t.fromByteArray(m.slice(u,c))}function tt(m,u,c){c=Math.min(m.length,c);let T=[],I=u;for(;I<c;){let U=m[I],W=null,Be=U>239?4:U>223?3:U>191?2:1;if(I+Be<=c){let qe,$e,Ge,He;switch(Be){case 1:U<128&&(W=U);break;case 2:qe=m[I+1],(qe&192)===128&&(He=(U&31)<<6|qe&63,He>127&&(W=He));break;case 3:qe=m[I+1],$e=m[I+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[I+1],$e=m[I+2],Ge=m[I+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,T.push(W>>>10&1023|55296),W=56320|W&1023),T.push(W),I+=Be}return Je(T)}let Ve=4096;function Je(m){let u=m.length;if(u<=Ve)return String.fromCharCode.apply(String,m);let c="",T=0;for(;T<u;)c+=String.fromCharCode.apply(String,m.slice(T,T+=Ve));return c}function mt(m,u,c){let T="";c=Math.min(m.length,c);for(let I=u;I<c;++I)T+=String.fromCharCode(m[I]&127);return T}function Ue(m,u,c){let T="";c=Math.min(m.length,c);for(let I=u;I<c;++I)T+=String.fromCharCode(m[I]);return T}function Pe(m,u,c){let T=m.length;(!u||u<0)&&(u=0),(!c||c<0||c>T)&&(c=T);let I="";for(let U=u;U<c;++U)I+=li[m[U]];return I}function Se(m,u,c){let T=m.slice(u,c),I="";for(let U=0;U<T.length-1;U+=2)I+=String.fromCharCode(T[U]+T[U+1]*256);return I}i.prototype.slice=function(u,c){let T=this.length;u=~~u,c=c===void 0?T:~~c,u<0?(u+=T,u<0&&(u=0)):u>T&&(u=T),c<0?(c+=T,c<0&&(c=0)):c>T&&(c=T),c<u&&(c=u);let I=this.subarray(u,c);return Object.setPrototypeOf(I,i.prototype),I};function fe(m,u,c){if(m%1!==0||m<0)throw new RangeError("offset is not uint");if(m+u>c)throw new RangeError("Trying to access beyond buffer length")}i.prototype.readUintLE=i.prototype.readUIntLE=function(u,c,T){u=u>>>0,c=c>>>0,T||fe(u,c,this.length);let I=this[u],U=1,W=0;for(;++W<c&&(U*=256);)I+=this[u+W]*U;return I},i.prototype.readUintBE=i.prototype.readUIntBE=function(u,c,T){u=u>>>0,c=c>>>0,T||fe(u,c,this.length);let I=this[u+--c],U=1;for(;c>0&&(U*=256);)I+=this[u+--c]*U;return I},i.prototype.readUint8=i.prototype.readUInt8=function(u,c){return u=u>>>0,c||fe(u,1,this.length),this[u]},i.prototype.readUint16LE=i.prototype.readUInt16LE=function(u,c){return u=u>>>0,c||fe(u,2,this.length),this[u]|this[u+1]<<8},i.prototype.readUint16BE=i.prototype.readUInt16BE=function(u,c){return u=u>>>0,c||fe(u,2,this.length),this[u]<<8|this[u+1]},i.prototype.readUint32LE=i.prototype.readUInt32LE=function(u,c){return u=u>>>0,c||fe(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,c){return u=u>>>0,c||fe(u,4,this.length),this[u]*16777216+(this[u+1]<<16|this[u+2]<<8|this[u+3])},i.prototype.readBigUInt64LE=Bt(function(u){u=u>>>0,b(u,"offset");let c=this[u],T=this[u+7];(c===void 0||T===void 0)&&x(u,this.length-8);let I=c+this[++u]*2**8+this[++u]*2**16+this[++u]*2**24,U=this[++u]+this[++u]*2**8+this[++u]*2**16+T*2**24;return BigInt(I)+(BigInt(U)<<BigInt(32))}),i.prototype.readBigUInt64BE=Bt(function(u){u=u>>>0,b(u,"offset");let c=this[u],T=this[u+7];(c===void 0||T===void 0)&&x(u,this.length-8);let I=c*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+T;return(BigInt(I)<<BigInt(32))+BigInt(U)}),i.prototype.readIntLE=function(u,c,T){u=u>>>0,c=c>>>0,T||fe(u,c,this.length);let I=this[u],U=1,W=0;for(;++W<c&&(U*=256);)I+=this[u+W]*U;return U*=128,I>=U&&(I-=Math.pow(2,8*c)),I},i.prototype.readIntBE=function(u,c,T){u=u>>>0,c=c>>>0,T||fe(u,c,this.length);let I=c,U=1,W=this[u+--I];for(;I>0&&(U*=256);)W+=this[u+--I]*U;return U*=128,W>=U&&(W-=Math.pow(2,8*c)),W},i.prototype.readInt8=function(u,c){return u=u>>>0,c||fe(u,1,this.length),this[u]&128?(255-this[u]+1)*-1:this[u]},i.prototype.readInt16LE=function(u,c){u=u>>>0,c||fe(u,2,this.length);let T=this[u]|this[u+1]<<8;return T&32768?T|4294901760:T},i.prototype.readInt16BE=function(u,c){u=u>>>0,c||fe(u,2,this.length);let T=this[u+1]|this[u]<<8;return T&32768?T|4294901760:T},i.prototype.readInt32LE=function(u,c){return u=u>>>0,c||fe(u,4,this.length),this[u]|this[u+1]<<8|this[u+2]<<16|this[u+3]<<24},i.prototype.readInt32BE=function(u,c){return u=u>>>0,c||fe(u,4,this.length),this[u]<<24|this[u+1]<<16|this[u+2]<<8|this[u+3]},i.prototype.readBigInt64LE=Bt(function(u){u=u>>>0,b(u,"offset");let c=this[u],T=this[u+7];(c===void 0||T===void 0)&&x(u,this.length-8);let I=this[u+4]+this[u+5]*2**8+this[u+6]*2**16+(T<<24);return(BigInt(I)<<BigInt(32))+BigInt(c+this[++u]*2**8+this[++u]*2**16+this[++u]*2**24)}),i.prototype.readBigInt64BE=Bt(function(u){u=u>>>0,b(u,"offset");let c=this[u],T=this[u+7];(c===void 0||T===void 0)&&x(u,this.length-8);let I=(c<<24)+this[++u]*2**16+this[++u]*2**8+this[++u];return(BigInt(I)<<BigInt(32))+BigInt(this[++u]*2**24+this[++u]*2**16+this[++u]*2**8+T)}),i.prototype.readFloatLE=function(u,c){return u=u>>>0,c||fe(u,4,this.length),e.read(this,u,!0,23,4)},i.prototype.readFloatBE=function(u,c){return u=u>>>0,c||fe(u,4,this.length),e.read(this,u,!1,23,4)},i.prototype.readDoubleLE=function(u,c){return u=u>>>0,c||fe(u,8,this.length),e.read(this,u,!0,52,8)},i.prototype.readDoubleBE=function(u,c){return u=u>>>0,c||fe(u,8,this.length),e.read(this,u,!1,52,8)};function ve(m,u,c,T,I,U){if(!i.isBuffer(m))throw new TypeError('"buffer" argument must be a Buffer instance');if(u>I||u<U)throw new RangeError('"value" argument is out of bounds');if(c+T>m.length)throw new RangeError("Index out of range")}i.prototype.writeUintLE=i.prototype.writeUIntLE=function(u,c,T,I){if(u=+u,c=c>>>0,T=T>>>0,!I){let Be=Math.pow(2,8*T)-1;ve(this,u,c,T,Be,0)}let U=1,W=0;for(this[c]=u&255;++W<T&&(U*=256);)this[c+W]=u/U&255;return c+T},i.prototype.writeUintBE=i.prototype.writeUIntBE=function(u,c,T,I){if(u=+u,c=c>>>0,T=T>>>0,!I){let Be=Math.pow(2,8*T)-1;ve(this,u,c,T,Be,0)}let U=T-1,W=1;for(this[c+U]=u&255;--U>=0&&(W*=256);)this[c+U]=u/W&255;return c+T},i.prototype.writeUint8=i.prototype.writeUInt8=function(u,c,T){return u=+u,c=c>>>0,T||ve(this,u,c,1,255,0),this[c]=u&255,c+1},i.prototype.writeUint16LE=i.prototype.writeUInt16LE=function(u,c,T){return u=+u,c=c>>>0,T||ve(this,u,c,2,65535,0),this[c]=u&255,this[c+1]=u>>>8,c+2},i.prototype.writeUint16BE=i.prototype.writeUInt16BE=function(u,c,T){return u=+u,c=c>>>0,T||ve(this,u,c,2,65535,0),this[c]=u>>>8,this[c+1]=u&255,c+2},i.prototype.writeUint32LE=i.prototype.writeUInt32LE=function(u,c,T){return u=+u,c=c>>>0,T||ve(this,u,c,4,4294967295,0),this[c+3]=u>>>24,this[c+2]=u>>>16,this[c+1]=u>>>8,this[c]=u&255,c+4},i.prototype.writeUint32BE=i.prototype.writeUInt32BE=function(u,c,T){return u=+u,c=c>>>0,T||ve(this,u,c,4,4294967295,0),this[c]=u>>>24,this[c+1]=u>>>16,this[c+2]=u>>>8,this[c+3]=u&255,c+4};function D(m,u,c,T,I){ie(u,T,I,m,c,7);let U=Number(u&BigInt(4294967295));m[c++]=U,U=U>>8,m[c++]=U,U=U>>8,m[c++]=U,U=U>>8,m[c++]=U;let W=Number(u>>BigInt(32)&BigInt(4294967295));return m[c++]=W,W=W>>8,m[c++]=W,W=W>>8,m[c++]=W,W=W>>8,m[c++]=W,c}function j(m,u,c,T,I){ie(u,T,I,m,c,7);let U=Number(u&BigInt(4294967295));m[c+7]=U,U=U>>8,m[c+6]=U,U=U>>8,m[c+5]=U,U=U>>8,m[c+4]=U;let W=Number(u>>BigInt(32)&BigInt(4294967295));return m[c+3]=W,W=W>>8,m[c+2]=W,W=W>>8,m[c+1]=W,W=W>>8,m[c]=W,c+8}i.prototype.writeBigUInt64LE=Bt(function(u,c=0){return D(this,u,c,BigInt(0),BigInt("0xffffffffffffffff"))}),i.prototype.writeBigUInt64BE=Bt(function(u,c=0){return j(this,u,c,BigInt(0),BigInt("0xffffffffffffffff"))}),i.prototype.writeIntLE=function(u,c,T,I){if(u=+u,c=c>>>0,!I){let qe=Math.pow(2,8*T-1);ve(this,u,c,T,qe-1,-qe)}let U=0,W=1,Be=0;for(this[c]=u&255;++U<T&&(W*=256);)u<0&&Be===0&&this[c+U-1]!==0&&(Be=1),this[c+U]=(u/W>>0)-Be&255;return c+T},i.prototype.writeIntBE=function(u,c,T,I){if(u=+u,c=c>>>0,!I){let qe=Math.pow(2,8*T-1);ve(this,u,c,T,qe-1,-qe)}let U=T-1,W=1,Be=0;for(this[c+U]=u&255;--U>=0&&(W*=256);)u<0&&Be===0&&this[c+U+1]!==0&&(Be=1),this[c+U]=(u/W>>0)-Be&255;return c+T},i.prototype.writeInt8=function(u,c,T){return u=+u,c=c>>>0,T||ve(this,u,c,1,127,-128),u<0&&(u=255+u+1),this[c]=u&255,c+1},i.prototype.writeInt16LE=function(u,c,T){return u=+u,c=c>>>0,T||ve(this,u,c,2,32767,-32768),this[c]=u&255,this[c+1]=u>>>8,c+2},i.prototype.writeInt16BE=function(u,c,T){return u=+u,c=c>>>0,T||ve(this,u,c,2,32767,-32768),this[c]=u>>>8,this[c+1]=u&255,c+2},i.prototype.writeInt32LE=function(u,c,T){return u=+u,c=c>>>0,T||ve(this,u,c,4,2147483647,-2147483648),this[c]=u&255,this[c+1]=u>>>8,this[c+2]=u>>>16,this[c+3]=u>>>24,c+4},i.prototype.writeInt32BE=function(u,c,T){return u=+u,c=c>>>0,T||ve(this,u,c,4,2147483647,-2147483648),u<0&&(u=4294967295+u+1),this[c]=u>>>24,this[c+1]=u>>>16,this[c+2]=u>>>8,this[c+3]=u&255,c+4},i.prototype.writeBigInt64LE=Bt(function(u,c=0){return D(this,u,c,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),i.prototype.writeBigInt64BE=Bt(function(u,c=0){return j(this,u,c,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function F(m,u,c,T,I,U){if(c+T>m.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("Index out of range")}function de(m,u,c,T,I){return u=+u,c=c>>>0,I||F(m,u,c,4),e.write(m,u,c,T,23,4),c+4}i.prototype.writeFloatLE=function(u,c,T){return de(this,u,c,!0,T)},i.prototype.writeFloatBE=function(u,c,T){return de(this,u,c,!1,T)};function Te(m,u,c,T,I){return u=+u,c=c>>>0,I||F(m,u,c,8),e.write(m,u,c,T,52,8),c+8}i.prototype.writeDoubleLE=function(u,c,T){return Te(this,u,c,!0,T)},i.prototype.writeDoubleBE=function(u,c,T){return Te(this,u,c,!1,T)},i.prototype.copy=function(u,c,T,I){if(!i.isBuffer(u))throw new TypeError("argument should be a Buffer");if(T||(T=0),!I&&I!==0&&(I=this.length),c>=u.length&&(c=u.length),c||(c=0),I>0&&I<T&&(I=T),I===T||u.length===0||this.length===0)return 0;if(c<0)throw new RangeError("targetStart out of bounds");if(T<0||T>=this.length)throw new RangeError("Index out of range");if(I<0)throw new RangeError("sourceEnd out of bounds");I>this.length&&(I=this.length),u.length-c<I-T&&(I=u.length-c+T);let U=I-T;return this===u&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(c,T,I):Uint8Array.prototype.set.call(u,this.subarray(T,I),c),U},i.prototype.fill=function(u,c,T,I){if(typeof u=="string"){if(typeof c=="string"?(I=c,c=0,T=this.length):typeof T=="string"&&(I=T,T=this.length),I!==void 0&&typeof I!="string")throw new TypeError("encoding must be a string");if(typeof I=="string"&&!i.isEncoding(I))throw new TypeError("Unknown encoding: "+I);if(u.length===1){let W=u.charCodeAt(0);(I==="utf8"&&W<128||I==="latin1")&&(u=W)}}else typeof u=="number"?u=u&255:typeof u=="boolean"&&(u=Number(u));if(c<0||this.length<c||this.length<T)throw new RangeError("Out of range index");if(T<=c)return this;c=c>>>0,T=T===void 0?this.length:T>>>0,u||(u=0);let U;if(typeof u=="number")for(U=c;U<T;++U)this[U]=u;else{let W=i.isBuffer(u)?u:i.from(u,I),Be=W.length;if(Be===0)throw new TypeError('The value "'+u+'" is invalid for argument "value"');for(U=0;U<T-c;++U)this[U+c]=W[U%Be]}return this};let A={};function k(m,u,c){A[m]=class extends c{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(I){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:I,writable:!0})}toString(){return`${this.name} [${m}]: ${this.message}`}}}k("ERR_BUFFER_OUT_OF_BOUNDS",function(m){return m?`${m} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),k("ERR_INVALID_ARG_TYPE",function(m,u){return`The "${m}" argument must be of type number. Received type ${typeof u}`},TypeError),k("ERR_OUT_OF_RANGE",function(m,u,c){let T=`The value of "${m}" is out of range.`,I=c;return Number.isInteger(c)&&Math.abs(c)>2**32?I=$(String(c)):typeof c=="bigint"&&(I=String(c),(c>BigInt(2)**BigInt(32)||c<-(BigInt(2)**BigInt(32)))&&(I=$(I)),I+="n"),T+=` It must be ${u}. Received ${I}`,T},RangeError);function $(m){let u="",c=m.length,T=m[0]==="-"?1:0;for(;c>=T+4;c-=3)u=`_${m.slice(c-3,c)}${u}`;return`${m.slice(0,c)}${u}`}function X(m,u,c){b(u,"offset"),(m[u]===void 0||m[u+c]===void 0)&&x(u,m.length-(c+1))}function ie(m,u,c,T,I,U){if(m>c||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 A.ERR_OUT_OF_RANGE("value",Be,m)}X(T,I,U)}function b(m,u){if(typeof m!="number")throw new A.ERR_INVALID_ARG_TYPE(u,"number",m)}function x(m,u,c){throw Math.floor(m)!==m?(b(m,c),new A.ERR_OUT_OF_RANGE("offset","an integer",m)):u<0?new A.ERR_BUFFER_OUT_OF_BOUNDS:new A.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 c,T=m.length,I=null,U=[];for(let W=0;W<T;++W){if(c=m.charCodeAt(W),c>55295&&c<57344){if(!I){if(c>56319){(u-=3)>-1&&U.push(239,191,189);continue}else if(W+1===T){(u-=3)>-1&&U.push(239,191,189);continue}I=c;continue}if(c<56320){(u-=3)>-1&&U.push(239,191,189),I=c;continue}c=(I-55296<<10|c-56320)+65536}else I&&(u-=3)>-1&&U.push(239,191,189);if(I=null,c<128){if((u-=1)<0)break;U.push(c)}else if(c<2048){if((u-=2)<0)break;U.push(c>>6|192,c&63|128)}else if(c<65536){if((u-=3)<0)break;U.push(c>>12|224,c>>6&63|128,c&63|128)}else if(c<1114112){if((u-=4)<0)break;U.push(c>>18|240,c>>12&63|128,c>>6&63|128,c&63|128)}else throw new Error("Invalid code point")}return U}function _e(m){let u=[];for(let c=0;c<m.length;++c)u.push(m.charCodeAt(c)&255);return u}function Z(m,u){let c,T,I,U=[];for(let W=0;W<m.length&&!((u-=2)<0);++W)c=m.charCodeAt(W),T=c>>8,I=c%256,U.push(I),U.push(T);return U}function kt(m){return t.toByteArray(Q(m))}function Ot(m,u,c,T){let I;for(I=0;I<T&&!(I+c>=u.length||I>=m.length);++I)u[I+c]=m[I];return I}function wt(m,u){return m instanceof u||m!=null&&m.constructor!=null&&m.constructor.name!=null&&m.constructor.name===u.name}function Tr(m){return m!==m}let li=function(){let m="0123456789abcdef",u=new Array(256);for(let c=0;c<16;++c){let T=c*16;for(let I=0;I<16;++I)u[T+I]=m[c]+m[I]}return u}();function Bt(m){return typeof BigInt>"u"?_r:m}function _r(){throw new Error("BigInt not supported")}return mn}var br,cc,di,fc,mn,dc,pi=ot(()=>{C();R();O();br={},cc=!1;di={},fc=!1;mn={},dc=!1});var hn,q,cA,fA,pc=ot(()=>{C();R();O();pi();hn=Rt();hn.Buffer;hn.SlowBuffer;hn.INSPECT_MAX_BYTES;hn.kMaxLength;q=hn.Buffer,cA=hn.INSPECT_MAX_BYTES,fA=hn.kMaxLength});var R=ot(()=>{pc()});function Mt(){return Hy||(Hy=!0,typeof Object.create=="function"?Ba=function(e,n){n&&(e.super_=n,e.prototype=Object.create(n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Ba=function(e,n){if(n){e.super_=n;var r=function(){};r.prototype=n.prototype,e.prototype=new r,e.prototype.constructor=e}}),Ba}var Ba,Hy,is=ot(()=>{C();R();O();Ba={},Hy=!1});function Ne(){Ne.init.call(this)}function Ea(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function qy(t){return t._maxListeners===void 0?Ne.defaultMaxListeners:t._maxListeners}function jy(t,e,n,r){var a,o,i,s;if(Ea(n),(o=t._events)===void 0?(o=t._events=Object.create(null),t._eventsCount=0):(o.newListener!==void 0&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),i=o[e]),i===void 0)i=o[e]=n,++t._eventsCount;else if(typeof i=="function"?i=o[e]=r?[n,i]:[i,n]:r?i.unshift(n):i.push(n),(a=qy(t))>0&&i.length>a&&!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,s=l,console&&console.warn&&console.warn(s)}return t}function NB(){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 Ky(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},a=NB.bind(r);return a.listener=n,r.wrapFn=a,a}function Ly(t,e,n){var r=t._events;if(r===void 0)return[];var a=r[e];return a===void 0?[]:typeof a=="function"?n?[a.listener||a]:[a]:n?function(o){for(var i=new Array(o.length),s=0;s<i.length;++s)i[s]=o[s].listener||o[s];return i}(a):Gy(a,a.length)}function Fy(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 Gy(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}var Wy,zy,sr,Uy,Zy,$y,Tt,as=ot(()=>{C();R();O();sr=typeof Reflect=="object"?Reflect:null,Uy=sr&&typeof sr.apply=="function"?sr.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};zy=sr&&typeof sr.ownKeys=="function"?sr.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};Zy=Number.isNaN||function(t){return t!=t};Wy=Ne,Ne.EventEmitter=Ne,Ne.prototype._events=void 0,Ne.prototype._eventsCount=0,Ne.prototype._maxListeners=void 0;$y=10;Object.defineProperty(Ne,"defaultMaxListeners",{enumerable:!0,get:function(){return $y},set:function(t){if(typeof t!="number"||t<0||Zy(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");$y=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||Zy(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 qy(this)},Ne.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var r=t==="error",a=this._events;if(a!==void 0)r=r&&a.error===void 0;else if(!r)return!1;if(r){var o;if(e.length>0&&(o=e[0]),o instanceof Error)throw o;var i=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw i.context=o,i}var s=a[t];if(s===void 0)return!1;if(typeof s=="function")Uy(s,this,e);else{var l=s.length,f=Gy(s,l);for(n=0;n<l;++n)Uy(f[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 Ea(e),this.on(t,Ky(this,t,e)),this},Ne.prototype.prependOnceListener=function(t,e){return Ea(e),this.prependListener(t,Ky(this,t,e)),this},Ne.prototype.removeListener=function(t,e){var n,r,a,o,i;if(Ea(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(a=-1,o=n.length-1;o>=0;o--)if(n[o]===e||n[o].listener===e){i=n[o].listener,a=o;break}if(a<0)return this;a===0?n.shift():function(s,l){for(;l+1<s.length;l++)s[l]=s[l+1];s.pop()}(n,a),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 a,o=Object.keys(n);for(r=0;r<o.length;++r)(a=o[r])!=="removeListener"&&this.removeAllListeners(a);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 Ly(this,t,!0)},Ne.prototype.rawListeners=function(t){return Ly(this,t,!1)},Ne.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Fy.call(t,e)},Ne.prototype.listenerCount=Fy,Ne.prototype.eventNames=function(){return this._eventsCount>0?zy(this._events):[]};Tt=Wy;Tt.EventEmitter;Tt.defaultMaxListeners;Tt.init;Tt.listenerCount;Tt.EventEmitter;Tt.defaultMaxListeners;Tt.init;Tt.listenerCount});var Vy=ot(()=>{C();R();O();as();Tt.once=function(t,e){return new Promise((n,r)=>{function a(...i){o!==void 0&&t.removeListener("error",o),n(i)}let o;e!=="error"&&(o=i=>{t.removeListener(name,a),r(i)},t.once("error",o)),t.once(e,a)})};Tt.on=function(t,e){let n=[],r=[],a=null,o=!1,i={async next(){let f=n.shift();if(f)return createIterResult(f,!1);if(a){let p=Promise.reject(a);return a=null,p}return o?createIterResult(void 0,!0):new Promise((p,y)=>r.push({resolve:p,reject:y}))},async return(){t.removeListener(e,s),t.removeListener("error",l),o=!0;for(let f of r)f.resolve(createIterResult(void 0,!0));return createIterResult(void 0,!0)},throw(f){a=f,t.removeListener(e,s),t.removeListener("error",l)},[Symbol.asyncIterator](){return this}};return t.on(e,s),t.on("error",l),i;function s(...f){let p=r.shift();p?p.resolve(createIterResult(f,!1)):n.push(f)}function l(f){o=!0;let p=r.shift();p?p.reject(f):a=f,i.return()}}});function cs(){throw new Error("setTimeout has not been defined")}function fs(){throw new Error("clearTimeout has not been defined")}function um(t){if(qt===setTimeout)return setTimeout(t,0);if((qt===cs||!qt)&&setTimeout)return qt=setTimeout,setTimeout(t,0);try{return qt(t,0)}catch{try{return qt.call(null,t,0)}catch{return qt.call(this||ur,t,0)}}}function DB(){lr&&Nn&&(lr=!1,Nn.length?Vt=Nn.concat(Vt):Oa=-1,Vt.length&&cm())}function cm(){if(!lr){var t=um(DB);lr=!0;for(var e=Vt.length;e;){for(Nn=Vt,Vt=[];++Oa<e;)Nn&&Nn[Oa].run();Oa=-1,e=Vt.length}Nn=null,lr=!1,function(n){if(Gt===clearTimeout)return clearTimeout(n);if((Gt===fs||!Gt)&&clearTimeout)return Gt=clearTimeout,clearTimeout(n);try{Gt(n)}catch{try{return Gt.call(null,n)}catch{return Gt.call(this||ur,n)}}}(t)}}function Jy(t,e){(this||ur).fun=t,(this||ur).array=e}function zt(){}function Hn(t){return t.call.bind(t)}function Qr(t,e){if(typeof t!="object")return!1;try{return e(t),!0}catch{return!1}}function Yy(t){return _t&&xt?Et(t)!==void 0:mm(t)||hm(t)||vm(t)||Tm(t)||_m(t)||bm(t)||wm(t)||xm(t)||Pm(t)||Bm(t)||Em(t)}function mm(t){return _t&&xt?Et(t)==="Uint8Array":We(t)==="[object Uint8Array]"||zB(t)&&t.buffer!==void 0}function hm(t){return _t&&xt?Et(t)==="Uint8ClampedArray":We(t)==="[object Uint8ClampedArray]"}function vm(t){return _t&&xt?Et(t)==="Uint16Array":We(t)==="[object Uint16Array]"}function Tm(t){return _t&&xt?Et(t)==="Uint32Array":We(t)==="[object Uint32Array]"}function _m(t){return _t&&xt?Et(t)==="Int8Array":We(t)==="[object Int8Array]"}function bm(t){return _t&&xt?Et(t)==="Int16Array":We(t)==="[object Int16Array]"}function wm(t){return _t&&xt?Et(t)==="Int32Array":We(t)==="[object Int32Array]"}function xm(t){return _t&&xt?Et(t)==="Float32Array":We(t)==="[object Float32Array]"}function Pm(t){return _t&&xt?Et(t)==="Float64Array":We(t)==="[object Float64Array]"}function Bm(t){return _t&&xt?Et(t)==="BigInt64Array":We(t)==="[object BigInt64Array]"}function Em(t){return _t&&xt?Et(t)==="BigUint64Array":We(t)==="[object BigUint64Array]"}function Sa(t){return We(t)==="[object Map]"}function ka(t){return We(t)==="[object Set]"}function Ia(t){return We(t)==="[object WeakMap]"}function os(t){return We(t)==="[object WeakSet]"}function Ma(t){return We(t)==="[object ArrayBuffer]"}function Qy(t){return typeof ArrayBuffer<"u"&&(Ma.working?Ma(t):t instanceof ArrayBuffer)}function Na(t){return We(t)==="[object DataView]"}function em(t){return typeof DataView<"u"&&(Na.working?Na(t):t instanceof DataView)}function Da(t){return We(t)==="[object SharedArrayBuffer]"}function tm(t){return typeof SharedArrayBuffer<"u"&&(Da.working?Da(t):t instanceof SharedArrayBuffer)}function nm(t){return Qr(t,XB)}function rm(t){return Qr(t,YB)}function im(t){return Qr(t,QB)}function am(t){return ym&&Qr(t,eE)}function om(t){return ps&&Qr(t,tE)}function ln(t,e){var n={seen:[],stylize:iE};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),gs(e)?n.showHidden=e:e&&L._extend(n,e),Dn(n.showHidden)&&(n.showHidden=!1),Dn(n.depth)&&(n.depth=2),Dn(n.colors)&&(n.colors=!1),Dn(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=rE),Ha(n,t,n.depth)}function rE(t,e){var n=ln.styles[e];return n?"\x1B["+ln.colors[n][0]+"m"+t+"\x1B["+ln.colors[n][1]+"m":t}function iE(t,e){return t}function Ha(t,e,n){if(t.customInspect&&e&&Ra(e.inspect)&&e.inspect!==L.inspect&&(!e.constructor||e.constructor.prototype!==e)){var r=e.inspect(n,t);return Ua(r)||(r=Ha(t,r,n)),r}var a=function(g,h){if(Dn(h))return g.stylize("undefined","undefined");if(Ua(h)){var w="'"+JSON.stringify(h).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return g.stylize(w,"string")}if(Im(h))return g.stylize(""+h,"number");if(gs(h))return g.stylize(""+h,"boolean");if(ja(h))return g.stylize("null","null")}(t,e);if(a)return a;var o=Object.keys(e),i=function(g){var h={};return g.forEach(function(w,P){h[w]=!0}),h}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),Yr(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return ss(e);if(o.length===0){if(Ra(e)){var s=e.name?": "+e.name:"";return t.stylize("[Function"+s+"]","special")}if(Xr(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(Za(e))return t.stylize(Date.prototype.toString.call(e),"date");if(Yr(e))return ss(e)}var l,f="",p=!1,y=["{","}"];return km(e)&&(p=!0,y=["[","]"]),Ra(e)&&(f=" [Function"+(e.name?": "+e.name:"")+"]"),Xr(e)&&(f=" "+RegExp.prototype.toString.call(e)),Za(e)&&(f=" "+Date.prototype.toUTCString.call(e)),Yr(e)&&(f=" "+ss(e)),o.length!==0||p&&e.length!=0?n<0?Xr(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),l=p?function(g,h,w,P,B){for(var v=[],S=0,E=h.length;S<E;++S)Am(h,String(S))?v.push(ls(g,h,w,P,String(S),!0)):v.push("");return B.forEach(function(H){H.match(/^\d+$/)||v.push(ls(g,h,w,P,H,!0))}),v}(t,e,n,i,o):o.map(function(g){return ls(t,e,n,i,g,p)}),t.seen.pop(),function(g,h,w){var P=0;return g.reduce(function(B,v){return P++,v.indexOf(`
2
- `)>=0&&P++,B+v.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?w[0]+(h===""?"":h+`
1
+ var Qo=Object.defineProperty;var Dv=Object.getOwnPropertyDescriptor;var Hv=Object.getOwnPropertyNames;var Uv=Object.prototype.hasOwnProperty;var at=(t,e)=>()=>(t&&(e=t(t=0)),e);var Kn=(t,e)=>{for(var n in e)Qo(t,n,{get:e[n],enumerable:!0})},Zv=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Hv(e))!Uv.call(t,o)&&o!==n&&Qo(t,o,{get:()=>e[o],enumerable:!(r=Dv(e,o))||r.enumerable});return t};var $v=t=>Zv(Qo({},"__esModule",{value:!0}),t);var C=at(()=>{});var J={};Kn(J,{_debugEnd:()=>Nu,_debugProcess:()=>Mu,_events:()=>Xu,_eventsCount:()=>Yu,_exiting:()=>yu,_fatalExceptions:()=>Au,_getActiveHandles:()=>Tu,_getActiveRequests:()=>vu,_kill:()=>bu,_linkedBinding:()=>pu,_maxListeners:()=>Ju,_preload_modules:()=>qu,_rawDebug:()=>fu,_startProfilerIdleNotifier:()=>Du,_stopProfilerIdleNotifier:()=>Hu,_tickCallback:()=>Ru,abort:()=>ju,addListener:()=>Qu,allowedNodeEnvironmentFlags:()=>Su,arch:()=>Xl,argv:()=>eu,argv0:()=>zu,assert:()=>ku,binding:()=>ou,browser:()=>cu,chdir:()=>lu,config:()=>mu,cpuUsage:()=>ci,cwd:()=>su,debugPort:()=>Wu,default:()=>lc,dlopen:()=>hu,domain:()=>gu,emit:()=>ic,emitWarning:()=>iu,env:()=>Ql,execArgv:()=>tu,execPath:()=>Fu,exit:()=>Bu,features:()=>Iu,hasUncaughtExceptionCaptureCallback:()=>Ou,hrtime:()=>ui,kill:()=>Pu,listeners:()=>sc,memoryUsage:()=>xu,moduleLoadList:()=>du,nextTick:()=>Gl,off:()=>tc,on:()=>Zt,once:()=>ec,openStdin:()=>Eu,pid:()=>Ku,platform:()=>Yl,ppid:()=>Lu,prependListener:()=>oc,prependOnceListener:()=>ac,reallyExit:()=>_u,release:()=>uu,removeAllListeners:()=>rc,removeListener:()=>nc,resourceUsage:()=>wu,setSourceMapsEnabled:()=>Gu,setUncaughtExceptionCaptureCallback:()=>Cu,stderr:()=>Zu,stdin:()=>$u,stdout:()=>Uu,title:()=>Jl,umask:()=>au,uptime:()=>Vu,version:()=>nu,versions:()=>ru});function na(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function jv(){!Ln||!yn||(Ln=!1,yn.length?Ut=yn.concat(Ut):li=-1,Ut.length&&ql())}function ql(){if(!Ln){var t=setTimeout(jv,0);Ln=!0;for(var e=Ut.length;e;){for(yn=Ut,Ut=[];++li<e;)yn&&yn[li].run();li=-1,e=Ut.length}yn=null,Ln=!1,clearTimeout(t)}}function Gl(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];Ut.push(new Vl(t,e)),Ut.length===1&&!Ln&&setTimeout(ql,0)}function Vl(t,e){this.fun=t,this.array=e}function lt(){}function pu(t){na("_linkedBinding")}function hu(t){na("dlopen")}function vu(){return[]}function Tu(){return[]}function ku(t,e){if(!t)throw new Error(e||"assertion error")}function Ou(){return!1}function Vu(){return tn.now()/1e3}function ui(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+=ta)),[r,o]}function Zt(){return lc}function sc(t){return[]}var Ut,Ln,yn,li,Jl,Xl,Yl,Ql,eu,tu,nu,ru,iu,ou,au,su,lu,uu,cu,fu,du,gu,yu,mu,_u,bu,ci,wu,xu,Pu,Bu,Eu,Su,Iu,Au,Cu,Ru,Mu,Nu,Du,Hu,Uu,Zu,$u,ju,Ku,Lu,Fu,Wu,zu,qu,Gu,tn,ea,ta,Ju,Xu,Yu,Qu,ec,tc,nc,rc,ic,oc,ac,lc,uc=at(()=>{C();R();O();Ut=[],Ln=!1,li=-1;Vl.prototype.run=function(){this.fun.apply(null,this.array)};Jl="browser",Xl="x64",Yl="browser",Ql={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},eu=["/usr/bin/node"],tu=[],nu="v16.8.0",ru={},iu=function(t,e){console.warn((e?e+": ":"")+t)},ou=function(t){na("binding")},au=function(t){return 0},su=function(){return"/"},lu=function(t){},uu={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};cu=!0,fu=lt,du=[];gu={},yu=!1,mu={};_u=lt,bu=lt,ci=function(){return{}},wu=ci,xu=ci,Pu=lt,Bu=lt,Eu=lt,Su={};Iu={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Au=lt,Cu=lt;Ru=lt,Mu=lt,Nu=lt,Du=lt,Hu=lt,Uu=void 0,Zu=void 0,$u=void 0,ju=lt,Ku=2,Lu=1,Fu="/bin/usr/node",Wu=9229,zu="node",qu=[],Gu=lt,tn={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};tn.now===void 0&&(ea=Date.now(),tn.timing&&tn.timing.navigationStart&&(ea=tn.timing.navigationStart),tn.now=()=>Date.now()-ea);ta=1e9;ui.bigint=function(t){var e=ui(t);return typeof BigInt>"u"?e[0]*ta+e[1]:BigInt(e[0]*ta)+BigInt(e[1])};Ju=10,Xu={},Yu=0;Qu=Zt,ec=Zt,tc=Zt,nc=Zt,rc=Zt,ic=lt,oc=Zt,ac=Zt;lc={version:nu,versions:ru,arch:Xl,platform:Yl,browser:cu,release:uu,_rawDebug:fu,moduleLoadList:du,binding:ou,_linkedBinding:pu,_events:Xu,_eventsCount:Yu,_maxListeners:Ju,on:Zt,addListener:Qu,once:ec,off:tc,removeListener:nc,removeAllListeners:rc,emit:ic,prependListener:oc,prependOnceListener:ac,listeners:sc,domain:gu,_exiting:yu,config:mu,dlopen:hu,uptime:Vu,_getActiveRequests:vu,_getActiveHandles:Tu,reallyExit:_u,_kill:bu,cpuUsage:ci,resourceUsage:wu,memoryUsage:xu,kill:Pu,exit:Bu,openStdin:Eu,allowedNodeEnvironmentFlags:Su,assert:ku,features:Iu,_fatalExceptions:Au,setUncaughtExceptionCaptureCallback:Cu,hasUncaughtExceptionCaptureCallback:Ou,emitWarning:iu,nextTick:Gl,_tickCallback:Ru,_debugProcess:Mu,_debugEnd:Nu,_startProfilerIdleNotifier:Du,_stopProfilerIdleNotifier:Hu,stdout:Uu,stdin:$u,stderr:Zu,abort:ju,umask:au,chdir:lu,cwd:su,env:Ql,title:Jl,argv:eu,execArgv:tu,pid:Ku,ppid:Lu,execPath:Fu,debugPort:Wu,hrtime:ui,argv0:zu,_preload_modules:qu,setSourceMapsEnabled:Gu}});var O=at(()=>{uc()});function Kv(){if(cc)return vr;cc=!0,vr.byteLength=s,vr.toByteArray=f,vr.fromByteArray=g;for(var t=[],e=[],n=typeof Uint8Array<"u"?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,a=r.length;o<a;++o)t[o]=r[o],e[r.charCodeAt(o)]=o;e[45]=62,e[95]=63;function i(h){var w=h.length;if(w%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var P=h.indexOf("=");P===-1&&(P=w);var B=P===w?0:4-P%4;return[P,B]}function s(h){var w=i(h),P=w[0],B=w[1];return(P+B)*3/4-B}function l(h,w,P){return(w+P)*3/4-P}function f(h){var w,P=i(h),B=P[0],v=P[1],S=new n(l(h,B,v)),E=0,H=v>0?B-4:B,K;for(K=0;K<H;K+=4)w=e[h.charCodeAt(K)]<<18|e[h.charCodeAt(K+1)]<<12|e[h.charCodeAt(K+2)]<<6|e[h.charCodeAt(K+3)],S[E++]=w>>16&255,S[E++]=w>>8&255,S[E++]=w&255;return v===2&&(w=e[h.charCodeAt(K)]<<2|e[h.charCodeAt(K+1)]>>4,S[E++]=w&255),v===1&&(w=e[h.charCodeAt(K)]<<10|e[h.charCodeAt(K+1)]<<4|e[h.charCodeAt(K+2)]>>2,S[E++]=w>>8&255,S[E++]=w&255),S}function p(h){return t[h>>18&63]+t[h>>12&63]+t[h>>6&63]+t[h&63]}function y(h,w,P){for(var B,v=[],S=w;S<P;S+=3)B=(h[S]<<16&16711680)+(h[S+1]<<8&65280)+(h[S+2]&255),v.push(p(B));return v.join("")}function g(h){for(var w,P=h.length,B=P%3,v=[],S=16383,E=0,H=P-B;E<H;E+=S)v.push(y(h,E,E+S>H?H:E+S));return B===1?(w=h[P-1],v.push(t[w>>2]+t[w<<4&63]+"==")):B===2&&(w=(h[P-2]<<8)+h[P-1],v.push(t[w>>10]+t[w>>4&63]+t[w<<2&63]+"=")),v.join("")}return vr}function Lv(){if(fc)return fi;fc=!0;return fi.read=function(t,e,n,r,o){var a,i,s=o*8-r-1,l=(1<<s)-1,f=l>>1,p=-7,y=n?o-1:0,g=n?-1:1,h=t[e+y];for(y+=g,a=h&(1<<-p)-1,h>>=-p,p+=s;p>0;a=a*256+t[e+y],y+=g,p-=8);for(i=a&(1<<-p)-1,a>>=-p,p+=r;p>0;i=i*256+t[e+y],y+=g,p-=8);if(a===0)a=1-f;else{if(a===l)return i?NaN:(h?-1:1)*(1/0);i=i+Math.pow(2,r),a=a-f}return(h?-1:1)*i*Math.pow(2,a-r)},fi.write=function(t,e,n,r,o,a){var i,s,l,f=a*8-o-1,p=(1<<f)-1,y=p>>1,g=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:a-1,w=r?1:-1,P=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=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?(s=0,i=p):i+y>=1?(s=(e*l-1)*Math.pow(2,o),i=i+y):(s=e*Math.pow(2,y-1)*Math.pow(2,o),i=0));o>=8;t[n+h]=s&255,h+=w,s/=256,o-=8);for(i=i<<o|s,f+=o;f>0;t[n+h]=i&255,h+=w,i/=256,f-=8);t[n+h-w]|=P*128},fi}function Rt(){if(dc)return mn;dc=!0;let t=Kv(),e=Lv(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;mn.Buffer=i,mn.SlowBuffer=v,mn.INSPECT_MAX_BYTES=50;let r=2147483647;mn.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 a(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,c){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 s(m,u,c)}i.poolSize=8192;function s(m,u,c){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(wt(m,ArrayBuffer)||m&&wt(m.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(wt(m,SharedArrayBuffer)||m&&wt(m.buffer,SharedArrayBuffer)))return w(m,u,c);if(typeof m=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let T=m.valueOf&&m.valueOf();if(T!=null&&T!==m)return i.from(T,u,c);let I=P(m);if(I)return I;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof m[Symbol.toPrimitive]=="function")return i.from(m[Symbol.toPrimitive]("string"),u,c);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,c){return s(m,u,c)},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 f(m,u,c){return l(m),m<=0?a(m):u!==void 0?typeof c=="string"?a(m).fill(u,c):a(m).fill(u):a(m)}i.alloc=function(m,u,c){return f(m,u,c)};function p(m){return l(m),a(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 c=S(m,u)|0,T=a(c),I=T.write(m,u);return I!==c&&(T=T.slice(0,I)),T}function g(m){let u=m.length<0?0:B(m.length)|0,c=a(u);for(let T=0;T<u;T+=1)c[T]=m[T]&255;return c}function h(m){if(wt(m,Uint8Array)){let u=new Uint8Array(m);return w(u.buffer,u.byteOffset,u.byteLength)}return g(m)}function w(m,u,c){if(u<0||m.byteLength<u)throw new RangeError('"offset" is outside of buffer bounds');if(m.byteLength<u+(c||0))throw new RangeError('"length" is outside of buffer bounds');let T;return u===void 0&&c===void 0?T=new Uint8Array(m):c===void 0?T=new Uint8Array(m,u):T=new Uint8Array(m,u,c),Object.setPrototypeOf(T,i.prototype),T}function P(m){if(i.isBuffer(m)){let u=B(m.length)|0,c=a(u);return c.length===0||m.copy(c,0,0,u),c}if(m.length!==void 0)return typeof m.length!="number"||mr(m.length)?a(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 v(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,c){if(wt(u,Uint8Array)&&(u=i.from(u,u.offset,u.byteLength)),wt(c,Uint8Array)&&(c=i.from(c,c.offset,c.byteLength)),!i.isBuffer(u)||!i.isBuffer(c))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(u===c)return 0;let T=u.length,I=c.length;for(let U=0,W=Math.min(T,I);U<W;++U)if(u[U]!==c[U]){T=u[U],I=c[U];break}return T<I?-1:I<T?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,c){if(!Array.isArray(u))throw new TypeError('"list" argument must be an Array of Buffers');if(u.length===0)return i.alloc(0);let T;if(c===void 0)for(c=0,T=0;T<u.length;++T)c+=u[T].length;let I=i.allocUnsafe(c),U=0;for(T=0;T<u.length;++T){let W=u[T];if(wt(W,Uint8Array))U+W.length>I.length?(i.isBuffer(W)||(W=i.from(W)),W.copy(I,U)):Uint8Array.prototype.set.call(I,W,U);else if(i.isBuffer(W))W.copy(I,U);else throw new TypeError('"list" argument must be an Array of Buffers');U+=W.length}return I};function S(m,u){if(i.isBuffer(m))return m.length;if(ArrayBuffer.isView(m)||wt(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 c=m.length,T=arguments.length>2&&arguments[2]===!0;if(!T&&c===0)return 0;let I=!1;for(;;)switch(u){case"ascii":case"latin1":case"binary":return c;case"utf8":case"utf-8":return Me(m).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c*2;case"hex":return c>>>1;case"base64":return kt(m).length;default:if(I)return T?-1:Me(m).length;u=(""+u).toLowerCase(),I=!0}}i.byteLength=S;function E(m,u,c){let T=!1;if((u===void 0||u<0)&&(u=0),u>this.length||((c===void 0||c>this.length)&&(c=this.length),c<=0)||(c>>>=0,u>>>=0,c<=u))return"";for(m||(m="utf8");;)switch(m){case"hex":return Pe(this,u,c);case"utf8":case"utf-8":return tt(this,u,c);case"ascii":return mt(this,u,c);case"latin1":case"binary":return Ue(this,u,c);case"base64":return ze(this,u,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Se(this,u,c);default:if(T)throw new TypeError("Unknown encoding: "+m);m=(m+"").toLowerCase(),T=!0}}i.prototype._isBuffer=!0;function H(m,u,c){let T=m[u];m[u]=m[c],m[c]=T}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 c=0;c<u;c+=2)H(this,c,c+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 c=0;c<u;c+=4)H(this,c,c+3),H(this,c+1,c+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 c=0;c<u;c+=8)H(this,c,c+7),H(this,c+1,c+6),H(this,c+2,c+5),H(this,c+3,c+4);return this},i.prototype.toString=function(){let u=this.length;return u===0?"":arguments.length===0?tt(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="",c=mn.INSPECT_MAX_BYTES;return u=this.toString("hex",0,c).replace(/(.{2})/g,"$1 ").trim(),this.length>c&&(u+=" ... "),"<Buffer "+u+">"},n&&(i.prototype[n]=i.prototype.inspect),i.prototype.compare=function(u,c,T,I,U){if(wt(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(c===void 0&&(c=0),T===void 0&&(T=u?u.length:0),I===void 0&&(I=0),U===void 0&&(U=this.length),c<0||T>u.length||I<0||U>this.length)throw new RangeError("out of range index");if(I>=U&&c>=T)return 0;if(I>=U)return-1;if(c>=T)return 1;if(c>>>=0,T>>>=0,I>>>=0,U>>>=0,this===u)return 0;let W=U-I,Be=T-c,qe=Math.min(W,Be),$e=this.slice(I,U),Ge=u.slice(c,T);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 K(m,u,c,T,I){if(m.length===0)return-1;if(typeof c=="string"?(T=c,c=0):c>2147483647?c=2147483647:c<-2147483648&&(c=-2147483648),c=+c,mr(c)&&(c=I?0:m.length-1),c<0&&(c=m.length+c),c>=m.length){if(I)return-1;c=m.length-1}else if(c<0)if(I)c=0;else return-1;if(typeof u=="string"&&(u=i.from(u,T)),i.isBuffer(u))return u.length===0?-1:oe(m,u,c,T,I);if(typeof u=="number")return u=u&255,typeof Uint8Array.prototype.indexOf=="function"?I?Uint8Array.prototype.indexOf.call(m,u,c):Uint8Array.prototype.lastIndexOf.call(m,u,c):oe(m,[u],c,T,I);throw new TypeError("val must be string, number or Buffer")}function oe(m,u,c,T,I){let U=1,W=m.length,Be=u.length;if(T!==void 0&&(T=String(T).toLowerCase(),T==="ucs2"||T==="ucs-2"||T==="utf16le"||T==="utf-16le")){if(m.length<2||u.length<2)return-1;U=2,W/=2,Be/=2,c/=2}function qe(Ge,He){return U===1?Ge[He]:Ge.readUInt16BE(He*U)}let $e;if(I){let Ge=-1;for($e=c;$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(c+Be>W&&(c=W-Be),$e=c;$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,c,T){return this.indexOf(u,c,T)!==-1},i.prototype.indexOf=function(u,c,T){return K(this,u,c,T,!0)},i.prototype.lastIndexOf=function(u,c,T){return K(this,u,c,T,!1)};function ee(m,u,c,T){c=Number(c)||0;let I=m.length-c;T?(T=Number(T),T>I&&(T=I)):T=I;let U=u.length;T>U/2&&(T=U/2);let W;for(W=0;W<T;++W){let Be=parseInt(u.substr(W*2,2),16);if(mr(Be))return W;m[c+W]=Be}return W}function ge(m,u,c,T){return Ot(Me(u,m.length-c),m,c,T)}function ae(m,u,c,T){return Ot(_e(u),m,c,T)}function re(m,u,c,T){return Ot(kt(u),m,c,T)}function Oe(m,u,c,T){return Ot(Z(u,m.length-c),m,c,T)}i.prototype.write=function(u,c,T,I){if(c===void 0)I="utf8",T=this.length,c=0;else if(T===void 0&&typeof c=="string")I=c,T=this.length,c=0;else if(isFinite(c))c=c>>>0,isFinite(T)?(T=T>>>0,I===void 0&&(I="utf8")):(I=T,T=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let U=this.length-c;if((T===void 0||T>U)&&(T=U),u.length>0&&(T<0||c<0)||c>this.length)throw new RangeError("Attempt to write outside buffer bounds");I||(I="utf8");let W=!1;for(;;)switch(I){case"hex":return ee(this,u,c,T);case"utf8":case"utf-8":return ge(this,u,c,T);case"ascii":case"latin1":case"binary":return ae(this,u,c,T);case"base64":return re(this,u,c,T);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Oe(this,u,c,T);default:if(W)throw new TypeError("Unknown encoding: "+I);I=(""+I).toLowerCase(),W=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ze(m,u,c){return u===0&&c===m.length?t.fromByteArray(m):t.fromByteArray(m.slice(u,c))}function tt(m,u,c){c=Math.min(m.length,c);let T=[],I=u;for(;I<c;){let U=m[I],W=null,Be=U>239?4:U>223?3:U>191?2:1;if(I+Be<=c){let qe,$e,Ge,He;switch(Be){case 1:U<128&&(W=U);break;case 2:qe=m[I+1],(qe&192)===128&&(He=(U&31)<<6|qe&63,He>127&&(W=He));break;case 3:qe=m[I+1],$e=m[I+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[I+1],$e=m[I+2],Ge=m[I+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,T.push(W>>>10&1023|55296),W=56320|W&1023),T.push(W),I+=Be}return Je(T)}let Ve=4096;function Je(m){let u=m.length;if(u<=Ve)return String.fromCharCode.apply(String,m);let c="",T=0;for(;T<u;)c+=String.fromCharCode.apply(String,m.slice(T,T+=Ve));return c}function mt(m,u,c){let T="";c=Math.min(m.length,c);for(let I=u;I<c;++I)T+=String.fromCharCode(m[I]&127);return T}function Ue(m,u,c){let T="";c=Math.min(m.length,c);for(let I=u;I<c;++I)T+=String.fromCharCode(m[I]);return T}function Pe(m,u,c){let T=m.length;(!u||u<0)&&(u=0),(!c||c<0||c>T)&&(c=T);let I="";for(let U=u;U<c;++U)I+=si[m[U]];return I}function Se(m,u,c){let T=m.slice(u,c),I="";for(let U=0;U<T.length-1;U+=2)I+=String.fromCharCode(T[U]+T[U+1]*256);return I}i.prototype.slice=function(u,c){let T=this.length;u=~~u,c=c===void 0?T:~~c,u<0?(u+=T,u<0&&(u=0)):u>T&&(u=T),c<0?(c+=T,c<0&&(c=0)):c>T&&(c=T),c<u&&(c=u);let I=this.subarray(u,c);return Object.setPrototypeOf(I,i.prototype),I};function fe(m,u,c){if(m%1!==0||m<0)throw new RangeError("offset is not uint");if(m+u>c)throw new RangeError("Trying to access beyond buffer length")}i.prototype.readUintLE=i.prototype.readUIntLE=function(u,c,T){u=u>>>0,c=c>>>0,T||fe(u,c,this.length);let I=this[u],U=1,W=0;for(;++W<c&&(U*=256);)I+=this[u+W]*U;return I},i.prototype.readUintBE=i.prototype.readUIntBE=function(u,c,T){u=u>>>0,c=c>>>0,T||fe(u,c,this.length);let I=this[u+--c],U=1;for(;c>0&&(U*=256);)I+=this[u+--c]*U;return I},i.prototype.readUint8=i.prototype.readUInt8=function(u,c){return u=u>>>0,c||fe(u,1,this.length),this[u]},i.prototype.readUint16LE=i.prototype.readUInt16LE=function(u,c){return u=u>>>0,c||fe(u,2,this.length),this[u]|this[u+1]<<8},i.prototype.readUint16BE=i.prototype.readUInt16BE=function(u,c){return u=u>>>0,c||fe(u,2,this.length),this[u]<<8|this[u+1]},i.prototype.readUint32LE=i.prototype.readUInt32LE=function(u,c){return u=u>>>0,c||fe(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,c){return u=u>>>0,c||fe(u,4,this.length),this[u]*16777216+(this[u+1]<<16|this[u+2]<<8|this[u+3])},i.prototype.readBigUInt64LE=Bt(function(u){u=u>>>0,b(u,"offset");let c=this[u],T=this[u+7];(c===void 0||T===void 0)&&x(u,this.length-8);let I=c+this[++u]*2**8+this[++u]*2**16+this[++u]*2**24,U=this[++u]+this[++u]*2**8+this[++u]*2**16+T*2**24;return BigInt(I)+(BigInt(U)<<BigInt(32))}),i.prototype.readBigUInt64BE=Bt(function(u){u=u>>>0,b(u,"offset");let c=this[u],T=this[u+7];(c===void 0||T===void 0)&&x(u,this.length-8);let I=c*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+T;return(BigInt(I)<<BigInt(32))+BigInt(U)}),i.prototype.readIntLE=function(u,c,T){u=u>>>0,c=c>>>0,T||fe(u,c,this.length);let I=this[u],U=1,W=0;for(;++W<c&&(U*=256);)I+=this[u+W]*U;return U*=128,I>=U&&(I-=Math.pow(2,8*c)),I},i.prototype.readIntBE=function(u,c,T){u=u>>>0,c=c>>>0,T||fe(u,c,this.length);let I=c,U=1,W=this[u+--I];for(;I>0&&(U*=256);)W+=this[u+--I]*U;return U*=128,W>=U&&(W-=Math.pow(2,8*c)),W},i.prototype.readInt8=function(u,c){return u=u>>>0,c||fe(u,1,this.length),this[u]&128?(255-this[u]+1)*-1:this[u]},i.prototype.readInt16LE=function(u,c){u=u>>>0,c||fe(u,2,this.length);let T=this[u]|this[u+1]<<8;return T&32768?T|4294901760:T},i.prototype.readInt16BE=function(u,c){u=u>>>0,c||fe(u,2,this.length);let T=this[u+1]|this[u]<<8;return T&32768?T|4294901760:T},i.prototype.readInt32LE=function(u,c){return u=u>>>0,c||fe(u,4,this.length),this[u]|this[u+1]<<8|this[u+2]<<16|this[u+3]<<24},i.prototype.readInt32BE=function(u,c){return u=u>>>0,c||fe(u,4,this.length),this[u]<<24|this[u+1]<<16|this[u+2]<<8|this[u+3]},i.prototype.readBigInt64LE=Bt(function(u){u=u>>>0,b(u,"offset");let c=this[u],T=this[u+7];(c===void 0||T===void 0)&&x(u,this.length-8);let I=this[u+4]+this[u+5]*2**8+this[u+6]*2**16+(T<<24);return(BigInt(I)<<BigInt(32))+BigInt(c+this[++u]*2**8+this[++u]*2**16+this[++u]*2**24)}),i.prototype.readBigInt64BE=Bt(function(u){u=u>>>0,b(u,"offset");let c=this[u],T=this[u+7];(c===void 0||T===void 0)&&x(u,this.length-8);let I=(c<<24)+this[++u]*2**16+this[++u]*2**8+this[++u];return(BigInt(I)<<BigInt(32))+BigInt(this[++u]*2**24+this[++u]*2**16+this[++u]*2**8+T)}),i.prototype.readFloatLE=function(u,c){return u=u>>>0,c||fe(u,4,this.length),e.read(this,u,!0,23,4)},i.prototype.readFloatBE=function(u,c){return u=u>>>0,c||fe(u,4,this.length),e.read(this,u,!1,23,4)},i.prototype.readDoubleLE=function(u,c){return u=u>>>0,c||fe(u,8,this.length),e.read(this,u,!0,52,8)},i.prototype.readDoubleBE=function(u,c){return u=u>>>0,c||fe(u,8,this.length),e.read(this,u,!1,52,8)};function ve(m,u,c,T,I,U){if(!i.isBuffer(m))throw new TypeError('"buffer" argument must be a Buffer instance');if(u>I||u<U)throw new RangeError('"value" argument is out of bounds');if(c+T>m.length)throw new RangeError("Index out of range")}i.prototype.writeUintLE=i.prototype.writeUIntLE=function(u,c,T,I){if(u=+u,c=c>>>0,T=T>>>0,!I){let Be=Math.pow(2,8*T)-1;ve(this,u,c,T,Be,0)}let U=1,W=0;for(this[c]=u&255;++W<T&&(U*=256);)this[c+W]=u/U&255;return c+T},i.prototype.writeUintBE=i.prototype.writeUIntBE=function(u,c,T,I){if(u=+u,c=c>>>0,T=T>>>0,!I){let Be=Math.pow(2,8*T)-1;ve(this,u,c,T,Be,0)}let U=T-1,W=1;for(this[c+U]=u&255;--U>=0&&(W*=256);)this[c+U]=u/W&255;return c+T},i.prototype.writeUint8=i.prototype.writeUInt8=function(u,c,T){return u=+u,c=c>>>0,T||ve(this,u,c,1,255,0),this[c]=u&255,c+1},i.prototype.writeUint16LE=i.prototype.writeUInt16LE=function(u,c,T){return u=+u,c=c>>>0,T||ve(this,u,c,2,65535,0),this[c]=u&255,this[c+1]=u>>>8,c+2},i.prototype.writeUint16BE=i.prototype.writeUInt16BE=function(u,c,T){return u=+u,c=c>>>0,T||ve(this,u,c,2,65535,0),this[c]=u>>>8,this[c+1]=u&255,c+2},i.prototype.writeUint32LE=i.prototype.writeUInt32LE=function(u,c,T){return u=+u,c=c>>>0,T||ve(this,u,c,4,4294967295,0),this[c+3]=u>>>24,this[c+2]=u>>>16,this[c+1]=u>>>8,this[c]=u&255,c+4},i.prototype.writeUint32BE=i.prototype.writeUInt32BE=function(u,c,T){return u=+u,c=c>>>0,T||ve(this,u,c,4,4294967295,0),this[c]=u>>>24,this[c+1]=u>>>16,this[c+2]=u>>>8,this[c+3]=u&255,c+4};function D(m,u,c,T,I){ie(u,T,I,m,c,7);let U=Number(u&BigInt(4294967295));m[c++]=U,U=U>>8,m[c++]=U,U=U>>8,m[c++]=U,U=U>>8,m[c++]=U;let W=Number(u>>BigInt(32)&BigInt(4294967295));return m[c++]=W,W=W>>8,m[c++]=W,W=W>>8,m[c++]=W,W=W>>8,m[c++]=W,c}function j(m,u,c,T,I){ie(u,T,I,m,c,7);let U=Number(u&BigInt(4294967295));m[c+7]=U,U=U>>8,m[c+6]=U,U=U>>8,m[c+5]=U,U=U>>8,m[c+4]=U;let W=Number(u>>BigInt(32)&BigInt(4294967295));return m[c+3]=W,W=W>>8,m[c+2]=W,W=W>>8,m[c+1]=W,W=W>>8,m[c]=W,c+8}i.prototype.writeBigUInt64LE=Bt(function(u,c=0){return D(this,u,c,BigInt(0),BigInt("0xffffffffffffffff"))}),i.prototype.writeBigUInt64BE=Bt(function(u,c=0){return j(this,u,c,BigInt(0),BigInt("0xffffffffffffffff"))}),i.prototype.writeIntLE=function(u,c,T,I){if(u=+u,c=c>>>0,!I){let qe=Math.pow(2,8*T-1);ve(this,u,c,T,qe-1,-qe)}let U=0,W=1,Be=0;for(this[c]=u&255;++U<T&&(W*=256);)u<0&&Be===0&&this[c+U-1]!==0&&(Be=1),this[c+U]=(u/W>>0)-Be&255;return c+T},i.prototype.writeIntBE=function(u,c,T,I){if(u=+u,c=c>>>0,!I){let qe=Math.pow(2,8*T-1);ve(this,u,c,T,qe-1,-qe)}let U=T-1,W=1,Be=0;for(this[c+U]=u&255;--U>=0&&(W*=256);)u<0&&Be===0&&this[c+U+1]!==0&&(Be=1),this[c+U]=(u/W>>0)-Be&255;return c+T},i.prototype.writeInt8=function(u,c,T){return u=+u,c=c>>>0,T||ve(this,u,c,1,127,-128),u<0&&(u=255+u+1),this[c]=u&255,c+1},i.prototype.writeInt16LE=function(u,c,T){return u=+u,c=c>>>0,T||ve(this,u,c,2,32767,-32768),this[c]=u&255,this[c+1]=u>>>8,c+2},i.prototype.writeInt16BE=function(u,c,T){return u=+u,c=c>>>0,T||ve(this,u,c,2,32767,-32768),this[c]=u>>>8,this[c+1]=u&255,c+2},i.prototype.writeInt32LE=function(u,c,T){return u=+u,c=c>>>0,T||ve(this,u,c,4,2147483647,-2147483648),this[c]=u&255,this[c+1]=u>>>8,this[c+2]=u>>>16,this[c+3]=u>>>24,c+4},i.prototype.writeInt32BE=function(u,c,T){return u=+u,c=c>>>0,T||ve(this,u,c,4,2147483647,-2147483648),u<0&&(u=4294967295+u+1),this[c]=u>>>24,this[c+1]=u>>>16,this[c+2]=u>>>8,this[c+3]=u&255,c+4},i.prototype.writeBigInt64LE=Bt(function(u,c=0){return D(this,u,c,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),i.prototype.writeBigInt64BE=Bt(function(u,c=0){return j(this,u,c,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function F(m,u,c,T,I,U){if(c+T>m.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("Index out of range")}function de(m,u,c,T,I){return u=+u,c=c>>>0,I||F(m,u,c,4),e.write(m,u,c,T,23,4),c+4}i.prototype.writeFloatLE=function(u,c,T){return de(this,u,c,!0,T)},i.prototype.writeFloatBE=function(u,c,T){return de(this,u,c,!1,T)};function Te(m,u,c,T,I){return u=+u,c=c>>>0,I||F(m,u,c,8),e.write(m,u,c,T,52,8),c+8}i.prototype.writeDoubleLE=function(u,c,T){return Te(this,u,c,!0,T)},i.prototype.writeDoubleBE=function(u,c,T){return Te(this,u,c,!1,T)},i.prototype.copy=function(u,c,T,I){if(!i.isBuffer(u))throw new TypeError("argument should be a Buffer");if(T||(T=0),!I&&I!==0&&(I=this.length),c>=u.length&&(c=u.length),c||(c=0),I>0&&I<T&&(I=T),I===T||u.length===0||this.length===0)return 0;if(c<0)throw new RangeError("targetStart out of bounds");if(T<0||T>=this.length)throw new RangeError("Index out of range");if(I<0)throw new RangeError("sourceEnd out of bounds");I>this.length&&(I=this.length),u.length-c<I-T&&(I=u.length-c+T);let U=I-T;return this===u&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(c,T,I):Uint8Array.prototype.set.call(u,this.subarray(T,I),c),U},i.prototype.fill=function(u,c,T,I){if(typeof u=="string"){if(typeof c=="string"?(I=c,c=0,T=this.length):typeof T=="string"&&(I=T,T=this.length),I!==void 0&&typeof I!="string")throw new TypeError("encoding must be a string");if(typeof I=="string"&&!i.isEncoding(I))throw new TypeError("Unknown encoding: "+I);if(u.length===1){let W=u.charCodeAt(0);(I==="utf8"&&W<128||I==="latin1")&&(u=W)}}else typeof u=="number"?u=u&255:typeof u=="boolean"&&(u=Number(u));if(c<0||this.length<c||this.length<T)throw new RangeError("Out of range index");if(T<=c)return this;c=c>>>0,T=T===void 0?this.length:T>>>0,u||(u=0);let U;if(typeof u=="number")for(U=c;U<T;++U)this[U]=u;else{let W=i.isBuffer(u)?u:i.from(u,I),Be=W.length;if(Be===0)throw new TypeError('The value "'+u+'" is invalid for argument "value"');for(U=0;U<T-c;++U)this[U+c]=W[U%Be]}return this};let A={};function k(m,u,c){A[m]=class extends c{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(I){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:I,writable:!0})}toString(){return`${this.name} [${m}]: ${this.message}`}}}k("ERR_BUFFER_OUT_OF_BOUNDS",function(m){return m?`${m} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),k("ERR_INVALID_ARG_TYPE",function(m,u){return`The "${m}" argument must be of type number. Received type ${typeof u}`},TypeError),k("ERR_OUT_OF_RANGE",function(m,u,c){let T=`The value of "${m}" is out of range.`,I=c;return Number.isInteger(c)&&Math.abs(c)>2**32?I=$(String(c)):typeof c=="bigint"&&(I=String(c),(c>BigInt(2)**BigInt(32)||c<-(BigInt(2)**BigInt(32)))&&(I=$(I)),I+="n"),T+=` It must be ${u}. Received ${I}`,T},RangeError);function $(m){let u="",c=m.length,T=m[0]==="-"?1:0;for(;c>=T+4;c-=3)u=`_${m.slice(c-3,c)}${u}`;return`${m.slice(0,c)}${u}`}function X(m,u,c){b(u,"offset"),(m[u]===void 0||m[u+c]===void 0)&&x(u,m.length-(c+1))}function ie(m,u,c,T,I,U){if(m>c||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 A.ERR_OUT_OF_RANGE("value",Be,m)}X(T,I,U)}function b(m,u){if(typeof m!="number")throw new A.ERR_INVALID_ARG_TYPE(u,"number",m)}function x(m,u,c){throw Math.floor(m)!==m?(b(m,c),new A.ERR_OUT_OF_RANGE("offset","an integer",m)):u<0?new A.ERR_BUFFER_OUT_OF_BOUNDS:new A.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 c,T=m.length,I=null,U=[];for(let W=0;W<T;++W){if(c=m.charCodeAt(W),c>55295&&c<57344){if(!I){if(c>56319){(u-=3)>-1&&U.push(239,191,189);continue}else if(W+1===T){(u-=3)>-1&&U.push(239,191,189);continue}I=c;continue}if(c<56320){(u-=3)>-1&&U.push(239,191,189),I=c;continue}c=(I-55296<<10|c-56320)+65536}else I&&(u-=3)>-1&&U.push(239,191,189);if(I=null,c<128){if((u-=1)<0)break;U.push(c)}else if(c<2048){if((u-=2)<0)break;U.push(c>>6|192,c&63|128)}else if(c<65536){if((u-=3)<0)break;U.push(c>>12|224,c>>6&63|128,c&63|128)}else if(c<1114112){if((u-=4)<0)break;U.push(c>>18|240,c>>12&63|128,c>>6&63|128,c&63|128)}else throw new Error("Invalid code point")}return U}function _e(m){let u=[];for(let c=0;c<m.length;++c)u.push(m.charCodeAt(c)&255);return u}function Z(m,u){let c,T,I,U=[];for(let W=0;W<m.length&&!((u-=2)<0);++W)c=m.charCodeAt(W),T=c>>8,I=c%256,U.push(I),U.push(T);return U}function kt(m){return t.toByteArray(Q(m))}function Ot(m,u,c,T){let I;for(I=0;I<T&&!(I+c>=u.length||I>=m.length);++I)u[I+c]=m[I];return I}function wt(m,u){return m instanceof u||m!=null&&m.constructor!=null&&m.constructor.name!=null&&m.constructor.name===u.name}function mr(m){return m!==m}let si=(function(){let m="0123456789abcdef",u=new Array(256);for(let c=0;c<16;++c){let T=c*16;for(let I=0;I<16;++I)u[T+I]=m[c]+m[I]}return u})();function Bt(m){return typeof BigInt>"u"?hr:m}function hr(){throw new Error("BigInt not supported")}return mn}var vr,cc,fi,fc,mn,dc,di=at(()=>{C();R();O();vr={},cc=!1;fi={},fc=!1;mn={},dc=!1});var hn,q,cA,fA,pc=at(()=>{C();R();O();di();hn=Rt();hn.Buffer;hn.SlowBuffer;hn.INSPECT_MAX_BYTES;hn.kMaxLength;q=hn.Buffer,cA=hn.INSPECT_MAX_BYTES,fA=hn.kMaxLength});var R=at(()=>{pc()});function Mt(){return Hy||(Hy=!0,typeof Object.create=="function"?Bo=function(e,n){n&&(e.super_=n,e.prototype=Object.create(n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Bo=function(e,n){if(n){e.super_=n;var r=function(){};r.prototype=n.prototype,e.prototype=new r,e.prototype.constructor=e}}),Bo}var Bo,Hy,rs=at(()=>{C();R();O();Bo={},Hy=!1});function Ne(){Ne.init.call(this)}function Eo(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function qy(t){return t._maxListeners===void 0?Ne.defaultMaxListeners:t._maxListeners}function jy(t,e,n,r){var o,a,i,s;if(Eo(n),(a=t._events)===void 0?(a=t._events=Object.create(null),t._eventsCount=0):(a.newListener!==void 0&&(t.emit("newListener",e,n.listener?n.listener:n),a=t._events),i=a[e]),i===void 0)i=a[e]=n,++t._eventsCount;else if(typeof i=="function"?i=a[e]=r?[n,i]:[i,n]:r?i.unshift(n):i.push(n),(o=qy(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,s=l,console&&console.warn&&console.warn(s)}return t}function NB(){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 Ky(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},o=NB.bind(r);return o.listener=n,r.wrapFn=o,o}function Ly(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(a){for(var i=new Array(a.length),s=0;s<i.length;++s)i[s]=a[s].listener||a[s];return i})(o):Gy(o,o.length)}function Fy(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 Gy(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}var Wy,zy,ir,Uy,Zy,$y,Tt,is=at(()=>{C();R();O();ir=typeof Reflect=="object"?Reflect:null,Uy=ir&&typeof ir.apply=="function"?ir.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};zy=ir&&typeof ir.ownKeys=="function"?ir.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};Zy=Number.isNaN||function(t){return t!=t};Wy=Ne,Ne.EventEmitter=Ne,Ne.prototype._events=void 0,Ne.prototype._eventsCount=0,Ne.prototype._maxListeners=void 0;$y=10;Object.defineProperty(Ne,"defaultMaxListeners",{enumerable:!0,get:function(){return $y},set:function(t){if(typeof t!="number"||t<0||Zy(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");$y=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||Zy(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 qy(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 a;if(e.length>0&&(a=e[0]),a instanceof Error)throw a;var i=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw i.context=a,i}var s=o[t];if(s===void 0)return!1;if(typeof s=="function")Uy(s,this,e);else{var l=s.length,f=Gy(s,l);for(n=0;n<l;++n)Uy(f[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 Eo(e),this.on(t,Ky(this,t,e)),this},Ne.prototype.prependOnceListener=function(t,e){return Eo(e),this.prependListener(t,Ky(this,t,e)),this},Ne.prototype.removeListener=function(t,e){var n,r,o,a,i;if(Eo(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,a=n.length-1;a>=0;a--)if(n[a]===e||n[a].listener===e){i=n[a].listener,o=a;break}if(o<0)return this;o===0?n.shift():(function(s,l){for(;l+1<s.length;l++)s[l]=s[l+1];s.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,a=Object.keys(n);for(r=0;r<a.length;++r)(o=a[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 Ly(this,t,!0)},Ne.prototype.rawListeners=function(t){return Ly(this,t,!1)},Ne.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Fy.call(t,e)},Ne.prototype.listenerCount=Fy,Ne.prototype.eventNames=function(){return this._eventsCount>0?zy(this._events):[]};Tt=Wy;Tt.EventEmitter;Tt.defaultMaxListeners;Tt.init;Tt.listenerCount;Tt.EventEmitter;Tt.defaultMaxListeners;Tt.init;Tt.listenerCount});var Vy=at(()=>{C();R();O();is();Tt.once=function(t,e){return new Promise((n,r)=>{function o(...i){a!==void 0&&t.removeListener("error",a),n(i)}let a;e!=="error"&&(a=i=>{t.removeListener(name,o),r(i)},t.once("error",a)),t.once(e,o)})};Tt.on=function(t,e){let n=[],r=[],o=null,a=!1,i={async next(){let f=n.shift();if(f)return createIterResult(f,!1);if(o){let p=Promise.reject(o);return o=null,p}return a?createIterResult(void 0,!0):new Promise((p,y)=>r.push({resolve:p,reject:y}))},async return(){t.removeListener(e,s),t.removeListener("error",l),a=!0;for(let f of r)f.resolve(createIterResult(void 0,!0));return createIterResult(void 0,!0)},throw(f){o=f,t.removeListener(e,s),t.removeListener("error",l)},[Symbol.asyncIterator](){return this}};return t.on(e,s),t.on("error",l),i;function s(...f){let p=r.shift();p?p.resolve(createIterResult(f,!1)):n.push(f)}function l(f){a=!0;let p=r.shift();p?p.reject(f):o=f,i.return()}}});function us(){throw new Error("setTimeout has not been defined")}function cs(){throw new Error("clearTimeout has not been defined")}function um(t){if(qt===setTimeout)return setTimeout(t,0);if((qt===us||!qt)&&setTimeout)return qt=setTimeout,setTimeout(t,0);try{return qt(t,0)}catch{try{return qt.call(null,t,0)}catch{return qt.call(this||ar,t,0)}}}function DB(){or&&Nn&&(or=!1,Nn.length?Vt=Nn.concat(Vt):Oo=-1,Vt.length&&cm())}function cm(){if(!or){var t=um(DB);or=!0;for(var e=Vt.length;e;){for(Nn=Vt,Vt=[];++Oo<e;)Nn&&Nn[Oo].run();Oo=-1,e=Vt.length}Nn=null,or=!1,(function(n){if(Gt===clearTimeout)return clearTimeout(n);if((Gt===cs||!Gt)&&clearTimeout)return Gt=clearTimeout,clearTimeout(n);try{Gt(n)}catch{try{return Gt.call(null,n)}catch{return Gt.call(this||ar,n)}}})(t)}}function Jy(t,e){(this||ar).fun=t,(this||ar).array=e}function zt(){}function Hn(t){return t.call.bind(t)}function Jr(t,e){if(typeof t!="object")return!1;try{return e(t),!0}catch{return!1}}function Yy(t){return _t&&xt?Et(t)!==void 0:mm(t)||hm(t)||vm(t)||Tm(t)||_m(t)||bm(t)||wm(t)||xm(t)||Pm(t)||Bm(t)||Em(t)}function mm(t){return _t&&xt?Et(t)==="Uint8Array":We(t)==="[object Uint8Array]"||zB(t)&&t.buffer!==void 0}function hm(t){return _t&&xt?Et(t)==="Uint8ClampedArray":We(t)==="[object Uint8ClampedArray]"}function vm(t){return _t&&xt?Et(t)==="Uint16Array":We(t)==="[object Uint16Array]"}function Tm(t){return _t&&xt?Et(t)==="Uint32Array":We(t)==="[object Uint32Array]"}function _m(t){return _t&&xt?Et(t)==="Int8Array":We(t)==="[object Int8Array]"}function bm(t){return _t&&xt?Et(t)==="Int16Array":We(t)==="[object Int16Array]"}function wm(t){return _t&&xt?Et(t)==="Int32Array":We(t)==="[object Int32Array]"}function xm(t){return _t&&xt?Et(t)==="Float32Array":We(t)==="[object Float32Array]"}function Pm(t){return _t&&xt?Et(t)==="Float64Array":We(t)==="[object Float64Array]"}function Bm(t){return _t&&xt?Et(t)==="BigInt64Array":We(t)==="[object BigInt64Array]"}function Em(t){return _t&&xt?Et(t)==="BigUint64Array":We(t)==="[object BigUint64Array]"}function So(t){return We(t)==="[object Map]"}function ko(t){return We(t)==="[object Set]"}function Io(t){return We(t)==="[object WeakMap]"}function os(t){return We(t)==="[object WeakSet]"}function Mo(t){return We(t)==="[object ArrayBuffer]"}function Qy(t){return typeof ArrayBuffer<"u"&&(Mo.working?Mo(t):t instanceof ArrayBuffer)}function No(t){return We(t)==="[object DataView]"}function em(t){return typeof DataView<"u"&&(No.working?No(t):t instanceof DataView)}function Do(t){return We(t)==="[object SharedArrayBuffer]"}function tm(t){return typeof SharedArrayBuffer<"u"&&(Do.working?Do(t):t instanceof SharedArrayBuffer)}function nm(t){return Jr(t,XB)}function rm(t){return Jr(t,YB)}function im(t){return Jr(t,QB)}function om(t){return ym&&Jr(t,eE)}function am(t){return ds&&Jr(t,tE)}function ln(t,e){var n={seen:[],stylize:iE};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),ps(e)?n.showHidden=e:e&&L._extend(n,e),Dn(n.showHidden)&&(n.showHidden=!1),Dn(n.depth)&&(n.depth=2),Dn(n.colors)&&(n.colors=!1),Dn(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=rE),Ho(n,t,n.depth)}function rE(t,e){var n=ln.styles[e];return n?"\x1B["+ln.colors[n][0]+"m"+t+"\x1B["+ln.colors[n][1]+"m":t}function iE(t,e){return t}function Ho(t,e,n){if(t.customInspect&&e&&Ro(e.inspect)&&e.inspect!==L.inspect&&(!e.constructor||e.constructor.prototype!==e)){var r=e.inspect(n,t);return Uo(r)||(r=Ho(t,r,n)),r}var o=(function(g,h){if(Dn(h))return g.stylize("undefined","undefined");if(Uo(h)){var w="'"+JSON.stringify(h).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return g.stylize(w,"string")}if(Im(h))return g.stylize(""+h,"number");if(ps(h))return g.stylize(""+h,"boolean");if(jo(h))return g.stylize("null","null")})(t,e);if(o)return o;var a=Object.keys(e),i=(function(g){var h={};return g.forEach((function(w,P){h[w]=!0})),h})(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(e)),Vr(e)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return as(e);if(a.length===0){if(Ro(e)){var s=e.name?": "+e.name:"";return t.stylize("[Function"+s+"]","special")}if(Gr(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(Zo(e))return t.stylize(Date.prototype.toString.call(e),"date");if(Vr(e))return as(e)}var l,f="",p=!1,y=["{","}"];return km(e)&&(p=!0,y=["[","]"]),Ro(e)&&(f=" [Function"+(e.name?": "+e.name:"")+"]"),Gr(e)&&(f=" "+RegExp.prototype.toString.call(e)),Zo(e)&&(f=" "+Date.prototype.toUTCString.call(e)),Vr(e)&&(f=" "+as(e)),a.length!==0||p&&e.length!=0?n<0?Gr(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),l=p?(function(g,h,w,P,B){for(var v=[],S=0,E=h.length;S<E;++S)Am(h,String(S))?v.push(ss(g,h,w,P,String(S),!0)):v.push("");return B.forEach((function(H){H.match(/^\d+$/)||v.push(ss(g,h,w,P,H,!0))})),v})(t,e,n,i,a):a.map((function(g){return ss(t,e,n,i,g,p)})),t.seen.pop(),(function(g,h,w){var P=0;return g.reduce((function(B,v){return P++,v.indexOf(`
2
+ `)>=0&&P++,B+v.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60?w[0]+(h===""?"":h+`
3
3
  `)+" "+g.join(`,
4
- `)+" "+w[1]:w[0]+h+" "+g.join(", ")+" "+w[1]}(l,f,y)):y[0]+f+y[1]}function ss(t){return"["+Error.prototype.toString.call(t)+"]"}function ls(t,e,n,r,a,o){var i,s,l;if((l=Object.getOwnPropertyDescriptor(e,a)||{value:e[a]}).get?s=l.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):l.set&&(s=t.stylize("[Setter]","special")),Am(r,a)||(i="["+a+"]"),s||(t.seen.indexOf(l.value)<0?(s=ja(n)?Ha(t,l.value,null):Ha(t,l.value,n-1)).indexOf(`
5
- `)>-1&&(s=o?s.split(`
6
- `).map(function(f){return" "+f}).join(`
4
+ `)+" "+w[1]:w[0]+h+" "+g.join(", ")+" "+w[1]})(l,f,y)):y[0]+f+y[1]}function as(t){return"["+Error.prototype.toString.call(t)+"]"}function ss(t,e,n,r,o,a){var i,s,l;if((l=Object.getOwnPropertyDescriptor(e,o)||{value:e[o]}).get?s=l.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):l.set&&(s=t.stylize("[Setter]","special")),Am(r,o)||(i="["+o+"]"),s||(t.seen.indexOf(l.value)<0?(s=jo(n)?Ho(t,l.value,null):Ho(t,l.value,n-1)).indexOf(`
5
+ `)>-1&&(s=a?s.split(`
6
+ `).map((function(f){return" "+f})).join(`
7
7
  `).substr(2):`
8
8
  `+s.split(`
9
- `).map(function(f){return" "+f}).join(`
10
- `)):s=t.stylize("[Circular]","special")),Dn(i)){if(o&&a.match(/^\d+$/))return s;(i=JSON.stringify(""+a)).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+": "+s}function km(t){return Array.isArray(t)}function gs(t){return typeof t=="boolean"}function ja(t){return t===null}function Im(t){return typeof t=="number"}function Ua(t){return typeof t=="string"}function Dn(t){return t===void 0}function Xr(t){return cr(t)&&ys(t)==="[object RegExp]"}function cr(t){return typeof t=="object"&&t!==null}function Za(t){return cr(t)&&ys(t)==="[object Date]"}function Yr(t){return cr(t)&&(ys(t)==="[object Error]"||t instanceof Error)}function Ra(t){return typeof t=="function"}function ys(t){return Object.prototype.toString.call(t)}function us(t){return t<10?"0"+t.toString(10):t.toString(10)}function oE(){var t=new Date,e=[us(t.getHours()),us(t.getMinutes()),us(t.getSeconds())].join(":");return[t.getDate(),aE[t.getMonth()],e].join(" ")}function Am(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function sE(t,e){if(!t){var n=new Error("Promise was rejected with a falsy value");n.reason=t,t=n}return e(t)}var lm,qt,Gt,ur,Qe,Nn,Vt,lr,Oa,je,HB,ds,$a,fm,UB,ZB,$B,jB,KB,dm,pm,Xy,LB,FB,WB,gm,Ee,zB,qB,GB,ym,ps,xt,_t,VB,We,XB,YB,QB,Jr,L,Nt,sm,nE,Aa,Sm,Ca,aE,Mn,_C,Ka=ot(()=>{C();R();O();ur=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,Qe=lm={};(function(){try{qt=typeof setTimeout=="function"?setTimeout:cs}catch{qt=cs}try{Gt=typeof clearTimeout=="function"?clearTimeout:fs}catch{Gt=fs}})();Vt=[],lr=!1,Oa=-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];Vt.push(new Jy(t,e)),Vt.length!==1||lr||um(cm)},Jy.prototype.run=function(){(this||ur).fun.apply(null,(this||ur).array)},Qe.title="browser",Qe.browser=!0,Qe.env={},Qe.argv=[],Qe.version="",Qe.versions={},Qe.on=zt,Qe.addListener=zt,Qe.once=zt,Qe.off=zt,Qe.removeListener=zt,Qe.removeAllListeners=zt,Qe.emit=zt,Qe.prependListener=zt,Qe.prependOnceListener=zt,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};je=lm;je.addListener;je.argv;je.binding;je.browser;je.chdir;je.cwd;je.emit;je.env;je.listeners;je.nextTick;je.off;je.on;je.once;je.prependListener;je.prependOnceListener;je.removeAllListeners;je.removeListener;je.title;je.umask;je.version;je.versions;HB=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",ds=Object.prototype.toString,$a=function(t){return!(HB&&t&&typeof t=="object"&&Symbol.toStringTag in t)&&ds.call(t)==="[object Arguments]"},fm=function(t){return!!$a(t)||t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&ds.call(t)!=="[object Array]"&&ds.call(t.callee)==="[object Function]"},UB=function(){return $a(arguments)}();$a.isLegacyArguments=fm;ZB=UB?$a:fm,$B=Object.prototype.toString,jB=Function.prototype.toString,KB=/^\s*(?:function)?\*/,dm=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",pm=Object.getPrototypeOf,Xy=function(){if(!dm)return!1;try{return Function("return function*() {}")()}catch{}}(),LB=Xy?pm(Xy):{},FB=function(t){return typeof t=="function"&&(!!KB.test(jB.call(t))||(dm?pm(t)===LB:$B.call(t)==="[object GeneratorFunction]"))},WB=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}},gm=function(t){return t&&typeof t=="object"&&typeof t.copy=="function"&&typeof t.fill=="function"&&typeof t.readUInt8=="function"},Ee={},zB=gm,qB=ZB,GB=FB;ym=typeof BigInt<"u",ps=typeof Symbol<"u",xt=ps&&Symbol.toStringTag!==void 0,_t=typeof Uint8Array<"u",VB=typeof ArrayBuffer<"u";if(_t&&xt)var JB=Object.getPrototypeOf(Uint8Array.prototype),Et=Hn(Object.getOwnPropertyDescriptor(JB,Symbol.toStringTag).get);We=Hn(Object.prototype.toString),XB=Hn(Number.prototype.valueOf),YB=Hn(String.prototype.valueOf),QB=Hn(Boolean.prototype.valueOf);if(ym)var eE=Hn(BigInt.prototype.valueOf);if(ps)var tE=Hn(Symbol.prototype.valueOf);Ee.isArgumentsObject=qB,Ee.isGeneratorFunction=GB,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 VB&&ArrayBuffer.isView?ArrayBuffer.isView(t):Yy(t)||em(t)},Ee.isTypedArray=Yy,Ee.isUint8Array=mm,Ee.isUint8ClampedArray=hm,Ee.isUint16Array=vm,Ee.isUint32Array=Tm,Ee.isInt8Array=_m,Ee.isInt16Array=bm,Ee.isInt32Array=wm,Ee.isFloat32Array=xm,Ee.isFloat64Array=Pm,Ee.isBigInt64Array=Bm,Ee.isBigUint64Array=Em,Sa.working=typeof Map<"u"&&Sa(new Map),Ee.isMap=function(t){return typeof Map<"u"&&(Sa.working?Sa(t):t instanceof Map)},ka.working=typeof Set<"u"&&ka(new Set),Ee.isSet=function(t){return typeof Set<"u"&&(ka.working?ka(t):t instanceof Set)},Ia.working=typeof WeakMap<"u"&&Ia(new WeakMap),Ee.isWeakMap=function(t){return typeof WeakMap<"u"&&(Ia.working?Ia(t):t instanceof WeakMap)},os.working=typeof WeakSet<"u"&&os(new WeakSet),Ee.isWeakSet=function(t){return os(t)},Ma.working=typeof ArrayBuffer<"u"&&Ma(new ArrayBuffer),Ee.isArrayBuffer=Qy,Na.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&Na(new DataView(new ArrayBuffer(1),0,1)),Ee.isDataView=em,Da.working=typeof SharedArrayBuffer<"u"&&Da(new SharedArrayBuffer),Ee.isSharedArrayBuffer=tm,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=nm,Ee.isStringObject=rm,Ee.isBooleanObject=im,Ee.isBigIntObject=am,Ee.isSymbolObject=om,Ee.isBoxedPrimitive=function(t){return nm(t)||rm(t)||im(t)||am(t)||om(t)},Ee.isAnyArrayBuffer=function(t){return _t&&(Qy(t)||tm(t))},["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(t){Object.defineProperty(Ee,t,{enumerable:!1,value:function(){throw new Error(t+" is not supported in userland")}})});Jr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,L={},Nt=je,sm=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},nE=/%[sdj%]/g;L.format=function(t){if(!Ua(t)){for(var e=[],n=0;n<arguments.length;n++)e.push(ln(arguments[n]));return e.join(" ")}n=1;for(var r=arguments,a=r.length,o=String(t).replace(nE,function(s){if(s==="%%")return"%";if(n>=a)return s;switch(s){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 s}}),i=r[n];n<a;i=r[++n])ja(i)||!cr(i)?o+=" "+i:o+=" "+ln(i);return o},L.deprecate=function(t,e){if(Nt!==void 0&&Nt.noDeprecation===!0)return t;if(Nt===void 0)return function(){return L.deprecate(t,e).apply(this||Jr,arguments)};var n=!1;return function(){if(!n){if(Nt.throwDeprecation)throw new Error(e);Nt.traceDeprecation?console.trace(e):console.error(e),n=!0}return t.apply(this||Jr,arguments)}};Aa={},Sm=/^$/;Nt.env.NODE_DEBUG&&(Ca=Nt.env.NODE_DEBUG,Ca=Ca.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),Sm=new RegExp("^"+Ca+"$","i"));L.debuglog=function(t){if(t=t.toUpperCase(),!Aa[t])if(Sm.test(t)){var e=Nt.pid;Aa[t]=function(){var n=L.format.apply(L,arguments);console.error("%s %d: %s",t,e,n)}}else Aa[t]=function(){};return Aa[t]},L.inspect=ln,ln.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]},ln.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},L.types=Ee,L.isArray=km,L.isBoolean=gs,L.isNull=ja,L.isNullOrUndefined=function(t){return t==null},L.isNumber=Im,L.isString=Ua,L.isSymbol=function(t){return typeof t=="symbol"},L.isUndefined=Dn,L.isRegExp=Xr,L.types.isRegExp=Xr,L.isObject=cr,L.isDate=Za,L.types.isDate=Za,L.isError=Yr,L.types.isNativeError=Yr,L.isFunction=Ra,L.isPrimitive=function(t){return t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||typeof t=="symbol"||t===void 0},L.isBuffer=gm;aE=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];L.log=function(){console.log("%s - %s",oE(),L.format.apply(L,arguments))},L.inherits=WB,L._extend=function(t,e){if(!e||!cr(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t};Mn=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(Mn&&t[Mn]){var e;if(typeof(e=t[Mn])!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,Mn,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var n,r,a=new Promise(function(s,l){n=s,r=l}),o=[],i=0;i<arguments.length;i++)o.push(arguments[i]);o.push(function(s,l){s?r(s):n(l)});try{t.apply(this||Jr,o)}catch(s){r(s)}return a}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Mn&&Object.defineProperty(e,Mn,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,sm(t))},L.promisify.custom=Mn,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 a=n.pop();if(typeof a!="function")throw new TypeError("The last argument must be of type Function");var o=this||Jr,i=function(){return a.apply(o,arguments)};t.apply(this||Jr,n).then(function(s){Nt.nextTick(i.bind(null,null,s))},function(s){Nt.nextTick(sE.bind(null,s,i))})}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Object.defineProperties(e,sm(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;_C=L.promisify;L.types});var EC,Cm=ot(()=>{C();R();O();Ka();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;EC=L.promisify;L.types;L.TextEncoder=globalThis.TextEncoder;L.TextDecoder=globalThis.TextDecoder});function Ts(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function lE(){!fr||!Un||(fr=!1,Un.length?Jt=Un.concat(Jt):La=-1,Jt.length&&Om())}function Om(){if(!fr){var t=setTimeout(lE,0);fr=!0;for(var e=Jt.length;e;){for(Un=Jt,Jt=[];++La<e;)Un&&Un[La].run();La=-1,e=Jt.length}Un=null,fr=!1,clearTimeout(t)}}function uE(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];Jt.push(new Rm(t,e)),Jt.length===1&&!fr&&setTimeout(Om,0)}function Rm(t,e){this.fun=t,this.array=e}function ct(){}function EE(t){Ts("_linkedBinding")}function AE(t){Ts("dlopen")}function CE(){return[]}function OE(){return[]}function jE(t,e){if(!t)throw new Error(e||"assertion error")}function WE(){return!1}function lS(){return un.now()/1e3}function vs(t){var e=Math.floor((Date.now()-un.now())*.001),n=un.now()*.001,r=Math.floor(n)+e,a=Math.floor(n%1*1e9);return t&&(r=r-t[0],a=a-t[1],a<0&&(r--,a+=hs)),[r,a]}function cn(){return At}function _S(t){return[]}var Jt,fr,Un,La,cE,fE,dE,pE,gE,yE,mE,hE,vE,TE,_E,bE,wE,xE,PE,BE,SE,kE,IE,RE,ME,_s,NE,DE,HE,UE,ZE,$E,KE,LE,FE,zE,qE,GE,VE,JE,XE,YE,QE,eS,tS,nS,rS,iS,aS,oS,sS,un,ms,hs,uS,cS,fS,dS,pS,gS,yS,mS,hS,vS,TS,At,bs=ot(()=>{C();R();O();Jt=[],fr=!1,La=-1;Rm.prototype.run=function(){this.fun.apply(null,this.array)};cE="browser",fE="x64",dE="browser",pE={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},gE=["/usr/bin/node"],yE=[],mE="v16.8.0",hE={},vE=function(t,e){console.warn((e?e+": ":"")+t)},TE=function(t){Ts("binding")},_E=function(t){return 0},bE=function(){return"/"},wE=function(t){},xE={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};PE=ct,BE=[];SE={},kE=!1,IE={};RE=ct,ME=ct,_s=function(){return{}},NE=_s,DE=_s,HE=ct,UE=ct,ZE=ct,$E={};KE={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},LE=ct,FE=ct;zE=ct,qE=ct,GE=ct,VE=ct,JE=ct,XE=void 0,YE=void 0,QE=void 0,eS=ct,tS=2,nS=1,rS="/bin/usr/node",iS=9229,aS="node",oS=[],sS=ct,un={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};un.now===void 0&&(ms=Date.now(),un.timing&&un.timing.navigationStart&&(ms=un.timing.navigationStart),un.now=()=>Date.now()-ms);hs=1e9;vs.bigint=function(t){var e=vs(t);return typeof BigInt>"u"?e[0]*hs+e[1]:BigInt(e[0]*hs)+BigInt(e[1])};uS=10,cS={},fS=0;dS=cn,pS=cn,gS=cn,yS=cn,mS=cn,hS=ct,vS=cn,TS=cn;At={version:mE,versions:hE,arch:fE,platform:dE,release:xE,_rawDebug:PE,moduleLoadList:BE,binding:TE,_linkedBinding:EE,_events:cS,_eventsCount:fS,_maxListeners:uS,on:cn,addListener:dS,once:pS,off:gS,removeListener:yS,removeAllListeners:mS,emit:hS,prependListener:vS,prependOnceListener:TS,listeners:_S,domain:SE,_exiting:kE,config:IE,dlopen:AE,uptime:lS,_getActiveRequests:CE,_getActiveHandles:OE,reallyExit:RE,_kill:ME,cpuUsage:_s,resourceUsage:NE,memoryUsage:DE,kill:HE,exit:UE,openStdin:ZE,allowedNodeEnvironmentFlags:$E,assert:jE,features:KE,_fatalExceptions:LE,setUncaughtExceptionCaptureCallback:FE,hasUncaughtExceptionCaptureCallback:WE,emitWarning:vE,nextTick:uE,_tickCallback:zE,_debugProcess:qE,_debugEnd:GE,_startProfilerIdleNotifier:VE,_stopProfilerIdleNotifier:JE,stdout:XE,stdin:QE,stderr:YE,abort:eS,umask:_E,chdir:wE,cwd:bE,env:pE,title:cE,argv:gE,execArgv:yE,pid:tS,ppid:nS,execPath:rS,debugPort:iS,hrtime:vs,argv0:aS,_preload_modules:oS,setSourceMapsEnabled:sS}});function Nm(){if(Mm)return ws;Mm=!0,ws=t;function t(n,r){if(e("noDeprecation"))return n;var a=!1;function o(){if(!a){if(e("throwDeprecation"))throw new Error(r);e("traceDeprecation")?console.trace(r):console.warn(r),a=!0}return n.apply(this||xs,arguments)}return o}function e(n){try{if(!xs.localStorage)return!1}catch{return!1}var r=xs.localStorage[n];return r==null?!1:String(r).toLowerCase()==="true"}return ws}var ws,Mm,xs,Dm=ot(()=>{C();R();O();ws={},Mm=!1,xs=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global});function bS(){if(Hm)return ei;Hm=!0;var t=Rt(),e=t.Buffer;function n(a,o){for(var i in a)o[i]=a[i]}e.from&&e.alloc&&e.allocUnsafe&&e.allocUnsafeSlow?ei=t:(n(t,ei),ei.Buffer=r);function r(a,o,i){return e(a,o,i)}return r.prototype=Object.create(e.prototype),n(e,r),r.from=function(a,o,i){if(typeof a=="number")throw new TypeError("Argument must not be a number");return e(a,o,i)},r.alloc=function(a,o,i){if(typeof a!="number")throw new TypeError("Argument must be a number");var s=e(a);return o!==void 0?typeof i=="string"?s.fill(o,i):s.fill(o):s.fill(0),s},r.allocUnsafe=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return e(a)},r.allocUnsafeSlow=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return t.SlowBuffer(a)},ei}function wS(){if(Um)return Ps;Um=!0;var t=bS().Buffer,e=t.isEncoding||function(v){switch(v=""+v,v&&v.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(v){if(!v)return"utf8";for(var S;;)switch(v){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 v;default:if(S)return;v=(""+v).toLowerCase(),S=!0}}function r(v){var S=n(v);if(typeof S!="string"&&(t.isEncoding===e||!e(v)))throw new Error("Unknown encoding: "+v);return S||v}Ps.StringDecoder=a;function a(v){this.encoding=r(v);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=w,S=3;break;default:this.write=P,this.end=B;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(S)}a.prototype.write=function(v){if(v.length===0)return"";var S,E;if(this.lastNeed){if(S=this.fillLast(v),S===void 0)return"";E=this.lastNeed,this.lastNeed=0}else E=0;return E<v.length?S?S+this.text(v,E):this.text(v,E):S||""},a.prototype.end=p,a.prototype.text=f,a.prototype.fillLast=function(v){if(this.lastNeed<=v.length)return v.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);v.copy(this.lastChar,this.lastTotal-this.lastNeed,0,v.length),this.lastNeed-=v.length};function o(v){return v<=127?0:v>>5===6?2:v>>4===14?3:v>>3===30?4:v>>6===2?-1:-2}function i(v,S,E){var H=S.length-1;if(H<E)return 0;var K=o(S[H]);return K>=0?(K>0&&(v.lastNeed=K-1),K):--H<E||K===-2?0:(K=o(S[H]),K>=0?(K>0&&(v.lastNeed=K-2),K):--H<E||K===-2?0:(K=o(S[H]),K>=0?(K>0&&(K===2?K=0:v.lastNeed=K-3),K):0))}function s(v,S,E){if((S[0]&192)!==128)return v.lastNeed=0,"\uFFFD";if(v.lastNeed>1&&S.length>1){if((S[1]&192)!==128)return v.lastNeed=1,"\uFFFD";if(v.lastNeed>2&&S.length>2&&(S[2]&192)!==128)return v.lastNeed=2,"\uFFFD"}}function l(v){var S=this.lastTotal-this.lastNeed,E=s(this,v);if(E!==void 0)return E;if(this.lastNeed<=v.length)return v.copy(this.lastChar,S,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);v.copy(this.lastChar,S,0,v.length),this.lastNeed-=v.length}function f(v,S){var E=i(this,v,S);if(!this.lastNeed)return v.toString("utf8",S);this.lastTotal=E;var H=v.length-(E-this.lastNeed);return v.copy(this.lastChar,0,H),v.toString("utf8",S,H)}function p(v){var S=v&&v.length?this.write(v):"";return this.lastNeed?S+"\uFFFD":S}function y(v,S){if((v.length-S)%2===0){var E=v.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]=v[v.length-2],this.lastChar[1]=v[v.length-1],E.slice(0,-1)}return E}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=v[v.length-1],v.toString("utf16le",S,v.length-1)}function g(v){var S=v&&v.length?this.write(v):"";if(this.lastNeed){var E=this.lastTotal-this.lastNeed;return S+this.lastChar.toString("utf16le",0,E)}return S}function h(v,S){var E=(v.length-S)%3;return E===0?v.toString("base64",S):(this.lastNeed=3-E,this.lastTotal=3,E===1?this.lastChar[0]=v[v.length-1]:(this.lastChar[0]=v[v.length-2],this.lastChar[1]=v[v.length-1]),v.toString("base64",S,v.length-E))}function w(v){var S=v&&v.length?this.write(v):"";return this.lastNeed?S+this.lastChar.toString("base64",0,3-this.lastNeed):S}function P(v){return v.toString(this.encoding)}function B(v){return v&&v.length?this.write(v):""}return Ps}var ei,Hm,Ps,Um,ti,$C,Zm=ot(()=>{C();R();O();pi();ei={},Hm=!1;Ps={},Um=!1;ti=wS();ti.StringDecoder;$C=ti.StringDecoder});function xS(){if($m)return Bs;$m=!0;var t=Bs={},e,n;function r(){throw new Error("setTimeout has not been defined")}function a(){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=a}catch{n=a}})();function o(P){if(e===setTimeout)return setTimeout(P,0);if((e===r||!e)&&setTimeout)return e=setTimeout,setTimeout(P,0);try{return e(P,0)}catch{try{return e.call(null,P,0)}catch{return e.call(this||dr,P,0)}}}function i(P){if(n===clearTimeout)return clearTimeout(P);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(P);try{return n(P)}catch{try{return n.call(null,P)}catch{return n.call(this||dr,P)}}}var s=[],l=!1,f,p=-1;function y(){!l||!f||(l=!1,f.length?s=f.concat(s):p=-1,s.length&&g())}function g(){if(!l){var P=o(y);l=!0;for(var B=s.length;B;){for(f=s,s=[];++p<B;)f&&f[p].run();p=-1,B=s.length}f=null,l=!1,i(P)}}t.nextTick=function(P){var B=new Array(arguments.length-1);if(arguments.length>1)for(var v=1;v<arguments.length;v++)B[v-1]=arguments[v];s.push(new h(P,B)),s.length===1&&!l&&o(g)};function h(P,B){(this||dr).fun=P,(this||dr).array=B}h.prototype.run=function(){(this||dr).fun.apply(null,(this||dr).array)},t.title="browser",t.browser=!0,t.env={},t.argv=[],t.version="",t.versions={};function w(){}return t.on=w,t.addListener=w,t.once=w,t.off=w,t.removeListener=w,t.removeAllListeners=w,t.emit=w,t.prependListener=w,t.prependOnceListener=w,t.listeners=function(P){return[]},t.binding=function(P){throw new Error("process.binding is not supported")},t.cwd=function(){return"/"},t.chdir=function(P){throw new Error("process.chdir is not supported")},t.umask=function(){return 0},Bs}var Bs,$m,dr,Ke,Es=ot(()=>{C();R();O();Bs={},$m=!1,dr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ke=xS();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 PS(){if(jm)return Ss;jm=!0;var t=Ke;function e(o){if(typeof o!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(o))}function n(o,i){for(var s="",l=0,f=-1,p=0,y,g=0;g<=o.length;++g){if(g<o.length)y=o.charCodeAt(g);else{if(y===47)break;y=47}if(y===47){if(!(f===g-1||p===1))if(f!==g-1&&p===2){if(s.length<2||l!==2||s.charCodeAt(s.length-1)!==46||s.charCodeAt(s.length-2)!==46){if(s.length>2){var h=s.lastIndexOf("/");if(h!==s.length-1){h===-1?(s="",l=0):(s=s.slice(0,h),l=s.length-1-s.lastIndexOf("/")),f=g,p=0;continue}}else if(s.length===2||s.length===1){s="",l=0,f=g,p=0;continue}}i&&(s.length>0?s+="/..":s="..",l=2)}else s.length>0?s+="/"+o.slice(f+1,g):s=o.slice(f+1,g),l=g-f-1;f=g,p=0}else y===46&&p!==-1?++p:p=-1}return s}function r(o,i){var s=i.dir||i.root,l=i.base||(i.name||"")+(i.ext||"");return s?s===i.root?s+l:s+o+l:l}var a={resolve:function(){for(var i="",s=!1,l,f=arguments.length-1;f>=-1&&!s;f--){var p;f>=0?p=arguments[f]:(l===void 0&&(l=t.cwd()),p=l),e(p),p.length!==0&&(i=p+"/"+i,s=p.charCodeAt(0)===47)}return i=n(i,!s),s?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(i){if(e(i),i.length===0)return".";var s=i.charCodeAt(0)===47,l=i.charCodeAt(i.length-1)===47;return i=n(i,!s),i.length===0&&!s&&(i="."),i.length>0&&l&&(i+="/"),s?"/"+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,s=0;s<arguments.length;++s){var l=arguments[s];e(l),l.length>0&&(i===void 0?i=l:i+="/"+l)}return i===void 0?".":a.normalize(i)},relative:function(i,s){if(e(i),e(s),i===s||(i=a.resolve(i),s=a.resolve(s),i===s))return"";for(var l=1;l<i.length&&i.charCodeAt(l)===47;++l);for(var f=i.length,p=f-l,y=1;y<s.length&&s.charCodeAt(y)===47;++y);for(var g=s.length,h=g-y,w=p<h?p:h,P=-1,B=0;B<=w;++B){if(B===w){if(h>w){if(s.charCodeAt(y+B)===47)return s.slice(y+B+1);if(B===0)return s.slice(y+B)}else p>w&&(i.charCodeAt(l+B)===47?P=B:B===0&&(P=0));break}var v=i.charCodeAt(l+B),S=s.charCodeAt(y+B);if(v!==S)break;v===47&&(P=B)}var E="";for(B=l+P+1;B<=f;++B)(B===f||i.charCodeAt(B)===47)&&(E.length===0?E+="..":E+="/..");return E.length>0?E+s.slice(y+P):(y+=P,s.charCodeAt(y)===47&&++y,s.slice(y))},_makeLong:function(i){return i},dirname:function(i){if(e(i),i.length===0)return".";for(var s=i.charCodeAt(0),l=s===47,f=-1,p=!0,y=i.length-1;y>=1;--y)if(s=i.charCodeAt(y),s===47){if(!p){f=y;break}}else p=!1;return f===-1?l?"/":".":l&&f===1?"//":i.slice(0,f)},basename:function(i,s){if(s!==void 0&&typeof s!="string")throw new TypeError('"ext" argument must be a string');e(i);var l=0,f=-1,p=!0,y;if(s!==void 0&&s.length>0&&s.length<=i.length){if(s.length===i.length&&s===i)return"";var g=s.length-1,h=-1;for(y=i.length-1;y>=0;--y){var w=i.charCodeAt(y);if(w===47){if(!p){l=y+1;break}}else h===-1&&(p=!1,h=y+1),g>=0&&(w===s.charCodeAt(g)?--g===-1&&(f=y):(g=-1,f=h))}return l===f?f=h:f===-1&&(f=i.length),i.slice(l,f)}else{for(y=i.length-1;y>=0;--y)if(i.charCodeAt(y)===47){if(!p){l=y+1;break}}else f===-1&&(p=!1,f=y+1);return f===-1?"":i.slice(l,f)}},extname:function(i){e(i);for(var s=-1,l=0,f=-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}f===-1&&(p=!1,f=g+1),h===46?s===-1?s=g:y!==1&&(y=1):s!==-1&&(y=-1)}return s===-1||f===-1||y===0||y===1&&s===f-1&&s===l+1?"":i.slice(s,f)},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 s={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return s;var l=i.charCodeAt(0),f=l===47,p;f?(s.root="/",p=1):p=0;for(var y=-1,g=0,h=-1,w=!0,P=i.length-1,B=0;P>=p;--P){if(l=i.charCodeAt(P),l===47){if(!w){g=P+1;break}continue}h===-1&&(w=!1,h=P+1),l===46?y===-1?y=P: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&&f?s.base=s.name=i.slice(1,h):s.base=s.name=i.slice(g,h)):(g===0&&f?(s.name=i.slice(1,y),s.base=i.slice(1,h)):(s.name=i.slice(g,y),s.base=i.slice(g,h)),s.ext=i.slice(y,h)),g>0?s.dir=i.slice(0,g-1):f&&(s.dir="/"),s},sep:"/",delimiter:":",win32:null,posix:null};return a.posix=a,Ss=a,Ss}function Zn(t){throw new RangeError(kS[t])}function Lm(t,e){let n=t.split("@"),r="";n.length>1&&(r=n[0]+"@",t=n[1]);let a=function(o,i){let s=[],l=o.length;for(;l--;)s[l]=i(o[l]);return s}((t=t.replace(SS,".")).split("."),e).join(".");return r+a}function Ym(t){let e=[],n=0,r=t.length;for(;n<r;){let a=t.charCodeAt(n++);if(a>=55296&&a<=56319&&n<r){let o=t.charCodeAt(n++);(64512&o)==56320?e.push(((1023&a)<<10)+(1023&o)+65536):(e.push(a),n--)}else e.push(a)}return e}function AS(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function St(){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 ri(t,e,n){if(t&&Dt.isObject(t)&&t instanceof St)return t;var r=new St;return r.parse(t,e,n),r}function $S(){if(Jm)return Cs;Jm=!0;var t=je;function e(o){if(typeof o!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(o))}function n(o,i){for(var s="",l=0,f=-1,p=0,y,g=0;g<=o.length;++g){if(g<o.length)y=o.charCodeAt(g);else{if(y===47)break;y=47}if(y===47){if(!(f===g-1||p===1))if(f!==g-1&&p===2){if(s.length<2||l!==2||s.charCodeAt(s.length-1)!==46||s.charCodeAt(s.length-2)!==46){if(s.length>2){var h=s.lastIndexOf("/");if(h!==s.length-1){h===-1?(s="",l=0):(s=s.slice(0,h),l=s.length-1-s.lastIndexOf("/")),f=g,p=0;continue}}else if(s.length===2||s.length===1){s="",l=0,f=g,p=0;continue}}i&&(s.length>0?s+="/..":s="..",l=2)}else s.length>0?s+="/"+o.slice(f+1,g):s=o.slice(f+1,g),l=g-f-1;f=g,p=0}else y===46&&p!==-1?++p:p=-1}return s}function r(o,i){var s=i.dir||i.root,l=i.base||(i.name||"")+(i.ext||"");return s?s===i.root?s+l:s+o+l:l}var a={resolve:function(){for(var i="",s=!1,l,f=arguments.length-1;f>=-1&&!s;f--){var p;f>=0?p=arguments[f]:(l===void 0&&(l=t.cwd()),p=l),e(p),p.length!==0&&(i=p+"/"+i,s=p.charCodeAt(0)===47)}return i=n(i,!s),s?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(i){if(e(i),i.length===0)return".";var s=i.charCodeAt(0)===47,l=i.charCodeAt(i.length-1)===47;return i=n(i,!s),i.length===0&&!s&&(i="."),i.length>0&&l&&(i+="/"),s?"/"+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,s=0;s<arguments.length;++s){var l=arguments[s];e(l),l.length>0&&(i===void 0?i=l:i+="/"+l)}return i===void 0?".":a.normalize(i)},relative:function(i,s){if(e(i),e(s),i===s||(i=a.resolve(i),s=a.resolve(s),i===s))return"";for(var l=1;l<i.length&&i.charCodeAt(l)===47;++l);for(var f=i.length,p=f-l,y=1;y<s.length&&s.charCodeAt(y)===47;++y);for(var g=s.length,h=g-y,w=p<h?p:h,P=-1,B=0;B<=w;++B){if(B===w){if(h>w){if(s.charCodeAt(y+B)===47)return s.slice(y+B+1);if(B===0)return s.slice(y+B)}else p>w&&(i.charCodeAt(l+B)===47?P=B:B===0&&(P=0));break}var v=i.charCodeAt(l+B),S=s.charCodeAt(y+B);if(v!==S)break;v===47&&(P=B)}var E="";for(B=l+P+1;B<=f;++B)(B===f||i.charCodeAt(B)===47)&&(E.length===0?E+="..":E+="/..");return E.length>0?E+s.slice(y+P):(y+=P,s.charCodeAt(y)===47&&++y,s.slice(y))},_makeLong:function(i){return i},dirname:function(i){if(e(i),i.length===0)return".";for(var s=i.charCodeAt(0),l=s===47,f=-1,p=!0,y=i.length-1;y>=1;--y)if(s=i.charCodeAt(y),s===47){if(!p){f=y;break}}else p=!1;return f===-1?l?"/":".":l&&f===1?"//":i.slice(0,f)},basename:function(i,s){if(s!==void 0&&typeof s!="string")throw new TypeError('"ext" argument must be a string');e(i);var l=0,f=-1,p=!0,y;if(s!==void 0&&s.length>0&&s.length<=i.length){if(s.length===i.length&&s===i)return"";var g=s.length-1,h=-1;for(y=i.length-1;y>=0;--y){var w=i.charCodeAt(y);if(w===47){if(!p){l=y+1;break}}else h===-1&&(p=!1,h=y+1),g>=0&&(w===s.charCodeAt(g)?--g===-1&&(f=y):(g=-1,f=h))}return l===f?f=h:f===-1&&(f=i.length),i.slice(l,f)}else{for(y=i.length-1;y>=0;--y)if(i.charCodeAt(y)===47){if(!p){l=y+1;break}}else f===-1&&(p=!1,f=y+1);return f===-1?"":i.slice(l,f)}},extname:function(i){e(i);for(var s=-1,l=0,f=-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}f===-1&&(p=!1,f=g+1),h===46?s===-1?s=g:y!==1&&(y=1):s!==-1&&(y=-1)}return s===-1||f===-1||y===0||y===1&&s===f-1&&s===l+1?"":i.slice(s,f)},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 s={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return s;var l=i.charCodeAt(0),f=l===47,p;f?(s.root="/",p=1):p=0;for(var y=-1,g=0,h=-1,w=!0,P=i.length-1,B=0;P>=p;--P){if(l=i.charCodeAt(P),l===47){if(!w){g=P+1;break}continue}h===-1&&(w=!1,h=P+1),l===46?y===-1?y=P: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&&f?s.base=s.name=i.slice(1,h):s.base=s.name=i.slice(g,h)):(g===0&&f?(s.name=i.slice(1,y),s.base=i.slice(1,h)):(s.name=i.slice(g,y),s.base=i.slice(g,h)),s.ext=i.slice(y,h)),g>0?s.dir=i.slice(0,g-1):f&&(s.dir="/"),s},sep:"/",delimiter:":",win32:null,posix:null};return a.posix=a,Cs=a,Cs}function YS(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 Rs?QS(t):ek(t)}function QS(t){let e=t.hostname,n=t.pathname;for(let r=0;r<n.length;r++)if(n[r]==="%"){let a=n.codePointAt(r+2)||32;if(n[r+1]==="2"&&a===102||n[r+1]==="5"&&a===99)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(n=n.replace(zS,"\\"),n=decodeURIComponent(n),e!=="")return`\\\\${e}${n}`;{let r=n.codePointAt(1)|32,a=n[2];if(r<FS||r>WS||a!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return n.slice(1)}}function ek(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 tk(t){let e=Xm.resolve(t),n=t.charCodeAt(t.length-1);(n===LS||Rs&&n===KS)&&e[e.length-1]!==Xm.sep&&(e+="/");let r=new URL("file://");return e.includes("%")&&(e=e.replace(qS,"%25")),!Rs&&e.includes("\\")&&(e=e.replace(GS,"%5C")),e.includes(`
11
- `)&&(e=e.replace(VS,"%0A")),e.includes("\r")&&(e=e.replace(JS,"%0D")),e.includes(" ")&&(e=e.replace(XS,"%09")),r.pathname=e,r}function pk(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 Ms?gk(t):yk(t)}function gk(t){let e=t.hostname,n=t.pathname;for(let r=0;r<n.length;r++)if(n[r]==="%"){let a=n.codePointAt(r+2)||32;if(n[r+1]==="2"&&a===102||n[r+1]==="5"&&a===99)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(n=n.replace(sk,"\\"),n=decodeURIComponent(n),e!=="")return`\\\\${e}${n}`;{let r=n.codePointAt(1)|32,a=n[2];if(r<ak||r>ok||a!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return n.slice(1)}}function yk(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 mk(t){let e=Km.resolve(t),n=t.charCodeAt(t.length-1);(n===ik||Ms&&n===rk)&&e[e.length-1]!==Km.sep&&(e+="/");let r=new URL("file://");return e.includes("%")&&(e=e.replace(lk,"%25")),!Ms&&e.includes("\\")&&(e=e.replace(uk,"%5C")),e.includes(`
12
- `)&&(e=e.replace(ck,"%0A")),e.includes("\r")&&(e=e.replace(fk,"%0D")),e.includes(" ")&&(e=e.replace(dk,"%09")),r.pathname=e,r}var Ss,jm,Km,gr,BS,ES,SS,kS,Ht,ks,Fm,Qm,Wm,zm,IS,CS,ni,OS,Xt,De,RS,Dt,MS,NS,DS,HS,Os,qm,Gm,Vm,US,ZS,Is,pr,As,Cs,Jm,Xm,jS,KS,LS,FS,WS,Rs,zS,qS,GS,VS,JS,XS,nk,rk,ik,ak,ok,Ms,sk,lk,uk,ck,fk,dk,eh=ot(()=>{C();R();O();Ka();Es();Ss={},jm=!1;Km=PS(),gr=2147483647,BS=/^xn--/,ES=/[^\0-\x7E]/,SS=/[\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"},Ht=Math.floor,ks=String.fromCharCode;Fm=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},Qm=function(t,e,n){let r=0;for(t=n?Ht(t/700):t>>1,t+=Ht(t/e);t>455;r+=36)t=Ht(t/35);return Ht(r+36*t/(t+38))},Wm=function(t){let e=[],n=t.length,r=0,a=128,o=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 f=r;for(let y=1,g=36;;g+=36){l>=n&&Zn("invalid-input");let h=(s=t.charCodeAt(l++))-48<10?s-22:s-65<26?s-65:s-97<26?s-97:36;(h>=36||h>Ht((gr-r)/y))&&Zn("overflow"),r+=h*y;let w=g<=o?1:g>=o+26?26:g-o;if(h<w)break;let P=36-w;y>Ht(gr/P)&&Zn("overflow"),y*=P}let p=e.length+1;o=Qm(r-f,p,f==0),Ht(r/p)>gr-a&&Zn("overflow"),a+=Ht(r/p),r%=p,e.splice(r++,0,a)}var s;return String.fromCodePoint(...e)},zm=function(t){let e=[],n=(t=Ym(t)).length,r=128,a=0,o=72;for(let l of t)l<128&&e.push(ks(l));let i=e.length,s=i;for(i&&e.push("-");s<n;){let l=gr;for(let p of t)p>=r&&p<l&&(l=p);let f=s+1;l-r>Ht((gr-a)/f)&&Zn("overflow"),a+=(l-r)*f,r=l;for(let p of t)if(p<r&&++a>gr&&Zn("overflow"),p==r){let y=a;for(let g=36;;g+=36){let h=g<=o?1:g>=o+26?26:g-o;if(y<h)break;let w=y-h,P=36-h;e.push(ks(Fm(h+w%P,0))),y=Ht(w/P)}e.push(ks(Fm(y,0))),o=Qm(a,f,s==i),a=0,++s}++a,++r}return e.join("")},IS={version:"2.1.0",ucs2:{decode:Ym,encode:t=>String.fromCodePoint(...t)},decode:Wm,encode:zm,toASCII:function(t){return Lm(t,function(e){return ES.test(e)?"xn--"+zm(e):e})},toUnicode:function(t){return Lm(t,function(e){return BS.test(e)?Wm(e.slice(4).toLowerCase()):e})}};CS=function(t,e,n,r){e=e||"&",n=n||"=";var a={};if(typeof t!="string"||t.length===0)return a;var o=/\+/g;t=t.split(e);var i=1e3;r&&typeof r.maxKeys=="number"&&(i=r.maxKeys);var s=t.length;i>0&&s>i&&(s=i);for(var l=0;l<s;++l){var f,p,y,g,h=t[l].replace(o,"%20"),w=h.indexOf(n);w>=0?(f=h.substr(0,w),p=h.substr(w+1)):(f=h,p=""),y=decodeURIComponent(f),g=decodeURIComponent(p),AS(a,y)?Array.isArray(a[y])?a[y].push(g):a[y]=[a[y],g]:a[y]=g}return a},ni=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}},OS=function(t,e,n,r){return e=e||"&",n=n||"=",t===null&&(t=void 0),typeof t=="object"?Object.keys(t).map(function(a){var o=encodeURIComponent(ni(a))+n;return Array.isArray(t[a])?t[a].map(function(i){return o+encodeURIComponent(ni(i))}).join(e):o+encodeURIComponent(ni(t[a]))}).join(e):r?encodeURIComponent(ni(r))+n+encodeURIComponent(ni(t)):""},Xt={};Xt.decode=Xt.parse=CS,Xt.encode=Xt.stringify=OS;Xt.decode;Xt.encode;Xt.parse;Xt.stringify;De={},RS=IS,Dt={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=ri,De.resolve=function(t,e){return ri(t,!1,!0).resolve(e)},De.resolveObject=function(t,e){return t?ri(t,!1,!0).resolveObject(e):e},De.format=function(t){return Dt.isString(t)&&(t=ri(t)),t instanceof St?t.format():St.prototype.format.call(t)},De.Url=St;MS=/^([a-z0-9.+-]+:)/i,NS=/:[0-9]*$/,DS=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,HS=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r",`
13
- `," "]),Os=["'"].concat(HS),qm=["%","/","?",";","#"].concat(Os),Gm=["/","?","#"],Vm=/^[+a-z0-9A-Z_-]{0,63}$/,US=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,ZS={javascript:!0,"javascript:":!0},Is={javascript:!0,"javascript:":!0},pr={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},As=Xt;St.prototype.parse=function(t,e,n){if(!Dt.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var r=t.indexOf("?"),a=r!==-1&&r<t.indexOf("#")?"?":"#",o=t.split(a);o[0]=o[0].replace(/\\/g,"/");var i=t=o.join(a);if(i=i.trim(),!n&&t.split("#").length===1){var s=DS.exec(i);if(s)return this.path=i,this.href=i,this.pathname=s[1],s[2]?(this.search=s[2],this.query=e?As.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var l=MS.exec(i);if(l){var f=(l=l[0]).toLowerCase();this.protocol=f,i=i.substr(l.length)}if(n||l||i.match(/^\/\/[^@\/]+@[^@\/]+/)){var p=i.substr(0,2)==="//";!p||l&&Is[l]||(i=i.substr(2),this.slashes=!0)}if(!Is[l]&&(p||l&&!pr[l])){for(var y,g,h=-1,w=0;w<Gm.length;w++)(P=i.indexOf(Gm[w]))!==-1&&(h===-1||P<h)&&(h=P);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,w=0;w<qm.length;w++){var P;(P=i.indexOf(qm[w]))!==-1&&(h===-1||P<h)&&(h=P)}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 v=this.hostname.split(/\./),S=(w=0,v.length);w<S;w++){var E=v[w];if(E&&!E.match(Vm)){for(var H="",K=0,ae=E.length;K<ae;K++)E.charCodeAt(K)>127?H+="x":H+=E[K];if(!H.match(Vm)){var ee=v.slice(0,w),ge=v.slice(w+1),oe=E.match(US);oe&&(ee.push(oe[1]),ge.unshift(oe[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=RS.toASCII(this.hostname));var re=this.port?":"+this.port:"",Oe=this.hostname||"";this.host=Oe+re,this.href+=this.host,B&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),i[0]!=="/"&&(i="/"+i))}if(!ZS[f])for(w=0,S=Os.length;w<S;w++){var ze=Os[w];if(i.indexOf(ze)!==-1){var tt=encodeURIComponent(ze);tt===ze&&(tt=escape(ze)),i=i.split(ze).join(tt)}}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=As.parse(this.query)),i=i.slice(0,Je)):e&&(this.search="",this.query={}),i&&(this.pathname=i),pr[f]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){re=this.pathname||"";var mt=this.search||"";this.path=re+mt}return this.href=this.format(),this},St.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||"",a=!1,o="";this.host?a=t+this.host:this.hostname&&(a=t+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(a+=":"+this.port)),this.query&&Dt.isObject(this.query)&&Object.keys(this.query).length&&(o=As.stringify(this.query));var i=this.search||o&&"?"+o||"";return e&&e.substr(-1)!==":"&&(e+=":"),this.slashes||(!e||pr[e])&&a!==!1?(a="//"+(a||""),n&&n.charAt(0)!=="/"&&(n="/"+n)):a||(a=""),r&&r.charAt(0)!=="#"&&(r="#"+r),i&&i.charAt(0)!=="?"&&(i="?"+i),e+a+(n=n.replace(/[?#]/g,function(s){return encodeURIComponent(s)}))+(i=i.replace("#","%23"))+r},St.prototype.resolve=function(t){return this.resolveObject(ri(t,!1,!0)).format()},St.prototype.resolveObject=function(t){if(Dt.isString(t)){var e=new St;e.parse(t,!1,!0),t=e}for(var n=new St,r=Object.keys(this),a=0;a<r.length;a++){var o=r[a];n[o]=this[o]}if(n.hash=t.hash,t.href==="")return n.href=n.format(),n;if(t.slashes&&!t.protocol){for(var i=Object.keys(t),s=0;s<i.length;s++){var l=i[s];l!=="protocol"&&(n[l]=t[l])}return pr[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(t.protocol&&t.protocol!==n.protocol){if(!pr[t.protocol]){for(var f=Object.keys(t),p=0;p<f.length;p++){var y=f[p];n[y]=t[y]}return n.href=n.format(),n}if(n.protocol=t.protocol,t.host||Is[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||"",w=n.search||"";n.path=h+w}return n.slashes=n.slashes||t.slashes,n.href=n.format(),n}var P=n.pathname&&n.pathname.charAt(0)==="/",B=t.host||t.pathname&&t.pathname.charAt(0)==="/",v=B||P||n.host&&t.pathname,S=v,E=n.pathname&&n.pathname.split("/")||[],H=(g=t.pathname&&t.pathname.split("/")||[],n.protocol&&!pr[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),v=v&&(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(!Dt.isNullOrUndefined(t.search))return H&&(n.hostname=n.host=E.shift(),(oe=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=oe.shift(),n.host=n.hostname=oe.shift())),n.search=t.search,n.query=t.query,Dt.isNull(n.pathname)&&Dt.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 K=E.slice(-1)[0],ae=(n.host||t.host||E.length>1)&&(K==="."||K==="..")||K==="",ee=0,ge=E.length;ge>=0;ge--)(K=E[ge])==="."?E.splice(ge,1):K===".."?(E.splice(ge,1),ee++):ee&&(E.splice(ge,1),ee--);if(!v&&!S)for(;ee--;ee)E.unshift("..");!v||E[0]===""||E[0]&&E[0].charAt(0)==="/"||E.unshift(""),ae&&E.join("/").substr(-1)!=="/"&&E.push("");var oe,re=E[0]===""||E[0]&&E[0].charAt(0)==="/";return H&&(n.hostname=n.host=re?"":E.length?E.shift():"",(oe=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=oe.shift(),n.host=n.hostname=oe.shift())),(v=v||n.host&&E.length)&&!re&&E.unshift(""),E.length?n.pathname=E.join("/"):(n.pathname=null,n.path=null),Dt.isNull(n.pathname)&&Dt.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},St.prototype.parseHost=function(){var t=this.host,e=NS.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;Cs={},Jm=!1;Xm=$S(),jS=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;De.URL=typeof URL<"u"?URL:null;De.pathToFileURL=tk;De.fileURLToPath=YS;De.Url;De.format;De.resolve;De.resolveObject;De.URL;KS=92,LS=47,FS=97,WS=122,Rs=jS==="win32",zS=/\//g,qS=/%/g,GS=/\\/g,VS=/\n/g,JS=/\r/g,XS=/\t/g;nk=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;De.URL=typeof URL<"u"?URL:null;De.pathToFileURL=mk;De.fileURLToPath=pk;De.Url;De.format;De.resolve;De.resolveObject;De.parse;De.URL;rk=92,ik=47,ak=97,ok=122,Ms=nk==="win32",sk=/\//g,lk=/%/g,uk=/\\/g,ck=/\n/g,fk=/\r/g,dk=/\t/g});var Rh={};Wn(Rh,{Agent:()=>Sk,ClientRequest:()=>kk,IncomingMessage:()=>Ik,METHODS:()=>Ak,STATUS_CODES:()=>Ck,default:()=>Yt,get:()=>Ok,globalAgent:()=>Rk,request:()=>Mk});function Ph(){if(th)return Pt;th=!0,Pt.fetch=r($n.fetch)&&r($n.ReadableStream),Pt.writableStream=r($n.WritableStream),Pt.abortController=r($n.AbortController);var t;function e(){if(t!==void 0)return t;if($n.XMLHttpRequest){t=new $n.XMLHttpRequest;try{t.open("GET",$n.XDomainRequest?"/":"https://example.com")}catch{t=null}}else t=null;return t}function n(a){var o=e();if(!o)return!1;try{return o.responseType=a,o.responseType===a}catch{}return!1}Pt.arraybuffer=Pt.fetch||n("arraybuffer"),Pt.msstream=!Pt.fetch&&n("ms-stream"),Pt.mozchunkedarraybuffer=!Pt.fetch&&n("moz-chunked-arraybuffer"),Pt.overrideMimeType=Pt.fetch||(e()?r(e().overrideMimeType):!1);function r(a){return typeof a=="function"}return t=null,Pt}function Bh(){return nh||(nh=!0,Ns=Tt.EventEmitter),Ns}function hk(){if(rh)return Ds;rh=!0;function t(w,P){var B=Object.keys(w);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(w);P&&(v=v.filter(function(S){return Object.getOwnPropertyDescriptor(w,S).enumerable})),B.push.apply(B,v)}return B}function e(w){for(var P=1;P<arguments.length;P++){var B=arguments[P]!=null?arguments[P]:{};P%2?t(Object(B),!0).forEach(function(v){n(w,v,B[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(w,Object.getOwnPropertyDescriptors(B)):t(Object(B)).forEach(function(v){Object.defineProperty(w,v,Object.getOwnPropertyDescriptor(B,v))})}return w}function n(w,P,B){return P=i(P),P in w?Object.defineProperty(w,P,{value:B,enumerable:!0,configurable:!0,writable:!0}):w[P]=B,w}function r(w,P){if(!(w instanceof P))throw new TypeError("Cannot call a class as a function")}function a(w,P){for(var B=0;B<P.length;B++){var v=P[B];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(w,i(v.key),v)}}function o(w,P,B){return P&&a(w.prototype,P),Object.defineProperty(w,"prototype",{writable:!1}),w}function i(w){var P=s(w,"string");return typeof P=="symbol"?P:String(P)}function s(w,P){if(typeof w!="object"||w===null)return w;var B=w[Symbol.toPrimitive];if(B!==void 0){var v=B.call(w,P||"default");if(typeof v!="object")return v;throw new TypeError("@@toPrimitive must return a primitive value.")}return(P==="string"?String:Number)(w)}var l=Rt(),f=l.Buffer,p=L,y=p.inspect,g=y&&y.custom||"inspect";function h(w,P,B){f.prototype.copy.call(w,P,B)}return Ds=function(){function w(){r(this,w),this.head=null,this.tail=null,this.length=0}return o(w,[{key:"push",value:function(B){var v={data:B,next:null};this.length>0?this.tail.next=v:this.head=v,this.tail=v,++this.length}},{key:"unshift",value:function(B){var v={data:B,next:this.head};this.length===0&&(this.tail=v),this.head=v,++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 v=this.head,S=""+v.data;v=v.next;)S+=B+v.data;return S}},{key:"concat",value:function(B){if(this.length===0)return f.alloc(0);for(var v=f.allocUnsafe(B>>>0),S=this.head,E=0;S;)h(S.data,v,E),E+=S.data.length,S=S.next;return v}},{key:"consume",value:function(B,v){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=v?this._getString(B):this._getBuffer(B),S}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(B){var v=this.head,S=1,E=v.data;for(B-=E.length;v=v.next;){var H=v.data,K=B>H.length?H.length:B;if(K===H.length?E+=H:E+=H.slice(0,B),B-=K,B===0){K===H.length?(++S,v.next?this.head=v.next:this.head=this.tail=null):(this.head=v,v.data=H.slice(K));break}++S}return this.length-=S,E}},{key:"_getBuffer",value:function(B){var v=f.allocUnsafe(B),S=this.head,E=1;for(S.data.copy(v),B-=S.data.length;S=S.next;){var H=S.data,K=B>H.length?H.length:B;if(H.copy(v,v.length-B,0,K),B-=K,B===0){K===H.length?(++E,S.next?this.head=S.next:this.head=this.tail=null):(this.head=S,S.data=H.slice(K));break}++E}return this.length-=E,v}},{key:g,value:function(B,v){return y(this,e(e({},v),{},{depth:0,customInspect:!1}))}}]),w}(),Ds}function Eh(){if(ih)return Hs;ih=!0;var t=At;function e(s,l){var f=this,p=this._readableState&&this._readableState.destroyed,y=this._writableState&&this._writableState.destroyed;return p||y?(l?l(s):s&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(o,this,s)):t.nextTick(o,this,s)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(s||null,function(g){!l&&g?f._writableState?f._writableState.errorEmitted?t.nextTick(r,f):(f._writableState.errorEmitted=!0,t.nextTick(n,f,g)):t.nextTick(n,f,g):l?(t.nextTick(r,f),l(g)):t.nextTick(r,f)}),this)}function n(s,l){o(s,l),r(s)}function r(s){s._writableState&&!s._writableState.emitClose||s._readableState&&!s._readableState.emitClose||s.emit("close")}function a(){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 o(s,l){s.emit("error",l)}function i(s,l){var f=s._readableState,p=s._writableState;f&&f.autoDestroy||p&&p.autoDestroy?s.destroy(l):s.emit("error",l)}return Hs={destroy:e,undestroy:a,errorOrDestroy:i},Hs}function mr(){if(ah)return Us;ah=!0;let t={};function e(i,s,l){l||(l=Error);function f(y,g,h){return typeof s=="string"?s:s(y,g,h)}class p extends l{constructor(g,h,w){super(f(g,h,w))}}p.prototype.name=l.name,p.prototype.code=i,t[i]=p}function n(i,s){if(Array.isArray(i)){let l=i.length;return i=i.map(f=>String(f)),l>2?`one of ${s} ${i.slice(0,l-1).join(", ")}, or `+i[l-1]:l===2?`one of ${s} ${i[0]} or ${i[1]}`:`of ${s} ${i[0]}`}else return`of ${s} ${String(i)}`}function r(i,s,l){return i.substr(0,s.length)===s}function a(i,s,l){return(l===void 0||l>i.length)&&(l=i.length),i.substring(l-s.length,l)===s}function o(i,s,l){return typeof l!="number"&&(l=0),l+s.length>i.length?!1:i.indexOf(s,l)!==-1}return e("ERR_INVALID_OPT_VALUE",function(i,s){return'The value "'+s+'" is invalid for option "'+i+'"'},TypeError),e("ERR_INVALID_ARG_TYPE",function(i,s,l){let f;typeof s=="string"&&r(s,"not ")?(f="must not be",s=s.replace(/^not /,"")):f="must be";let p;if(a(i," argument"))p=`The ${i} ${f} ${n(s,"type")}`;else{let y=o(i,".")?"property":"argument";p=`The "${i}" ${y} ${f} ${n(s,"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"),Us.codes=t,Us}function Sh(){if(oh)return Zs;oh=!0;var t=mr().codes.ERR_INVALID_OPT_VALUE;function e(r,a,o){return r.highWaterMark!=null?r.highWaterMark:a?r[o]:null}function n(r,a,o,i){var s=e(a,i,o);if(s!=null){if(!(isFinite(s)&&Math.floor(s)===s)||s<0){var l=i?o:"highWaterMark";throw new t(l,s)}return Math.floor(s)}return r.objectMode?16:16*1024}return Zs={getHighWaterMark:n},Zs}function kh(){if(sh)return $s;sh=!0;var t=At;$s=oe;function e(A){var k=this;this.next=null,this.entry=null,this.finish=function(){Te(k,A)}}var n;oe.WritableState=ee;var r={deprecate:Nm()},a=Bh(),o=Rt().Buffer,i=(typeof lh<"u"?lh:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function s(A){return o.from(A)}function l(A){return o.isBuffer(A)||A instanceof i}var f=Eh(),p=Sh(),y=p.getHighWaterMark,g=mr().codes,h=g.ERR_INVALID_ARG_TYPE,w=g.ERR_METHOD_NOT_IMPLEMENTED,P=g.ERR_MULTIPLE_CALLBACK,B=g.ERR_STREAM_CANNOT_PIPE,v=g.ERR_STREAM_DESTROYED,S=g.ERR_STREAM_NULL_VALUES,E=g.ERR_STREAM_WRITE_AFTER_END,H=g.ERR_UNKNOWN_ENCODING,K=f.errorOrDestroy;Mt()(oe,a);function ae(){}function ee(A,k,$){n=n||yr(),A=A||{},typeof $!="boolean"&&($=k instanceof n),this.objectMode=!!A.objectMode,$&&(this.objectMode=this.objectMode||!!A.writableObjectMode),this.highWaterMark=y(this,A,"writableHighWaterMark",$),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var X=A.decodeStrings===!1;this.decodeStrings=!X,this.defaultEncoding=A.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(ie){Ue(k,ie)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=A.emitClose!==!1,this.autoDestroy=!!A.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}ee.prototype.getBuffer=function(){for(var k=this.bufferedRequest,$=[];k;)$.push(k),k=k.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(oe,Symbol.hasInstance,{value:function(k){return ge.call(this,k)?!0:this!==oe?!1:k&&k._writableState instanceof ee}})):ge=function(k){return k instanceof this};function oe(A){n=n||yr();var k=this instanceof n;if(!k&&!ge.call(oe,this))return new oe(A);this._writableState=new ee(A,this,k),this.writable=!0,A&&(typeof A.write=="function"&&(this._write=A.write),typeof A.writev=="function"&&(this._writev=A.writev),typeof A.destroy=="function"&&(this._destroy=A.destroy),typeof A.final=="function"&&(this._final=A.final)),a.call(this)}oe.prototype.pipe=function(){K(this,new B)};function re(A,k){var $=new E;K(A,$),t.nextTick(k,$)}function Oe(A,k,$,X){var ie;return $===null?ie=new S:typeof $!="string"&&!k.objectMode&&(ie=new h("chunk",["string","Buffer"],$)),ie?(K(A,ie),t.nextTick(X,ie),!1):!0}oe.prototype.write=function(A,k,$){var X=this._writableState,ie=!1,b=!X.objectMode&&l(A);return b&&!o.isBuffer(A)&&(A=s(A)),typeof k=="function"&&($=k,k=null),b?k="buffer":k||(k=X.defaultEncoding),typeof $!="function"&&($=ae),X.ending?re(this,$):(b||Oe(this,X,A,$))&&(X.pendingcb++,ie=tt(this,X,b,A,k,$)),ie},oe.prototype.cork=function(){this._writableState.corked++},oe.prototype.uncork=function(){var A=this._writableState;A.corked&&(A.corked--,!A.writing&&!A.corked&&!A.bufferProcessing&&A.bufferedRequest&&fe(this,A))},oe.prototype.setDefaultEncoding=function(k){if(typeof k=="string"&&(k=k.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((k+"").toLowerCase())>-1))throw new H(k);return this._writableState.defaultEncoding=k,this},Object.defineProperty(oe.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function ze(A,k,$){return!A.objectMode&&A.decodeStrings!==!1&&typeof k=="string"&&(k=o.from(k,$)),k}Object.defineProperty(oe.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function tt(A,k,$,X,ie,b){if(!$){var x=ze(k,X,ie);X!==x&&($=!0,ie="buffer",X=x)}var z=k.objectMode?1:X.length;k.length+=z;var Q=k.length<k.highWaterMark;if(Q||(k.needDrain=!0),k.writing||k.corked){var Me=k.lastBufferedRequest;k.lastBufferedRequest={chunk:X,encoding:ie,isBuf:$,callback:b,next:null},Me?Me.next=k.lastBufferedRequest:k.bufferedRequest=k.lastBufferedRequest,k.bufferedRequestCount+=1}else Ve(A,k,!1,z,X,ie,b);return Q}function Ve(A,k,$,X,ie,b,x){k.writelen=X,k.writecb=x,k.writing=!0,k.sync=!0,k.destroyed?k.onwrite(new v("write")):$?A._writev(ie,k.onwrite):A._write(ie,b,k.onwrite),k.sync=!1}function Je(A,k,$,X,ie){--k.pendingcb,$?(t.nextTick(ie,X),t.nextTick(F,A,k),A._writableState.errorEmitted=!0,K(A,X)):(ie(X),A._writableState.errorEmitted=!0,K(A,X),F(A,k))}function mt(A){A.writing=!1,A.writecb=null,A.length-=A.writelen,A.writelen=0}function Ue(A,k){var $=A._writableState,X=$.sync,ie=$.writecb;if(typeof ie!="function")throw new P;if(mt($),k)Je(A,$,X,k,ie);else{var b=ve($)||A.destroyed;!b&&!$.corked&&!$.bufferProcessing&&$.bufferedRequest&&fe(A,$),X?t.nextTick(Pe,A,$,b,ie):Pe(A,$,b,ie)}}function Pe(A,k,$,X){$||Se(A,k),k.pendingcb--,X(),F(A,k)}function Se(A,k){k.length===0&&k.needDrain&&(k.needDrain=!1,A.emit("drain"))}function fe(A,k){k.bufferProcessing=!0;var $=k.bufferedRequest;if(A._writev&&$&&$.next){var X=k.bufferedRequestCount,ie=new Array(X),b=k.corkedRequestsFree;b.entry=$;for(var x=0,z=!0;$;)ie[x]=$,$.isBuf||(z=!1),$=$.next,x+=1;ie.allBuffers=z,Ve(A,k,!0,k.length,ie,"",b.finish),k.pendingcb++,k.lastBufferedRequest=null,b.next?(k.corkedRequestsFree=b.next,b.next=null):k.corkedRequestsFree=new e(k),k.bufferedRequestCount=0}else{for(;$;){var Q=$.chunk,Me=$.encoding,_e=$.callback,Z=k.objectMode?1:Q.length;if(Ve(A,k,!1,Z,Q,Me,_e),$=$.next,k.bufferedRequestCount--,k.writing)break}$===null&&(k.lastBufferedRequest=null)}k.bufferedRequest=$,k.bufferProcessing=!1}oe.prototype._write=function(A,k,$){$(new w("_write()"))},oe.prototype._writev=null,oe.prototype.end=function(A,k,$){var X=this._writableState;return typeof A=="function"?($=A,A=null,k=null):typeof k=="function"&&($=k,k=null),A!=null&&this.write(A,k),X.corked&&(X.corked=1,this.uncork()),X.ending||de(this,X,$),this},Object.defineProperty(oe.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function ve(A){return A.ending&&A.length===0&&A.bufferedRequest===null&&!A.finished&&!A.writing}function D(A,k){A._final(function($){k.pendingcb--,$&&K(A,$),k.prefinished=!0,A.emit("prefinish"),F(A,k)})}function j(A,k){!k.prefinished&&!k.finalCalled&&(typeof A._final=="function"&&!k.destroyed?(k.pendingcb++,k.finalCalled=!0,t.nextTick(D,A,k)):(k.prefinished=!0,A.emit("prefinish")))}function F(A,k){var $=ve(k);if($&&(j(A,k),k.pendingcb===0&&(k.finished=!0,A.emit("finish"),k.autoDestroy))){var X=A._readableState;(!X||X.autoDestroy&&X.endEmitted)&&A.destroy()}return $}function de(A,k,$){k.ending=!0,F(A,k),$&&(k.finished?t.nextTick($):A.once("finish",$)),k.ended=!0,A.writable=!1}function Te(A,k,$){var X=A.entry;for(A.entry=null;X;){var ie=X.callback;k.pendingcb--,ie($),X=X.next}k.corkedRequestsFree.next=A}return Object.defineProperty(oe.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(k){this._writableState&&(this._writableState.destroyed=k)}}),oe.prototype.destroy=f.destroy,oe.prototype._undestroy=f.undestroy,oe.prototype._destroy=function(A,k){k(A)},$s}function yr(){if(uh)return js;uh=!0;var t=At,e=Object.keys||function(p){var y=[];for(var g in p)y.push(g);return y};js=s;var n=Ih(),r=kh();Mt()(s,n);for(var a=e(r.prototype),o=0;o<a.length;o++){var i=a[o];s.prototype[i]||(s.prototype[i]=r.prototype[i])}function s(p){if(!(this instanceof s))return new s(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(s.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(s.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(s.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function l(){this._writableState.ended||t.nextTick(f,this)}function f(p){p.end()}return Object.defineProperty(s.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)}}),js}function Qs(){if(ch)return Ks;ch=!0;var t=mr().codes.ERR_STREAM_PREMATURE_CLOSE;function e(o){var i=!1;return function(){if(!i){i=!0;for(var s=arguments.length,l=new Array(s),f=0;f<s;f++)l[f]=arguments[f];o.apply(this,l)}}}function n(){}function r(o){return o.setHeader&&typeof o.abort=="function"}function a(o,i,s){if(typeof i=="function")return a(o,null,i);i||(i={}),s=e(s||n);var l=i.readable||i.readable!==!1&&o.readable,f=i.writable||i.writable!==!1&&o.writable,p=function(){o.writable||g()},y=o._writableState&&o._writableState.finished,g=function(){f=!1,y=!0,l||s.call(o)},h=o._readableState&&o._readableState.endEmitted,w=function(){l=!1,h=!0,f||s.call(o)},P=function(E){s.call(o,E)},B=function(){var E;if(l&&!h)return(!o._readableState||!o._readableState.ended)&&(E=new t),s.call(o,E);if(f&&!y)return(!o._writableState||!o._writableState.ended)&&(E=new t),s.call(o,E)},v=function(){o.req.on("finish",g)};return r(o)?(o.on("complete",g),o.on("abort",B),o.req?v():o.on("request",v)):f&&!o._writableState&&(o.on("end",p),o.on("close",p)),o.on("end",w),o.on("finish",g),i.error!==!1&&o.on("error",P),o.on("close",B),function(){o.removeListener("complete",g),o.removeListener("abort",B),o.removeListener("request",v),o.req&&o.req.removeListener("finish",g),o.removeListener("end",p),o.removeListener("close",p),o.removeListener("finish",g),o.removeListener("end",w),o.removeListener("error",P),o.removeListener("close",B)}}return Ks=a,Ks}function vk(){if(fh)return Ls;fh=!0;var t=At,e;function n(H,K,ae){return K=r(K),K in H?Object.defineProperty(H,K,{value:ae,enumerable:!0,configurable:!0,writable:!0}):H[K]=ae,H}function r(H){var K=a(H,"string");return typeof K=="symbol"?K:String(K)}function a(H,K){if(typeof H!="object"||H===null)return H;var ae=H[Symbol.toPrimitive];if(ae!==void 0){var ee=ae.call(H,K||"default");if(typeof ee!="object")return ee;throw new TypeError("@@toPrimitive must return a primitive value.")}return(K==="string"?String:Number)(H)}var o=Qs(),i=Symbol("lastResolve"),s=Symbol("lastReject"),l=Symbol("error"),f=Symbol("ended"),p=Symbol("lastPromise"),y=Symbol("handlePromise"),g=Symbol("stream");function h(H,K){return{value:H,done:K}}function w(H){var K=H[i];if(K!==null){var ae=H[g].read();ae!==null&&(H[p]=null,H[i]=null,H[s]=null,K(h(ae,!1)))}}function P(H){t.nextTick(w,H)}function B(H,K){return function(ae,ee){H.then(function(){if(K[f]){ae(h(void 0,!0));return}K[y](ae,ee)},ee)}}var v=Object.getPrototypeOf(function(){}),S=Object.setPrototypeOf((e={get stream(){return this[g]},next:function(){var K=this,ae=this[l];if(ae!==null)return Promise.reject(ae);if(this[f])return Promise.resolve(h(void 0,!0));if(this[g].destroyed)return new Promise(function(re,Oe){t.nextTick(function(){K[l]?Oe(K[l]):re(h(void 0,!0))})});var ee=this[p],ge;if(ee)ge=new Promise(B(ee,this));else{var oe=this[g].read();if(oe!==null)return Promise.resolve(h(oe,!1));ge=new Promise(this[y])}return this[p]=ge,ge}},n(e,Symbol.asyncIterator,function(){return this}),n(e,"return",function(){var K=this;return new Promise(function(ae,ee){K[g].destroy(null,function(ge){if(ge){ee(ge);return}ae(h(void 0,!0))})})}),e),v),E=function(K){var ae,ee=Object.create(S,(ae={},n(ae,g,{value:K,writable:!0}),n(ae,i,{value:null,writable:!0}),n(ae,s,{value:null,writable:!0}),n(ae,l,{value:null,writable:!0}),n(ae,f,{value:K._readableState.endEmitted,writable:!0}),n(ae,y,{value:function(oe,re){var Oe=ee[g].read();Oe?(ee[p]=null,ee[i]=null,ee[s]=null,oe(h(Oe,!1))):(ee[i]=oe,ee[s]=re)},writable:!0}),ae));return ee[p]=null,o(K,function(ge){if(ge&&ge.code!=="ERR_STREAM_PREMATURE_CLOSE"){var oe=ee[s];oe!==null&&(ee[p]=null,ee[i]=null,ee[s]=null,oe(ge)),ee[l]=ge;return}var re=ee[i];re!==null&&(ee[p]=null,ee[i]=null,ee[s]=null,re(h(void 0,!0))),ee[f]=!0}),K.on("readable",P.bind(null,ee)),ee};return Ls=E,Ls}function Tk(){return dh||(dh=!0,Fs=function(){throw new Error("Readable.from is not available in the browser")}),Fs}function Ih(){if(ph)return Ws;ph=!0;var t=At;Ws=re;var e;re.ReadableState=oe,Tt.EventEmitter;var n=function(x,z){return x.listeners(z).length},r=Bh(),a=Rt().Buffer,o=(typeof gh<"u"?gh:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function i(b){return a.from(b)}function s(b){return a.isBuffer(b)||b instanceof o}var l=L,f;l&&l.debuglog?f=l.debuglog("stream"):f=function(){};var p=hk(),y=Eh(),g=Sh(),h=g.getHighWaterMark,w=mr().codes,P=w.ERR_INVALID_ARG_TYPE,B=w.ERR_STREAM_PUSH_AFTER_EOF,v=w.ERR_METHOD_NOT_IMPLEMENTED,S=w.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,E,H,K;Mt()(re,r);var ae=y.errorOrDestroy,ee=["error","close","destroy","pause","resume"];function ge(b,x,z){if(typeof b.prependListener=="function")return b.prependListener(x,z);!b._events||!b._events[x]?b.on(x,z):Array.isArray(b._events[x])?b._events[x].unshift(z):b._events[x]=[z,b._events[x]]}function oe(b,x,z){e=e||yr(),b=b||{},typeof z!="boolean"&&(z=x instanceof e),this.objectMode=!!b.objectMode,z&&(this.objectMode=this.objectMode||!!b.readableObjectMode),this.highWaterMark=h(this,b,"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=b.emitClose!==!1,this.autoDestroy=!!b.autoDestroy,this.destroyed=!1,this.defaultEncoding=b.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,b.encoding&&(E||(E=ti.StringDecoder),this.decoder=new E(b.encoding),this.encoding=b.encoding)}function re(b){if(e=e||yr(),!(this instanceof re))return new re(b);var x=this instanceof e;this._readableState=new oe(b,this,x),this.readable=!0,b&&(typeof b.read=="function"&&(this._read=b.read),typeof b.destroy=="function"&&(this._destroy=b.destroy)),r.call(this)}Object.defineProperty(re.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(x){this._readableState&&(this._readableState.destroyed=x)}}),re.prototype.destroy=y.destroy,re.prototype._undestroy=y.undestroy,re.prototype._destroy=function(b,x){x(b)},re.prototype.push=function(b,x){var z=this._readableState,Q;return z.objectMode?Q=!0:typeof b=="string"&&(x=x||z.defaultEncoding,x!==z.encoding&&(b=a.from(b,x),x=""),Q=!0),Oe(this,b,x,!1,Q)},re.prototype.unshift=function(b){return Oe(this,b,null,!0,!1)};function Oe(b,x,z,Q,Me){f("readableAddChunk",x);var _e=b._readableState;if(x===null)_e.reading=!1,Ue(b,_e);else{var Z;if(Me||(Z=tt(_e,x)),Z)ae(b,Z);else if(_e.objectMode||x&&x.length>0)if(typeof x!="string"&&!_e.objectMode&&Object.getPrototypeOf(x)!==a.prototype&&(x=i(x)),Q)_e.endEmitted?ae(b,new S):ze(b,_e,x,!0);else if(_e.ended)ae(b,new B);else{if(_e.destroyed)return!1;_e.reading=!1,_e.decoder&&!z?(x=_e.decoder.write(x),_e.objectMode||x.length!==0?ze(b,_e,x,!1):fe(b,_e)):ze(b,_e,x,!1)}else Q||(_e.reading=!1,fe(b,_e))}return!_e.ended&&(_e.length<_e.highWaterMark||_e.length===0)}function ze(b,x,z,Q){x.flowing&&x.length===0&&!x.sync?(x.awaitDrain=0,b.emit("data",z)):(x.length+=x.objectMode?1:z.length,Q?x.buffer.unshift(z):x.buffer.push(z),x.needReadable&&Pe(b)),fe(b,x)}function tt(b,x){var z;return!s(x)&&typeof x!="string"&&x!==void 0&&!b.objectMode&&(z=new P("chunk",["string","Buffer","Uint8Array"],x)),z}re.prototype.isPaused=function(){return this._readableState.flowing===!1},re.prototype.setEncoding=function(b){E||(E=ti.StringDecoder);var x=new E(b);this._readableState.decoder=x,this._readableState.encoding=this._readableState.decoder.encoding;for(var z=this._readableState.buffer.head,Q="";z!==null;)Q+=x.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(b){return b>=Ve?b=Ve:(b--,b|=b>>>1,b|=b>>>2,b|=b>>>4,b|=b>>>8,b|=b>>>16,b++),b}function mt(b,x){return b<=0||x.length===0&&x.ended?0:x.objectMode?1:b!==b?x.flowing&&x.length?x.buffer.head.data.length:x.length:(b>x.highWaterMark&&(x.highWaterMark=Je(b)),b<=x.length?b:x.ended?x.length:(x.needReadable=!0,0))}re.prototype.read=function(b){f("read",b),b=parseInt(b,10);var x=this._readableState,z=b;if(b!==0&&(x.emittedReadable=!1),b===0&&x.needReadable&&((x.highWaterMark!==0?x.length>=x.highWaterMark:x.length>0)||x.ended))return f("read: emitReadable",x.length,x.ended),x.length===0&&x.ended?$(this):Pe(this),null;if(b=mt(b,x),b===0&&x.ended)return x.length===0&&$(this),null;var Q=x.needReadable;f("need readable",Q),(x.length===0||x.length-b<x.highWaterMark)&&(Q=!0,f("length less than watermark",Q)),x.ended||x.reading?(Q=!1,f("reading or ended",Q)):Q&&(f("do read"),x.reading=!0,x.sync=!0,x.length===0&&(x.needReadable=!0),this._read(x.highWaterMark),x.sync=!1,x.reading||(b=mt(z,x)));var Me;return b>0?Me=k(b,x):Me=null,Me===null?(x.needReadable=x.length<=x.highWaterMark,b=0):(x.length-=b,x.awaitDrain=0),x.length===0&&(x.ended||(x.needReadable=!0),z!==b&&x.ended&&$(this)),Me!==null&&this.emit("data",Me),Me};function Ue(b,x){if(f("onEofChunk"),!x.ended){if(x.decoder){var z=x.decoder.end();z&&z.length&&(x.buffer.push(z),x.length+=x.objectMode?1:z.length)}x.ended=!0,x.sync?Pe(b):(x.needReadable=!1,x.emittedReadable||(x.emittedReadable=!0,Se(b)))}}function Pe(b){var x=b._readableState;f("emitReadable",x.needReadable,x.emittedReadable),x.needReadable=!1,x.emittedReadable||(f("emitReadable",x.flowing),x.emittedReadable=!0,t.nextTick(Se,b))}function Se(b){var x=b._readableState;f("emitReadable_",x.destroyed,x.length,x.ended),!x.destroyed&&(x.length||x.ended)&&(b.emit("readable"),x.emittedReadable=!1),x.needReadable=!x.flowing&&!x.ended&&x.length<=x.highWaterMark,A(b)}function fe(b,x){x.readingMore||(x.readingMore=!0,t.nextTick(ve,b,x))}function ve(b,x){for(;!x.reading&&!x.ended&&(x.length<x.highWaterMark||x.flowing&&x.length===0);){var z=x.length;if(f("maybeReadMore read 0"),b.read(0),z===x.length)break}x.readingMore=!1}re.prototype._read=function(b){ae(this,new v("_read()"))},re.prototype.pipe=function(b,x){var z=this,Q=this._readableState;switch(Q.pipesCount){case 0:Q.pipes=b;break;case 1:Q.pipes=[Q.pipes,b];break;default:Q.pipes.push(b);break}Q.pipesCount+=1,f("pipe count=%d opts=%j",Q.pipesCount,x);var Me=(!x||x.end!==!1)&&b!==t.stdout&&b!==t.stderr,_e=Me?kt:u;Q.endEmitted?t.nextTick(_e):z.once("end",_e),b.on("unpipe",Z);function Z(c,T){f("onunpipe"),c===z&&T&&T.hasUnpiped===!1&&(T.hasUnpiped=!0,Tr())}function kt(){f("onend"),b.end()}var Ot=D(z);b.on("drain",Ot);var wt=!1;function Tr(){f("cleanup"),b.removeListener("close",_r),b.removeListener("finish",m),b.removeListener("drain",Ot),b.removeListener("error",Bt),b.removeListener("unpipe",Z),z.removeListener("end",kt),z.removeListener("end",u),z.removeListener("data",li),wt=!0,Q.awaitDrain&&(!b._writableState||b._writableState.needDrain)&&Ot()}z.on("data",li);function li(c){f("ondata");var T=b.write(c);f("dest.write",T),T===!1&&((Q.pipesCount===1&&Q.pipes===b||Q.pipesCount>1&&ie(Q.pipes,b)!==-1)&&!wt&&(f("false write response, pause",Q.awaitDrain),Q.awaitDrain++),z.pause())}function Bt(c){f("onerror",c),u(),b.removeListener("error",Bt),n(b,"error")===0&&ae(b,c)}ge(b,"error",Bt);function _r(){b.removeListener("finish",m),u()}b.once("close",_r);function m(){f("onfinish"),b.removeListener("close",_r),u()}b.once("finish",m);function u(){f("unpipe"),z.unpipe(b)}return b.emit("pipe",z),Q.flowing||(f("pipe resume"),z.resume()),b};function D(b){return function(){var z=b._readableState;f("pipeOnDrain",z.awaitDrain),z.awaitDrain&&z.awaitDrain--,z.awaitDrain===0&&n(b,"data")&&(z.flowing=!0,A(b))}}re.prototype.unpipe=function(b){var x=this._readableState,z={hasUnpiped:!1};if(x.pipesCount===0)return this;if(x.pipesCount===1)return b&&b!==x.pipes?this:(b||(b=x.pipes),x.pipes=null,x.pipesCount=0,x.flowing=!1,b&&b.emit("unpipe",this,z),this);if(!b){var Q=x.pipes,Me=x.pipesCount;x.pipes=null,x.pipesCount=0,x.flowing=!1;for(var _e=0;_e<Me;_e++)Q[_e].emit("unpipe",this,{hasUnpiped:!1});return this}var Z=ie(x.pipes,b);return Z===-1?this:(x.pipes.splice(Z,1),x.pipesCount-=1,x.pipesCount===1&&(x.pipes=x.pipes[0]),b.emit("unpipe",this,z),this)},re.prototype.on=function(b,x){var z=r.prototype.on.call(this,b,x),Q=this._readableState;return b==="data"?(Q.readableListening=this.listenerCount("readable")>0,Q.flowing!==!1&&this.resume()):b==="readable"&&!Q.endEmitted&&!Q.readableListening&&(Q.readableListening=Q.needReadable=!0,Q.flowing=!1,Q.emittedReadable=!1,f("on readable",Q.length,Q.reading),Q.length?Pe(this):Q.reading||t.nextTick(F,this)),z},re.prototype.addListener=re.prototype.on,re.prototype.removeListener=function(b,x){var z=r.prototype.removeListener.call(this,b,x);return b==="readable"&&t.nextTick(j,this),z},re.prototype.removeAllListeners=function(b){var x=r.prototype.removeAllListeners.apply(this,arguments);return(b==="readable"||b===void 0)&&t.nextTick(j,this),x};function j(b){var x=b._readableState;x.readableListening=b.listenerCount("readable")>0,x.resumeScheduled&&!x.paused?x.flowing=!0:b.listenerCount("data")>0&&b.resume()}function F(b){f("readable nexttick read 0"),b.read(0)}re.prototype.resume=function(){var b=this._readableState;return b.flowing||(f("resume"),b.flowing=!b.readableListening,de(this,b)),b.paused=!1,this};function de(b,x){x.resumeScheduled||(x.resumeScheduled=!0,t.nextTick(Te,b,x))}function Te(b,x){f("resume",x.reading),x.reading||b.read(0),x.resumeScheduled=!1,b.emit("resume"),A(b),x.flowing&&!x.reading&&b.read(0)}re.prototype.pause=function(){return f("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(f("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function A(b){var x=b._readableState;for(f("flow",x.flowing);x.flowing&&b.read()!==null;);}re.prototype.wrap=function(b){var x=this,z=this._readableState,Q=!1;b.on("end",function(){if(f("wrapped end"),z.decoder&&!z.ended){var Z=z.decoder.end();Z&&Z.length&&x.push(Z)}x.push(null)}),b.on("data",function(Z){if(f("wrapped data"),z.decoder&&(Z=z.decoder.write(Z)),!(z.objectMode&&Z==null)&&!(!z.objectMode&&(!Z||!Z.length))){var kt=x.push(Z);kt||(Q=!0,b.pause())}});for(var Me in b)this[Me]===void 0&&typeof b[Me]=="function"&&(this[Me]=function(kt){return function(){return b[kt].apply(b,arguments)}}(Me));for(var _e=0;_e<ee.length;_e++)b.on(ee[_e],this.emit.bind(this,ee[_e]));return this._read=function(Z){f("wrapped _read",Z),Q&&(Q=!1,b.resume())},this},typeof Symbol=="function"&&(re.prototype[Symbol.asyncIterator]=function(){return H===void 0&&(H=vk()),H(this)}),Object.defineProperty(re.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(re.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(re.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(x){this._readableState&&(this._readableState.flowing=x)}}),re._fromList=k,Object.defineProperty(re.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function k(b,x){if(x.length===0)return null;var z;return x.objectMode?z=x.buffer.shift():!b||b>=x.length?(x.decoder?z=x.buffer.join(""):x.buffer.length===1?z=x.buffer.first():z=x.buffer.concat(x.length),x.buffer.clear()):z=x.buffer.consume(b,x.decoder),z}function $(b){var x=b._readableState;f("endReadable",x.endEmitted),x.endEmitted||(x.ended=!0,t.nextTick(X,x,b))}function X(b,x){if(f("endReadableNT",b.endEmitted,b.length),!b.endEmitted&&b.length===0&&(b.endEmitted=!0,x.readable=!1,x.emit("end"),b.autoDestroy)){var z=x._writableState;(!z||z.autoDestroy&&z.finished)&&x.destroy()}}typeof Symbol=="function"&&(re.from=function(b,x){return K===void 0&&(K=Tk()),K(re,b,x)});function ie(b,x){for(var z=0,Q=b.length;z<Q;z++)if(b[z]===x)return z;return-1}return Ws}function Ah(){if(yh)return zs;yh=!0,zs=s;var t=mr().codes,e=t.ERR_METHOD_NOT_IMPLEMENTED,n=t.ERR_MULTIPLE_CALLBACK,r=t.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=t.ERR_TRANSFORM_WITH_LENGTH_0,o=yr();Mt()(s,o);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 w=this._readableState;w.reading=!1,(w.needReadable||w.length<w.highWaterMark)&&this._read(w.highWaterMark)}function s(p){if(!(this instanceof s))return new s(p);o.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){f(p,y,g)}):f(this,null,null)}s.prototype.push=function(p,y){return this._transformState.needTransform=!1,o.prototype.push.call(this,p,y)},s.prototype._transform=function(p,y,g){g(new e("_transform()"))},s.prototype._write=function(p,y,g){var h=this._transformState;if(h.writecb=g,h.writechunk=p,h.writeencoding=y,!h.transforming){var w=this._readableState;(h.needTransform||w.needReadable||w.length<w.highWaterMark)&&this._read(w.highWaterMark)}},s.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},s.prototype._destroy=function(p,y){o.prototype._destroy.call(this,p,function(g){y(g)})};function f(p,y,g){if(y)return p.emit("error",y);if(g!=null&&p.push(g),p._writableState.length)throw new a;if(p._transformState.transforming)throw new r;return p.push(null)}return zs}function _k(){if(mh)return qs;mh=!0,qs=e;var t=Ah();Mt()(e,t);function e(n){if(!(this instanceof e))return new e(n);t.call(this,n)}return e.prototype._transform=function(n,r,a){a(null,n)},qs}function bk(){if(hh)return Gs;hh=!0;var t;function e(g){var h=!1;return function(){h||(h=!0,g.apply(void 0,arguments))}}var n=mr().codes,r=n.ERR_MISSING_ARGS,a=n.ERR_STREAM_DESTROYED;function o(g){if(g)throw g}function i(g){return g.setHeader&&typeof g.abort=="function"}function s(g,h,w,P){P=e(P);var B=!1;g.on("close",function(){B=!0}),t===void 0&&(t=Qs()),t(g,{readable:h,writable:w},function(S){if(S)return P(S);B=!0,P()});var v=!1;return function(S){if(!B&&!v){if(v=!0,i(g))return g.abort();if(typeof g.destroy=="function")return g.destroy();P(S||new a("pipe"))}}}function l(g){g()}function f(g,h){return g.pipe(h)}function p(g){return!g.length||typeof g[g.length-1]!="function"?o:g.pop()}function y(){for(var g=arguments.length,h=new Array(g),w=0;w<g;w++)h[w]=arguments[w];var P=p(h);if(Array.isArray(h[0])&&(h=h[0]),h.length<2)throw new r("streams");var B,v=h.map(function(S,E){var H=E<h.length-1,K=E>0;return s(S,H,K,function(ae){B||(B=ae),ae&&v.forEach(l),!H&&(v.forEach(l),P(B))})});return h.reduce(f)}return Gs=y,Gs}function Ch(){return vh||(vh=!0,bt=bt=Ih(),bt.Stream=bt,bt.Readable=bt,bt.Writable=kh(),bt.Duplex=yr(),bt.Transform=Ah(),bt.PassThrough=_k(),bt.finished=Qs(),bt.pipeline=bk()),bt}function Oh(){if(Th)return Fa;Th=!0;var t=Rt().Buffer,e=At,n=Ph(),r=Mt(),a=Ch(),o=Fa.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},i=Fa.IncomingMessage=function(s,l,f,p){var y=this||Wa;if(a.Readable.call(y),y._mode=f,y.headers={},y.rawHeaders=[],y.trailers={},y.rawTrailers=[],y.on("end",function(){e.nextTick(function(){y.emit("close")})}),f==="fetch"){let v=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)),v()}}).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();v()}else{y._xhr=s,y._pos=0,y.url=s.responseURL,y.statusCode=s.status,y.statusMessage=s.statusText;var w=s.getAllResponseHeaders().split(/\r?\n/);if(w.forEach(function(v){var S=v.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 P=y.rawHeaders["mime-type"];if(P){var B=P.match(/;\s*charset=([^;])(;|$)/);B&&(y._charset=B[1].toLowerCase())}y._charset||(y._charset="utf-8")}}};return r(i,a.Readable),i.prototype._read=function(){var s=this||Wa,l=s._resumeFetch;l&&(s._resumeFetch=null,l())},i.prototype._onXHRProgress=function(s){var l=this||Wa,f=l._xhr,p=null;switch(l._mode){case"text":if(p=f.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(f.readyState!==o.DONE||!f.response)break;p=f.response,l.push(t.from(new Uint8Array(p)));break;case"moz-chunked-arraybuffer":if(p=f.response,f.readyState!==o.LOADING||!p)break;l.push(t.from(new Uint8Array(p)));break;case"ms-stream":if(p=f.response,f.readyState!==o.LOADING)break;var w=new Wa.MSStreamReader;w.onprogress=function(){w.result.byteLength>l._pos&&(l.push(t.from(new Uint8Array(w.result.slice(l._pos)))),l._pos=w.result.byteLength)},w.onload=function(){s(!0),l.push(null)},w.readAsArrayBuffer(p);break}l._xhr.readyState===o.DONE&&l._mode!=="ms-stream"&&(s(!0),l.push(null))},Fa}function wk(){if(_h)return Vs;_h=!0;var t=Rt().Buffer,e=At,n=Ph(),r=Mt(),a=Oh(),o=Ch(),i=a.IncomingMessage,s=a.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 f=Vs=function(g){var h=this||at;o.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 w,P=!0;if(g.mode==="disable-fetch"||"requestTimeout"in g&&!n.abortController)P=!1,w=!0;else if(g.mode==="prefer-streaming")w=!1;else if(g.mode==="allow-wrong-content-type")w=!n.overrideMimeType;else if(!g.mode||g.mode==="default"||g.mode==="prefer-fast")w=!0;else throw new Error("Invalid value for opts.mode");h._mode=l(w,P),h._fetchTimer=null,h._socketTimeout=null,h._socketTimer=null,h.on("finish",function(){h._onFinish()})};r(f,o.Writable),f.prototype.setHeader=function(g,h){var w=this||at,P=g.toLowerCase();y.indexOf(P)===-1&&(w._headers[P]={name:g,value:h})},f.prototype.getHeader=function(g){var h=(this||at)._headers[g.toLowerCase()];return h?h.value:null},f.prototype.removeHeader=function(g){var h=this||at;delete h._headers[g.toLowerCase()]},f.prototype._onFinish=function(){var g=this||at;if(!g._destroyed){var h=g._opts;"timeout"in h&&h.timeout!==0&&g.setTimeout(h.timeout);var w=g._headers,P=null;h.method!=="GET"&&h.method!=="HEAD"&&(P=new Blob(g._body,{type:(w["content-type"]||{}).value||""}));var B=[];if(Object.keys(w).forEach(function(H){var K=w[H].name,ae=w[H].value;Array.isArray(ae)?ae.forEach(function(ee){B.push([K,ee])}):B.push([K,ae])}),g._mode==="fetch"){var v=null;if(n.abortController){var S=new AbortController;v=S.signal,g._fetchAbortController=S,"requestTimeout"in h&&h.requestTimeout!==0&&(g._fetchTimer=at.setTimeout(function(){g.emit("requestTimeout"),g._fetchAbortController&&g._fetchAbortController.abort()},h.requestTimeout))}at.fetch(g._opts.url,{method:g._opts.method,headers:B,body:P||void 0,mode:"cors",credentials:h.withCredentials?"include":"same-origin",signal:v}).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 at.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 s.LOADING:case s.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(P)}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}}f.prototype._onXHRProgress=function(){var g=this||at;g._resetTimers(!1),!(!p(g._xhr)||g._destroyed)&&(g._response||g._connect(),g._response._onXHRProgress(g._resetTimers.bind(g)))},f.prototype._connect=function(){var g=this||at;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))},f.prototype._write=function(g,h,w){var P=this||at;P._body.push(g),w()},f.prototype._resetTimers=function(g){var h=this||at;at.clearTimeout(h._socketTimer),h._socketTimer=null,g?(at.clearTimeout(h._fetchTimer),h._fetchTimer=null):h._socketTimeout&&(h._socketTimer=at.setTimeout(function(){h.emit("timeout")},h._socketTimeout))},f.prototype.abort=f.prototype.destroy=function(g){var h=this||at;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)},f.prototype.end=function(g,h,w){var P=this||at;typeof g=="function"&&(w=g,g=void 0),o.Writable.prototype.end.call(P,g,h,w)},f.prototype.setTimeout=function(g,h){var w=this||at;h&&w.once("timeout",h),w._socketTimeout=g,w._resetTimers(!1)},f.prototype.flushHeaders=function(){},f.prototype.setNoDelay=function(){},f.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 Vs}function xk(){if(bh)return Js;bh=!0,Js=e;var t=Object.prototype.hasOwnProperty;function e(){for(var n={},r=0;r<arguments.length;r++){var a=arguments[r];for(var o in a)t.call(a,o)&&(n[o]=a[o])}return n}return Js}function Pk(){return wh||(wh=!0,Xs={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"}),Xs}function Ek(){if(xh)return Ys;xh=!0;var t=wk(),e=Oh(),n=xk(),r=Pk(),a=De,o=Ys;return o.request=function(i,s){typeof i=="string"?i=a.parse(i):i=n(i);var l=Bk.location.protocol.search(/^https?:$/)===-1?"http:":"",f=i.protocol||l,p=i.hostname||i.host,y=i.port,g=i.path||"/";p&&p.indexOf(":")!==-1&&(p="["+p+"]"),i.url=(p?f+"//"+p:"")+(y?":"+y:"")+g,i.method=(i.method||"GET").toUpperCase(),i.headers=i.headers||{};var h=new t(i);return s&&h.on("response",s),h},o.get=function(s,l){var f=o.request(s,l);return f.end(),f},o.ClientRequest=t,o.IncomingMessage=e.IncomingMessage,o.Agent=function(){},o.Agent.defaultMaxSockets=4,o.globalAgent=new o.Agent,o.STATUS_CODES=r,o.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"],Ys}var Pt,th,$n,Ns,nh,Ds,rh,Hs,ih,Us,ah,Zs,oh,$s,sh,lh,js,uh,Ks,ch,Ls,fh,Fs,dh,Ws,ph,gh,zs,yh,qs,mh,Gs,hh,bt,vh,Fa,Th,Wa,Vs,_h,at,Js,bh,Xs,wh,Ys,xh,Bk,Yt,Sk,kk,Ik,Ak,Ck,Ok,Rk,Mk,Mh=ot(()=>{C();R();O();is();Vy();as();pi();Cm();Ka();bs();Dm();Zm();eh();Es();Pt={},th=!1,$n=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ns={},nh=!1;Ds={},rh=!1;Hs={},ih=!1;Us={},ah=!1;Zs={},oh=!1;$s={},sh=!1,lh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;js={},uh=!1;Ks={},ch=!1;Ls={},fh=!1;Fs={},dh=!1;Ws={},ph=!1,gh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;zs={},yh=!1;qs={},mh=!1;Gs={},hh=!1;bt={},vh=!1;Fa={},Th=!1,Wa=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Vs={},_h=!1,at=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Js={},bh=!1;Xs={},wh=!1;Ys={},xh=!1,Bk=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Yt=Ek(),Sk=Yt.Agent,kk=Yt.ClientRequest,Ik=Yt.IncomingMessage,Ak=Yt.METHODS,Ck=Yt.STATUS_CODES,Ok=Yt.get,Rk=Yt.globalAgent,Mk=Yt.request});C();R();O();var Cy={};Wn(Cy,{defaults:()=>MB,markdown:()=>RB});C();R();O();C();R();O();C();R();O();var Bo=Object.defineProperty,Fv=Object.defineProperties,Wv=Object.getOwnPropertyDescriptors,Bi=Object.getOwnPropertySymbols,Xc=Object.prototype.hasOwnProperty,Yc=Object.prototype.propertyIsEnumerable,gc=(t,e,n)=>e in t?Bo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,_=(t,e)=>{for(var n in e||(e={}))Xc.call(e,n)&&gc(t,n,e[n]);if(Bi)for(var n of Bi(e))Yc.call(e,n)&&gc(t,n,e[n]);return t},N=(t,e)=>Fv(t,Wv(e)),d=(t,e)=>Bo(t,"name",{value:e,configurable:!0}),Qc=(t,e)=>{var n={};for(var r in t)Xc.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Bi)for(var r of Bi(t))e.indexOf(r)<0&&Yc.call(t,r)&&(n[r]=t[r]);return n},oa=(t,e)=>{for(var n in e)Bo(t,n,{get:e[n],enumerable:!0})},zv={};oa(zv,{errors:()=>rf,fromJSONSchema:()=>Vg,fromJSONSchemaLegacy:()=>rB,fromObject:()=>xo,toJSONSchema:()=>st,toJSONSchemaLegacy:()=>IB,toTypescriptSchema:()=>Ho,toTypescriptType:()=>Eo});var Y={};oa(Y,{BRAND:()=>Rx,DIRTY:()=>Xn,EMPTY_PATH:()=>Ix,INVALID:()=>pe,NEVER:()=>RP,OK:()=>pt,ParseInputLazyPath:()=>It,ParseStatus:()=>vt,Schema:()=>he,ZodAny:()=>Fr,ZodArray:()=>Wr,ZodBigInt:()=>jo,ZodBoolean:()=>Ko,ZodBranded:()=>Lo,ZodCatch:()=>Fo,ZodDate:()=>Wo,ZodDefault:()=>ha,ZodDiscriminatedUnion:()=>fg,ZodEffects:()=>En,ZodEnum:()=>or,ZodError:()=>Kt,ZodFirstPartyTypeKind:()=>Yp,ZodFunction:()=>pg,ZodIntersection:()=>qo,ZodIssueCode:()=>G,ZodLazy:()=>Go,ZodLiteral:()=>Vo,ZodMap:()=>yg,ZodNaN:()=>hg,ZodNativeEnum:()=>Jo,ZodNever:()=>Gr,ZodNull:()=>Xo,ZodNullable:()=>tr,ZodNumber:()=>Yo,ZodObject:()=>nr,ZodOptional:()=>an,ZodParsedType:()=>ne,ZodPipeline:()=>Qo,ZodPromise:()=>Ta,ZodReadonly:()=>_a,ZodRecord:()=>Pg,ZodRef:()=>Eg,ZodSchema:()=>he,ZodSet:()=>Sg,ZodString:()=>gt,ZodSymbol:()=>Ug,ZodTransformer:()=>En,ZodTuple:()=>ir,ZodType:()=>he,ZodUndefined:()=>ba,ZodUnion:()=>es,ZodUnknown:()=>Ur,ZodVoid:()=>Kg,addIssueToContext:()=>te,agent:()=>$x,aimodel:()=>Wx,any:()=>nP,array:()=>oP,bigint:()=>Xx,boolean:()=>Wg,coerce:()=>OP,conversation:()=>Hx,createZodEnum:()=>va,cuid2Regex:()=>Ig,cuidRegex:()=>kg,custom:()=>ug,datasource:()=>zx,date:()=>Yx,default:()=>EP,discriminatedUnion:()=>cP,effect:()=>Gc,emailRegex:()=>Og,enum:()=>bP,errorUtil:()=>ue,event:()=>jx,function:()=>vP,getErrorMap:()=>Kr,getParsedType:()=>rn,instanceof:()=>Vx,intent:()=>Fx,intersection:()=>fP,ipv4Regex:()=>Mg,ipv6Regex:()=>Ng,isAborted:()=>_o,isAsync:()=>ki,isDirty:()=>bo,isEmojiRegex:()=>Mx,isValid:()=>Lr,knowledgebase:()=>qx,late:()=>Gx,lazy:()=>TP,literal:()=>_P,makeIssue:()=>Si,map:()=>mP,message:()=>Zx,nan:()=>Jx,nativeEnum:()=>wP,never:()=>iP,null:()=>tP,nullable:()=>BP,number:()=>Fg,object:()=>sP,objectUtil:()=>To,oboolean:()=>CP,onumber:()=>AP,optional:()=>PP,ostring:()=>IP,pipeline:()=>kP,preprocess:()=>SP,processCreateParams:()=>me,promise:()=>xP,quotelessJson:()=>kx,readonly:()=>yP,record:()=>pP,ref:()=>gP,set:()=>hP,setErrorMap:()=>tg,strictObject:()=>lP,string:()=>Lg,symbol:()=>Qx,table:()=>Kx,tablerow:()=>Lx,transformer:()=>Gc,tuple:()=>dP,ulidRegex:()=>Ag,undefined:()=>eP,union:()=>uP,unknown:()=>rP,user:()=>Ux,util:()=>be,uuidRegex:()=>Cg,variable:()=>Dx,void:()=>aP});var le="x-zui";function ef(t){return typeof t=="symbol"?"symbol":typeof t=="bigint"?`${t.toString()}n`:se(t)}d(ef,"primitiveToTypscriptLiteralType");function se(t){return typeof t>"u"?"undefined":typeof t=="symbol"?t.description?`Symbol(${se(t.description)})`:"Symbol()":typeof t=="bigint"?`BigInt(${t.toString()})`:JSON.stringify(t)}d(se,"primitiveToTypescriptValue");function Yn(t){return typeof t>"u"?"undefined":JSON.stringify(t)}d(Yn,"unknownToTypescriptValue");var tf=d((t,e)=>{let n=Object.entries(t),r=e?" as const":"";return`{ ${n.map(([a,o])=>`${uo(a)}: ${Yn(o)}`).join(", ")} }${r}`},"recordOfUnknownToTypescriptRecord"),uo=d(t=>/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t)?t:se(t),"toPropertyKey"),qv=d(t=>t.charAt(0).toUpperCase()+t.slice(1),"capitalize"),nf=d(t=>{let e=/[^a-zA-Z0-9_]/g;return t.split(e).map(qv).filter(r=>!!r).join("")},"toTypeArgumentName"),nt=d(t=>{let e=(t??"").split(`
9
+ `).map((function(f){return" "+f})).join(`
10
+ `)):s=t.stylize("[Circular]","special")),Dn(i)){if(a&&o.match(/^\d+$/))return s;(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+": "+s}function km(t){return Array.isArray(t)}function ps(t){return typeof t=="boolean"}function jo(t){return t===null}function Im(t){return typeof t=="number"}function Uo(t){return typeof t=="string"}function Dn(t){return t===void 0}function Gr(t){return sr(t)&&gs(t)==="[object RegExp]"}function sr(t){return typeof t=="object"&&t!==null}function Zo(t){return sr(t)&&gs(t)==="[object Date]"}function Vr(t){return sr(t)&&(gs(t)==="[object Error]"||t instanceof Error)}function Ro(t){return typeof t=="function"}function gs(t){return Object.prototype.toString.call(t)}function ls(t){return t<10?"0"+t.toString(10):t.toString(10)}function aE(){var t=new Date,e=[ls(t.getHours()),ls(t.getMinutes()),ls(t.getSeconds())].join(":");return[t.getDate(),oE[t.getMonth()],e].join(" ")}function Am(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function sE(t,e){if(!t){var n=new Error("Promise was rejected with a falsy value");n.reason=t,t=n}return e(t)}var lm,qt,Gt,ar,Qe,Nn,Vt,or,Oo,je,HB,fs,$o,fm,UB,ZB,$B,jB,KB,dm,pm,Xy,LB,FB,WB,gm,Ee,zB,qB,GB,ym,ds,xt,_t,VB,We,XB,YB,QB,qr,L,Nt,sm,nE,Ao,Sm,Co,oE,Mn,_C,Ko=at(()=>{C();R();O();ar=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,Qe=lm={};(function(){try{qt=typeof setTimeout=="function"?setTimeout:us}catch{qt=us}try{Gt=typeof clearTimeout=="function"?clearTimeout:cs}catch{Gt=cs}})();Vt=[],or=!1,Oo=-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];Vt.push(new Jy(t,e)),Vt.length!==1||or||um(cm)},Jy.prototype.run=function(){(this||ar).fun.apply(null,(this||ar).array)},Qe.title="browser",Qe.browser=!0,Qe.env={},Qe.argv=[],Qe.version="",Qe.versions={},Qe.on=zt,Qe.addListener=zt,Qe.once=zt,Qe.off=zt,Qe.removeListener=zt,Qe.removeAllListeners=zt,Qe.emit=zt,Qe.prependListener=zt,Qe.prependOnceListener=zt,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};je=lm;je.addListener;je.argv;je.binding;je.browser;je.chdir;je.cwd;je.emit;je.env;je.listeners;je.nextTick;je.off;je.on;je.once;je.prependListener;je.prependOnceListener;je.removeAllListeners;je.removeListener;je.title;je.umask;je.version;je.versions;HB=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",fs=Object.prototype.toString,$o=function(t){return!(HB&&t&&typeof t=="object"&&Symbol.toStringTag in t)&&fs.call(t)==="[object Arguments]"},fm=function(t){return!!$o(t)||t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&fs.call(t)!=="[object Array]"&&fs.call(t.callee)==="[object Function]"},UB=(function(){return $o(arguments)})();$o.isLegacyArguments=fm;ZB=UB?$o:fm,$B=Object.prototype.toString,jB=Function.prototype.toString,KB=/^\s*(?:function)?\*/,dm=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",pm=Object.getPrototypeOf,Xy=(function(){if(!dm)return!1;try{return Function("return function*() {}")()}catch{}})(),LB=Xy?pm(Xy):{},FB=function(t){return typeof t=="function"&&(!!KB.test(jB.call(t))||(dm?pm(t)===LB:$B.call(t)==="[object GeneratorFunction]"))},WB=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}},gm=function(t){return t&&typeof t=="object"&&typeof t.copy=="function"&&typeof t.fill=="function"&&typeof t.readUInt8=="function"},Ee={},zB=gm,qB=ZB,GB=FB;ym=typeof BigInt<"u",ds=typeof Symbol<"u",xt=ds&&Symbol.toStringTag!==void 0,_t=typeof Uint8Array<"u",VB=typeof ArrayBuffer<"u";if(_t&&xt)var JB=Object.getPrototypeOf(Uint8Array.prototype),Et=Hn(Object.getOwnPropertyDescriptor(JB,Symbol.toStringTag).get);We=Hn(Object.prototype.toString),XB=Hn(Number.prototype.valueOf),YB=Hn(String.prototype.valueOf),QB=Hn(Boolean.prototype.valueOf);if(ym)var eE=Hn(BigInt.prototype.valueOf);if(ds)var tE=Hn(Symbol.prototype.valueOf);Ee.isArgumentsObject=qB,Ee.isGeneratorFunction=GB,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 VB&&ArrayBuffer.isView?ArrayBuffer.isView(t):Yy(t)||em(t)},Ee.isTypedArray=Yy,Ee.isUint8Array=mm,Ee.isUint8ClampedArray=hm,Ee.isUint16Array=vm,Ee.isUint32Array=Tm,Ee.isInt8Array=_m,Ee.isInt16Array=bm,Ee.isInt32Array=wm,Ee.isFloat32Array=xm,Ee.isFloat64Array=Pm,Ee.isBigInt64Array=Bm,Ee.isBigUint64Array=Em,So.working=typeof Map<"u"&&So(new Map),Ee.isMap=function(t){return typeof Map<"u"&&(So.working?So(t):t instanceof Map)},ko.working=typeof Set<"u"&&ko(new Set),Ee.isSet=function(t){return typeof Set<"u"&&(ko.working?ko(t):t instanceof Set)},Io.working=typeof WeakMap<"u"&&Io(new WeakMap),Ee.isWeakMap=function(t){return typeof WeakMap<"u"&&(Io.working?Io(t):t instanceof WeakMap)},os.working=typeof WeakSet<"u"&&os(new WeakSet),Ee.isWeakSet=function(t){return os(t)},Mo.working=typeof ArrayBuffer<"u"&&Mo(new ArrayBuffer),Ee.isArrayBuffer=Qy,No.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&No(new DataView(new ArrayBuffer(1),0,1)),Ee.isDataView=em,Do.working=typeof SharedArrayBuffer<"u"&&Do(new SharedArrayBuffer),Ee.isSharedArrayBuffer=tm,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=nm,Ee.isStringObject=rm,Ee.isBooleanObject=im,Ee.isBigIntObject=om,Ee.isSymbolObject=am,Ee.isBoxedPrimitive=function(t){return nm(t)||rm(t)||im(t)||om(t)||am(t)},Ee.isAnyArrayBuffer=function(t){return _t&&(Qy(t)||tm(t))},["isProxy","isExternal","isModuleNamespaceObject"].forEach((function(t){Object.defineProperty(Ee,t,{enumerable:!1,value:function(){throw new Error(t+" is not supported in userland")}})}));qr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,L={},Nt=je,sm=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},nE=/%[sdj%]/g;L.format=function(t){if(!Uo(t)){for(var e=[],n=0;n<arguments.length;n++)e.push(ln(arguments[n]));return e.join(" ")}n=1;for(var r=arguments,o=r.length,a=String(t).replace(nE,(function(s){if(s==="%%")return"%";if(n>=o)return s;switch(s){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 s}})),i=r[n];n<o;i=r[++n])jo(i)||!sr(i)?a+=" "+i:a+=" "+ln(i);return a},L.deprecate=function(t,e){if(Nt!==void 0&&Nt.noDeprecation===!0)return t;if(Nt===void 0)return function(){return L.deprecate(t,e).apply(this||qr,arguments)};var n=!1;return function(){if(!n){if(Nt.throwDeprecation)throw new Error(e);Nt.traceDeprecation?console.trace(e):console.error(e),n=!0}return t.apply(this||qr,arguments)}};Ao={},Sm=/^$/;Nt.env.NODE_DEBUG&&(Co=Nt.env.NODE_DEBUG,Co=Co.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),Sm=new RegExp("^"+Co+"$","i"));L.debuglog=function(t){if(t=t.toUpperCase(),!Ao[t])if(Sm.test(t)){var e=Nt.pid;Ao[t]=function(){var n=L.format.apply(L,arguments);console.error("%s %d: %s",t,e,n)}}else Ao[t]=function(){};return Ao[t]},L.inspect=ln,ln.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]},ln.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},L.types=Ee,L.isArray=km,L.isBoolean=ps,L.isNull=jo,L.isNullOrUndefined=function(t){return t==null},L.isNumber=Im,L.isString=Uo,L.isSymbol=function(t){return typeof t=="symbol"},L.isUndefined=Dn,L.isRegExp=Gr,L.types.isRegExp=Gr,L.isObject=sr,L.isDate=Zo,L.types.isDate=Zo,L.isError=Vr,L.types.isNativeError=Vr,L.isFunction=Ro,L.isPrimitive=function(t){return t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||typeof t=="symbol"||t===void 0},L.isBuffer=gm;oE=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];L.log=function(){console.log("%s - %s",aE(),L.format.apply(L,arguments))},L.inherits=WB,L._extend=function(t,e){if(!e||!sr(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t};Mn=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(Mn&&t[Mn]){var e;if(typeof(e=t[Mn])!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,Mn,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var n,r,o=new Promise((function(s,l){n=s,r=l})),a=[],i=0;i<arguments.length;i++)a.push(arguments[i]);a.push((function(s,l){s?r(s):n(l)}));try{t.apply(this||qr,a)}catch(s){r(s)}return o}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Mn&&Object.defineProperty(e,Mn,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,sm(t))},L.promisify.custom=Mn,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 a=this||qr,i=function(){return o.apply(a,arguments)};t.apply(this||qr,n).then((function(s){Nt.nextTick(i.bind(null,null,s))}),(function(s){Nt.nextTick(sE.bind(null,s,i))}))}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Object.defineProperties(e,sm(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;_C=L.promisify;L.types});var EC,Cm=at(()=>{C();R();O();Ko();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;EC=L.promisify;L.types;L.TextEncoder=globalThis.TextEncoder;L.TextDecoder=globalThis.TextDecoder});function vs(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function lE(){!lr||!Un||(lr=!1,Un.length?Jt=Un.concat(Jt):Lo=-1,Jt.length&&Om())}function Om(){if(!lr){var t=setTimeout(lE,0);lr=!0;for(var e=Jt.length;e;){for(Un=Jt,Jt=[];++Lo<e;)Un&&Un[Lo].run();Lo=-1,e=Jt.length}Un=null,lr=!1,clearTimeout(t)}}function uE(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];Jt.push(new Rm(t,e)),Jt.length===1&&!lr&&setTimeout(Om,0)}function Rm(t,e){this.fun=t,this.array=e}function ct(){}function EE(t){vs("_linkedBinding")}function AE(t){vs("dlopen")}function CE(){return[]}function OE(){return[]}function jE(t,e){if(!t)throw new Error(e||"assertion error")}function WE(){return!1}function lS(){return un.now()/1e3}function hs(t){var e=Math.floor((Date.now()-un.now())*.001),n=un.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+=ms)),[r,o]}function cn(){return At}function _S(t){return[]}var Jt,lr,Un,Lo,cE,fE,dE,pE,gE,yE,mE,hE,vE,TE,_E,bE,wE,xE,PE,BE,SE,kE,IE,RE,ME,Ts,NE,DE,HE,UE,ZE,$E,KE,LE,FE,zE,qE,GE,VE,JE,XE,YE,QE,eS,tS,nS,rS,iS,oS,aS,sS,un,ys,ms,uS,cS,fS,dS,pS,gS,yS,mS,hS,vS,TS,At,_s=at(()=>{C();R();O();Jt=[],lr=!1,Lo=-1;Rm.prototype.run=function(){this.fun.apply(null,this.array)};cE="browser",fE="x64",dE="browser",pE={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},gE=["/usr/bin/node"],yE=[],mE="v16.8.0",hE={},vE=function(t,e){console.warn((e?e+": ":"")+t)},TE=function(t){vs("binding")},_E=function(t){return 0},bE=function(){return"/"},wE=function(t){},xE={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};PE=ct,BE=[];SE={},kE=!1,IE={};RE=ct,ME=ct,Ts=function(){return{}},NE=Ts,DE=Ts,HE=ct,UE=ct,ZE=ct,$E={};KE={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},LE=ct,FE=ct;zE=ct,qE=ct,GE=ct,VE=ct,JE=ct,XE=void 0,YE=void 0,QE=void 0,eS=ct,tS=2,nS=1,rS="/bin/usr/node",iS=9229,oS="node",aS=[],sS=ct,un={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};un.now===void 0&&(ys=Date.now(),un.timing&&un.timing.navigationStart&&(ys=un.timing.navigationStart),un.now=()=>Date.now()-ys);ms=1e9;hs.bigint=function(t){var e=hs(t);return typeof BigInt>"u"?e[0]*ms+e[1]:BigInt(e[0]*ms)+BigInt(e[1])};uS=10,cS={},fS=0;dS=cn,pS=cn,gS=cn,yS=cn,mS=cn,hS=ct,vS=cn,TS=cn;At={version:mE,versions:hE,arch:fE,platform:dE,release:xE,_rawDebug:PE,moduleLoadList:BE,binding:TE,_linkedBinding:EE,_events:cS,_eventsCount:fS,_maxListeners:uS,on:cn,addListener:dS,once:pS,off:gS,removeListener:yS,removeAllListeners:mS,emit:hS,prependListener:vS,prependOnceListener:TS,listeners:_S,domain:SE,_exiting:kE,config:IE,dlopen:AE,uptime:lS,_getActiveRequests:CE,_getActiveHandles:OE,reallyExit:RE,_kill:ME,cpuUsage:Ts,resourceUsage:NE,memoryUsage:DE,kill:HE,exit:UE,openStdin:ZE,allowedNodeEnvironmentFlags:$E,assert:jE,features:KE,_fatalExceptions:LE,setUncaughtExceptionCaptureCallback:FE,hasUncaughtExceptionCaptureCallback:WE,emitWarning:vE,nextTick:uE,_tickCallback:zE,_debugProcess:qE,_debugEnd:GE,_startProfilerIdleNotifier:VE,_stopProfilerIdleNotifier:JE,stdout:XE,stdin:QE,stderr:YE,abort:eS,umask:_E,chdir:wE,cwd:bE,env:pE,title:cE,argv:gE,execArgv:yE,pid:tS,ppid:nS,execPath:rS,debugPort:iS,hrtime:hs,argv0:oS,_preload_modules:aS,setSourceMapsEnabled:sS}});function Nm(){if(Mm)return bs;Mm=!0,bs=t;function t(n,r){if(e("noDeprecation"))return n;var o=!1;function a(){if(!o){if(e("throwDeprecation"))throw new Error(r);e("traceDeprecation")?console.trace(r):console.warn(r),o=!0}return n.apply(this||ws,arguments)}return a}function e(n){try{if(!ws.localStorage)return!1}catch{return!1}var r=ws.localStorage[n];return r==null?!1:String(r).toLowerCase()==="true"}return bs}var bs,Mm,ws,Dm=at(()=>{C();R();O();bs={},Mm=!1,ws=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global});function bS(){if(Hm)return Xr;Hm=!0;var t=Rt(),e=t.Buffer;function n(o,a){for(var i in o)a[i]=o[i]}e.from&&e.alloc&&e.allocUnsafe&&e.allocUnsafeSlow?Xr=t:(n(t,Xr),Xr.Buffer=r);function r(o,a,i){return e(o,a,i)}return r.prototype=Object.create(e.prototype),n(e,r),r.from=function(o,a,i){if(typeof o=="number")throw new TypeError("Argument must not be a number");return e(o,a,i)},r.alloc=function(o,a,i){if(typeof o!="number")throw new TypeError("Argument must be a number");var s=e(o);return a!==void 0?typeof i=="string"?s.fill(a,i):s.fill(a):s.fill(0),s},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)},Xr}function wS(){if(Um)return xs;Um=!0;var t=bS().Buffer,e=t.isEncoding||function(v){switch(v=""+v,v&&v.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(v){if(!v)return"utf8";for(var S;;)switch(v){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 v;default:if(S)return;v=(""+v).toLowerCase(),S=!0}}function r(v){var S=n(v);if(typeof S!="string"&&(t.isEncoding===e||!e(v)))throw new Error("Unknown encoding: "+v);return S||v}xs.StringDecoder=o;function o(v){this.encoding=r(v);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=w,S=3;break;default:this.write=P,this.end=B;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(S)}o.prototype.write=function(v){if(v.length===0)return"";var S,E;if(this.lastNeed){if(S=this.fillLast(v),S===void 0)return"";E=this.lastNeed,this.lastNeed=0}else E=0;return E<v.length?S?S+this.text(v,E):this.text(v,E):S||""},o.prototype.end=p,o.prototype.text=f,o.prototype.fillLast=function(v){if(this.lastNeed<=v.length)return v.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);v.copy(this.lastChar,this.lastTotal-this.lastNeed,0,v.length),this.lastNeed-=v.length};function a(v){return v<=127?0:v>>5===6?2:v>>4===14?3:v>>3===30?4:v>>6===2?-1:-2}function i(v,S,E){var H=S.length-1;if(H<E)return 0;var K=a(S[H]);return K>=0?(K>0&&(v.lastNeed=K-1),K):--H<E||K===-2?0:(K=a(S[H]),K>=0?(K>0&&(v.lastNeed=K-2),K):--H<E||K===-2?0:(K=a(S[H]),K>=0?(K>0&&(K===2?K=0:v.lastNeed=K-3),K):0))}function s(v,S,E){if((S[0]&192)!==128)return v.lastNeed=0,"\uFFFD";if(v.lastNeed>1&&S.length>1){if((S[1]&192)!==128)return v.lastNeed=1,"\uFFFD";if(v.lastNeed>2&&S.length>2&&(S[2]&192)!==128)return v.lastNeed=2,"\uFFFD"}}function l(v){var S=this.lastTotal-this.lastNeed,E=s(this,v);if(E!==void 0)return E;if(this.lastNeed<=v.length)return v.copy(this.lastChar,S,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);v.copy(this.lastChar,S,0,v.length),this.lastNeed-=v.length}function f(v,S){var E=i(this,v,S);if(!this.lastNeed)return v.toString("utf8",S);this.lastTotal=E;var H=v.length-(E-this.lastNeed);return v.copy(this.lastChar,0,H),v.toString("utf8",S,H)}function p(v){var S=v&&v.length?this.write(v):"";return this.lastNeed?S+"\uFFFD":S}function y(v,S){if((v.length-S)%2===0){var E=v.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]=v[v.length-2],this.lastChar[1]=v[v.length-1],E.slice(0,-1)}return E}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=v[v.length-1],v.toString("utf16le",S,v.length-1)}function g(v){var S=v&&v.length?this.write(v):"";if(this.lastNeed){var E=this.lastTotal-this.lastNeed;return S+this.lastChar.toString("utf16le",0,E)}return S}function h(v,S){var E=(v.length-S)%3;return E===0?v.toString("base64",S):(this.lastNeed=3-E,this.lastTotal=3,E===1?this.lastChar[0]=v[v.length-1]:(this.lastChar[0]=v[v.length-2],this.lastChar[1]=v[v.length-1]),v.toString("base64",S,v.length-E))}function w(v){var S=v&&v.length?this.write(v):"";return this.lastNeed?S+this.lastChar.toString("base64",0,3-this.lastNeed):S}function P(v){return v.toString(this.encoding)}function B(v){return v&&v.length?this.write(v):""}return xs}var Xr,Hm,xs,Um,Yr,$C,Zm=at(()=>{C();R();O();di();Xr={},Hm=!1;xs={},Um=!1;Yr=wS();Yr.StringDecoder;$C=Yr.StringDecoder});function xS(){if($m)return Ps;$m=!0;var t=Ps={},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 a(P){if(e===setTimeout)return setTimeout(P,0);if((e===r||!e)&&setTimeout)return e=setTimeout,setTimeout(P,0);try{return e(P,0)}catch{try{return e.call(null,P,0)}catch{return e.call(this||ur,P,0)}}}function i(P){if(n===clearTimeout)return clearTimeout(P);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(P);try{return n(P)}catch{try{return n.call(null,P)}catch{return n.call(this||ur,P)}}}var s=[],l=!1,f,p=-1;function y(){!l||!f||(l=!1,f.length?s=f.concat(s):p=-1,s.length&&g())}function g(){if(!l){var P=a(y);l=!0;for(var B=s.length;B;){for(f=s,s=[];++p<B;)f&&f[p].run();p=-1,B=s.length}f=null,l=!1,i(P)}}t.nextTick=function(P){var B=new Array(arguments.length-1);if(arguments.length>1)for(var v=1;v<arguments.length;v++)B[v-1]=arguments[v];s.push(new h(P,B)),s.length===1&&!l&&a(g)};function h(P,B){(this||ur).fun=P,(this||ur).array=B}h.prototype.run=function(){(this||ur).fun.apply(null,(this||ur).array)},t.title="browser",t.browser=!0,t.env={},t.argv=[],t.version="",t.versions={};function w(){}return t.on=w,t.addListener=w,t.once=w,t.off=w,t.removeListener=w,t.removeAllListeners=w,t.emit=w,t.prependListener=w,t.prependOnceListener=w,t.listeners=function(P){return[]},t.binding=function(P){throw new Error("process.binding is not supported")},t.cwd=function(){return"/"},t.chdir=function(P){throw new Error("process.chdir is not supported")},t.umask=function(){return 0},Ps}var Ps,$m,ur,Ke,Bs=at(()=>{C();R();O();Ps={},$m=!1,ur=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ke=xS();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 PS(){if(jm)return Es;jm=!0;var t=Ke;function e(a){if(typeof a!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(a))}function n(a,i){for(var s="",l=0,f=-1,p=0,y,g=0;g<=a.length;++g){if(g<a.length)y=a.charCodeAt(g);else{if(y===47)break;y=47}if(y===47){if(!(f===g-1||p===1))if(f!==g-1&&p===2){if(s.length<2||l!==2||s.charCodeAt(s.length-1)!==46||s.charCodeAt(s.length-2)!==46){if(s.length>2){var h=s.lastIndexOf("/");if(h!==s.length-1){h===-1?(s="",l=0):(s=s.slice(0,h),l=s.length-1-s.lastIndexOf("/")),f=g,p=0;continue}}else if(s.length===2||s.length===1){s="",l=0,f=g,p=0;continue}}i&&(s.length>0?s+="/..":s="..",l=2)}else s.length>0?s+="/"+a.slice(f+1,g):s=a.slice(f+1,g),l=g-f-1;f=g,p=0}else y===46&&p!==-1?++p:p=-1}return s}function r(a,i){var s=i.dir||i.root,l=i.base||(i.name||"")+(i.ext||"");return s?s===i.root?s+l:s+a+l:l}var o={resolve:function(){for(var i="",s=!1,l,f=arguments.length-1;f>=-1&&!s;f--){var p;f>=0?p=arguments[f]:(l===void 0&&(l=t.cwd()),p=l),e(p),p.length!==0&&(i=p+"/"+i,s=p.charCodeAt(0)===47)}return i=n(i,!s),s?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(i){if(e(i),i.length===0)return".";var s=i.charCodeAt(0)===47,l=i.charCodeAt(i.length-1)===47;return i=n(i,!s),i.length===0&&!s&&(i="."),i.length>0&&l&&(i+="/"),s?"/"+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,s=0;s<arguments.length;++s){var l=arguments[s];e(l),l.length>0&&(i===void 0?i=l:i+="/"+l)}return i===void 0?".":o.normalize(i)},relative:function(i,s){if(e(i),e(s),i===s||(i=o.resolve(i),s=o.resolve(s),i===s))return"";for(var l=1;l<i.length&&i.charCodeAt(l)===47;++l);for(var f=i.length,p=f-l,y=1;y<s.length&&s.charCodeAt(y)===47;++y);for(var g=s.length,h=g-y,w=p<h?p:h,P=-1,B=0;B<=w;++B){if(B===w){if(h>w){if(s.charCodeAt(y+B)===47)return s.slice(y+B+1);if(B===0)return s.slice(y+B)}else p>w&&(i.charCodeAt(l+B)===47?P=B:B===0&&(P=0));break}var v=i.charCodeAt(l+B),S=s.charCodeAt(y+B);if(v!==S)break;v===47&&(P=B)}var E="";for(B=l+P+1;B<=f;++B)(B===f||i.charCodeAt(B)===47)&&(E.length===0?E+="..":E+="/..");return E.length>0?E+s.slice(y+P):(y+=P,s.charCodeAt(y)===47&&++y,s.slice(y))},_makeLong:function(i){return i},dirname:function(i){if(e(i),i.length===0)return".";for(var s=i.charCodeAt(0),l=s===47,f=-1,p=!0,y=i.length-1;y>=1;--y)if(s=i.charCodeAt(y),s===47){if(!p){f=y;break}}else p=!1;return f===-1?l?"/":".":l&&f===1?"//":i.slice(0,f)},basename:function(i,s){if(s!==void 0&&typeof s!="string")throw new TypeError('"ext" argument must be a string');e(i);var l=0,f=-1,p=!0,y;if(s!==void 0&&s.length>0&&s.length<=i.length){if(s.length===i.length&&s===i)return"";var g=s.length-1,h=-1;for(y=i.length-1;y>=0;--y){var w=i.charCodeAt(y);if(w===47){if(!p){l=y+1;break}}else h===-1&&(p=!1,h=y+1),g>=0&&(w===s.charCodeAt(g)?--g===-1&&(f=y):(g=-1,f=h))}return l===f?f=h:f===-1&&(f=i.length),i.slice(l,f)}else{for(y=i.length-1;y>=0;--y)if(i.charCodeAt(y)===47){if(!p){l=y+1;break}}else f===-1&&(p=!1,f=y+1);return f===-1?"":i.slice(l,f)}},extname:function(i){e(i);for(var s=-1,l=0,f=-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}f===-1&&(p=!1,f=g+1),h===46?s===-1?s=g:y!==1&&(y=1):s!==-1&&(y=-1)}return s===-1||f===-1||y===0||y===1&&s===f-1&&s===l+1?"":i.slice(s,f)},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 s={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return s;var l=i.charCodeAt(0),f=l===47,p;f?(s.root="/",p=1):p=0;for(var y=-1,g=0,h=-1,w=!0,P=i.length-1,B=0;P>=p;--P){if(l=i.charCodeAt(P),l===47){if(!w){g=P+1;break}continue}h===-1&&(w=!1,h=P+1),l===46?y===-1?y=P: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&&f?s.base=s.name=i.slice(1,h):s.base=s.name=i.slice(g,h)):(g===0&&f?(s.name=i.slice(1,y),s.base=i.slice(1,h)):(s.name=i.slice(g,y),s.base=i.slice(g,h)),s.ext=i.slice(y,h)),g>0?s.dir=i.slice(0,g-1):f&&(s.dir="/"),s},sep:"/",delimiter:":",win32:null,posix:null};return o.posix=o,Es=o,Es}function Zn(t){throw new RangeError(kS[t])}function Lm(t,e){let n=t.split("@"),r="";n.length>1&&(r=n[0]+"@",t=n[1]);let o=(function(a,i){let s=[],l=a.length;for(;l--;)s[l]=i(a[l]);return s})((t=t.replace(SS,".")).split("."),e).join(".");return r+o}function Ym(t){let e=[],n=0,r=t.length;for(;n<r;){let o=t.charCodeAt(n++);if(o>=55296&&o<=56319&&n<r){let a=t.charCodeAt(n++);(64512&a)==56320?e.push(((1023&o)<<10)+(1023&a)+65536):(e.push(o),n--)}else e.push(o)}return e}function AS(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function St(){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 ei(t,e,n){if(t&&Dt.isObject(t)&&t instanceof St)return t;var r=new St;return r.parse(t,e,n),r}function $S(){if(Jm)return As;Jm=!0;var t=je;function e(a){if(typeof a!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(a))}function n(a,i){for(var s="",l=0,f=-1,p=0,y,g=0;g<=a.length;++g){if(g<a.length)y=a.charCodeAt(g);else{if(y===47)break;y=47}if(y===47){if(!(f===g-1||p===1))if(f!==g-1&&p===2){if(s.length<2||l!==2||s.charCodeAt(s.length-1)!==46||s.charCodeAt(s.length-2)!==46){if(s.length>2){var h=s.lastIndexOf("/");if(h!==s.length-1){h===-1?(s="",l=0):(s=s.slice(0,h),l=s.length-1-s.lastIndexOf("/")),f=g,p=0;continue}}else if(s.length===2||s.length===1){s="",l=0,f=g,p=0;continue}}i&&(s.length>0?s+="/..":s="..",l=2)}else s.length>0?s+="/"+a.slice(f+1,g):s=a.slice(f+1,g),l=g-f-1;f=g,p=0}else y===46&&p!==-1?++p:p=-1}return s}function r(a,i){var s=i.dir||i.root,l=i.base||(i.name||"")+(i.ext||"");return s?s===i.root?s+l:s+a+l:l}var o={resolve:function(){for(var i="",s=!1,l,f=arguments.length-1;f>=-1&&!s;f--){var p;f>=0?p=arguments[f]:(l===void 0&&(l=t.cwd()),p=l),e(p),p.length!==0&&(i=p+"/"+i,s=p.charCodeAt(0)===47)}return i=n(i,!s),s?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(i){if(e(i),i.length===0)return".";var s=i.charCodeAt(0)===47,l=i.charCodeAt(i.length-1)===47;return i=n(i,!s),i.length===0&&!s&&(i="."),i.length>0&&l&&(i+="/"),s?"/"+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,s=0;s<arguments.length;++s){var l=arguments[s];e(l),l.length>0&&(i===void 0?i=l:i+="/"+l)}return i===void 0?".":o.normalize(i)},relative:function(i,s){if(e(i),e(s),i===s||(i=o.resolve(i),s=o.resolve(s),i===s))return"";for(var l=1;l<i.length&&i.charCodeAt(l)===47;++l);for(var f=i.length,p=f-l,y=1;y<s.length&&s.charCodeAt(y)===47;++y);for(var g=s.length,h=g-y,w=p<h?p:h,P=-1,B=0;B<=w;++B){if(B===w){if(h>w){if(s.charCodeAt(y+B)===47)return s.slice(y+B+1);if(B===0)return s.slice(y+B)}else p>w&&(i.charCodeAt(l+B)===47?P=B:B===0&&(P=0));break}var v=i.charCodeAt(l+B),S=s.charCodeAt(y+B);if(v!==S)break;v===47&&(P=B)}var E="";for(B=l+P+1;B<=f;++B)(B===f||i.charCodeAt(B)===47)&&(E.length===0?E+="..":E+="/..");return E.length>0?E+s.slice(y+P):(y+=P,s.charCodeAt(y)===47&&++y,s.slice(y))},_makeLong:function(i){return i},dirname:function(i){if(e(i),i.length===0)return".";for(var s=i.charCodeAt(0),l=s===47,f=-1,p=!0,y=i.length-1;y>=1;--y)if(s=i.charCodeAt(y),s===47){if(!p){f=y;break}}else p=!1;return f===-1?l?"/":".":l&&f===1?"//":i.slice(0,f)},basename:function(i,s){if(s!==void 0&&typeof s!="string")throw new TypeError('"ext" argument must be a string');e(i);var l=0,f=-1,p=!0,y;if(s!==void 0&&s.length>0&&s.length<=i.length){if(s.length===i.length&&s===i)return"";var g=s.length-1,h=-1;for(y=i.length-1;y>=0;--y){var w=i.charCodeAt(y);if(w===47){if(!p){l=y+1;break}}else h===-1&&(p=!1,h=y+1),g>=0&&(w===s.charCodeAt(g)?--g===-1&&(f=y):(g=-1,f=h))}return l===f?f=h:f===-1&&(f=i.length),i.slice(l,f)}else{for(y=i.length-1;y>=0;--y)if(i.charCodeAt(y)===47){if(!p){l=y+1;break}}else f===-1&&(p=!1,f=y+1);return f===-1?"":i.slice(l,f)}},extname:function(i){e(i);for(var s=-1,l=0,f=-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}f===-1&&(p=!1,f=g+1),h===46?s===-1?s=g:y!==1&&(y=1):s!==-1&&(y=-1)}return s===-1||f===-1||y===0||y===1&&s===f-1&&s===l+1?"":i.slice(s,f)},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 s={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return s;var l=i.charCodeAt(0),f=l===47,p;f?(s.root="/",p=1):p=0;for(var y=-1,g=0,h=-1,w=!0,P=i.length-1,B=0;P>=p;--P){if(l=i.charCodeAt(P),l===47){if(!w){g=P+1;break}continue}h===-1&&(w=!1,h=P+1),l===46?y===-1?y=P: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&&f?s.base=s.name=i.slice(1,h):s.base=s.name=i.slice(g,h)):(g===0&&f?(s.name=i.slice(1,y),s.base=i.slice(1,h)):(s.name=i.slice(g,y),s.base=i.slice(g,h)),s.ext=i.slice(y,h)),g>0?s.dir=i.slice(0,g-1):f&&(s.dir="/"),s},sep:"/",delimiter:":",win32:null,posix:null};return o.posix=o,As=o,As}function YS(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 Os?QS(t):ek(t)}function QS(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(zS,"\\"),n=decodeURIComponent(n),e!=="")return`\\\\${e}${n}`;{let r=n.codePointAt(1)|32,o=n[2];if(r<FS||r>WS||o!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return n.slice(1)}}function ek(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 tk(t){let e=Xm.resolve(t),n=t.charCodeAt(t.length-1);(n===LS||Os&&n===KS)&&e[e.length-1]!==Xm.sep&&(e+="/");let r=new URL("file://");return e.includes("%")&&(e=e.replace(qS,"%25")),!Os&&e.includes("\\")&&(e=e.replace(GS,"%5C")),e.includes(`
11
+ `)&&(e=e.replace(VS,"%0A")),e.includes("\r")&&(e=e.replace(JS,"%0D")),e.includes(" ")&&(e=e.replace(XS,"%09")),r.pathname=e,r}function pk(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 Rs?gk(t):yk(t)}function gk(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(sk,"\\"),n=decodeURIComponent(n),e!=="")return`\\\\${e}${n}`;{let r=n.codePointAt(1)|32,o=n[2];if(r<ok||r>ak||o!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return n.slice(1)}}function yk(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 mk(t){let e=Km.resolve(t),n=t.charCodeAt(t.length-1);(n===ik||Rs&&n===rk)&&e[e.length-1]!==Km.sep&&(e+="/");let r=new URL("file://");return e.includes("%")&&(e=e.replace(lk,"%25")),!Rs&&e.includes("\\")&&(e=e.replace(uk,"%5C")),e.includes(`
12
+ `)&&(e=e.replace(ck,"%0A")),e.includes("\r")&&(e=e.replace(fk,"%0D")),e.includes(" ")&&(e=e.replace(dk,"%09")),r.pathname=e,r}var Es,jm,Km,fr,BS,ES,SS,kS,Ht,Ss,Fm,Qm,Wm,zm,IS,CS,Qr,OS,Xt,De,RS,Dt,MS,NS,DS,HS,Cs,qm,Gm,Vm,US,ZS,ks,cr,Is,As,Jm,Xm,jS,KS,LS,FS,WS,Os,zS,qS,GS,VS,JS,XS,nk,rk,ik,ok,ak,Rs,sk,lk,uk,ck,fk,dk,eh=at(()=>{C();R();O();Ko();Bs();Es={},jm=!1;Km=PS(),fr=2147483647,BS=/^xn--/,ES=/[^\0-\x7E]/,SS=/[\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"},Ht=Math.floor,Ss=String.fromCharCode;Fm=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},Qm=function(t,e,n){let r=0;for(t=n?Ht(t/700):t>>1,t+=Ht(t/e);t>455;r+=36)t=Ht(t/35);return Ht(r+36*t/(t+38))},Wm=function(t){let e=[],n=t.length,r=0,o=128,a=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 f=r;for(let y=1,g=36;;g+=36){l>=n&&Zn("invalid-input");let h=(s=t.charCodeAt(l++))-48<10?s-22:s-65<26?s-65:s-97<26?s-97:36;(h>=36||h>Ht((fr-r)/y))&&Zn("overflow"),r+=h*y;let w=g<=a?1:g>=a+26?26:g-a;if(h<w)break;let P=36-w;y>Ht(fr/P)&&Zn("overflow"),y*=P}let p=e.length+1;a=Qm(r-f,p,f==0),Ht(r/p)>fr-o&&Zn("overflow"),o+=Ht(r/p),r%=p,e.splice(r++,0,o)}var s;return String.fromCodePoint(...e)},zm=function(t){let e=[],n=(t=Ym(t)).length,r=128,o=0,a=72;for(let l of t)l<128&&e.push(Ss(l));let i=e.length,s=i;for(i&&e.push("-");s<n;){let l=fr;for(let p of t)p>=r&&p<l&&(l=p);let f=s+1;l-r>Ht((fr-o)/f)&&Zn("overflow"),o+=(l-r)*f,r=l;for(let p of t)if(p<r&&++o>fr&&Zn("overflow"),p==r){let y=o;for(let g=36;;g+=36){let h=g<=a?1:g>=a+26?26:g-a;if(y<h)break;let w=y-h,P=36-h;e.push(Ss(Fm(h+w%P,0))),y=Ht(w/P)}e.push(Ss(Fm(y,0))),a=Qm(o,f,s==i),o=0,++s}++o,++r}return e.join("")},IS={version:"2.1.0",ucs2:{decode:Ym,encode:t=>String.fromCodePoint(...t)},decode:Wm,encode:zm,toASCII:function(t){return Lm(t,(function(e){return ES.test(e)?"xn--"+zm(e):e}))},toUnicode:function(t){return Lm(t,(function(e){return BS.test(e)?Wm(e.slice(4).toLowerCase()):e}))}};CS=function(t,e,n,r){e=e||"&",n=n||"=";var o={};if(typeof t!="string"||t.length===0)return o;var a=/\+/g;t=t.split(e);var i=1e3;r&&typeof r.maxKeys=="number"&&(i=r.maxKeys);var s=t.length;i>0&&s>i&&(s=i);for(var l=0;l<s;++l){var f,p,y,g,h=t[l].replace(a,"%20"),w=h.indexOf(n);w>=0?(f=h.substr(0,w),p=h.substr(w+1)):(f=h,p=""),y=decodeURIComponent(f),g=decodeURIComponent(p),AS(o,y)?Array.isArray(o[y])?o[y].push(g):o[y]=[o[y],g]:o[y]=g}return o},Qr=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}},OS=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 a=encodeURIComponent(Qr(o))+n;return Array.isArray(t[o])?t[o].map((function(i){return a+encodeURIComponent(Qr(i))})).join(e):a+encodeURIComponent(Qr(t[o]))})).join(e):r?encodeURIComponent(Qr(r))+n+encodeURIComponent(Qr(t)):""},Xt={};Xt.decode=Xt.parse=CS,Xt.encode=Xt.stringify=OS;Xt.decode;Xt.encode;Xt.parse;Xt.stringify;De={},RS=IS,Dt={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=ei,De.resolve=function(t,e){return ei(t,!1,!0).resolve(e)},De.resolveObject=function(t,e){return t?ei(t,!1,!0).resolveObject(e):e},De.format=function(t){return Dt.isString(t)&&(t=ei(t)),t instanceof St?t.format():St.prototype.format.call(t)},De.Url=St;MS=/^([a-z0-9.+-]+:)/i,NS=/:[0-9]*$/,DS=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,HS=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r",`
13
+ `," "]),Cs=["'"].concat(HS),qm=["%","/","?",";","#"].concat(Cs),Gm=["/","?","#"],Vm=/^[+a-z0-9A-Z_-]{0,63}$/,US=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,ZS={javascript:!0,"javascript:":!0},ks={javascript:!0,"javascript:":!0},cr={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Is=Xt;St.prototype.parse=function(t,e,n){if(!Dt.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var r=t.indexOf("?"),o=r!==-1&&r<t.indexOf("#")?"?":"#",a=t.split(o);a[0]=a[0].replace(/\\/g,"/");var i=t=a.join(o);if(i=i.trim(),!n&&t.split("#").length===1){var s=DS.exec(i);if(s)return this.path=i,this.href=i,this.pathname=s[1],s[2]?(this.search=s[2],this.query=e?Is.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var l=MS.exec(i);if(l){var f=(l=l[0]).toLowerCase();this.protocol=f,i=i.substr(l.length)}if(n||l||i.match(/^\/\/[^@\/]+@[^@\/]+/)){var p=i.substr(0,2)==="//";!p||l&&ks[l]||(i=i.substr(2),this.slashes=!0)}if(!ks[l]&&(p||l&&!cr[l])){for(var y,g,h=-1,w=0;w<Gm.length;w++)(P=i.indexOf(Gm[w]))!==-1&&(h===-1||P<h)&&(h=P);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,w=0;w<qm.length;w++){var P;(P=i.indexOf(qm[w]))!==-1&&(h===-1||P<h)&&(h=P)}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 v=this.hostname.split(/\./),S=(w=0,v.length);w<S;w++){var E=v[w];if(E&&!E.match(Vm)){for(var H="",K=0,oe=E.length;K<oe;K++)E.charCodeAt(K)>127?H+="x":H+=E[K];if(!H.match(Vm)){var ee=v.slice(0,w),ge=v.slice(w+1),ae=E.match(US);ae&&(ee.push(ae[1]),ge.unshift(ae[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=RS.toASCII(this.hostname));var re=this.port?":"+this.port:"",Oe=this.hostname||"";this.host=Oe+re,this.href+=this.host,B&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),i[0]!=="/"&&(i="/"+i))}if(!ZS[f])for(w=0,S=Cs.length;w<S;w++){var ze=Cs[w];if(i.indexOf(ze)!==-1){var tt=encodeURIComponent(ze);tt===ze&&(tt=escape(ze)),i=i.split(ze).join(tt)}}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=Is.parse(this.query)),i=i.slice(0,Je)):e&&(this.search="",this.query={}),i&&(this.pathname=i),cr[f]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){re=this.pathname||"";var mt=this.search||"";this.path=re+mt}return this.href=this.format(),this},St.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,a="";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&&Dt.isObject(this.query)&&Object.keys(this.query).length&&(a=Is.stringify(this.query));var i=this.search||a&&"?"+a||"";return e&&e.substr(-1)!==":"&&(e+=":"),this.slashes||(!e||cr[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(s){return encodeURIComponent(s)})))+(i=i.replace("#","%23"))+r},St.prototype.resolve=function(t){return this.resolveObject(ei(t,!1,!0)).format()},St.prototype.resolveObject=function(t){if(Dt.isString(t)){var e=new St;e.parse(t,!1,!0),t=e}for(var n=new St,r=Object.keys(this),o=0;o<r.length;o++){var a=r[o];n[a]=this[a]}if(n.hash=t.hash,t.href==="")return n.href=n.format(),n;if(t.slashes&&!t.protocol){for(var i=Object.keys(t),s=0;s<i.length;s++){var l=i[s];l!=="protocol"&&(n[l]=t[l])}return cr[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(t.protocol&&t.protocol!==n.protocol){if(!cr[t.protocol]){for(var f=Object.keys(t),p=0;p<f.length;p++){var y=f[p];n[y]=t[y]}return n.href=n.format(),n}if(n.protocol=t.protocol,t.host||ks[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||"",w=n.search||"";n.path=h+w}return n.slashes=n.slashes||t.slashes,n.href=n.format(),n}var P=n.pathname&&n.pathname.charAt(0)==="/",B=t.host||t.pathname&&t.pathname.charAt(0)==="/",v=B||P||n.host&&t.pathname,S=v,E=n.pathname&&n.pathname.split("/")||[],H=(g=t.pathname&&t.pathname.split("/")||[],n.protocol&&!cr[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),v=v&&(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(!Dt.isNullOrUndefined(t.search))return H&&(n.hostname=n.host=E.shift(),(ae=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=ae.shift(),n.host=n.hostname=ae.shift())),n.search=t.search,n.query=t.query,Dt.isNull(n.pathname)&&Dt.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 K=E.slice(-1)[0],oe=(n.host||t.host||E.length>1)&&(K==="."||K==="..")||K==="",ee=0,ge=E.length;ge>=0;ge--)(K=E[ge])==="."?E.splice(ge,1):K===".."?(E.splice(ge,1),ee++):ee&&(E.splice(ge,1),ee--);if(!v&&!S)for(;ee--;ee)E.unshift("..");!v||E[0]===""||E[0]&&E[0].charAt(0)==="/"||E.unshift(""),oe&&E.join("/").substr(-1)!=="/"&&E.push("");var ae,re=E[0]===""||E[0]&&E[0].charAt(0)==="/";return H&&(n.hostname=n.host=re?"":E.length?E.shift():"",(ae=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=ae.shift(),n.host=n.hostname=ae.shift())),(v=v||n.host&&E.length)&&!re&&E.unshift(""),E.length?n.pathname=E.join("/"):(n.pathname=null,n.path=null),Dt.isNull(n.pathname)&&Dt.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},St.prototype.parseHost=function(){var t=this.host,e=NS.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;As={},Jm=!1;Xm=$S(),jS=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;De.URL=typeof URL<"u"?URL:null;De.pathToFileURL=tk;De.fileURLToPath=YS;De.Url;De.format;De.resolve;De.resolveObject;De.URL;KS=92,LS=47,FS=97,WS=122,Os=jS==="win32",zS=/\//g,qS=/%/g,GS=/\\/g,VS=/\n/g,JS=/\r/g,XS=/\t/g;nk=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;De.URL=typeof URL<"u"?URL:null;De.pathToFileURL=mk;De.fileURLToPath=pk;De.Url;De.format;De.resolve;De.resolveObject;De.parse;De.URL;rk=92,ik=47,ok=97,ak=122,Rs=nk==="win32",sk=/\//g,lk=/%/g,uk=/\\/g,ck=/\n/g,fk=/\r/g,dk=/\t/g});var Rh={};Kn(Rh,{Agent:()=>Sk,ClientRequest:()=>kk,IncomingMessage:()=>Ik,METHODS:()=>Ak,STATUS_CODES:()=>Ck,default:()=>Yt,get:()=>Ok,globalAgent:()=>Rk,request:()=>Mk});function Ph(){if(th)return Pt;th=!0,Pt.fetch=r($n.fetch)&&r($n.ReadableStream),Pt.writableStream=r($n.WritableStream),Pt.abortController=r($n.AbortController);var t;function e(){if(t!==void 0)return t;if($n.XMLHttpRequest){t=new $n.XMLHttpRequest;try{t.open("GET",$n.XDomainRequest?"/":"https://example.com")}catch{t=null}}else t=null;return t}function n(o){var a=e();if(!a)return!1;try{return a.responseType=o,a.responseType===o}catch{}return!1}Pt.arraybuffer=Pt.fetch||n("arraybuffer"),Pt.msstream=!Pt.fetch&&n("ms-stream"),Pt.mozchunkedarraybuffer=!Pt.fetch&&n("moz-chunked-arraybuffer"),Pt.overrideMimeType=Pt.fetch||(e()?r(e().overrideMimeType):!1);function r(o){return typeof o=="function"}return t=null,Pt}function Bh(){return nh||(nh=!0,Ms=Tt.EventEmitter),Ms}function hk(){if(rh)return Ns;rh=!0;function t(w,P){var B=Object.keys(w);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(w);P&&(v=v.filter(function(S){return Object.getOwnPropertyDescriptor(w,S).enumerable})),B.push.apply(B,v)}return B}function e(w){for(var P=1;P<arguments.length;P++){var B=arguments[P]!=null?arguments[P]:{};P%2?t(Object(B),!0).forEach(function(v){n(w,v,B[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(w,Object.getOwnPropertyDescriptors(B)):t(Object(B)).forEach(function(v){Object.defineProperty(w,v,Object.getOwnPropertyDescriptor(B,v))})}return w}function n(w,P,B){return P=i(P),P in w?Object.defineProperty(w,P,{value:B,enumerable:!0,configurable:!0,writable:!0}):w[P]=B,w}function r(w,P){if(!(w instanceof P))throw new TypeError("Cannot call a class as a function")}function o(w,P){for(var B=0;B<P.length;B++){var v=P[B];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(w,i(v.key),v)}}function a(w,P,B){return P&&o(w.prototype,P),Object.defineProperty(w,"prototype",{writable:!1}),w}function i(w){var P=s(w,"string");return typeof P=="symbol"?P:String(P)}function s(w,P){if(typeof w!="object"||w===null)return w;var B=w[Symbol.toPrimitive];if(B!==void 0){var v=B.call(w,P||"default");if(typeof v!="object")return v;throw new TypeError("@@toPrimitive must return a primitive value.")}return(P==="string"?String:Number)(w)}var l=Rt(),f=l.Buffer,p=L,y=p.inspect,g=y&&y.custom||"inspect";function h(w,P,B){f.prototype.copy.call(w,P,B)}return Ns=(function(){function w(){r(this,w),this.head=null,this.tail=null,this.length=0}return a(w,[{key:"push",value:function(B){var v={data:B,next:null};this.length>0?this.tail.next=v:this.head=v,this.tail=v,++this.length}},{key:"unshift",value:function(B){var v={data:B,next:this.head};this.length===0&&(this.tail=v),this.head=v,++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 v=this.head,S=""+v.data;v=v.next;)S+=B+v.data;return S}},{key:"concat",value:function(B){if(this.length===0)return f.alloc(0);for(var v=f.allocUnsafe(B>>>0),S=this.head,E=0;S;)h(S.data,v,E),E+=S.data.length,S=S.next;return v}},{key:"consume",value:function(B,v){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=v?this._getString(B):this._getBuffer(B),S}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(B){var v=this.head,S=1,E=v.data;for(B-=E.length;v=v.next;){var H=v.data,K=B>H.length?H.length:B;if(K===H.length?E+=H:E+=H.slice(0,B),B-=K,B===0){K===H.length?(++S,v.next?this.head=v.next:this.head=this.tail=null):(this.head=v,v.data=H.slice(K));break}++S}return this.length-=S,E}},{key:"_getBuffer",value:function(B){var v=f.allocUnsafe(B),S=this.head,E=1;for(S.data.copy(v),B-=S.data.length;S=S.next;){var H=S.data,K=B>H.length?H.length:B;if(H.copy(v,v.length-B,0,K),B-=K,B===0){K===H.length?(++E,S.next?this.head=S.next:this.head=this.tail=null):(this.head=S,S.data=H.slice(K));break}++E}return this.length-=E,v}},{key:g,value:function(B,v){return y(this,e(e({},v),{},{depth:0,customInspect:!1}))}}]),w})(),Ns}function Eh(){if(ih)return Ds;ih=!0;var t=At;function e(s,l){var f=this,p=this._readableState&&this._readableState.destroyed,y=this._writableState&&this._writableState.destroyed;return p||y?(l?l(s):s&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(a,this,s)):t.nextTick(a,this,s)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(s||null,function(g){!l&&g?f._writableState?f._writableState.errorEmitted?t.nextTick(r,f):(f._writableState.errorEmitted=!0,t.nextTick(n,f,g)):t.nextTick(n,f,g):l?(t.nextTick(r,f),l(g)):t.nextTick(r,f)}),this)}function n(s,l){a(s,l),r(s)}function r(s){s._writableState&&!s._writableState.emitClose||s._readableState&&!s._readableState.emitClose||s.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 a(s,l){s.emit("error",l)}function i(s,l){var f=s._readableState,p=s._writableState;f&&f.autoDestroy||p&&p.autoDestroy?s.destroy(l):s.emit("error",l)}return Ds={destroy:e,undestroy:o,errorOrDestroy:i},Ds}function pr(){if(oh)return Hs;oh=!0;let t={};function e(i,s,l){l||(l=Error);function f(y,g,h){return typeof s=="string"?s:s(y,g,h)}class p extends l{constructor(g,h,w){super(f(g,h,w))}}p.prototype.name=l.name,p.prototype.code=i,t[i]=p}function n(i,s){if(Array.isArray(i)){let l=i.length;return i=i.map(f=>String(f)),l>2?`one of ${s} ${i.slice(0,l-1).join(", ")}, or `+i[l-1]:l===2?`one of ${s} ${i[0]} or ${i[1]}`:`of ${s} ${i[0]}`}else return`of ${s} ${String(i)}`}function r(i,s,l){return i.substr(0,s.length)===s}function o(i,s,l){return(l===void 0||l>i.length)&&(l=i.length),i.substring(l-s.length,l)===s}function a(i,s,l){return typeof l!="number"&&(l=0),l+s.length>i.length?!1:i.indexOf(s,l)!==-1}return e("ERR_INVALID_OPT_VALUE",function(i,s){return'The value "'+s+'" is invalid for option "'+i+'"'},TypeError),e("ERR_INVALID_ARG_TYPE",function(i,s,l){let f;typeof s=="string"&&r(s,"not ")?(f="must not be",s=s.replace(/^not /,"")):f="must be";let p;if(o(i," argument"))p=`The ${i} ${f} ${n(s,"type")}`;else{let y=a(i,".")?"property":"argument";p=`The "${i}" ${y} ${f} ${n(s,"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"),Hs.codes=t,Hs}function Sh(){if(ah)return Us;ah=!0;var t=pr().codes.ERR_INVALID_OPT_VALUE;function e(r,o,a){return r.highWaterMark!=null?r.highWaterMark:o?r[a]:null}function n(r,o,a,i){var s=e(o,i,a);if(s!=null){if(!(isFinite(s)&&Math.floor(s)===s)||s<0){var l=i?a:"highWaterMark";throw new t(l,s)}return Math.floor(s)}return r.objectMode?16:16*1024}return Us={getHighWaterMark:n},Us}function kh(){if(sh)return Zs;sh=!0;var t=At;Zs=ae;function e(A){var k=this;this.next=null,this.entry=null,this.finish=function(){Te(k,A)}}var n;ae.WritableState=ee;var r={deprecate:Nm()},o=Bh(),a=Rt().Buffer,i=(typeof lh<"u"?lh:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function s(A){return a.from(A)}function l(A){return a.isBuffer(A)||A instanceof i}var f=Eh(),p=Sh(),y=p.getHighWaterMark,g=pr().codes,h=g.ERR_INVALID_ARG_TYPE,w=g.ERR_METHOD_NOT_IMPLEMENTED,P=g.ERR_MULTIPLE_CALLBACK,B=g.ERR_STREAM_CANNOT_PIPE,v=g.ERR_STREAM_DESTROYED,S=g.ERR_STREAM_NULL_VALUES,E=g.ERR_STREAM_WRITE_AFTER_END,H=g.ERR_UNKNOWN_ENCODING,K=f.errorOrDestroy;Mt()(ae,o);function oe(){}function ee(A,k,$){n=n||dr(),A=A||{},typeof $!="boolean"&&($=k instanceof n),this.objectMode=!!A.objectMode,$&&(this.objectMode=this.objectMode||!!A.writableObjectMode),this.highWaterMark=y(this,A,"writableHighWaterMark",$),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var X=A.decodeStrings===!1;this.decodeStrings=!X,this.defaultEncoding=A.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(ie){Ue(k,ie)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=A.emitClose!==!1,this.autoDestroy=!!A.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}ee.prototype.getBuffer=function(){for(var k=this.bufferedRequest,$=[];k;)$.push(k),k=k.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(ae,Symbol.hasInstance,{value:function(k){return ge.call(this,k)?!0:this!==ae?!1:k&&k._writableState instanceof ee}})):ge=function(k){return k instanceof this};function ae(A){n=n||dr();var k=this instanceof n;if(!k&&!ge.call(ae,this))return new ae(A);this._writableState=new ee(A,this,k),this.writable=!0,A&&(typeof A.write=="function"&&(this._write=A.write),typeof A.writev=="function"&&(this._writev=A.writev),typeof A.destroy=="function"&&(this._destroy=A.destroy),typeof A.final=="function"&&(this._final=A.final)),o.call(this)}ae.prototype.pipe=function(){K(this,new B)};function re(A,k){var $=new E;K(A,$),t.nextTick(k,$)}function Oe(A,k,$,X){var ie;return $===null?ie=new S:typeof $!="string"&&!k.objectMode&&(ie=new h("chunk",["string","Buffer"],$)),ie?(K(A,ie),t.nextTick(X,ie),!1):!0}ae.prototype.write=function(A,k,$){var X=this._writableState,ie=!1,b=!X.objectMode&&l(A);return b&&!a.isBuffer(A)&&(A=s(A)),typeof k=="function"&&($=k,k=null),b?k="buffer":k||(k=X.defaultEncoding),typeof $!="function"&&($=oe),X.ending?re(this,$):(b||Oe(this,X,A,$))&&(X.pendingcb++,ie=tt(this,X,b,A,k,$)),ie},ae.prototype.cork=function(){this._writableState.corked++},ae.prototype.uncork=function(){var A=this._writableState;A.corked&&(A.corked--,!A.writing&&!A.corked&&!A.bufferProcessing&&A.bufferedRequest&&fe(this,A))},ae.prototype.setDefaultEncoding=function(k){if(typeof k=="string"&&(k=k.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((k+"").toLowerCase())>-1))throw new H(k);return this._writableState.defaultEncoding=k,this},Object.defineProperty(ae.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function ze(A,k,$){return!A.objectMode&&A.decodeStrings!==!1&&typeof k=="string"&&(k=a.from(k,$)),k}Object.defineProperty(ae.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function tt(A,k,$,X,ie,b){if(!$){var x=ze(k,X,ie);X!==x&&($=!0,ie="buffer",X=x)}var z=k.objectMode?1:X.length;k.length+=z;var Q=k.length<k.highWaterMark;if(Q||(k.needDrain=!0),k.writing||k.corked){var Me=k.lastBufferedRequest;k.lastBufferedRequest={chunk:X,encoding:ie,isBuf:$,callback:b,next:null},Me?Me.next=k.lastBufferedRequest:k.bufferedRequest=k.lastBufferedRequest,k.bufferedRequestCount+=1}else Ve(A,k,!1,z,X,ie,b);return Q}function Ve(A,k,$,X,ie,b,x){k.writelen=X,k.writecb=x,k.writing=!0,k.sync=!0,k.destroyed?k.onwrite(new v("write")):$?A._writev(ie,k.onwrite):A._write(ie,b,k.onwrite),k.sync=!1}function Je(A,k,$,X,ie){--k.pendingcb,$?(t.nextTick(ie,X),t.nextTick(F,A,k),A._writableState.errorEmitted=!0,K(A,X)):(ie(X),A._writableState.errorEmitted=!0,K(A,X),F(A,k))}function mt(A){A.writing=!1,A.writecb=null,A.length-=A.writelen,A.writelen=0}function Ue(A,k){var $=A._writableState,X=$.sync,ie=$.writecb;if(typeof ie!="function")throw new P;if(mt($),k)Je(A,$,X,k,ie);else{var b=ve($)||A.destroyed;!b&&!$.corked&&!$.bufferProcessing&&$.bufferedRequest&&fe(A,$),X?t.nextTick(Pe,A,$,b,ie):Pe(A,$,b,ie)}}function Pe(A,k,$,X){$||Se(A,k),k.pendingcb--,X(),F(A,k)}function Se(A,k){k.length===0&&k.needDrain&&(k.needDrain=!1,A.emit("drain"))}function fe(A,k){k.bufferProcessing=!0;var $=k.bufferedRequest;if(A._writev&&$&&$.next){var X=k.bufferedRequestCount,ie=new Array(X),b=k.corkedRequestsFree;b.entry=$;for(var x=0,z=!0;$;)ie[x]=$,$.isBuf||(z=!1),$=$.next,x+=1;ie.allBuffers=z,Ve(A,k,!0,k.length,ie,"",b.finish),k.pendingcb++,k.lastBufferedRequest=null,b.next?(k.corkedRequestsFree=b.next,b.next=null):k.corkedRequestsFree=new e(k),k.bufferedRequestCount=0}else{for(;$;){var Q=$.chunk,Me=$.encoding,_e=$.callback,Z=k.objectMode?1:Q.length;if(Ve(A,k,!1,Z,Q,Me,_e),$=$.next,k.bufferedRequestCount--,k.writing)break}$===null&&(k.lastBufferedRequest=null)}k.bufferedRequest=$,k.bufferProcessing=!1}ae.prototype._write=function(A,k,$){$(new w("_write()"))},ae.prototype._writev=null,ae.prototype.end=function(A,k,$){var X=this._writableState;return typeof A=="function"?($=A,A=null,k=null):typeof k=="function"&&($=k,k=null),A!=null&&this.write(A,k),X.corked&&(X.corked=1,this.uncork()),X.ending||de(this,X,$),this},Object.defineProperty(ae.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function ve(A){return A.ending&&A.length===0&&A.bufferedRequest===null&&!A.finished&&!A.writing}function D(A,k){A._final(function($){k.pendingcb--,$&&K(A,$),k.prefinished=!0,A.emit("prefinish"),F(A,k)})}function j(A,k){!k.prefinished&&!k.finalCalled&&(typeof A._final=="function"&&!k.destroyed?(k.pendingcb++,k.finalCalled=!0,t.nextTick(D,A,k)):(k.prefinished=!0,A.emit("prefinish")))}function F(A,k){var $=ve(k);if($&&(j(A,k),k.pendingcb===0&&(k.finished=!0,A.emit("finish"),k.autoDestroy))){var X=A._readableState;(!X||X.autoDestroy&&X.endEmitted)&&A.destroy()}return $}function de(A,k,$){k.ending=!0,F(A,k),$&&(k.finished?t.nextTick($):A.once("finish",$)),k.ended=!0,A.writable=!1}function Te(A,k,$){var X=A.entry;for(A.entry=null;X;){var ie=X.callback;k.pendingcb--,ie($),X=X.next}k.corkedRequestsFree.next=A}return Object.defineProperty(ae.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(k){this._writableState&&(this._writableState.destroyed=k)}}),ae.prototype.destroy=f.destroy,ae.prototype._undestroy=f.undestroy,ae.prototype._destroy=function(A,k){k(A)},Zs}function dr(){if(uh)return $s;uh=!0;var t=At,e=Object.keys||function(p){var y=[];for(var g in p)y.push(g);return y};$s=s;var n=Ih(),r=kh();Mt()(s,n);for(var o=e(r.prototype),a=0;a<o.length;a++){var i=o[a];s.prototype[i]||(s.prototype[i]=r.prototype[i])}function s(p){if(!(this instanceof s))return new s(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(s.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(s.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(s.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function l(){this._writableState.ended||t.nextTick(f,this)}function f(p){p.end()}return Object.defineProperty(s.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)}}),$s}function Ys(){if(ch)return js;ch=!0;var t=pr().codes.ERR_STREAM_PREMATURE_CLOSE;function e(a){var i=!1;return function(){if(!i){i=!0;for(var s=arguments.length,l=new Array(s),f=0;f<s;f++)l[f]=arguments[f];a.apply(this,l)}}}function n(){}function r(a){return a.setHeader&&typeof a.abort=="function"}function o(a,i,s){if(typeof i=="function")return o(a,null,i);i||(i={}),s=e(s||n);var l=i.readable||i.readable!==!1&&a.readable,f=i.writable||i.writable!==!1&&a.writable,p=function(){a.writable||g()},y=a._writableState&&a._writableState.finished,g=function(){f=!1,y=!0,l||s.call(a)},h=a._readableState&&a._readableState.endEmitted,w=function(){l=!1,h=!0,f||s.call(a)},P=function(E){s.call(a,E)},B=function(){var E;if(l&&!h)return(!a._readableState||!a._readableState.ended)&&(E=new t),s.call(a,E);if(f&&!y)return(!a._writableState||!a._writableState.ended)&&(E=new t),s.call(a,E)},v=function(){a.req.on("finish",g)};return r(a)?(a.on("complete",g),a.on("abort",B),a.req?v():a.on("request",v)):f&&!a._writableState&&(a.on("end",p),a.on("close",p)),a.on("end",w),a.on("finish",g),i.error!==!1&&a.on("error",P),a.on("close",B),function(){a.removeListener("complete",g),a.removeListener("abort",B),a.removeListener("request",v),a.req&&a.req.removeListener("finish",g),a.removeListener("end",p),a.removeListener("close",p),a.removeListener("finish",g),a.removeListener("end",w),a.removeListener("error",P),a.removeListener("close",B)}}return js=o,js}function vk(){if(fh)return Ks;fh=!0;var t=At,e;function n(H,K,oe){return K=r(K),K in H?Object.defineProperty(H,K,{value:oe,enumerable:!0,configurable:!0,writable:!0}):H[K]=oe,H}function r(H){var K=o(H,"string");return typeof K=="symbol"?K:String(K)}function o(H,K){if(typeof H!="object"||H===null)return H;var oe=H[Symbol.toPrimitive];if(oe!==void 0){var ee=oe.call(H,K||"default");if(typeof ee!="object")return ee;throw new TypeError("@@toPrimitive must return a primitive value.")}return(K==="string"?String:Number)(H)}var a=Ys(),i=Symbol("lastResolve"),s=Symbol("lastReject"),l=Symbol("error"),f=Symbol("ended"),p=Symbol("lastPromise"),y=Symbol("handlePromise"),g=Symbol("stream");function h(H,K){return{value:H,done:K}}function w(H){var K=H[i];if(K!==null){var oe=H[g].read();oe!==null&&(H[p]=null,H[i]=null,H[s]=null,K(h(oe,!1)))}}function P(H){t.nextTick(w,H)}function B(H,K){return function(oe,ee){H.then(function(){if(K[f]){oe(h(void 0,!0));return}K[y](oe,ee)},ee)}}var v=Object.getPrototypeOf(function(){}),S=Object.setPrototypeOf((e={get stream(){return this[g]},next:function(){var K=this,oe=this[l];if(oe!==null)return Promise.reject(oe);if(this[f])return Promise.resolve(h(void 0,!0));if(this[g].destroyed)return new Promise(function(re,Oe){t.nextTick(function(){K[l]?Oe(K[l]):re(h(void 0,!0))})});var ee=this[p],ge;if(ee)ge=new Promise(B(ee,this));else{var ae=this[g].read();if(ae!==null)return Promise.resolve(h(ae,!1));ge=new Promise(this[y])}return this[p]=ge,ge}},n(e,Symbol.asyncIterator,function(){return this}),n(e,"return",function(){var K=this;return new Promise(function(oe,ee){K[g].destroy(null,function(ge){if(ge){ee(ge);return}oe(h(void 0,!0))})})}),e),v),E=function(K){var oe,ee=Object.create(S,(oe={},n(oe,g,{value:K,writable:!0}),n(oe,i,{value:null,writable:!0}),n(oe,s,{value:null,writable:!0}),n(oe,l,{value:null,writable:!0}),n(oe,f,{value:K._readableState.endEmitted,writable:!0}),n(oe,y,{value:function(ae,re){var Oe=ee[g].read();Oe?(ee[p]=null,ee[i]=null,ee[s]=null,ae(h(Oe,!1))):(ee[i]=ae,ee[s]=re)},writable:!0}),oe));return ee[p]=null,a(K,function(ge){if(ge&&ge.code!=="ERR_STREAM_PREMATURE_CLOSE"){var ae=ee[s];ae!==null&&(ee[p]=null,ee[i]=null,ee[s]=null,ae(ge)),ee[l]=ge;return}var re=ee[i];re!==null&&(ee[p]=null,ee[i]=null,ee[s]=null,re(h(void 0,!0))),ee[f]=!0}),K.on("readable",P.bind(null,ee)),ee};return Ks=E,Ks}function Tk(){return dh||(dh=!0,Ls=function(){throw new Error("Readable.from is not available in the browser")}),Ls}function Ih(){if(ph)return Fs;ph=!0;var t=At;Fs=re;var e;re.ReadableState=ae,Tt.EventEmitter;var n=function(x,z){return x.listeners(z).length},r=Bh(),o=Rt().Buffer,a=(typeof gh<"u"?gh:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function i(b){return o.from(b)}function s(b){return o.isBuffer(b)||b instanceof a}var l=L,f;l&&l.debuglog?f=l.debuglog("stream"):f=function(){};var p=hk(),y=Eh(),g=Sh(),h=g.getHighWaterMark,w=pr().codes,P=w.ERR_INVALID_ARG_TYPE,B=w.ERR_STREAM_PUSH_AFTER_EOF,v=w.ERR_METHOD_NOT_IMPLEMENTED,S=w.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,E,H,K;Mt()(re,r);var oe=y.errorOrDestroy,ee=["error","close","destroy","pause","resume"];function ge(b,x,z){if(typeof b.prependListener=="function")return b.prependListener(x,z);!b._events||!b._events[x]?b.on(x,z):Array.isArray(b._events[x])?b._events[x].unshift(z):b._events[x]=[z,b._events[x]]}function ae(b,x,z){e=e||dr(),b=b||{},typeof z!="boolean"&&(z=x instanceof e),this.objectMode=!!b.objectMode,z&&(this.objectMode=this.objectMode||!!b.readableObjectMode),this.highWaterMark=h(this,b,"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=b.emitClose!==!1,this.autoDestroy=!!b.autoDestroy,this.destroyed=!1,this.defaultEncoding=b.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,b.encoding&&(E||(E=Yr.StringDecoder),this.decoder=new E(b.encoding),this.encoding=b.encoding)}function re(b){if(e=e||dr(),!(this instanceof re))return new re(b);var x=this instanceof e;this._readableState=new ae(b,this,x),this.readable=!0,b&&(typeof b.read=="function"&&(this._read=b.read),typeof b.destroy=="function"&&(this._destroy=b.destroy)),r.call(this)}Object.defineProperty(re.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(x){this._readableState&&(this._readableState.destroyed=x)}}),re.prototype.destroy=y.destroy,re.prototype._undestroy=y.undestroy,re.prototype._destroy=function(b,x){x(b)},re.prototype.push=function(b,x){var z=this._readableState,Q;return z.objectMode?Q=!0:typeof b=="string"&&(x=x||z.defaultEncoding,x!==z.encoding&&(b=o.from(b,x),x=""),Q=!0),Oe(this,b,x,!1,Q)},re.prototype.unshift=function(b){return Oe(this,b,null,!0,!1)};function Oe(b,x,z,Q,Me){f("readableAddChunk",x);var _e=b._readableState;if(x===null)_e.reading=!1,Ue(b,_e);else{var Z;if(Me||(Z=tt(_e,x)),Z)oe(b,Z);else if(_e.objectMode||x&&x.length>0)if(typeof x!="string"&&!_e.objectMode&&Object.getPrototypeOf(x)!==o.prototype&&(x=i(x)),Q)_e.endEmitted?oe(b,new S):ze(b,_e,x,!0);else if(_e.ended)oe(b,new B);else{if(_e.destroyed)return!1;_e.reading=!1,_e.decoder&&!z?(x=_e.decoder.write(x),_e.objectMode||x.length!==0?ze(b,_e,x,!1):fe(b,_e)):ze(b,_e,x,!1)}else Q||(_e.reading=!1,fe(b,_e))}return!_e.ended&&(_e.length<_e.highWaterMark||_e.length===0)}function ze(b,x,z,Q){x.flowing&&x.length===0&&!x.sync?(x.awaitDrain=0,b.emit("data",z)):(x.length+=x.objectMode?1:z.length,Q?x.buffer.unshift(z):x.buffer.push(z),x.needReadable&&Pe(b)),fe(b,x)}function tt(b,x){var z;return!s(x)&&typeof x!="string"&&x!==void 0&&!b.objectMode&&(z=new P("chunk",["string","Buffer","Uint8Array"],x)),z}re.prototype.isPaused=function(){return this._readableState.flowing===!1},re.prototype.setEncoding=function(b){E||(E=Yr.StringDecoder);var x=new E(b);this._readableState.decoder=x,this._readableState.encoding=this._readableState.decoder.encoding;for(var z=this._readableState.buffer.head,Q="";z!==null;)Q+=x.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(b){return b>=Ve?b=Ve:(b--,b|=b>>>1,b|=b>>>2,b|=b>>>4,b|=b>>>8,b|=b>>>16,b++),b}function mt(b,x){return b<=0||x.length===0&&x.ended?0:x.objectMode?1:b!==b?x.flowing&&x.length?x.buffer.head.data.length:x.length:(b>x.highWaterMark&&(x.highWaterMark=Je(b)),b<=x.length?b:x.ended?x.length:(x.needReadable=!0,0))}re.prototype.read=function(b){f("read",b),b=parseInt(b,10);var x=this._readableState,z=b;if(b!==0&&(x.emittedReadable=!1),b===0&&x.needReadable&&((x.highWaterMark!==0?x.length>=x.highWaterMark:x.length>0)||x.ended))return f("read: emitReadable",x.length,x.ended),x.length===0&&x.ended?$(this):Pe(this),null;if(b=mt(b,x),b===0&&x.ended)return x.length===0&&$(this),null;var Q=x.needReadable;f("need readable",Q),(x.length===0||x.length-b<x.highWaterMark)&&(Q=!0,f("length less than watermark",Q)),x.ended||x.reading?(Q=!1,f("reading or ended",Q)):Q&&(f("do read"),x.reading=!0,x.sync=!0,x.length===0&&(x.needReadable=!0),this._read(x.highWaterMark),x.sync=!1,x.reading||(b=mt(z,x)));var Me;return b>0?Me=k(b,x):Me=null,Me===null?(x.needReadable=x.length<=x.highWaterMark,b=0):(x.length-=b,x.awaitDrain=0),x.length===0&&(x.ended||(x.needReadable=!0),z!==b&&x.ended&&$(this)),Me!==null&&this.emit("data",Me),Me};function Ue(b,x){if(f("onEofChunk"),!x.ended){if(x.decoder){var z=x.decoder.end();z&&z.length&&(x.buffer.push(z),x.length+=x.objectMode?1:z.length)}x.ended=!0,x.sync?Pe(b):(x.needReadable=!1,x.emittedReadable||(x.emittedReadable=!0,Se(b)))}}function Pe(b){var x=b._readableState;f("emitReadable",x.needReadable,x.emittedReadable),x.needReadable=!1,x.emittedReadable||(f("emitReadable",x.flowing),x.emittedReadable=!0,t.nextTick(Se,b))}function Se(b){var x=b._readableState;f("emitReadable_",x.destroyed,x.length,x.ended),!x.destroyed&&(x.length||x.ended)&&(b.emit("readable"),x.emittedReadable=!1),x.needReadable=!x.flowing&&!x.ended&&x.length<=x.highWaterMark,A(b)}function fe(b,x){x.readingMore||(x.readingMore=!0,t.nextTick(ve,b,x))}function ve(b,x){for(;!x.reading&&!x.ended&&(x.length<x.highWaterMark||x.flowing&&x.length===0);){var z=x.length;if(f("maybeReadMore read 0"),b.read(0),z===x.length)break}x.readingMore=!1}re.prototype._read=function(b){oe(this,new v("_read()"))},re.prototype.pipe=function(b,x){var z=this,Q=this._readableState;switch(Q.pipesCount){case 0:Q.pipes=b;break;case 1:Q.pipes=[Q.pipes,b];break;default:Q.pipes.push(b);break}Q.pipesCount+=1,f("pipe count=%d opts=%j",Q.pipesCount,x);var Me=(!x||x.end!==!1)&&b!==t.stdout&&b!==t.stderr,_e=Me?kt:u;Q.endEmitted?t.nextTick(_e):z.once("end",_e),b.on("unpipe",Z);function Z(c,T){f("onunpipe"),c===z&&T&&T.hasUnpiped===!1&&(T.hasUnpiped=!0,mr())}function kt(){f("onend"),b.end()}var Ot=D(z);b.on("drain",Ot);var wt=!1;function mr(){f("cleanup"),b.removeListener("close",hr),b.removeListener("finish",m),b.removeListener("drain",Ot),b.removeListener("error",Bt),b.removeListener("unpipe",Z),z.removeListener("end",kt),z.removeListener("end",u),z.removeListener("data",si),wt=!0,Q.awaitDrain&&(!b._writableState||b._writableState.needDrain)&&Ot()}z.on("data",si);function si(c){f("ondata");var T=b.write(c);f("dest.write",T),T===!1&&((Q.pipesCount===1&&Q.pipes===b||Q.pipesCount>1&&ie(Q.pipes,b)!==-1)&&!wt&&(f("false write response, pause",Q.awaitDrain),Q.awaitDrain++),z.pause())}function Bt(c){f("onerror",c),u(),b.removeListener("error",Bt),n(b,"error")===0&&oe(b,c)}ge(b,"error",Bt);function hr(){b.removeListener("finish",m),u()}b.once("close",hr);function m(){f("onfinish"),b.removeListener("close",hr),u()}b.once("finish",m);function u(){f("unpipe"),z.unpipe(b)}return b.emit("pipe",z),Q.flowing||(f("pipe resume"),z.resume()),b};function D(b){return function(){var z=b._readableState;f("pipeOnDrain",z.awaitDrain),z.awaitDrain&&z.awaitDrain--,z.awaitDrain===0&&n(b,"data")&&(z.flowing=!0,A(b))}}re.prototype.unpipe=function(b){var x=this._readableState,z={hasUnpiped:!1};if(x.pipesCount===0)return this;if(x.pipesCount===1)return b&&b!==x.pipes?this:(b||(b=x.pipes),x.pipes=null,x.pipesCount=0,x.flowing=!1,b&&b.emit("unpipe",this,z),this);if(!b){var Q=x.pipes,Me=x.pipesCount;x.pipes=null,x.pipesCount=0,x.flowing=!1;for(var _e=0;_e<Me;_e++)Q[_e].emit("unpipe",this,{hasUnpiped:!1});return this}var Z=ie(x.pipes,b);return Z===-1?this:(x.pipes.splice(Z,1),x.pipesCount-=1,x.pipesCount===1&&(x.pipes=x.pipes[0]),b.emit("unpipe",this,z),this)},re.prototype.on=function(b,x){var z=r.prototype.on.call(this,b,x),Q=this._readableState;return b==="data"?(Q.readableListening=this.listenerCount("readable")>0,Q.flowing!==!1&&this.resume()):b==="readable"&&!Q.endEmitted&&!Q.readableListening&&(Q.readableListening=Q.needReadable=!0,Q.flowing=!1,Q.emittedReadable=!1,f("on readable",Q.length,Q.reading),Q.length?Pe(this):Q.reading||t.nextTick(F,this)),z},re.prototype.addListener=re.prototype.on,re.prototype.removeListener=function(b,x){var z=r.prototype.removeListener.call(this,b,x);return b==="readable"&&t.nextTick(j,this),z},re.prototype.removeAllListeners=function(b){var x=r.prototype.removeAllListeners.apply(this,arguments);return(b==="readable"||b===void 0)&&t.nextTick(j,this),x};function j(b){var x=b._readableState;x.readableListening=b.listenerCount("readable")>0,x.resumeScheduled&&!x.paused?x.flowing=!0:b.listenerCount("data")>0&&b.resume()}function F(b){f("readable nexttick read 0"),b.read(0)}re.prototype.resume=function(){var b=this._readableState;return b.flowing||(f("resume"),b.flowing=!b.readableListening,de(this,b)),b.paused=!1,this};function de(b,x){x.resumeScheduled||(x.resumeScheduled=!0,t.nextTick(Te,b,x))}function Te(b,x){f("resume",x.reading),x.reading||b.read(0),x.resumeScheduled=!1,b.emit("resume"),A(b),x.flowing&&!x.reading&&b.read(0)}re.prototype.pause=function(){return f("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(f("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function A(b){var x=b._readableState;for(f("flow",x.flowing);x.flowing&&b.read()!==null;);}re.prototype.wrap=function(b){var x=this,z=this._readableState,Q=!1;b.on("end",function(){if(f("wrapped end"),z.decoder&&!z.ended){var Z=z.decoder.end();Z&&Z.length&&x.push(Z)}x.push(null)}),b.on("data",function(Z){if(f("wrapped data"),z.decoder&&(Z=z.decoder.write(Z)),!(z.objectMode&&Z==null)&&!(!z.objectMode&&(!Z||!Z.length))){var kt=x.push(Z);kt||(Q=!0,b.pause())}});for(var Me in b)this[Me]===void 0&&typeof b[Me]=="function"&&(this[Me]=(function(kt){return function(){return b[kt].apply(b,arguments)}})(Me));for(var _e=0;_e<ee.length;_e++)b.on(ee[_e],this.emit.bind(this,ee[_e]));return this._read=function(Z){f("wrapped _read",Z),Q&&(Q=!1,b.resume())},this},typeof Symbol=="function"&&(re.prototype[Symbol.asyncIterator]=function(){return H===void 0&&(H=vk()),H(this)}),Object.defineProperty(re.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(re.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(re.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(x){this._readableState&&(this._readableState.flowing=x)}}),re._fromList=k,Object.defineProperty(re.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function k(b,x){if(x.length===0)return null;var z;return x.objectMode?z=x.buffer.shift():!b||b>=x.length?(x.decoder?z=x.buffer.join(""):x.buffer.length===1?z=x.buffer.first():z=x.buffer.concat(x.length),x.buffer.clear()):z=x.buffer.consume(b,x.decoder),z}function $(b){var x=b._readableState;f("endReadable",x.endEmitted),x.endEmitted||(x.ended=!0,t.nextTick(X,x,b))}function X(b,x){if(f("endReadableNT",b.endEmitted,b.length),!b.endEmitted&&b.length===0&&(b.endEmitted=!0,x.readable=!1,x.emit("end"),b.autoDestroy)){var z=x._writableState;(!z||z.autoDestroy&&z.finished)&&x.destroy()}}typeof Symbol=="function"&&(re.from=function(b,x){return K===void 0&&(K=Tk()),K(re,b,x)});function ie(b,x){for(var z=0,Q=b.length;z<Q;z++)if(b[z]===x)return z;return-1}return Fs}function Ah(){if(yh)return Ws;yh=!0,Ws=s;var t=pr().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,a=dr();Mt()(s,a);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 w=this._readableState;w.reading=!1,(w.needReadable||w.length<w.highWaterMark)&&this._read(w.highWaterMark)}function s(p){if(!(this instanceof s))return new s(p);a.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){f(p,y,g)}):f(this,null,null)}s.prototype.push=function(p,y){return this._transformState.needTransform=!1,a.prototype.push.call(this,p,y)},s.prototype._transform=function(p,y,g){g(new e("_transform()"))},s.prototype._write=function(p,y,g){var h=this._transformState;if(h.writecb=g,h.writechunk=p,h.writeencoding=y,!h.transforming){var w=this._readableState;(h.needTransform||w.needReadable||w.length<w.highWaterMark)&&this._read(w.highWaterMark)}},s.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},s.prototype._destroy=function(p,y){a.prototype._destroy.call(this,p,function(g){y(g)})};function f(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 Ws}function _k(){if(mh)return zs;mh=!0,zs=e;var t=Ah();Mt()(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)},zs}function bk(){if(hh)return qs;hh=!0;var t;function e(g){var h=!1;return function(){h||(h=!0,g.apply(void 0,arguments))}}var n=pr().codes,r=n.ERR_MISSING_ARGS,o=n.ERR_STREAM_DESTROYED;function a(g){if(g)throw g}function i(g){return g.setHeader&&typeof g.abort=="function"}function s(g,h,w,P){P=e(P);var B=!1;g.on("close",function(){B=!0}),t===void 0&&(t=Ys()),t(g,{readable:h,writable:w},function(S){if(S)return P(S);B=!0,P()});var v=!1;return function(S){if(!B&&!v){if(v=!0,i(g))return g.abort();if(typeof g.destroy=="function")return g.destroy();P(S||new o("pipe"))}}}function l(g){g()}function f(g,h){return g.pipe(h)}function p(g){return!g.length||typeof g[g.length-1]!="function"?a:g.pop()}function y(){for(var g=arguments.length,h=new Array(g),w=0;w<g;w++)h[w]=arguments[w];var P=p(h);if(Array.isArray(h[0])&&(h=h[0]),h.length<2)throw new r("streams");var B,v=h.map(function(S,E){var H=E<h.length-1,K=E>0;return s(S,H,K,function(oe){B||(B=oe),oe&&v.forEach(l),!H&&(v.forEach(l),P(B))})});return h.reduce(f)}return qs=y,qs}function Ch(){return vh||(vh=!0,bt=bt=Ih(),bt.Stream=bt,bt.Readable=bt,bt.Writable=kh(),bt.Duplex=dr(),bt.Transform=Ah(),bt.PassThrough=_k(),bt.finished=Ys(),bt.pipeline=bk()),bt}function Oh(){if(Th)return Fo;Th=!0;var t=Rt().Buffer,e=At,n=Ph(),r=Mt(),o=Ch(),a=Fo.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},i=Fo.IncomingMessage=function(s,l,f,p){var y=this||Wo;if(o.Readable.call(y),y._mode=f,y.headers={},y.rawHeaders=[],y.trailers={},y.rawTrailers=[],y.on("end",function(){e.nextTick(function(){y.emit("close")})}),f==="fetch"){let v=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)),v()}}).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();v()}else{y._xhr=s,y._pos=0,y.url=s.responseURL,y.statusCode=s.status,y.statusMessage=s.statusText;var w=s.getAllResponseHeaders().split(/\r?\n/);if(w.forEach(function(v){var S=v.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 P=y.rawHeaders["mime-type"];if(P){var B=P.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 s=this||Wo,l=s._resumeFetch;l&&(s._resumeFetch=null,l())},i.prototype._onXHRProgress=function(s){var l=this||Wo,f=l._xhr,p=null;switch(l._mode){case"text":if(p=f.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(f.readyState!==a.DONE||!f.response)break;p=f.response,l.push(t.from(new Uint8Array(p)));break;case"moz-chunked-arraybuffer":if(p=f.response,f.readyState!==a.LOADING||!p)break;l.push(t.from(new Uint8Array(p)));break;case"ms-stream":if(p=f.response,f.readyState!==a.LOADING)break;var w=new Wo.MSStreamReader;w.onprogress=function(){w.result.byteLength>l._pos&&(l.push(t.from(new Uint8Array(w.result.slice(l._pos)))),l._pos=w.result.byteLength)},w.onload=function(){s(!0),l.push(null)},w.readAsArrayBuffer(p);break}l._xhr.readyState===a.DONE&&l._mode!=="ms-stream"&&(s(!0),l.push(null))},Fo}function wk(){if(_h)return Gs;_h=!0;var t=Rt().Buffer,e=At,n=Ph(),r=Mt(),o=Oh(),a=Ch(),i=o.IncomingMessage,s=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 f=Gs=function(g){var h=this||ot;a.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 w,P=!0;if(g.mode==="disable-fetch"||"requestTimeout"in g&&!n.abortController)P=!1,w=!0;else if(g.mode==="prefer-streaming")w=!1;else if(g.mode==="allow-wrong-content-type")w=!n.overrideMimeType;else if(!g.mode||g.mode==="default"||g.mode==="prefer-fast")w=!0;else throw new Error("Invalid value for opts.mode");h._mode=l(w,P),h._fetchTimer=null,h._socketTimeout=null,h._socketTimer=null,h.on("finish",function(){h._onFinish()})};r(f,a.Writable),f.prototype.setHeader=function(g,h){var w=this||ot,P=g.toLowerCase();y.indexOf(P)===-1&&(w._headers[P]={name:g,value:h})},f.prototype.getHeader=function(g){var h=(this||ot)._headers[g.toLowerCase()];return h?h.value:null},f.prototype.removeHeader=function(g){var h=this||ot;delete h._headers[g.toLowerCase()]},f.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 w=g._headers,P=null;h.method!=="GET"&&h.method!=="HEAD"&&(P=new Blob(g._body,{type:(w["content-type"]||{}).value||""}));var B=[];if(Object.keys(w).forEach(function(H){var K=w[H].name,oe=w[H].value;Array.isArray(oe)?oe.forEach(function(ee){B.push([K,ee])}):B.push([K,oe])}),g._mode==="fetch"){var v=null;if(n.abortController){var S=new AbortController;v=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:P||void 0,mode:"cors",credentials:h.withCredentials?"include":"same-origin",signal:v}).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 s.LOADING:case s.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(P)}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}}f.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)))},f.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))},f.prototype._write=function(g,h,w){var P=this||ot;P._body.push(g),w()},f.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))},f.prototype.abort=f.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)},f.prototype.end=function(g,h,w){var P=this||ot;typeof g=="function"&&(w=g,g=void 0),a.Writable.prototype.end.call(P,g,h,w)},f.prototype.setTimeout=function(g,h){var w=this||ot;h&&w.once("timeout",h),w._socketTimeout=g,w._resetTimers(!1)},f.prototype.flushHeaders=function(){},f.prototype.setNoDelay=function(){},f.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 Gs}function xk(){if(bh)return Vs;bh=!0,Vs=e;var t=Object.prototype.hasOwnProperty;function e(){for(var n={},r=0;r<arguments.length;r++){var o=arguments[r];for(var a in o)t.call(o,a)&&(n[a]=o[a])}return n}return Vs}function Pk(){return wh||(wh=!0,Js={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"}),Js}function Ek(){if(xh)return Xs;xh=!0;var t=wk(),e=Oh(),n=xk(),r=Pk(),o=De,a=Xs;return a.request=function(i,s){typeof i=="string"?i=o.parse(i):i=n(i);var l=Bk.location.protocol.search(/^https?:$/)===-1?"http:":"",f=i.protocol||l,p=i.hostname||i.host,y=i.port,g=i.path||"/";p&&p.indexOf(":")!==-1&&(p="["+p+"]"),i.url=(p?f+"//"+p:"")+(y?":"+y:"")+g,i.method=(i.method||"GET").toUpperCase(),i.headers=i.headers||{};var h=new t(i);return s&&h.on("response",s),h},a.get=function(s,l){var f=a.request(s,l);return f.end(),f},a.ClientRequest=t,a.IncomingMessage=e.IncomingMessage,a.Agent=function(){},a.Agent.defaultMaxSockets=4,a.globalAgent=new a.Agent,a.STATUS_CODES=r,a.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"],Xs}var Pt,th,$n,Ms,nh,Ns,rh,Ds,ih,Hs,oh,Us,ah,Zs,sh,lh,$s,uh,js,ch,Ks,fh,Ls,dh,Fs,ph,gh,Ws,yh,zs,mh,qs,hh,bt,vh,Fo,Th,Wo,Gs,_h,ot,Vs,bh,Js,wh,Xs,xh,Bk,Yt,Sk,kk,Ik,Ak,Ck,Ok,Rk,Mk,Mh=at(()=>{C();R();O();rs();Vy();is();di();Cm();Ko();_s();Dm();Zm();eh();Bs();Pt={},th=!1,$n=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ms={},nh=!1;Ns={},rh=!1;Ds={},ih=!1;Hs={},oh=!1;Us={},ah=!1;Zs={},sh=!1,lh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;$s={},uh=!1;js={},ch=!1;Ks={},fh=!1;Ls={},dh=!1;Fs={},ph=!1,gh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ws={},yh=!1;zs={},mh=!1;qs={},hh=!1;bt={},vh=!1;Fo={},Th=!1,Wo=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Gs={},_h=!1,ot=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Vs={},bh=!1;Js={},wh=!1;Xs={},xh=!1,Bk=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Yt=Ek(),Sk=Yt.Agent,kk=Yt.ClientRequest,Ik=Yt.IncomingMessage,Ak=Yt.METHODS,Ck=Yt.STATUS_CODES,Ok=Yt.get,Rk=Yt.globalAgent,Mk=Yt.request});C();R();O();var Cy={};Kn(Cy,{defaults:()=>MB,markdown:()=>RB});C();R();O();C();R();O();C();R();O();var Pa=Object.defineProperty,Fv=Object.defineProperties,Wv=Object.getOwnPropertyDescriptors,Pi=Object.getOwnPropertySymbols,Xc=Object.prototype.hasOwnProperty,Yc=Object.prototype.propertyIsEnumerable,gc=(t,e,n)=>e in t?Pa(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,_=(t,e)=>{for(var n in e||(e={}))Xc.call(e,n)&&gc(t,n,e[n]);if(Pi)for(var n of Pi(e))Yc.call(e,n)&&gc(t,n,e[n]);return t},N=(t,e)=>Fv(t,Wv(e)),d=(t,e)=>Pa(t,"name",{value:e,configurable:!0}),Qc=(t,e)=>{var n={};for(var r in t)Xc.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Pi)for(var r of Pi(t))e.indexOf(r)<0&&Yc.call(t,r)&&(n[r]=t[r]);return n},oo=(t,e)=>{for(var n in e)Pa(t,n,{get:e[n],enumerable:!0})},zv={};oo(zv,{errors:()=>rf,fromJSONSchema:()=>Vg,fromJSONSchemaLegacy:()=>rB,fromObject:()=>wa,toJSONSchema:()=>st,toJSONSchemaLegacy:()=>IB,toTypescriptSchema:()=>Da,toTypescriptType:()=>Ba});var Y={};oo(Y,{BRAND:()=>Rx,DIRTY:()=>Gn,EMPTY_PATH:()=>Ix,INVALID:()=>pe,NEVER:()=>RP,OK:()=>pt,ParseInputLazyPath:()=>It,ParseStatus:()=>vt,Schema:()=>he,ZodAny:()=>jr,ZodArray:()=>Kr,ZodBigInt:()=>$a,ZodBoolean:()=>ja,ZodBranded:()=>Ka,ZodCatch:()=>La,ZodDate:()=>Fa,ZodDefault:()=>ho,ZodDiscriminatedUnion:()=>fg,ZodEffects:()=>En,ZodEnum:()=>rr,ZodError:()=>Kt,ZodFirstPartyTypeKind:()=>Yp,ZodFunction:()=>pg,ZodIntersection:()=>za,ZodIssueCode:()=>G,ZodLazy:()=>qa,ZodLiteral:()=>Ga,ZodMap:()=>yg,ZodNaN:()=>hg,ZodNativeEnum:()=>Va,ZodNever:()=>Wr,ZodNull:()=>Ja,ZodNullable:()=>Yn,ZodNumber:()=>Xa,ZodObject:()=>Qn,ZodOptional:()=>on,ZodParsedType:()=>ne,ZodPipeline:()=>Ya,ZodPromise:()=>To,ZodReadonly:()=>_o,ZodRecord:()=>Pg,ZodRef:()=>Eg,ZodSchema:()=>he,ZodSet:()=>Sg,ZodString:()=>gt,ZodSymbol:()=>Ug,ZodTransformer:()=>En,ZodTuple:()=>tr,ZodType:()=>he,ZodUndefined:()=>bo,ZodUnion:()=>Qa,ZodUnknown:()=>Nr,ZodVoid:()=>Kg,addIssueToContext:()=>te,agent:()=>$x,aimodel:()=>Wx,any:()=>nP,array:()=>aP,bigint:()=>Xx,boolean:()=>Wg,coerce:()=>OP,conversation:()=>Hx,createZodEnum:()=>vo,cuid2Regex:()=>Ig,cuidRegex:()=>kg,custom:()=>ug,datasource:()=>zx,date:()=>Yx,default:()=>EP,discriminatedUnion:()=>cP,effect:()=>Gc,emailRegex:()=>Og,enum:()=>bP,errorUtil:()=>ue,event:()=>jx,function:()=>vP,getErrorMap:()=>Zr,getParsedType:()=>rn,instanceof:()=>Vx,intent:()=>Fx,intersection:()=>fP,ipv4Regex:()=>Mg,ipv6Regex:()=>Ng,isAborted:()=>Ta,isAsync:()=>Si,isDirty:()=>_a,isEmojiRegex:()=>Mx,isValid:()=>$r,knowledgebase:()=>qx,late:()=>Gx,lazy:()=>TP,literal:()=>_P,makeIssue:()=>Ei,map:()=>mP,message:()=>Zx,nan:()=>Jx,nativeEnum:()=>wP,never:()=>iP,null:()=>tP,nullable:()=>BP,number:()=>Fg,object:()=>sP,objectUtil:()=>va,oboolean:()=>CP,onumber:()=>AP,optional:()=>PP,ostring:()=>IP,pipeline:()=>kP,preprocess:()=>SP,processCreateParams:()=>me,promise:()=>xP,quotelessJson:()=>kx,readonly:()=>yP,record:()=>pP,ref:()=>gP,set:()=>hP,setErrorMap:()=>tg,strictObject:()=>lP,string:()=>Lg,symbol:()=>Qx,table:()=>Kx,tablerow:()=>Lx,transformer:()=>Gc,tuple:()=>dP,ulidRegex:()=>Ag,undefined:()=>eP,union:()=>uP,unknown:()=>rP,user:()=>Ux,util:()=>be,uuidRegex:()=>Cg,variable:()=>Dx,void:()=>oP});var le="x-zui";function ef(t){return typeof t=="symbol"?"symbol":typeof t=="bigint"?`${t.toString()}n`:se(t)}d(ef,"primitiveToTypscriptLiteralType");function se(t){return typeof t>"u"?"undefined":typeof t=="symbol"?t.description?`Symbol(${se(t.description)})`:"Symbol()":typeof t=="bigint"?`BigInt(${t.toString()})`:JSON.stringify(t)}d(se,"primitiveToTypescriptValue");function Vn(t){return typeof t>"u"?"undefined":JSON.stringify(t)}d(Vn,"unknownToTypescriptValue");var tf=d((t,e)=>{let n=Object.entries(t),r=e?" as const":"";return`{ ${n.map(([o,a])=>`${ua(o)}: ${Vn(a)}`).join(", ")} }${r}`},"recordOfUnknownToTypescriptRecord"),ua=d(t=>/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t)?t:se(t),"toPropertyKey"),qv=d(t=>t.charAt(0).toUpperCase()+t.slice(1),"capitalize"),nf=d(t=>{let e=/[^a-zA-Z0-9_]/g;return t.split(e).map(qv).filter(r=>!!r).join("")},"toTypeArgumentName"),nt=d(t=>{let e=(t??"").split(`
14
14
  `).filter(n=>n.trim().length>0);return e.length===0?"":e.length===1?`/** ${e[0]} */`:`/**
15
15
  * ${e.join(`
16
16
  * `)}
17
- */`},"getMultilineComment"),rf={};oa(rf,{JSONSchemaToZuiError:()=>sa,ObjectToZuiError:()=>co,UnrepresentableGenericError:()=>fo,UnsupportedJSONSchemaToZuiError:()=>nn,UnsupportedZuiCheckToJSONSchemaError:()=>ff,UnsupportedZuiToJSONSchemaError:()=>dt,UnsupportedZuiToTypescriptSchemaError:()=>Tn,UnsupportedZuiToTypescriptTypeError:()=>vf,UntitledDeclarationError:()=>_f,ZuiToJSONSchemaError:()=>la,ZuiToTypescriptSchemaError:()=>gf,ZuiToTypescriptTypeError:()=>ua,ZuiTransformError:()=>ar});var af=class extends Error{constructor(e,n){super(n),this.transform=e}};d(af,"ZuiTransformError");var ar=af,of=class extends ar{constructor(e){super("json-schema-to-zui",e)}};d(of,"JSONSchemaToZuiError");var sa=of,sf=class extends ar{constructor(e){super("object-to-zui",e)}};d(sf,"ObjectToZuiError");var co=sf,lf=class extends ar{constructor(e){super("zui-to-json-schema",e)}};d(lf,"ZuiToJSONSchemaError");var la=lf,uf=class extends la{constructor(e,{suggestedAlternative:n}={}){super(`Zod type ${e} cannot be transformed to JSON Schema.`+(n?` Suggested alternative: ${n}`:""))}};d(uf,"UnsupportedZuiToJSONSchemaError");var dt=uf,cf=class extends la{constructor({zodType:e,checkKind:n}){super(`Zod check .${n}() of type ${e} cannot be transformed to JSON Schema.`)}};d(cf,"UnsupportedZuiCheckToJSONSchemaError");var ff=cf,df=class extends sa{constructor(e){super(`JSON Schema ${JSON.stringify(e)} cannot be transformed to ZUI type.`)}};d(df,"UnsupportedJSONSchemaToZuiError");var nn=df,pf=class extends ar{constructor(e){super("zui-to-typescript-schema",e)}};d(pf,"ZuiToTypescriptSchemaError");var gf=pf,yf=class extends gf{constructor(e){super(`Zod type ${e} cannot be transformed to TypeScript schema.`)}};d(yf,"UnsupportedZuiToTypescriptSchemaError");var Tn=yf,mf=class extends ar{constructor(e){super("zui-to-typescript-type",e)}};d(mf,"ZuiToTypescriptTypeError");var ua=mf,hf=class extends ua{constructor(e){super(`Zod type ${e} cannot be transformed to TypeScript type.`)}};d(hf,"UnsupportedZuiToTypescriptTypeError");var vf=hf,Tf=class extends ua{constructor(){super("Schema must have a title to be transformed to a TypeScript type with a declaration.")}};d(Tf,"UntitledDeclarationError");var _f=Tf,bf=class extends ua{constructor(){super('ZodRef can only be transformed to a TypeScript type with a "type" declaration.')}};d(bf,"UnrepresentableGenericError");var fo=bf,wf=["string","number","boolean","unknown","void","any","null","undefined","never","bigint","symbol","object"],Gv=d(t=>wf.includes(t),"isPrimitive"),Vv=d(t=>wf.map(e=>`${e}[]`).includes(t),"isArrayOfPrimitives"),yc=d(t=>t.replace(/ +/g," ").trim(),"stripSpaces"),xf=class{constructor(e,n,r=!1){this.key=e,this.value=n,this.optional=r}};d(xf,"KeyValue");var gi=xf,Pf=class{constructor(e){this.schema=e}};d(Pf,"FnParameters");var mc=Pf,Bf=class{constructor(e){this.schema=e}};d(Bf,"FnReturn");var hc=Bf,Ef=class{constructor(e){this.props=e}};d(Ef,"Declaration");var mi=Ef;function Eo(t,e={}){let n=Yv(t,e),r=ke(n,{});return e.formatter&&(r=e.formatter(r)),r}d(Eo,"toTypescriptType");function ke(t,e){var n,r,a;let o=N(_({},e),{parent:t});if(t===null)return"";if(t instanceof mi)return Jv(t,o);if(t instanceof gi){if(t.value instanceof M.ZodOptional){let h=t.value._def.innerType;return ke(new gi(t.key,h,!0),o)}let l=nt(t.value.description),f=l?.trim().length>0?`
18
- `:"",p=t.value.describe(""),g=t.optional||t.value.isOptional()?"?":"";return`${f}${l}${f}${t.key}${g}: ${ke(p,o)}${f}`}if(t instanceof mc){if(t.schema instanceof M.ZodTuple){let p="";for(let y=0;y<t.schema.items.length;y++){let g=(a=(r=(n=t.schema.items[y])==null?void 0:n.ui)==null?void 0:r.title)!=null?a:`arg${y}`,h=t.schema.items[y];p+=`${ke(new gi(uo(g),h),o)}${y<t.schema.items.length-1?", ":""} `}return p}let l=ke(t.schema,o);return l.startsWith("{")&&l.endsWith("}")||l.startsWith("[")&&l.endsWith("]")||l.startsWith("(")&&l.endsWith(")")||l.startsWith("Array<")&&l.endsWith(">")||l.startsWith("Record<")&&l.endsWith(">")||Vv(l)?`args: ${l}`:l}if(t instanceof hc)return t.schema instanceof M.ZodOptional?`${ke(t.schema.unwrap(),o)} | undefined`:ke(t.schema,o);let i=t,s=i._def;switch(s.typeName){case M.ZodFirstPartyTypeKind.ZodString:return`${nt(i.description)} string`.trim();case M.ZodFirstPartyTypeKind.ZodNumber:case M.ZodFirstPartyTypeKind.ZodNaN:case M.ZodFirstPartyTypeKind.ZodBigInt:return`${nt(i.description)} number`.trim();case M.ZodFirstPartyTypeKind.ZodBoolean:return`${nt(i.description)} boolean`.trim();case M.ZodFirstPartyTypeKind.ZodDate:return`${nt(i.description)} Date`.trim();case M.ZodFirstPartyTypeKind.ZodUndefined:return`${nt(i.description)} undefined`.trim();case M.ZodFirstPartyTypeKind.ZodNull:return`${nt(i.description)} null`.trim();case M.ZodFirstPartyTypeKind.ZodAny:return`${nt(i.description)} any`.trim();case M.ZodFirstPartyTypeKind.ZodUnknown:return`${nt(i.description)} unknown`.trim();case M.ZodFirstPartyTypeKind.ZodNever:return`${nt(i.description)} never`.trim();case M.ZodFirstPartyTypeKind.ZodVoid:return`${nt(i.description)} void`.trim();case M.ZodFirstPartyTypeKind.ZodArray:let l=ke(s.type,o);return Gv(l)?`${l}[]`:`Array<${l}>`;case M.ZodFirstPartyTypeKind.ZodObject:return`{ ${Object.entries(s.shape()).map(([E,H])=>ke(new gi(uo(E),H),o)).join("; ")} }`;case M.ZodFirstPartyTypeKind.ZodUnion:let p=s.options.map(E=>ke(E,o));return`${nt(i.description)}
19
- ${p.join(" | ")}`;case M.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:let y=s.options.map(E=>ke(E,o));return`${nt(i.description)}
20
- ${y.join(" | ")}`;case M.ZodFirstPartyTypeKind.ZodIntersection:return`${ke(s.left,o)} & ${ke(s.right,o)}`;case M.ZodFirstPartyTypeKind.ZodTuple:return s.items.length===0?"":`[${s.items.map(E=>ke(E,o)).join(", ")}]`;case M.ZodFirstPartyTypeKind.ZodRecord:let h=ke(s.keyType,o),w=ke(s.valueType,o);return`${nt(i.description)} { [key: ${h}]: ${w} }`;case M.ZodFirstPartyTypeKind.ZodMap:return`Map<${ke(s.keyType,o)}, ${ke(s.valueType,o)}>`;case M.ZodFirstPartyTypeKind.ZodSet:return`Set<${ke(s.valueType,o)}>`;case M.ZodFirstPartyTypeKind.ZodFunction:let P=ke(new mc(s.args),o),B=ke(new hc(s.returns),o);return`${nt(i.description)}
21
- (${P}) => ${B}`;case M.ZodFirstPartyTypeKind.ZodLazy:return ke(s.getter(),o);case M.ZodFirstPartyTypeKind.ZodLiteral:let v=ef(s.value);return`${nt(i.description)}
22
- ${v}`.trim();case M.ZodFirstPartyTypeKind.ZodEnum:return s.values.map(se).join(" | ");case M.ZodFirstPartyTypeKind.ZodEffects:return ke(s.schema,o);case M.ZodFirstPartyTypeKind.ZodNativeEnum:throw new vf(M.ZodFirstPartyTypeKind.ZodNativeEnum);case M.ZodFirstPartyTypeKind.ZodOptional:return`${ke(s.innerType,o)} | undefined`;case M.ZodFirstPartyTypeKind.ZodNullable:return`${ke(s.innerType,o)} | null`;case M.ZodFirstPartyTypeKind.ZodDefault:return ke(s.innerType,o);case M.ZodFirstPartyTypeKind.ZodCatch:return ke(s.innerType,o);case M.ZodFirstPartyTypeKind.ZodPromise:return`Promise<${ke(s.type,o)}>`;case M.ZodFirstPartyTypeKind.ZodBranded:return ke(s.type,o);case M.ZodFirstPartyTypeKind.ZodPipeline:return ke(s.in,o);case M.ZodFirstPartyTypeKind.ZodSymbol:return`${nt(i.description)} symbol`.trim();case M.ZodFirstPartyTypeKind.ZodReadonly:return`Readonly<${ke(s.innerType,o)}>`;case M.ZodFirstPartyTypeKind.ZodRef:return nf(s.uri);default:be.assertNever(s)}}d(ke,"sUnwrapZod");var Jv=d((t,e)=>{if(t.props.type==="none")return ke(t.props.schema,e);let n=nt(t.props.schema.description),r=t.props.schema.describe(""),a=ke(r,e);if(t.props.type==="variable")return yc(`${n}declare const ${t.props.identifier}: ${a};`);let o=t.props.args.length>0?`<${t.props.args.map(nf).join(", ")}>`:"";return yc(`${n}type ${t.props.identifier}${o} = ${a};`)},"unwrapDeclaration"),Xv=d(t=>t.declaration?t.declaration===!0?"variable":t.declaration:"none","getDeclarationType"),Yv=d((t,e)=>{let n=Xv(e),r=t.getReferences();if(n==="none"){if(r.length>0)throw new fo;return new mi({type:"none",schema:t})}let a="title"in t.ui?t.ui.title:null;if(!a)throw new _f;if(n==="variable"){if(r.length>0)throw new fo;return new mi({type:"variable",identifier:a,schema:t})}return new mi({type:"type",identifier:a,schema:t,args:r})},"getDeclarationProps"),Qv=typeof global=="object"&&global&&global.Object===Object&&global,Sf=Qv,eT=typeof self=="object"&&self&&self.Object===Object&&self,tT=Sf||eT||Function("return this")(),Ft=tT,nT=Ft.Symbol,on=nT,kf=Object.prototype,rT=kf.hasOwnProperty,iT=kf.toString,wr=on?on.toStringTag:void 0;function If(t){var e=rT.call(t,wr),n=t[wr];try{t[wr]=void 0;var r=!0}catch{}var a=iT.call(t);return r&&(e?t[wr]=n:delete t[wr]),a}d(If,"getRawTag");var aT=If,oT=Object.prototype,sT=oT.toString;function Af(t){return sT.call(t)}d(Af,"objectToString");var lT=Af,uT="[object Null]",cT="[object Undefined]",vc=on?on.toStringTag:void 0;function Cf(t){return t==null?t===void 0?cT:uT:vc&&vc in Object(t)?aT(t):lT(t)}d(Cf,"baseGetTag");var Sn=Cf;function Of(t){return t!=null&&typeof t=="object"}d(Of,"isObjectLike");var Bn=Of,fT="[object Symbol]";function Rf(t){return typeof t=="symbol"||Bn(t)&&Sn(t)==fT}d(Rf,"isSymbol");var So=Rf;function Mf(t,e){for(var n=-1,r=t==null?0:t.length,a=Array(r);++n<r;)a[n]=e(t[n],n,t);return a}d(Mf,"arrayMap");var Nf=Mf,dT=Array.isArray,Lt=dT,pT=1/0,Tc=on?on.prototype:void 0,_c=Tc?Tc.toString:void 0;function ko(t){if(typeof t=="string")return t;if(Lt(t))return Nf(t,ko)+"";if(So(t))return _c?_c.call(t):"";var e=t+"";return e=="0"&&1/t==-pT?"-0":e}d(ko,"baseToString");var gT=ko;function Df(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}d(Df,"isObject");var er=Df;function Hf(t){return t}d(Hf,"identity");var yT=Hf,mT="[object AsyncFunction]",hT="[object Function]",vT="[object GeneratorFunction]",TT="[object Proxy]";function Uf(t){if(!er(t))return!1;var e=Sn(t);return e==hT||e==vT||e==mT||e==TT}d(Uf,"isFunction");var Zf=Uf,_T=Ft["__core-js_shared__"],ro=_T,bc=function(){var t=/[^.]+$/.exec(ro&&ro.keys&&ro.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function $f(t){return!!bc&&bc in t}d($f,"isMasked");var bT=$f,wT=Function.prototype,xT=wT.toString;function jf(t){if(t!=null){try{return xT.call(t)}catch{}try{return t+""}catch{}}return""}d(jf,"toSource");var kn=jf,PT=/[\\^$.*+?()[\]{}|]/g,BT=/^\[object .+?Constructor\]$/,ET=Function.prototype,ST=Object.prototype,kT=ET.toString,IT=ST.hasOwnProperty,AT=RegExp("^"+kT.call(IT).replace(PT,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Kf(t){if(!er(t)||bT(t))return!1;var e=Zf(t)?AT:BT;return e.test(kn(t))}d(Kf,"baseIsNative");var CT=Kf;function Lf(t,e){return t?.[e]}d(Lf,"getValue");var OT=Lf;function Ff(t,e){var n=OT(t,e);return CT(n)?n:void 0}d(Ff,"getNative");var In=Ff,RT=In(Ft,"WeakMap"),po=RT,MT=function(){try{var t=In(Object,"defineProperty");return t({},"",{}),t}catch{}}(),wc=MT,NT=9007199254740991,DT=/^(?:0|[1-9]\d*)$/;function Wf(t,e){var n=typeof t;return e=e??NT,!!e&&(n=="number"||n!="symbol"&&DT.test(t))&&t>-1&&t%1==0&&t<e}d(Wf,"isIndex");var Io=Wf;function zf(t,e,n){e=="__proto__"&&wc?wc(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}d(zf,"baseAssignValue");var qf=zf;function Gf(t,e){return t===e||t!==t&&e!==e}d(Gf,"eq");var Ao=Gf,HT=Object.prototype,UT=HT.hasOwnProperty;function Vf(t,e,n){var r=t[e];(!(UT.call(t,e)&&Ao(r,n))||n===void 0&&!(e in t))&&qf(t,e,n)}d(Vf,"assignValue");var ZT=Vf,$T=9007199254740991;function Jf(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=$T}d(Jf,"isLength");var Co=Jf;function Xf(t){return t!=null&&Co(t.length)&&!Zf(t)}d(Xf,"isArrayLike");var Yf=Xf,jT=Object.prototype;function Qf(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||jT;return t===n}d(Qf,"isPrototype");var ed=Qf;function td(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}d(td,"baseTimes");var KT=td,LT="[object Arguments]";function nd(t){return Bn(t)&&Sn(t)==LT}d(nd,"baseIsArguments");var xc=nd,rd=Object.prototype,FT=rd.hasOwnProperty,WT=rd.propertyIsEnumerable,zT=xc(function(){return arguments}())?xc:function(t){return Bn(t)&&FT.call(t,"callee")&&!WT.call(t,"callee")},id=zT;function ad(){return!1}d(ad,"stubFalse");var qT=ad,od=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Pc=od&&typeof module=="object"&&module&&!module.nodeType&&module,GT=Pc&&Pc.exports===od,Bc=GT?Ft.Buffer:void 0,VT=Bc?Bc.isBuffer:void 0,JT=VT||qT,go=JT,XT="[object Arguments]",YT="[object Array]",QT="[object Boolean]",e_="[object Date]",t_="[object Error]",n_="[object Function]",r_="[object Map]",i_="[object Number]",a_="[object Object]",o_="[object RegExp]",s_="[object Set]",l_="[object String]",u_="[object WeakMap]",c_="[object ArrayBuffer]",f_="[object DataView]",d_="[object Float32Array]",p_="[object Float64Array]",g_="[object Int8Array]",y_="[object Int16Array]",m_="[object Int32Array]",h_="[object Uint8Array]",v_="[object Uint8ClampedArray]",T_="[object Uint16Array]",__="[object Uint32Array]",Ze={};Ze[d_]=Ze[p_]=Ze[g_]=Ze[y_]=Ze[m_]=Ze[h_]=Ze[v_]=Ze[T_]=Ze[__]=!0;Ze[XT]=Ze[YT]=Ze[c_]=Ze[QT]=Ze[f_]=Ze[e_]=Ze[t_]=Ze[n_]=Ze[r_]=Ze[i_]=Ze[a_]=Ze[o_]=Ze[s_]=Ze[l_]=Ze[u_]=!1;function sd(t){return Bn(t)&&Co(t.length)&&!!Ze[Sn(t)]}d(sd,"baseIsTypedArray");var b_=sd;function ld(t){return function(e){return t(e)}}d(ld,"baseUnary");var w_=ld,ud=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Dr=ud&&typeof module=="object"&&module&&!module.nodeType&&module,x_=Dr&&Dr.exports===ud,io=x_&&Sf.process,P_=function(){try{var t=Dr&&Dr.require&&Dr.require("util").types;return t||io&&io.binding&&io.binding("util")}catch{}}(),Ec=P_,Sc=Ec&&Ec.isTypedArray,B_=Sc?w_(Sc):b_,cd=B_,E_=Object.prototype,S_=E_.hasOwnProperty;function fd(t,e){var n=Lt(t),r=!n&&id(t),a=!n&&!r&&go(t),o=!n&&!r&&!a&&cd(t),i=n||r||a||o,s=i?KT(t.length,String):[],l=s.length;for(var f in t)(e||S_.call(t,f))&&!(i&&(f=="length"||a&&(f=="offset"||f=="parent")||o&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||Io(f,l)))&&s.push(f);return s}d(fd,"arrayLikeKeys");var dd=fd;function pd(t,e){return function(n){return t(e(n))}}d(pd,"overArg");var gd=pd,k_=gd(Object.keys,Object),I_=k_,A_=Object.prototype,C_=A_.hasOwnProperty;function yd(t){if(!ed(t))return I_(t);var e=[];for(var n in Object(t))C_.call(t,n)&&n!="constructor"&&e.push(n);return e}d(yd,"baseKeys");var O_=yd;function md(t){return Yf(t)?dd(t):O_(t)}d(md,"keys");var Oo=md;function hd(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}d(hd,"nativeKeysIn");var R_=hd,M_=Object.prototype,N_=M_.hasOwnProperty;function vd(t){if(!er(t))return R_(t);var e=ed(t),n=[];for(var r in t)r=="constructor"&&(e||!N_.call(t,r))||n.push(r);return n}d(vd,"baseKeysIn");var D_=vd;function Td(t){return Yf(t)?dd(t,!0):D_(t)}d(Td,"keysIn");var H_=Td,U_=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Z_=/^\w*$/;function _d(t,e){if(Lt(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||So(t)?!0:Z_.test(t)||!U_.test(t)||e!=null&&t in Object(e)}d(_d,"isKey");var Ro=_d,$_=In(Object,"create"),Zr=$_;function bd(){this.__data__=Zr?Zr(null):{},this.size=0}d(bd,"hashClear");var j_=bd;function wd(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}d(wd,"hashDelete");var K_=wd,L_="__lodash_hash_undefined__",F_=Object.prototype,W_=F_.hasOwnProperty;function xd(t){var e=this.__data__;if(Zr){var n=e[t];return n===L_?void 0:n}return W_.call(e,t)?e[t]:void 0}d(xd,"hashGet");var z_=xd,q_=Object.prototype,G_=q_.hasOwnProperty;function Pd(t){var e=this.__data__;return Zr?e[t]!==void 0:G_.call(e,t)}d(Pd,"hashHas");var V_=Pd,J_="__lodash_hash_undefined__";function Bd(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Zr&&e===void 0?J_:e,this}d(Bd,"hashSet");var X_=Bd;function An(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])}}d(An,"Hash");An.prototype.clear=j_;An.prototype.delete=K_;An.prototype.get=z_;An.prototype.has=V_;An.prototype.set=X_;var kc=An;function Ed(){this.__data__=[],this.size=0}d(Ed,"listCacheClear");var Y_=Ed;function Sd(t,e){for(var n=t.length;n--;)if(Ao(t[n][0],e))return n;return-1}d(Sd,"assocIndexOf");var ca=Sd,Q_=Array.prototype,eb=Q_.splice;function kd(t){var e=this.__data__,n=ca(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():eb.call(e,n,1),--this.size,!0}d(kd,"listCacheDelete");var tb=kd;function Id(t){var e=this.__data__,n=ca(e,t);return n<0?void 0:e[n][1]}d(Id,"listCacheGet");var nb=Id;function Ad(t){return ca(this.__data__,t)>-1}d(Ad,"listCacheHas");var rb=Ad;function Cd(t,e){var n=this.__data__,r=ca(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}d(Cd,"listCacheSet");var ib=Cd;function Cn(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])}}d(Cn,"ListCache");Cn.prototype.clear=Y_;Cn.prototype.delete=tb;Cn.prototype.get=nb;Cn.prototype.has=rb;Cn.prototype.set=ib;var fa=Cn,ab=In(Ft,"Map"),$r=ab;function Od(){this.size=0,this.__data__={hash:new kc,map:new($r||fa),string:new kc}}d(Od,"mapCacheClear");var ob=Od;function Rd(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}d(Rd,"isKeyable");var sb=Rd;function Md(t,e){var n=t.__data__;return sb(e)?n[typeof e=="string"?"string":"hash"]:n.map}d(Md,"getMapData");var da=Md;function Nd(t){var e=da(this,t).delete(t);return this.size-=e?1:0,e}d(Nd,"mapCacheDelete");var lb=Nd;function Dd(t){return da(this,t).get(t)}d(Dd,"mapCacheGet");var ub=Dd;function Hd(t){return da(this,t).has(t)}d(Hd,"mapCacheHas");var cb=Hd;function Ud(t,e){var n=da(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}d(Ud,"mapCacheSet");var fb=Ud;function On(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])}}d(On,"MapCache");On.prototype.clear=ob;On.prototype.delete=lb;On.prototype.get=ub;On.prototype.has=cb;On.prototype.set=fb;var pa=On,db="Expected a function";function ga(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(db);var n=d(function(){var r=arguments,a=e?e.apply(this,r):r[0],o=n.cache;if(o.has(a))return o.get(a);var i=t.apply(this,r);return n.cache=o.set(a,i)||o,i},"memoized");return n.cache=new(ga.Cache||pa),n}d(ga,"memoize");ga.Cache=pa;var pb=ga,gb=500;function Zd(t){var e=pb(t,function(r){return n.size===gb&&n.clear(),r}),n=e.cache;return e}d(Zd,"memoizeCapped");var yb=Zd,mb=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,hb=/\\(\\)?/g,vb=yb(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(mb,function(n,r,a,o){e.push(a?o.replace(hb,"$1"):r||n)}),e}),Tb=vb;function $d(t){return t==null?"":gT(t)}d($d,"toString");var _b=$d;function jd(t,e){return Lt(t)?t:Ro(t,e)?[t]:Tb(_b(t))}d(jd,"castPath");var ya=jd,bb=1/0;function Kd(t){if(typeof t=="string"||So(t))return t;var e=t+"";return e=="0"&&1/t==-bb?"-0":e}d(Kd,"toKey");var qr=Kd;function Ld(t,e){e=ya(e,t);for(var n=0,r=e.length;t!=null&&n<r;)t=t[qr(e[n++])];return n&&n==r?t:void 0}d(Ld,"baseGet");var Mo=Ld;function Fd(t,e,n){var r=t==null?void 0:Mo(t,e);return r===void 0?n:r}d(Fd,"get");var wb=Fd;function Wd(t,e){for(var n=-1,r=e.length,a=t.length;++n<r;)t[a+n]=e[n];return t}d(Wd,"arrayPush");var zd=Wd,xb=gd(Object.getPrototypeOf,Object),qd=xb,Pb="[object Object]",Bb=Function.prototype,Eb=Object.prototype,Gd=Bb.toString,Sb=Eb.hasOwnProperty,kb=Gd.call(Object);function Vd(t){if(!Bn(t)||Sn(t)!=Pb)return!1;var e=qd(t);if(e===null)return!0;var n=Sb.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&Gd.call(n)==kb}d(Vd,"isPlainObject");var Ic=Vd;function Jd(){this.__data__=new fa,this.size=0}d(Jd,"stackClear");var Ib=Jd;function Xd(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}d(Xd,"stackDelete");var Ab=Xd;function Yd(t){return this.__data__.get(t)}d(Yd,"stackGet");var Cb=Yd;function Qd(t){return this.__data__.has(t)}d(Qd,"stackHas");var Ob=Qd,Rb=200;function ep(t,e){var n=this.__data__;if(n instanceof fa){var r=n.__data__;if(!$r||r.length<Rb-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new pa(r)}return n.set(t,e),this.size=n.size,this}d(ep,"stackSet");var Mb=ep;function Rn(t){var e=this.__data__=new fa(t);this.size=e.size}d(Rn,"Stack");Rn.prototype.clear=Ib;Rn.prototype.delete=Ab;Rn.prototype.get=Cb;Rn.prototype.has=Ob;Rn.prototype.set=Mb;var hi=Rn;function tp(t,e){for(var n=-1,r=t==null?0:t.length,a=0,o=[];++n<r;){var i=t[n];e(i,n,t)&&(o[a++]=i)}return o}d(tp,"arrayFilter");var Nb=tp;function np(){return[]}d(np,"stubArray");var rp=np,Db=Object.prototype,Hb=Db.propertyIsEnumerable,Ac=Object.getOwnPropertySymbols,Ub=Ac?function(t){return t==null?[]:(t=Object(t),Nb(Ac(t),function(e){return Hb.call(t,e)}))}:rp,ip=Ub,Zb=Object.getOwnPropertySymbols,$b=Zb?function(t){for(var e=[];t;)zd(e,ip(t)),t=qd(t);return e}:rp,jb=$b;function ap(t,e,n){var r=e(t);return Lt(t)?r:zd(r,n(t))}d(ap,"baseGetAllKeys");var op=ap;function sp(t){return op(t,Oo,ip)}d(sp,"getAllKeys");var Cc=sp;function lp(t){return op(t,H_,jb)}d(lp,"getAllKeysIn");var Kb=lp,Lb=In(Ft,"DataView"),yo=Lb,Fb=In(Ft,"Promise"),mo=Fb,Wb=In(Ft,"Set"),ho=Wb,Oc="[object Map]",zb="[object Object]",Rc="[object Promise]",Mc="[object Set]",Nc="[object WeakMap]",Dc="[object DataView]",qb=kn(yo),Gb=kn($r),Vb=kn(mo),Jb=kn(ho),Xb=kn(po),_n=Sn;(yo&&_n(new yo(new ArrayBuffer(1)))!=Dc||$r&&_n(new $r)!=Oc||mo&&_n(mo.resolve())!=Rc||ho&&_n(new ho)!=Mc||po&&_n(new po)!=Nc)&&(_n=d(function(t){var e=Sn(t),n=e==zb?t.constructor:void 0,r=n?kn(n):"";if(r)switch(r){case qb:return Dc;case Gb:return Oc;case Vb:return Rc;case Jb:return Mc;case Xb:return Nc}return e},"getTag"));var Hc=_n,Yb=Ft.Uint8Array,Uc=Yb,Qb="__lodash_hash_undefined__";function up(t){return this.__data__.set(t,Qb),this}d(up,"setCacheAdd");var ew=up;function cp(t){return this.__data__.has(t)}d(cp,"setCacheHas");var tw=cp;function jr(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new pa;++e<n;)this.add(t[e])}d(jr,"SetCache");jr.prototype.add=jr.prototype.push=ew;jr.prototype.has=tw;var nw=jr;function fp(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}d(fp,"arraySome");var rw=fp;function dp(t,e){return t.has(e)}d(dp,"cacheHas");var iw=dp,aw=1,ow=2;function pp(t,e,n,r,a,o){var i=n&aw,s=t.length,l=e.length;if(s!=l&&!(i&&l>s))return!1;var f=o.get(t),p=o.get(e);if(f&&p)return f==e&&p==t;var y=-1,g=!0,h=n&ow?new nw:void 0;for(o.set(t,e),o.set(e,t);++y<s;){var w=t[y],P=e[y];if(r)var B=i?r(P,w,y,e,t,o):r(w,P,y,t,e,o);if(B!==void 0){if(B)continue;g=!1;break}if(h){if(!rw(e,function(v,S){if(!iw(h,S)&&(w===v||a(w,v,n,r,o)))return h.push(S)})){g=!1;break}}else if(!(w===P||a(w,P,n,r,o))){g=!1;break}}return o.delete(t),o.delete(e),g}d(pp,"equalArrays");var gp=pp;function yp(t){var e=-1,n=Array(t.size);return t.forEach(function(r,a){n[++e]=[a,r]}),n}d(yp,"mapToArray");var sw=yp;function mp(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}d(mp,"setToArray");var lw=mp,uw=1,cw=2,fw="[object Boolean]",dw="[object Date]",pw="[object Error]",gw="[object Map]",yw="[object Number]",mw="[object RegExp]",hw="[object Set]",vw="[object String]",Tw="[object Symbol]",_w="[object ArrayBuffer]",bw="[object DataView]",Zc=on?on.prototype:void 0,ao=Zc?Zc.valueOf:void 0;function hp(t,e,n,r,a,o,i){switch(n){case bw:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case _w:return!(t.byteLength!=e.byteLength||!o(new Uc(t),new Uc(e)));case fw:case dw:case yw:return Ao(+t,+e);case pw:return t.name==e.name&&t.message==e.message;case mw:case vw:return t==e+"";case gw:var s=sw;case hw:var l=r&uw;if(s||(s=lw),t.size!=e.size&&!l)return!1;var f=i.get(t);if(f)return f==e;r|=cw,i.set(t,e);var p=gp(s(t),s(e),r,a,o,i);return i.delete(t),p;case Tw:if(ao)return ao.call(t)==ao.call(e)}return!1}d(hp,"equalByTag");var ww=hp,xw=1,Pw=Object.prototype,Bw=Pw.hasOwnProperty;function vp(t,e,n,r,a,o){var i=n&xw,s=Cc(t),l=s.length,f=Cc(e),p=f.length;if(l!=p&&!i)return!1;for(var y=l;y--;){var g=s[y];if(!(i?g in e:Bw.call(e,g)))return!1}var h=o.get(t),w=o.get(e);if(h&&w)return h==e&&w==t;var P=!0;o.set(t,e),o.set(e,t);for(var B=i;++y<l;){g=s[y];var v=t[g],S=e[g];if(r)var E=i?r(S,v,g,e,t,o):r(v,S,g,t,e,o);if(!(E===void 0?v===S||a(v,S,n,r,o):E)){P=!1;break}B||(B=g=="constructor")}if(P&&!B){var H=t.constructor,K=e.constructor;H!=K&&"constructor"in t&&"constructor"in e&&!(typeof H=="function"&&H instanceof H&&typeof K=="function"&&K instanceof K)&&(P=!1)}return o.delete(t),o.delete(e),P}d(vp,"equalObjects");var Ew=vp,Sw=1,$c="[object Arguments]",jc="[object Array]",yi="[object Object]",kw=Object.prototype,Kc=kw.hasOwnProperty;function Tp(t,e,n,r,a,o){var i=Lt(t),s=Lt(e),l=i?jc:Hc(t),f=s?jc:Hc(e);l=l==$c?yi:l,f=f==$c?yi:f;var p=l==yi,y=f==yi,g=l==f;if(g&&go(t)){if(!go(e))return!1;i=!0,p=!1}if(g&&!p)return o||(o=new hi),i||cd(t)?gp(t,e,n,r,a,o):ww(t,e,l,n,r,a,o);if(!(n&Sw)){var h=p&&Kc.call(t,"__wrapped__"),w=y&&Kc.call(e,"__wrapped__");if(h||w){var P=h?t.value():t,B=w?e.value():e;return o||(o=new hi),a(P,B,n,r,o)}}return g?(o||(o=new hi),Ew(t,e,n,r,a,o)):!1}d(Tp,"baseIsEqualDeep");var Iw=Tp;function No(t,e,n,r,a){return t===e?!0:t==null||e==null||!Bn(t)&&!Bn(e)?t!==t&&e!==e:Iw(t,e,n,r,No,a)}d(No,"baseIsEqual");var ma=No,Aw=1,Cw=2;function _p(t,e,n,r){var a=n.length,o=a,i=!r;if(t==null)return!o;for(t=Object(t);a--;){var s=n[a];if(i&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++a<o;){s=n[a];var l=s[0],f=t[l],p=s[1];if(i&&s[2]){if(f===void 0&&!(l in t))return!1}else{var y=new hi;if(r)var g=r(f,p,l,t,e,y);if(!(g===void 0?ma(p,f,Aw|Cw,r,y):g))return!1}}return!0}d(_p,"baseIsMatch");var Ow=_p;function bp(t){return t===t&&!er(t)}d(bp,"isStrictComparable");var wp=bp;function xp(t){for(var e=Oo(t),n=e.length;n--;){var r=e[n],a=t[r];e[n]=[r,a,wp(a)]}return e}d(xp,"getMatchData");var Rw=xp;function Pp(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}d(Pp,"matchesStrictComparable");var Bp=Pp;function Ep(t){var e=Rw(t);return e.length==1&&e[0][2]?Bp(e[0][0],e[0][1]):function(n){return n===t||Ow(n,t,e)}}d(Ep,"baseMatches");var Mw=Ep;function Sp(t,e){return t!=null&&e in Object(t)}d(Sp,"baseHasIn");var Nw=Sp;function kp(t,e,n){e=ya(e,t);for(var r=-1,a=e.length,o=!1;++r<a;){var i=qr(e[r]);if(!(o=t!=null&&n(t,i)))break;t=t[i]}return o||++r!=a?o:(a=t==null?0:t.length,!!a&&Co(a)&&Io(i,a)&&(Lt(t)||id(t)))}d(kp,"hasPath");var Dw=kp;function Ip(t,e){return t!=null&&Dw(t,e,Nw)}d(Ip,"hasIn");var Hw=Ip,Uw=1,Zw=2;function Ap(t,e){return Ro(t)&&wp(e)?Bp(qr(t),e):function(n){var r=wb(n,t);return r===void 0&&r===e?Hw(n,t):ma(e,r,Uw|Zw)}}d(Ap,"baseMatchesProperty");var $w=Ap;function Cp(t){return function(e){return e?.[t]}}d(Cp,"baseProperty");var jw=Cp;function Op(t){return function(e){return Mo(e,t)}}d(Op,"basePropertyDeep");var Kw=Op;function Rp(t){return Ro(t)?jw(qr(t)):Kw(t)}d(Rp,"property");var Lw=Rp;function Mp(t){return typeof t=="function"?t:t==null?yT:typeof t=="object"?Lt(t)?$w(t[0],t[1]):Mw(t):Lw(t)}d(Mp,"baseIteratee");var Do=Mp;function Np(t){return function(e,n,r){for(var a=-1,o=Object(e),i=r(e),s=i.length;s--;){var l=i[t?s:++a];if(n(o[l],l,o)===!1)break}return e}}d(Np,"createBaseFor");var Fw=Np,Ww=Fw(),zw=Ww;function Dp(t,e){return t&&zw(t,e,Oo)}d(Dp,"baseForOwn");var qw=Dp;function Hp(t,e){return ma(t,e)}d(Hp,"isEqual");var Qn=Hp;function Up(t,e,n){n=typeof n=="function"?n:void 0;var r=n?n(t,e):void 0;return r===void 0?ma(t,e,void 0,n):!!r}d(Up,"isEqualWith");var Gw=Up;function Zp(t){return t===void 0}d(Zp,"isUndefined");var Lc=Zp;function $p(t,e){var n={};return e=Do(e,3),qw(t,function(r,a,o){qf(n,a,e(r,a,o))}),n}d($p,"mapValues");var Vw=$p,Jw="Expected a function";function jp(t){if(typeof t!="function")throw new TypeError(Jw);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)}}d(jp,"negate");var Xw=jp;function Kp(t,e,n,r){if(!er(t))return t;e=ya(e,t);for(var a=-1,o=e.length,i=o-1,s=t;s!=null&&++a<o;){var l=qr(e[a]),f=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return t;if(a!=i){var p=s[l];f=r?r(p,l,s):void 0,f===void 0&&(f=er(p)?p:Io(e[a+1])?[]:{})}ZT(s,l,f),s=s[l]}return t}d(Kp,"baseSet");var Yw=Kp;function Lp(t,e,n){for(var r=-1,a=e.length,o={};++r<a;){var i=e[r],s=Mo(t,i);n(s,i)&&Yw(o,ya(i,t),s)}return o}d(Lp,"basePickBy");var Qw=Lp;function Fp(t,e){if(t==null)return{};var n=Nf(Kb(t),function(r){return[r]});return e=Do(e),Qw(t,n,function(r,a){return e(r,a[0])})}d(Fp,"pickBy");var ex=Fp;function Wp(t,e){return ex(t,Xw(Do(e)))}d(Wp,"omitBy");var Fc=Wp,tx=d(t=>{let e=t.checks;return e.length===0?"":e.map(nx).join("")},"generateStringChecks"),nx=d(t=>{switch(t.kind){case"min":return`.min(${se(t.value)}, ${se(t.message)})`;case"max":return`.max(${se(t.value)}, ${se(t.message)})`;case"length":return`.length(${se(t.value)}, ${se(t.message)})`;case"email":return`.email(${se(t.message)})`;case"url":return`.url(${se(t.message)})`;case"emoji":return`.emoji(${se(t.message)})`;case"uuid":return`.uuid(${se(t.message)})`;case"cuid":return`.cuid(${se(t.message)})`;case"cuid2":return`.cuid2(${se(t.message)})`;case"ulid":return`.ulid(${se(t.message)})`;case"includes":let e=Yn({message:t.message,position:t.position});return`.includes(${se(t.value)}, ${e})`;case"startsWith":return`.startsWith(${se(t.value)}, ${se(t.message)})`;case"endsWith":return`.endsWith(${se(t.value)}, ${se(t.message)})`;case"regex":return`.regex(${String(t.regex)}, ${se(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(${Yn({message:t.message,precision:r,offset:t.offset})})`;case"ip":return`.ip(${Yn({message:t.message,version:t.version})})`;default:return""}},"_generateStringCheck"),rx=d(t=>{let e=t.checks;return e.length===0?"":e.map(ix).join("")},"generateNumberChecks"),ix=d(t=>{switch(t.kind){case"min":return`.min(${se(t.value)}, ${se(t.message)})`;case"max":return`.max(${se(t.value)}, ${se(t.message)})`;case"int":return`.int(${se(t.message)})`;case"multipleOf":return`.multipleOf(${se(t.value)}, ${se(t.message)})`;case"finite":return`.finite(${se(t.message)})`;default:return""}},"_generateNumberCheck"),ax=d(t=>{let e=t.checks;return e.length===0?"":e.map(ox).join("")},"generateBigIntChecks"),ox=d(t=>{switch(t.kind){case"min":return`.min(${se(t.value)}, ${se(t.message)})`;case"max":return`.max(${se(t.value)}, ${se(t.message)})`;case"multipleOf":return`.multipleOf(${se(t.value)}, ${se(t.message)})`;default:return""}},"_generateBigIntCheck"),sx=d(t=>{let e=t.checks;return e.length===0?"":e.map(lx).join("")},"generateDateChecks"),lx=d(t=>{switch(t.kind){case"min":return`.min(${Wc(t.value)}, ${se(t.message)})`;case"max":return`.max(${Wc(t.value)}, ${se(t.message)})`;default:return""}},"_generateDateCheck"),Wc=d(t=>`new Date(${t})`,"dateTs"),ux=d(t=>{let e=[];if(t.exactLength){let{value:n,message:r}=t.exactLength;e.push(`.length(${se(n)}, ${se(r)})`)}if(t.minLength){let{value:n,message:r}=t.minLength;e.push(`.min(${se(n)}, ${se(r)})`)}if(t.maxLength){let{value:n,message:r}=t.maxLength;e.push(`.max(${se(n)}, ${se(r)})`)}return e.join("")},"generateArrayChecks"),cx=d(t=>{let e=[];if(t.minSize){let{value:n,message:r}=t.minSize;e.push(`.min(${se(n)}, ${se(r)})`)}if(t.maxSize){let{value:n,message:r}=t.maxSize;e.push(`.max(${se(n)}, ${se(r)})`)}return e.join("")},"generateSetChecks");function Ho(t){return Fe(t)}d(Ho,"toTypescriptSchema");function Fe(t){let n=t._def;switch(n.typeName){case M.ZodFirstPartyTypeKind.ZodString:return`z.string()${tx(n)}${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodNumber:return`z.number()${rx(n)}${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodNaN:return`z.nan()${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodBigInt:return`z.bigint()${ax(n)}${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodBoolean:return`z.boolean()${Ce(n)}${Ae(t._def)}`.trim();case M.ZodFirstPartyTypeKind.ZodDate:return`z.date()${sx(n)}${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodUndefined:return`z.undefined()${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodNull:return`z.null()${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodAny:return`z.any()${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodUnknown:return`z.unknown()${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodNever:return`z.never()${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodVoid:return`z.void()${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodArray:return`z.array(${Fe(n.type)})${ux(n)}${Ce(n)}${Ae(n)}`;case M.ZodFirstPartyTypeKind.ZodObject:let r=Vw(n.shape(),Fe),a=t.additionalProperties(),o=a?`.catchall(${Fe(a)})`:"";return["z.object({",...Object.entries(r).map(([ee,ge])=>` ${ee}: ${ge},`),`})${o}${Ce(n)}${Ae(n)}`].join(`
23
- `).trim();case M.ZodFirstPartyTypeKind.ZodUnion:return`z.union([${n.options.map(Fe).join(", ")}])${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:let s=n.options.map(Fe);return`z.discriminatedUnion(${se(n.discriminator)}, [${s.join(", ")}])${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodIntersection:let f=Fe(n.left),p=Fe(n.right);return`z.intersection(${f}, ${p})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodTuple:return`z.tuple([${n.items.map(Fe).join(", ")}])${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodRecord:let g=Fe(n.keyType),h=Fe(n.valueType);return`z.record(${g}, ${h})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodMap:let w=Fe(n.keyType),P=Fe(n.valueType);return`z.map(${w}, ${P})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodSet:return`z.set(${Fe(n.valueType)})${cx(n)}${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodFunction:let B=n.args.items.map(Fe),v=B.length?`.args(${B.join(", ")})`:"",S=Fe(n.returns);return`z.function()${v}.returns(${S})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodLazy:return`z.lazy(() => ${Fe(n.getter())})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodLiteral:return`z.literal(${se(n.value)})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodEnum:return`z.enum([${n.values.map(se).join(", ")}])${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodEffects:throw new Tn(M.ZodFirstPartyTypeKind.ZodEffects);case M.ZodFirstPartyTypeKind.ZodNativeEnum:throw new Tn(M.ZodFirstPartyTypeKind.ZodNativeEnum);case M.ZodFirstPartyTypeKind.ZodOptional:return`z.optional(${Fe(n.innerType)})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodNullable:return`z.nullable(${Fe(n.innerType)})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodDefault:let K=Yn(n.defaultValue());return`z.default(${Fe(n.innerType)}, ${K})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodCatch:throw new Tn(M.ZodFirstPartyTypeKind.ZodCatch);case M.ZodFirstPartyTypeKind.ZodPromise:return`z.promise(${Fe(n.type)})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodBranded:throw new Tn(M.ZodFirstPartyTypeKind.ZodBranded);case M.ZodFirstPartyTypeKind.ZodPipeline:throw new Tn(M.ZodFirstPartyTypeKind.ZodPipeline);case M.ZodFirstPartyTypeKind.ZodSymbol:throw new Tn(M.ZodFirstPartyTypeKind.ZodSymbol);case M.ZodFirstPartyTypeKind.ZodReadonly:return`z.readonly(${Fe(n.innerType)})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodRef:return`z.ref(${se(n.uri)})${Ce(n)}${Ae(n)}`.trim();default:be.assertNever(n)}}d(Fe,"sUnwrapZod");var Ae=d(t=>t.description?`.describe(${se(t.description)})`:"","_maybeDescribe"),Ce=d(t=>`${fx(t)}${dx(t)}${px(t)}${gx(t)}${yx(t)}${mx(t)}${hx(t)}`,"_addZuiExtensions"),fx=d(t=>{var e;return(e=t[le])!=null&&e.title?`.title(${se(t[le].title)})`:""},"_maybeTitle"),dx=d(t=>{var e;return(e=t[le])!=null&&e.displayAs?`.displayAs(${tf({id:t[le].displayAs[0],params:t[le].displayAs[1]})})`:""},"_maybeDisplayAs"),px=d(t=>{var e;return(e=t[le])!=null&&e.disabled?`.disabled(${t[le].disabled})`:""},"_maybeDisabled"),gx=d(t=>{var e;return(e=t[le])!=null&&e.hidden?`.hidden(${t[le].hidden})`:""},"_maybeHidden"),yx=d(t=>{var e;return(e=t[le])!=null&&e.placeholder?`.placeholder(${se(t[le].placeholder)})`:""},"_maybePlaceholder"),mx=d(t=>{var e;return(e=t[le])!=null&&e.secret?".secret()":""},"_maybeSecret"),hx=d(t=>{var e;let n=["title","tooltip","displayAs","disabled","hidden","placeholder","secret","coerce"],r=Object.entries((e=t[le])!=null?e:{}).filter(([a])=>!n.includes(a));return r.length>0?`.metadata(${tf(Object.fromEntries(r))})`:""},"_maybeSetMetadata"),vx=d(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",a=n.inclusive?"exclusiveMinimum":"minimum";e[r]=n.value,delete e[a];break}case"max":{let r=n.inclusive?"maximum":"exclusiveMaximum",a=n.inclusive?"exclusiveMaximum":"maximum";e[r]=n.value,delete e[a];break}case"int":e.type="integer";break;case"finite":{e.format="finite";break}case"multipleOf":e.multipleOf=n.value;break;default:}return e},"zodNumberToJsonNumber"),zp="\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}",qp="(([+-]\\d{2}(:?\\d{2})?)|Z)",Tx="Z",Gp="(\\.\\d+)?",vo="\\.\\d{",_x="}",Vp=d(t=>{let e=t.precision?vo+t.precision+_x:t.precision===0?"":Gp,n=t.offset?qp:Tx;return new RegExp(`^${zp}${e}${n}$`)},"generateDatetimeRegex"),bx=d(t=>({precision:wx(t),offset:t.endsWith(`${qp}$`)}),"extractPrecisionAndOffset"),wx=d(t=>{let e=t.slice(1+zp.length);return e.startsWith(Gp)?null:e.startsWith(vo)?parseInt(e.slice(vo.length)):0},"_extractPrecision"),Hr={};oa(Hr,{escapeSpecialChars:()=>xx});var xx=d(t=>t.replaceAll(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeSpecialChars");function Uo(t,e,n,r){r?.errorMessages&&n&&(t.errorMessage=N(_({},t.errorMessage),{[e]:n}))}d(Uo,"addErrorMessage");function Re(t,e,n,r,a){t[e]=n,Uo(t,e,r,a)}d(Re,"setResponseValueAndErrors");var Ye={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 Zo(t,e){let n=_({type:"string"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{});function r(a){return e.patternStrategy==="escape"?Hr.escapeSpecialChars(a):a}if(d(r,"processPattern"),t.checks)for(let a of t.checks)switch(a.kind){case"min":Re(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,a.value):a.value,a.message,e);break;case"max":Re(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,a.value):a.value,a.message,e);break;case"email":switch(e.emailStrategy){case"format:email":vn(n,"email",a.message,e);break;case"format:idn-email":vn(n,"idn-email",a.message,e);break;case"pattern:zod":$t(n,Ye.email,a.message,e);break}break;case"url":vn(n,"uri",a.message,e);break;case"uuid":vn(n,"uuid",a.message,e);break;case"regex":$t(n,a.regex.source,a.message,e);break;case"cuid":$t(n,Ye.cuid,a.message,e);break;case"cuid2":$t(n,Ye.cuid2,a.message,e);break;case"startsWith":$t(n,"^"+r(a.value),a.message,e);break;case"endsWith":$t(n,r(a.value)+"$",a.message,e);break;case"datetime":vn(n,"date-time",a.message,e);break;case"length":Re(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,a.value):a.value,a.message,e),Re(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,a.value):a.value,a.message,e);break;case"includes":{$t(n,r(a.value),a.message,e);break}case"ip":{a.version!=="v6"&&vn(n,"ipv4",a.message,e),a.version!=="v4"&&vn(n,"ipv6",a.message,e);break}case"emoji":$t(n,Ye.emoji,a.message,e);break;case"ulid":{$t(n,Ye.ulid,a.message,e);break}case"toLowerCase":case"toUpperCase":case"trim":break;default:}return n}d(Zo,"parseStringDef");var vn=d((t,e,n,r)=>{var a;t.format||(a=t.anyOf)!=null&&a.some(o=>o.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push(_({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(_({format:e},n&&r.errorMessages&&{errorMessage:{format:n}}))):Re(t,"format",e,n,r)},"addFormat"),$t=d((t,e,n,r)=>{var a;t.pattern||(a=t.allOf)!=null&&a.some(o=>o.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push(_({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(_({pattern:e},n&&r.errorMessages&&{errorMessage:{pattern:n}}))):Re(t,"pattern",e,n,r)},"addPattern"),Px=d(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=Ye.cuid;break;case"cuid2":e.format="cuid2",e.pattern=Ye.cuid2;break;case"ulid":e.format="ulid",e.pattern=Ye.ulid;break;case"uuid":e.format="uuid",e.pattern=Ye.uuid;break;case"emoji":e.format="emoji",e.pattern=Ye.emoji;break;case"email":e.format="email",e.pattern=Ye.email;break;case"ip":e.format=n.version==="v6"?"ipv6":"ipv4",e.pattern=n.version==="v6"?Ye.ipv6:Ye.ipv4;break;case"datetime":e.format="date-time",e.pattern=Vp(n).source,e[le]=N(_({},e[le]),{precision:n.precision,offset:n.offset});break;case"url":e.format="uri";break;case"endsWith":e.pattern=`${Hr.escapeSpecialChars(n.value)}$`;break;case"startsWith":e.pattern=`^${Hr.escapeSpecialChars(n.value)}`;break;case"includes":let r=n.position&&n.position>=1?`^(?:.{${n.position}}).*`:"";e.pattern=`${r}${Hr.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 ff({zodType:M.ZodFirstPartyTypeKind.ZodString,checkKind:n.kind})}return e},"zodStringToJsonString"),Bx=d((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"),Ex=d((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"),Sx=d((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 st(t){let e=t,n=e._def;switch(n.typeName){case M.ZodFirstPartyTypeKind.ZodString:return Px(e);case M.ZodFirstPartyTypeKind.ZodNumber:return vx(e);case M.ZodFirstPartyTypeKind.ZodNaN:throw new dt(M.ZodFirstPartyTypeKind.ZodNaN);case M.ZodFirstPartyTypeKind.ZodBigInt:throw new dt(M.ZodFirstPartyTypeKind.ZodBigInt,{suggestedAlternative:"serialize bigint to string"});case M.ZodFirstPartyTypeKind.ZodBoolean:return{type:"boolean",description:n.description,"x-zui":n["x-zui"]};case M.ZodFirstPartyTypeKind.ZodDate:throw new dt(M.ZodFirstPartyTypeKind.ZodDate,{suggestedAlternative:"use z.string().datetime() instead"});case M.ZodFirstPartyTypeKind.ZodUndefined:return oo(n);case M.ZodFirstPartyTypeKind.ZodNull:return so(n);case M.ZodFirstPartyTypeKind.ZodAny:return{description:n.description,"x-zui":n["x-zui"]};case M.ZodFirstPartyTypeKind.ZodUnknown:return{description:n.description,"x-zui":N(_({},n["x-zui"]),{def:{typeName:M.ZodFirstPartyTypeKind.ZodUnknown}})};case M.ZodFirstPartyTypeKind.ZodNever:return{not:!0,description:n.description,"x-zui":n["x-zui"]};case M.ZodFirstPartyTypeKind.ZodVoid:throw new dt(M.ZodFirstPartyTypeKind.ZodVoid);case M.ZodFirstPartyTypeKind.ZodArray:return Bx(e,st);case M.ZodFirstPartyTypeKind.ZodObject:let r=Object.entries(n.shape()),a=r.filter(([p,y])=>!y.isOptional()),o=a.length?a.map(([p])=>p):void 0,i=r.map(([p,y])=>[p,y.mandatory()]).map(([p,y])=>[p,st(y)]),s=!1;return n.unknownKeys instanceof M.ZodType?s=st(n.unknownKeys):n.unknownKeys==="passthrough"&&(s=!0),{type:"object",description:n.description,properties:Object.fromEntries(i),required:o,additionalProperties:s,"x-zui":n["x-zui"]};case M.ZodFirstPartyTypeKind.ZodUnion:return{description:n.description,anyOf:n.options.map(p=>st(p)),"x-zui":n["x-zui"]};case M.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:return{description:n.description,anyOf:n.options.map(p=>st(p)),"x-zui":n["x-zui"]};case M.ZodFirstPartyTypeKind.ZodIntersection:let l=st(n.left),f=st(n.right);return"additionalProperties"in l&&delete l.additionalProperties,"additionalProperties"in f&&delete f.additionalProperties,{description:n.description,allOf:[l,f],"x-zui":n["x-zui"]};case M.ZodFirstPartyTypeKind.ZodTuple:return Sx(e,st);case M.ZodFirstPartyTypeKind.ZodRecord:return{type:"object",description:n.description,additionalProperties:st(n.valueType),"x-zui":n["x-zui"]};case M.ZodFirstPartyTypeKind.ZodMap:throw new dt(M.ZodFirstPartyTypeKind.ZodMap);case M.ZodFirstPartyTypeKind.ZodSet:return Ex(e,st);case M.ZodFirstPartyTypeKind.ZodFunction:throw new dt(M.ZodFirstPartyTypeKind.ZodFunction);case M.ZodFirstPartyTypeKind.ZodLazy:throw new dt(M.ZodFirstPartyTypeKind.ZodLazy);case M.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 so(n);if(n.value===void 0)return oo(n);{M.util.assertEqual(!0);let p=typeof n.value;throw new la(`Unsupported literal type: "${p}"`)}case M.ZodFirstPartyTypeKind.ZodEnum:return{type:"string",description:n.description,enum:n.values,"x-zui":n["x-zui"]};case M.ZodFirstPartyTypeKind.ZodEffects:throw new dt(M.ZodFirstPartyTypeKind.ZodEffects);case M.ZodFirstPartyTypeKind.ZodNativeEnum:throw new dt(M.ZodFirstPartyTypeKind.ZodNativeEnum);case M.ZodFirstPartyTypeKind.ZodOptional:return{description:n.description,anyOf:[st(n.innerType),oo()],"x-zui":N(_({},n["x-zui"]),{def:{typeName:M.ZodFirstPartyTypeKind.ZodOptional}})};case M.ZodFirstPartyTypeKind.ZodNullable:return{anyOf:[st(n.innerType),so()],"x-zui":N(_({},n["x-zui"]),{def:{typeName:M.ZodFirstPartyTypeKind.ZodNullable}})};case M.ZodFirstPartyTypeKind.ZodDefault:return N(_({},st(n.innerType)),{default:n.defaultValue()});case M.ZodFirstPartyTypeKind.ZodCatch:throw new dt(M.ZodFirstPartyTypeKind.ZodCatch);case M.ZodFirstPartyTypeKind.ZodPromise:throw new dt(M.ZodFirstPartyTypeKind.ZodPromise);case M.ZodFirstPartyTypeKind.ZodBranded:throw new dt(M.ZodFirstPartyTypeKind.ZodBranded);case M.ZodFirstPartyTypeKind.ZodPipeline:throw new dt(M.ZodFirstPartyTypeKind.ZodPipeline);case M.ZodFirstPartyTypeKind.ZodSymbol:throw new dt(M.ZodFirstPartyTypeKind.ZodPipeline);case M.ZodFirstPartyTypeKind.ZodReadonly:return N(_({},st(n.innerType)),{readOnly:!0});case M.ZodFirstPartyTypeKind.ZodRef:return{$ref:n.uri,description:n.description,"x-zui":n["x-zui"]};default:M.util.assertNever(n)}}d(st,"toJSONSchema");var oo=d(t=>({not:!0,description:t?.description,"x-zui":N(_({},t?.["x-zui"]),{def:{typeName:M.ZodFirstPartyTypeKind.ZodUndefined}})}),"undefinedSchema"),so=d(t=>({type:"null",description:t?.description,"x-zui":t?.["x-zui"]}),"nullSchema"),Jp=class{constructor(e,n,r,a){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=a}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}};d(Jp,"ParseInputLazyPath");var It=Jp,zc=d((t,e)=>{if(Lr(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 Kt(t.common.issues);return this._error=n,this._error}}},"handleResult"),Xp=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(_({},this._def))}_getType(e){return rn(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:rn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new vt,ctx:{common:e.parent.common,data:e.data,parsedType:rn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(ki(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 a={common:{issues:[],async:(r=n?.async)!=null?r:!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rn(e)},o=this._parseSync({data:e,path:a.path,parent:a});return zc(a,o)}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:rn(e)},a=this._parse({data:e,path:r.path,parent:r}),o=await(ki(a)?a:Promise.resolve(a));return zc(r,o)}refine(e,n){let r=d(a=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(a):n,"getIssueProperties");return this._refinement((a,o)=>{let i=e(a),s=d(()=>o.addIssue(_({code:G.custom},r(a))),"setError");return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(s(),!1)):i?!0:(s(),!1)})}refinement(e,n){return this._refinement((r,a)=>e(r)?!0:(a.addIssue(typeof n=="function"?n(r,a):n),!1))}_refinement(e){return new En({schema:this,typeName:"ZodEffects",effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return an.create(this,this._def)}nullable(){return tr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Wr.create(this,this._def)}promise(){return Ta.create(this,this._def)}mandatory(){return this}or(e){return es.create([this,e],this._def)}and(e){return qo.create(this,e,this._def)}transform(e){return new En(N(_({},me(this._def)),{schema:this,typeName:"ZodEffects",effect:{type:"transform",transform:e}}))}default(e){let n=typeof e=="function"?e:()=>e;return new ha(N(_({},me(this._def)),{innerType:this,defaultValue:n,typeName:"ZodDefault"}))}brand(){return new Lo(_({typeName:"ZodBranded",type:this},me(this._def)))}catch(e){let n=typeof e=="function"?e:()=>e;return new Fo(N(_({},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 Qo.create(this,e)}readonly(){return _a.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}metadata(e){var n,r,a;let o=this.clone(),i=o._metadataRoot;(a=(n=i._def)[r=le])!=null||(n[r]={});for(let[s,l]of Object.entries(e))i._def[le]=N(_({},i._def[le]),{[s]:l});return o}getMetadata(){return _({},this._metadataRoot._def[le])}setMetadata(e){this._metadataRoot._def[le]=_({},e)}get ui(){return _({},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 st(this)}toTypescriptType(e){return Eo(this,e)}toTypescriptSchema(){return Ho(this)}naked(){return this}};d(Xp,"ZodType");var he=Xp,Yp=(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))(Yp||{}),be;(t=>{t.assertEqual=d(a=>a,"assertEqual");function e(a){}t.assertIs=e,d(e,"assertIs");function n(a){throw new Error("assertNever called")}t.assertNever=n,d(n,"assertNever"),t.arrayToEnum=d(a=>{let o={};for(let i of a)o[i]=i;return o},"arrayToEnum"),t.getValidEnumValues=d(a=>{let o=(0,t.objectKeys)(a).filter(s=>typeof a[a[s]]!="number"),i={};for(let s of o)i[s]=a[s];return(0,t.objectValues)(i)},"getValidEnumValues"),t.objectValues=d(a=>(0,t.objectKeys)(a).map(function(o){return a[o]}),"objectValues"),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let o=[];for(let i in a)Object.prototype.hasOwnProperty.call(a,i)&&o.push(i);return o},t.find=d((a,o)=>{for(let i of a)if(o(i))return i},"find"),t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&isFinite(a)&&Math.floor(a)===a;function r(a,o=" | "){return a.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}t.joinValues=r,d(r,"joinValues"),t.jsonStringifyReplacer=d((a,o)=>typeof o=="bigint"?o.toString():o,"jsonStringifyReplacer"),t.compareFunctions=d((a,o)=>a.toString()===o.toString(),"compareFunctions"),t.mock=d(()=>({}),"mock")})(be||(be={}));var To;(t=>{t.mergeShapes=d((e,n)=>_(_({},e),n),"mergeShapes")})(To||(To={}));var ne=be.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),rn=d(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:a,supportsExtensions:o,[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 s=i?Object.fromEntries(Object.entries(i).filter(([f])=>f!=="secret"||o?.includes("secret"))):void 0;return e?{errorMap:e,description:a,[le]:s}:{errorMap:d((f,p)=>f.code!=="invalid_type"?{message:p.defaultError}:typeof p.data>"u"?{message:r??p.defaultError}:{message:n??p.defaultError},"customMap"),description:a,[le]:s}}d(me,"processCreateParams");var $o=d((t,e)=>{let n;switch(t.code){case G.invalid_type:t.received===ne.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case G.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,be.jsonStringifyReplacer)}`;break;case G.unrecognized_keys:n=`Unrecognized key(s) in object: ${be.joinValues(t.keys,", ")}`;break;case G.invalid_union:n="Invalid input";break;case G.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${be.joinValues(t.options)}`;break;case G.invalid_enum_value:n=`Invalid enum value. Expected ${be.joinValues(t.options)}, received '${t.received}'`;break;case G.invalid_arguments:n="Invalid function arguments";break;case G.invalid_return_type:n="Invalid function return type";break;case G.invalid_date:n="Invalid date";break;case G.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 G.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 G.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 G.custom:n="Invalid input";break;case G.invalid_intersection_types:n="Intersection results could not be merged";break;case G.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case G.not_finite:n="Number must be finite";break;case G.unresolved_reference:n="Unresolved reference";break;default:n=e.defaultError,be.assertNever(t)}return{message:n}},"errorMap"),qc=$o,G=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"]),kx=d(t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),Ei=class Qp extends Error{constructor(e){super(),this.issues=[],this.addIssue=d(r=>{this.issues=[...this.issues,r]},"addIssue"),this.addIssues=d((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(o){return o.message},r={_errors:[]},a=d(o=>{for(let i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(a);else if(i.code==="invalid_return_type")a(i.returnTypeError);else if(i.code==="invalid_arguments")a(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let s=r,l=0;for(;l<i.path.length;){let f=i.path[l];l===i.path.length-1?(s[f]=s[f]||{_errors:[]},s[f]._errors.push(n(i))):s[f]=s[f]||{_errors:[]},s=s[f],l++}}},"processError");return a(this),r}static assert(e){if(!(e instanceof Qp))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 a of this.issues)a.path.length>0?(n[a.path[0]]=n[a.path[0]]||[],n[a.path[0]].push(e(a))):r.push(e(a));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};d(Ei,"ZodError");Ei.create=d(t=>new Ei(t),"create");var Kt=Ei,eg=$o;function tg(t){eg=t}d(tg,"setErrorMap");function Kr(){return eg}d(Kr,"getErrorMap");var Si=d(t=>{var e;let{data:n,path:r,errorMaps:a,issueData:o}=t,i=[...r,...o.path||[]],s=N(_({},o),{path:i}),l="",f=a.filter(p=>!!p).slice().reverse();for(let p of f)l=p(s,{data:n,defaultError:l}).message;return N(_({},o),{path:i,message:(e=o.message)!=null?e:l})},"makeIssue"),Ix=[];function te(t,e){let n=Si({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Kr(),$o].filter(r=>!!r)});t.common.issues.push(n)}d(te,"addIssueToContext");var ng=class rg{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 a of n){if(a.status==="aborted")return pe;a.status==="dirty"&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let a of n)r.push({key:await a.key,value:await a.value});return rg.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let a of n){let{key:o,value:i}=a;if(o.status==="aborted"||i.status==="aborted")return pe;o.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof i.value<"u"||a.alwaysSet)&&(r[o.value]=i.value)}return{status:e.value,value:r}}};d(ng,"ParseStatus");var vt=ng,pe=Object.freeze({status:"aborted"}),Xn=d(t=>({status:"dirty",value:t}),"DIRTY"),pt=d(t=>({status:"valid",value:t}),"OK"),_o=d(t=>t.status==="aborted","isAborted"),bo=d(t=>t.status==="dirty","isDirty"),Lr=d(t=>t.status==="valid","isValid"),ki=d(t=>typeof Promise<"u"&&t instanceof Promise,"isAsync"),ue;(t=>{t.errToObj=d(e=>typeof e=="string"?{message:e}:e||{},"errToObj"),t.toString=d(e=>typeof e=="string"?e:e?.message,"toString")})(ue||(ue={}));var Ii=class ig extends he{constructor(){super(...arguments),this._any=!0}_parse(e){return pt(e.data)}isEqual(e){return e instanceof ig}};d(Ii,"ZodAny");Ii.create=d(t=>new Ii(_({typeName:"ZodAny"},me(t))),"create");var Fr=Ii,Ai=class bn extends he{dereference(e){return new bn(N(_({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new bn(N(_({},this._def),{type:this._def.type.clone()}))}isEqual(e){var n,r,a,o,i,s;return e instanceof bn?Qn((n=this._def.exactLength)==null?void 0:n.value,(r=e._def.exactLength)==null?void 0:r.value)&&Qn((a=this._def.maxLength)==null?void 0:a.value,(o=e._def.maxLength)==null?void 0:o.value)&&Qn((i=this._def.minLength)==null?void 0:i.value,(s=e._def.minLength)==null?void 0:s.value)&&this._def.type.isEqual(e._def.type):!1}_parse(e){let{ctx:n,status:r}=this._processInputParams(e),a=this._def;if(n.parsedType!==ne.array)return te(n,{code:G.invalid_type,expected:ne.array,received:n.parsedType}),pe;if(a.exactLength!==null){let i=n.data.length>a.exactLength.value,s=n.data.length<a.exactLength.value;(i||s)&&(te(n,{code:i?G.too_big:G.too_small,minimum:s?a.exactLength.value:void 0,maximum:i?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(a.minLength!==null&&n.data.length<a.minLength.value&&(te(n,{code:G.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),a.maxLength!==null&&n.data.length>a.maxLength.value&&(te(n,{code:G.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,s)=>a.type._parseAsync(new It(n,i,n.path,s)))).then(i=>vt.mergeArray(r,i));let o=[...n.data].map((i,s)=>a.type._parseSync(new It(n,i,n.path,s)));return vt.mergeArray(r,o)}get element(){return this._def.type}min(e,n){return new bn(N(_({},this._def),{minLength:{value:e,message:ue.toString(n)}}))}max(e,n){return new bn(N(_({},this._def),{maxLength:{value:e,message:ue.toString(n)}}))}length(e,n){return new bn(N(_({},this._def),{exactLength:{value:e,message:ue.toString(n)}}))}nonempty(e){return this.min(1,e)}};d(Ai,"ZodArray");Ai.create=d((t,e)=>new Ai(_({type:t,minLength:null,maxLength:null,exactLength:null,typeName:"ZodArray"},me(e))),"create");var Wr=Ai,Ax=d((t,e)=>ag(t,e,new WeakSet),"isEqual"),ag=d((t,e,n)=>Gw(t,e,Cx(n)),"_isEqualWithVisitedTracking"),Cx=d(t=>(e,n)=>{if(Ic(e)&&!t.has(e)&&Ic(n)&&!t.has(n)){let r=Fc(e,Lc),a=Fc(n,Lc);return t.add(r).add(a).add(e).add(n),ag(r,a,t)}},"_customizerWithVisitedTracking"),Ox={compare:Ax},og=class{constructor(e=[],n={}){this._options=_(_({},Ox),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))}};d(og,"CustomSet");var et=og,Ci=class vi 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 o=this._getOrReturnCtx(e);return te(o,{code:G.invalid_type,expected:ne.bigint,received:o.parsedType}),pe}let r,a=new vt;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:G.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:G.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),te(r,{code:G.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):be.assertNever(o);return{status:a.value,value:e.data}}isEqual(e){if(!(e instanceof vi)||this._def.coerce!==e._def.coerce)return!1;let n=new et(this._def.checks),r=new et(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,a){return new vi(N(_({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ue.toString(a)}]}))}_addCheck(e){return new vi(N(_({},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}};d(Ci,"ZodBigInt");Ci.create=d(t=>{var e;return new Ci(_({checks:[],typeName:"ZodBigInt",coerce:(e=t?.coerce)!=null?e:!1},me(t)))},"create");var jo=Ci,Oi=class sg extends he{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==ne.boolean){let r=this._getOrReturnCtx(e);return te(r,{code:G.invalid_type,expected:ne.boolean,received:r.parsedType}),pe}return pt(e.data)}isEqual(e){return e instanceof sg?this._def.coerce===e._def.coerce:!1}};d(Oi,"ZodBoolean");Oi.create=d(t=>new Oi(_({typeName:"ZodBoolean",coerce:t?.coerce||!1},me(t))),"create");var Ko=Oi,Rx=Symbol("zod_brand"),lg=class Pr extends he{dereference(e){return new Pr(N(_({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new Pr(N(_({},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 Pr?this._def.type.isEqual(e._def.type):!1}naked(){return this._def.type.naked()}mandatory(){return new Pr(N(_({},this._def),{type:this._def.type.mandatory()}))}};d(lg,"ZodBranded");var Lo=lg,Ri=class Br extends he{_parse(e){let{ctx:n}=this._processInputParams(e),r=N(_({},n),{common:N(_({},n.common),{issues:[]})}),a=this._def.innerType._parse({data:r.data,path:r.path,parent:_({},r)});return ki(a)?a.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Kt(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Kt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}isEqual(e){return e instanceof Br?this._def.innerType.isEqual(e._def.innerType)&&be.compareFunctions(this._def.catchValue,e._def.catchValue):!1}dereference(e){return new Br(N(_({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Br(N(_({},this._def),{innerType:this._def.innerType.clone()}))}naked(){return this._def.innerType.naked()}mandatory(){return new Br(N(_({},this._def),{innerType:this._def.innerType.mandatory()}))}};d(Ri,"ZodCatch");Ri.create=d((t,e)=>new Ri(_({innerType:t,typeName:"ZodCatch",catchValue:typeof e.catch=="function"?e.catch:()=>e.catch},me(e))),"create");var Fo=Ri,ug=d((t,e={},n)=>t?Fr.create().superRefine((r,a)=>{var o,i;if(!t(r)){let s=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e,l=(i=(o=s.fatal)!=null?o:n)!=null?i:!0,f=typeof s=="string"?{message:s}:s;a.addIssue(N(_({code:"custom"},f),{fatal:l}))}}):Fr.create(),"custom"),Mi=class wo extends he{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ne.date){let o=this._getOrReturnCtx(e);return te(o,{code:G.invalid_type,expected:ne.date,received:o.parsedType}),pe}if(isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return te(o,{code:G.invalid_date}),pe}let r=new vt,a;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(a=this._getOrReturnCtx(e,a),te(a,{code:G.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(a=this._getOrReturnCtx(e,a),te(a,{code:G.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):be.assertNever(o);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new wo(N(_({},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 wo))return!1;let n=new et(this._def.checks),r=new et(e._def.checks);return n.isEqual(r)&&this._def.coerce===e._def.coerce}};d(Mi,"ZodDate");Mi.create=d(t=>new Mi(_({checks:[],coerce:t?.coerce||!1,typeName:"ZodDate"},me(t))),"create");var Wo=Mi,Ni=class Er 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 Er(N(_({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Er(N(_({},this._def),{innerType:this._def.innerType.clone()}))}isEqual(e){return e instanceof Er?this._def.innerType.isEqual(e._def.innerType)&&Qn(this._def.defaultValue(),e._def.defaultValue()):!1}unwrap(){return this._def.innerType}naked(){return this._def.innerType.naked()}mandatory(){return new Er(N(_({},this._def),{innerType:this._def.innerType.mandatory()}))}};d(Ni,"ZodDefault");Ni.create=d((t,e,n)=>new Ni(_({innerType:t,typeName:"ZodDefault",defaultValue:typeof e=="function"?e:()=>e},me(n))),"create");var ha=Ni,Wt=d(t=>Array.from(new Set(t)),"unique"),jt=d(t=>t instanceof Go?jt(t.schema):t instanceof En?jt(t.innerType()):t instanceof Vo?[t.value]:t instanceof or?t.options:t instanceof Jo?be.objectValues(t.enum):t instanceof ha?jt(t._def.innerType):t instanceof ba?[void 0]:t instanceof Xo?[null]:t instanceof an?[void 0,...jt(t.unwrap())]:t instanceof tr?[null,...jt(t.unwrap())]:t instanceof Lo||t instanceof _a?jt(t.unwrap()):t instanceof Fo?jt(t._def.innerType):[],"getDiscriminator"),cg=class wn extends he{dereference(e){let n=this.options.map(a=>a.dereference(e)),r=wn._getOptionsMap(this.discriminator,n);return new wn(N(_({},this._def),{options:n,optionsMap:r}))}getReferences(){return Wt(this.options.flatMap(e=>e.getReferences()))}clone(){let e=this.options.map(n=>n.clone());return new wn(N(_({},this._def),{options:e}))}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==ne.object)return te(n,{code:G.invalid_type,expected:ne.object,received:n.parsedType}),pe;let r=this.discriminator,a=n.data[r],o=this.optionsMap.get(a);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(te(n,{code:G.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 a=wn._getOptionsMap(e,n);return new wn(_({typeName:"ZodDiscriminatedUnion",discriminator:e,options:n,optionsMap:a},me(r)))}static _getOptionsMap(e,n){let r=new Map;for(let a of n){let o=jt(a.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of o){if(r.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);r.set(i,a)}}return r}isEqual(e){if(!(e instanceof wn)||this._def.discriminator!==e._def.discriminator)return!1;let n=d((o,i)=>o.isEqual(i),"compare"),r=new et(this._def.options,{compare:n}),a=new et(e._def.options,{compare:n});return r.isEqual(a)}};d(cg,"ZodDiscriminatedUnion");var fg=cg;function va(t,e){return new or(_({values:t,typeName:"ZodEnum"},me(e)))}d(va,"createZodEnum");var zo=class Ti 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:G.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:G.invalid_enum_value,options:r}),pe}return pt(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 Ti.create(e,_(_({},this._def),n))}exclude(e,n=this._def){return Ti.create(this.options.filter(r=>!e.includes(r)),_(_({},this._def),n))}isEqual(e){if(!(e instanceof Ti))return!1;let n=new et(this._def.values),r=new et(e._def.values);return n.isEqual(r)}};d(zo,"ZodEnum");zo.create=va;var or=zo,dg=class xn 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 xn(N(_({},this._def),{args:n,returns:r}))}getReferences(){return Wt([...this._def.args.getReferences(),...this._def.returns.getReferences()])}clone(){return new xn(N(_({},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:G.invalid_type,expected:ne.function,received:n.parsedType}),pe;function r(s,l){return Si({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Kr(),qc].filter(f=>!!f),issueData:{code:G.invalid_arguments,argumentsError:l}})}d(r,"makeArgsIssue");function a(s,l){return Si({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Kr(),qc].filter(f=>!!f),issueData:{code:G.invalid_return_type,returnTypeError:l}})}d(a,"makeReturnsIssue");let o={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof Ta){let s=this;return pt(async function(...l){let f=new Kt([]),p=await s._def.args.parseAsync(l,o).catch(h=>{throw f.addIssue(r(l,h)),f}),y=await Reflect.apply(i,this,p);return await s._def.returns._def.type.parseAsync(y,o).catch(h=>{throw f.addIssue(a(y,h)),f})})}else{let s=this;return pt(function(...l){let f=s._def.args.safeParse(l,o);if(!f.success)throw new Kt([r(l,f.error)]);let p=Reflect.apply(i,this,f.data),y=s._def.returns.safeParse(p,o);if(!y.success)throw new Kt([a(p,y.error)]);return y.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new xn(N(_({},this._def),{args:ir.create(e).rest(Ur.create())}))}returns(e){return new xn(N(_({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new xn(_({args:e||ir.create([]).rest(Ur.create()),returns:n||Ur.create(),typeName:"ZodFunction"},me(r)))}isEqual(e){return e instanceof xn&&this._def.args.isEqual(e._def.args)&&this._def.returns.isEqual(e._def.returns)}};d(dg,"ZodFunction");var pg=dg;function Di(t,e){let n=rn(t),r=rn(e);if(t===e)return{valid:!0,data:t};if(n===ne.object&&r===ne.object){let a=be.objectKeys(e),o=be.objectKeys(t).filter(s=>a.indexOf(s)!==-1),i=_(_({},t),e);for(let s of o){let l=Di(t[s],e[s]);if(!l.valid)return{valid:!1};i[s]=l.data}return{valid:!0,data:i}}else if(n===ne.array&&r===ne.array){if(t.length!==e.length)return{valid:!1};let a=[];for(let o=0;o<t.length;o++){let i=t[o],s=e[o],l=Di(i,s);if(!l.valid)return{valid:!1};a.push(l.data)}return{valid:!0,data:a}}else return n===ne.date&&r===ne.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}d(Di,"mergeValues");var Hi=class _i extends he{dereference(e){return new _i(N(_({},this._def),{left:this._def.left.dereference(e),right:this._def.right.dereference(e)}))}getReferences(){return Wt([...this._def.left.getReferences(),...this._def.right.getReferences()])}clone(){return new _i(N(_({},this._def),{left:this._def.left.clone(),right:this._def.right.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),a=d((o,i)=>{if(_o(o)||_o(i))return pe;let s=Di(o.value,i.value);return s.valid?((bo(o)||bo(i))&&n.dirty(),{status:n.value,value:s.data}):(te(r,{code:G.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(([o,i])=>a(o,i)):a(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 _i))return!1;let n=d((o,i)=>o.isEqual(i),"compare"),r=new et([this._def.left,this._def.right],{compare:n}),a=new et([e._def.left,e._def.right],{compare:n});return r.isEqual(a)}};d(Hi,"ZodIntersection");Hi.create=d((t,e,n)=>new Hi(_({left:t,right:e,typeName:"ZodIntersection"},me(n))),"create");var qo=Hi,Ui=class Sr extends he{get schema(){return this._def.getter()}dereference(e){return new Sr(N(_({},this._def),{getter:d(()=>this._def.getter().dereference(e),"getter")}))}getReferences(){return this._def.getter().getReferences()}clone(){return new Sr(N(_({},this._def),{getter:d(()=>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 Sr?this._def.getter().isEqual(e._def.getter()):!1}naked(){return this._def.getter().naked()}mandatory(){return new Sr(N(_({},this._def),{getter:d(()=>this._def.getter().mandatory(),"getter")}))}};d(Ui,"ZodLazy");Ui.create=d((t,e)=>new Ui(_({getter:t,typeName:"ZodLazy"},me(e))),"create");var Go=Ui,Zi=class gg extends he{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return te(n,{received:n.data,code:G.invalid_literal,expected:this._def.value}),pe}return{status:"valid",value:e.data}}get value(){return this._def.value}isEqual(e){return e instanceof gg?Qn(this._def.value,e._def.value):!1}};d(Zi,"ZodLiteral");Zi.create=d((t,e)=>new Zi(_({value:t,typeName:"ZodLiteral"},me(e))),"create");var Vo=Zi,$i=class bi 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 bi(N(_({},this._def),{keyType:n,valueType:r}))}getReferences(){return Wt([...this._def.keyType.getReferences(),...this._def.valueType.getReferences()])}clone(){return new bi(N(_({},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:G.invalid_type,expected:ne.map,received:r.parsedType}),pe;let a=this._def.keyType,o=this._def.valueType,i=[...r.data.entries()].map(([s,l],f)=>({key:a._parse(new It(r,s,r.path,[f,"key"])),value:o._parse(new It(r,l,r.path,[f,"value"]))}));if(r.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let l of i){let f=await l.key,p=await l.value;if(f.status==="aborted"||p.status==="aborted")return pe;(f.status==="dirty"||p.status==="dirty")&&n.dirty(),s.set(f.value,p.value)}return{status:n.value,value:s}})}else{let s=new Map;for(let l of i){let f=l.key,p=l.value;if(f.status==="aborted"||p.status==="aborted")return pe;(f.status==="dirty"||p.status==="dirty")&&n.dirty(),s.set(f.value,p.value)}return{status:n.value,value:s}}}isEqual(e){return!(!(e instanceof bi)||!this._def.keyType.isEqual(e._def.keyType)||!this._def.valueType.isEqual(e._def.valueType))}};d($i,"ZodMap");$i.create=d((t,e,n)=>new $i(_({valueType:e,keyType:t,typeName:"ZodMap"},me(n))),"create");var yg=$i,ji=class mg extends he{_parse(e){if(this._getType(e)!==ne.nan){let r=this._getOrReturnCtx(e);return te(r,{code:G.invalid_type,expected:ne.nan,received:r.parsedType}),pe}return{status:"valid",value:e.data}}isEqual(e){return e instanceof mg}};d(ji,"ZodNaN");ji.create=d(t=>new ji(_({typeName:"ZodNaN"},me(t))),"create");var hg=ji,Ki=class vg 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 a=be.objectValues(n);return te(r,{expected:be.joinValues(a),received:r.parsedType,code:G.invalid_type}),pe}if(n.indexOf(e.data)===-1){let a=be.objectValues(n);return te(r,{received:r.data,code:G.invalid_enum_value,options:a}),pe}return pt(e.data)}get enum(){return this._def.values}isEqual(e){return e instanceof vg?Qn(this._def.values,e._def.values):!1}};d(Ki,"ZodNativeEnum");Ki.create=d((t,e)=>new Ki(_({values:t,typeName:"ZodNativeEnum"},me(e))),"create");var Jo=Ki,Li=class Tg extends he{_parse(e){let n=this._getOrReturnCtx(e);return te(n,{code:G.invalid_type,expected:ne.never,received:n.parsedType}),pe}isEqual(e){return e instanceof Tg}};d(Li,"ZodNever");Li.create=d(t=>new Li(_({typeName:"ZodNever"},me(t))),"create");var Gr=Li,Fi=class _g extends he{_parse(e){if(this._getType(e)!==ne.null){let r=this._getOrReturnCtx(e);return te(r,{code:G.invalid_type,expected:ne.null,received:r.parsedType}),pe}return pt(e.data)}isEqual(e){return e instanceof _g}};d(Fi,"ZodNull");Fi.create=d(t=>new Fi(_({typeName:"ZodNull"},me(t))),"create");var Xo=Fi,Wi=class kr extends he{dereference(e){return new kr(N(_({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new kr(N(_({},this._def),{innerType:this._def.innerType.clone()}))}_parse(e){return this._getType(e)===ne.null?pt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}isEqual(e){return e instanceof kr?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return new kr(N(_({},this._def),{innerType:this._def.innerType.mandatory()}))}};d(Wi,"ZodNullable");Wi.create=d((t,e)=>new Wi(_({innerType:t,typeName:"ZodNullable"},me(e))),"create");var tr=Wi;function bg(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,a=n>r?n:r,o=parseInt(t.toFixed(a).replace(".","")),i=parseInt(e.toFixed(a).replace(".",""));return o%i/Math.pow(10,a)}d(bg,"floatSafeRemainder");var zi=class wi 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 o=this._getOrReturnCtx(e);return te(o,{code:G.invalid_type,expected:ne.number,received:o.parsedType}),pe}let r,a=new vt;for(let o of this._def.checks)o.kind==="int"?be.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),te(r,{code:G.invalid_type,expected:"integer",received:"float",message:o.message}),a.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:G.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:G.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="multipleOf"?bg(e.data,o.value)!==0&&(r=this._getOrReturnCtx(e,r),te(r,{code:G.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),te(r,{code:G.not_finite,message:o.message}),a.dirty()):be.assertNever(o);return{status:a.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,a){return new wi(N(_({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ue.toString(a)}]}))}_addCheck(e){return new wi(N(_({},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 wi))return!1;let n=new et(this._def.checks),r=new et(e._def.checks);return n.isEqual(r)}};d(zi,"ZodNumber");zi.create=d(t=>new zi(_({checks:[],typeName:"ZodNumber",coerce:t?.coerce||!1},me(t))),"create");var Yo=zi;function Pn(t){if(t instanceof nr){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=an.create(Pn(r))}return new nr(N(_({},t._def),{shape:d(()=>e,"shape")}))}else return t instanceof Wr?new Wr(N(_({},t._def),{type:Pn(t.element)})):t instanceof an?an.create(Pn(t.unwrap())):t instanceof tr?tr.create(Pn(t.unwrap())):t instanceof ir?ir.create(t.items.map(e=>Pn(e))):t}d(Pn,"deepPartialify");var sn=class ht 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 a in n)r[a]=n[a].dereference(e);return new ht(N(_({},this._def),{shape:d(()=>r,"shape")}))}getReferences(){let e=this._def.shape(),n=[];for(let r in e)n.push(...e[r].getReferences());return Wt(n)}clone(){let e={},n=this._def.shape();for(let[r,a]of Object.entries(n))e[r]=a.clone();return new ht(N(_({},this._def),{shape:d(()=>e,"shape")}))}_parse(e){if(this._getType(e)!==ne.object){let p=this._getOrReturnCtx(e);return te(p,{code:G.invalid_type,expected:ne.object,received:p.parsedType}),pe}let{status:r,ctx:a}=this._processInputParams(e),{shape:o,keys:i}=this._getCached(),s=[];if(this._def.unknownKeys!=="strip")for(let p in a.data)i.includes(p)||s.push(p);let l=[];for(let p of i){let y=o[p],g=a.data[p];l.push({key:{status:"valid",value:p},value:y._parse(new It(a,g,a.path,p)),alwaysSet:p in a.data})}let f=this._def.unknownKeys;if(f==="passthrough")for(let p of s)l.push({key:{status:"valid",value:p},value:{status:"valid",value:a.data[p]}});else if(f==="strict")s.length>0&&(te(a,{code:G.unrecognized_keys,keys:s}),r.dirty());else if(f!=="strip")for(let p of s){let y=a.data[p];l.push({key:{status:"valid",value:p},value:f._parse(new It(a,y,a.path,p)),alwaysSet:p in a.data})}return a.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=>vt.mergeObjectSync(r,p)):vt.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return ue.errToObj,new ht(_(N(_({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:d((n,r)=>{var a,o,i,s;let l=(i=(o=(a=this._def).errorMap)==null?void 0:o.call(a,n,r).message)!=null?i:r.defaultError;return n.code==="unrecognized_keys"?{message:(s=ue.errToObj(e).message)!=null?s:l}:{message:l}},"errorMap")}:{}))}strip(){return new ht(N(_({},this._def),{unknownKeys:"strip"}))}passthrough(){return new ht(N(_({},this._def),{unknownKeys:"passthrough"}))}additionalProperties(){if(this._def.unknownKeys instanceof he)return this._def.unknownKeys;if(this._def.unknownKeys==="passthrough")return Fr.create();if(this._def.unknownKeys==="strict")return Gr.create()}extend(e){return new ht(N(_({},this._def),{shape:d(()=>_(_({},this._def.shape()),e),"shape")}))}merge(e){return new ht({unknownKeys:e._def.unknownKeys,shape:d(()=>_(_({},this._def.shape()),e._def.shape()),"shape"),typeName:"ZodObject"})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new ht(N(_({},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 ht(N(_({},this._def),{shape:d(()=>n,"shape")}))}omit(e){let n={};return be.objectKeys(this.shape).forEach(r=>{e[r]||(n[r]=this.shape[r])}),new ht(N(_({},this._def),{shape:d(()=>n,"shape")}))}deepPartial(){return Pn(this)}partial(e){let n={};return be.objectKeys(this.shape).forEach(r=>{let a=this.shape[r];e&&!e[r]?n[r]=a:n[r]=a?.optional()}),new ht(N(_({},this._def),{shape:d(()=>n,"shape")}))}required(e){let n={};return be.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof an;)o=o._def.innerType;n[r]=o}}),new ht(N(_({},this._def),{shape:d(()=>n,"shape")}))}keyof(){return va(be.objectKeys(this.shape))}isEqual(e){if(!(e instanceof ht)||!this._unknownKeysEqual(e))return!1;let n=this._def.shape(),r=e._def.shape(),a=d((s,l)=>s[0]===l[0]&&s[1].isEqual(l[1]),"compare"),o=new et(Object.entries(n),{compare:a}),i=new et(Object.entries(r),{compare:a});return o.isEqual(i)}_unknownKeysEqual(e){let n=this.additionalProperties(),r=e.additionalProperties();return n===void 0||r===void 0?n===r:n.isEqual(r)}};d(sn,"ZodObject");sn.create=d((t,e)=>new sn(_({shape:d(()=>t,"shape"),unknownKeys:"strip",typeName:"ZodObject"},me(e))),"create");sn.strictCreate=d((t,e)=>new sn(_({shape:d(()=>t,"shape"),unknownKeys:"strict",typeName:"ZodObject"},me(e))),"strictCreate");sn.lazycreate=d((t,e)=>new sn(_({shape:t,unknownKeys:"strip",typeName:"ZodObject"},me(e))),"lazycreate");var nr=sn,qi=class xi extends he{dereference(e){return new xi(N(_({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new xi(N(_({},this._def),{innerType:this._def.innerType.clone()}))}_parse(e){return this._getType(e)===ne.undefined?pt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}isEqual(e){return e instanceof xi?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return this._def.innerType.mandatory()}};d(qi,"ZodOptional");qi.create=d((t,e)=>new qi(_({innerType:t,typeName:"ZodOptional"},me(e))),"create");var an=qi,wg=class Ir extends he{dereference(e){return new Ir(N(_({},this._def),{in:this._def.in.dereference(e),out:this._def.out.dereference(e)}))}getReferences(){return Wt([...this._def.in.getReferences(),...this._def.out.getReferences()])}clone(){return new Ir(N(_({},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 d(async()=>{let o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?pe:o.status==="dirty"?(n.dirty(),Xn(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})},"handleAsync")();{let a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?pe:a.status==="dirty"?(n.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(e,n){return new Ir({in:e,out:n,typeName:"ZodPipeline"})}isEqual(e){return!(!(e instanceof Ir)||!this._def.in.isEqual(e._def.in)||!this._def.out.isEqual(e._def.out))}};d(wg,"ZodPipeline");var Qo=wg,Gi=class Pi extends he{unwrap(){return this._def.type}dereference(e){return new Pi(N(_({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new Pi(N(_({},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:G.invalid_type,expected:ne.promise,received:n.parsedType}),pe;let r=n.parsedType===ne.promise?n.data:Promise.resolve(n.data);return pt(r.then(a=>this._def.type.parseAsync(a,{path:n.path,errorMap:n.common.contextualErrorMap})))}isEqual(e){return e instanceof Pi?this._def.type.isEqual(e._def.type):!1}naked(){return this._def.type.naked()}};d(Gi,"ZodPromise");Gi.create=d((t,e)=>new Gi(_({type:t,typeName:"ZodPromise"},me(e))),"create");var Ta=Gi,Vi=class Ar extends he{dereference(e){return new Ar(N(_({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Ar(N(_({},this._def),{innerType:this._def.innerType.clone()}))}_parse(e){let n=this._def.innerType._parse(e);return Lr(n)&&(n.value=Object.freeze(n.value)),n}unwrap(){return this._def.innerType}isEqual(e){return e instanceof Ar?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return new Ar(N(_({},this._def),{innerType:this._def.innerType.mandatory()}))}};d(Vi,"ZodReadonly");Vi.create=d((t,e)=>new Vi(_({innerType:t,typeName:"ZodReadonly"},me(e))),"create");var _a=Vi,xg=class Gn 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 Gn(N(_({},this._def),{keyType:n,valueType:r}))}getReferences(){return Wt([...this._def.keyType.getReferences(),...this._def.valueType.getReferences()])}clone(){return new Gn(N(_({},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:G.invalid_type,expected:ne.object,received:r.parsedType}),pe;let a=[],o=this._def.keyType,i=this._def.valueType;for(let s in r.data)a.push({key:o._parse(new It(r,s,r.path,s)),value:i._parse(new It(r,r.data[s],r.path,s))});return r.common.async?vt.mergeObjectAsync(n,a):vt.mergeObjectSync(n,a)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof he?new Gn(_({keyType:e,valueType:n,typeName:"ZodRecord"},me(r))):new Gn(_({keyType:gt.create(),valueType:e,typeName:"ZodRecord"},me(n)))}isEqual(e){return!(!(e instanceof Gn)||!this._def.keyType.isEqual(e._def.keyType)||!this._def.valueType.isEqual(e._def.valueType))}};d(xg,"ZodRecord");var Pg=xg,Ji=class Bg 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:G.unresolved_reference}),pe}isOptional(){return!1}isNullable(){return!1}isEqual(e){return e instanceof Bg?this._def.uri===e._def.uri:!1}};d(Ji,"ZodRef");Ji.create=d(t=>new Ji({typeName:"ZodRef",uri:t}),"create");var Eg=Ji,Xi=class Vn extends he{dereference(e){return new Vn(N(_({},this._def),{valueType:this._def.valueType.dereference(e)}))}getReferences(){return this._def.valueType.getReferences()}clone(){return new Vn(N(_({},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:G.invalid_type,expected:ne.set,received:r.parsedType}),pe;let a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(te(r,{code:G.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),n.dirty()),a.maxSize!==null&&r.data.size>a.maxSize.value&&(te(r,{code:G.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),n.dirty());let o=this._def.valueType;function i(l){let f=new Set;for(let p of l){if(p.status==="aborted")return pe;p.status==="dirty"&&n.dirty(),f.add(p.value)}return{status:n.value,value:f}}d(i,"finalizeSet");let s=[...r.data.values()].map((l,f)=>o._parse(new It(r,l,r.path,f)));return r.common.async?Promise.all(s).then(l=>i(l)):i(s)}min(e,n){return new Vn(N(_({},this._def),{minSize:{value:e,message:ue.toString(n)}}))}max(e,n){return new Vn(N(_({},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,a,o;if(!(e instanceof Vn))return!1;let i=(n=this._def.minSize)==null?void 0:n.value,s=(r=e._def.minSize)==null?void 0:r.value;if(i!==s)return!1;let l=(a=this._def.maxSize)==null?void 0:a.value,f=(o=e._def.maxSize)==null?void 0:o.value;return l!==f?!1:this._def.valueType.isEqual(e._def.valueType)}};d(Xi,"ZodSet");Xi.create=d((t,e)=>new Xi(_({valueType:t,minSize:null,maxSize:null,typeName:"ZodSet"},me(e))),"create");var Sg=Xi,kg=/^c[^\s-]{8,}$/i,Ig=/^[a-z][a-z0-9]*$/,Ag=/^[0-9A-HJKMNP-TV-Z]{26}$/,Cg=/^[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,Og=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Rg="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Mx=d(t=>t===Rg,"isEmojiRegex"),lo,Mg=/^(((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}))$/,Ng=/^(([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 Dg(t,e){return!!((e==="v4"||!e)&&Mg.test(t)||(e==="v6"||!e)&&Ng.test(t))}d(Dg,"isValidIP");var Yi=class Jn extends he{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ne.string){let o=this._getOrReturnCtx(e);return te(o,{code:G.invalid_type,expected:ne.string,received:o.parsedType}),pe}let r=new vt,a;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(a=this._getOrReturnCtx(e,a),te(a,{code:G.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="max")e.data.length>o.value&&(a=this._getOrReturnCtx(e,a),te(a,{code:G.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){let i=e.data.length>o.value,s=e.data.length<o.value;(i||s)&&(a=this._getOrReturnCtx(e,a),i?te(a,{code:G.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):s&&te(a,{code:G.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")Og.test(e.data)||(a=this._getOrReturnCtx(e,a),te(a,{validation:"email",code:G.invalid_string,message:o.message}),r.dirty());else if(o.kind==="emoji")lo||(lo=new RegExp(Rg,"u")),lo.test(e.data)||(a=this._getOrReturnCtx(e,a),te(a,{validation:"emoji",code:G.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")Cg.test(e.data)||(a=this._getOrReturnCtx(e,a),te(a,{validation:"uuid",code:G.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")kg.test(e.data)||(a=this._getOrReturnCtx(e,a),te(a,{validation:"cuid",code:G.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid2")Ig.test(e.data)||(a=this._getOrReturnCtx(e,a),te(a,{validation:"cuid2",code:G.invalid_string,message:o.message}),r.dirty());else if(o.kind==="ulid")Ag.test(e.data)||(a=this._getOrReturnCtx(e,a),te(a,{validation:"ulid",code:G.invalid_string,message:o.message}),r.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),te(a,{validation:"url",code:G.invalid_string,message:o.message}),r.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),te(a,{validation:"regex",code:G.invalid_string,message:o.message}),r.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(a=this._getOrReturnCtx(e,a),te(a,{code:G.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),r.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(a=this._getOrReturnCtx(e,a),te(a,{code:G.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(a=this._getOrReturnCtx(e,a),te(a,{code:G.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?Vp(o).test(e.data)||(a=this._getOrReturnCtx(e,a),te(a,{code:G.invalid_string,validation:"datetime",message:o.message}),r.dirty()):o.kind==="ip"?Dg(e.data,o.version)||(a=this._getOrReturnCtx(e,a),te(a,{validation:"ip",code:G.invalid_string,message:o.message}),r.dirty()):be.assertNever(o);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(a=>e.test(a),_({validation:n,code:G.invalid_string},ue.errToObj(r)))}_addCheck(e){return new Jn(N(_({},this._def),{checks:[...this._def.checks,e]}))}email(e){return this._addCheck(_({kind:"email"},ue.errToObj(e)))}url(e){return this._addCheck(_({kind:"url"},ue.errToObj(e)))}emoji(e){return this._addCheck(_({kind:"emoji"},ue.errToObj(e)))}uuid(e){return this._addCheck(_({kind:"uuid"},ue.errToObj(e)))}cuid(e){return this._addCheck(_({kind:"cuid"},ue.errToObj(e)))}cuid2(e){return this._addCheck(_({kind:"cuid2"},ue.errToObj(e)))}ulid(e){return this._addCheck(_({kind:"ulid"},ue.errToObj(e)))}ip(e){return this._addCheck(_({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(_({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(_({kind:"regex",regex:e},ue.errToObj(n)))}includes(e,n){return this._addCheck(_({kind:"includes",value:e,position:n?.position},ue.errToObj(n?.message)))}startsWith(e,n){return this._addCheck(_({kind:"startsWith",value:e},ue.errToObj(n)))}endsWith(e,n){return this._addCheck(_({kind:"endsWith",value:e},ue.errToObj(n)))}min(e,n){return this._addCheck(_({kind:"min",value:e},ue.errToObj(n)))}max(e,n){return this._addCheck(_({kind:"max",value:e},ue.errToObj(n)))}length(e,n){return this._addCheck(_({kind:"length",value:e},ue.errToObj(n)))}nonempty(e){return this.min(1,ue.errToObj(e))}trim(){return new Jn(N(_({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}secret(){return this._def[le]=N(_({},this._def[le]),{secret:!0}),this}toLowerCase(){return new Jn(N(_({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new Jn(N(_({},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 Jn))return!1;let n=new et(this._def.checks),r=new et(e._def.checks);return n.isEqual(r)}};d(Yi,"ZodString");Yi.create=d(t=>{var e;return new Yi(_({checks:[],typeName:"ZodString",coerce:(e=t?.coerce)!=null?e:!1},me(N(_({},t),{supportsExtensions:["secret"]}))))},"create");var gt=Yi,Qi=class Hg extends he{_parse(e){if(this._getType(e)!==ne.symbol){let r=this._getOrReturnCtx(e);return te(r,{code:G.invalid_type,expected:ne.symbol,received:r.parsedType}),pe}return pt(e.data)}isEqual(e){return e instanceof Hg}};d(Qi,"ZodSymbol");Qi.create=d(t=>new Qi(_({typeName:"ZodSymbol"},me(t))),"create");var Ug=Qi,rr=class Cr 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 Cr(N(_({},this._def),{schema:this._def.schema.dereference(e)}))}getReferences(){return this._def.schema.getReferences()}clone(){return new Cr(N(_({},this._def),{schema:this._def.schema.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),a=this._def.effect||null,o={addIssue:d(i=>{te(r,i),i.fatal?n.abort():n.dirty()},"addIssue"),get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),a.type==="preprocess"){let i=a.transform(r.data,o);if(r.common.async)return Promise.resolve(i).then(async s=>{if(n.value==="aborted")return pe;let l=await this._def.schema._parseAsync({data:s,path:r.path,parent:r});return l.status==="aborted"?pe:l.status==="dirty"||n.value==="dirty"?Xn(l.value):l});{if(n.value==="aborted")return pe;let s=this._def.schema._parseSync({data:i,path:r.path,parent:r});return s.status==="aborted"?pe:s.status==="dirty"||n.value==="dirty"?Xn(s.value):s}}if(a.type==="refinement"){let i=d(s=>{let l=a.refinement(s,o);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 s},"executeRefinement");if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?pe:(s.status==="dirty"&&n.dirty(),i(s.value),{status:n.value,value:s.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>s.status==="aborted"?pe:(s.status==="dirty"&&n.dirty(),i(s.value).then(()=>({status:n.value,value:s.value}))))}if(a.type==="transform")if(r.common.async===!1){let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Lr(i))return i;let s=a.transform(i.value,o);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>Lr(i)?Promise.resolve(a.transform(i.value,o)).then(s=>({status:n.value,value:s})):i);be.assertNever(a)}isEqual(e){return!(e instanceof Cr)||!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 Cr(N(_({},this._def),{schema:this._def.schema.mandatory()}))}};d(rr,"ZodEffects");rr.create=d((t,e,n)=>new rr(_({schema:t,typeName:"ZodEffects",effect:e},me(n))),"create");rr.createWithPreprocess=d((t,e,n)=>new rr(_({schema:e,effect:{type:"preprocess",transform:t},typeName:"ZodEffects"},me(n))),"createWithPreprocess");var En=rr,ea=class Or extends he{dereference(e){let n=this._def.items.map(a=>a.dereference(e)),r=this._def.rest?this._def.rest.dereference(e):null;return new Or(N(_({},this._def),{items:n,rest:r}))}getReferences(){return Wt([...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 Or(N(_({},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:G.invalid_type,expected:ne.array,received:r.parsedType}),pe;if(r.data.length<this._def.items.length)return te(r,{code:G.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:G.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let o=[...r.data].map((i,s)=>{let l=this._def.items[s]||this._def.rest;return l?l._parse(new It(r,i,r.path,s)):null}).filter(i=>!!i);return r.common.async?Promise.all(o).then(i=>vt.mergeArray(n,i)):vt.mergeArray(n,o)}get items(){return this._def.items}rest(e){return new Or(N(_({},this._def),{rest:e}))}isEqual(e){if(!(e instanceof Or)||!this._restEquals(e))return!1;let n=d((o,i)=>o.isEqual(i),"compare"),r=new et(this._def.items,{compare:n}),a=new et(e._def.items,{compare:n});return r.isEqual(a)}_restEquals(e){return this._def.rest===null?e._def.rest===null:e._def.rest!==null&&this._def.rest.isEqual(e._def.rest)}};d(ea,"ZodTuple");ea.create=d((t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ea(_({items:t,typeName:"ZodTuple",rest:null},me(e)))},"create");var ir=ea,ta=class Zg extends he{_parse(e){if(this._getType(e)!==ne.undefined){let r=this._getOrReturnCtx(e);return te(r,{code:G.invalid_type,expected:ne.undefined,received:r.parsedType}),pe}return pt(e.data)}isEqual(e){return e instanceof Zg}mandatory(){return Gr.create(_({},this._def))}};d(ta,"ZodUndefined");ta.create=d(t=>new ta(_({typeName:"ZodUndefined"},me(t))),"create");var ba=ta,na=class Rr extends he{dereference(e){let n=this._def.options.map(r=>r.dereference(e));return new Rr(N(_({},this._def),{options:n}))}getReferences(){return Wt(this._def.options.reduce((e,n)=>[...e,...n.getReferences()],[]))}clone(){let e=this._def.options.map(n=>n.clone());return new Rr(N(_({},this._def),{options:e}))}_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function a(o){for(let s of o)if(s.result.status==="valid")return s.result;for(let s of o)if(s.result.status==="dirty")return n.common.issues.push(...s.ctx.common.issues),s.result;let i=o.map(s=>new Kt(s.ctx.common.issues));return te(n,{code:G.invalid_union,unionErrors:i}),pe}if(d(a,"handleResults"),n.common.async)return Promise.all(r.map(async o=>{let i=N(_({},n),{common:N(_({},n.common),{issues:[]}),parent:null});return{result:await o._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(a);{let o,i=[];for(let l of r){let f=N(_({},n),{common:N(_({},n.common),{issues:[]}),parent:null}),p=l._parseSync({data:n.data,path:n.path,parent:f});if(p.status==="valid")return p;p.status==="dirty"&&!o&&(o={result:p,ctx:f}),f.common.issues.length&&i.push(f.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;let s=i.map(l=>new Kt(l));return te(n,{code:G.invalid_union,unionErrors:s}),pe}}get options(){return this._def.options}isEqual(e){if(!(e instanceof Rr))return!1;let n=d((o,i)=>o.isEqual(i),"compare"),r=new et([...this._def.options],{compare:n}),a=new et([...e._def.options],{compare:n});return r.isEqual(a)}mandatory(){let e=this._def.options.filter(o=>!(o instanceof ba)).map(o=>o.mandatory()),[n,r,...a]=e;return n?r?new Rr(N(_({},this._def),{options:[n,r,...a]})):n:Gr.create(_({},this._def))}};d(na,"ZodUnion");na.create=d((t,e)=>new na(_({options:t,typeName:"ZodUnion"},me(e))),"create");var es=na,ra=class $g extends he{constructor(){super(...arguments),this._unknown=!0}_parse(e){return pt(e.data)}isEqual(e){return e instanceof $g}};d(ra,"ZodUnknown");ra.create=d(t=>new ra(_({typeName:"ZodUnknown"},me(t))),"create");var Ur=ra,ia=class jg extends he{_parse(e){if(this._getType(e)!==ne.undefined){let r=this._getOrReturnCtx(e);return te(r,{code:G.invalid_type,expected:ne.void,received:r.parsedType}),pe}return pt(e.data)}isEqual(e){return e instanceof jg}};d(ia,"ZodVoid");ia.create=d(t=>new ia(_({typeName:"ZodVoid"},me(t))),"create");var Kg=ia,Nx=["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"],UA=or.create(["any","string","number","boolean","object","pattern","date","array","target","time","enum"]),Dx=d(t=>gt.create().displayAs({id:"variable",params:_({type:t?.type||"any"},t?.params)}),"variable"),Hx=d(t=>gt.create().displayAs({id:"conversation",params:_({},t?.params)}),"conversation"),Ux=d(t=>gt.create().displayAs({id:"user",params:_({},t?.params)}),"user"),Zx=d(t=>gt.create().displayAs({id:"message",params:_({},t?.params)}),"message"),$x=d(t=>gt.create().displayAs({id:"agent",params:_({},t?.params)}),"agent"),jx=d(t=>gt.create().displayAs({id:"event",params:_({},t?.params)}),"event"),Kx=d(t=>gt.create().displayAs({id:"table",params:_({},t?.params)}),"table"),Lx=d(t=>gt.create().displayAs({id:"tablerow",params:_({},t?.params)}),"tablerow"),Fx=d(t=>gt.create().displayAs({id:"intent",params:_({},t?.params)}),"intent"),Wx=d(()=>or.create(Nx).displayAs({id:"dropdown",params:{}}),"aimodel"),zx=d(t=>gt.create().displayAs({id:"datasource",params:_({},t)}),"datasource"),qx=d(t=>gt.create().displayAs({id:"knowledgebase",params:_({},t)}),"knowledgebase"),Gx={object:nr.lazycreate},Vx=d((t,e={message:`Input not instance of ${t.name}`})=>ug(n=>n instanceof t,e),"instanceOfType"),Lg=gt.create,Fg=Yo.create,Jx=hg.create,Xx=jo.create,Wg=Ko.create,Yx=Wo.create,Qx=Ug.create,eP=ba.create,tP=Xo.create,nP=Fr.create,rP=Ur.create,iP=Gr.create,aP=Kg.create,oP=Wr.create,sP=nr.create,lP=nr.strictCreate,uP=es.create,cP=fg.create,fP=qo.create,dP=ir.create,pP=Pg.create,gP=Eg.create,yP=_a.create,mP=yg.create,hP=Sg.create,vP=pg.create,TP=Go.create,_P=Vo.create,bP=or.create,wP=Jo.create,xP=Ta.create,Gc=En.create,PP=an.create,BP=tr.create,EP=ha.create,SP=En.createWithPreprocess,kP=Qo.create,IP=d(()=>Lg().optional(),"ostring"),AP=d(()=>Fg().optional(),"onumber"),CP=d(()=>Wg().optional(),"oboolean"),OP={string:d(t=>gt.create(N(_({},t),{coerce:!0})),"string"),number:d(t=>Yo.create(N(_({},t),{coerce:!0})),"number"),boolean:d(t=>Ko.create(N(_({},t),{coerce:!0})),"boolean"),bigint:d(t=>jo.create(N(_({},t),{coerce:!0})),"bigint"),date:d(t=>Wo.create(N(_({},t),{coerce:!0})),"date")},RP=pe,M=Y,zg=d((t,e)=>t.anyOf.length?t.anyOf.length===1?it(t.anyOf[0],N(_({},e),{path:[...e.path,"anyOf",0]})):`z.union([${t.anyOf.map((n,r)=>it(n,N(_({},e),{path:[...e.path,"anyOf",r]}))).join(", ")}])`:"z.any()","parseAnyOf"),MP=d(t=>{var e;return(e=t[le])!=null&&e.coerce?"z.coerce.boolean()":"z.boolean()"},"parseBoolean"),NP=d(t=>"z.any()","parseDefault"),DP=d((t,e)=>`z.union([${t.type.map(n=>it(N(_({},t),{type:n}),e)).join(", ")}])`,"parseMultipleType"),HP=d((t,e)=>`z.any().refine((value) => !${it(t.not,N(_({},e),{path:[...e.path,"not"]}))}.safeParse(value).success, "Invalid input: Should NOT be valid against schema")`,"parseNot"),UP=d(t=>"z.null()","parseNull"),ZP=d(t=>[t.slice(0,t.length/2),t.slice(t.length/2)],"half"),$P=d((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 a=t[e],o="";if(a!==void 0){let i=n({value:a,json:JSON.stringify(a)});if(i){let s=i[0],l=i.length===3?i[1]:"",f=i.length===3?i[2]:i[1];o+=s,((r=t.errorMessage)==null?void 0:r[e])!==void 0&&(o+=l+JSON.stringify(t.errorMessage[e])),o+=f}}return o}d(ut,"withMessage");var Mr=Symbol("Original index"),jP=d(t=>{let e=[];for(let n=0;n<t.length;n++){let r=t[n];if(typeof r=="boolean")e.push(r?{[Mr]:n}:{[Mr]:n,not:{}});else{if(Mr in r)return t;e.push(N(_({},r),{[Mr]:n}))}}return e},"ensureOriginalIndex");function zr(t,e){if(t.allOf.length===0)return"z.never()";if(t.allOf.length===1){let n=t.allOf[0];return it(n,N(_({},e),{path:[...e.path,"allOf",n[Mr]]}))}else{let[n,r]=ZP(jP(t.allOf));return`z.intersection(${zr({allOf:n},e)}, ${zr({allOf:r},e)})`}}d(zr,"parseAllOf");var KP=d((t,e)=>{if(Array.isArray(t.items))return`z.tuple([${t.items.map((r,a)=>it(r,N(_({},e),{path:[...e.path,"items",a]})))}])`;let n=t.items?`z.array(${it(t.items,N(_({},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"),LP=d(t=>`z.literal(${JSON.stringify(t.const)})`,"parseConst"),FP=d(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"),WP=d((t,e)=>{let n=it(t.if,N(_({},e),{path:[...e.path,"if"]})),r=it(t.then,N(_({},e),{path:[...e.path,"then"]})),a=it(t.else,N(_({},e),{path:[...e.path,"else"]}));return`z.union([${r}, ${a}]).superRefine((value,ctx) => {
17
+ */`},"getMultilineComment"),rf={};oo(rf,{JSONSchemaToZuiError:()=>ao,ObjectToZuiError:()=>ca,UnrepresentableGenericError:()=>fa,UnsupportedJSONSchemaToZuiError:()=>nn,UnsupportedZuiCheckToJSONSchemaError:()=>ff,UnsupportedZuiToJSONSchemaError:()=>dt,UnsupportedZuiToTypescriptSchemaError:()=>Tn,UnsupportedZuiToTypescriptTypeError:()=>vf,UntitledDeclarationError:()=>_f,ZuiToJSONSchemaError:()=>so,ZuiToTypescriptSchemaError:()=>gf,ZuiToTypescriptTypeError:()=>lo,ZuiTransformError:()=>nr});var of=class extends Error{constructor(e,n){super(n),this.transform=e}};d(of,"ZuiTransformError");var nr=of,af=class extends nr{constructor(e){super("json-schema-to-zui",e)}};d(af,"JSONSchemaToZuiError");var ao=af,sf=class extends nr{constructor(e){super("object-to-zui",e)}};d(sf,"ObjectToZuiError");var ca=sf,lf=class extends nr{constructor(e){super("zui-to-json-schema",e)}};d(lf,"ZuiToJSONSchemaError");var so=lf,uf=class extends so{constructor(e,{suggestedAlternative:n}={}){super(`Zod type ${e} cannot be transformed to JSON Schema.`+(n?` Suggested alternative: ${n}`:""))}};d(uf,"UnsupportedZuiToJSONSchemaError");var dt=uf,cf=class extends so{constructor({zodType:e,checkKind:n}){super(`Zod check .${n}() of type ${e} cannot be transformed to JSON Schema.`)}};d(cf,"UnsupportedZuiCheckToJSONSchemaError");var ff=cf,df=class extends ao{constructor(e){super(`JSON Schema ${JSON.stringify(e)} cannot be transformed to ZUI type.`)}};d(df,"UnsupportedJSONSchemaToZuiError");var nn=df,pf=class extends nr{constructor(e){super("zui-to-typescript-schema",e)}};d(pf,"ZuiToTypescriptSchemaError");var gf=pf,yf=class extends gf{constructor(e){super(`Zod type ${e} cannot be transformed to TypeScript schema.`)}};d(yf,"UnsupportedZuiToTypescriptSchemaError");var Tn=yf,mf=class extends nr{constructor(e){super("zui-to-typescript-type",e)}};d(mf,"ZuiToTypescriptTypeError");var lo=mf,hf=class extends lo{constructor(e){super(`Zod type ${e} cannot be transformed to TypeScript type.`)}};d(hf,"UnsupportedZuiToTypescriptTypeError");var vf=hf,Tf=class extends lo{constructor(){super("Schema must have a title to be transformed to a TypeScript type with a declaration.")}};d(Tf,"UntitledDeclarationError");var _f=Tf,bf=class extends lo{constructor(){super('ZodRef can only be transformed to a TypeScript type with a "type" declaration.')}};d(bf,"UnrepresentableGenericError");var fa=bf,wf=["string","number","boolean","unknown","void","any","null","undefined","never","bigint","symbol","object"],Gv=d(t=>wf.includes(t),"isPrimitive"),Vv=d(t=>wf.map(e=>`${e}[]`).includes(t),"isArrayOfPrimitives"),yc=d(t=>t.replace(/ +/g," ").trim(),"stripSpaces"),xf=class{constructor(e,n,r=!1){this.key=e,this.value=n,this.optional=r}};d(xf,"KeyValue");var pi=xf,Pf=class{constructor(e){this.schema=e}};d(Pf,"FnParameters");var mc=Pf,Bf=class{constructor(e){this.schema=e}};d(Bf,"FnReturn");var hc=Bf,Ef=class{constructor(e){this.props=e}};d(Ef,"Declaration");var yi=Ef;function Ba(t,e={}){let n=Yv(t,e),r=ke(n,{});return e.formatter&&(r=e.formatter(r)),r}d(Ba,"toTypescriptType");function ke(t,e){var n,r,o;let a=N(_({},e),{parent:t});if(t===null)return"";if(t instanceof yi)return Jv(t,a);if(t instanceof pi){if(t.value instanceof M.ZodOptional){let h=t.value._def.innerType;return ke(new pi(t.key,h,!0),a)}let l=nt(t.value.description),f=l?.trim().length>0?`
18
+ `:"",p=t.value.describe(""),g=t.optional||t.value.isOptional()?"?":"";return`${f}${l}${f}${t.key}${g}: ${ke(p,a)}${f}`}if(t instanceof mc){if(t.schema instanceof M.ZodTuple){let p="";for(let y=0;y<t.schema.items.length;y++){let g=(o=(r=(n=t.schema.items[y])==null?void 0:n.ui)==null?void 0:r.title)!=null?o:`arg${y}`,h=t.schema.items[y];p+=`${ke(new pi(ua(g),h),a)}${y<t.schema.items.length-1?", ":""} `}return p}let l=ke(t.schema,a);return l.startsWith("{")&&l.endsWith("}")||l.startsWith("[")&&l.endsWith("]")||l.startsWith("(")&&l.endsWith(")")||l.startsWith("Array<")&&l.endsWith(">")||l.startsWith("Record<")&&l.endsWith(">")||Vv(l)?`args: ${l}`:l}if(t instanceof hc)return t.schema instanceof M.ZodOptional?`${ke(t.schema.unwrap(),a)} | undefined`:ke(t.schema,a);let i=t,s=i._def;switch(s.typeName){case M.ZodFirstPartyTypeKind.ZodString:return`${nt(i.description)} string`.trim();case M.ZodFirstPartyTypeKind.ZodNumber:case M.ZodFirstPartyTypeKind.ZodNaN:case M.ZodFirstPartyTypeKind.ZodBigInt:return`${nt(i.description)} number`.trim();case M.ZodFirstPartyTypeKind.ZodBoolean:return`${nt(i.description)} boolean`.trim();case M.ZodFirstPartyTypeKind.ZodDate:return`${nt(i.description)} Date`.trim();case M.ZodFirstPartyTypeKind.ZodUndefined:return`${nt(i.description)} undefined`.trim();case M.ZodFirstPartyTypeKind.ZodNull:return`${nt(i.description)} null`.trim();case M.ZodFirstPartyTypeKind.ZodAny:return`${nt(i.description)} any`.trim();case M.ZodFirstPartyTypeKind.ZodUnknown:return`${nt(i.description)} unknown`.trim();case M.ZodFirstPartyTypeKind.ZodNever:return`${nt(i.description)} never`.trim();case M.ZodFirstPartyTypeKind.ZodVoid:return`${nt(i.description)} void`.trim();case M.ZodFirstPartyTypeKind.ZodArray:let l=ke(s.type,a);return Gv(l)?`${l}[]`:`Array<${l}>`;case M.ZodFirstPartyTypeKind.ZodObject:return`{ ${Object.entries(s.shape()).map(([E,H])=>ke(new pi(ua(E),H),a)).join("; ")} }`;case M.ZodFirstPartyTypeKind.ZodUnion:let p=s.options.map(E=>ke(E,a));return`${nt(i.description)}
19
+ ${p.join(" | ")}`;case M.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:let y=s.options.map(E=>ke(E,a));return`${nt(i.description)}
20
+ ${y.join(" | ")}`;case M.ZodFirstPartyTypeKind.ZodIntersection:return`${ke(s.left,a)} & ${ke(s.right,a)}`;case M.ZodFirstPartyTypeKind.ZodTuple:return s.items.length===0?"":`[${s.items.map(E=>ke(E,a)).join(", ")}]`;case M.ZodFirstPartyTypeKind.ZodRecord:let h=ke(s.keyType,a),w=ke(s.valueType,a);return`${nt(i.description)} { [key: ${h}]: ${w} }`;case M.ZodFirstPartyTypeKind.ZodMap:return`Map<${ke(s.keyType,a)}, ${ke(s.valueType,a)}>`;case M.ZodFirstPartyTypeKind.ZodSet:return`Set<${ke(s.valueType,a)}>`;case M.ZodFirstPartyTypeKind.ZodFunction:let P=ke(new mc(s.args),a),B=ke(new hc(s.returns),a);return`${nt(i.description)}
21
+ (${P}) => ${B}`;case M.ZodFirstPartyTypeKind.ZodLazy:return ke(s.getter(),a);case M.ZodFirstPartyTypeKind.ZodLiteral:let v=ef(s.value);return`${nt(i.description)}
22
+ ${v}`.trim();case M.ZodFirstPartyTypeKind.ZodEnum:return s.values.map(se).join(" | ");case M.ZodFirstPartyTypeKind.ZodEffects:return ke(s.schema,a);case M.ZodFirstPartyTypeKind.ZodNativeEnum:throw new vf(M.ZodFirstPartyTypeKind.ZodNativeEnum);case M.ZodFirstPartyTypeKind.ZodOptional:return`${ke(s.innerType,a)} | undefined`;case M.ZodFirstPartyTypeKind.ZodNullable:return`${ke(s.innerType,a)} | null`;case M.ZodFirstPartyTypeKind.ZodDefault:return ke(s.innerType,a);case M.ZodFirstPartyTypeKind.ZodCatch:return ke(s.innerType,a);case M.ZodFirstPartyTypeKind.ZodPromise:return`Promise<${ke(s.type,a)}>`;case M.ZodFirstPartyTypeKind.ZodBranded:return ke(s.type,a);case M.ZodFirstPartyTypeKind.ZodPipeline:return ke(s.in,a);case M.ZodFirstPartyTypeKind.ZodSymbol:return`${nt(i.description)} symbol`.trim();case M.ZodFirstPartyTypeKind.ZodReadonly:return`Readonly<${ke(s.innerType,a)}>`;case M.ZodFirstPartyTypeKind.ZodRef:return nf(s.uri);default:be.assertNever(s)}}d(ke,"sUnwrapZod");var Jv=d((t,e)=>{if(t.props.type==="none")return ke(t.props.schema,e);let n=nt(t.props.schema.description),r=t.props.schema.describe(""),o=ke(r,e);if(t.props.type==="variable")return yc(`${n}declare const ${t.props.identifier}: ${o};`);let a=t.props.args.length>0?`<${t.props.args.map(nf).join(", ")}>`:"";return yc(`${n}type ${t.props.identifier}${a} = ${o};`)},"unwrapDeclaration"),Xv=d(t=>t.declaration?t.declaration===!0?"variable":t.declaration:"none","getDeclarationType"),Yv=d((t,e)=>{let n=Xv(e),r=t.getReferences();if(n==="none"){if(r.length>0)throw new fa;return new yi({type:"none",schema:t})}let o="title"in t.ui?t.ui.title:null;if(!o)throw new _f;if(n==="variable"){if(r.length>0)throw new fa;return new yi({type:"variable",identifier:o,schema:t})}return new yi({type:"type",identifier:o,schema:t,args:r})},"getDeclarationProps"),Qv=typeof global=="object"&&global&&global.Object===Object&&global,Sf=Qv,eT=typeof self=="object"&&self&&self.Object===Object&&self,tT=Sf||eT||Function("return this")(),Ft=tT,nT=Ft.Symbol,an=nT,kf=Object.prototype,rT=kf.hasOwnProperty,iT=kf.toString,Tr=an?an.toStringTag:void 0;function If(t){var e=rT.call(t,Tr),n=t[Tr];try{t[Tr]=void 0;var r=!0}catch{}var o=iT.call(t);return r&&(e?t[Tr]=n:delete t[Tr]),o}d(If,"getRawTag");var oT=If,aT=Object.prototype,sT=aT.toString;function Af(t){return sT.call(t)}d(Af,"objectToString");var lT=Af,uT="[object Null]",cT="[object Undefined]",vc=an?an.toStringTag:void 0;function Cf(t){return t==null?t===void 0?cT:uT:vc&&vc in Object(t)?oT(t):lT(t)}d(Cf,"baseGetTag");var Sn=Cf;function Of(t){return t!=null&&typeof t=="object"}d(Of,"isObjectLike");var Bn=Of,fT="[object Symbol]";function Rf(t){return typeof t=="symbol"||Bn(t)&&Sn(t)==fT}d(Rf,"isSymbol");var Ea=Rf;function Mf(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}d(Mf,"arrayMap");var Nf=Mf,dT=Array.isArray,Lt=dT,pT=1/0,Tc=an?an.prototype:void 0,_c=Tc?Tc.toString:void 0;function Sa(t){if(typeof t=="string")return t;if(Lt(t))return Nf(t,Sa)+"";if(Ea(t))return _c?_c.call(t):"";var e=t+"";return e=="0"&&1/t==-pT?"-0":e}d(Sa,"baseToString");var gT=Sa;function Df(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}d(Df,"isObject");var Xn=Df;function Hf(t){return t}d(Hf,"identity");var yT=Hf,mT="[object AsyncFunction]",hT="[object Function]",vT="[object GeneratorFunction]",TT="[object Proxy]";function Uf(t){if(!Xn(t))return!1;var e=Sn(t);return e==hT||e==vT||e==mT||e==TT}d(Uf,"isFunction");var Zf=Uf,_T=Ft["__core-js_shared__"],ra=_T,bc=(function(){var t=/[^.]+$/.exec(ra&&ra.keys&&ra.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function $f(t){return!!bc&&bc in t}d($f,"isMasked");var bT=$f,wT=Function.prototype,xT=wT.toString;function jf(t){if(t!=null){try{return xT.call(t)}catch{}try{return t+""}catch{}}return""}d(jf,"toSource");var kn=jf,PT=/[\\^$.*+?()[\]{}|]/g,BT=/^\[object .+?Constructor\]$/,ET=Function.prototype,ST=Object.prototype,kT=ET.toString,IT=ST.hasOwnProperty,AT=RegExp("^"+kT.call(IT).replace(PT,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Kf(t){if(!Xn(t)||bT(t))return!1;var e=Zf(t)?AT:BT;return e.test(kn(t))}d(Kf,"baseIsNative");var CT=Kf;function Lf(t,e){return t?.[e]}d(Lf,"getValue");var OT=Lf;function Ff(t,e){var n=OT(t,e);return CT(n)?n:void 0}d(Ff,"getNative");var In=Ff,RT=In(Ft,"WeakMap"),da=RT,MT=(function(){try{var t=In(Object,"defineProperty");return t({},"",{}),t}catch{}})(),wc=MT,NT=9007199254740991,DT=/^(?:0|[1-9]\d*)$/;function Wf(t,e){var n=typeof t;return e=e??NT,!!e&&(n=="number"||n!="symbol"&&DT.test(t))&&t>-1&&t%1==0&&t<e}d(Wf,"isIndex");var ka=Wf;function zf(t,e,n){e=="__proto__"&&wc?wc(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}d(zf,"baseAssignValue");var qf=zf;function Gf(t,e){return t===e||t!==t&&e!==e}d(Gf,"eq");var Ia=Gf,HT=Object.prototype,UT=HT.hasOwnProperty;function Vf(t,e,n){var r=t[e];(!(UT.call(t,e)&&Ia(r,n))||n===void 0&&!(e in t))&&qf(t,e,n)}d(Vf,"assignValue");var ZT=Vf,$T=9007199254740991;function Jf(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=$T}d(Jf,"isLength");var Aa=Jf;function Xf(t){return t!=null&&Aa(t.length)&&!Zf(t)}d(Xf,"isArrayLike");var Yf=Xf,jT=Object.prototype;function Qf(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||jT;return t===n}d(Qf,"isPrototype");var ed=Qf;function td(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}d(td,"baseTimes");var KT=td,LT="[object Arguments]";function nd(t){return Bn(t)&&Sn(t)==LT}d(nd,"baseIsArguments");var xc=nd,rd=Object.prototype,FT=rd.hasOwnProperty,WT=rd.propertyIsEnumerable,zT=xc((function(){return arguments})())?xc:function(t){return Bn(t)&&FT.call(t,"callee")&&!WT.call(t,"callee")},id=zT;function od(){return!1}d(od,"stubFalse");var qT=od,ad=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Pc=ad&&typeof module=="object"&&module&&!module.nodeType&&module,GT=Pc&&Pc.exports===ad,Bc=GT?Ft.Buffer:void 0,VT=Bc?Bc.isBuffer:void 0,JT=VT||qT,pa=JT,XT="[object Arguments]",YT="[object Array]",QT="[object Boolean]",e_="[object Date]",t_="[object Error]",n_="[object Function]",r_="[object Map]",i_="[object Number]",o_="[object Object]",a_="[object RegExp]",s_="[object Set]",l_="[object String]",u_="[object WeakMap]",c_="[object ArrayBuffer]",f_="[object DataView]",d_="[object Float32Array]",p_="[object Float64Array]",g_="[object Int8Array]",y_="[object Int16Array]",m_="[object Int32Array]",h_="[object Uint8Array]",v_="[object Uint8ClampedArray]",T_="[object Uint16Array]",__="[object Uint32Array]",Ze={};Ze[d_]=Ze[p_]=Ze[g_]=Ze[y_]=Ze[m_]=Ze[h_]=Ze[v_]=Ze[T_]=Ze[__]=!0;Ze[XT]=Ze[YT]=Ze[c_]=Ze[QT]=Ze[f_]=Ze[e_]=Ze[t_]=Ze[n_]=Ze[r_]=Ze[i_]=Ze[o_]=Ze[a_]=Ze[s_]=Ze[l_]=Ze[u_]=!1;function sd(t){return Bn(t)&&Aa(t.length)&&!!Ze[Sn(t)]}d(sd,"baseIsTypedArray");var b_=sd;function ld(t){return function(e){return t(e)}}d(ld,"baseUnary");var w_=ld,ud=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Rr=ud&&typeof module=="object"&&module&&!module.nodeType&&module,x_=Rr&&Rr.exports===ud,ia=x_&&Sf.process,P_=(function(){try{var t=Rr&&Rr.require&&Rr.require("util").types;return t||ia&&ia.binding&&ia.binding("util")}catch{}})(),Ec=P_,Sc=Ec&&Ec.isTypedArray,B_=Sc?w_(Sc):b_,cd=B_,E_=Object.prototype,S_=E_.hasOwnProperty;function fd(t,e){var n=Lt(t),r=!n&&id(t),o=!n&&!r&&pa(t),a=!n&&!r&&!o&&cd(t),i=n||r||o||a,s=i?KT(t.length,String):[],l=s.length;for(var f in t)(e||S_.call(t,f))&&!(i&&(f=="length"||o&&(f=="offset"||f=="parent")||a&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||ka(f,l)))&&s.push(f);return s}d(fd,"arrayLikeKeys");var dd=fd;function pd(t,e){return function(n){return t(e(n))}}d(pd,"overArg");var gd=pd,k_=gd(Object.keys,Object),I_=k_,A_=Object.prototype,C_=A_.hasOwnProperty;function yd(t){if(!ed(t))return I_(t);var e=[];for(var n in Object(t))C_.call(t,n)&&n!="constructor"&&e.push(n);return e}d(yd,"baseKeys");var O_=yd;function md(t){return Yf(t)?dd(t):O_(t)}d(md,"keys");var Ca=md;function hd(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}d(hd,"nativeKeysIn");var R_=hd,M_=Object.prototype,N_=M_.hasOwnProperty;function vd(t){if(!Xn(t))return R_(t);var e=ed(t),n=[];for(var r in t)r=="constructor"&&(e||!N_.call(t,r))||n.push(r);return n}d(vd,"baseKeysIn");var D_=vd;function Td(t){return Yf(t)?dd(t,!0):D_(t)}d(Td,"keysIn");var H_=Td,U_=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Z_=/^\w*$/;function _d(t,e){if(Lt(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||Ea(t)?!0:Z_.test(t)||!U_.test(t)||e!=null&&t in Object(e)}d(_d,"isKey");var Oa=_d,$_=In(Object,"create"),Dr=$_;function bd(){this.__data__=Dr?Dr(null):{},this.size=0}d(bd,"hashClear");var j_=bd;function wd(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}d(wd,"hashDelete");var K_=wd,L_="__lodash_hash_undefined__",F_=Object.prototype,W_=F_.hasOwnProperty;function xd(t){var e=this.__data__;if(Dr){var n=e[t];return n===L_?void 0:n}return W_.call(e,t)?e[t]:void 0}d(xd,"hashGet");var z_=xd,q_=Object.prototype,G_=q_.hasOwnProperty;function Pd(t){var e=this.__data__;return Dr?e[t]!==void 0:G_.call(e,t)}d(Pd,"hashHas");var V_=Pd,J_="__lodash_hash_undefined__";function Bd(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Dr&&e===void 0?J_:e,this}d(Bd,"hashSet");var X_=Bd;function An(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])}}d(An,"Hash");An.prototype.clear=j_;An.prototype.delete=K_;An.prototype.get=z_;An.prototype.has=V_;An.prototype.set=X_;var kc=An;function Ed(){this.__data__=[],this.size=0}d(Ed,"listCacheClear");var Y_=Ed;function Sd(t,e){for(var n=t.length;n--;)if(Ia(t[n][0],e))return n;return-1}d(Sd,"assocIndexOf");var uo=Sd,Q_=Array.prototype,eb=Q_.splice;function kd(t){var e=this.__data__,n=uo(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():eb.call(e,n,1),--this.size,!0}d(kd,"listCacheDelete");var tb=kd;function Id(t){var e=this.__data__,n=uo(e,t);return n<0?void 0:e[n][1]}d(Id,"listCacheGet");var nb=Id;function Ad(t){return uo(this.__data__,t)>-1}d(Ad,"listCacheHas");var rb=Ad;function Cd(t,e){var n=this.__data__,r=uo(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}d(Cd,"listCacheSet");var ib=Cd;function Cn(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])}}d(Cn,"ListCache");Cn.prototype.clear=Y_;Cn.prototype.delete=tb;Cn.prototype.get=nb;Cn.prototype.has=rb;Cn.prototype.set=ib;var co=Cn,ob=In(Ft,"Map"),Hr=ob;function Od(){this.size=0,this.__data__={hash:new kc,map:new(Hr||co),string:new kc}}d(Od,"mapCacheClear");var ab=Od;function Rd(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}d(Rd,"isKeyable");var sb=Rd;function Md(t,e){var n=t.__data__;return sb(e)?n[typeof e=="string"?"string":"hash"]:n.map}d(Md,"getMapData");var fo=Md;function Nd(t){var e=fo(this,t).delete(t);return this.size-=e?1:0,e}d(Nd,"mapCacheDelete");var lb=Nd;function Dd(t){return fo(this,t).get(t)}d(Dd,"mapCacheGet");var ub=Dd;function Hd(t){return fo(this,t).has(t)}d(Hd,"mapCacheHas");var cb=Hd;function Ud(t,e){var n=fo(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}d(Ud,"mapCacheSet");var fb=Ud;function On(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])}}d(On,"MapCache");On.prototype.clear=ab;On.prototype.delete=lb;On.prototype.get=ub;On.prototype.has=cb;On.prototype.set=fb;var po=On,db="Expected a function";function go(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(db);var n=d(function(){var r=arguments,o=e?e.apply(this,r):r[0],a=n.cache;if(a.has(o))return a.get(o);var i=t.apply(this,r);return n.cache=a.set(o,i)||a,i},"memoized");return n.cache=new(go.Cache||po),n}d(go,"memoize");go.Cache=po;var pb=go,gb=500;function Zd(t){var e=pb(t,function(r){return n.size===gb&&n.clear(),r}),n=e.cache;return e}d(Zd,"memoizeCapped");var yb=Zd,mb=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,hb=/\\(\\)?/g,vb=yb(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(mb,function(n,r,o,a){e.push(o?a.replace(hb,"$1"):r||n)}),e}),Tb=vb;function $d(t){return t==null?"":gT(t)}d($d,"toString");var _b=$d;function jd(t,e){return Lt(t)?t:Oa(t,e)?[t]:Tb(_b(t))}d(jd,"castPath");var yo=jd,bb=1/0;function Kd(t){if(typeof t=="string"||Ea(t))return t;var e=t+"";return e=="0"&&1/t==-bb?"-0":e}d(Kd,"toKey");var Fr=Kd;function Ld(t,e){e=yo(e,t);for(var n=0,r=e.length;t!=null&&n<r;)t=t[Fr(e[n++])];return n&&n==r?t:void 0}d(Ld,"baseGet");var Ra=Ld;function Fd(t,e,n){var r=t==null?void 0:Ra(t,e);return r===void 0?n:r}d(Fd,"get");var wb=Fd;function Wd(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}d(Wd,"arrayPush");var zd=Wd,xb=gd(Object.getPrototypeOf,Object),qd=xb,Pb="[object Object]",Bb=Function.prototype,Eb=Object.prototype,Gd=Bb.toString,Sb=Eb.hasOwnProperty,kb=Gd.call(Object);function Vd(t){if(!Bn(t)||Sn(t)!=Pb)return!1;var e=qd(t);if(e===null)return!0;var n=Sb.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&Gd.call(n)==kb}d(Vd,"isPlainObject");var Ic=Vd;function Jd(){this.__data__=new co,this.size=0}d(Jd,"stackClear");var Ib=Jd;function Xd(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}d(Xd,"stackDelete");var Ab=Xd;function Yd(t){return this.__data__.get(t)}d(Yd,"stackGet");var Cb=Yd;function Qd(t){return this.__data__.has(t)}d(Qd,"stackHas");var Ob=Qd,Rb=200;function ep(t,e){var n=this.__data__;if(n instanceof co){var r=n.__data__;if(!Hr||r.length<Rb-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new po(r)}return n.set(t,e),this.size=n.size,this}d(ep,"stackSet");var Mb=ep;function Rn(t){var e=this.__data__=new co(t);this.size=e.size}d(Rn,"Stack");Rn.prototype.clear=Ib;Rn.prototype.delete=Ab;Rn.prototype.get=Cb;Rn.prototype.has=Ob;Rn.prototype.set=Mb;var mi=Rn;function tp(t,e){for(var n=-1,r=t==null?0:t.length,o=0,a=[];++n<r;){var i=t[n];e(i,n,t)&&(a[o++]=i)}return a}d(tp,"arrayFilter");var Nb=tp;function np(){return[]}d(np,"stubArray");var rp=np,Db=Object.prototype,Hb=Db.propertyIsEnumerable,Ac=Object.getOwnPropertySymbols,Ub=Ac?function(t){return t==null?[]:(t=Object(t),Nb(Ac(t),function(e){return Hb.call(t,e)}))}:rp,ip=Ub,Zb=Object.getOwnPropertySymbols,$b=Zb?function(t){for(var e=[];t;)zd(e,ip(t)),t=qd(t);return e}:rp,jb=$b;function op(t,e,n){var r=e(t);return Lt(t)?r:zd(r,n(t))}d(op,"baseGetAllKeys");var ap=op;function sp(t){return ap(t,Ca,ip)}d(sp,"getAllKeys");var Cc=sp;function lp(t){return ap(t,H_,jb)}d(lp,"getAllKeysIn");var Kb=lp,Lb=In(Ft,"DataView"),ga=Lb,Fb=In(Ft,"Promise"),ya=Fb,Wb=In(Ft,"Set"),ma=Wb,Oc="[object Map]",zb="[object Object]",Rc="[object Promise]",Mc="[object Set]",Nc="[object WeakMap]",Dc="[object DataView]",qb=kn(ga),Gb=kn(Hr),Vb=kn(ya),Jb=kn(ma),Xb=kn(da),_n=Sn;(ga&&_n(new ga(new ArrayBuffer(1)))!=Dc||Hr&&_n(new Hr)!=Oc||ya&&_n(ya.resolve())!=Rc||ma&&_n(new ma)!=Mc||da&&_n(new da)!=Nc)&&(_n=d(function(t){var e=Sn(t),n=e==zb?t.constructor:void 0,r=n?kn(n):"";if(r)switch(r){case qb:return Dc;case Gb:return Oc;case Vb:return Rc;case Jb:return Mc;case Xb:return Nc}return e},"getTag"));var Hc=_n,Yb=Ft.Uint8Array,Uc=Yb,Qb="__lodash_hash_undefined__";function up(t){return this.__data__.set(t,Qb),this}d(up,"setCacheAdd");var ew=up;function cp(t){return this.__data__.has(t)}d(cp,"setCacheHas");var tw=cp;function Ur(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new po;++e<n;)this.add(t[e])}d(Ur,"SetCache");Ur.prototype.add=Ur.prototype.push=ew;Ur.prototype.has=tw;var nw=Ur;function fp(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}d(fp,"arraySome");var rw=fp;function dp(t,e){return t.has(e)}d(dp,"cacheHas");var iw=dp,ow=1,aw=2;function pp(t,e,n,r,o,a){var i=n&ow,s=t.length,l=e.length;if(s!=l&&!(i&&l>s))return!1;var f=a.get(t),p=a.get(e);if(f&&p)return f==e&&p==t;var y=-1,g=!0,h=n&aw?new nw:void 0;for(a.set(t,e),a.set(e,t);++y<s;){var w=t[y],P=e[y];if(r)var B=i?r(P,w,y,e,t,a):r(w,P,y,t,e,a);if(B!==void 0){if(B)continue;g=!1;break}if(h){if(!rw(e,function(v,S){if(!iw(h,S)&&(w===v||o(w,v,n,r,a)))return h.push(S)})){g=!1;break}}else if(!(w===P||o(w,P,n,r,a))){g=!1;break}}return a.delete(t),a.delete(e),g}d(pp,"equalArrays");var gp=pp;function yp(t){var e=-1,n=Array(t.size);return t.forEach(function(r,o){n[++e]=[o,r]}),n}d(yp,"mapToArray");var sw=yp;function mp(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}d(mp,"setToArray");var lw=mp,uw=1,cw=2,fw="[object Boolean]",dw="[object Date]",pw="[object Error]",gw="[object Map]",yw="[object Number]",mw="[object RegExp]",hw="[object Set]",vw="[object String]",Tw="[object Symbol]",_w="[object ArrayBuffer]",bw="[object DataView]",Zc=an?an.prototype:void 0,oa=Zc?Zc.valueOf:void 0;function hp(t,e,n,r,o,a,i){switch(n){case bw:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case _w:return!(t.byteLength!=e.byteLength||!a(new Uc(t),new Uc(e)));case fw:case dw:case yw:return Ia(+t,+e);case pw:return t.name==e.name&&t.message==e.message;case mw:case vw:return t==e+"";case gw:var s=sw;case hw:var l=r&uw;if(s||(s=lw),t.size!=e.size&&!l)return!1;var f=i.get(t);if(f)return f==e;r|=cw,i.set(t,e);var p=gp(s(t),s(e),r,o,a,i);return i.delete(t),p;case Tw:if(oa)return oa.call(t)==oa.call(e)}return!1}d(hp,"equalByTag");var ww=hp,xw=1,Pw=Object.prototype,Bw=Pw.hasOwnProperty;function vp(t,e,n,r,o,a){var i=n&xw,s=Cc(t),l=s.length,f=Cc(e),p=f.length;if(l!=p&&!i)return!1;for(var y=l;y--;){var g=s[y];if(!(i?g in e:Bw.call(e,g)))return!1}var h=a.get(t),w=a.get(e);if(h&&w)return h==e&&w==t;var P=!0;a.set(t,e),a.set(e,t);for(var B=i;++y<l;){g=s[y];var v=t[g],S=e[g];if(r)var E=i?r(S,v,g,e,t,a):r(v,S,g,t,e,a);if(!(E===void 0?v===S||o(v,S,n,r,a):E)){P=!1;break}B||(B=g=="constructor")}if(P&&!B){var H=t.constructor,K=e.constructor;H!=K&&"constructor"in t&&"constructor"in e&&!(typeof H=="function"&&H instanceof H&&typeof K=="function"&&K instanceof K)&&(P=!1)}return a.delete(t),a.delete(e),P}d(vp,"equalObjects");var Ew=vp,Sw=1,$c="[object Arguments]",jc="[object Array]",gi="[object Object]",kw=Object.prototype,Kc=kw.hasOwnProperty;function Tp(t,e,n,r,o,a){var i=Lt(t),s=Lt(e),l=i?jc:Hc(t),f=s?jc:Hc(e);l=l==$c?gi:l,f=f==$c?gi:f;var p=l==gi,y=f==gi,g=l==f;if(g&&pa(t)){if(!pa(e))return!1;i=!0,p=!1}if(g&&!p)return a||(a=new mi),i||cd(t)?gp(t,e,n,r,o,a):ww(t,e,l,n,r,o,a);if(!(n&Sw)){var h=p&&Kc.call(t,"__wrapped__"),w=y&&Kc.call(e,"__wrapped__");if(h||w){var P=h?t.value():t,B=w?e.value():e;return a||(a=new mi),o(P,B,n,r,a)}}return g?(a||(a=new mi),Ew(t,e,n,r,o,a)):!1}d(Tp,"baseIsEqualDeep");var Iw=Tp;function Ma(t,e,n,r,o){return t===e?!0:t==null||e==null||!Bn(t)&&!Bn(e)?t!==t&&e!==e:Iw(t,e,n,r,Ma,o)}d(Ma,"baseIsEqual");var mo=Ma,Aw=1,Cw=2;function _p(t,e,n,r){var o=n.length,a=o,i=!r;if(t==null)return!a;for(t=Object(t);o--;){var s=n[o];if(i&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++o<a;){s=n[o];var l=s[0],f=t[l],p=s[1];if(i&&s[2]){if(f===void 0&&!(l in t))return!1}else{var y=new mi;if(r)var g=r(f,p,l,t,e,y);if(!(g===void 0?mo(p,f,Aw|Cw,r,y):g))return!1}}return!0}d(_p,"baseIsMatch");var Ow=_p;function bp(t){return t===t&&!Xn(t)}d(bp,"isStrictComparable");var wp=bp;function xp(t){for(var e=Ca(t),n=e.length;n--;){var r=e[n],o=t[r];e[n]=[r,o,wp(o)]}return e}d(xp,"getMatchData");var Rw=xp;function Pp(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}d(Pp,"matchesStrictComparable");var Bp=Pp;function Ep(t){var e=Rw(t);return e.length==1&&e[0][2]?Bp(e[0][0],e[0][1]):function(n){return n===t||Ow(n,t,e)}}d(Ep,"baseMatches");var Mw=Ep;function Sp(t,e){return t!=null&&e in Object(t)}d(Sp,"baseHasIn");var Nw=Sp;function kp(t,e,n){e=yo(e,t);for(var r=-1,o=e.length,a=!1;++r<o;){var i=Fr(e[r]);if(!(a=t!=null&&n(t,i)))break;t=t[i]}return a||++r!=o?a:(o=t==null?0:t.length,!!o&&Aa(o)&&ka(i,o)&&(Lt(t)||id(t)))}d(kp,"hasPath");var Dw=kp;function Ip(t,e){return t!=null&&Dw(t,e,Nw)}d(Ip,"hasIn");var Hw=Ip,Uw=1,Zw=2;function Ap(t,e){return Oa(t)&&wp(e)?Bp(Fr(t),e):function(n){var r=wb(n,t);return r===void 0&&r===e?Hw(n,t):mo(e,r,Uw|Zw)}}d(Ap,"baseMatchesProperty");var $w=Ap;function Cp(t){return function(e){return e?.[t]}}d(Cp,"baseProperty");var jw=Cp;function Op(t){return function(e){return Ra(e,t)}}d(Op,"basePropertyDeep");var Kw=Op;function Rp(t){return Oa(t)?jw(Fr(t)):Kw(t)}d(Rp,"property");var Lw=Rp;function Mp(t){return typeof t=="function"?t:t==null?yT:typeof t=="object"?Lt(t)?$w(t[0],t[1]):Mw(t):Lw(t)}d(Mp,"baseIteratee");var Na=Mp;function Np(t){return function(e,n,r){for(var o=-1,a=Object(e),i=r(e),s=i.length;s--;){var l=i[t?s:++o];if(n(a[l],l,a)===!1)break}return e}}d(Np,"createBaseFor");var Fw=Np,Ww=Fw(),zw=Ww;function Dp(t,e){return t&&zw(t,e,Ca)}d(Dp,"baseForOwn");var qw=Dp;function Hp(t,e){return mo(t,e)}d(Hp,"isEqual");var Jn=Hp;function Up(t,e,n){n=typeof n=="function"?n:void 0;var r=n?n(t,e):void 0;return r===void 0?mo(t,e,void 0,n):!!r}d(Up,"isEqualWith");var Gw=Up;function Zp(t){return t===void 0}d(Zp,"isUndefined");var Lc=Zp;function $p(t,e){var n={};return e=Na(e,3),qw(t,function(r,o,a){qf(n,o,e(r,o,a))}),n}d($p,"mapValues");var Vw=$p,Jw="Expected a function";function jp(t){if(typeof t!="function")throw new TypeError(Jw);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)}}d(jp,"negate");var Xw=jp;function Kp(t,e,n,r){if(!Xn(t))return t;e=yo(e,t);for(var o=-1,a=e.length,i=a-1,s=t;s!=null&&++o<a;){var l=Fr(e[o]),f=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return t;if(o!=i){var p=s[l];f=r?r(p,l,s):void 0,f===void 0&&(f=Xn(p)?p:ka(e[o+1])?[]:{})}ZT(s,l,f),s=s[l]}return t}d(Kp,"baseSet");var Yw=Kp;function Lp(t,e,n){for(var r=-1,o=e.length,a={};++r<o;){var i=e[r],s=Ra(t,i);n(s,i)&&Yw(a,yo(i,t),s)}return a}d(Lp,"basePickBy");var Qw=Lp;function Fp(t,e){if(t==null)return{};var n=Nf(Kb(t),function(r){return[r]});return e=Na(e),Qw(t,n,function(r,o){return e(r,o[0])})}d(Fp,"pickBy");var ex=Fp;function Wp(t,e){return ex(t,Xw(Na(e)))}d(Wp,"omitBy");var Fc=Wp,tx=d(t=>{let e=t.checks;return e.length===0?"":e.map(nx).join("")},"generateStringChecks"),nx=d(t=>{switch(t.kind){case"min":return`.min(${se(t.value)}, ${se(t.message)})`;case"max":return`.max(${se(t.value)}, ${se(t.message)})`;case"length":return`.length(${se(t.value)}, ${se(t.message)})`;case"email":return`.email(${se(t.message)})`;case"url":return`.url(${se(t.message)})`;case"emoji":return`.emoji(${se(t.message)})`;case"uuid":return`.uuid(${se(t.message)})`;case"cuid":return`.cuid(${se(t.message)})`;case"cuid2":return`.cuid2(${se(t.message)})`;case"ulid":return`.ulid(${se(t.message)})`;case"includes":let e=Vn({message:t.message,position:t.position});return`.includes(${se(t.value)}, ${e})`;case"startsWith":return`.startsWith(${se(t.value)}, ${se(t.message)})`;case"endsWith":return`.endsWith(${se(t.value)}, ${se(t.message)})`;case"regex":return`.regex(${String(t.regex)}, ${se(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(${Vn({message:t.message,precision:r,offset:t.offset})})`;case"ip":return`.ip(${Vn({message:t.message,version:t.version})})`;default:return""}},"_generateStringCheck"),rx=d(t=>{let e=t.checks;return e.length===0?"":e.map(ix).join("")},"generateNumberChecks"),ix=d(t=>{switch(t.kind){case"min":return`.min(${se(t.value)}, ${se(t.message)})`;case"max":return`.max(${se(t.value)}, ${se(t.message)})`;case"int":return`.int(${se(t.message)})`;case"multipleOf":return`.multipleOf(${se(t.value)}, ${se(t.message)})`;case"finite":return`.finite(${se(t.message)})`;default:return""}},"_generateNumberCheck"),ox=d(t=>{let e=t.checks;return e.length===0?"":e.map(ax).join("")},"generateBigIntChecks"),ax=d(t=>{switch(t.kind){case"min":return`.min(${se(t.value)}, ${se(t.message)})`;case"max":return`.max(${se(t.value)}, ${se(t.message)})`;case"multipleOf":return`.multipleOf(${se(t.value)}, ${se(t.message)})`;default:return""}},"_generateBigIntCheck"),sx=d(t=>{let e=t.checks;return e.length===0?"":e.map(lx).join("")},"generateDateChecks"),lx=d(t=>{switch(t.kind){case"min":return`.min(${Wc(t.value)}, ${se(t.message)})`;case"max":return`.max(${Wc(t.value)}, ${se(t.message)})`;default:return""}},"_generateDateCheck"),Wc=d(t=>`new Date(${t})`,"dateTs"),ux=d(t=>{let e=[];if(t.exactLength){let{value:n,message:r}=t.exactLength;e.push(`.length(${se(n)}, ${se(r)})`)}if(t.minLength){let{value:n,message:r}=t.minLength;e.push(`.min(${se(n)}, ${se(r)})`)}if(t.maxLength){let{value:n,message:r}=t.maxLength;e.push(`.max(${se(n)}, ${se(r)})`)}return e.join("")},"generateArrayChecks"),cx=d(t=>{let e=[];if(t.minSize){let{value:n,message:r}=t.minSize;e.push(`.min(${se(n)}, ${se(r)})`)}if(t.maxSize){let{value:n,message:r}=t.maxSize;e.push(`.max(${se(n)}, ${se(r)})`)}return e.join("")},"generateSetChecks");function Da(t){return Fe(t)}d(Da,"toTypescriptSchema");function Fe(t){let n=t._def;switch(n.typeName){case M.ZodFirstPartyTypeKind.ZodString:return`z.string()${tx(n)}${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodNumber:return`z.number()${rx(n)}${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodNaN:return`z.nan()${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodBigInt:return`z.bigint()${ox(n)}${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodBoolean:return`z.boolean()${Ce(n)}${Ae(t._def)}`.trim();case M.ZodFirstPartyTypeKind.ZodDate:return`z.date()${sx(n)}${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodUndefined:return`z.undefined()${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodNull:return`z.null()${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodAny:return`z.any()${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodUnknown:return`z.unknown()${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodNever:return`z.never()${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodVoid:return`z.void()${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodArray:return`z.array(${Fe(n.type)})${ux(n)}${Ce(n)}${Ae(n)}`;case M.ZodFirstPartyTypeKind.ZodObject:let r=Vw(n.shape(),Fe),o=t.additionalProperties(),a=o?`.catchall(${Fe(o)})`:"";return["z.object({",...Object.entries(r).map(([ee,ge])=>` ${ee}: ${ge},`),`})${a}${Ce(n)}${Ae(n)}`].join(`
23
+ `).trim();case M.ZodFirstPartyTypeKind.ZodUnion:return`z.union([${n.options.map(Fe).join(", ")}])${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:let s=n.options.map(Fe);return`z.discriminatedUnion(${se(n.discriminator)}, [${s.join(", ")}])${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodIntersection:let f=Fe(n.left),p=Fe(n.right);return`z.intersection(${f}, ${p})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodTuple:return`z.tuple([${n.items.map(Fe).join(", ")}])${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodRecord:let g=Fe(n.keyType),h=Fe(n.valueType);return`z.record(${g}, ${h})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodMap:let w=Fe(n.keyType),P=Fe(n.valueType);return`z.map(${w}, ${P})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodSet:return`z.set(${Fe(n.valueType)})${cx(n)}${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodFunction:let B=n.args.items.map(Fe),v=B.length?`.args(${B.join(", ")})`:"",S=Fe(n.returns);return`z.function()${v}.returns(${S})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodLazy:return`z.lazy(() => ${Fe(n.getter())})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodLiteral:return`z.literal(${se(n.value)})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodEnum:return`z.enum([${n.values.map(se).join(", ")}])${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodEffects:throw new Tn(M.ZodFirstPartyTypeKind.ZodEffects);case M.ZodFirstPartyTypeKind.ZodNativeEnum:throw new Tn(M.ZodFirstPartyTypeKind.ZodNativeEnum);case M.ZodFirstPartyTypeKind.ZodOptional:return`z.optional(${Fe(n.innerType)})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodNullable:return`z.nullable(${Fe(n.innerType)})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodDefault:let K=Vn(n.defaultValue());return`z.default(${Fe(n.innerType)}, ${K})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodCatch:throw new Tn(M.ZodFirstPartyTypeKind.ZodCatch);case M.ZodFirstPartyTypeKind.ZodPromise:return`z.promise(${Fe(n.type)})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodBranded:throw new Tn(M.ZodFirstPartyTypeKind.ZodBranded);case M.ZodFirstPartyTypeKind.ZodPipeline:throw new Tn(M.ZodFirstPartyTypeKind.ZodPipeline);case M.ZodFirstPartyTypeKind.ZodSymbol:throw new Tn(M.ZodFirstPartyTypeKind.ZodSymbol);case M.ZodFirstPartyTypeKind.ZodReadonly:return`z.readonly(${Fe(n.innerType)})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodRef:return`z.ref(${se(n.uri)})${Ce(n)}${Ae(n)}`.trim();default:be.assertNever(n)}}d(Fe,"sUnwrapZod");var Ae=d(t=>t.description?`.describe(${se(t.description)})`:"","_maybeDescribe"),Ce=d(t=>`${fx(t)}${dx(t)}${px(t)}${gx(t)}${yx(t)}${mx(t)}${hx(t)}`,"_addZuiExtensions"),fx=d(t=>{var e;return(e=t[le])!=null&&e.title?`.title(${se(t[le].title)})`:""},"_maybeTitle"),dx=d(t=>{var e;return(e=t[le])!=null&&e.displayAs?`.displayAs(${tf({id:t[le].displayAs[0],params:t[le].displayAs[1]})})`:""},"_maybeDisplayAs"),px=d(t=>{var e;return(e=t[le])!=null&&e.disabled?`.disabled(${t[le].disabled})`:""},"_maybeDisabled"),gx=d(t=>{var e;return(e=t[le])!=null&&e.hidden?`.hidden(${t[le].hidden})`:""},"_maybeHidden"),yx=d(t=>{var e;return(e=t[le])!=null&&e.placeholder?`.placeholder(${se(t[le].placeholder)})`:""},"_maybePlaceholder"),mx=d(t=>{var e;return(e=t[le])!=null&&e.secret?".secret()":""},"_maybeSecret"),hx=d(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(${tf(Object.fromEntries(r))})`:""},"_maybeSetMetadata"),vx=d(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"),zp="\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}",qp="(([+-]\\d{2}(:?\\d{2})?)|Z)",Tx="Z",Gp="(\\.\\d+)?",ha="\\.\\d{",_x="}",Vp=d(t=>{let e=t.precision?ha+t.precision+_x:t.precision===0?"":Gp,n=t.offset?qp:Tx;return new RegExp(`^${zp}${e}${n}$`)},"generateDatetimeRegex"),bx=d(t=>({precision:wx(t),offset:t.endsWith(`${qp}$`)}),"extractPrecisionAndOffset"),wx=d(t=>{let e=t.slice(1+zp.length);return e.startsWith(Gp)?null:e.startsWith(ha)?parseInt(e.slice(ha.length)):0},"_extractPrecision"),Mr={};oo(Mr,{escapeSpecialChars:()=>xx});var xx=d(t=>t.replaceAll(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeSpecialChars");function Ha(t,e,n,r){r?.errorMessages&&n&&(t.errorMessage=N(_({},t.errorMessage),{[e]:n}))}d(Ha,"addErrorMessage");function Re(t,e,n,r,o){t[e]=n,Ha(t,e,r,o)}d(Re,"setResponseValueAndErrors");var Ye={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 Ua(t,e){let n=_({type:"string"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{});function r(o){return e.patternStrategy==="escape"?Mr.escapeSpecialChars(o):o}if(d(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":vn(n,"email",o.message,e);break;case"format:idn-email":vn(n,"idn-email",o.message,e);break;case"pattern:zod":$t(n,Ye.email,o.message,e);break}break;case"url":vn(n,"uri",o.message,e);break;case"uuid":vn(n,"uuid",o.message,e);break;case"regex":$t(n,o.regex.source,o.message,e);break;case"cuid":$t(n,Ye.cuid,o.message,e);break;case"cuid2":$t(n,Ye.cuid2,o.message,e);break;case"startsWith":$t(n,"^"+r(o.value),o.message,e);break;case"endsWith":$t(n,r(o.value)+"$",o.message,e);break;case"datetime":vn(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":{$t(n,r(o.value),o.message,e);break}case"ip":{o.version!=="v6"&&vn(n,"ipv4",o.message,e),o.version!=="v4"&&vn(n,"ipv6",o.message,e);break}case"emoji":$t(n,Ye.emoji,o.message,e);break;case"ulid":{$t(n,Ye.ulid,o.message,e);break}case"toLowerCase":case"toUpperCase":case"trim":break;default:}return n}d(Ua,"parseStringDef");var vn=d((t,e,n,r)=>{var o;t.format||(o=t.anyOf)!=null&&o.some(a=>a.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push(_({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(_({format:e},n&&r.errorMessages&&{errorMessage:{format:n}}))):Re(t,"format",e,n,r)},"addFormat"),$t=d((t,e,n,r)=>{var o;t.pattern||(o=t.allOf)!=null&&o.some(a=>a.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push(_({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(_({pattern:e},n&&r.errorMessages&&{errorMessage:{pattern:n}}))):Re(t,"pattern",e,n,r)},"addPattern"),Px=d(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=Ye.cuid;break;case"cuid2":e.format="cuid2",e.pattern=Ye.cuid2;break;case"ulid":e.format="ulid",e.pattern=Ye.ulid;break;case"uuid":e.format="uuid",e.pattern=Ye.uuid;break;case"emoji":e.format="emoji",e.pattern=Ye.emoji;break;case"email":e.format="email",e.pattern=Ye.email;break;case"ip":e.format=n.version==="v6"?"ipv6":"ipv4",e.pattern=n.version==="v6"?Ye.ipv6:Ye.ipv4;break;case"datetime":e.format="date-time",e.pattern=Vp(n).source,e[le]=N(_({},e[le]),{precision:n.precision,offset:n.offset});break;case"url":e.format="uri";break;case"endsWith":e.pattern=`${Mr.escapeSpecialChars(n.value)}$`;break;case"startsWith":e.pattern=`^${Mr.escapeSpecialChars(n.value)}`;break;case"includes":let r=n.position&&n.position>=1?`^(?:.{${n.position}}).*`:"";e.pattern=`${r}${Mr.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 ff({zodType:M.ZodFirstPartyTypeKind.ZodString,checkKind:n.kind})}return e},"zodStringToJsonString"),Bx=d((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"),Ex=d((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"),Sx=d((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 st(t){let e=t,n=e._def;switch(n.typeName){case M.ZodFirstPartyTypeKind.ZodString:return Px(e);case M.ZodFirstPartyTypeKind.ZodNumber:return vx(e);case M.ZodFirstPartyTypeKind.ZodNaN:throw new dt(M.ZodFirstPartyTypeKind.ZodNaN);case M.ZodFirstPartyTypeKind.ZodBigInt:throw new dt(M.ZodFirstPartyTypeKind.ZodBigInt,{suggestedAlternative:"serialize bigint to string"});case M.ZodFirstPartyTypeKind.ZodBoolean:return{type:"boolean",description:n.description,"x-zui":n["x-zui"]};case M.ZodFirstPartyTypeKind.ZodDate:throw new dt(M.ZodFirstPartyTypeKind.ZodDate,{suggestedAlternative:"use z.string().datetime() instead"});case M.ZodFirstPartyTypeKind.ZodUndefined:return aa(n);case M.ZodFirstPartyTypeKind.ZodNull:return sa(n);case M.ZodFirstPartyTypeKind.ZodAny:return{description:n.description,"x-zui":n["x-zui"]};case M.ZodFirstPartyTypeKind.ZodUnknown:return{description:n.description,"x-zui":N(_({},n["x-zui"]),{def:{typeName:M.ZodFirstPartyTypeKind.ZodUnknown}})};case M.ZodFirstPartyTypeKind.ZodNever:return{not:!0,description:n.description,"x-zui":n["x-zui"]};case M.ZodFirstPartyTypeKind.ZodVoid:throw new dt(M.ZodFirstPartyTypeKind.ZodVoid);case M.ZodFirstPartyTypeKind.ZodArray:return Bx(e,st);case M.ZodFirstPartyTypeKind.ZodObject:let r=Object.entries(n.shape()),o=r.filter(([p,y])=>!y.isOptional()),a=o.length?o.map(([p])=>p):void 0,i=r.map(([p,y])=>[p,y.mandatory()]).map(([p,y])=>[p,st(y)]),s=!1;return n.unknownKeys instanceof M.ZodType?s=st(n.unknownKeys):n.unknownKeys==="passthrough"&&(s=!0),{type:"object",description:n.description,properties:Object.fromEntries(i),required:a,additionalProperties:s,"x-zui":n["x-zui"]};case M.ZodFirstPartyTypeKind.ZodUnion:return{description:n.description,anyOf:n.options.map(p=>st(p)),"x-zui":n["x-zui"]};case M.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:return{description:n.description,anyOf:n.options.map(p=>st(p)),"x-zui":n["x-zui"]};case M.ZodFirstPartyTypeKind.ZodIntersection:let l=st(n.left),f=st(n.right);return"additionalProperties"in l&&delete l.additionalProperties,"additionalProperties"in f&&delete f.additionalProperties,{description:n.description,allOf:[l,f],"x-zui":n["x-zui"]};case M.ZodFirstPartyTypeKind.ZodTuple:return Sx(e,st);case M.ZodFirstPartyTypeKind.ZodRecord:return{type:"object",description:n.description,additionalProperties:st(n.valueType),"x-zui":n["x-zui"]};case M.ZodFirstPartyTypeKind.ZodMap:throw new dt(M.ZodFirstPartyTypeKind.ZodMap);case M.ZodFirstPartyTypeKind.ZodSet:return Ex(e,st);case M.ZodFirstPartyTypeKind.ZodFunction:throw new dt(M.ZodFirstPartyTypeKind.ZodFunction);case M.ZodFirstPartyTypeKind.ZodLazy:throw new dt(M.ZodFirstPartyTypeKind.ZodLazy);case M.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 sa(n);if(n.value===void 0)return aa(n);{M.util.assertEqual(!0);let p=typeof n.value;throw new so(`Unsupported literal type: "${p}"`)}case M.ZodFirstPartyTypeKind.ZodEnum:return{type:"string",description:n.description,enum:n.values,"x-zui":n["x-zui"]};case M.ZodFirstPartyTypeKind.ZodEffects:throw new dt(M.ZodFirstPartyTypeKind.ZodEffects);case M.ZodFirstPartyTypeKind.ZodNativeEnum:throw new dt(M.ZodFirstPartyTypeKind.ZodNativeEnum);case M.ZodFirstPartyTypeKind.ZodOptional:return{description:n.description,anyOf:[st(n.innerType),aa()],"x-zui":N(_({},n["x-zui"]),{def:{typeName:M.ZodFirstPartyTypeKind.ZodOptional}})};case M.ZodFirstPartyTypeKind.ZodNullable:return{anyOf:[st(n.innerType),sa()],"x-zui":N(_({},n["x-zui"]),{def:{typeName:M.ZodFirstPartyTypeKind.ZodNullable}})};case M.ZodFirstPartyTypeKind.ZodDefault:return N(_({},st(n.innerType)),{default:n.defaultValue()});case M.ZodFirstPartyTypeKind.ZodCatch:throw new dt(M.ZodFirstPartyTypeKind.ZodCatch);case M.ZodFirstPartyTypeKind.ZodPromise:throw new dt(M.ZodFirstPartyTypeKind.ZodPromise);case M.ZodFirstPartyTypeKind.ZodBranded:throw new dt(M.ZodFirstPartyTypeKind.ZodBranded);case M.ZodFirstPartyTypeKind.ZodPipeline:throw new dt(M.ZodFirstPartyTypeKind.ZodPipeline);case M.ZodFirstPartyTypeKind.ZodSymbol:throw new dt(M.ZodFirstPartyTypeKind.ZodPipeline);case M.ZodFirstPartyTypeKind.ZodReadonly:return N(_({},st(n.innerType)),{readOnly:!0});case M.ZodFirstPartyTypeKind.ZodRef:return{$ref:n.uri,description:n.description,"x-zui":n["x-zui"]};default:M.util.assertNever(n)}}d(st,"toJSONSchema");var aa=d(t=>({not:!0,description:t?.description,"x-zui":N(_({},t?.["x-zui"]),{def:{typeName:M.ZodFirstPartyTypeKind.ZodUndefined}})}),"undefinedSchema"),sa=d(t=>({type:"null",description:t?.description,"x-zui":t?.["x-zui"]}),"nullSchema"),Jp=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}};d(Jp,"ParseInputLazyPath");var It=Jp,zc=d((t,e)=>{if($r(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 Kt(t.common.issues);return this._error=n,this._error}}},"handleResult"),Xp=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(_({},this._def))}_getType(e){return rn(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:rn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new vt,ctx:{common:e.parent.common,data:e.data,parsedType:rn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(Si(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:rn(e)},a=this._parseSync({data:e,path:o.path,parent:o});return zc(o,a)}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:rn(e)},o=this._parse({data:e,path:r.path,parent:r}),a=await(Si(o)?o:Promise.resolve(o));return zc(r,a)}refine(e,n){let r=d(o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n,"getIssueProperties");return this._refinement((o,a)=>{let i=e(o),s=d(()=>a.addIssue(_({code:G.custom},r(o))),"setError");return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(s(),!1)):i?!0:(s(),!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 En({schema:this,typeName:"ZodEffects",effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return on.create(this,this._def)}nullable(){return Yn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Kr.create(this,this._def)}promise(){return To.create(this,this._def)}mandatory(){return this}or(e){return Qa.create([this,e],this._def)}and(e){return za.create(this,e,this._def)}transform(e){return new En(N(_({},me(this._def)),{schema:this,typeName:"ZodEffects",effect:{type:"transform",transform:e}}))}default(e){let n=typeof e=="function"?e:()=>e;return new ho(N(_({},me(this._def)),{innerType:this,defaultValue:n,typeName:"ZodDefault"}))}brand(){return new Ka(_({typeName:"ZodBranded",type:this},me(this._def)))}catch(e){let n=typeof e=="function"?e:()=>e;return new La(N(_({},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 Ya.create(this,e)}readonly(){return _o.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}metadata(e){var n,r,o;let a=this.clone(),i=a._metadataRoot;(o=(n=i._def)[r=le])!=null||(n[r]={});for(let[s,l]of Object.entries(e))i._def[le]=N(_({},i._def[le]),{[s]:l});return a}getMetadata(){return _({},this._metadataRoot._def[le])}setMetadata(e){this._metadataRoot._def[le]=_({},e)}get ui(){return _({},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 st(this)}toTypescriptType(e){return Ba(this,e)}toTypescriptSchema(){return Da(this)}naked(){return this}};d(Xp,"ZodType");var he=Xp,Yp=(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))(Yp||{}),be;(t=>{t.assertEqual=d(o=>o,"assertEqual");function e(o){}t.assertIs=e,d(e,"assertIs");function n(o){throw new Error("assertNever called")}t.assertNever=n,d(n,"assertNever"),t.arrayToEnum=d(o=>{let a={};for(let i of o)a[i]=i;return a},"arrayToEnum"),t.getValidEnumValues=d(o=>{let a=(0,t.objectKeys)(o).filter(s=>typeof o[o[s]]!="number"),i={};for(let s of a)i[s]=o[s];return(0,t.objectValues)(i)},"getValidEnumValues"),t.objectValues=d(o=>(0,t.objectKeys)(o).map(function(a){return o[a]}),"objectValues"),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let a=[];for(let i in o)Object.prototype.hasOwnProperty.call(o,i)&&a.push(i);return a},t.find=d((o,a)=>{for(let i of o)if(a(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,a=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}t.joinValues=r,d(r,"joinValues"),t.jsonStringifyReplacer=d((o,a)=>typeof a=="bigint"?a.toString():a,"jsonStringifyReplacer"),t.compareFunctions=d((o,a)=>o.toString()===a.toString(),"compareFunctions"),t.mock=d(()=>({}),"mock")})(be||(be={}));var va;(t=>{t.mergeShapes=d((e,n)=>_(_({},e),n),"mergeShapes")})(va||(va={}));var ne=be.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),rn=d(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:a,[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 s=i?Object.fromEntries(Object.entries(i).filter(([f])=>f!=="secret"||a?.includes("secret"))):void 0;return e?{errorMap:e,description:o,[le]:s}:{errorMap:d((f,p)=>f.code!=="invalid_type"?{message:p.defaultError}:typeof p.data>"u"?{message:r??p.defaultError}:{message:n??p.defaultError},"customMap"),description:o,[le]:s}}d(me,"processCreateParams");var Za=d((t,e)=>{let n;switch(t.code){case G.invalid_type:t.received===ne.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case G.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,be.jsonStringifyReplacer)}`;break;case G.unrecognized_keys:n=`Unrecognized key(s) in object: ${be.joinValues(t.keys,", ")}`;break;case G.invalid_union:n="Invalid input";break;case G.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${be.joinValues(t.options)}`;break;case G.invalid_enum_value:n=`Invalid enum value. Expected ${be.joinValues(t.options)}, received '${t.received}'`;break;case G.invalid_arguments:n="Invalid function arguments";break;case G.invalid_return_type:n="Invalid function return type";break;case G.invalid_date:n="Invalid date";break;case G.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 G.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 G.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 G.custom:n="Invalid input";break;case G.invalid_intersection_types:n="Intersection results could not be merged";break;case G.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case G.not_finite:n="Number must be finite";break;case G.unresolved_reference:n="Unresolved reference";break;default:n=e.defaultError,be.assertNever(t)}return{message:n}},"errorMap"),qc=Za,G=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"]),kx=d(t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),Bi=class Qp extends Error{constructor(e){super(),this.issues=[],this.addIssue=d(r=>{this.issues=[...this.issues,r]},"addIssue"),this.addIssues=d((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(a){return a.message},r={_errors:[]},o=d(a=>{for(let i of a.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 s=r,l=0;for(;l<i.path.length;){let f=i.path[l];l===i.path.length-1?(s[f]=s[f]||{_errors:[]},s[f]._errors.push(n(i))):s[f]=s[f]||{_errors:[]},s=s[f],l++}}},"processError");return o(this),r}static assert(e){if(!(e instanceof Qp))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()}};d(Bi,"ZodError");Bi.create=d(t=>new Bi(t),"create");var Kt=Bi,eg=Za;function tg(t){eg=t}d(tg,"setErrorMap");function Zr(){return eg}d(Zr,"getErrorMap");var Ei=d(t=>{var e;let{data:n,path:r,errorMaps:o,issueData:a}=t,i=[...r,...a.path||[]],s=N(_({},a),{path:i}),l="",f=o.filter(p=>!!p).slice().reverse();for(let p of f)l=p(s,{data:n,defaultError:l}).message;return N(_({},a),{path:i,message:(e=a.message)!=null?e:l})},"makeIssue"),Ix=[];function te(t,e){let n=Ei({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Zr(),Za].filter(r=>!!r)});t.common.issues.push(n)}d(te,"addIssueToContext");var ng=class rg{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 rg.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let o of n){let{key:a,value:i}=o;if(a.status==="aborted"||i.status==="aborted")return pe;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(r[a.value]=i.value)}return{status:e.value,value:r}}};d(ng,"ParseStatus");var vt=ng,pe=Object.freeze({status:"aborted"}),Gn=d(t=>({status:"dirty",value:t}),"DIRTY"),pt=d(t=>({status:"valid",value:t}),"OK"),Ta=d(t=>t.status==="aborted","isAborted"),_a=d(t=>t.status==="dirty","isDirty"),$r=d(t=>t.status==="valid","isValid"),Si=d(t=>typeof Promise<"u"&&t instanceof Promise,"isAsync"),ue;(t=>{t.errToObj=d(e=>typeof e=="string"?{message:e}:e||{},"errToObj"),t.toString=d(e=>typeof e=="string"?e:e?.message,"toString")})(ue||(ue={}));var ki=class ig extends he{constructor(){super(...arguments),this._any=!0}_parse(e){return pt(e.data)}isEqual(e){return e instanceof ig}};d(ki,"ZodAny");ki.create=d(t=>new ki(_({typeName:"ZodAny"},me(t))),"create");var jr=ki,Ii=class bn extends he{dereference(e){return new bn(N(_({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new bn(N(_({},this._def),{type:this._def.type.clone()}))}isEqual(e){var n,r,o,a,i,s;return e instanceof bn?Jn((n=this._def.exactLength)==null?void 0:n.value,(r=e._def.exactLength)==null?void 0:r.value)&&Jn((o=this._def.maxLength)==null?void 0:o.value,(a=e._def.maxLength)==null?void 0:a.value)&&Jn((i=this._def.minLength)==null?void 0:i.value,(s=e._def.minLength)==null?void 0:s.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:G.invalid_type,expected:ne.array,received:n.parsedType}),pe;if(o.exactLength!==null){let i=n.data.length>o.exactLength.value,s=n.data.length<o.exactLength.value;(i||s)&&(te(n,{code:i?G.too_big:G.too_small,minimum:s?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:G.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:G.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,s)=>o.type._parseAsync(new It(n,i,n.path,s)))).then(i=>vt.mergeArray(r,i));let a=[...n.data].map((i,s)=>o.type._parseSync(new It(n,i,n.path,s)));return vt.mergeArray(r,a)}get element(){return this._def.type}min(e,n){return new bn(N(_({},this._def),{minLength:{value:e,message:ue.toString(n)}}))}max(e,n){return new bn(N(_({},this._def),{maxLength:{value:e,message:ue.toString(n)}}))}length(e,n){return new bn(N(_({},this._def),{exactLength:{value:e,message:ue.toString(n)}}))}nonempty(e){return this.min(1,e)}};d(Ii,"ZodArray");Ii.create=d((t,e)=>new Ii(_({type:t,minLength:null,maxLength:null,exactLength:null,typeName:"ZodArray"},me(e))),"create");var Kr=Ii,Ax=d((t,e)=>og(t,e,new WeakSet),"isEqual"),og=d((t,e,n)=>Gw(t,e,Cx(n)),"_isEqualWithVisitedTracking"),Cx=d(t=>(e,n)=>{if(Ic(e)&&!t.has(e)&&Ic(n)&&!t.has(n)){let r=Fc(e,Lc),o=Fc(n,Lc);return t.add(r).add(o).add(e).add(n),og(r,o,t)}},"_customizerWithVisitedTracking"),Ox={compare:Ax},ag=class{constructor(e=[],n={}){this._options=_(_({},Ox),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))}};d(ag,"CustomSet");var et=ag,Ai=class hi 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 a=this._getOrReturnCtx(e);return te(a,{code:G.invalid_type,expected:ne.bigint,received:a.parsedType}),pe}let r,o=new vt;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:G.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),o.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:G.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),o.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),te(r,{code:G.not_multiple_of,multipleOf:a.value,message:a.message}),o.dirty()):be.assertNever(a);return{status:o.value,value:e.data}}isEqual(e){if(!(e instanceof hi)||this._def.coerce!==e._def.coerce)return!1;let n=new et(this._def.checks),r=new et(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 hi(N(_({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ue.toString(o)}]}))}_addCheck(e){return new hi(N(_({},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}};d(Ai,"ZodBigInt");Ai.create=d(t=>{var e;return new Ai(_({checks:[],typeName:"ZodBigInt",coerce:(e=t?.coerce)!=null?e:!1},me(t)))},"create");var $a=Ai,Ci=class sg 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:G.invalid_type,expected:ne.boolean,received:r.parsedType}),pe}return pt(e.data)}isEqual(e){return e instanceof sg?this._def.coerce===e._def.coerce:!1}};d(Ci,"ZodBoolean");Ci.create=d(t=>new Ci(_({typeName:"ZodBoolean",coerce:t?.coerce||!1},me(t))),"create");var ja=Ci,Rx=Symbol("zod_brand"),lg=class br extends he{dereference(e){return new br(N(_({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new br(N(_({},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 br?this._def.type.isEqual(e._def.type):!1}naked(){return this._def.type.naked()}mandatory(){return new br(N(_({},this._def),{type:this._def.type.mandatory()}))}};d(lg,"ZodBranded");var Ka=lg,Oi=class wr extends he{_parse(e){let{ctx:n}=this._processInputParams(e),r=N(_({},n),{common:N(_({},n.common),{issues:[]})}),o=this._def.innerType._parse({data:r.data,path:r.path,parent:_({},r)});return Si(o)?o.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Kt(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Kt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}isEqual(e){return e instanceof wr?this._def.innerType.isEqual(e._def.innerType)&&be.compareFunctions(this._def.catchValue,e._def.catchValue):!1}dereference(e){return new wr(N(_({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new wr(N(_({},this._def),{innerType:this._def.innerType.clone()}))}naked(){return this._def.innerType.naked()}mandatory(){return new wr(N(_({},this._def),{innerType:this._def.innerType.mandatory()}))}};d(Oi,"ZodCatch");Oi.create=d((t,e)=>new Oi(_({innerType:t,typeName:"ZodCatch",catchValue:typeof e.catch=="function"?e.catch:()=>e.catch},me(e))),"create");var La=Oi,ug=d((t,e={},n)=>t?jr.create().superRefine((r,o)=>{var a,i;if(!t(r)){let s=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e,l=(i=(a=s.fatal)!=null?a:n)!=null?i:!0,f=typeof s=="string"?{message:s}:s;o.addIssue(N(_({code:"custom"},f),{fatal:l}))}}):jr.create(),"custom"),Ri=class ba extends he{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ne.date){let a=this._getOrReturnCtx(e);return te(a,{code:G.invalid_type,expected:ne.date,received:a.parsedType}),pe}if(isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return te(a,{code:G.invalid_date}),pe}let r=new vt,o;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(o=this._getOrReturnCtx(e,o),te(o,{code:G.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(o=this._getOrReturnCtx(e,o),te(o,{code:G.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):be.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ba(N(_({},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 ba))return!1;let n=new et(this._def.checks),r=new et(e._def.checks);return n.isEqual(r)&&this._def.coerce===e._def.coerce}};d(Ri,"ZodDate");Ri.create=d(t=>new Ri(_({checks:[],coerce:t?.coerce||!1,typeName:"ZodDate"},me(t))),"create");var Fa=Ri,Mi=class xr 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 xr(N(_({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new xr(N(_({},this._def),{innerType:this._def.innerType.clone()}))}isEqual(e){return e instanceof xr?this._def.innerType.isEqual(e._def.innerType)&&Jn(this._def.defaultValue(),e._def.defaultValue()):!1}unwrap(){return this._def.innerType}naked(){return this._def.innerType.naked()}mandatory(){return new xr(N(_({},this._def),{innerType:this._def.innerType.mandatory()}))}};d(Mi,"ZodDefault");Mi.create=d((t,e,n)=>new Mi(_({innerType:t,typeName:"ZodDefault",defaultValue:typeof e=="function"?e:()=>e},me(n))),"create");var ho=Mi,Wt=d(t=>Array.from(new Set(t)),"unique"),jt=d(t=>t instanceof qa?jt(t.schema):t instanceof En?jt(t.innerType()):t instanceof Ga?[t.value]:t instanceof rr?t.options:t instanceof Va?be.objectValues(t.enum):t instanceof ho?jt(t._def.innerType):t instanceof bo?[void 0]:t instanceof Ja?[null]:t instanceof on?[void 0,...jt(t.unwrap())]:t instanceof Yn?[null,...jt(t.unwrap())]:t instanceof Ka||t instanceof _o?jt(t.unwrap()):t instanceof La?jt(t._def.innerType):[],"getDiscriminator"),cg=class wn extends he{dereference(e){let n=this.options.map(o=>o.dereference(e)),r=wn._getOptionsMap(this.discriminator,n);return new wn(N(_({},this._def),{options:n,optionsMap:r}))}getReferences(){return Wt(this.options.flatMap(e=>e.getReferences()))}clone(){let e=this.options.map(n=>n.clone());return new wn(N(_({},this._def),{options:e}))}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==ne.object)return te(n,{code:G.invalid_type,expected:ne.object,received:n.parsedType}),pe;let r=this.discriminator,o=n.data[r],a=this.optionsMap.get(o);return a?n.common.async?a._parseAsync({data:n.data,path:n.path,parent:n}):a._parseSync({data:n.data,path:n.path,parent:n}):(te(n,{code:G.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=wn._getOptionsMap(e,n);return new wn(_({typeName:"ZodDiscriminatedUnion",discriminator:e,options:n,optionsMap:o},me(r)))}static _getOptionsMap(e,n){let r=new Map;for(let o of n){let a=jt(o.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of a){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 wn)||this._def.discriminator!==e._def.discriminator)return!1;let n=d((a,i)=>a.isEqual(i),"compare"),r=new et(this._def.options,{compare:n}),o=new et(e._def.options,{compare:n});return r.isEqual(o)}};d(cg,"ZodDiscriminatedUnion");var fg=cg;function vo(t,e){return new rr(_({values:t,typeName:"ZodEnum"},me(e)))}d(vo,"createZodEnum");var Wa=class vi 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:G.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:G.invalid_enum_value,options:r}),pe}return pt(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 vi.create(e,_(_({},this._def),n))}exclude(e,n=this._def){return vi.create(this.options.filter(r=>!e.includes(r)),_(_({},this._def),n))}isEqual(e){if(!(e instanceof vi))return!1;let n=new et(this._def.values),r=new et(e._def.values);return n.isEqual(r)}};d(Wa,"ZodEnum");Wa.create=vo;var rr=Wa,dg=class xn 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 xn(N(_({},this._def),{args:n,returns:r}))}getReferences(){return Wt([...this._def.args.getReferences(),...this._def.returns.getReferences()])}clone(){return new xn(N(_({},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:G.invalid_type,expected:ne.function,received:n.parsedType}),pe;function r(s,l){return Ei({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Zr(),qc].filter(f=>!!f),issueData:{code:G.invalid_arguments,argumentsError:l}})}d(r,"makeArgsIssue");function o(s,l){return Ei({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Zr(),qc].filter(f=>!!f),issueData:{code:G.invalid_return_type,returnTypeError:l}})}d(o,"makeReturnsIssue");let a={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof To){let s=this;return pt(async function(...l){let f=new Kt([]),p=await s._def.args.parseAsync(l,a).catch(h=>{throw f.addIssue(r(l,h)),f}),y=await Reflect.apply(i,this,p);return await s._def.returns._def.type.parseAsync(y,a).catch(h=>{throw f.addIssue(o(y,h)),f})})}else{let s=this;return pt(function(...l){let f=s._def.args.safeParse(l,a);if(!f.success)throw new Kt([r(l,f.error)]);let p=Reflect.apply(i,this,f.data),y=s._def.returns.safeParse(p,a);if(!y.success)throw new Kt([o(p,y.error)]);return y.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new xn(N(_({},this._def),{args:tr.create(e).rest(Nr.create())}))}returns(e){return new xn(N(_({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new xn(_({args:e||tr.create([]).rest(Nr.create()),returns:n||Nr.create(),typeName:"ZodFunction"},me(r)))}isEqual(e){return e instanceof xn&&this._def.args.isEqual(e._def.args)&&this._def.returns.isEqual(e._def.returns)}};d(dg,"ZodFunction");var pg=dg;function Ni(t,e){let n=rn(t),r=rn(e);if(t===e)return{valid:!0,data:t};if(n===ne.object&&r===ne.object){let o=be.objectKeys(e),a=be.objectKeys(t).filter(s=>o.indexOf(s)!==-1),i=_(_({},t),e);for(let s of a){let l=Ni(t[s],e[s]);if(!l.valid)return{valid:!1};i[s]=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 a=0;a<t.length;a++){let i=t[a],s=e[a],l=Ni(i,s);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}}d(Ni,"mergeValues");var Di=class Ti extends he{dereference(e){return new Ti(N(_({},this._def),{left:this._def.left.dereference(e),right:this._def.right.dereference(e)}))}getReferences(){return Wt([...this._def.left.getReferences(),...this._def.right.getReferences()])}clone(){return new Ti(N(_({},this._def),{left:this._def.left.clone(),right:this._def.right.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),o=d((a,i)=>{if(Ta(a)||Ta(i))return pe;let s=Ni(a.value,i.value);return s.valid?((_a(a)||_a(i))&&n.dirty(),{status:n.value,value:s.data}):(te(r,{code:G.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(([a,i])=>o(a,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 Ti))return!1;let n=d((a,i)=>a.isEqual(i),"compare"),r=new et([this._def.left,this._def.right],{compare:n}),o=new et([e._def.left,e._def.right],{compare:n});return r.isEqual(o)}};d(Di,"ZodIntersection");Di.create=d((t,e,n)=>new Di(_({left:t,right:e,typeName:"ZodIntersection"},me(n))),"create");var za=Di,Hi=class Pr extends he{get schema(){return this._def.getter()}dereference(e){return new Pr(N(_({},this._def),{getter:d(()=>this._def.getter().dereference(e),"getter")}))}getReferences(){return this._def.getter().getReferences()}clone(){return new Pr(N(_({},this._def),{getter:d(()=>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 Pr?this._def.getter().isEqual(e._def.getter()):!1}naked(){return this._def.getter().naked()}mandatory(){return new Pr(N(_({},this._def),{getter:d(()=>this._def.getter().mandatory(),"getter")}))}};d(Hi,"ZodLazy");Hi.create=d((t,e)=>new Hi(_({getter:t,typeName:"ZodLazy"},me(e))),"create");var qa=Hi,Ui=class gg extends he{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return te(n,{received:n.data,code:G.invalid_literal,expected:this._def.value}),pe}return{status:"valid",value:e.data}}get value(){return this._def.value}isEqual(e){return e instanceof gg?Jn(this._def.value,e._def.value):!1}};d(Ui,"ZodLiteral");Ui.create=d((t,e)=>new Ui(_({value:t,typeName:"ZodLiteral"},me(e))),"create");var Ga=Ui,Zi=class _i 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 _i(N(_({},this._def),{keyType:n,valueType:r}))}getReferences(){return Wt([...this._def.keyType.getReferences(),...this._def.valueType.getReferences()])}clone(){return new _i(N(_({},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:G.invalid_type,expected:ne.map,received:r.parsedType}),pe;let o=this._def.keyType,a=this._def.valueType,i=[...r.data.entries()].map(([s,l],f)=>({key:o._parse(new It(r,s,r.path,[f,"key"])),value:a._parse(new It(r,l,r.path,[f,"value"]))}));if(r.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let l of i){let f=await l.key,p=await l.value;if(f.status==="aborted"||p.status==="aborted")return pe;(f.status==="dirty"||p.status==="dirty")&&n.dirty(),s.set(f.value,p.value)}return{status:n.value,value:s}})}else{let s=new Map;for(let l of i){let f=l.key,p=l.value;if(f.status==="aborted"||p.status==="aborted")return pe;(f.status==="dirty"||p.status==="dirty")&&n.dirty(),s.set(f.value,p.value)}return{status:n.value,value:s}}}isEqual(e){return!(!(e instanceof _i)||!this._def.keyType.isEqual(e._def.keyType)||!this._def.valueType.isEqual(e._def.valueType))}};d(Zi,"ZodMap");Zi.create=d((t,e,n)=>new Zi(_({valueType:e,keyType:t,typeName:"ZodMap"},me(n))),"create");var yg=Zi,$i=class mg extends he{_parse(e){if(this._getType(e)!==ne.nan){let r=this._getOrReturnCtx(e);return te(r,{code:G.invalid_type,expected:ne.nan,received:r.parsedType}),pe}return{status:"valid",value:e.data}}isEqual(e){return e instanceof mg}};d($i,"ZodNaN");$i.create=d(t=>new $i(_({typeName:"ZodNaN"},me(t))),"create");var hg=$i,ji=class vg 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:G.invalid_type}),pe}if(n.indexOf(e.data)===-1){let o=be.objectValues(n);return te(r,{received:r.data,code:G.invalid_enum_value,options:o}),pe}return pt(e.data)}get enum(){return this._def.values}isEqual(e){return e instanceof vg?Jn(this._def.values,e._def.values):!1}};d(ji,"ZodNativeEnum");ji.create=d((t,e)=>new ji(_({values:t,typeName:"ZodNativeEnum"},me(e))),"create");var Va=ji,Ki=class Tg extends he{_parse(e){let n=this._getOrReturnCtx(e);return te(n,{code:G.invalid_type,expected:ne.never,received:n.parsedType}),pe}isEqual(e){return e instanceof Tg}};d(Ki,"ZodNever");Ki.create=d(t=>new Ki(_({typeName:"ZodNever"},me(t))),"create");var Wr=Ki,Li=class _g extends he{_parse(e){if(this._getType(e)!==ne.null){let r=this._getOrReturnCtx(e);return te(r,{code:G.invalid_type,expected:ne.null,received:r.parsedType}),pe}return pt(e.data)}isEqual(e){return e instanceof _g}};d(Li,"ZodNull");Li.create=d(t=>new Li(_({typeName:"ZodNull"},me(t))),"create");var Ja=Li,Fi=class Br extends he{dereference(e){return new Br(N(_({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Br(N(_({},this._def),{innerType:this._def.innerType.clone()}))}_parse(e){return this._getType(e)===ne.null?pt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}isEqual(e){return e instanceof Br?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return new Br(N(_({},this._def),{innerType:this._def.innerType.mandatory()}))}};d(Fi,"ZodNullable");Fi.create=d((t,e)=>new Fi(_({innerType:t,typeName:"ZodNullable"},me(e))),"create");var Yn=Fi;function bg(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,o=n>r?n:r,a=parseInt(t.toFixed(o).replace(".","")),i=parseInt(e.toFixed(o).replace(".",""));return a%i/Math.pow(10,o)}d(bg,"floatSafeRemainder");var Wi=class bi 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 a=this._getOrReturnCtx(e);return te(a,{code:G.invalid_type,expected:ne.number,received:a.parsedType}),pe}let r,o=new vt;for(let a of this._def.checks)a.kind==="int"?be.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),te(r,{code:G.invalid_type,expected:"integer",received:"float",message:a.message}),o.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:G.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),o.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:G.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),o.dirty()):a.kind==="multipleOf"?bg(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),te(r,{code:G.not_multiple_of,multipleOf:a.value,message:a.message}),o.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),te(r,{code:G.not_finite,message:a.message}),o.dirty()):be.assertNever(a);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 bi(N(_({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ue.toString(o)}]}))}_addCheck(e){return new bi(N(_({},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 bi))return!1;let n=new et(this._def.checks),r=new et(e._def.checks);return n.isEqual(r)}};d(Wi,"ZodNumber");Wi.create=d(t=>new Wi(_({checks:[],typeName:"ZodNumber",coerce:t?.coerce||!1},me(t))),"create");var Xa=Wi;function Pn(t){if(t instanceof Qn){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=on.create(Pn(r))}return new Qn(N(_({},t._def),{shape:d(()=>e,"shape")}))}else return t instanceof Kr?new Kr(N(_({},t._def),{type:Pn(t.element)})):t instanceof on?on.create(Pn(t.unwrap())):t instanceof Yn?Yn.create(Pn(t.unwrap())):t instanceof tr?tr.create(t.items.map(e=>Pn(e))):t}d(Pn,"deepPartialify");var sn=class ht 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 ht(N(_({},this._def),{shape:d(()=>r,"shape")}))}getReferences(){let e=this._def.shape(),n=[];for(let r in e)n.push(...e[r].getReferences());return Wt(n)}clone(){let e={},n=this._def.shape();for(let[r,o]of Object.entries(n))e[r]=o.clone();return new ht(N(_({},this._def),{shape:d(()=>e,"shape")}))}_parse(e){if(this._getType(e)!==ne.object){let p=this._getOrReturnCtx(e);return te(p,{code:G.invalid_type,expected:ne.object,received:p.parsedType}),pe}let{status:r,ctx:o}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),s=[];if(this._def.unknownKeys!=="strip")for(let p in o.data)i.includes(p)||s.push(p);let l=[];for(let p of i){let y=a[p],g=o.data[p];l.push({key:{status:"valid",value:p},value:y._parse(new It(o,g,o.path,p)),alwaysSet:p in o.data})}let f=this._def.unknownKeys;if(f==="passthrough")for(let p of s)l.push({key:{status:"valid",value:p},value:{status:"valid",value:o.data[p]}});else if(f==="strict")s.length>0&&(te(o,{code:G.unrecognized_keys,keys:s}),r.dirty());else if(f!=="strip")for(let p of s){let y=o.data[p];l.push({key:{status:"valid",value:p},value:f._parse(new It(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=>vt.mergeObjectSync(r,p)):vt.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return ue.errToObj,new ht(_(N(_({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:d((n,r)=>{var o,a,i,s;let l=(i=(a=(o=this._def).errorMap)==null?void 0:a.call(o,n,r).message)!=null?i:r.defaultError;return n.code==="unrecognized_keys"?{message:(s=ue.errToObj(e).message)!=null?s:l}:{message:l}},"errorMap")}:{}))}strip(){return new ht(N(_({},this._def),{unknownKeys:"strip"}))}passthrough(){return new ht(N(_({},this._def),{unknownKeys:"passthrough"}))}additionalProperties(){if(this._def.unknownKeys instanceof he)return this._def.unknownKeys;if(this._def.unknownKeys==="passthrough")return jr.create();if(this._def.unknownKeys==="strict")return Wr.create()}extend(e){return new ht(N(_({},this._def),{shape:d(()=>_(_({},this._def.shape()),e),"shape")}))}merge(e){return new ht({unknownKeys:e._def.unknownKeys,shape:d(()=>_(_({},this._def.shape()),e._def.shape()),"shape"),typeName:"ZodObject"})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new ht(N(_({},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 ht(N(_({},this._def),{shape:d(()=>n,"shape")}))}omit(e){let n={};return be.objectKeys(this.shape).forEach(r=>{e[r]||(n[r]=this.shape[r])}),new ht(N(_({},this._def),{shape:d(()=>n,"shape")}))}deepPartial(){return Pn(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 ht(N(_({},this._def),{shape:d(()=>n,"shape")}))}required(e){let n={};return be.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])n[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof on;)a=a._def.innerType;n[r]=a}}),new ht(N(_({},this._def),{shape:d(()=>n,"shape")}))}keyof(){return vo(be.objectKeys(this.shape))}isEqual(e){if(!(e instanceof ht)||!this._unknownKeysEqual(e))return!1;let n=this._def.shape(),r=e._def.shape(),o=d((s,l)=>s[0]===l[0]&&s[1].isEqual(l[1]),"compare"),a=new et(Object.entries(n),{compare:o}),i=new et(Object.entries(r),{compare:o});return a.isEqual(i)}_unknownKeysEqual(e){let n=this.additionalProperties(),r=e.additionalProperties();return n===void 0||r===void 0?n===r:n.isEqual(r)}};d(sn,"ZodObject");sn.create=d((t,e)=>new sn(_({shape:d(()=>t,"shape"),unknownKeys:"strip",typeName:"ZodObject"},me(e))),"create");sn.strictCreate=d((t,e)=>new sn(_({shape:d(()=>t,"shape"),unknownKeys:"strict",typeName:"ZodObject"},me(e))),"strictCreate");sn.lazycreate=d((t,e)=>new sn(_({shape:t,unknownKeys:"strip",typeName:"ZodObject"},me(e))),"lazycreate");var Qn=sn,zi=class wi extends he{dereference(e){return new wi(N(_({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new wi(N(_({},this._def),{innerType:this._def.innerType.clone()}))}_parse(e){return this._getType(e)===ne.undefined?pt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}isEqual(e){return e instanceof wi?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return this._def.innerType.mandatory()}};d(zi,"ZodOptional");zi.create=d((t,e)=>new zi(_({innerType:t,typeName:"ZodOptional"},me(e))),"create");var on=zi,wg=class Er extends he{dereference(e){return new Er(N(_({},this._def),{in:this._def.in.dereference(e),out:this._def.out.dereference(e)}))}getReferences(){return Wt([...this._def.in.getReferences(),...this._def.out.getReferences()])}clone(){return new Er(N(_({},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 d(async()=>{let a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?pe:a.status==="dirty"?(n.dirty(),Gn(a.value)):this._def.out._parseAsync({data:a.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 Er({in:e,out:n,typeName:"ZodPipeline"})}isEqual(e){return!(!(e instanceof Er)||!this._def.in.isEqual(e._def.in)||!this._def.out.isEqual(e._def.out))}};d(wg,"ZodPipeline");var Ya=wg,qi=class xi extends he{unwrap(){return this._def.type}dereference(e){return new xi(N(_({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new xi(N(_({},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:G.invalid_type,expected:ne.promise,received:n.parsedType}),pe;let r=n.parsedType===ne.promise?n.data:Promise.resolve(n.data);return pt(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}isEqual(e){return e instanceof xi?this._def.type.isEqual(e._def.type):!1}naked(){return this._def.type.naked()}};d(qi,"ZodPromise");qi.create=d((t,e)=>new qi(_({type:t,typeName:"ZodPromise"},me(e))),"create");var To=qi,Gi=class Sr extends he{dereference(e){return new Sr(N(_({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Sr(N(_({},this._def),{innerType:this._def.innerType.clone()}))}_parse(e){let n=this._def.innerType._parse(e);return $r(n)&&(n.value=Object.freeze(n.value)),n}unwrap(){return this._def.innerType}isEqual(e){return e instanceof Sr?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return new Sr(N(_({},this._def),{innerType:this._def.innerType.mandatory()}))}};d(Gi,"ZodReadonly");Gi.create=d((t,e)=>new Gi(_({innerType:t,typeName:"ZodReadonly"},me(e))),"create");var _o=Gi,xg=class Wn 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 Wn(N(_({},this._def),{keyType:n,valueType:r}))}getReferences(){return Wt([...this._def.keyType.getReferences(),...this._def.valueType.getReferences()])}clone(){return new Wn(N(_({},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:G.invalid_type,expected:ne.object,received:r.parsedType}),pe;let o=[],a=this._def.keyType,i=this._def.valueType;for(let s in r.data)o.push({key:a._parse(new It(r,s,r.path,s)),value:i._parse(new It(r,r.data[s],r.path,s))});return r.common.async?vt.mergeObjectAsync(n,o):vt.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof he?new Wn(_({keyType:e,valueType:n,typeName:"ZodRecord"},me(r))):new Wn(_({keyType:gt.create(),valueType:e,typeName:"ZodRecord"},me(n)))}isEqual(e){return!(!(e instanceof Wn)||!this._def.keyType.isEqual(e._def.keyType)||!this._def.valueType.isEqual(e._def.valueType))}};d(xg,"ZodRecord");var Pg=xg,Vi=class Bg 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:G.unresolved_reference}),pe}isOptional(){return!1}isNullable(){return!1}isEqual(e){return e instanceof Bg?this._def.uri===e._def.uri:!1}};d(Vi,"ZodRef");Vi.create=d(t=>new Vi({typeName:"ZodRef",uri:t}),"create");var Eg=Vi,Ji=class zn extends he{dereference(e){return new zn(N(_({},this._def),{valueType:this._def.valueType.dereference(e)}))}getReferences(){return this._def.valueType.getReferences()}clone(){return new zn(N(_({},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:G.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:G.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:G.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());let a=this._def.valueType;function i(l){let f=new Set;for(let p of l){if(p.status==="aborted")return pe;p.status==="dirty"&&n.dirty(),f.add(p.value)}return{status:n.value,value:f}}d(i,"finalizeSet");let s=[...r.data.values()].map((l,f)=>a._parse(new It(r,l,r.path,f)));return r.common.async?Promise.all(s).then(l=>i(l)):i(s)}min(e,n){return new zn(N(_({},this._def),{minSize:{value:e,message:ue.toString(n)}}))}max(e,n){return new zn(N(_({},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,a;if(!(e instanceof zn))return!1;let i=(n=this._def.minSize)==null?void 0:n.value,s=(r=e._def.minSize)==null?void 0:r.value;if(i!==s)return!1;let l=(o=this._def.maxSize)==null?void 0:o.value,f=(a=e._def.maxSize)==null?void 0:a.value;return l!==f?!1:this._def.valueType.isEqual(e._def.valueType)}};d(Ji,"ZodSet");Ji.create=d((t,e)=>new Ji(_({valueType:t,minSize:null,maxSize:null,typeName:"ZodSet"},me(e))),"create");var Sg=Ji,kg=/^c[^\s-]{8,}$/i,Ig=/^[a-z][a-z0-9]*$/,Ag=/^[0-9A-HJKMNP-TV-Z]{26}$/,Cg=/^[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,Og=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Rg="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Mx=d(t=>t===Rg,"isEmojiRegex"),la,Mg=/^(((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}))$/,Ng=/^(([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 Dg(t,e){return!!((e==="v4"||!e)&&Mg.test(t)||(e==="v6"||!e)&&Ng.test(t))}d(Dg,"isValidIP");var Xi=class qn extends he{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ne.string){let a=this._getOrReturnCtx(e);return te(a,{code:G.invalid_type,expected:ne.string,received:a.parsedType}),pe}let r=new vt,o;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(o=this._getOrReturnCtx(e,o),te(o,{code:G.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="max")e.data.length>a.value&&(o=this._getOrReturnCtx(e,o),te(o,{code:G.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){let i=e.data.length>a.value,s=e.data.length<a.value;(i||s)&&(o=this._getOrReturnCtx(e,o),i?te(o,{code:G.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&te(o,{code:G.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")Og.test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"email",code:G.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")la||(la=new RegExp(Rg,"u")),la.test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"emoji",code:G.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")Cg.test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"uuid",code:G.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")kg.test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"cuid",code:G.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")Ig.test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"cuid2",code:G.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")Ag.test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"ulid",code:G.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),te(o,{validation:"url",code:G.invalid_string,message:a.message}),r.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"regex",code:G.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(o=this._getOrReturnCtx(e,o),te(o,{code:G.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),r.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(o=this._getOrReturnCtx(e,o),te(o,{code:G.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(o=this._getOrReturnCtx(e,o),te(o,{code:G.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?Vp(a).test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{code:G.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="ip"?Dg(e.data,a.version)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"ip",code:G.invalid_string,message:a.message}),r.dirty()):be.assertNever(a);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(o=>e.test(o),_({validation:n,code:G.invalid_string},ue.errToObj(r)))}_addCheck(e){return new qn(N(_({},this._def),{checks:[...this._def.checks,e]}))}email(e){return this._addCheck(_({kind:"email"},ue.errToObj(e)))}url(e){return this._addCheck(_({kind:"url"},ue.errToObj(e)))}emoji(e){return this._addCheck(_({kind:"emoji"},ue.errToObj(e)))}uuid(e){return this._addCheck(_({kind:"uuid"},ue.errToObj(e)))}cuid(e){return this._addCheck(_({kind:"cuid"},ue.errToObj(e)))}cuid2(e){return this._addCheck(_({kind:"cuid2"},ue.errToObj(e)))}ulid(e){return this._addCheck(_({kind:"ulid"},ue.errToObj(e)))}ip(e){return this._addCheck(_({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(_({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(_({kind:"regex",regex:e},ue.errToObj(n)))}includes(e,n){return this._addCheck(_({kind:"includes",value:e,position:n?.position},ue.errToObj(n?.message)))}startsWith(e,n){return this._addCheck(_({kind:"startsWith",value:e},ue.errToObj(n)))}endsWith(e,n){return this._addCheck(_({kind:"endsWith",value:e},ue.errToObj(n)))}min(e,n){return this._addCheck(_({kind:"min",value:e},ue.errToObj(n)))}max(e,n){return this._addCheck(_({kind:"max",value:e},ue.errToObj(n)))}length(e,n){return this._addCheck(_({kind:"length",value:e},ue.errToObj(n)))}nonempty(e){return this.min(1,ue.errToObj(e))}trim(){return new qn(N(_({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}secret(){return this._def[le]=N(_({},this._def[le]),{secret:!0}),this}toLowerCase(){return new qn(N(_({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new qn(N(_({},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 et(this._def.checks),r=new et(e._def.checks);return n.isEqual(r)}};d(Xi,"ZodString");Xi.create=d(t=>{var e;return new Xi(_({checks:[],typeName:"ZodString",coerce:(e=t?.coerce)!=null?e:!1},me(N(_({},t),{supportsExtensions:["secret"]}))))},"create");var gt=Xi,Yi=class Hg extends he{_parse(e){if(this._getType(e)!==ne.symbol){let r=this._getOrReturnCtx(e);return te(r,{code:G.invalid_type,expected:ne.symbol,received:r.parsedType}),pe}return pt(e.data)}isEqual(e){return e instanceof Hg}};d(Yi,"ZodSymbol");Yi.create=d(t=>new Yi(_({typeName:"ZodSymbol"},me(t))),"create");var Ug=Yi,er=class kr 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 kr(N(_({},this._def),{schema:this._def.schema.dereference(e)}))}getReferences(){return this._def.schema.getReferences()}clone(){return new kr(N(_({},this._def),{schema:this._def.schema.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),o=this._def.effect||null,a={addIssue:d(i=>{te(r,i),i.fatal?n.abort():n.dirty()},"addIssue"),get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),o.type==="preprocess"){let i=o.transform(r.data,a);if(r.common.async)return Promise.resolve(i).then(async s=>{if(n.value==="aborted")return pe;let l=await this._def.schema._parseAsync({data:s,path:r.path,parent:r});return l.status==="aborted"?pe:l.status==="dirty"||n.value==="dirty"?Gn(l.value):l});{if(n.value==="aborted")return pe;let s=this._def.schema._parseSync({data:i,path:r.path,parent:r});return s.status==="aborted"?pe:s.status==="dirty"||n.value==="dirty"?Gn(s.value):s}}if(o.type==="refinement"){let i=d(s=>{let l=o.refinement(s,a);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 s},"executeRefinement");if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?pe:(s.status==="dirty"&&n.dirty(),i(s.value),{status:n.value,value:s.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>s.status==="aborted"?pe:(s.status==="dirty"&&n.dirty(),i(s.value).then(()=>({status:n.value,value:s.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(!$r(i))return i;let s=o.transform(i.value,a);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>$r(i)?Promise.resolve(o.transform(i.value,a)).then(s=>({status:n.value,value:s})):i);be.assertNever(o)}isEqual(e){return!(e instanceof kr)||!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 kr(N(_({},this._def),{schema:this._def.schema.mandatory()}))}};d(er,"ZodEffects");er.create=d((t,e,n)=>new er(_({schema:t,typeName:"ZodEffects",effect:e},me(n))),"create");er.createWithPreprocess=d((t,e,n)=>new er(_({schema:e,effect:{type:"preprocess",transform:t},typeName:"ZodEffects"},me(n))),"createWithPreprocess");var En=er,Qi=class Ir 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 Ir(N(_({},this._def),{items:n,rest:r}))}getReferences(){return Wt([...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 Ir(N(_({},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:G.invalid_type,expected:ne.array,received:r.parsedType}),pe;if(r.data.length<this._def.items.length)return te(r,{code:G.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:G.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let a=[...r.data].map((i,s)=>{let l=this._def.items[s]||this._def.rest;return l?l._parse(new It(r,i,r.path,s)):null}).filter(i=>!!i);return r.common.async?Promise.all(a).then(i=>vt.mergeArray(n,i)):vt.mergeArray(n,a)}get items(){return this._def.items}rest(e){return new Ir(N(_({},this._def),{rest:e}))}isEqual(e){if(!(e instanceof Ir)||!this._restEquals(e))return!1;let n=d((a,i)=>a.isEqual(i),"compare"),r=new et(this._def.items,{compare:n}),o=new et(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)}};d(Qi,"ZodTuple");Qi.create=d((t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Qi(_({items:t,typeName:"ZodTuple",rest:null},me(e)))},"create");var tr=Qi,eo=class Zg extends he{_parse(e){if(this._getType(e)!==ne.undefined){let r=this._getOrReturnCtx(e);return te(r,{code:G.invalid_type,expected:ne.undefined,received:r.parsedType}),pe}return pt(e.data)}isEqual(e){return e instanceof Zg}mandatory(){return Wr.create(_({},this._def))}};d(eo,"ZodUndefined");eo.create=d(t=>new eo(_({typeName:"ZodUndefined"},me(t))),"create");var bo=eo,to=class Ar extends he{dereference(e){let n=this._def.options.map(r=>r.dereference(e));return new Ar(N(_({},this._def),{options:n}))}getReferences(){return Wt(this._def.options.reduce((e,n)=>[...e,...n.getReferences()],[]))}clone(){let e=this._def.options.map(n=>n.clone());return new Ar(N(_({},this._def),{options:e}))}_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function o(a){for(let s of a)if(s.result.status==="valid")return s.result;for(let s of a)if(s.result.status==="dirty")return n.common.issues.push(...s.ctx.common.issues),s.result;let i=a.map(s=>new Kt(s.ctx.common.issues));return te(n,{code:G.invalid_union,unionErrors:i}),pe}if(d(o,"handleResults"),n.common.async)return Promise.all(r.map(async a=>{let i=N(_({},n),{common:N(_({},n.common),{issues:[]}),parent:null});return{result:await a._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(o);{let a,i=[];for(let l of r){let f=N(_({},n),{common:N(_({},n.common),{issues:[]}),parent:null}),p=l._parseSync({data:n.data,path:n.path,parent:f});if(p.status==="valid")return p;p.status==="dirty"&&!a&&(a={result:p,ctx:f}),f.common.issues.length&&i.push(f.common.issues)}if(a)return n.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(l=>new Kt(l));return te(n,{code:G.invalid_union,unionErrors:s}),pe}}get options(){return this._def.options}isEqual(e){if(!(e instanceof Ar))return!1;let n=d((a,i)=>a.isEqual(i),"compare"),r=new et([...this._def.options],{compare:n}),o=new et([...e._def.options],{compare:n});return r.isEqual(o)}mandatory(){let e=this._def.options.filter(a=>!(a instanceof bo)).map(a=>a.mandatory()),[n,r,...o]=e;return n?r?new Ar(N(_({},this._def),{options:[n,r,...o]})):n:Wr.create(_({},this._def))}};d(to,"ZodUnion");to.create=d((t,e)=>new to(_({options:t,typeName:"ZodUnion"},me(e))),"create");var Qa=to,no=class $g extends he{constructor(){super(...arguments),this._unknown=!0}_parse(e){return pt(e.data)}isEqual(e){return e instanceof $g}};d(no,"ZodUnknown");no.create=d(t=>new no(_({typeName:"ZodUnknown"},me(t))),"create");var Nr=no,ro=class jg extends he{_parse(e){if(this._getType(e)!==ne.undefined){let r=this._getOrReturnCtx(e);return te(r,{code:G.invalid_type,expected:ne.void,received:r.parsedType}),pe}return pt(e.data)}isEqual(e){return e instanceof jg}};d(ro,"ZodVoid");ro.create=d(t=>new ro(_({typeName:"ZodVoid"},me(t))),"create");var Kg=ro,Nx=["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"],UA=rr.create(["any","string","number","boolean","object","pattern","date","array","target","time","enum"]),Dx=d(t=>gt.create().displayAs({id:"variable",params:_({type:t?.type||"any"},t?.params)}),"variable"),Hx=d(t=>gt.create().displayAs({id:"conversation",params:_({},t?.params)}),"conversation"),Ux=d(t=>gt.create().displayAs({id:"user",params:_({},t?.params)}),"user"),Zx=d(t=>gt.create().displayAs({id:"message",params:_({},t?.params)}),"message"),$x=d(t=>gt.create().displayAs({id:"agent",params:_({},t?.params)}),"agent"),jx=d(t=>gt.create().displayAs({id:"event",params:_({},t?.params)}),"event"),Kx=d(t=>gt.create().displayAs({id:"table",params:_({},t?.params)}),"table"),Lx=d(t=>gt.create().displayAs({id:"tablerow",params:_({},t?.params)}),"tablerow"),Fx=d(t=>gt.create().displayAs({id:"intent",params:_({},t?.params)}),"intent"),Wx=d(()=>rr.create(Nx).displayAs({id:"dropdown",params:{}}),"aimodel"),zx=d(t=>gt.create().displayAs({id:"datasource",params:_({},t)}),"datasource"),qx=d(t=>gt.create().displayAs({id:"knowledgebase",params:_({},t)}),"knowledgebase"),Gx={object:Qn.lazycreate},Vx=d((t,e={message:`Input not instance of ${t.name}`})=>ug(n=>n instanceof t,e),"instanceOfType"),Lg=gt.create,Fg=Xa.create,Jx=hg.create,Xx=$a.create,Wg=ja.create,Yx=Fa.create,Qx=Ug.create,eP=bo.create,tP=Ja.create,nP=jr.create,rP=Nr.create,iP=Wr.create,oP=Kg.create,aP=Kr.create,sP=Qn.create,lP=Qn.strictCreate,uP=Qa.create,cP=fg.create,fP=za.create,dP=tr.create,pP=Pg.create,gP=Eg.create,yP=_o.create,mP=yg.create,hP=Sg.create,vP=pg.create,TP=qa.create,_P=Ga.create,bP=rr.create,wP=Va.create,xP=To.create,Gc=En.create,PP=on.create,BP=Yn.create,EP=ho.create,SP=En.createWithPreprocess,kP=Ya.create,IP=d(()=>Lg().optional(),"ostring"),AP=d(()=>Fg().optional(),"onumber"),CP=d(()=>Wg().optional(),"oboolean"),OP={string:d(t=>gt.create(N(_({},t),{coerce:!0})),"string"),number:d(t=>Xa.create(N(_({},t),{coerce:!0})),"number"),boolean:d(t=>ja.create(N(_({},t),{coerce:!0})),"boolean"),bigint:d(t=>$a.create(N(_({},t),{coerce:!0})),"bigint"),date:d(t=>Fa.create(N(_({},t),{coerce:!0})),"date")},RP=pe,M=Y,zg=d((t,e)=>t.anyOf.length?t.anyOf.length===1?it(t.anyOf[0],N(_({},e),{path:[...e.path,"anyOf",0]})):`z.union([${t.anyOf.map((n,r)=>it(n,N(_({},e),{path:[...e.path,"anyOf",r]}))).join(", ")}])`:"z.any()","parseAnyOf"),MP=d(t=>{var e;return(e=t[le])!=null&&e.coerce?"z.coerce.boolean()":"z.boolean()"},"parseBoolean"),NP=d(t=>"z.any()","parseDefault"),DP=d((t,e)=>`z.union([${t.type.map(n=>it(N(_({},t),{type:n}),e)).join(", ")}])`,"parseMultipleType"),HP=d((t,e)=>`z.any().refine((value) => !${it(t.not,N(_({},e),{path:[...e.path,"not"]}))}.safeParse(value).success, "Invalid input: Should NOT be valid against schema")`,"parseNot"),UP=d(t=>"z.null()","parseNull"),ZP=d(t=>[t.slice(0,t.length/2),t.slice(t.length/2)],"half"),$P=d((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],a="";if(o!==void 0){let i=n({value:o,json:JSON.stringify(o)});if(i){let s=i[0],l=i.length===3?i[1]:"",f=i.length===3?i[2]:i[1];a+=s,((r=t.errorMessage)==null?void 0:r[e])!==void 0&&(a+=l+JSON.stringify(t.errorMessage[e])),a+=f}}return a}d(ut,"withMessage");var Cr=Symbol("Original index"),jP=d(t=>{let e=[];for(let n=0;n<t.length;n++){let r=t[n];if(typeof r=="boolean")e.push(r?{[Cr]:n}:{[Cr]:n,not:{}});else{if(Cr in r)return t;e.push(N(_({},r),{[Cr]:n}))}}return e},"ensureOriginalIndex");function Lr(t,e){if(t.allOf.length===0)return"z.never()";if(t.allOf.length===1){let n=t.allOf[0];return it(n,N(_({},e),{path:[...e.path,"allOf",n[Cr]]}))}else{let[n,r]=ZP(jP(t.allOf));return`z.intersection(${Lr({allOf:n},e)}, ${Lr({allOf:r},e)})`}}d(Lr,"parseAllOf");var KP=d((t,e)=>{if(Array.isArray(t.items))return`z.tuple([${t.items.map((r,o)=>it(r,N(_({},e),{path:[...e.path,"items",o]})))}])`;let n=t.items?`z.array(${it(t.items,N(_({},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"),LP=d(t=>`z.literal(${JSON.stringify(t.const)})`,"parseConst"),FP=d(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"),WP=d((t,e)=>{let n=it(t.if,N(_({},e),{path:[...e.path,"if"]})),r=it(t.then,N(_({},e),{path:[...e.path,"then"]})),o=it(t.else,N(_({},e),{path:[...e.path,"else"]}));return`z.union([${r}, ${o}]).superRefine((value,ctx) => {
24
24
  const result = ${n}.safeParse(value).success
25
25
  ? ${r}.safeParse(value)
26
- : ${a}.safeParse(value);
26
+ : ${o}.safeParse(value);
27
27
  if (!result.success) {
28
28
  result.error.errors.forEach((error) => ctx.addIssue(error))
29
29
  }
30
- })`},"parseIfThenElse"),zP=d(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:a})=>r===1?n.startsWith("z.number().int(")?void 0:[".int(",")"]:[`.multipleOf(${a}`,", ",")"]),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"),ts=d((t,e)=>t.oneOf.length?t.oneOf.length===1?it(t.oneOf[0],N(_({},e),{path:[...e.path,"oneOf",0]})):`z.any().superRefine((x, ctx) => {
30
+ })`},"parseIfThenElse"),zP=d(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"),es=d((t,e)=>t.oneOf.length?t.oneOf.length===1?it(t.oneOf[0],N(_({},e),{path:[...e.path,"oneOf",0]})):`z.any().superRefine((x, ctx) => {
31
31
  const schemas = [${t.oneOf.map((n,r)=>it(n,N(_({},e),{path:[...e.path,"oneOf",r]}))).join(", ")}];
32
32
  const errors = schemas.reduce(
33
33
  (errors: z.ZodError[], schema) =>
@@ -44,15 +44,15 @@ ${v}`.trim();case M.ZodFirstPartyTypeKind.ZodEnum:return s.values.map(se).join("
44
44
  message: "Invalid input: Should pass single schema",
45
45
  });
46
46
  }
47
- })`:"z.any()","parseOneOf");function qg(t,e){let n;t.properties&&(Object.keys(t.properties).length?(n="z.object({ ",n+=Object.keys(t.properties).map(i=>{let s=t.properties[i],l=`${JSON.stringify(i)}: ${it(s,N(_({},e),{path:[...e.path,"properties",i]}))}`,f=typeof s=="object"&&s.default!==void 0||typeof t.default=="object"&&t.default!==null&&i in t.default,p=Array.isArray(t.required)?t.required.includes(i):typeof s=="object"&&s.required===!0;return!f&&!p?`${l}.optional()`:l}).join(", "),n+=" })"):n="z.object({})");let r=t.additionalProperties!==void 0?it(t.additionalProperties,N(_({},e),{path:[...e.path,"additionalProperties"]})):void 0,a;if(t.patternProperties){let i=Object.fromEntries(Object.entries(t.patternProperties).map(([s,l])=>[s,it(l,N(_({},e),{path:[...e.path,"patternProperties",s]}))],{}));a="",n?r?a+=`.catchall(z.union([${[...Object.values(i),r].join(", ")}]))`:Object.keys(i).length>1?a+=`.catchall(z.union([${Object.values(i).join(", ")}]))`:a+=`.catchall(${Object.values(i)})`:r?a+=`z.record(z.union([${[...Object.values(i),r].join(", ")}]))`:Object.keys(i).length>1?a+=`z.record(z.union([${Object.values(i).join(", ")}]))`:a+=`z.record(${Object.values(i)})`,a+=`.superRefine((value, ctx) => {
48
- `,a+=`for (const key in value) {
49
- `,r&&(t.properties?a+=`let evaluated = [${Object.keys(t.properties).map(s=>JSON.stringify(s)).join(", ")}].includes(key)
50
- `:a+=`let evaluated = false
51
- `);for(let s in t.patternProperties)a+="if (key.match(new RegExp("+JSON.stringify(s)+`))) {
52
- `,r&&(a+=`evaluated = true
53
- `),a+="const result = "+i[s]+`.safeParse(value[key])
54
- `,a+=`if (!result.success) {
55
- `,a+=`ctx.addIssue({
47
+ })`:"z.any()","parseOneOf");function qg(t,e){let n;t.properties&&(Object.keys(t.properties).length?(n="z.object({ ",n+=Object.keys(t.properties).map(i=>{let s=t.properties[i],l=`${JSON.stringify(i)}: ${it(s,N(_({},e),{path:[...e.path,"properties",i]}))}`,f=typeof s=="object"&&s.default!==void 0||typeof t.default=="object"&&t.default!==null&&i in t.default,p=Array.isArray(t.required)?t.required.includes(i):typeof s=="object"&&s.required===!0;return!f&&!p?`${l}.optional()`:l}).join(", "),n+=" })"):n="z.object({})");let r=t.additionalProperties!==void 0?it(t.additionalProperties,N(_({},e),{path:[...e.path,"additionalProperties"]})):void 0,o;if(t.patternProperties){let i=Object.fromEntries(Object.entries(t.patternProperties).map(([s,l])=>[s,it(l,N(_({},e),{path:[...e.path,"patternProperties",s]}))],{}));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) => {
48
+ `,o+=`for (const key in value) {
49
+ `,r&&(t.properties?o+=`let evaluated = [${Object.keys(t.properties).map(s=>JSON.stringify(s)).join(", ")}].includes(key)
50
+ `:o+=`let evaluated = false
51
+ `);for(let s in t.patternProperties)o+="if (key.match(new RegExp("+JSON.stringify(s)+`))) {
52
+ `,r&&(o+=`evaluated = true
53
+ `),o+="const result = "+i[s]+`.safeParse(value[key])
54
+ `,o+=`if (!result.success) {
55
+ `,o+=`ctx.addIssue({
56
56
  path: [...ctx.path, key],
57
57
  code: 'custom',
58
58
  message: \`Invalid input: Key matching regex /\${key}/ must match schema\`,
@@ -60,12 +60,12 @@ ${v}`.trim();case M.ZodFirstPartyTypeKind.ZodEnum:return s.values.map(se).join("
60
60
  issues: result.error.issues
61
61
  }
62
62
  })
63
- `,a+=`}
64
- `,a+=`}
65
- `;r&&(a+=`if (!evaluated) {
66
- `,a+="const result = "+r+`.safeParse(value[key])
67
- `,a+=`if (!result.success) {
68
- `,a+=`ctx.addIssue({
63
+ `,o+=`}
64
+ `,o+=`}
65
+ `;r&&(o+=`if (!evaluated) {
66
+ `,o+="const result = "+r+`.safeParse(value[key])
67
+ `,o+=`if (!result.success) {
68
+ `,o+=`ctx.addIssue({
69
69
  path: [...ctx.path, key],
70
70
  code: 'custom',
71
71
  message: \`Invalid input: must match catchall schema\`,
@@ -73,10 +73,10 @@ ${v}`.trim();case M.ZodFirstPartyTypeKind.ZodEnum:return s.values.map(se).join("
73
73
  issues: result.error.issues
74
74
  }
75
75
  })
76
- `,a+=`}
77
- `,a+=`}
78
- `),a+=`}
79
- `,a+="})"}let o=n?a?n+a:r?r==="z.never()"?n+".strict()":n+`.catchall(${r})`:n:a||(r?`z.record(${r})`:"z.record(z.any())");return Xe.an.anyOf(t)&&(o+=`.and(${zg(N(_({},t),{anyOf:t.anyOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?N(_({},i),{type:"object"}):i)}),e)})`),Xe.a.oneOf(t)&&(o+=`.and(${ts(N(_({},t),{oneOf:t.oneOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?N(_({},i),{type:"object"}):i)}),e)})`),Xe.an.allOf(t)&&(o+=`.and(${zr(N(_({},t),{allOf:t.allOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?N(_({},i),{type:"object"}):i)}),e)})`),o}d(qg,"parseObject");var qP=d(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"),GP=d((t,e)=>`${it($P(t,"nullable"),e,!0)}.nullable()`,"parseNullable"),VP=d(t=>`z.ref('${t.$ref}')`,"parseRef"),JP=d((t,e)=>{var n,r;if(t.oneOf.length<=1||!((n=t.discriminator)!=null&&n.propertyName))return ts(t,e);let a=t.oneOf.map((o,i)=>it(o,N(_({},e),{path:[...e.path,"oneOf",i]})));return`z.discriminatedUnion("${(r=t.discriminator)==null?void 0:r.propertyName}", [${a.join(", ")}])`},"parseDiscriminator"),it=d((t,e={seen:new Map,path:[]},n)=>{if(typeof t!="object")return t?"z.any()":"z.never()";if(e.parserOverride){let o=e.parserOverride(t,e);if(typeof o=="string")return o}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 a=QP(t,e);return n||(a=XP(t,a),e.withoutDefaults||(a=YP(t,a))),r.r=a,a},"parseSchema"),XP=d((t,e)=>(t.description&&(e+=`.describe(${JSON.stringify(t.description)})`),e),"addMeta"),YP=d((t,e)=>(t.default!==void 0&&(e+=`.default(${JSON.stringify(t.default)})`),e),"addDefaults"),QP=d((t,e)=>Xe.a.nullable(t)?GP(t,e):Xe.an.object(t)?qg(t,e):Xe.an.array(t)?KP(t,e):Xe.an.anyOf(t)?zg(t,e):Xe.an.allOf(t)?zr(t,e):Xe.a.discriminator(t)?JP(t,e):Xe.a.oneOf(t)?ts(t,e):Xe.a.not(t)?HP(t,e):Xe.an.enum(t)?FP(t):Xe.a.const(t)?LP(t):Xe.a.multipleType(t)?DP(t,e):Xe.a.primitive(t,"string")?qP(t):Xe.a.primitive(t,"number")||Xe.a.primitive(t,"integer")?zP(t):Xe.a.primitive(t,"boolean")?MP(t):Xe.a.primitive(t,"null")?UP(t):Xe.a.conditional(t)?WP(t,e):Xe.a.ref(t)?VP(t):NP(t),"selectParser"),Xe={an:{object:d(t=>t.type==="object","object"),array:d(t=>t.type==="array","array"),anyOf:d(t=>t.anyOf!==void 0,"anyOf"),allOf:d(t=>t.allOf!==void 0,"allOf"),enum:d(t=>t.enum!==void 0,"enum")},a:{nullable:d(t=>t.nullable===!0,"nullable"),multipleType:d(t=>Array.isArray(t.type),"multipleType"),not:d(t=>t.not!==void 0,"not"),const:d(t=>t.const!==void 0,"const"),primitive:d((t,e)=>t.type===e,"primitive"),conditional:d(t=>Boolean("if"in t&&t.if&&"then"in t&&"else"in t&&t.then&&t.else),"conditional"),discriminator:d(t=>{var e;return t.oneOf!==void 0&&((e=t.discriminator)==null?void 0:e.propertyName)!==void 0},"discriminator"),oneOf:d(t=>t.oneOf!==void 0,"oneOf"),ref:d(t=>t.$ref!==void 0,"ref")}},eB=d(t=>{let e;try{e=new Function("z",`return ${t}`)(M)}catch(n){return{sucess:!1,error:`Failed to evaluate schema: ${(n instanceof Error?n:new Error(String(n))).message}`}}return e instanceof M.ZodType?{sucess:!0,value:e}:{sucess:!1,error:`String "${t}" does not evaluate to a Zod schema`}},"evalZuiString"),tB=d(t=>it(t,{seen:new Map,path:[]}),"jsonSchemaToZodStr"),nB=d(t=>{let e=tB(t);e=e.replaceAll("errors: z.ZodError[]","errors");let n=eB(e);if(!n.sucess)throw new sa(n.error);return n.value},"jsonSchemaToZod"),Nr=d((t,e)=>{var n,r;if(e[le]&&t._def&&(t._def[le]=e[le]),((n=t._def)==null?void 0:n.typeName)==="ZodObject"&&e.type==="object"&&e.properties&&Object.entries(e.properties).forEach(([a,o])=>{let i=typeof t._def.shape=="function"?t._def.shape():t._def.shape;i[a]&&Nr(i[a],o)}),((r=t._def)==null?void 0:r.typeName)==="ZodRecord"&&e.type==="object"&&e.additionalProperties&&Nr(t._def.valueType,e.additionalProperties),e.type==="array"&&e.items){let a=e.items;if(typeof a=="object"&&!Array.isArray(a)){let o=t._def.type;o&&Nr(o,a)}else Array.isArray(a)&&a.forEach((o,i)=>{let s=t._def;s.typeName===Y.ZodFirstPartyTypeKind.ZodTuple&&Nr(s.items[i],o)})}},"applyZuiPropsRecursively"),rB=d(t=>{let e=nB(t);return Nr(e,t),e},"fromJSONSchemaLegacy"),iB=d(t=>{var e,n;return t.anyOf!==void 0&&t.anyOf.length===2&&t.anyOf.some(r=>typeof r!="boolean"&&Gg(r))&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)===M.ZodFirstPartyTypeKind.ZodOptional},"isOptionalSchema"),aB=d(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)===M.ZodFirstPartyTypeKind.ZodNullable},"isNullableSchema"),Gg=d(t=>{var e,n;return t.not===!0&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)===M.ZodFirstPartyTypeKind.ZodUndefined},"isUndefinedSchema"),oB=d(t=>{var e,n;return!t.not&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)===M.ZodFirstPartyTypeKind.ZodUnknown},"isUnknownSchema"),sB=d(({type:t,minimum:e,exclusiveMinimum:n,maximum:r,exclusiveMaximum:a,multipleOf:o,format:i})=>{let s=M.number();return t==="integer"&&(s=s.int()),i==="finite"&&(s=s.finite()),n!==void 0?s=s.gt(n):e!==void 0&&(s=s.gte(e)),a!==void 0?s=s.lt(a):r!==void 0&&(s=s.lte(r)),o!==void 0&&(s=s.multipleOf(o)),s},"numberJSONSchemaToZuiNumber"),lB=d(({format:t,pattern:e,minLength:n,maxLength:r})=>{let a=M.string();if(n&&r&&n===r?a=a.length(n):(n&&(a=a.min(n)),r&&(a=a.max(r))),t==="cuid"||e===Ye.cuid)a=a.cuid();else if(t==="cuid2"||e===Ye.cuid2)a=a.cuid2();else if(t==="emoji"||e===Ye.emoji)a=a.emoji();else if(t==="ulid"||e===Ye.ulid)a=a.ulid();else if(t==="date-time"){let{precision:o,offset:i}=e?bx(e):{};a=a.datetime({precision:o,offset:i})}else t==="email"||e===Ye.email?a=a.email():t==="ipv4"||e===Ye.ipv4?a=a.ip():t==="ipv6"||e===Ye.ipv6?a=a.ip("v6"):t==="uri"?a=a.url():t==="uuid"||e===Ye.uuid?a=a.uuid():e&&(a=a.regex(new RegExp(e)));return a},"stringJSONSchemaToZuiString"),xr=d((t,e)=>{let n=[];e.enum!==void 0&&n.push(...e.enum),e.const!==void 0&&n.push(e.const);let r=n.filter(i=>typeof i===t),[a]=r;if(!a){if(t==="string"&&e.type==="string")return lB(e);if(t==="number"&&(e.type==="number"||e.type==="integer"))return sB(e);if(t==="boolean")return M.boolean();if(t==="null")return M.null();throw new sa(`Unknown primitive type: "${t}"`)}if(r.length===1)return M.literal(a);let o=r.map(i=>M.literal(i));return M.union(o)},"toZuiPrimitive"),uB=d((t,e)=>cB(t)?dB(t,e):fB(t)?pB(t,e):gB(t,e),"arrayJSONSchemaToZuiArray"),cB=d(t=>Array.isArray(t.items),"_isTuple"),fB=d(t=>t.items!==void 0&&t.uniqueItems,"_isSet"),dB=d(({items:t,additionalItems:e},n)=>{let r=t.map(n),a=M.tuple(r);return e!==void 0&&(a=a.rest(n(e))),a},"_handleTuple"),pB=d(({items:t,minItems:e,maxItems:n},r)=>{let a=M.set(r(t));return e&&(a=a.min(e)),n&&(a=a.max(n)),a},"_handleSet"),gB=d(({minItems:t,maxItems:e,items:n},r)=>{let a=M.array(r(n));return t&&t===e?a.length(t):(t&&(a=a.min(t)),e&&(a=a.max(e)),a)},"_handleArray"),qn=M.any();function Vg(t){return rt(t)}d(Vg,"fromJSONSchema");function rt(t){var e;if(t===void 0)return qn;if(t===!0)return M.any();if(t===!1)return M.never();if(t.default!==void 0)return rt(N(_({},t),{default:void 0})).default(t.default);if(t.readOnly)return rt(N(_({},t),{readOnly:void 0})).readonly();if(t.oneOf!==void 0)throw new nn({oneOf:t.oneOf});if(t.patternProperties!==void 0)throw new nn({patternProperties:t.patternProperties});if(t.propertyNames!==void 0)throw new nn({propertyNames:t.propertyNames});if(t.if!==void 0)throw new nn({if:t.if});if(t.then!==void 0)throw new nn({then:t.then});if(t.else!==void 0)throw new nn({else:t.else});if(t.$ref!==void 0)return M.ref(t.$ref);if(t.not!==void 0){if(Gg(t))return M.undefined();if(t.not===!0)return M.never();throw new nn({not:t.not})}if(Array.isArray(t.type)){if(t.type.length===0)return qn;if(t.type.length===1)return rt(N(_({},t),{type:t.type[0]}));let n=t,{type:r}=n,a=Qc(n,["type"]),o=t.type.map(i=>rt(N(_({},a),{type:i})));return M.union(o)}if(t.type==="string")return t.enum&&t.enum.length>0?M.enum(t.enum):xr("string",t);if(t.type==="integer"){let n=xr("number",t);return n instanceof M.ZodNumber?n.int():n}if(t.type==="number")return xr("number",t);if(t.type==="boolean")return xr("boolean",t);if(t.type==="null")return xr("null",t);if(t.type==="array")return uB(t,rt);if(t.type==="object"){if(t.additionalProperties!==void 0&&t.properties!==void 0){let n=rt(t.additionalProperties);return rt(N(_({},t),{additionalProperties:void 0})).catchall(n)}if(t.properties!==void 0){let n={};for(let[r,a]of Object.entries(t.properties)){let o=rt(a),i=(e=t.required)!=null?e:[];n[r]=i.includes(r)?o:o.optional()}return M.object(n)}if(t.additionalProperties!==void 0){let n=rt(t.additionalProperties);return M.record(n)}return M.record(qn)}if(t.anyOf!==void 0){if(t.anyOf.length===0)return qn;if(t.anyOf.length===1)return rt(t.anyOf[0]);if(iB(t))return rt(t.anyOf[0]).optional();if(aB(t))return rt(t.anyOf[0]).nullable();let n=t.anyOf.map(rt);return M.union(n)}if(t.allOf!==void 0){if(t.allOf.length===0)return qn;if(t.allOf.length===1)return rt(t.allOf[0]);let[n,...r]=t.allOf,a=rt(n),o=rt({allOf:r});return M.intersection(a,o)}return oB(t)?M.unknown():qn}d(rt,"_fromJSONSchema");var yB=/^\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))?$/,xo=d((t,e,n=!0)=>{if(typeof t!="object")throw new co("Input must be an object");let r=d(i=>{let s=i;return e?.nullable&&(s=s.nullable()),e?.optional&&(s=s.optional()),e?.passtrough&&typeof s.passthrough=="function"&&(s=s.passthrough()),s},"applyOptions"),a=Object.entries(t).reduce((i,[s,l])=>{if(l===null)i[s]=r(Y.null());else switch(typeof l){case"string":i[s]=yB.test(l)?r(Y.string().datetime()):r(Y.string());break;case"number":i[s]=r(Y.number());break;case"boolean":i[s]=r(Y.boolean());break;case"object":Array.isArray(l)?l.length===0?i[s]=r(Y.array(Y.unknown())):typeof l[0]=="object"?i[s]=r(Y.array(xo(l[0],e,!1))):["string","number","boolean"].includes(typeof l[0])&&(i[s]=r(Y.array(Y[typeof l[0]]()))):i[s]=r(xo(l,e,!1));break;default:throw new co(`Unsupported type for key ${s}`)}return i},{}),o=Object.keys(a).length>0;return e?.passtrough||!n&&!o?Y.object(a).passthrough():Y.object(a)},"fromObject");function Jg(){return{}}d(Jg,"parseAnyDef");function Xg(t,e){var n,r;let a={type:"array"};return((r=(n=t.type)==null?void 0:n._def)==null?void 0:r.typeName)!=="ZodAny"&&(a.items=Ie(t.type._def,N(_({},e),{currentPath:[...e.currentPath,"items"]}))),t.minLength&&Re(a,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Re(a,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Re(a,"minItems",t.exactLength.value,t.exactLength.message,e),Re(a,"maxItems",t.exactLength.value,t.exactLength.message,e)),a}d(Xg,"parseArrayDef");function Yg(t,e){let n=_({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}d(Yg,"parseBigintDef");function Qg(t){return _({type:"boolean"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{})}d(Qg,"parseBooleanDef");function ey(t,e){return Ie(t.type._def,e)}d(ey,"parseBrandedDef");var mB=d((t,e)=>Ie(t.innerType._def,e),"parseCatchDef");function ty(t,e){return e.dateStrategy=="integer"?hB(t,e):_({type:"string",format:"date-time"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{})}d(ty,"parseDateDef");var hB=d((t,e)=>{let n=_({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 ny(t,e){return N(_({},Ie(t.innerType._def,e)),{default:t.defaultValue()})}d(ny,"parseDefaultDef");function ry(t,e){return e.effectStrategy==="input"?Ie(t.schema._def,e):{}}d(ry,"parseEffectsDef");function iy(t){return{type:"string",enum:t.values}}d(iy,"parseEnumDef");var vB=d(t=>"type"in t&&t.type==="string"?!1:"allOf"in t,"isJsonSchema7AllOfType");function ay(t,e){let n=[Ie(t.left._def,N(_({},e),{currentPath:[...e.currentPath,"allOf","0"]})),Ie(t.right._def,N(_({},e),{currentPath:[...e.currentPath,"allOf","1"]}))].filter(o=>!!o),r=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,a=[];return n.forEach(o=>{if(vB(o))a.push(...o.allOf),o.unevaluatedProperties===void 0&&(r=void 0);else{let i=o;if("additionalProperties"in o&&o.additionalProperties===!1){let s=o,{additionalProperties:l}=s;i=Qc(s,["additionalProperties"])}else r=void 0;a.push(i)}}),a.length?_({allOf:a},r):void 0}d(ay,"parseIntersectionDef");function oy(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}}d(oy,"parseLiteralDef");function ns(t,e){var n,r,a,o,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,f)=>{var p;return N(_({},l),{[f]:(p=Ie(t.valueType._def,N(_({},e),{currentPath:[...e.currentPath,"properties",f]})))!=null?p:{}})},{}),additionalProperties:!1};let s={type:"object",additionalProperties:(r=Ie(t.valueType._def,N(_({},e),{currentPath:[...e.currentPath,"additionalProperties"]})))!=null?r:{}};if(e.target==="openApi3")return s;if(((a=t.keyType)==null?void 0:a._def.typeName)==="ZodString"&&((o=t.keyType._def.checks)!=null&&o.length)){let l=Object.entries(Zo(t.keyType._def,e)).reduce((f,[p,y])=>p==="type"?f:N(_({},f),{[p]:y}),{});return N(_({},s),{propertyNames:l})}else if(((i=t.keyType)==null?void 0:i._def.typeName)==="ZodEnum")return N(_({},s),{propertyNames:{enum:t.keyType._def.values}});return s}d(ns,"parseRecordDef");function sy(t,e){if(e.mapStrategy==="record")return ns(t,e);let n=Ie(t.keyType._def,N(_({},e),{currentPath:[...e.currentPath,"items","items","0"]}))||{},r=Ie(t.valueType._def,N(_({},e),{currentPath:[...e.currentPath,"items","items","1"]}))||{};return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}d(sy,"parseMapDef");function ly(t){let e=t.values,r=Object.keys(t.values).filter(o=>typeof e[e[o]]!="number").map(o=>e[o]),a=Array.from(new Set(r.map(o=>typeof o)));return{type:a.length===1?a[0]==="string"?"string":"number":["string","number"],enum:r.filter(o=>typeof o=="string"||typeof o=="number")}}d(ly,"parseNativeEnumDef");function uy(){return{not:{}}}d(uy,"parseNeverDef");function cy(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}d(cy,"parseNullDef");var aa={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function fy(t,e){if(e.target==="openApi3")return Vc(t,e);let n=t.options instanceof Map?Array.from(t.options.values()):t.options;if(n.every(r=>r._def.typeName in aa&&(!r._def.checks||!r._def.checks.length))){let r=n.reduce((a,o)=>{let i=aa[o._def.typeName];return i&&!a.includes(i)?[...a,i]:a},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){let r=n.reduce((a,o)=>{let i=typeof o._def.value;switch(i){case"string":case"number":case"boolean":return[...a,i];case"bigint":return[...a,"integer"];case"object":if(o._def.value===null)return[...a,"null"];case"symbol":case"undefined":case"function":default:return a}},[]);if(r.length===n.length){let a=r.filter((o,i,s)=>s.indexOf(o)===i);return{type:a.length>1?a:a[0],enum:n.reduce((o,i)=>o.includes(i._def.value)?o:[...o,i._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,a)=>[...r,...a._def.values.filter(o=>!r.includes(o))],[])};return Vc(t,e)}d(fy,"parseUnionDef");var Vc=d((t,e)=>{let n=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((a,o)=>Ie(a._def,N(_({},e),{currentPath:[...e.currentPath,e.unionStrategy,`${o}`]}))).filter(a=>!!a&&(!e.strictUnions||typeof a=="object"&&Object.keys(a).length>0)),r=e.discriminator&&t.typeName==="ZodDiscriminatedUnion"&&typeof t.discriminator=="string"?{discriminator:{propertyName:t.discriminator}}:{};if(n.length)return e.unionStrategy==="anyOf"?_({anyOf:n},r):_({oneOf:n},r)},"asUnionOf");function dy(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 o={type:aa[r._def.typeName],nullable:!0};return Po(r._def,e,o)}let a={type:[aa[r._def.typeName],"null"]};return Po(r._def,e,a)}if(e.target==="openApi3"){let r=Ie(t.innerType._def,N(_({},e),{currentPath:[...e.currentPath]}));return r&&N(_({},r),{nullable:!0})}let n=Ie(t.innerType._def,N(_({},e),{currentPath:[...e.currentPath,"anyOf","0"]}));return n&&{anyOf:[n,{type:"null"}]}}d(dy,"parseNullableDef");function py(t,e){let n=_({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",Uo(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}d(py,"parseNumberDef");var TB=d((t,e)=>{var n;return t.unknownKeys instanceof he?(n=Ie(t.unknownKeys._def,N(_({},e),{currentPath:[...e.currentPath,"additionalProperties"]})))!=null?n:!0:t.unknownKeys==="passthrough"},"getAdditionalProperties");function gy(t,e){let n=N(_({type:"object"},Object.entries(t.shape()).reduce((r,[a,o])=>{if(o===void 0||o._def===void 0)return r;let i=Ie(o._def,N(_({},e),{currentPath:[...e.currentPath,"properties",a],propertyPath:[...e.currentPath,"properties",a]}));return i===void 0?r:{properties:N(_({},r.properties),{[a]:i}),required:o.isOptional()?r.required:[...r.required,a]}},{properties:{},required:[]})),{additionalProperties:TB(t,e)});return n.required.length||delete n.required,n}d(gy,"parseObjectDef");var _B=d((t,e)=>{var n;if(e.currentPath.toString()===((n=e.propertyPath)==null?void 0:n.toString()))return Ie(t.innerType._def,e);let r=Ie(t.innerType._def,N(_({},e),{currentPath:[...e.currentPath,"anyOf","1"]}));return r?{anyOf:[{not:{}},r]}:{}},"parseOptionalDef"),bB=d((t,e)=>{if(e.pipeStrategy==="input")return Ie(t.in._def,e);if(e.pipeStrategy==="output")return Ie(t.out._def,e);let n=Ie(t.in._def,N(_({},e),{currentPath:[...e.currentPath,"allOf","0"]})),r=Ie(t.out._def,N(_({},e),{currentPath:[...e.currentPath,"allOf",n?"1":"0"]}));return{allOf:[n,r].filter(a=>a!==void 0)}},"parsePipelineDef");function yy(t,e){return Ie(t.type._def,e)}d(yy,"parsePromiseDef");function my(t,e){let r={type:"array",uniqueItems:!0,items:Ie(t.valueType._def,N(_({},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}d(my,"parseSetDef");function hy(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((n,r)=>Ie(n._def,N(_({},e),{currentPath:[...e.currentPath,"items",`${r}`]}))).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:Ie(t.rest._def,N(_({},e),{currentPath:[...e.currentPath,"additionalItems"]}))}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((n,r)=>Ie(n._def,N(_({},e),{currentPath:[...e.currentPath,"items",`${r}`]}))).reduce((n,r)=>r===void 0?n:[...n,r],[])}}d(hy,"parseTupleDef");function vy(){return{not:{}}}d(vy,"parseUndefinedDef");function Ty(){return{}}d(Ty,"parseUnknownDef");var wB=d((t,e)=>Ie(t.innerType._def,e),"parseReadonlyDef");function _y(t){return{$ref:t.uri}}d(_y,"parseRefDef");function Ie(t,e,n=!1){let r=e.seen.get(t);if(r&&!n){let i=xB(r,e);if(i!==void 0)return i}let a={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,a);let o=BB(t,t.typeName,e);return o&&Po(t,e,o),a.jsonSchema=o,o}d(Ie,"parseDef");var xB=d((t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:PB(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"),PB=d((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"),BB=d((t,e,n)=>{switch(e){case"ZodString":return Zo(t,n);case"ZodNumber":return py(t,n);case"ZodObject":return gy(t,n);case"ZodBigInt":return Yg(t,n);case"ZodBoolean":return Qg(t);case"ZodDate":return ty(t,n);case"ZodUndefined":return vy();case"ZodNull":return cy(n);case"ZodArray":return Xg(t,n);case"ZodUnion":case"ZodDiscriminatedUnion":return fy(t,n);case"ZodIntersection":return ay(t,n);case"ZodTuple":return hy(t,n);case"ZodRecord":return ns(t,n);case"ZodRef":return _y(t);case"ZodLiteral":return oy(t,n);case"ZodEnum":return iy(t);case"ZodNativeEnum":return ly(t);case"ZodNullable":return dy(t,n);case"ZodOptional":return _B(t,n);case"ZodMap":return sy(t,n);case"ZodSet":return my(t,n);case"ZodLazy":return Ie(t.getter()._def,n);case"ZodPromise":return yy(t,n);case"ZodNaN":case"ZodNever":return uy();case"ZodEffects":return ry(t,n);case"ZodAny":return Jg();case"ZodUnknown":return Ty();case"ZodDefault":return ny(t,n);case"ZodBranded":return ey(t,n);case"ZodReadonly":return wB(t,n);case"ZodCatch":return mB(t,n);case"ZodPipeline":return bB(t,n);case"ZodFunction":case"ZodVoid":case"ZodSymbol":return;default:return(r=>{})(e)}},"selectParser"),Po=d((t,e,n)=>(t.description&&(n.description=t.description,e.markdownDescription&&(n.markdownDescription=t.description)),Object.assign(n,{[le]:_(_({},t[le]),n[le])}),n),"addMeta"),Jc={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"},EB=d(t=>typeof t=="string"?N(_({},Jc),{name:t}):_(_({},Jc),t),"getDefaultOptions"),SB=d(t=>{let e=EB(t),n=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return N(_({},e),{currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([r,a])=>[a._def,{def:a._def,path:[...e.basePath,e.definitionPath,r],jsonSchema:void 0}]))})},"getRefs"),kB=d((t,e)=>{var n;let r=SB(e),a=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[f,p])=>{var y;return N(_({},l),{[f]:(y=Ie(p._def,N(_({},r),{currentPath:[...r.basePath,r.definitionPath,f]}),!0))!=null?y:{}})},{}):void 0,o=typeof e=="string"?e:e?.name,i=(n=Ie(t._def,o===void 0?r:N(_({},r),{currentPath:[...r.basePath,r.definitionPath,o]}),!1))!=null?n:{},s=o===void 0?a?N(_({},i),{[r.definitionPath]:a}):i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,o].join("/"),[r.definitionPath]:N(_({},a),{[o]:i})};return r.target==="jsonSchema7"?s.$schema="http://json-schema.org/draft-07/schema#":r.target==="jsonSchema2019-09"&&(s.$schema="https://json-schema.org/draft/2019-09/schema#"),s},"zodToJsonSchema"),IB=d((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 Vr=(t,e)=>{let n=t._def,r=e._def;if(n.typeName===Y.ZodFirstPartyTypeKind.ZodObject&&r.typeName===Y.ZodFirstPartyTypeKind.ZodObject){let a=n.shape(),o=r.shape();return Y.object({...a,...o})}if(n.typeName===Y.ZodFirstPartyTypeKind.ZodRecord&&r.typeName===Y.ZodFirstPartyTypeKind.ZodRecord)return Y.record(Y.intersection(n.valueType,r.valueType));throw new Error("Cannot merge object schemas with record schemas")},by=Y;var yt=Y.string().min(1),xy=Y.object({text:yt}),Py=Y.object({markdown:yt}),By=Y.object({imageUrl:yt}),Ey=Y.object({audioUrl:yt}),Sy=Y.object({videoUrl:yt}),ky=Y.object({fileUrl:yt,title:yt.optional()}),Iy=Y.object({latitude:Y.number(),longitude:Y.number(),address:Y.string().optional(),title:Y.string().optional()}),Ay=Y.object({title:yt,subtitle:yt.optional(),imageUrl:yt.optional(),actions:Y.array(Y.object({action:Y.enum(["postback","url","say"]),label:yt,value:yt}))}),wy=Y.object({text:yt,options:Y.array(Y.object({label:yt,value:yt}))}),AB=Y.object({items:Y.array(Ay)}),CB=Y.union([Y.object({type:Y.literal("text"),payload:xy}),Y.object({type:Y.literal("markdown"),payload:Py}),Y.object({type:Y.literal("image"),payload:By}),Y.object({type:Y.literal("audio"),payload:Ey}),Y.object({type:Y.literal("video"),payload:Sy}),Y.object({type:Y.literal("file"),payload:ky}),Y.object({type:Y.literal("location"),payload:Iy})]),OB=Y.object({items:Y.array(CB)}),RB={schema:Py},MB={text:{schema:xy},image:{schema:By},audio:{schema:Ey},video:{schema:Sy},file:{schema:ky},location:{schema:Iy},carousel:{schema:AB},card:{schema:Ay},dropdown:{schema:wy},choice:{schema:wy},bloc:{schema:OB}};C();R();O();var wa="x-bot-id",Oy="x-bot-user-id",Ry="x-integration-id",My="x-webhook-id",Ny="x-bp-configuration-type",xa="x-bp-configuration",Pa="x-bp-operation",Dy="x-bp-type",QA={HIDDEN_IN_STUDIO:{bpActionHiddenInStudio:"true"},AWAIT_RETURN:{bpActionAwaitReturn:"true"}};C();R();O();import{isNode as Nk}from"browser-or-node";C();R();O();var rs=console;function Ct(t){if(!t.body)throw new Error("Missing body");return JSON.parse(t.body)}async function za(t,e=8072,n=Zk){if(!Nk)throw new Error("This function can only be called in Node.js");let a=(Mh(),$v(Rh)).createServer(async(o,i)=>{try{let s=await Dk(o);if(s.path==="/health"){i.writeHead(200).end("ok");return}let l=await t(s);i.writeHead(l?.status??200,l?.headers??{}).end(l?.body??"{}")}catch(s){rs.error("Error while handling request",{error:s?.message??"Internal error occured"}),i.writeHead(500).end(JSON.stringify({error:s?.message??"Internal error occured"}))}});return a.listen(e,()=>n(e)),a}async function Dk(t){let e=await Uk(t),n={};for(let a=0;a<t.rawHeaders.length;a+=2){let o=t.rawHeaders[a].toLowerCase(),i=t.rawHeaders[a+1];n[o]=i}let r=new URL(t.url??"",t.headers.host?`http://${t.headers.host}`:"http://botpress.cloud");return{body:e,path:r.pathname,query:Hk(r.search,"?"),headers:n,method:t.method?.toUpperCase()??"GET"}}function Hk(t,e){return t.indexOf(e)===0?t.slice(e.length):t}async function Uk(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",a=>r+=a.toString()),t.on("error",a=>n(a)),t.on("end",()=>e(r))})}function Zk(t){rs.info(`Listening on port ${t}`)}import{isApiError as nU,RuntimeError as rU}from"@botpress/client";C();R();O();C();R();O();C();R();O();C();R();O();var Le={};Wn(Le,{mapKeys:()=>Kk,mapValues:()=>jk,mergeRecords:()=>Fk,pairs:()=>qa,stripUndefinedProps:()=>Lk,values:()=>$k});C();R();O();var qa=t=>Object.entries(t),$k=t=>Object.values(t),jk=(t,e)=>Object.fromEntries(qa(t).map(([n,r])=>[n,e(r,n)])),Kk=(t,e)=>Object.fromEntries(qa(t).map(([n,r])=>[e(n),r])),Lk=t=>Object.fromEntries(qa(t).filter(([,e])=>e!==void 0)),Fk=(t,e,n)=>{let r=[...Object.keys(t),...Object.keys(e)],a=[...new Set(r)],o={};for(let i of a){let s=t[i],l=e[i];s&&l?o[i]=n(s,l):s?o[i]=s:l&&(o[i]=l)}return o};var ye={};Wn(ye,{safePush:()=>Wk,unique:()=>zk});C();R();O();var Wk=(t,...e)=>t?[...t,...e]:[...e],zk=t=>Array.from(new Set(t));C();R();O();var Qt={};Wn(Qt,{setName:()=>qk});C();R();O();var qk=(t,e)=>(Object.defineProperty(t,"name",{value:e}),t);var Nh=t=>{let{name:e,version:n}=t,r={actions:{},events:{},channels:{}},a={name:e,version:n,entities:Le.mapValues(t.entities,i=>({name:i.name})),actions:{},events:{},channels:{}},o=Le.mapValues(t.entities,i=>i.schema);for(let[i,s]of Object.entries(t.definition.actions??{})){let l=s.input.schema.dereference(o),f=s.output.schema.dereference(o),p=t.actions?.[i]?.name??i;r.actions[p]={...s,...t.actions?.[i]??{},input:{schema:l},output:{schema:f}},a.actions[i]={name:p}}for(let[i,s]of Object.entries(t.definition.events??{})){let l=s.schema.dereference(o),f=t.events?.[i]?.name??i;r.events[f]={...s,...t.events?.[i]??{},schema:l},a.events[i]={name:f}}for(let[i,s]of Object.entries(t.definition.channels??{})){let l={};for(let[p,y]of Object.entries(s.messages)){let g=y.schema.dereference(o);l[p]={...y,schema:g}}let f=t.channels?.[i]?.name??i;r.channels[f]={...s,...t.channels?.[i]??{},message:{...s.message??{},tags:{...s.message?.tags??{},...t.channels?.[i]?.message?.tags??{}}},conversation:{...s.conversation??{},tags:{...s.conversation?.tags??{},...t.channels?.[i]?.conversation?.tags??{}}},messages:l},a.channels[i]={name:f}}return{resolved:r,statement:a}};C();R();O();var Ga=Symbol("schemaName"),Dh=t=>t?Le.mapValues(t,(n,r)=>({...n,[Ga]:r})):{},Hh=t=>Ga in t&&t[Ga]!==void 0,Uh=t=>t[Ga];C();R();O();var el=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;extend(e,n){let{entities:r,actions:a,events:o,channels:i}=this._callBuilder(e,n),s=this;s.interfaces??={};let l=Object.values(r).map(g=>g.name),f=l.length===0?e.name:`${e.name}<${l.join(",")}>`,{resolved:p,statement:y}=Nh({...e,entities:r,actions:Le.stripUndefinedProps(a),events:Le.stripUndefinedProps(o),channels:Le.stripUndefinedProps(i)});return s.actions=Le.mergeRecords(s.actions??{},p.actions,this._mergeActions),s.channels=Le.mergeRecords(s.channels??{},p.channels,this._mergeChannels),s.events=Le.mergeRecords(s.events??{},p.events,this._mergeEvents),s.interfaces[f]={id:e.id,...y},this}_callBuilder(e,n){let a={entities:Dh(this.entities)},o=n(a),i=Le.pairs(o.entities).find(([l,f])=>!Hh(f));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(o.entities,l=>({name:Uh(l),schema:l.schema})),actions:o.actions??{},events:o.events??{},channels:o.channels??{}}}_mergeActions=(e,n)=>({...e,...n,input:{schema:Vr(e.input.schema,n.input.schema)},output:{schema:Vr(e.output.schema,n.output.schema)}});_mergeEvents=(e,n)=>({...e,...n,schema:Vr(e.schema,n.schema)});_mergeChannels=(e,n)=>{let r=Le.mergeRecords(e.messages,n.messages,this._mergeMessage),a;(e.conversation||n.conversation)&&(a={tags:{...e.conversation?.tags,...n.conversation?.tags}});let o;return(e.message||n.message)&&(o={tags:{...e.message?.tags,...n.message?.tags}}),{...e,...n,messages:r,conversation:a,message:o}};_mergeMessage=(e,n)=>({schema:Vr(e.schema,n.schema)})};C();R();O();C();R();O();import{isApiError as xI,Client as PI,RuntimeError as wv,InvalidPayloadError as BI}from"@botpress/client";C();R();O();import*as Zh from"@botpress/client";var Va={retries:3,retryCondition:t=>Zh.axiosRetry.isNetworkOrIdempotentRequestError(t)||[429,502].includes(t.response?.status??0),retryDelay:(t,e)=>(Gk(e.response?.headers??{})??t)*1e3},Gk=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 Vk(String(r))}},Vk=t=>{let e=Jk(t)?Xk(t):t.length>0?parseInt(t,10):void 0;return e===void 0||isNaN(e)?void 0:e},Jk=t=>t.includes(" "),Xk=t=>{let e=Yk(t);if(!e)return;let n=new Date;return Math.max(0,Math.floor((e.getTime()-n.getTime())/1e3))},Yk=t=>{let e=new Date(t);return isNaN(e.getTime())?void 0:e};C();R();O();C();R();O();var ii=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)};C();R();O();var Ja=class{_cost=0;get cost(){return this._cost}setCost(e){this._cost=e}toJSON(){return{cost:this.cost}}};C();R();O();C();R();O();var fn="#";var SR=Y.enum(["webhook_received","message_created","action_triggered","register","unregister","ping","create_user","create_conversation"]),$h=t=>{let e=t[wa],n=t[Oy],r=t[Ry],a=t[My],o=t[Ny],i=t[xa],s=t[Pa];if(!e)throw new Error("Missing bot headers");if(!n)throw new Error("Missing bot user headers");if(!r)throw new Error("Missing integration headers");if(!a)throw new Error("Missing webhook headers");if(!i)throw new Error("Missing configuration headers");if(!s)throw new Error("Missing operation headers");return{botId:e,botUserId:n,integrationId:r,webhookId:a,operation:s,configurationType:o??null,configuration:i?JSON.parse(q.from(i,"base64").toString("utf-8")):{}}};C();R();O();C();R();O();C();R();O();C();R();O();var nl={},jh=!1;function wl(){return jh||(jh=!0,nl=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 a=42;e[n]=a;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 o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==n||!Object.prototype.propertyIsEnumerable.call(e,n))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var i=Object.getOwnPropertyDescriptor(e,n);if(i.value!==a||i.enumerable!==!0)return!1}return!0}),nl}var rl={},Kh=!1;function Qk(){return Kh||(Kh=!0,rl=Error),rl}var il={},Lh=!1;function eI(){return Lh||(Lh=!0,il=EvalError),il}var al={},Fh=!1;function tI(){return Fh||(Fh=!0,al=RangeError),al}var ol={},Wh=!1;function nI(){return Wh||(Wh=!0,ol=ReferenceError),ol}var sl={},zh=!1;function lv(){return zh||(zh=!0,sl=SyntaxError),sl}var ll={},qh=!1;function Xa(){return qh||(qh=!0,ll=TypeError),ll}var ul={},Gh=!1;function rI(){return Gh||(Gh=!0,ul=URIError),ul}var cl={},Vh=!1;function iI(){if(Vh)return cl;Vh=!0;var t=typeof Symbol<"u"&&Symbol,e=wl();return cl=function(){return typeof t!="function"||typeof Symbol!="function"||typeof t("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},cl}var fl={},Jh=!1;function aI(){if(Jh)return fl;Jh=!0;var t={__proto__:null,foo:{}},e=Object;return fl=function(){return{__proto__:t}.foo===t.foo&&!(t instanceof e)},fl}var dl={},Xh=!1;function oI(){if(Xh)return dl;Xh=!0;var t="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,n=Math.max,r="[object Function]",a=function(l,f){for(var p=[],y=0;y<l.length;y+=1)p[y]=l[y];for(var g=0;g<f.length;g+=1)p[g+l.length]=f[g];return p},o=function(l,f){for(var p=[],y=f,g=0;y<l.length;y+=1,g+=1)p[g]=l[y];return p},i=function(s,l){for(var f="",p=0;p<s.length;p+=1)f+=s[p],p+1<s.length&&(f+=l);return f};return dl=function(l){var f=this;if(typeof f!="function"||e.apply(f)!==r)throw new TypeError(t+f);for(var p=o(arguments,1),y,g=function(){if(this instanceof y){var v=f.apply(this,a(p,arguments));return Object(v)===v?v:this}return f.apply(l,a(p,arguments))},h=n(0,f.length-p.length),w=[],P=0;P<h;P++)w[P]="$"+P;if(y=Function("binder","return function ("+i(w,",")+"){ return binder.apply(this,arguments); }")(g),f.prototype){var B=function(){};B.prototype=f.prototype,y.prototype=new B,B.prototype=null}return y},dl}var pl={},Yh=!1;function xl(){if(Yh)return pl;Yh=!0;var t=oI();return pl=Function.prototype.bind||t,pl}var gl={},Qh=!1;function sI(){if(Qh)return gl;Qh=!0;var t=Function.prototype.call,e=Object.prototype.hasOwnProperty,n=xl();return gl=n.call(t,e),gl}var yl={},ev=!1;function oi(){if(ev)return yl;ev=!0;var t,e=Qk(),n=eI(),r=tI(),a=nI(),o=lv(),i=Xa(),s=rI(),l=Function,f=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=iI()(),w=aI()(),P=Object.getPrototypeOf||(w?function(Ue){return Ue.__proto__}:null),B={},v=typeof Uint8Array>"u"||!P?t:P(Uint8Array),S={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?t:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?t:ArrayBuffer,"%ArrayIteratorPrototype%":h&&P?P([][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&&P?P(P([][Symbol.iterator]())):t,"%JSON%":typeof JSON=="object"?JSON:t,"%Map%":typeof Map>"u"?t:Map,"%MapIteratorPrototype%":typeof Map>"u"||!h||!P?t:P(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%":a,"%Reflect%":typeof Reflect>"u"?t:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?t:Set,"%SetIteratorPrototype%":typeof Set>"u"||!h||!P?t:P(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?t:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":h&&P?P(""[Symbol.iterator]()):t,"%Symbol%":h?Symbol:t,"%SyntaxError%":o,"%ThrowTypeError%":g,"%TypedArray%":v,"%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%":s,"%WeakMap%":typeof WeakMap>"u"?t:WeakMap,"%WeakRef%":typeof WeakRef>"u"?t:WeakRef,"%WeakSet%":typeof WeakSet>"u"?t:WeakSet};if(P)try{null.error}catch(Ue){var E=P(P(Ue));S["%Error.prototype%"]=E}var H=function Ue(Pe){var Se;if(Pe==="%AsyncFunction%")Se=f("async function () {}");else if(Pe==="%GeneratorFunction%")Se=f("function* () {}");else if(Pe==="%AsyncGeneratorFunction%")Se=f("async function* () {}");else if(Pe==="%AsyncGenerator%"){var fe=Ue("%AsyncGeneratorFunction%");fe&&(Se=fe.prototype)}else if(Pe==="%AsyncIteratorPrototype%"){var ve=Ue("%AsyncGenerator%");ve&&P&&(Se=P(ve.prototype))}return S[Pe]=Se,Se},K={__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"]},ae=xl(),ee=sI(),ge=ae.call(Function.call,Array.prototype.concat),oe=ae.call(Function.apply,Array.prototype.splice),re=ae.call(Function.call,String.prototype.replace),Oe=ae.call(Function.call,String.prototype.slice),ze=ae.call(Function.call,RegExp.prototype.exec),tt=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Ve=/\\(\\)?/g,Je=function(Pe){var Se=Oe(Pe,0,1),fe=Oe(Pe,-1);if(Se==="%"&&fe!=="%")throw new o("invalid intrinsic syntax, expected closing `%`");if(fe==="%"&&Se!=="%")throw new o("invalid intrinsic syntax, expected opening `%`");var ve=[];return re(Pe,tt,function(D,j,F,de){ve[ve.length]=F?re(de,Ve,"$1"):j||D}),ve},mt=function(Pe,Se){var fe=Pe,ve;if(ee(K,fe)&&(ve=K[fe],fe="%"+ve[0]+"%"),ee(S,fe)){var D=S[fe];if(D===B&&(D=H(fe)),typeof D>"u"&&!Se)throw new i("intrinsic "+Pe+" exists, but is not available. Please file an issue!");return{alias:ve,name:fe,value:D}}throw new o("intrinsic "+Pe+" does not exist!")};return yl=function(Pe,Se){if(typeof Pe!="string"||Pe.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(/^%?[^%]*%?$/,Pe)===null)throw new o("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var fe=Je(Pe),ve=fe.length>0?fe[0]:"",D=mt("%"+ve+"%",Se),j=D.name,F=D.value,de=!1,Te=D.alias;Te&&(ve=Te[0],oe(fe,ge([0,1],Te)));for(var A=1,k=!0;A<fe.length;A+=1){var $=fe[A],X=Oe($,0,1),ie=Oe($,-1);if((X==='"'||X==="'"||X==="`"||ie==='"'||ie==="'"||ie==="`")&&X!==ie)throw new o("property names with quotes must have matching quotes");if(($==="constructor"||!k)&&(de=!0),ve+="."+$,j="%"+ve+"%",ee(S,j))F=S[j];else if(F!=null){if(!($ in F)){if(!Se)throw new i("base intrinsic for "+Pe+" exists, but the property is not available.");return}if(p&&A+1>=fe.length){var b=p(F,$);k=!!b,k&&"get"in b&&!("originalValue"in b.get)?F=b.get:F=F[$]}else k=ee(F,$),F=F[$];k&&!de&&(S[j]=F)}}return F},yl}var ml={},tv=!1;function Pl(){if(tv)return ml;tv=!0;var t=oi(),e=t("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return ml=e,ml}var hl={},nv=!1;function Ya(){if(nv)return hl;nv=!0;var t=oi(),e=t("%Object.getOwnPropertyDescriptor%",!0);if(e)try{e([],"length")}catch{e=null}return hl=e,hl}var vl={},rv=!1;function lI(){if(rv)return vl;rv=!0;var t=Pl(),e=lv(),n=Xa(),r=Ya();return vl=function(o,i,s){if(!o||typeof o!="object"&&typeof o!="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,f=arguments.length>4?arguments[4]:null,p=arguments.length>5?arguments[5]:null,y=arguments.length>6?arguments[6]:!1,g=!!r&&r(o,i);if(t)t(o,i,{configurable:p===null&&g?g.configurable:!p,enumerable:l===null&&g?g.enumerable:!l,value:s,writable:f===null&&g?g.writable:!f});else if(y||!l&&!f&&!p)o[i]=s;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},vl}var Tl={},iv=!1;function uI(){if(iv)return Tl;iv=!0;var t=Pl(),e=function(){return!!t};return e.hasArrayLengthDefineBug=function(){if(!t)return null;try{return t([],"length",{value:1}).length!==1}catch{return!0}},Tl=e,Tl}var _l={},av=!1;function cI(){if(av)return _l;av=!0;var t=oi(),e=lI(),n=uI()(),r=Ya(),a=Xa(),o=t("%Math.floor%");return _l=function(s,l){if(typeof s!="function")throw new a("`fn` is not a function");if(typeof l!="number"||l<0||l>4294967295||o(l)!==l)throw new a("`length` must be a positive 32-bit integer");var f=arguments.length>2&&!!arguments[2],p=!0,y=!0;if("length"in s&&r){var g=r(s,"length");g&&!g.configurable&&(p=!1),g&&!g.writable&&(y=!1)}return(p||y||!f)&&(n?e(s,"length",l,!0,!0):e(s,"length",l)),s},_l}var ai={},ov=!1;function Bl(){if(ov)return ai;ov=!0;var t=xl(),e=oi(),n=cI(),r=Xa(),a=e("%Function.prototype.apply%"),o=e("%Function.prototype.call%"),i=e("%Reflect.apply%",!0)||t.call(o,a),s=Pl(),l=e("%Math.max%");ai=function(y){if(typeof y!="function")throw new r("a function is required");var g=i(t,o,arguments);return n(g,1+l(0,y.length-(arguments.length-1)),!0)};var f=function(){return i(t,a,arguments)};return s?s(ai,"apply",{value:f}):ai.apply=f,ai}var bl={},sv=!1;function El(){if(sv)return bl;sv=!0;var t=oi(),e=Bl(),n=e(t("String.prototype.indexOf"));return bl=function(a,o){var i=t(a,!!o);return typeof i=="function"&&n(a,".prototype.")>-1?e(i):i},bl}is();bs();var Sl={},uv=!1;function Hl(){if(uv)return Sl;uv=!0;var t=wl();return Sl=function(){return t()&&!!Symbol.toStringTag},Sl}var kl={},cv=!1;function fI(){if(cv)return kl;cv=!0;var t=Hl()(),e=El(),n=e("Object.prototype.toString"),r=function(s){return t&&s&&typeof s=="object"&&Symbol.toStringTag in s?!1:n(s)==="[object Arguments]"},a=function(s){return r(s)?!0:s!==null&&typeof s=="object"&&typeof s.length=="number"&&s.length>=0&&n(s)!=="[object Array]"&&n(s.callee)==="[object Function]"},o=function(){return r(arguments)}();return r.isLegacyArguments=a,kl=o?r:a,kl}var Il={},fv=!1;function dI(){if(fv)return Il;fv=!0;var t=Object.prototype.toString,e=Function.prototype.toString,n=/^\s*(?:function)?\*/,r=Hl()(),a=Object.getPrototypeOf,o=function(){if(!r)return!1;try{return Function("return function*() {}")()}catch{}},i;return Il=function(l){if(typeof l!="function")return!1;if(n.test(e.call(l)))return!0;if(!r){var f=t.call(l);return f==="[object GeneratorFunction]"}if(!a)return!1;if(typeof i>"u"){var p=o();i=p?a(p):!1}return a(l)===i},Il}var Al={},dv=!1;function pI(){if(dv)return Al;dv=!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 a=/^\s*class\b/,o=function(E){try{var H=t.call(E);return a.test(H)}catch{return!1}},i=function(E){try{return o(E)?!1:(t.call(E),!0)}catch{return!1}},s=Object.prototype.toString,l="[object Object]",f="[object Function]",p="[object GeneratorFunction]",y="[object HTMLAllCollection]",g="[object HTML document.all class]",h="[object HTMLCollection]",w=typeof Symbol=="function"&&!!Symbol.toStringTag,P=!(0 in[,]),B=function(){return!1};if(typeof document=="object"){var v=document.all;s.call(v)===s.call(document.all)&&(B=function(E){if((P||!E)&&(typeof E>"u"||typeof E=="object"))try{var H=s.call(E);return(H===y||H===g||H===h||H===l)&&E("")==null}catch{}return!1})}return Al=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!o(E)&&i(E)}:function(E){if(B(E))return!0;if(!E||typeof E!="function"&&typeof E!="object")return!1;if(w)return i(E);if(o(E))return!1;var H=s.call(E);return H!==f&&H!==p&&!/^\[object HTML/.test(H)?!1:i(E)},Al}var Cl={},pv=!1;function gI(){if(pv)return Cl;pv=!0;var t=pI(),e=Object.prototype.toString,n=Object.prototype.hasOwnProperty,r=function(l,f,p){for(var y=0,g=l.length;y<g;y++)n.call(l,y)&&(p==null?f(l[y],y,l):f.call(p,l[y],y,l))},a=function(l,f,p){for(var y=0,g=l.length;y<g;y++)p==null?f(l.charAt(y),y,l):f.call(p,l.charAt(y),y,l)},o=function(l,f,p){for(var y in l)n.call(l,y)&&(p==null?f(l[y],y,l):f.call(p,l[y],y,l))},i=function(l,f,p){if(!t(f))throw new TypeError("iterator must be a function");var y;arguments.length>=3&&(y=p),e.call(l)==="[object Array]"?r(l,f,y):typeof l=="string"?a(l,f,y):o(l,f,y)};return Cl=i,Cl}var Ol={},gv=!1;function yI(){return gv||(gv=!0,Ol=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),Ol}var Rl={},yv=!1,mI=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function hI(){if(yv)return Rl;yv=!0;var t=yI(),e=typeof globalThis>"u"?mI:globalThis;return Rl=function(){for(var r=[],a=0;a<t.length;a++)typeof e[t[a]]=="function"&&(r[r.length]=t[a]);return r},Rl}var Ml={},mv=!1,vI=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function bv(){if(mv)return Ml;mv=!0;var t=gI(),e=hI(),n=Bl(),r=El(),a=Ya(),o=r("Object.prototype.toString"),i=Hl()(),s=typeof globalThis>"u"?vI:globalThis,l=e(),f=r("String.prototype.slice"),p=Object.getPrototypeOf,y=r("Array.prototype.indexOf",!0)||function(B,v){for(var S=0;S<B.length;S+=1)if(B[S]===v)return S;return-1},g={__proto__:null};i&&a&&p?t(l,function(P){var B=new s[P];if(Symbol.toStringTag in B){var v=p(B),S=a(v,Symbol.toStringTag);if(!S){var E=p(v);S=a(E,Symbol.toStringTag)}g["$"+P]=n(S.get)}}):t(l,function(P){var B=new s[P],v=B.slice||B.set;v&&(g["$"+P]=n(v))});var h=function(B){var v=!1;return t(g,function(S,E){if(!v)try{"$"+S(B)===E&&(v=f(E,1))}catch{}}),v},w=function(B){var v=!1;return t(g,function(S,E){if(!v)try{S(B),v=f(E,1)}catch{}}),v};return Ml=function(B){if(!B||typeof B!="object")return!1;if(!i){var v=f(o(B),8,-1);return y(l,v)>-1?v:v!=="Object"?!1:w(B)}return a?h(B):null},Ml}var Nl={},hv=!1;function TI(){if(hv)return Nl;hv=!0;var t=bv();return Nl=function(n){return!!t(n)},Nl}var we={},vv=!1;function _I(){if(vv)return we;vv=!0;var t=fI(),e=dI(),n=bv(),r=TI();function a(Z){return Z.call.bind(Z)}var o=typeof BigInt<"u",i=typeof Symbol<"u",s=a(Object.prototype.toString),l=a(Number.prototype.valueOf),f=a(String.prototype.valueOf),p=a(Boolean.prototype.valueOf);if(o)var y=a(BigInt.prototype.valueOf);if(i)var g=a(Symbol.prototype.valueOf);function h(Z,kt){if(typeof Z!="object")return!1;try{return kt(Z),!0}catch{return!1}}we.isArgumentsObject=t,we.isGeneratorFunction=e,we.isTypedArray=r;function w(Z){return typeof Promise<"u"&&Z instanceof Promise||Z!==null&&typeof Z=="object"&&typeof Z.then=="function"&&typeof Z.catch=="function"}we.isPromise=w;function P(Z){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(Z):r(Z)||D(Z)}we.isArrayBufferView=P;function B(Z){return n(Z)==="Uint8Array"}we.isUint8Array=B;function v(Z){return n(Z)==="Uint8ClampedArray"}we.isUint8ClampedArray=v;function S(Z){return n(Z)==="Uint16Array"}we.isUint16Array=S;function E(Z){return n(Z)==="Uint32Array"}we.isUint32Array=E;function H(Z){return n(Z)==="Int8Array"}we.isInt8Array=H;function K(Z){return n(Z)==="Int16Array"}we.isInt16Array=K;function ae(Z){return n(Z)==="Int32Array"}we.isInt32Array=ae;function ee(Z){return n(Z)==="Float32Array"}we.isFloat32Array=ee;function ge(Z){return n(Z)==="Float64Array"}we.isFloat64Array=ge;function oe(Z){return n(Z)==="BigInt64Array"}we.isBigInt64Array=oe;function re(Z){return n(Z)==="BigUint64Array"}we.isBigUint64Array=re;function Oe(Z){return s(Z)==="[object Map]"}Oe.working=typeof Map<"u"&&Oe(new Map);function ze(Z){return typeof Map>"u"?!1:Oe.working?Oe(Z):Z instanceof Map}we.isMap=ze;function tt(Z){return s(Z)==="[object Set]"}tt.working=typeof Set<"u"&&tt(new Set);function Ve(Z){return typeof Set>"u"?!1:tt.working?tt(Z):Z instanceof Set}we.isSet=Ve;function Je(Z){return s(Z)==="[object WeakMap]"}Je.working=typeof WeakMap<"u"&&Je(new WeakMap);function mt(Z){return typeof WeakMap>"u"?!1:Je.working?Je(Z):Z instanceof WeakMap}we.isWeakMap=mt;function Ue(Z){return s(Z)==="[object WeakSet]"}Ue.working=typeof WeakSet<"u"&&Ue(new WeakSet);function Pe(Z){return Ue(Z)}we.isWeakSet=Pe;function Se(Z){return s(Z)==="[object ArrayBuffer]"}Se.working=typeof ArrayBuffer<"u"&&Se(new ArrayBuffer);function fe(Z){return typeof ArrayBuffer>"u"?!1:Se.working?Se(Z):Z instanceof ArrayBuffer}we.isArrayBuffer=fe;function ve(Z){return s(Z)==="[object DataView]"}ve.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&ve(new DataView(new ArrayBuffer(1),0,1));function D(Z){return typeof DataView>"u"?!1:ve.working?ve(Z):Z instanceof DataView}we.isDataView=D;var j=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function F(Z){return s(Z)==="[object SharedArrayBuffer]"}function de(Z){return typeof j>"u"?!1:(typeof F.working>"u"&&(F.working=F(new j)),F.working?F(Z):Z instanceof j)}we.isSharedArrayBuffer=de;function Te(Z){return s(Z)==="[object AsyncFunction]"}we.isAsyncFunction=Te;function A(Z){return s(Z)==="[object Map Iterator]"}we.isMapIterator=A;function k(Z){return s(Z)==="[object Set Iterator]"}we.isSetIterator=k;function $(Z){return s(Z)==="[object Generator]"}we.isGeneratorObject=$;function X(Z){return s(Z)==="[object WebAssembly.Module]"}we.isWebAssemblyCompiledModule=X;function ie(Z){return h(Z,l)}we.isNumberObject=ie;function b(Z){return h(Z,f)}we.isStringObject=b;function x(Z){return h(Z,p)}we.isBooleanObject=x;function z(Z){return o&&h(Z,y)}we.isBigIntObject=z;function Q(Z){return i&&h(Z,g)}we.isSymbolObject=Q;function Me(Z){return ie(Z)||b(Z)||x(Z)||z(Z)||Q(Z)}we.isBoxedPrimitive=Me;function _e(Z){return typeof Uint8Array<"u"&&(fe(Z)||de(Z))}return we.isAnyArrayBuffer=_e,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(Z){Object.defineProperty(we,Z,{enumerable:!1,value:function(){throw new Error(Z+" is not supported in userland")}})}),we}var Dl={},Tv=!1;function bI(){return Tv||(Tv=!0,Dl=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"}),Dl}var xe={},_v=!1,si=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function wI(){if(_v)return xe;_v=!0;var t=At,e=Object.getOwnPropertyDescriptors||function(j){for(var F=Object.keys(j),de={},Te=0;Te<F.length;Te++)de[F[Te]]=Object.getOwnPropertyDescriptor(j,F[Te]);return de},n=/%[sdj%]/g;xe.format=function(D){if(!K(D)){for(var j=[],F=0;F<arguments.length;F++)j.push(i(arguments[F]));return j.join(" ")}for(var F=1,de=arguments,Te=de.length,A=String(D).replace(n,function($){if($==="%%")return"%";if(F>=Te)return $;switch($){case"%s":return String(de[F++]);case"%d":return Number(de[F++]);case"%j":try{return JSON.stringify(de[F++])}catch{return"[Circular]"}default:return $}}),k=de[F];F<Te;k=de[++F])S(k)||!oe(k)?A+=" "+k:A+=" "+i(k);return A},xe.deprecate=function(D,j){if(typeof t<"u"&&t.noDeprecation===!0)return D;if(typeof t>"u")return function(){return xe.deprecate(D,j).apply(this||si,arguments)};var F=!1;function de(){if(!F){if(t.throwDeprecation)throw new Error(j);t.traceDeprecation?console.trace(j):console.error(j),F=!0}return D.apply(this||si,arguments)}return de};var r={},a=/^$/;if(t.env.NODE_DEBUG){var o=t.env.NODE_DEBUG;o=o.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),a=new RegExp("^"+o+"$","i")}xe.debuglog=function(D){if(D=D.toUpperCase(),!r[D])if(a.test(D)){var j=t.pid;r[D]=function(){var F=xe.format.apply(xe,arguments);console.error("%s %d: %s",D,j,F)}}else r[D]=function(){};return r[D]};function i(D,j){var F={seen:[],stylize:l};return arguments.length>=3&&(F.depth=arguments[2]),arguments.length>=4&&(F.colors=arguments[3]),v(j)?F.showHidden=j:j&&xe._extend(F,j),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=s),p(F,D,F.depth)}xe.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 s(D,j){var F=i.styles[j];return F?"\x1B["+i.colors[F][0]+"m"+D+"\x1B["+i.colors[F][1]+"m":D}function l(D,j){return D}function f(D){var j={};return D.forEach(function(F,de){j[F]=!0}),j}function p(D,j,F){if(D.customInspect&&j&&ze(j.inspect)&&j.inspect!==xe.inspect&&!(j.constructor&&j.constructor.prototype===j)){var de=j.inspect(F,D);return K(de)||(de=p(D,de,F)),de}var Te=y(D,j);if(Te)return Te;var A=Object.keys(j),k=f(A);if(D.showHidden&&(A=Object.getOwnPropertyNames(j)),Oe(j)&&(A.indexOf("message")>=0||A.indexOf("description")>=0))return g(j);if(A.length===0){if(ze(j)){var $=j.name?": "+j.name:"";return D.stylize("[Function"+$+"]","special")}if(ge(j))return D.stylize(RegExp.prototype.toString.call(j),"regexp");if(re(j))return D.stylize(Date.prototype.toString.call(j),"date");if(Oe(j))return g(j)}var X="",ie=!1,b=["{","}"];if(B(j)&&(ie=!0,b=["[","]"]),ze(j)){var x=j.name?": "+j.name:"";X=" [Function"+x+"]"}if(ge(j)&&(X=" "+RegExp.prototype.toString.call(j)),re(j)&&(X=" "+Date.prototype.toUTCString.call(j)),Oe(j)&&(X=" "+g(j)),A.length===0&&(!ie||j.length==0))return b[0]+X+b[1];if(F<0)return ge(j)?D.stylize(RegExp.prototype.toString.call(j),"regexp"):D.stylize("[Object]","special");D.seen.push(j);var z;return ie?z=h(D,j,F,k,A):z=A.map(function(Q){return w(D,j,F,k,Q,ie)}),D.seen.pop(),P(z,X,b)}function y(D,j){if(ee(j))return D.stylize("undefined","undefined");if(K(j)){var F="'"+JSON.stringify(j).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return D.stylize(F,"string")}if(H(j))return D.stylize(""+j,"number");if(v(j))return D.stylize(""+j,"boolean");if(S(j))return D.stylize("null","null")}function g(D){return"["+Error.prototype.toString.call(D)+"]"}function h(D,j,F,de,Te){for(var A=[],k=0,$=j.length;k<$;++k)Pe(j,String(k))?A.push(w(D,j,F,de,String(k),!0)):A.push("");return Te.forEach(function(X){X.match(/^\d+$/)||A.push(w(D,j,F,de,X,!0))}),A}function w(D,j,F,de,Te,A){var k,$,X;if(X=Object.getOwnPropertyDescriptor(j,Te)||{value:j[Te]},X.get?X.set?$=D.stylize("[Getter/Setter]","special"):$=D.stylize("[Getter]","special"):X.set&&($=D.stylize("[Setter]","special")),Pe(de,Te)||(k="["+Te+"]"),$||(D.seen.indexOf(X.value)<0?(S(F)?$=p(D,X.value,null):$=p(D,X.value,F-1),$.indexOf(`
76
+ `,o+=`}
77
+ `,o+=`}
78
+ `),o+=`}
79
+ `,o+="})"}let a=n?o?n+o:r?r==="z.never()"?n+".strict()":n+`.catchall(${r})`:n:o||(r?`z.record(${r})`:"z.record(z.any())");return Xe.an.anyOf(t)&&(a+=`.and(${zg(N(_({},t),{anyOf:t.anyOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?N(_({},i),{type:"object"}):i)}),e)})`),Xe.a.oneOf(t)&&(a+=`.and(${es(N(_({},t),{oneOf:t.oneOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?N(_({},i),{type:"object"}):i)}),e)})`),Xe.an.allOf(t)&&(a+=`.and(${Lr(N(_({},t),{allOf:t.allOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?N(_({},i),{type:"object"}):i)}),e)})`),a}d(qg,"parseObject");var qP=d(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"),GP=d((t,e)=>`${it($P(t,"nullable"),e,!0)}.nullable()`,"parseNullable"),VP=d(t=>`z.ref('${t.$ref}')`,"parseRef"),JP=d((t,e)=>{var n,r;if(t.oneOf.length<=1||!((n=t.discriminator)!=null&&n.propertyName))return es(t,e);let o=t.oneOf.map((a,i)=>it(a,N(_({},e),{path:[...e.path,"oneOf",i]})));return`z.discriminatedUnion("${(r=t.discriminator)==null?void 0:r.propertyName}", [${o.join(", ")}])`},"parseDiscriminator"),it=d((t,e={seen:new Map,path:[]},n)=>{if(typeof t!="object")return t?"z.any()":"z.never()";if(e.parserOverride){let a=e.parserOverride(t,e);if(typeof a=="string")return a}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=QP(t,e);return n||(o=XP(t,o),e.withoutDefaults||(o=YP(t,o))),r.r=o,o},"parseSchema"),XP=d((t,e)=>(t.description&&(e+=`.describe(${JSON.stringify(t.description)})`),e),"addMeta"),YP=d((t,e)=>(t.default!==void 0&&(e+=`.default(${JSON.stringify(t.default)})`),e),"addDefaults"),QP=d((t,e)=>Xe.a.nullable(t)?GP(t,e):Xe.an.object(t)?qg(t,e):Xe.an.array(t)?KP(t,e):Xe.an.anyOf(t)?zg(t,e):Xe.an.allOf(t)?Lr(t,e):Xe.a.discriminator(t)?JP(t,e):Xe.a.oneOf(t)?es(t,e):Xe.a.not(t)?HP(t,e):Xe.an.enum(t)?FP(t):Xe.a.const(t)?LP(t):Xe.a.multipleType(t)?DP(t,e):Xe.a.primitive(t,"string")?qP(t):Xe.a.primitive(t,"number")||Xe.a.primitive(t,"integer")?zP(t):Xe.a.primitive(t,"boolean")?MP(t):Xe.a.primitive(t,"null")?UP(t):Xe.a.conditional(t)?WP(t,e):Xe.a.ref(t)?VP(t):NP(t),"selectParser"),Xe={an:{object:d(t=>t.type==="object","object"),array:d(t=>t.type==="array","array"),anyOf:d(t=>t.anyOf!==void 0,"anyOf"),allOf:d(t=>t.allOf!==void 0,"allOf"),enum:d(t=>t.enum!==void 0,"enum")},a:{nullable:d(t=>t.nullable===!0,"nullable"),multipleType:d(t=>Array.isArray(t.type),"multipleType"),not:d(t=>t.not!==void 0,"not"),const:d(t=>t.const!==void 0,"const"),primitive:d((t,e)=>t.type===e,"primitive"),conditional:d(t=>!!("if"in t&&t.if&&"then"in t&&"else"in t&&t.then&&t.else),"conditional"),discriminator:d(t=>{var e;return t.oneOf!==void 0&&((e=t.discriminator)==null?void 0:e.propertyName)!==void 0},"discriminator"),oneOf:d(t=>t.oneOf!==void 0,"oneOf"),ref:d(t=>t.$ref!==void 0,"ref")}},eB=d(t=>{let e;try{e=new Function("z",`return ${t}`)(M)}catch(n){return{sucess:!1,error:`Failed to evaluate schema: ${(n instanceof Error?n:new Error(String(n))).message}`}}return e instanceof M.ZodType?{sucess:!0,value:e}:{sucess:!1,error:`String "${t}" does not evaluate to a Zod schema`}},"evalZuiString"),tB=d(t=>it(t,{seen:new Map,path:[]}),"jsonSchemaToZodStr"),nB=d(t=>{let e=tB(t);e=e.replaceAll("errors: z.ZodError[]","errors");let n=eB(e);if(!n.sucess)throw new ao(n.error);return n.value},"jsonSchemaToZod"),Or=d((t,e)=>{var n,r;if(e[le]&&t._def&&(t._def[le]=e[le]),((n=t._def)==null?void 0:n.typeName)==="ZodObject"&&e.type==="object"&&e.properties&&Object.entries(e.properties).forEach(([o,a])=>{let i=typeof t._def.shape=="function"?t._def.shape():t._def.shape;i[o]&&Or(i[o],a)}),((r=t._def)==null?void 0:r.typeName)==="ZodRecord"&&e.type==="object"&&e.additionalProperties&&Or(t._def.valueType,e.additionalProperties),e.type==="array"&&e.items){let o=e.items;if(typeof o=="object"&&!Array.isArray(o)){let a=t._def.type;a&&Or(a,o)}else Array.isArray(o)&&o.forEach((a,i)=>{let s=t._def;s.typeName===Y.ZodFirstPartyTypeKind.ZodTuple&&Or(s.items[i],a)})}},"applyZuiPropsRecursively"),rB=d(t=>{let e=nB(t);return Or(e,t),e},"fromJSONSchemaLegacy"),iB=d(t=>{var e,n;return t.anyOf!==void 0&&t.anyOf.length===2&&t.anyOf.some(r=>typeof r!="boolean"&&Gg(r))&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)===M.ZodFirstPartyTypeKind.ZodOptional},"isOptionalSchema"),oB=d(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)===M.ZodFirstPartyTypeKind.ZodNullable},"isNullableSchema"),Gg=d(t=>{var e,n;return t.not===!0&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)===M.ZodFirstPartyTypeKind.ZodUndefined},"isUndefinedSchema"),aB=d(t=>{var e,n;return!t.not&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)===M.ZodFirstPartyTypeKind.ZodUnknown},"isUnknownSchema"),sB=d(({type:t,minimum:e,exclusiveMinimum:n,maximum:r,exclusiveMaximum:o,multipleOf:a,format:i})=>{let s=M.number();return t==="integer"&&(s=s.int()),i==="finite"&&(s=s.finite()),n!==void 0?s=s.gt(n):e!==void 0&&(s=s.gte(e)),o!==void 0?s=s.lt(o):r!==void 0&&(s=s.lte(r)),a!==void 0&&(s=s.multipleOf(a)),s},"numberJSONSchemaToZuiNumber"),lB=d(({format:t,pattern:e,minLength:n,maxLength:r})=>{let o=M.string();if(n&&r&&n===r?o=o.length(n):(n&&(o=o.min(n)),r&&(o=o.max(r))),t==="cuid"||e===Ye.cuid)o=o.cuid();else if(t==="cuid2"||e===Ye.cuid2)o=o.cuid2();else if(t==="emoji"||e===Ye.emoji)o=o.emoji();else if(t==="ulid"||e===Ye.ulid)o=o.ulid();else if(t==="date-time"){let{precision:a,offset:i}=e?bx(e):{};o=o.datetime({precision:a,offset:i})}else t==="email"||e===Ye.email?o=o.email():t==="ipv4"||e===Ye.ipv4?o=o.ip():t==="ipv6"||e===Ye.ipv6?o=o.ip("v6"):t==="uri"?o=o.url():t==="uuid"||e===Ye.uuid?o=o.uuid():e&&(o=o.regex(new RegExp(e)));return o},"stringJSONSchemaToZuiString"),_r=d((t,e)=>{let n=[];e.enum!==void 0&&n.push(...e.enum),e.const!==void 0&&n.push(e.const);let r=n.filter(i=>typeof i===t),[o]=r;if(!o){if(t==="string"&&e.type==="string")return lB(e);if(t==="number"&&(e.type==="number"||e.type==="integer"))return sB(e);if(t==="boolean")return M.boolean();if(t==="null")return M.null();throw new ao(`Unknown primitive type: "${t}"`)}if(r.length===1)return M.literal(o);let a=r.map(i=>M.literal(i));return M.union(a)},"toZuiPrimitive"),uB=d((t,e)=>cB(t)?dB(t,e):fB(t)?pB(t,e):gB(t,e),"arrayJSONSchemaToZuiArray"),cB=d(t=>Array.isArray(t.items),"_isTuple"),fB=d(t=>t.items!==void 0&&t.uniqueItems,"_isSet"),dB=d(({items:t,additionalItems:e},n)=>{let r=t.map(n),o=M.tuple(r);return e!==void 0&&(o=o.rest(n(e))),o},"_handleTuple"),pB=d(({items:t,minItems:e,maxItems:n},r)=>{let o=M.set(r(t));return e&&(o=o.min(e)),n&&(o=o.max(n)),o},"_handleSet"),gB=d(({minItems:t,maxItems:e,items:n},r)=>{let o=M.array(r(n));return t&&t===e?o.length(t):(t&&(o=o.min(t)),e&&(o=o.max(e)),o)},"_handleArray"),Fn=M.any();function Vg(t){return rt(t)}d(Vg,"fromJSONSchema");function rt(t){var e;if(t===void 0)return Fn;if(t===!0)return M.any();if(t===!1)return M.never();if(t.default!==void 0)return rt(N(_({},t),{default:void 0})).default(t.default);if(t.readOnly)return rt(N(_({},t),{readOnly:void 0})).readonly();if(t.oneOf!==void 0)throw new nn({oneOf:t.oneOf});if(t.patternProperties!==void 0)throw new nn({patternProperties:t.patternProperties});if(t.propertyNames!==void 0)throw new nn({propertyNames:t.propertyNames});if(t.if!==void 0)throw new nn({if:t.if});if(t.then!==void 0)throw new nn({then:t.then});if(t.else!==void 0)throw new nn({else:t.else});if(t.$ref!==void 0)return M.ref(t.$ref);if(t.not!==void 0){if(Gg(t))return M.undefined();if(t.not===!0)return M.never();throw new nn({not:t.not})}if(Array.isArray(t.type)){if(t.type.length===0)return Fn;if(t.type.length===1)return rt(N(_({},t),{type:t.type[0]}));let n=t,{type:r}=n,o=Qc(n,["type"]),a=t.type.map(i=>rt(N(_({},o),{type:i})));return M.union(a)}if(t.type==="string")return t.enum&&t.enum.length>0?M.enum(t.enum):_r("string",t);if(t.type==="integer"){let n=_r("number",t);return n instanceof M.ZodNumber?n.int():n}if(t.type==="number")return _r("number",t);if(t.type==="boolean")return _r("boolean",t);if(t.type==="null")return _r("null",t);if(t.type==="array")return uB(t,rt);if(t.type==="object"){if(t.additionalProperties!==void 0&&t.properties!==void 0){let n=rt(t.additionalProperties);return rt(N(_({},t),{additionalProperties:void 0})).catchall(n)}if(t.properties!==void 0){let n={};for(let[r,o]of Object.entries(t.properties)){let a=rt(o),i=(e=t.required)!=null?e:[];n[r]=i.includes(r)?a:a.optional()}return M.object(n)}if(t.additionalProperties!==void 0){let n=rt(t.additionalProperties);return M.record(n)}return M.record(Fn)}if(t.anyOf!==void 0){if(t.anyOf.length===0)return Fn;if(t.anyOf.length===1)return rt(t.anyOf[0]);if(iB(t))return rt(t.anyOf[0]).optional();if(oB(t))return rt(t.anyOf[0]).nullable();let n=t.anyOf.map(rt);return M.union(n)}if(t.allOf!==void 0){if(t.allOf.length===0)return Fn;if(t.allOf.length===1)return rt(t.allOf[0]);let[n,...r]=t.allOf,o=rt(n),a=rt({allOf:r});return M.intersection(o,a)}return aB(t)?M.unknown():Fn}d(rt,"_fromJSONSchema");var yB=/^\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))?$/,wa=d((t,e,n=!0)=>{if(typeof t!="object")throw new ca("Input must be an object");let r=d(i=>{let s=i;return e?.nullable&&(s=s.nullable()),e?.optional&&(s=s.optional()),e?.passtrough&&typeof s.passthrough=="function"&&(s=s.passthrough()),s},"applyOptions"),o=Object.entries(t).reduce((i,[s,l])=>{if(l===null)i[s]=r(Y.null());else switch(typeof l){case"string":i[s]=yB.test(l)?r(Y.string().datetime()):r(Y.string());break;case"number":i[s]=r(Y.number());break;case"boolean":i[s]=r(Y.boolean());break;case"object":Array.isArray(l)?l.length===0?i[s]=r(Y.array(Y.unknown())):typeof l[0]=="object"?i[s]=r(Y.array(wa(l[0],e,!1))):["string","number","boolean"].includes(typeof l[0])&&(i[s]=r(Y.array(Y[typeof l[0]]()))):i[s]=r(wa(l,e,!1));break;default:throw new ca(`Unsupported type for key ${s}`)}return i},{}),a=Object.keys(o).length>0;return e?.passtrough||!n&&!a?Y.object(o).passthrough():Y.object(o)},"fromObject");function Jg(){return{}}d(Jg,"parseAnyDef");function Xg(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=Ie(t.type._def,N(_({},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}d(Xg,"parseArrayDef");function Yg(t,e){let n=_({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}d(Yg,"parseBigintDef");function Qg(t){return _({type:"boolean"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{})}d(Qg,"parseBooleanDef");function ey(t,e){return Ie(t.type._def,e)}d(ey,"parseBrandedDef");var mB=d((t,e)=>Ie(t.innerType._def,e),"parseCatchDef");function ty(t,e){return e.dateStrategy=="integer"?hB(t,e):_({type:"string",format:"date-time"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{})}d(ty,"parseDateDef");var hB=d((t,e)=>{let n=_({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 ny(t,e){return N(_({},Ie(t.innerType._def,e)),{default:t.defaultValue()})}d(ny,"parseDefaultDef");function ry(t,e){return e.effectStrategy==="input"?Ie(t.schema._def,e):{}}d(ry,"parseEffectsDef");function iy(t){return{type:"string",enum:t.values}}d(iy,"parseEnumDef");var vB=d(t=>"type"in t&&t.type==="string"?!1:"allOf"in t,"isJsonSchema7AllOfType");function oy(t,e){let n=[Ie(t.left._def,N(_({},e),{currentPath:[...e.currentPath,"allOf","0"]})),Ie(t.right._def,N(_({},e),{currentPath:[...e.currentPath,"allOf","1"]}))].filter(a=>!!a),r=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return n.forEach(a=>{if(vB(a))o.push(...a.allOf),a.unevaluatedProperties===void 0&&(r=void 0);else{let i=a;if("additionalProperties"in a&&a.additionalProperties===!1){let s=a,{additionalProperties:l}=s;i=Qc(s,["additionalProperties"])}else r=void 0;o.push(i)}}),o.length?_({allOf:o},r):void 0}d(oy,"parseIntersectionDef");function ay(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}}d(ay,"parseLiteralDef");function ts(t,e){var n,r,o,a,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,f)=>{var p;return N(_({},l),{[f]:(p=Ie(t.valueType._def,N(_({},e),{currentPath:[...e.currentPath,"properties",f]})))!=null?p:{}})},{}),additionalProperties:!1};let s={type:"object",additionalProperties:(r=Ie(t.valueType._def,N(_({},e),{currentPath:[...e.currentPath,"additionalProperties"]})))!=null?r:{}};if(e.target==="openApi3")return s;if(((o=t.keyType)==null?void 0:o._def.typeName)==="ZodString"&&((a=t.keyType._def.checks)!=null&&a.length)){let l=Object.entries(Ua(t.keyType._def,e)).reduce((f,[p,y])=>p==="type"?f:N(_({},f),{[p]:y}),{});return N(_({},s),{propertyNames:l})}else if(((i=t.keyType)==null?void 0:i._def.typeName)==="ZodEnum")return N(_({},s),{propertyNames:{enum:t.keyType._def.values}});return s}d(ts,"parseRecordDef");function sy(t,e){if(e.mapStrategy==="record")return ts(t,e);let n=Ie(t.keyType._def,N(_({},e),{currentPath:[...e.currentPath,"items","items","0"]}))||{},r=Ie(t.valueType._def,N(_({},e),{currentPath:[...e.currentPath,"items","items","1"]}))||{};return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}d(sy,"parseMapDef");function ly(t){let e=t.values,r=Object.keys(t.values).filter(a=>typeof e[e[a]]!="number").map(a=>e[a]),o=Array.from(new Set(r.map(a=>typeof a)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:r.filter(a=>typeof a=="string"||typeof a=="number")}}d(ly,"parseNativeEnumDef");function uy(){return{not:{}}}d(uy,"parseNeverDef");function cy(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}d(cy,"parseNullDef");var io={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function fy(t,e){if(e.target==="openApi3")return Vc(t,e);let n=t.options instanceof Map?Array.from(t.options.values()):t.options;if(n.every(r=>r._def.typeName in io&&(!r._def.checks||!r._def.checks.length))){let r=n.reduce((o,a)=>{let i=io[a._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,a)=>{let i=typeof a._def.value;switch(i){case"string":case"number":case"boolean":return[...o,i];case"bigint":return[...o,"integer"];case"object":if(a._def.value===null)return[...o,"null"];case"symbol":case"undefined":case"function":default:return o}},[]);if(r.length===n.length){let o=r.filter((a,i,s)=>s.indexOf(a)===i);return{type:o.length>1?o:o[0],enum:n.reduce((a,i)=>a.includes(i._def.value)?a:[...a,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(a=>!r.includes(a))],[])};return Vc(t,e)}d(fy,"parseUnionDef");var Vc=d((t,e)=>{let n=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((o,a)=>Ie(o._def,N(_({},e),{currentPath:[...e.currentPath,e.unionStrategy,`${a}`]}))).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"?_({anyOf:n},r):_({oneOf:n},r)},"asUnionOf");function dy(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 a={type:io[r._def.typeName],nullable:!0};return xa(r._def,e,a)}let o={type:[io[r._def.typeName],"null"]};return xa(r._def,e,o)}if(e.target==="openApi3"){let r=Ie(t.innerType._def,N(_({},e),{currentPath:[...e.currentPath]}));return r&&N(_({},r),{nullable:!0})}let n=Ie(t.innerType._def,N(_({},e),{currentPath:[...e.currentPath,"anyOf","0"]}));return n&&{anyOf:[n,{type:"null"}]}}d(dy,"parseNullableDef");function py(t,e){let n=_({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",Ha(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}d(py,"parseNumberDef");var TB=d((t,e)=>{var n;return t.unknownKeys instanceof he?(n=Ie(t.unknownKeys._def,N(_({},e),{currentPath:[...e.currentPath,"additionalProperties"]})))!=null?n:!0:t.unknownKeys==="passthrough"},"getAdditionalProperties");function gy(t,e){let n=N(_({type:"object"},Object.entries(t.shape()).reduce((r,[o,a])=>{if(a===void 0||a._def===void 0)return r;let i=Ie(a._def,N(_({},e),{currentPath:[...e.currentPath,"properties",o],propertyPath:[...e.currentPath,"properties",o]}));return i===void 0?r:{properties:N(_({},r.properties),{[o]:i}),required:a.isOptional()?r.required:[...r.required,o]}},{properties:{},required:[]})),{additionalProperties:TB(t,e)});return n.required.length||delete n.required,n}d(gy,"parseObjectDef");var _B=d((t,e)=>{var n;if(e.currentPath.toString()===((n=e.propertyPath)==null?void 0:n.toString()))return Ie(t.innerType._def,e);let r=Ie(t.innerType._def,N(_({},e),{currentPath:[...e.currentPath,"anyOf","1"]}));return r?{anyOf:[{not:{}},r]}:{}},"parseOptionalDef"),bB=d((t,e)=>{if(e.pipeStrategy==="input")return Ie(t.in._def,e);if(e.pipeStrategy==="output")return Ie(t.out._def,e);let n=Ie(t.in._def,N(_({},e),{currentPath:[...e.currentPath,"allOf","0"]})),r=Ie(t.out._def,N(_({},e),{currentPath:[...e.currentPath,"allOf",n?"1":"0"]}));return{allOf:[n,r].filter(o=>o!==void 0)}},"parsePipelineDef");function yy(t,e){return Ie(t.type._def,e)}d(yy,"parsePromiseDef");function my(t,e){let r={type:"array",uniqueItems:!0,items:Ie(t.valueType._def,N(_({},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}d(my,"parseSetDef");function hy(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((n,r)=>Ie(n._def,N(_({},e),{currentPath:[...e.currentPath,"items",`${r}`]}))).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:Ie(t.rest._def,N(_({},e),{currentPath:[...e.currentPath,"additionalItems"]}))}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((n,r)=>Ie(n._def,N(_({},e),{currentPath:[...e.currentPath,"items",`${r}`]}))).reduce((n,r)=>r===void 0?n:[...n,r],[])}}d(hy,"parseTupleDef");function vy(){return{not:{}}}d(vy,"parseUndefinedDef");function Ty(){return{}}d(Ty,"parseUnknownDef");var wB=d((t,e)=>Ie(t.innerType._def,e),"parseReadonlyDef");function _y(t){return{$ref:t.uri}}d(_y,"parseRefDef");function Ie(t,e,n=!1){let r=e.seen.get(t);if(r&&!n){let i=xB(r,e);if(i!==void 0)return i}let o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);let a=BB(t,t.typeName,e);return a&&xa(t,e,a),o.jsonSchema=a,a}d(Ie,"parseDef");var xB=d((t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:PB(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"),PB=d((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"),BB=d((t,e,n)=>{switch(e){case"ZodString":return Ua(t,n);case"ZodNumber":return py(t,n);case"ZodObject":return gy(t,n);case"ZodBigInt":return Yg(t,n);case"ZodBoolean":return Qg(t);case"ZodDate":return ty(t,n);case"ZodUndefined":return vy();case"ZodNull":return cy(n);case"ZodArray":return Xg(t,n);case"ZodUnion":case"ZodDiscriminatedUnion":return fy(t,n);case"ZodIntersection":return oy(t,n);case"ZodTuple":return hy(t,n);case"ZodRecord":return ts(t,n);case"ZodRef":return _y(t);case"ZodLiteral":return ay(t,n);case"ZodEnum":return iy(t);case"ZodNativeEnum":return ly(t);case"ZodNullable":return dy(t,n);case"ZodOptional":return _B(t,n);case"ZodMap":return sy(t,n);case"ZodSet":return my(t,n);case"ZodLazy":return Ie(t.getter()._def,n);case"ZodPromise":return yy(t,n);case"ZodNaN":case"ZodNever":return uy();case"ZodEffects":return ry(t,n);case"ZodAny":return Jg();case"ZodUnknown":return Ty();case"ZodDefault":return ny(t,n);case"ZodBranded":return ey(t,n);case"ZodReadonly":return wB(t,n);case"ZodCatch":return mB(t,n);case"ZodPipeline":return bB(t,n);case"ZodFunction":case"ZodVoid":case"ZodSymbol":return;default:return(r=>{})(e)}},"selectParser"),xa=d((t,e,n)=>(t.description&&(n.description=t.description,e.markdownDescription&&(n.markdownDescription=t.description)),Object.assign(n,{[le]:_(_({},t[le]),n[le])}),n),"addMeta"),Jc={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"},EB=d(t=>typeof t=="string"?N(_({},Jc),{name:t}):_(_({},Jc),t),"getDefaultOptions"),SB=d(t=>{let e=EB(t),n=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return N(_({},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=d((t,e)=>{var n;let r=SB(e),o=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[f,p])=>{var y;return N(_({},l),{[f]:(y=Ie(p._def,N(_({},r),{currentPath:[...r.basePath,r.definitionPath,f]}),!0))!=null?y:{}})},{}):void 0,a=typeof e=="string"?e:e?.name,i=(n=Ie(t._def,a===void 0?r:N(_({},r),{currentPath:[...r.basePath,r.definitionPath,a]}),!1))!=null?n:{},s=a===void 0?o?N(_({},i),{[r.definitionPath]:o}):i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,a].join("/"),[r.definitionPath]:N(_({},o),{[a]:i})};return r.target==="jsonSchema7"?s.$schema="http://json-schema.org/draft-07/schema#":r.target==="jsonSchema2019-09"&&(s.$schema="https://json-schema.org/draft/2019-09/schema#"),s},"zodToJsonSchema"),IB=d((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 zr=(t,e)=>{let n=t._def,r=e._def;if(n.typeName===Y.ZodFirstPartyTypeKind.ZodObject&&r.typeName===Y.ZodFirstPartyTypeKind.ZodObject){let o=n.shape(),a=r.shape();return Y.object({...o,...a})}if(n.typeName===Y.ZodFirstPartyTypeKind.ZodRecord&&r.typeName===Y.ZodFirstPartyTypeKind.ZodRecord)return Y.record(Y.intersection(n.valueType,r.valueType));throw new Error("Cannot merge object schemas with record schemas")},by=Y;var yt=Y.string().min(1),xy=Y.object({text:yt}),Py=Y.object({markdown:yt}),By=Y.object({imageUrl:yt}),Ey=Y.object({audioUrl:yt}),Sy=Y.object({videoUrl:yt}),ky=Y.object({fileUrl:yt,title:yt.optional()}),Iy=Y.object({latitude:Y.number(),longitude:Y.number(),address:Y.string().optional(),title:Y.string().optional()}),Ay=Y.object({title:yt,subtitle:yt.optional(),imageUrl:yt.optional(),actions:Y.array(Y.object({action:Y.enum(["postback","url","say"]),label:yt,value:yt}))}),wy=Y.object({text:yt,options:Y.array(Y.object({label:yt,value:yt}))}),AB=Y.object({items:Y.array(Ay)}),CB=Y.union([Y.object({type:Y.literal("text"),payload:xy}),Y.object({type:Y.literal("markdown"),payload:Py}),Y.object({type:Y.literal("image"),payload:By}),Y.object({type:Y.literal("audio"),payload:Ey}),Y.object({type:Y.literal("video"),payload:Sy}),Y.object({type:Y.literal("file"),payload:ky}),Y.object({type:Y.literal("location"),payload:Iy})]),OB=Y.object({items:Y.array(CB)}),RB={schema:Py},MB={text:{schema:xy},image:{schema:By},audio:{schema:Ey},video:{schema:Sy},file:{schema:ky},location:{schema:Iy},carousel:{schema:AB},card:{schema:Ay},dropdown:{schema:wy},choice:{schema:wy},bloc:{schema:OB}};C();R();O();var wo="x-bot-id",Oy="x-bot-user-id",Ry="x-integration-id",My="x-webhook-id",Ny="x-bp-configuration-type",xo="x-bp-configuration",Po="x-bp-operation",Dy="x-bp-type",QA={HIDDEN_IN_STUDIO:{bpActionHiddenInStudio:"true"},AWAIT_RETURN:{bpActionAwaitReturn:"true"}};C();R();O();import{isNode as Nk}from"browser-or-node";C();R();O();var ns=console;function Ct(t){if(!t.body)throw new Error("Missing body");return JSON.parse(t.body)}async function zo(t,e=8072,n=Zk){if(!Nk)throw new Error("This function can only be called in Node.js");let o=(Mh(),$v(Rh)).createServer(async(a,i)=>{try{let s=await Dk(a);if(s.path==="/health"){i.writeHead(200).end("ok");return}let l=await t(s);i.writeHead(l?.status??200,l?.headers??{}).end(l?.body??"{}")}catch(s){ns.error("Error while handling request",{error:s?.message??"Internal error occured"}),i.writeHead(500).end(JSON.stringify({error:s?.message??"Internal error occured"}))}});return o.listen(e,()=>n(e)),o}async function Dk(t){let e=await Uk(t),n={};for(let o=0;o<t.rawHeaders.length;o+=2){let a=t.rawHeaders[o].toLowerCase(),i=t.rawHeaders[o+1];n[a]=i}let r=new URL(t.url??"",t.headers.host?`http://${t.headers.host}`:"http://botpress.cloud");return{body:e,path:r.pathname,query:Hk(r.search,"?"),headers:n,method:t.method?.toUpperCase()??"GET"}}function Hk(t,e){return t.indexOf(e)===0?t.slice(e.length):t}async function Uk(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 Zk(t){ns.info(`Listening on port ${t}`)}import{isApiError as nU,RuntimeError as rU}from"@botpress/client";C();R();O();C();R();O();C();R();O();C();R();O();var Le={};Kn(Le,{mapKeys:()=>Kk,mapValues:()=>jk,mergeRecords:()=>Fk,pairs:()=>qo,stripUndefinedProps:()=>Lk,values:()=>$k});C();R();O();var qo=t=>Object.entries(t),$k=t=>Object.values(t),jk=(t,e)=>Object.fromEntries(qo(t).map(([n,r])=>[n,e(r,n)])),Kk=(t,e)=>Object.fromEntries(qo(t).map(([n,r])=>[e(n),r])),Lk=t=>Object.fromEntries(qo(t).filter(([,e])=>e!==void 0)),Fk=(t,e,n)=>{let r=[...Object.keys(t),...Object.keys(e)],o=[...new Set(r)],a={};for(let i of o){let s=t[i],l=e[i];s&&l?a[i]=n(s,l):s?a[i]=s:l&&(a[i]=l)}return a};var ye={};Kn(ye,{safePush:()=>Wk,unique:()=>zk});C();R();O();var Wk=(t,...e)=>t?[...t,...e]:[...e],zk=t=>Array.from(new Set(t));C();R();O();var Qt={};Kn(Qt,{setName:()=>qk});C();R();O();var qk=(t,e)=>(Object.defineProperty(t,"name",{value:e}),t);var Nh=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:{}},a=Le.mapValues(t.entities,i=>i.schema);for(let[i,s]of Object.entries(t.definition.actions??{})){let l=s.input.schema.dereference(a),f=s.output.schema.dereference(a),p=t.actions?.[i]?.name??i;r.actions[p]={...s,...t.actions?.[i]??{},input:{schema:l},output:{schema:f}},o.actions[i]={name:p}}for(let[i,s]of Object.entries(t.definition.events??{})){let l=s.schema.dereference(a),f=t.events?.[i]?.name??i;r.events[f]={...s,...t.events?.[i]??{},schema:l},o.events[i]={name:f}}for(let[i,s]of Object.entries(t.definition.channels??{})){let l={};for(let[p,y]of Object.entries(s.messages)){let g=y.schema.dereference(a);l[p]={...y,schema:g}}let f=t.channels?.[i]?.name??i;r.channels[f]={...s,...t.channels?.[i]??{},message:{...s.message??{},tags:{...s.message?.tags??{},...t.channels?.[i]?.message?.tags??{}}},conversation:{...s.conversation??{},tags:{...s.conversation?.tags??{},...t.channels?.[i]?.conversation?.tags??{}}},messages:l},o.channels[i]={name:f}}return{resolved:r,statement:o}};C();R();O();var Go=Symbol("schemaName"),Dh=t=>t?Le.mapValues(t,(n,r)=>({...n,[Go]:r})):{},Hh=t=>Go in t&&t[Go]!==void 0,Uh=t=>t[Go];C();R();O();var Qs=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;extend(e,n){let{entities:r,actions:o,events:a,channels:i}=this._callBuilder(e,n),s=this;s.interfaces??={};let l=Object.values(r).map(g=>g.name),f=l.length===0?e.name:`${e.name}<${l.join(",")}>`,{resolved:p,statement:y}=Nh({...e,entities:r,actions:Le.stripUndefinedProps(o),events:Le.stripUndefinedProps(a),channels:Le.stripUndefinedProps(i)});return s.actions=Le.mergeRecords(s.actions??{},p.actions,this._mergeActions),s.channels=Le.mergeRecords(s.channels??{},p.channels,this._mergeChannels),s.events=Le.mergeRecords(s.events??{},p.events,this._mergeEvents),s.interfaces[f]={id:e.id,...y},this}_callBuilder(e,n){let o={entities:Dh(this.entities)},a=n(o),i=Le.pairs(a.entities).find(([l,f])=>!Hh(f));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(a.entities,l=>({name:Uh(l),schema:l.schema})),actions:a.actions??{},events:a.events??{},channels:a.channels??{}}}_mergeActions=(e,n)=>({...e,...n,input:{schema:zr(e.input.schema,n.input.schema)},output:{schema:zr(e.output.schema,n.output.schema)}});_mergeEvents=(e,n)=>({...e,...n,schema:zr(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 a;return(e.message||n.message)&&(a={tags:{...e.message?.tags,...n.message?.tags}}),{...e,...n,messages:r,conversation:o,message:a}};_mergeMessage=(e,n)=>({schema:zr(e.schema,n.schema)})};C();R();O();C();R();O();import{isApiError as xI,Client as PI,RuntimeError as wv,InvalidPayloadError as BI}from"@botpress/client";C();R();O();import*as Zh from"@botpress/client";var Vo={retries:3,retryCondition:t=>Zh.axiosRetry.isNetworkOrIdempotentRequestError(t)||[429,502].includes(t.response?.status??0),retryDelay:(t,e)=>(Gk(e.response?.headers??{})??t)*1e3},Gk=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 Vk(String(r))}},Vk=t=>{let e=Jk(t)?Xk(t):t.length>0?parseInt(t,10):void 0;return e===void 0||isNaN(e)?void 0:e},Jk=t=>t.includes(" "),Xk=t=>{let e=Yk(t);if(!e)return;let n=new Date;return Math.max(0,Math.floor((e.getTime()-n.getTime())/1e3))},Yk=t=>{let e=new Date(t);return isNaN(e.getTime())?void 0:e};C();R();O();C();R();O();var ti=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)};C();R();O();var Jo=class{_cost=0;get cost(){return this._cost}setCost(e){this._cost=e}toJSON(){return{cost:this.cost}}};C();R();O();C();R();O();var fn="#";var SR=Y.enum(["webhook_received","message_created","action_triggered","register","unregister","ping","create_user","create_conversation"]),$h=t=>{let e=t[wo],n=t[Oy],r=t[Ry],o=t[My],a=t[Ny],i=t[xo],s=t[Po];if(!e)throw new Error("Missing bot headers");if(!n)throw new Error("Missing bot user headers");if(!r)throw new Error("Missing integration headers");if(!o)throw new Error("Missing webhook headers");if(!i)throw new Error("Missing configuration headers");if(!s)throw new Error("Missing operation headers");return{botId:e,botUserId:n,integrationId:r,webhookId:o,operation:s,configurationType:a??null,configuration:i?JSON.parse(q.from(i,"base64").toString("utf-8")):{}}};C();R();O();C();R();O();C();R();O();C();R();O();var tl={},jh=!1;function bl(){return jh||(jh=!0,tl=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 a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[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}),tl}var nl={},Kh=!1;function Qk(){return Kh||(Kh=!0,nl=Error),nl}var rl={},Lh=!1;function eI(){return Lh||(Lh=!0,rl=EvalError),rl}var il={},Fh=!1;function tI(){return Fh||(Fh=!0,il=RangeError),il}var ol={},Wh=!1;function nI(){return Wh||(Wh=!0,ol=ReferenceError),ol}var al={},zh=!1;function lv(){return zh||(zh=!0,al=SyntaxError),al}var sl={},qh=!1;function Xo(){return qh||(qh=!0,sl=TypeError),sl}var ll={},Gh=!1;function rI(){return Gh||(Gh=!0,ll=URIError),ll}var ul={},Vh=!1;function iI(){if(Vh)return ul;Vh=!0;var t=typeof Symbol<"u"&&Symbol,e=bl();return ul=function(){return typeof t!="function"||typeof Symbol!="function"||typeof t("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},ul}var cl={},Jh=!1;function oI(){if(Jh)return cl;Jh=!0;var t={__proto__:null,foo:{}},e=Object;return cl=function(){return{__proto__:t}.foo===t.foo&&!(t instanceof e)},cl}var fl={},Xh=!1;function aI(){if(Xh)return fl;Xh=!0;var t="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,n=Math.max,r="[object Function]",o=function(l,f){for(var p=[],y=0;y<l.length;y+=1)p[y]=l[y];for(var g=0;g<f.length;g+=1)p[g+l.length]=f[g];return p},a=function(l,f){for(var p=[],y=f,g=0;y<l.length;y+=1,g+=1)p[g]=l[y];return p},i=function(s,l){for(var f="",p=0;p<s.length;p+=1)f+=s[p],p+1<s.length&&(f+=l);return f};return fl=function(l){var f=this;if(typeof f!="function"||e.apply(f)!==r)throw new TypeError(t+f);for(var p=a(arguments,1),y,g=function(){if(this instanceof y){var v=f.apply(this,o(p,arguments));return Object(v)===v?v:this}return f.apply(l,o(p,arguments))},h=n(0,f.length-p.length),w=[],P=0;P<h;P++)w[P]="$"+P;if(y=Function("binder","return function ("+i(w,",")+"){ return binder.apply(this,arguments); }")(g),f.prototype){var B=function(){};B.prototype=f.prototype,y.prototype=new B,B.prototype=null}return y},fl}var dl={},Yh=!1;function wl(){if(Yh)return dl;Yh=!0;var t=aI();return dl=Function.prototype.bind||t,dl}var pl={},Qh=!1;function sI(){if(Qh)return pl;Qh=!0;var t=Function.prototype.call,e=Object.prototype.hasOwnProperty,n=wl();return pl=n.call(t,e),pl}var gl={},ev=!1;function ri(){if(ev)return gl;ev=!0;var t,e=Qk(),n=eI(),r=tI(),o=nI(),a=lv(),i=Xo(),s=rI(),l=Function,f=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=iI()(),w=oI()(),P=Object.getPrototypeOf||(w?function(Ue){return Ue.__proto__}:null),B={},v=typeof Uint8Array>"u"||!P?t:P(Uint8Array),S={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?t:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?t:ArrayBuffer,"%ArrayIteratorPrototype%":h&&P?P([][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&&P?P(P([][Symbol.iterator]())):t,"%JSON%":typeof JSON=="object"?JSON:t,"%Map%":typeof Map>"u"?t:Map,"%MapIteratorPrototype%":typeof Map>"u"||!h||!P?t:P(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||!P?t:P(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?t:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":h&&P?P(""[Symbol.iterator]()):t,"%Symbol%":h?Symbol:t,"%SyntaxError%":a,"%ThrowTypeError%":g,"%TypedArray%":v,"%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%":s,"%WeakMap%":typeof WeakMap>"u"?t:WeakMap,"%WeakRef%":typeof WeakRef>"u"?t:WeakRef,"%WeakSet%":typeof WeakSet>"u"?t:WeakSet};if(P)try{null.error}catch(Ue){var E=P(P(Ue));S["%Error.prototype%"]=E}var H=function Ue(Pe){var Se;if(Pe==="%AsyncFunction%")Se=f("async function () {}");else if(Pe==="%GeneratorFunction%")Se=f("function* () {}");else if(Pe==="%AsyncGeneratorFunction%")Se=f("async function* () {}");else if(Pe==="%AsyncGenerator%"){var fe=Ue("%AsyncGeneratorFunction%");fe&&(Se=fe.prototype)}else if(Pe==="%AsyncIteratorPrototype%"){var ve=Ue("%AsyncGenerator%");ve&&P&&(Se=P(ve.prototype))}return S[Pe]=Se,Se},K={__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"]},oe=wl(),ee=sI(),ge=oe.call(Function.call,Array.prototype.concat),ae=oe.call(Function.apply,Array.prototype.splice),re=oe.call(Function.call,String.prototype.replace),Oe=oe.call(Function.call,String.prototype.slice),ze=oe.call(Function.call,RegExp.prototype.exec),tt=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Ve=/\\(\\)?/g,Je=function(Pe){var Se=Oe(Pe,0,1),fe=Oe(Pe,-1);if(Se==="%"&&fe!=="%")throw new a("invalid intrinsic syntax, expected closing `%`");if(fe==="%"&&Se!=="%")throw new a("invalid intrinsic syntax, expected opening `%`");var ve=[];return re(Pe,tt,function(D,j,F,de){ve[ve.length]=F?re(de,Ve,"$1"):j||D}),ve},mt=function(Pe,Se){var fe=Pe,ve;if(ee(K,fe)&&(ve=K[fe],fe="%"+ve[0]+"%"),ee(S,fe)){var D=S[fe];if(D===B&&(D=H(fe)),typeof D>"u"&&!Se)throw new i("intrinsic "+Pe+" exists, but is not available. Please file an issue!");return{alias:ve,name:fe,value:D}}throw new a("intrinsic "+Pe+" does not exist!")};return gl=function(Pe,Se){if(typeof Pe!="string"||Pe.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(/^%?[^%]*%?$/,Pe)===null)throw new a("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var fe=Je(Pe),ve=fe.length>0?fe[0]:"",D=mt("%"+ve+"%",Se),j=D.name,F=D.value,de=!1,Te=D.alias;Te&&(ve=Te[0],ae(fe,ge([0,1],Te)));for(var A=1,k=!0;A<fe.length;A+=1){var $=fe[A],X=Oe($,0,1),ie=Oe($,-1);if((X==='"'||X==="'"||X==="`"||ie==='"'||ie==="'"||ie==="`")&&X!==ie)throw new a("property names with quotes must have matching quotes");if(($==="constructor"||!k)&&(de=!0),ve+="."+$,j="%"+ve+"%",ee(S,j))F=S[j];else if(F!=null){if(!($ in F)){if(!Se)throw new i("base intrinsic for "+Pe+" exists, but the property is not available.");return}if(p&&A+1>=fe.length){var b=p(F,$);k=!!b,k&&"get"in b&&!("originalValue"in b.get)?F=b.get:F=F[$]}else k=ee(F,$),F=F[$];k&&!de&&(S[j]=F)}}return F},gl}var yl={},tv=!1;function xl(){if(tv)return yl;tv=!0;var t=ri(),e=t("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return yl=e,yl}var ml={},nv=!1;function Yo(){if(nv)return ml;nv=!0;var t=ri(),e=t("%Object.getOwnPropertyDescriptor%",!0);if(e)try{e([],"length")}catch{e=null}return ml=e,ml}var hl={},rv=!1;function lI(){if(rv)return hl;rv=!0;var t=xl(),e=lv(),n=Xo(),r=Yo();return hl=function(a,i,s){if(!a||typeof a!="object"&&typeof a!="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,f=arguments.length>4?arguments[4]:null,p=arguments.length>5?arguments[5]:null,y=arguments.length>6?arguments[6]:!1,g=!!r&&r(a,i);if(t)t(a,i,{configurable:p===null&&g?g.configurable:!p,enumerable:l===null&&g?g.enumerable:!l,value:s,writable:f===null&&g?g.writable:!f});else if(y||!l&&!f&&!p)a[i]=s;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},hl}var vl={},iv=!1;function uI(){if(iv)return vl;iv=!0;var t=xl(),e=function(){return!!t};return e.hasArrayLengthDefineBug=function(){if(!t)return null;try{return t([],"length",{value:1}).length!==1}catch{return!0}},vl=e,vl}var Tl={},ov=!1;function cI(){if(ov)return Tl;ov=!0;var t=ri(),e=lI(),n=uI()(),r=Yo(),o=Xo(),a=t("%Math.floor%");return Tl=function(s,l){if(typeof s!="function")throw new o("`fn` is not a function");if(typeof l!="number"||l<0||l>4294967295||a(l)!==l)throw new o("`length` must be a positive 32-bit integer");var f=arguments.length>2&&!!arguments[2],p=!0,y=!0;if("length"in s&&r){var g=r(s,"length");g&&!g.configurable&&(p=!1),g&&!g.writable&&(y=!1)}return(p||y||!f)&&(n?e(s,"length",l,!0,!0):e(s,"length",l)),s},Tl}var ni={},av=!1;function Pl(){if(av)return ni;av=!0;var t=wl(),e=ri(),n=cI(),r=Xo(),o=e("%Function.prototype.apply%"),a=e("%Function.prototype.call%"),i=e("%Reflect.apply%",!0)||t.call(a,o),s=xl(),l=e("%Math.max%");ni=function(y){if(typeof y!="function")throw new r("a function is required");var g=i(t,a,arguments);return n(g,1+l(0,y.length-(arguments.length-1)),!0)};var f=function(){return i(t,o,arguments)};return s?s(ni,"apply",{value:f}):ni.apply=f,ni}var _l={},sv=!1;function Bl(){if(sv)return _l;sv=!0;var t=ri(),e=Pl(),n=e(t("String.prototype.indexOf"));return _l=function(o,a){var i=t(o,!!a);return typeof i=="function"&&n(o,".prototype.")>-1?e(i):i},_l}rs();_s();var El={},uv=!1;function Dl(){if(uv)return El;uv=!0;var t=bl();return El=function(){return t()&&!!Symbol.toStringTag},El}var Sl={},cv=!1;function fI(){if(cv)return Sl;cv=!0;var t=Dl()(),e=Bl(),n=e("Object.prototype.toString"),r=function(s){return t&&s&&typeof s=="object"&&Symbol.toStringTag in s?!1:n(s)==="[object Arguments]"},o=function(s){return r(s)?!0:s!==null&&typeof s=="object"&&typeof s.length=="number"&&s.length>=0&&n(s)!=="[object Array]"&&n(s.callee)==="[object Function]"},a=(function(){return r(arguments)})();return r.isLegacyArguments=o,Sl=a?r:o,Sl}var kl={},fv=!1;function dI(){if(fv)return kl;fv=!0;var t=Object.prototype.toString,e=Function.prototype.toString,n=/^\s*(?:function)?\*/,r=Dl()(),o=Object.getPrototypeOf,a=function(){if(!r)return!1;try{return Function("return function*() {}")()}catch{}},i;return kl=function(l){if(typeof l!="function")return!1;if(n.test(e.call(l)))return!0;if(!r){var f=t.call(l);return f==="[object GeneratorFunction]"}if(!o)return!1;if(typeof i>"u"){var p=a();i=p?o(p):!1}return o(l)===i},kl}var Il={},dv=!1;function pI(){if(dv)return Il;dv=!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/,a=function(E){try{var H=t.call(E);return o.test(H)}catch{return!1}},i=function(E){try{return a(E)?!1:(t.call(E),!0)}catch{return!1}},s=Object.prototype.toString,l="[object Object]",f="[object Function]",p="[object GeneratorFunction]",y="[object HTMLAllCollection]",g="[object HTML document.all class]",h="[object HTMLCollection]",w=typeof Symbol=="function"&&!!Symbol.toStringTag,P=!(0 in[,]),B=function(){return!1};if(typeof document=="object"){var v=document.all;s.call(v)===s.call(document.all)&&(B=function(E){if((P||!E)&&(typeof E>"u"||typeof E=="object"))try{var H=s.call(E);return(H===y||H===g||H===h||H===l)&&E("")==null}catch{}return!1})}return Il=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!a(E)&&i(E)}:function(E){if(B(E))return!0;if(!E||typeof E!="function"&&typeof E!="object")return!1;if(w)return i(E);if(a(E))return!1;var H=s.call(E);return H!==f&&H!==p&&!/^\[object HTML/.test(H)?!1:i(E)},Il}var Al={},pv=!1;function gI(){if(pv)return Al;pv=!0;var t=pI(),e=Object.prototype.toString,n=Object.prototype.hasOwnProperty,r=function(l,f,p){for(var y=0,g=l.length;y<g;y++)n.call(l,y)&&(p==null?f(l[y],y,l):f.call(p,l[y],y,l))},o=function(l,f,p){for(var y=0,g=l.length;y<g;y++)p==null?f(l.charAt(y),y,l):f.call(p,l.charAt(y),y,l)},a=function(l,f,p){for(var y in l)n.call(l,y)&&(p==null?f(l[y],y,l):f.call(p,l[y],y,l))},i=function(l,f,p){if(!t(f))throw new TypeError("iterator must be a function");var y;arguments.length>=3&&(y=p),e.call(l)==="[object Array]"?r(l,f,y):typeof l=="string"?o(l,f,y):a(l,f,y)};return Al=i,Al}var Cl={},gv=!1;function yI(){return gv||(gv=!0,Cl=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),Cl}var Ol={},yv=!1,mI=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function hI(){if(yv)return Ol;yv=!0;var t=yI(),e=typeof globalThis>"u"?mI:globalThis;return Ol=function(){for(var r=[],o=0;o<t.length;o++)typeof e[t[o]]=="function"&&(r[r.length]=t[o]);return r},Ol}var Rl={},mv=!1,vI=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function bv(){if(mv)return Rl;mv=!0;var t=gI(),e=hI(),n=Pl(),r=Bl(),o=Yo(),a=r("Object.prototype.toString"),i=Dl()(),s=typeof globalThis>"u"?vI:globalThis,l=e(),f=r("String.prototype.slice"),p=Object.getPrototypeOf,y=r("Array.prototype.indexOf",!0)||function(B,v){for(var S=0;S<B.length;S+=1)if(B[S]===v)return S;return-1},g={__proto__:null};i&&o&&p?t(l,function(P){var B=new s[P];if(Symbol.toStringTag in B){var v=p(B),S=o(v,Symbol.toStringTag);if(!S){var E=p(v);S=o(E,Symbol.toStringTag)}g["$"+P]=n(S.get)}}):t(l,function(P){var B=new s[P],v=B.slice||B.set;v&&(g["$"+P]=n(v))});var h=function(B){var v=!1;return t(g,function(S,E){if(!v)try{"$"+S(B)===E&&(v=f(E,1))}catch{}}),v},w=function(B){var v=!1;return t(g,function(S,E){if(!v)try{S(B),v=f(E,1)}catch{}}),v};return Rl=function(B){if(!B||typeof B!="object")return!1;if(!i){var v=f(a(B),8,-1);return y(l,v)>-1?v:v!=="Object"?!1:w(B)}return o?h(B):null},Rl}var Ml={},hv=!1;function TI(){if(hv)return Ml;hv=!0;var t=bv();return Ml=function(n){return!!t(n)},Ml}var we={},vv=!1;function _I(){if(vv)return we;vv=!0;var t=fI(),e=dI(),n=bv(),r=TI();function o(Z){return Z.call.bind(Z)}var a=typeof BigInt<"u",i=typeof Symbol<"u",s=o(Object.prototype.toString),l=o(Number.prototype.valueOf),f=o(String.prototype.valueOf),p=o(Boolean.prototype.valueOf);if(a)var y=o(BigInt.prototype.valueOf);if(i)var g=o(Symbol.prototype.valueOf);function h(Z,kt){if(typeof Z!="object")return!1;try{return kt(Z),!0}catch{return!1}}we.isArgumentsObject=t,we.isGeneratorFunction=e,we.isTypedArray=r;function w(Z){return typeof Promise<"u"&&Z instanceof Promise||Z!==null&&typeof Z=="object"&&typeof Z.then=="function"&&typeof Z.catch=="function"}we.isPromise=w;function P(Z){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(Z):r(Z)||D(Z)}we.isArrayBufferView=P;function B(Z){return n(Z)==="Uint8Array"}we.isUint8Array=B;function v(Z){return n(Z)==="Uint8ClampedArray"}we.isUint8ClampedArray=v;function S(Z){return n(Z)==="Uint16Array"}we.isUint16Array=S;function E(Z){return n(Z)==="Uint32Array"}we.isUint32Array=E;function H(Z){return n(Z)==="Int8Array"}we.isInt8Array=H;function K(Z){return n(Z)==="Int16Array"}we.isInt16Array=K;function oe(Z){return n(Z)==="Int32Array"}we.isInt32Array=oe;function ee(Z){return n(Z)==="Float32Array"}we.isFloat32Array=ee;function ge(Z){return n(Z)==="Float64Array"}we.isFloat64Array=ge;function ae(Z){return n(Z)==="BigInt64Array"}we.isBigInt64Array=ae;function re(Z){return n(Z)==="BigUint64Array"}we.isBigUint64Array=re;function Oe(Z){return s(Z)==="[object Map]"}Oe.working=typeof Map<"u"&&Oe(new Map);function ze(Z){return typeof Map>"u"?!1:Oe.working?Oe(Z):Z instanceof Map}we.isMap=ze;function tt(Z){return s(Z)==="[object Set]"}tt.working=typeof Set<"u"&&tt(new Set);function Ve(Z){return typeof Set>"u"?!1:tt.working?tt(Z):Z instanceof Set}we.isSet=Ve;function Je(Z){return s(Z)==="[object WeakMap]"}Je.working=typeof WeakMap<"u"&&Je(new WeakMap);function mt(Z){return typeof WeakMap>"u"?!1:Je.working?Je(Z):Z instanceof WeakMap}we.isWeakMap=mt;function Ue(Z){return s(Z)==="[object WeakSet]"}Ue.working=typeof WeakSet<"u"&&Ue(new WeakSet);function Pe(Z){return Ue(Z)}we.isWeakSet=Pe;function Se(Z){return s(Z)==="[object ArrayBuffer]"}Se.working=typeof ArrayBuffer<"u"&&Se(new ArrayBuffer);function fe(Z){return typeof ArrayBuffer>"u"?!1:Se.working?Se(Z):Z instanceof ArrayBuffer}we.isArrayBuffer=fe;function ve(Z){return s(Z)==="[object DataView]"}ve.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&ve(new DataView(new ArrayBuffer(1),0,1));function D(Z){return typeof DataView>"u"?!1:ve.working?ve(Z):Z instanceof DataView}we.isDataView=D;var j=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function F(Z){return s(Z)==="[object SharedArrayBuffer]"}function de(Z){return typeof j>"u"?!1:(typeof F.working>"u"&&(F.working=F(new j)),F.working?F(Z):Z instanceof j)}we.isSharedArrayBuffer=de;function Te(Z){return s(Z)==="[object AsyncFunction]"}we.isAsyncFunction=Te;function A(Z){return s(Z)==="[object Map Iterator]"}we.isMapIterator=A;function k(Z){return s(Z)==="[object Set Iterator]"}we.isSetIterator=k;function $(Z){return s(Z)==="[object Generator]"}we.isGeneratorObject=$;function X(Z){return s(Z)==="[object WebAssembly.Module]"}we.isWebAssemblyCompiledModule=X;function ie(Z){return h(Z,l)}we.isNumberObject=ie;function b(Z){return h(Z,f)}we.isStringObject=b;function x(Z){return h(Z,p)}we.isBooleanObject=x;function z(Z){return a&&h(Z,y)}we.isBigIntObject=z;function Q(Z){return i&&h(Z,g)}we.isSymbolObject=Q;function Me(Z){return ie(Z)||b(Z)||x(Z)||z(Z)||Q(Z)}we.isBoxedPrimitive=Me;function _e(Z){return typeof Uint8Array<"u"&&(fe(Z)||de(Z))}return we.isAnyArrayBuffer=_e,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(Z){Object.defineProperty(we,Z,{enumerable:!1,value:function(){throw new Error(Z+" is not supported in userland")}})}),we}var Nl={},Tv=!1;function bI(){return Tv||(Tv=!0,Nl=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"}),Nl}var xe={},_v=!1,ii=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function wI(){if(_v)return xe;_v=!0;var t=At,e=Object.getOwnPropertyDescriptors||function(j){for(var F=Object.keys(j),de={},Te=0;Te<F.length;Te++)de[F[Te]]=Object.getOwnPropertyDescriptor(j,F[Te]);return de},n=/%[sdj%]/g;xe.format=function(D){if(!K(D)){for(var j=[],F=0;F<arguments.length;F++)j.push(i(arguments[F]));return j.join(" ")}for(var F=1,de=arguments,Te=de.length,A=String(D).replace(n,function($){if($==="%%")return"%";if(F>=Te)return $;switch($){case"%s":return String(de[F++]);case"%d":return Number(de[F++]);case"%j":try{return JSON.stringify(de[F++])}catch{return"[Circular]"}default:return $}}),k=de[F];F<Te;k=de[++F])S(k)||!ae(k)?A+=" "+k:A+=" "+i(k);return A},xe.deprecate=function(D,j){if(typeof t<"u"&&t.noDeprecation===!0)return D;if(typeof t>"u")return function(){return xe.deprecate(D,j).apply(this||ii,arguments)};var F=!1;function de(){if(!F){if(t.throwDeprecation)throw new Error(j);t.traceDeprecation?console.trace(j):console.error(j),F=!0}return D.apply(this||ii,arguments)}return de};var r={},o=/^$/;if(t.env.NODE_DEBUG){var a=t.env.NODE_DEBUG;a=a.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),o=new RegExp("^"+a+"$","i")}xe.debuglog=function(D){if(D=D.toUpperCase(),!r[D])if(o.test(D)){var j=t.pid;r[D]=function(){var F=xe.format.apply(xe,arguments);console.error("%s %d: %s",D,j,F)}}else r[D]=function(){};return r[D]};function i(D,j){var F={seen:[],stylize:l};return arguments.length>=3&&(F.depth=arguments[2]),arguments.length>=4&&(F.colors=arguments[3]),v(j)?F.showHidden=j:j&&xe._extend(F,j),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=s),p(F,D,F.depth)}xe.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 s(D,j){var F=i.styles[j];return F?"\x1B["+i.colors[F][0]+"m"+D+"\x1B["+i.colors[F][1]+"m":D}function l(D,j){return D}function f(D){var j={};return D.forEach(function(F,de){j[F]=!0}),j}function p(D,j,F){if(D.customInspect&&j&&ze(j.inspect)&&j.inspect!==xe.inspect&&!(j.constructor&&j.constructor.prototype===j)){var de=j.inspect(F,D);return K(de)||(de=p(D,de,F)),de}var Te=y(D,j);if(Te)return Te;var A=Object.keys(j),k=f(A);if(D.showHidden&&(A=Object.getOwnPropertyNames(j)),Oe(j)&&(A.indexOf("message")>=0||A.indexOf("description")>=0))return g(j);if(A.length===0){if(ze(j)){var $=j.name?": "+j.name:"";return D.stylize("[Function"+$+"]","special")}if(ge(j))return D.stylize(RegExp.prototype.toString.call(j),"regexp");if(re(j))return D.stylize(Date.prototype.toString.call(j),"date");if(Oe(j))return g(j)}var X="",ie=!1,b=["{","}"];if(B(j)&&(ie=!0,b=["[","]"]),ze(j)){var x=j.name?": "+j.name:"";X=" [Function"+x+"]"}if(ge(j)&&(X=" "+RegExp.prototype.toString.call(j)),re(j)&&(X=" "+Date.prototype.toUTCString.call(j)),Oe(j)&&(X=" "+g(j)),A.length===0&&(!ie||j.length==0))return b[0]+X+b[1];if(F<0)return ge(j)?D.stylize(RegExp.prototype.toString.call(j),"regexp"):D.stylize("[Object]","special");D.seen.push(j);var z;return ie?z=h(D,j,F,k,A):z=A.map(function(Q){return w(D,j,F,k,Q,ie)}),D.seen.pop(),P(z,X,b)}function y(D,j){if(ee(j))return D.stylize("undefined","undefined");if(K(j)){var F="'"+JSON.stringify(j).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return D.stylize(F,"string")}if(H(j))return D.stylize(""+j,"number");if(v(j))return D.stylize(""+j,"boolean");if(S(j))return D.stylize("null","null")}function g(D){return"["+Error.prototype.toString.call(D)+"]"}function h(D,j,F,de,Te){for(var A=[],k=0,$=j.length;k<$;++k)Pe(j,String(k))?A.push(w(D,j,F,de,String(k),!0)):A.push("");return Te.forEach(function(X){X.match(/^\d+$/)||A.push(w(D,j,F,de,X,!0))}),A}function w(D,j,F,de,Te,A){var k,$,X;if(X=Object.getOwnPropertyDescriptor(j,Te)||{value:j[Te]},X.get?X.set?$=D.stylize("[Getter/Setter]","special"):$=D.stylize("[Getter]","special"):X.set&&($=D.stylize("[Setter]","special")),Pe(de,Te)||(k="["+Te+"]"),$||(D.seen.indexOf(X.value)<0?(S(F)?$=p(D,X.value,null):$=p(D,X.value,F-1),$.indexOf(`
80
80
  `)>-1&&(A?$=$.split(`
81
81
  `).map(function(ie){return" "+ie}).join(`
82
82
  `).slice(2):$=`
@@ -85,7 +85,7 @@ ${v}`.trim();case M.ZodFirstPartyTypeKind.ZodEnum:return s.values.map(se).join("
85
85
  `))):$=D.stylize("[Circular]","special")),ee(k)){if(A&&Te.match(/^\d+$/))return $;k=JSON.stringify(""+Te),k.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(k=k.slice(1,-1),k=D.stylize(k,"name")):(k=k.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),k=D.stylize(k,"string"))}return k+": "+$}function P(D,j,F){var de=D.reduce(function(Te,A){return A.indexOf(`
86
86
  `)>=0,Te+A.replace(/\u001b\[\d\d?m/g,"").length+1},0);return de>60?F[0]+(j===""?"":j+`
87
87
  `)+" "+D.join(`,
88
- `)+" "+F[1]:F[0]+j+" "+D.join(", ")+" "+F[1]}xe.types=_I();function B(D){return Array.isArray(D)}xe.isArray=B;function v(D){return typeof D=="boolean"}xe.isBoolean=v;function S(D){return D===null}xe.isNull=S;function E(D){return D==null}xe.isNullOrUndefined=E;function H(D){return typeof D=="number"}xe.isNumber=H;function K(D){return typeof D=="string"}xe.isString=K;function ae(D){return typeof D=="symbol"}xe.isSymbol=ae;function ee(D){return D===void 0}xe.isUndefined=ee;function ge(D){return oe(D)&&Ve(D)==="[object RegExp]"}xe.isRegExp=ge,xe.types.isRegExp=ge;function oe(D){return typeof D=="object"&&D!==null}xe.isObject=oe;function re(D){return oe(D)&&Ve(D)==="[object Date]"}xe.isDate=re,xe.types.isDate=re;function Oe(D){return oe(D)&&(Ve(D)==="[object Error]"||D instanceof Error)}xe.isError=Oe,xe.types.isNativeError=Oe;function ze(D){return typeof D=="function"}xe.isFunction=ze;function tt(D){return D===null||typeof D=="boolean"||typeof D=="number"||typeof D=="string"||typeof D=="symbol"||typeof D>"u"}xe.isPrimitive=tt,xe.isBuffer=bI();function Ve(D){return Object.prototype.toString.call(D)}function Je(D){return D<10?"0"+D.toString(10):D.toString(10)}var mt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ue(){var D=new Date,j=[Je(D.getHours()),Je(D.getMinutes()),Je(D.getSeconds())].join(":");return[D.getDate(),mt[D.getMonth()],j].join(" ")}xe.log=function(){console.log("%s - %s",Ue(),xe.format.apply(xe,arguments))},xe.inherits=Mt(),xe._extend=function(D,j){if(!j||!oe(j))return D;for(var F=Object.keys(j),de=F.length;de--;)D[F[de]]=j[F[de]];return D};function Pe(D,j){return Object.prototype.hasOwnProperty.call(D,j)}var Se=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;xe.promisify=function(j){if(typeof j!="function")throw new TypeError('The "original" argument must be of type Function');if(Se&&j[Se]){if(F=j[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 de,Te,A=new Promise(function(X,ie){de=X,Te=ie}),k=[],$=0;$<arguments.length;$++)k.push(arguments[$]);k.push(function(X,ie){X?Te(X):de(ie)});try{j.apply(this||si,k)}catch(X){Te(X)}return A}return Object.setPrototypeOf(F,Object.getPrototypeOf(j)),Se&&Object.defineProperty(F,Se,{value:F,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(F,e(j))},xe.promisify.custom=Se;function fe(D,j){if(!D){var F=new Error("Promise was rejected with a falsy value");F.reason=D,D=F}return j(D)}function ve(D){if(typeof D!="function")throw new TypeError('The "original" argument must be of type Function');function j(){for(var F=[],de=0;de<arguments.length;de++)F.push(arguments[de]);var Te=F.pop();if(typeof Te!="function")throw new TypeError("The last argument must be of type Function");var A=this||si,k=function(){return Te.apply(A,arguments)};D.apply(this||si,F).then(function($){t.nextTick(k.bind(null,null,$))},function($){t.nextTick(fe.bind(null,$,k))})}return Object.setPrototypeOf(j,Object.getPrototypeOf(D)),Object.defineProperties(j,e(D)),j}return xe.callbackify=ve,xe}var ce=wI();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 ZR=ce._extend,$R=ce.callbackify,jR=ce.debuglog,KR=ce.deprecate,LR=ce.format,FR=ce.inherits,WR=ce.inspect,zR=ce.isArray,qR=ce.isBoolean,GR=ce.isBuffer,VR=ce.isDate,JR=ce.isError,XR=ce.isFunction,YR=ce.isNull,QR=ce.isNullOrUndefined,e0=ce.isNumber,t0=ce.isObject,n0=ce.isPrimitive,r0=ce.isRegExp,i0=ce.isString,a0=ce.isSymbol,o0=ce.isUndefined,s0=ce.log,l0=ce.promisify,u0=ce.types,c0=ce.TextEncoder=globalThis.TextEncoder,f0=ce.TextDecoder=globalThis.TextDecoder;var hr=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 J.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 Kn=class extends hr{constructor(e){super({visibleToBotOwners:!0,...e})}with(e){return new Kn({...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})}};C();R();O();var EI=t=>["traceparent","tracestate","sentry-trace"].reduce((e,n)=>(t[n]&&(e[n]=t[n]),e),{}),SI=(t,e,n)=>{let[,r]=(e.headers.traceparent||"").split("-"),a=new PI({botId:t.botId,integrationId:t.integrationId,retry:Va,headers:EI(e.headers)}),o=new ii(a),i=new Kn({traceId:r});return{ctx:t,req:e,client:o,logger:i,instance:n}},kI=async t=>{let{ctx:e}=t;switch(e.operation){case"webhook_received":return await AI(t);case"register":return await CI(t);case"unregister":return await OI(t);case"message_created":return await NI(t);case"action_triggered":return await DI(t);case"ping":return await II(t);case"create_user":return await RI(t);case"create_conversation":return await MI(t);default:throw new BI(`Unknown operation ${e.operation}`)}},xv=t=>async e=>{let n=$h(e.headers),r=SI(n,e,t),{logger:a}=r;try{let o;return o=await HI(r),o?{...o,status:o.status??200}:(o=await kI(r),o?{...o,status:o.status??200}:{status:200})}catch(o){if(xI(o)){let s=o.type==="Runtime"?o:new wv(o.message,o);return a.forBot().error(s.message),{status:s.code,body:JSON.stringify(s.toJSON())}}console.error(o);let i=new wv("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 a.forBot().error(i.message),{status:i.code,body:JSON.stringify(i.toJSON())}}},II=async t=>{},AI=async({client:t,ctx:e,req:n,logger:r,instance:a})=>{let{req:o}=Ct(n);return a.webhook({client:t,ctx:e,req:o,logger:r})},CI=async({client:t,ctx:e,req:n,logger:r,instance:a})=>{if(!a.register)return;let{webhookUrl:o}=Ct(n);await a.register({client:t,ctx:e,webhookUrl:o,logger:r})},OI=async({client:t,ctx:e,req:n,logger:r,instance:a})=>{if(!a.unregister)return;let{webhookUrl:o}=Ct(n);await a.unregister({ctx:e,webhookUrl:o,client:t,logger:r})},RI=async({client:t,ctx:e,req:n,logger:r,instance:a})=>{if(!a.createUser)return;let{tags:o}=Ct(n);return await a.createUser({ctx:e,client:t,tags:o,logger:r})},MI=async({client:t,ctx:e,req:n,logger:r,instance:a})=>{if(!a.createConversation)return;let{channel:o,tags:i}=Ct(n);return await a.createConversation({ctx:e,client:t,channel:o,tags:i,logger:r})},NI=async({ctx:t,req:e,client:n,logger:r,instance:a})=>{let{conversation:o,user:i,type:s,payload:l,message:f}=Ct(e),p=a.channels[o.channel];if(!p)throw new Error(`Channel ${o.channel} not found`);let y=p.messages[s];if(!y)throw new Error(`Message of type ${s} not found in channel ${o.channel}`);await y({ctx:t,conversation:o,message:f,user:i,type:s,client:n,payload:l,ack:async({tags:h})=>{await n.updateMessage({id:f.id,tags:h})},logger:r})},DI=async({req:t,ctx:e,client:n,logger:r,instance:a})=>{let{input:o,type:i}=Ct(t);if(!i)throw new Error("Missing action type");let s=a.actions[i];if(!s)throw new Error(`Action ${i} not found`);let l=new Ja,p={output:await s({ctx:e,input:o,client:n,type:i,logger:r,metadata:l}),meta:l.toJSON()};return{body:JSON.stringify(p)}},HI=async({instance:t,client:e,ctx:n,logger:r,req:a})=>{let o=t.unknownOperationHandler;if(o)return await o({client:e,ctx:n,logger:r,req:a})};var Ul=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=xv(this);start=e=>za(this.handler,e)};C();R();O();C();R();O();C();R();O();C();R();O();C();R();O();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.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;withPlugins;addIntegration(e,n){let r=this;return r.integrations||(r.integrations={}),r.integrations[e.name]={...e,enabled:n?.enabled,configurationType:n?.configurationType,configuration:n?.configuration,disabledChannels:n?.disabledChannels},this}addPlugin(e,n){let r=this;r.plugins||(r.plugins={});let a=n.alias??e.name.replace("/","-");return r.plugins[a]={...e,alias:a,configuration:n.configuration,interfaces:n.interfaces},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,a)),r.withPlugins.events=this._mergeEvents(r.withPlugins.events,this._prefixKeysWithPluginAlias(e.definition.events,a)),r.withPlugins.actions=this._mergeActions(r.withPlugins.actions,this._prefixKeysWithPluginAlias(e.definition.actions,a)),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}${fn}${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,a]of n){let o=Object.entries(a.interfaces??{});for(let[i,s]of o){let l=this.integrations?.[s.name];if(!l)throw new Error(`Interface with alias "${i}" of plugin with alias "${r}" references integration "${s.name}" which is not installed`);let f=Object.entries(s.entities??{});for(let[p,{name:y}]of f){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,a])=>[r,this._dereferenceDefinitionSchema(a,n)]))}_dereferenceDefinitionSchema(e,n){return e&&{...e,schema:this._dereferenceZuiSchema(e.schema,n)}}_dereferenceActionDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,a])=>[r,{...a,input:{schema:this._dereferenceZuiSchema(a.input.schema,n)},output:{schema:this._dereferenceZuiSchema(a.output.schema,n)}}]))}};C();R();O();C();R();O();import{isApiError as FI,Client as WI,RuntimeError as Ev}from"@botpress/client";C();R();O();var Ln=class extends hr{constructor(e){super({...e})}with(e){return new Ln({...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})}};C();R();O();C();R();O();var en=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);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 a=await this._client[e](n),o=this._hooks.after[e];return o&&(a=await o(a,n)),a}};C();R();O();C();R();O();var vr=t=>new Proxy({},{get:(e,n)=>({listInstances:{all:r=>dn({workflowName:n,client:t,input:r}),running:r=>dn({workflowName:n,client:t,input:r,statuses:["in_progress"]}),scheduled:r=>dn({workflowName:n,client:t,input:r,statuses:["pending","listening"]}),allFinished:r=>dn({workflowName:n,client:t,input:r,statuses:["completed","cancelled","failed","timedout"]}),cancelled:r=>dn({workflowName:n,client:t,input:r,statuses:["cancelled"]}),failed:r=>dn({workflowName:n,client:t,input:r,statuses:["failed"]}),succeeded:r=>dn({workflowName:n,client:t,input:r,statuses:["completed"]}),timedOut:r=>dn({workflowName:n,client:t,input:r,statuses:["timedout"]})},startNewInstance:async r=>{let{workflow:a}=await t.createWorkflow({name:n,status:"pending",...r});return{workflow:pn({client:t,workflow:a})}}})}),dn=async t=>{let e=await t.client.listWorkflows({name:t.workflowName,statuses:t.statuses,...t.input});return{...e,workflows:e.workflows.map(n=>pn({client:t.client,workflow:n}))}},pn=t=>({...t.workflow,async update(e){let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,...e});return{workflow:pn({client:t.client,workflow:n})}},async setFailed({failureReason:e}){let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,status:"failed",failureReason:e});return{workflow:pn({client:t.client,workflow:n})}},async setCompleted({output:e}={}){let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,status:"completed",output:e});return{workflow:pn({client:t.client,workflow:n})}},async cancel(){let{workflow:e}=await t.client.updateWorkflow({id:t.workflow.id,status:"cancelled"});return{workflow:pn({client:t.client,workflow:e})}}});C();R();O();C();R();O();var UI=Y.enum(["event_received","register","unregister","ping","action_triggered"]),Pv=t=>{let e=t[wa],n=t[xa],r=t[Dy],a=UI.parse(t[Pa]);if(!e)throw new Error("Missing bot headers");if(!r)throw new Error("Missing type headers");if(!n)throw new Error("Missing configuration headers");if(!a)throw new Error("Missing operation headers");return{botId:e,operation:a,type:r,configuration:n?JSON.parse(q.from(n,"base64").toString("utf-8")):{}}};C();R();O();var ft={status:200};C();R();O();C();R();O();var $l=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 ZI=["child_workflow_deleted","child_workflow_finished","workflow_timedout","workflow_started","workflow_continued"],Bv=async(t,e)=>{if(t.ctx.type!=="workflow_update"||!ZI.includes(e.payload.type))throw new Error("Unexpected event type");let n={...t,logger:$I(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 jI(n,e);default:e.payload.type}return ft},$I=(t,e)=>t.logger.with({eventId:e.id,workflowId:e.payload.workflow.id,conversationId:e.payload.conversation?.id,userId:e.payload.user?.id}),jI=async(t,e)=>{let n=$l(e.payload.type),r=t.self.workflowHandlers[n]?.[e.payload.workflow.name];return!r||r.length===0?(t.logger.warn(`No ${n} handler found for workflow "${e.payload.workflow.name}"`),ft):(await KI(t,e),await LI(t,e),ft)},KI=async(t,e)=>{e.payload.workflow.status==="pending"&&await t.client.updateWorkflow({id:e.payload.workflow.id,status:"in_progress",eventId:e.id})},LI=async(t,e)=>{let n=$l(e.payload.type),r=t.self.workflowHandlers[n]?.[e.payload.workflow.name];for(let a of r)await a({...t,event:e,conversation:e.payload.conversation,user:e.payload.user,workflow:pn({...t,workflow:e.payload.workflow}),workflows:vr(t.client)})};C();R();O();var Sv=t=>async e=>{let n=Pv(e.headers),r=new Ln,a=new WI({botId:n.botId,retry:Va}),o=new en(a,{before:{createMessage:async s=>{let l=t.hookHandlers.before_outgoing_message[s.type]??[];for(let f of l){let p=new en(a);s=(await f({client:p,ctx:n,logger:r.with({conversationId:s.conversationId,userId:s.userId}),data:s,...gn({client:p})}))?.data??s}return s},callAction:async s=>{let l=t.hookHandlers.before_outgoing_call_action[s.type]??[];for(let f of l){let p=new en(a);s=(await f({client:p,ctx:n,logger:r,data:s,...gn({client:p})}))?.data??s}return s}},after:{createMessage:async s=>{let l=t.hookHandlers.after_outgoing_message[s.message.type]??[];for(let f of l){let p=new en(a);s=(await f({client:p,ctx:n,logger:r.with({messageId:s.message.id,conversationId:s.message.conversationId,userId:s.message.userId}),data:s,...gn({client:p})}))?.data??s}return s},callAction:async(s,l)=>{let{type:f}=l,p=t.hookHandlers.after_outgoing_call_action[f]??[];for(let y of p){let g=new en(a);s=(await y({client:g,ctx:n,logger:r,data:{type:f,...s},...gn({client:g})}))?.data??s}return s}}}),i={req:e,ctx:n,logger:r,client:o,self:t};try{switch(n.operation){case"action_triggered":return await JI(i);case"event_received":return await VI(i);case"register":return await qI(i);case"unregister":return await GI(i);case"ping":return await zI(i);default:throw new Error(`Unknown operation ${n.operation}`)}}catch(s){let l=s instanceof Error?s:new Error(String(s));if(FI(l)){let p=l.type==="Runtime"?l:new Ev(l.message,l);return r.error(p.message),{status:p.code,body:JSON.stringify(p.toJSON())}}let f=new Ev("An unexpected error occurred in the bot.",l);return r.error(f.message,l),{status:f.code,body:JSON.stringify(f.toJSON())}}},zI=async t=>ft,qI=async t=>ft,GI=async t=>ft,VI=async t=>{let{ctx:e,logger:n,req:r,client:a,self:o}=t,i={client:a,ctx:e,logger:n,...gn({client:a})},s=Ct(r);if(i.logger=i.logger.with({eventId:s.event.id,messageId:s.event.messageId,conversationId:s.event.conversationId,userId:s.event.userId}),e.type==="workflow_update")return await Bv(t,s.event);if(e.type==="message_created"){let h=s.event,w=h.payload.message;i.logger=i.logger.with({messageId:w.id,conversationId:w.conversationId,userId:w.userId});let P=o.hookHandlers.before_incoming_message[w.type]??[];for(let E of P){let H=await E({...i,data:w});if(w=H?.data??w,H?.stop)return ft}let B={...i,user:h.payload.user,conversation:h.payload.conversation,message:w,event:h},v=o.messageHandlers[w.type]??[];for(let E of v)await E(B);let S=o.hookHandlers.after_incoming_message[w.type]??[];for(let E of S){let H=await E({...i,data:w});if(w=H?.data??w,H?.stop)return ft}return ft}if(e.type==="state_expired"){let w=s.event.payload.state,P={...i,state:w},B=o.stateExpiredHandlers[w.name]??[];for(let v of B)await v(P);return ft}let l=s.event,f=o.hookHandlers.before_incoming_event[l.type]??[];for(let h of f){let w=await h({...i,data:l});if(l=w?.data??l,w?.stop)return ft}let p={...i,event:l},y=o.eventHandlers[l.type]??[];for(let h of y)await h(p);let g=o.hookHandlers.after_incoming_event[l.type]??[];for(let h of g){let w=await h({...i,data:l});if(l=w?.data??l,w?.stop)return ft}return ft},JI=async({ctx:t,logger:e,req:n,client:r,self:a})=>{let{input:o,type:i}=Ct(n);if(!i)throw new Error("Missing action type");let s=a.hookHandlers.before_incoming_call_action[i]??[];for(let g of s){let h=await g({ctx:t,logger:e,client:r,data:{type:i,input:o},...gn({client:r})});o=h?.data?.input??o,i=h?.data?.type??i}let l=a.actionHandlers[i];if(!l)throw new Error(`Action ${i} not found`);let f=await l({ctx:t,logger:e,input:o,client:r,type:i,...gn({client:r})}),p=a.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:f},...gn({client:r})});i=h?.data?.type??i,f=h?.data?.output??f}return{status:200,body:JSON.stringify({output:f})}},gn=t=>({workflows:vr(t.client)});var jl=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 r;for(let[a,o]of Object.entries(this._plugins)){let[i,s]=n.split(fn);if(!(i!==a||!s)&&(r=o.actionHandlers[s],r))return r}}})}get messageHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(s=>s.messageHandlers[n]??[]),a=this._messageHandlers[n]??[],o=this._messageHandlers["*"]??[],i=[...a,...o].sort((s,l)=>s.order-l.order).map(({handler:s})=>s);return ye.unique([...r,...i])}})}get eventHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(s=>s.eventHandlers[n]??[]),a=this._eventHandlers[n]??[],o=this._eventHandlers["*"]??[],i=[...a,...o].sort((s,l)=>s.order-l.order).map(({handler:s})=>s);return ye.unique([...r,...i])}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(s=>s.stateExpiredHandlers[n]??[]),a=this._stateExpiredHandlers[n]??[],o=this._stateExpiredHandlers["*"]??[],i=[...a,...o].sort((s,l)=>s.order-l.order).map(({handler:s})=>s);return ye.unique([...r,...i])}})}get hookHandlers(){return new Proxy({},{get:(e,n)=>{if(this._hookHandlers[n])return new Proxy({},{get:(a,o)=>{let i=Object.values(this._plugins).flatMap(y=>y.hookHandlers[n]?.[o]??[]),s=this._hookHandlers[n]??{},l=s[o]??[],f=s["*"]??[],p=[...l,...f].sort((y,g)=>y.order-g.order).map(({handler:y})=>y);return ye.unique([...i,...p])}})}})}get workflowHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._workflowHandlers[n];if(r)return new Proxy({},{get:(a,o)=>{let i=r[o]?.sort((l,f)=>l.order-f.order).map(({handler:l})=>l)??[],s=Object.values(this._plugins).flatMap(l=>l.workflowHandlers[n]?.[o]??[]);return ye.unique([...i,...s])}})}})}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=Sv(this);start=e=>za(this.handler,e)};C();R();O();C();R();O();C();R();O();C();R();O();C();R();O();var Kl=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;let n=this._getEntityReference(this.entities),r=e.events===void 0?{}:Le.mapValues(e.events,i=>({...i,schema:i.schema(n)})),a=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)}})),o=e.channels===void 0?{}:Le.mapValues(e.channels,i=>({...i,messages:Le.mapValues(i.messages,s=>({...s,schema:s.schema(n)}))}));this.events=r,this.actions=a,this.channels=o}name;version;title;description;icon;readme;attributes;entities;events;actions;channels;_getEntityReference=e=>{let n={};for(let[r,a]of Object.entries(e)){let o=a.schema._def["x-zui"]?.title,i=a.schema._def.description,s=by.ref(r);o&&s.title(o),i&&s.describe(i),n[r]=s}return n}};C();R();O();C();R();O();C();R();O();C();R();O();var Ll=class{constructor(e){this.props=e;let n=Object.fromEntries(Object.entries(e.interfaces??{}).map(([r,a])=>[r,Object.fromEntries(Object.entries(a.definition.entities??{}).map(([o])=>[o,Y.ref(`interface:${r}/entities/${o}`)]))]));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.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(([r,a])=>[r,{...a,schema:typeof a.schema=="object"?a.schema:a.schema({entities:n})}])),this.events=Object.fromEntries(Object.entries(e.events??{}).map(([r,a])=>[r,{...a,schema:typeof a.schema=="object"?a.schema:a.schema({entities:n})}])),this.actions=Object.fromEntries(Object.entries(e.actions??{}).map(([r,a])=>[r,{...a,input:{...a.input,schema:typeof a.input.schema=="object"?a.input.schema:a.input.schema({entities:n})},output:{...a.output,schema:typeof a.output.schema=="object"?a.output.schema:a.output.schema({entities:n})}}])),this.tables=Object.fromEntries(Object.entries(e.tables??{}).map(([r,a])=>[r,{...a,schema:typeof a.schema=="object"?a.schema:a.schema({entities:n})}]))}name;version;title;description;icon;readme;attributes;integrations;interfaces;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;workflows;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(([a,o])=>[`interface:${n}/entities/${a}`,e?o.schema.and(Y.record(Y.string(),Y.unknown())):o.schema])))}_dereferenceZuiSchema(e,n){return e.dereference(n)}_dereferenceDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,a])=>[r,{...a,schema:this._dereferenceZuiSchema(a.schema,n)}]))}_dereferenceActionDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,a])=>[r,{...a,input:{schema:this._dereferenceZuiSchema(a.input.schema,n)},output:{schema:this._dereferenceZuiSchema(a.output.schema,n)}}]))}};C();R();O();C();R();O();C();R();O();C();R();O();var Fl=":";var kv=t=>{let[e,n]=t.split(Fl);return!e||!n?null:{namespace:e,eventName:n}},Iv=t=>`${t.namespace}${Fl}${t.actionName}`,Av=t=>`${t.namespace}${Fl}${t.eventName}`,Cv=(t,e)=>{let n=e[t.namespace]??{name:t.namespace,version:"0.0.0",entities:{},actions:{},events:{},channels:{}},r=n.name,a=n.actions[t.actionName]?.name??t.actionName;return{namespace:r,actionName:a}},Ov=(t,e)=>{let n=e[t.namespace]??{name:t.namespace,version:"0.0.0",entities:{},actions:{},events:{},channels:{}},r=n.name,a=n.events[t.eventName]?.name??t.eventName;return{namespace:r,eventName:a}};var Rv=(t,e)=>new Proxy({},{get:(n,r)=>new Proxy({},{get:(a,o)=>i=>XI({client:t,interfaces:e.interfaces,integrationOrInterfaceName:r,methodName:o,input:i})})}),XI=async({client:t,interfaces:e,integrationOrInterfaceName:n,methodName:r,input:a})=>{let o=Cv({namespace:n,actionName:r},e),i=Iv(o);return(await t.callAction({type:i,input:a})).output};C();R();O();C();R();O();C();R();O();var Fn=class{constructor(e){this._props=e}async emit(e){let{conversationId:n,userId:r,messageId:a}=this._props;await this._props.client.createEvent({type:this._props.eventName,payload:e,conversationId:n,userId:r,messageId:a})}async schedule(e,n){let{conversationId:r,userId:a,messageId:o}=this._props;await this._props.client.createEvent({type:this._props.eventName,payload:e,conversationId:r,userId:a,messageId:o,schedule:n})}withConversationId(e){return new Fn({...this._props,conversationId:e})}withUserId(e){return new Fn({...this._props,userId:e})}withMessageId(e){return new Fn({...this._props,messageId:e})}},Mv=(t,e)=>new Proxy({},{get:(n,r)=>{let a=e.alias!==void 0?`${e.alias}${fn}${r}`:r;return new Fn({client:t,eventName:a})}});C();R();O();C();R();O();C();R();O();var Wl=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){await this._client.setState({type:this._stateType,name:this._stateName,id:e,payload:n})}async getOrSet(e,n){return await this._client.getOrSetState({type:this._stateType,name:this._stateName,id:e,payload:n}).then(r=>r.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})}},Nv=(t,e)=>new Proxy({},{get:(n,r)=>new Proxy({},{get:(a,o)=>{let i=e.alias!==void 0?`${e.alias}${fn}${o}`:o;return new Wl(t,r,i)}})});C();R();O();var zl=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,alias:a}=this._runtime,o=Rv(e,this._runtime),i=Nv(e,this._runtime),s=vr(e),l=Mv(e,this._runtime);return{configuration:n,interfaces:r,actions:o,states:i,alias:a,workflows:s,events:l}}get actionHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._actionHandlers[n];if(r)return Qt.setName(a=>r({...a,...this._getTools(a.client)}),r.name)}})}get messageHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._messageHandlers[n]??[],a=this._messageHandlers["*"]??[];return ye.unique([...r,...a]).sort((i,s)=>i.order-s.order).map(({handler:i})=>Qt.setName(s=>i({...s,...this._getTools(s.client)}),i.name))}})}get eventHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._eventHandlers[n]??[],a=Object.entries(this._eventHandlers).filter(([s])=>this._eventResolvesTo(s,n)).flatMap(([,s])=>s??[]),o=this._eventHandlers["*"]??[];return ye.unique([...r,...a,...o]).sort((s,l)=>s.order-l.order).map(({handler:s})=>Qt.setName(l=>s({...l,...this._getTools(l.client)}),s.name))}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._stateExpiredHandlers[n]??[],a=this._stateExpiredHandlers["*"]??[];return ye.unique([...r,...a]).sort((i,s)=>i.order-s.order).map(({handler:i})=>Qt.setName(s=>i({...s,...this._getTools(s.client)}),i.name))}})}get hookHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._hookHandlers[n];if(r)return new Proxy({},{get:(a,o)=>{o=this._stripAliasPrefix(o);let i=r[o]??[],s=Object.entries(r).filter(([p])=>this._eventResolvesTo(p,o)).flatMap(([,p])=>p??[]),l=r["*"]??[];return ye.unique([...i,...s,...l]).sort((p,y)=>p.order-y.order).map(({handler:p})=>Qt.setName(y=>p({...y,...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:(a,o)=>(r[o]?.sort((s,l)=>s.order-l.order)??[]).map(({handler:s})=>Qt.setName(l=>s({...l,...this._getTools(l.client)}),s.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 r=kv(e);if(!r)return!1;let a=Ov(r,this._runtime.interfaces);return Av(a)===n};_stripAliasPrefix=e=>{let{alias:n}=this._runtime;if(!n)return e;let r=`${n}#`;return e.startsWith(r)?e.slice(r.length):e}};C();R();O();C();R();O();C();R();O();C();R();O();C();R();O();C();R();O();export{Rx as BRAND,jl as Bot,Zl as BotDefinition,Ln as BotLogger,en as BotSpecificClient,Xn as DIRTY,Ix as EMPTY_PATH,pe as INVALID,Ul as Integration,el as IntegrationDefinition,Kn as IntegrationLogger,ii as IntegrationSpecificClient,Kl as InterfaceDefinition,RP as NEVER,pt as OK,It as ParseInputLazyPath,vt as ParseStatus,zl as Plugin,Ll as PluginDefinition,rU as RuntimeError,he as Schema,QA as WELL_KNOWN_ATTRIBUTES,Fr as ZodAny,Wr as ZodArray,jo as ZodBigInt,Ko as ZodBoolean,Lo as ZodBranded,Fo as ZodCatch,Wo as ZodDate,ha as ZodDefault,fg as ZodDiscriminatedUnion,En as ZodEffects,or as ZodEnum,Kt as ZodError,Yp as ZodFirstPartyTypeKind,pg as ZodFunction,qo as ZodIntersection,G as ZodIssueCode,Go as ZodLazy,Vo as ZodLiteral,yg as ZodMap,hg as ZodNaN,Jo as ZodNativeEnum,Gr as ZodNever,Xo as ZodNull,tr as ZodNullable,Yo as ZodNumber,nr as ZodObject,an as ZodOptional,ne as ZodParsedType,Qo as ZodPipeline,Ta as ZodPromise,_a as ZodReadonly,Pg as ZodRecord,Eg as ZodRef,he as ZodSchema,Sg as ZodSet,gt as ZodString,Ug as ZodSymbol,En as ZodTransformer,ir as ZodTuple,he as ZodType,ba as ZodUndefined,es as ZodUnion,Ur as ZodUnknown,Kg as ZodVoid,te as addIssueToContext,$x as agent,Wx as aimodel,nP as any,oP as array,Xx as bigint,Wg as boolean,wa as botIdHeader,Oy as botUserIdHeader,OP as coerce,xa as configurationHeader,Ny as configurationTypeHeader,Hx as conversation,va as createZodEnum,Ig as cuid2Regex,kg as cuidRegex,ug as custom,zx as datasource,Yx as date,cP as discriminatedUnion,Gc as effect,Og as emailRegex,bP as enum,ue as errorUtil,jx as event,vP as function,Kr as getErrorMap,rn as getParsedType,Vx as instanceof,Ry as integrationIdHeader,Fx as intent,fP as intersection,Mg as ipv4Regex,Ng as ipv6Regex,_o as isAborted,nU as isApiError,ki as isAsync,bo as isDirty,Mx as isEmojiRegex,Lr as isValid,qx as knowledgebase,Gx as late,TP as lazy,_P as literal,Si as makeIssue,mP as map,Vr as mergeObjectSchemas,Zx as message,Cy as messages,Jx as nan,wP as nativeEnum,iP as never,tP as null,BP as nullable,Fg as number,sP as object,To as objectUtil,CP as oboolean,AP as onumber,Pa as operationHeader,PP as optional,IP as ostring,Ct as parseBody,kP as pipeline,SP as preprocess,me as processCreateParams,xP as promise,kx as quotelessJson,yP as readonly,pP as record,gP as ref,za as serve,hP as set,tg as setErrorMap,lP as strictObject,Lg as string,Qx as symbol,Kx as table,Lx as tablerow,Gc as transformer,zv as transforms,dP as tuple,Dy as typeHeader,Ag as ulidRegex,eP as undefined,uP as union,rP as unknown,Ux as user,be as util,Cg as uuidRegex,Dx as variable,aP as void,My as webhookIdHeader,Y as z};
88
+ `)+" "+F[1]:F[0]+j+" "+D.join(", ")+" "+F[1]}xe.types=_I();function B(D){return Array.isArray(D)}xe.isArray=B;function v(D){return typeof D=="boolean"}xe.isBoolean=v;function S(D){return D===null}xe.isNull=S;function E(D){return D==null}xe.isNullOrUndefined=E;function H(D){return typeof D=="number"}xe.isNumber=H;function K(D){return typeof D=="string"}xe.isString=K;function oe(D){return typeof D=="symbol"}xe.isSymbol=oe;function ee(D){return D===void 0}xe.isUndefined=ee;function ge(D){return ae(D)&&Ve(D)==="[object RegExp]"}xe.isRegExp=ge,xe.types.isRegExp=ge;function ae(D){return typeof D=="object"&&D!==null}xe.isObject=ae;function re(D){return ae(D)&&Ve(D)==="[object Date]"}xe.isDate=re,xe.types.isDate=re;function Oe(D){return ae(D)&&(Ve(D)==="[object Error]"||D instanceof Error)}xe.isError=Oe,xe.types.isNativeError=Oe;function ze(D){return typeof D=="function"}xe.isFunction=ze;function tt(D){return D===null||typeof D=="boolean"||typeof D=="number"||typeof D=="string"||typeof D=="symbol"||typeof D>"u"}xe.isPrimitive=tt,xe.isBuffer=bI();function Ve(D){return Object.prototype.toString.call(D)}function Je(D){return D<10?"0"+D.toString(10):D.toString(10)}var mt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ue(){var D=new Date,j=[Je(D.getHours()),Je(D.getMinutes()),Je(D.getSeconds())].join(":");return[D.getDate(),mt[D.getMonth()],j].join(" ")}xe.log=function(){console.log("%s - %s",Ue(),xe.format.apply(xe,arguments))},xe.inherits=Mt(),xe._extend=function(D,j){if(!j||!ae(j))return D;for(var F=Object.keys(j),de=F.length;de--;)D[F[de]]=j[F[de]];return D};function Pe(D,j){return Object.prototype.hasOwnProperty.call(D,j)}var Se=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;xe.promisify=function(j){if(typeof j!="function")throw new TypeError('The "original" argument must be of type Function');if(Se&&j[Se]){if(F=j[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 de,Te,A=new Promise(function(X,ie){de=X,Te=ie}),k=[],$=0;$<arguments.length;$++)k.push(arguments[$]);k.push(function(X,ie){X?Te(X):de(ie)});try{j.apply(this||ii,k)}catch(X){Te(X)}return A}return Object.setPrototypeOf(F,Object.getPrototypeOf(j)),Se&&Object.defineProperty(F,Se,{value:F,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(F,e(j))},xe.promisify.custom=Se;function fe(D,j){if(!D){var F=new Error("Promise was rejected with a falsy value");F.reason=D,D=F}return j(D)}function ve(D){if(typeof D!="function")throw new TypeError('The "original" argument must be of type Function');function j(){for(var F=[],de=0;de<arguments.length;de++)F.push(arguments[de]);var Te=F.pop();if(typeof Te!="function")throw new TypeError("The last argument must be of type Function");var A=this||ii,k=function(){return Te.apply(A,arguments)};D.apply(this||ii,F).then(function($){t.nextTick(k.bind(null,null,$))},function($){t.nextTick(fe.bind(null,$,k))})}return Object.setPrototypeOf(j,Object.getPrototypeOf(D)),Object.defineProperties(j,e(D)),j}return xe.callbackify=ve,xe}var ce=wI();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 ZR=ce._extend,$R=ce.callbackify,jR=ce.debuglog,KR=ce.deprecate,LR=ce.format,FR=ce.inherits,WR=ce.inspect,zR=ce.isArray,qR=ce.isBoolean,GR=ce.isBuffer,VR=ce.isDate,JR=ce.isError,XR=ce.isFunction,YR=ce.isNull,QR=ce.isNullOrUndefined,e0=ce.isNumber,t0=ce.isObject,n0=ce.isPrimitive,r0=ce.isRegExp,i0=ce.isString,o0=ce.isSymbol,a0=ce.isUndefined,s0=ce.log,l0=ce.promisify,u0=ce.types,c0=ce.TextEncoder=globalThis.TextEncoder,f0=ce.TextDecoder=globalThis.TextDecoder;var gr=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 J.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 oi=class t extends gr{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})}};C();R();O();var EI=t=>["traceparent","tracestate","sentry-trace"].reduce((e,n)=>(t[n]&&(e[n]=t[n]),e),{}),SI=(t,e,n)=>{let[,r]=(e.headers.traceparent||"").split("-"),o=new PI({botId:t.botId,integrationId:t.integrationId,retry:Vo,headers:EI(e.headers)}),a=new ti(o),i=new oi({traceId:r});return{ctx:t,req:e,client:a,logger:i,instance:n}},kI=async t=>{let{ctx:e}=t;switch(e.operation){case"webhook_received":return await AI(t);case"register":return await CI(t);case"unregister":return await OI(t);case"message_created":return await NI(t);case"action_triggered":return await DI(t);case"ping":return await II(t);case"create_user":return await RI(t);case"create_conversation":return await MI(t);default:throw new BI(`Unknown operation ${e.operation}`)}},xv=t=>async e=>{let n=$h(e.headers),r=SI(n,e,t),{logger:o}=r;try{let a;return a=await HI(r),a?{...a,status:a.status??200}:(a=await kI(r),a?{...a,status:a.status??200}:{status:200})}catch(a){if(xI(a)){let s=a.type==="Runtime"?a:new wv(a.message,a);return o.forBot().error(s.message),{status:s.code,body:JSON.stringify(s.toJSON())}}console.error(a);let i=new wv("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())}}},II=async t=>{},AI=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{let{req:a}=Ct(n);return o.webhook({client:t,ctx:e,req:a,logger:r})},CI=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{if(!o.register)return;let{webhookUrl:a}=Ct(n);await o.register({client:t,ctx:e,webhookUrl:a,logger:r})},OI=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{if(!o.unregister)return;let{webhookUrl:a}=Ct(n);await o.unregister({ctx:e,webhookUrl:a,client:t,logger:r})},RI=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{if(!o.createUser)return;let{tags:a}=Ct(n);return await o.createUser({ctx:e,client:t,tags:a,logger:r})},MI=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{if(!o.createConversation)return;let{channel:a,tags:i}=Ct(n);return await o.createConversation({ctx:e,client:t,channel:a,tags:i,logger:r})},NI=async({ctx:t,req:e,client:n,logger:r,instance:o})=>{let{conversation:a,user:i,type:s,payload:l,message:f}=Ct(e),p=o.channels[a.channel];if(!p)throw new Error(`Channel ${a.channel} not found`);let y=p.messages[s];if(!y)throw new Error(`Message of type ${s} not found in channel ${a.channel}`);await y({ctx:t,conversation:a,message:f,user:i,type:s,client:n,payload:l,ack:async({tags:h})=>{await n.updateMessage({id:f.id,tags:h})},logger:r})},DI=async({req:t,ctx:e,client:n,logger:r,instance:o})=>{let{input:a,type:i}=Ct(t);if(!i)throw new Error("Missing action type");let s=o.actions[i];if(!s)throw new Error(`Action ${i} not found`);let l=new Jo,p={output:await s({ctx:e,input:a,client:n,type:i,logger:r,metadata:l}),meta:l.toJSON()};return{body:JSON.stringify(p)}},HI=async({instance:t,client:e,ctx:n,logger:r,req:o})=>{let a=t.unknownOperationHandler;if(a)return await a({client:e,ctx:n,logger:r,req:o})};var Hl=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=xv(this);start=e=>zo(this.handler,e)};C();R();O();C();R();O();C();R();O();C();R();O();C();R();O();var Ul=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.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;withPlugins;addIntegration(e,n){let r=this;return r.integrations||(r.integrations={}),r.integrations[e.name]={...e,enabled:n?.enabled,configurationType:n?.configurationType,configuration:n?.configuration,disabledChannels:n?.disabledChannels},this}addPlugin(e,n){let r=this;r.plugins||(r.plugins={});let o=n.alias??e.name.replace("/","-");return r.plugins[o]={...e,alias:o,configuration:n.configuration,interfaces:n.interfaces},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}${fn}${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 a=Object.entries(o.interfaces??{});for(let[i,s]of a){let l=this.integrations?.[s.name];if(!l)throw new Error(`Interface with alias "${i}" of plugin with alias "${r}" references integration "${s.name}" which is not installed`);let f=Object.entries(s.entities??{});for(let[p,{name:y}]of f){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)}}]))}};C();R();O();C();R();O();import{isApiError as FI,Client as WI,RuntimeError as Ev}from"@botpress/client";C();R();O();var ai=class t extends gr{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})}};C();R();O();C();R();O();var en=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));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),a=this._hooks.after[e];return a&&(o=await a(o,n)),o}};C();R();O();C();R();O();var yr=t=>new Proxy({},{get:(e,n)=>({listInstances:{all:r=>dn({workflowName:n,client:t,input:r}),running:r=>dn({workflowName:n,client:t,input:r,statuses:["in_progress"]}),scheduled:r=>dn({workflowName:n,client:t,input:r,statuses:["pending","listening"]}),allFinished:r=>dn({workflowName:n,client:t,input:r,statuses:["completed","cancelled","failed","timedout"]}),cancelled:r=>dn({workflowName:n,client:t,input:r,statuses:["cancelled"]}),failed:r=>dn({workflowName:n,client:t,input:r,statuses:["failed"]}),succeeded:r=>dn({workflowName:n,client:t,input:r,statuses:["completed"]}),timedOut:r=>dn({workflowName:n,client:t,input:r,statuses:["timedout"]})},startNewInstance:async r=>{let{workflow:o}=await t.createWorkflow({name:n,status:"pending",...r});return{workflow:pn({client:t,workflow:o})}}})}),dn=async t=>{let e=await t.client.listWorkflows({name:t.workflowName,statuses:t.statuses,...t.input});return{...e,workflows:e.workflows.map(n=>pn({client:t.client,workflow:n}))}},pn=t=>({...t.workflow,async update(e){let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,...e});return{workflow:pn({client:t.client,workflow:n})}},async setFailed({failureReason:e}){let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,status:"failed",failureReason:e});return{workflow:pn({client:t.client,workflow:n})}},async setCompleted({output:e}={}){let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,status:"completed",output:e});return{workflow:pn({client:t.client,workflow:n})}},async cancel(){let{workflow:e}=await t.client.updateWorkflow({id:t.workflow.id,status:"cancelled"});return{workflow:pn({client:t.client,workflow:e})}}});C();R();O();C();R();O();var UI=Y.enum(["event_received","register","unregister","ping","action_triggered"]),Pv=t=>{let e=t[wo],n=t[xo],r=t[Dy],o=UI.parse(t[Po]);if(!e)throw new Error("Missing bot headers");if(!r)throw new Error("Missing type headers");if(!n)throw new Error("Missing configuration headers");if(!o)throw new Error("Missing operation headers");return{botId:e,operation:o,type:r,configuration:n?JSON.parse(q.from(n,"base64").toString("utf-8")):{}}};C();R();O();var ft={status:200};C();R();O();C();R();O();var Zl=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 ZI=["child_workflow_deleted","child_workflow_finished","workflow_timedout","workflow_started","workflow_continued"],Bv=async(t,e)=>{if(t.ctx.type!=="workflow_update"||!ZI.includes(e.payload.type))throw new Error("Unexpected event type");let n={...t,logger:$I(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 jI(n,e);default:e.payload.type}return ft},$I=(t,e)=>t.logger.with({eventId:e.id,workflowId:e.payload.workflow.id,conversationId:e.payload.conversation?.id,userId:e.payload.user?.id}),jI=async(t,e)=>{let n=Zl(e.payload.type),r=t.self.workflowHandlers[n]?.[e.payload.workflow.name];return!r||r.length===0?(t.logger.warn(`No ${n} handler found for workflow "${e.payload.workflow.name}"`),ft):(await KI(t,e),await LI(t,e),ft)},KI=async(t,e)=>{e.payload.workflow.status==="pending"&&await t.client.updateWorkflow({id:e.payload.workflow.id,status:"in_progress",eventId:e.id})},LI=async(t,e)=>{let n=Zl(e.payload.type),r=t.self.workflowHandlers[n]?.[e.payload.workflow.name];for(let o of r)await o({...t,event:e,conversation:e.payload.conversation,user:e.payload.user,workflow:pn({...t,workflow:e.payload.workflow}),workflows:yr(t.client)})};C();R();O();var Sv=t=>async e=>{let n=Pv(e.headers),r=new ai,o=new WI({botId:n.botId,retry:Vo}),a=new en(o,{before:{createMessage:async s=>{let l=t.hookHandlers.before_outgoing_message[s.type]??[];for(let f of l){let p=new en(o);s=(await f({client:p,ctx:n,logger:r.with({conversationId:s.conversationId,userId:s.userId}),data:s,...gn({client:p})}))?.data??s}return s},callAction:async s=>{let l=t.hookHandlers.before_outgoing_call_action[s.type]??[];for(let f of l){let p=new en(o);s=(await f({client:p,ctx:n,logger:r,data:s,...gn({client:p})}))?.data??s}return s}},after:{createMessage:async s=>{let l=t.hookHandlers.after_outgoing_message[s.message.type]??[];for(let f of l){let p=new en(o);s=(await f({client:p,ctx:n,logger:r.with({messageId:s.message.id,conversationId:s.message.conversationId,userId:s.message.userId}),data:s,...gn({client:p})}))?.data??s}return s},callAction:async(s,l)=>{let{type:f}=l,p=t.hookHandlers.after_outgoing_call_action[f]??[];for(let y of p){let g=new en(o);s=(await y({client:g,ctx:n,logger:r,data:{type:f,...s},...gn({client:g})}))?.data??s}return s}}}),i={req:e,ctx:n,logger:r,client:a,self:t};try{switch(n.operation){case"action_triggered":return await JI(i);case"event_received":return await VI(i);case"register":return await qI(i);case"unregister":return await GI(i);case"ping":return await zI(i);default:throw new Error(`Unknown operation ${n.operation}`)}}catch(s){let l=s instanceof Error?s:new Error(String(s));if(FI(l)){let p=l.type==="Runtime"?l:new Ev(l.message,l);return r.error(p.message),{status:p.code,body:JSON.stringify(p.toJSON())}}let f=new Ev("An unexpected error occurred in the bot.",l);return r.error(f.message,l),{status:f.code,body:JSON.stringify(f.toJSON())}}},zI=async t=>ft,qI=async t=>ft,GI=async t=>ft,VI=async t=>{let{ctx:e,logger:n,req:r,client:o,self:a}=t,i={client:o,ctx:e,logger:n,...gn({client:o})},s=Ct(r);if(i.logger=i.logger.with({eventId:s.event.id,messageId:s.event.messageId,conversationId:s.event.conversationId,userId:s.event.userId}),e.type==="workflow_update")return await Bv(t,s.event);if(e.type==="message_created"){let h=s.event,w=h.payload.message;i.logger=i.logger.with({messageId:w.id,conversationId:w.conversationId,userId:w.userId});let P=a.hookHandlers.before_incoming_message[w.type]??[];for(let E of P){let H=await E({...i,data:w});if(w=H?.data??w,H?.stop)return ft}let B={...i,user:h.payload.user,conversation:h.payload.conversation,message:w,event:h},v=a.messageHandlers[w.type]??[];for(let E of v)await E(B);let S=a.hookHandlers.after_incoming_message[w.type]??[];for(let E of S){let H=await E({...i,data:w});if(w=H?.data??w,H?.stop)return ft}return ft}if(e.type==="state_expired"){let w=s.event.payload.state,P={...i,state:w},B=a.stateExpiredHandlers[w.name]??[];for(let v of B)await v(P);return ft}let l=s.event,f=a.hookHandlers.before_incoming_event[l.type]??[];for(let h of f){let w=await h({...i,data:l});if(l=w?.data??l,w?.stop)return ft}let p={...i,event:l},y=a.eventHandlers[l.type]??[];for(let h of y)await h(p);let g=a.hookHandlers.after_incoming_event[l.type]??[];for(let h of g){let w=await h({...i,data:l});if(l=w?.data??l,w?.stop)return ft}return ft},JI=async({ctx:t,logger:e,req:n,client:r,self:o})=>{let{input:a,type:i}=Ct(n);if(!i)throw new Error("Missing action type");let s=o.hookHandlers.before_incoming_call_action[i]??[];for(let g of s){let h=await g({ctx:t,logger:e,client:r,data:{type:i,input:a},...gn({client:r})});a=h?.data?.input??a,i=h?.data?.type??i}let l=o.actionHandlers[i];if(!l)throw new Error(`Action ${i} not found`);let f=await l({ctx:t,logger:e,input:a,client:r,type:i,...gn({client:r})}),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:f},...gn({client:r})});i=h?.data?.type??i,f=h?.data?.output??f}return{status:200,body:JSON.stringify({output:f})}},gn=t=>({workflows:yr(t.client)});var $l=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 r;for(let[o,a]of Object.entries(this._plugins)){let[i,s]=n.split(fn);if(!(i!==o||!s)&&(r=a.actionHandlers[s],r))return r}}})}get messageHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(s=>s.messageHandlers[n]??[]),o=this._messageHandlers[n]??[],a=this._messageHandlers["*"]??[],i=[...o,...a].sort((s,l)=>s.order-l.order).map(({handler:s})=>s);return ye.unique([...r,...i])}})}get eventHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(s=>s.eventHandlers[n]??[]),o=this._eventHandlers[n]??[],a=this._eventHandlers["*"]??[],i=[...o,...a].sort((s,l)=>s.order-l.order).map(({handler:s})=>s);return ye.unique([...r,...i])}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(s=>s.stateExpiredHandlers[n]??[]),o=this._stateExpiredHandlers[n]??[],a=this._stateExpiredHandlers["*"]??[],i=[...o,...a].sort((s,l)=>s.order-l.order).map(({handler:s})=>s);return ye.unique([...r,...i])}})}get hookHandlers(){return new Proxy({},{get:(e,n)=>{if(this._hookHandlers[n])return new Proxy({},{get:(o,a)=>{let i=Object.values(this._plugins).flatMap(y=>y.hookHandlers[n]?.[a]??[]),s=this._hookHandlers[n]??{},l=s[a]??[],f=s["*"]??[],p=[...l,...f].sort((y,g)=>y.order-g.order).map(({handler:y})=>y);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,a)=>{let i=r[a]?.sort((l,f)=>l.order-f.order).map(({handler:l})=>l)??[],s=Object.values(this._plugins).flatMap(l=>l.workflowHandlers[n]?.[a]??[]);return ye.unique([...i,...s])}})}})}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=Sv(this);start=e=>zo(this.handler,e)};C();R();O();C();R();O();C();R();O();C();R();O();C();R();O();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;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)}})),a=e.channels===void 0?{}:Le.mapValues(e.channels,i=>({...i,messages:Le.mapValues(i.messages,s=>({...s,schema:s.schema(n)}))}));this.events=r,this.actions=o,this.channels=a}name;version;title;description;icon;readme;attributes;entities;events;actions;channels;_getEntityReference=e=>{let n={};for(let[r,o]of Object.entries(e)){let a=o.schema._def["x-zui"]?.title,i=o.schema._def.description,s=by.ref(r);a&&s.title(a),i&&s.describe(i),n[r]=s}return n}};C();R();O();C();R();O();C();R();O();C();R();O();var Kl=class{constructor(e){this.props=e;let n=Object.fromEntries(Object.entries(e.interfaces??{}).map(([r,o])=>[r,Object.fromEntries(Object.entries(o.definition.entities??{}).map(([a])=>[a,Y.ref(`interface:${r}/entities/${a}`)]))]));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.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(([r,o])=>[r,{...o,schema:typeof o.schema=="object"?o.schema:o.schema({entities:n})}])),this.events=Object.fromEntries(Object.entries(e.events??{}).map(([r,o])=>[r,{...o,schema:typeof o.schema=="object"?o.schema:o.schema({entities:n})}])),this.actions=Object.fromEntries(Object.entries(e.actions??{}).map(([r,o])=>[r,{...o,input:{...o.input,schema:typeof o.input.schema=="object"?o.input.schema:o.input.schema({entities:n})},output:{...o.output,schema:typeof o.output.schema=="object"?o.output.schema:o.output.schema({entities:n})}}])),this.tables=Object.fromEntries(Object.entries(e.tables??{}).map(([r,o])=>[r,{...o,schema:typeof o.schema=="object"?o.schema:o.schema({entities:n})}]))}name;version;title;description;icon;readme;attributes;integrations;interfaces;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;workflows;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,a])=>[`interface:${n}/entities/${o}`,e?a.schema.and(Y.record(Y.string(),Y.unknown())):a.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)}}]))}};C();R();O();C();R();O();C();R();O();C();R();O();var Ll=":";var kv=t=>{let[e,n]=t.split(Ll);return!e||!n?null:{namespace:e,eventName:n}},Iv=t=>`${t.namespace}${Ll}${t.actionName}`,Av=t=>`${t.namespace}${Ll}${t.eventName}`,Cv=(t,e)=>{let n=e[t.namespace]??{name:t.namespace,version:"0.0.0",entities:{},actions:{},events:{},channels:{}},r=n.name,o=n.actions[t.actionName]?.name??t.actionName;return{namespace:r,actionName:o}},Ov=(t,e)=>{let n=e[t.namespace]??{name:t.namespace,version:"0.0.0",entities:{},actions:{},events:{},channels:{}},r=n.name,o=n.events[t.eventName]?.name??t.eventName;return{namespace:r,eventName:o}};var Rv=(t,e)=>new Proxy({},{get:(n,r)=>new Proxy({},{get:(o,a)=>i=>XI({client:t,interfaces:e.interfaces,integrationOrInterfaceName:r,methodName:a,input:i})})}),XI=async({client:t,interfaces:e,integrationOrInterfaceName:n,methodName:r,input:o})=>{let a=Cv({namespace:n,actionName:r},e),i=Iv(a);return(await t.callAction({type:i,input:o})).output};C();R();O();C();R();O();C();R();O();var Fl=class t{constructor(e){this._props=e}async emit(e){let{conversationId:n,userId:r,messageId:o}=this._props;await this._props.client.createEvent({type:this._props.eventName,payload:e,conversationId:n,userId:r,messageId:o})}async schedule(e,n){let{conversationId:r,userId:o,messageId:a}=this._props;await this._props.client.createEvent({type:this._props.eventName,payload:e,conversationId:r,userId:o,messageId:a,schedule:n})}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})}},Mv=(t,e)=>new Proxy({},{get:(n,r)=>{let o=e.alias!==void 0?`${e.alias}${fn}${r}`:r;return new Fl({client:t,eventName:o})}});C();R();O();C();R();O();C();R();O();var Wl=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){await this._client.setState({type:this._stateType,name:this._stateName,id:e,payload:n})}async getOrSet(e,n){return await this._client.getOrSetState({type:this._stateType,name:this._stateName,id:e,payload:n}).then(r=>r.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})}},Nv=(t,e)=>new Proxy({},{get:(n,r)=>new Proxy({},{get:(o,a)=>{let i=e.alias!==void 0?`${e.alias}${fn}${a}`:a;return new Wl(t,r,i)}})});C();R();O();var zl=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,alias:o}=this._runtime,a=Rv(e,this._runtime),i=Nv(e,this._runtime),s=yr(e),l=Mv(e,this._runtime);return{configuration:n,interfaces:r,actions:a,states:i,alias:o,workflows:s,events:l}}get actionHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._actionHandlers[n];if(r)return Qt.setName(o=>r({...o,...this._getTools(o.client)}),r.name)}})}get messageHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._messageHandlers[n]??[],o=this._messageHandlers["*"]??[];return ye.unique([...r,...o]).sort((i,s)=>i.order-s.order).map(({handler:i})=>Qt.setName(s=>i({...s,...this._getTools(s.client)}),i.name))}})}get eventHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._eventHandlers[n]??[],o=Object.entries(this._eventHandlers).filter(([s])=>this._eventResolvesTo(s,n)).flatMap(([,s])=>s??[]),a=this._eventHandlers["*"]??[];return ye.unique([...r,...o,...a]).sort((s,l)=>s.order-l.order).map(({handler:s})=>Qt.setName(l=>s({...l,...this._getTools(l.client)}),s.name))}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._stateExpiredHandlers[n]??[],o=this._stateExpiredHandlers["*"]??[];return ye.unique([...r,...o]).sort((i,s)=>i.order-s.order).map(({handler:i})=>Qt.setName(s=>i({...s,...this._getTools(s.client)}),i.name))}})}get hookHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._hookHandlers[n];if(r)return new Proxy({},{get:(o,a)=>{a=this._stripAliasPrefix(a);let i=r[a]??[],s=Object.entries(r).filter(([p])=>this._eventResolvesTo(p,a)).flatMap(([,p])=>p??[]),l=r["*"]??[];return ye.unique([...i,...s,...l]).sort((p,y)=>p.order-y.order).map(({handler:p})=>Qt.setName(y=>p({...y,...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,a)=>(r[a]?.sort((s,l)=>s.order-l.order)??[]).map(({handler:s})=>Qt.setName(l=>s({...l,...this._getTools(l.client)}),s.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 r=kv(e);if(!r)return!1;let o=Ov(r,this._runtime.interfaces);return Av(o)===n};_stripAliasPrefix=e=>{let{alias:n}=this._runtime;if(!n)return e;let r=`${n}#`;return e.startsWith(r)?e.slice(r.length):e}};C();R();O();C();R();O();C();R();O();C();R();O();C();R();O();C();R();O();export{Rx as BRAND,$l as Bot,Ul as BotDefinition,ai as BotLogger,en as BotSpecificClient,Gn as DIRTY,Ix as EMPTY_PATH,pe as INVALID,Hl as Integration,Qs as IntegrationDefinition,oi as IntegrationLogger,ti as IntegrationSpecificClient,jl as InterfaceDefinition,RP as NEVER,pt as OK,It as ParseInputLazyPath,vt as ParseStatus,zl as Plugin,Kl as PluginDefinition,rU as RuntimeError,he as Schema,QA as WELL_KNOWN_ATTRIBUTES,jr as ZodAny,Kr as ZodArray,$a as ZodBigInt,ja as ZodBoolean,Ka as ZodBranded,La as ZodCatch,Fa as ZodDate,ho as ZodDefault,fg as ZodDiscriminatedUnion,En as ZodEffects,rr as ZodEnum,Kt as ZodError,Yp as ZodFirstPartyTypeKind,pg as ZodFunction,za as ZodIntersection,G as ZodIssueCode,qa as ZodLazy,Ga as ZodLiteral,yg as ZodMap,hg as ZodNaN,Va as ZodNativeEnum,Wr as ZodNever,Ja as ZodNull,Yn as ZodNullable,Xa as ZodNumber,Qn as ZodObject,on as ZodOptional,ne as ZodParsedType,Ya as ZodPipeline,To as ZodPromise,_o as ZodReadonly,Pg as ZodRecord,Eg as ZodRef,he as ZodSchema,Sg as ZodSet,gt as ZodString,Ug as ZodSymbol,En as ZodTransformer,tr as ZodTuple,he as ZodType,bo as ZodUndefined,Qa as ZodUnion,Nr as ZodUnknown,Kg as ZodVoid,te as addIssueToContext,$x as agent,Wx as aimodel,nP as any,aP as array,Xx as bigint,Wg as boolean,wo as botIdHeader,Oy as botUserIdHeader,OP as coerce,xo as configurationHeader,Ny as configurationTypeHeader,Hx as conversation,vo as createZodEnum,Ig as cuid2Regex,kg as cuidRegex,ug as custom,zx as datasource,Yx as date,cP as discriminatedUnion,Gc as effect,Og as emailRegex,bP as enum,ue as errorUtil,jx as event,vP as function,Zr as getErrorMap,rn as getParsedType,Vx as instanceof,Ry as integrationIdHeader,Fx as intent,fP as intersection,Mg as ipv4Regex,Ng as ipv6Regex,Ta as isAborted,nU as isApiError,Si as isAsync,_a as isDirty,Mx as isEmojiRegex,$r as isValid,qx as knowledgebase,Gx as late,TP as lazy,_P as literal,Ei as makeIssue,mP as map,zr as mergeObjectSchemas,Zx as message,Cy as messages,Jx as nan,wP as nativeEnum,iP as never,tP as null,BP as nullable,Fg as number,sP as object,va as objectUtil,CP as oboolean,AP as onumber,Po as operationHeader,PP as optional,IP as ostring,Ct as parseBody,kP as pipeline,SP as preprocess,me as processCreateParams,xP as promise,kx as quotelessJson,yP as readonly,pP as record,gP as ref,zo as serve,hP as set,tg as setErrorMap,lP as strictObject,Lg as string,Qx as symbol,Kx as table,Lx as tablerow,Gc as transformer,zv as transforms,dP as tuple,Dy as typeHeader,Ag as ulidRegex,eP as undefined,uP as union,rP as unknown,Ux as user,be as util,Cg as uuidRegex,Dx as variable,oP as void,My as webhookIdHeader,Y as z};
89
89
  /*! Bundled license information:
90
90
 
91
91
  @jspm/core/nodelibs/browser/chunk-DtuTasat.js: