@botpress/sdk 4.16.0 → 4.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +5 -5
- package/dist/index.cjs +20 -15
- package/dist/index.cjs.map +4 -4
- package/dist/index.mjs +32 -27
- package/dist/index.mjs.map +4 -4
- package/dist/integration/server/types.d.ts +1 -1
- package/package.json +5 -2
package/dist/index.mjs
CHANGED
|
@@ -1,34 +1,39 @@
|
|
|
1
|
-
var Xa=Object.defineProperty;var Hv=Object.getOwnPropertyDescriptor;var Uv=Object.getOwnPropertyNames;var Zv=Object.prototype.hasOwnProperty;var ot=(t,e)=>()=>(t&&(e=t(t=0)),e);var Ln=(t,e)=>{for(var n in e)Xa(t,n,{get:e[n],enumerable:!0})},$v=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Uv(e))!Zv.call(t,a)&&a!==n&&Xa(t,a,{get:()=>e[a],enumerable:!(r=Hv(e,a))||r.enumerable});return t};var jv=t=>$v(Xa({},"__esModule",{value:!0}),t);var C=ot(()=>{});var J={};Ln(J,{_debugEnd:()=>Nu,_debugProcess:()=>Mu,_events:()=>Yu,_eventsCount:()=>Xu,_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:()=>Yl,argv:()=>eu,argv0:()=>zu,assert:()=>ku,binding:()=>au,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:()=>Kt,once:()=>ec,openStdin:()=>Eu,pid:()=>Ku,platform:()=>Xl,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 to(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function Kv(){!Fn||!mn||(Fn=!1,mn.length?jt=mn.concat(jt):li=-1,jt.length&&ql())}function ql(){if(!Fn){var t=setTimeout(Kv,0);Fn=!0;for(var e=jt.length;e;){for(mn=jt,jt=[];++li<e;)mn&&mn[li].run();li=-1,e=jt.length}mn=null,Fn=!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];jt.push(new Vl(t,e)),jt.length===1&&!Fn&&setTimeout(ql,0)}function Vl(t,e){this.fun=t,this.array=e}function lt(){}function pu(t){to("_linkedBinding")}function hu(t){to("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 an.now()/1e3}function ui(t){var e=Math.floor((Date.now()-an.now())*.001),n=an.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+=eo)),[r,a]}function Kt(){return lc}function sc(t){return[]}var jt,Fn,mn,li,Jl,Yl,Xl,Ql,eu,tu,nu,ru,iu,au,ou,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,an,Qa,eo,Ju,Yu,Xu,Qu,ec,tc,nc,rc,ic,ac,oc,lc,uc=ot(()=>{C();R();O();jt=[],Fn=!1,li=-1;Vl.prototype.run=function(){this.fun.apply(null,this.array)};Jl="browser",Yl="x64",Xl="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){to("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,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,an={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};an.now===void 0&&(Qa=Date.now(),an.timing&&an.timing.navigationStart&&(Qa=an.timing.navigationStart),an.now=()=>Date.now()-Qa);eo=1e9;ui.bigint=function(t){var e=ui(t);return typeof BigInt>"u"?e[0]*eo+e[1]:BigInt(e[0]*eo)+BigInt(e[1])};Ju=10,Yu={},Xu=0;Qu=Kt,ec=Kt,tc=Kt,nc=Kt,rc=Kt,ic=lt,ac=Kt,oc=Kt;lc={version:nu,versions:ru,arch:Yl,platform:Xl,browser:cu,release:uu,_rawDebug:fu,moduleLoadList:du,binding:au,_linkedBinding:pu,_events:Yu,_eventsCount:Xu,_maxListeners:Ju,on:Kt,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: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:ou,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=ot(()=>{uc()});function Lv(){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+/",a=0,o=r.length;a<o;++a)t[a]=r[a],e[r.charCodeAt(a)]=a;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 Fv(){if(fc)return fi;fc=!0;return fi.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)},fi.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},fi}function Dt(){if(dc)return hn;dc=!0;let t=Lv(),e=Fv(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;hn.Buffer=i,hn.SlowBuffer=v,hn.INSPECT_MAX_BYTES=50;let r=2147483647;hn.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(xt(m,ArrayBuffer)||m&&xt(m.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(xt(m,SharedArrayBuffer)||m&&xt(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(xt(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"||mr(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(xt(u,Uint8Array)&&(u=i.from(u,u.offset,u.byteLength)),xt(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(xt(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)||xt(m,ArrayBuffer))return m.byteLength;if(typeof m!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof m);let 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 At(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 ht(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=hn.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(xt(u,Uint8Array)&&(u=i.from(u,u.offset,u.byteLength)),!i.isBuffer(u))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof u);if(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: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(mr(Be))return W;m[c+W]=Be}return W}function ge(m,u,c,T){return Nt(Me(u,m.length-c),m,c,T)}function oe(m,u,c,T){return Nt(_e(u),m,c,T)}function re(m,u,c,T){return Nt(At(u),m,c,T)}function Oe(m,u,c,T){return Nt(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 ht(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=Et(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=Et(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=Et(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=Et(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=Et(function(u,c=0){return D(this,u,c,BigInt(0),BigInt("0xffffffffffffffff"))}),i.prototype.writeBigUInt64BE=Et(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=Et(function(u,c=0){return D(this,u,c,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),i.prototype.writeBigInt64BE=Et(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 Y(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)}Y(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 At(m){return t.toByteArray(Q(m))}function Nt(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 xt(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 Et(m){return typeof BigInt>"u"?hr:m}function hr(){throw new Error("BigInt not supported")}return hn}var vr,cc,fi,fc,hn,dc,di=ot(()=>{C();R();O();vr={},cc=!1;fi={},fc=!1;hn={},dc=!1});var vn,q,cA,fA,pc=ot(()=>{C();R();O();di();vn=Dt();vn.Buffer;vn.SlowBuffer;vn.INSPECT_MAX_BYTES;vn.kMaxLength;q=vn.Buffer,cA=vn.INSPECT_MAX_BYTES,fA=vn.kMaxLength});var R=ot(()=>{pc()});function Ht(){return Oy||(Oy=!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,Oy,rs=ot(()=>{C();R();O();ba={},Oy=!1});function Ne(){Ne.init.call(this)}function wa(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function Ky(t){return t._maxListeners===void 0?Ne.defaultMaxListeners:t._maxListeners}function Dy(t,e,n,r){var a,o,i,s;if(wa(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=Ky(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 DB(){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 Hy(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},a=DB.bind(r);return a.listener=n,r.wrapFn=a,a}function Uy(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):Ly(a,a.length)}function Zy(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 Ly(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}var $y,jy,ar,Ry,My,Ny,_t,is=ot(()=>{C();R();O();ar=typeof Reflect=="object"?Reflect:null,Ry=ar&&typeof ar.apply=="function"?ar.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};jy=ar&&typeof ar.ownKeys=="function"?ar.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};My=Number.isNaN||function(t){return t!=t};$y=Ne,Ne.EventEmitter=Ne,Ne.prototype._events=void 0,Ne.prototype._eventsCount=0,Ne.prototype._maxListeners=void 0;Ny=10;Object.defineProperty(Ne,"defaultMaxListeners",{enumerable:!0,get:function(){return Ny},set:function(t){if(typeof t!="number"||t<0||My(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Ny=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||My(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 Ky(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")Ry(s,this,e);else{var l=s.length,f=Ly(s,l);for(n=0;n<l;++n)Ry(f[n],this,e)}return!0},Ne.prototype.addListener=function(t,e){return Dy(this,t,e,!1)},Ne.prototype.on=Ne.prototype.addListener,Ne.prototype.prependListener=function(t,e){return Dy(this,t,e,!0)},Ne.prototype.once=function(t,e){return wa(e),this.on(t,Hy(this,t,e)),this},Ne.prototype.prependOnceListener=function(t,e){return wa(e),this.prependListener(t,Hy(this,t,e)),this},Ne.prototype.removeListener=function(t,e){var n,r,a,o,i;if(wa(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 Uy(this,t,!0)},Ne.prototype.rawListeners=function(t){return Uy(this,t,!1)},Ne.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Zy.call(t,e)},Ne.prototype.listenerCount=Zy,Ne.prototype.eventNames=function(){return this._eventsCount>0?jy(this._events):[]};_t=$y;_t.EventEmitter;_t.defaultMaxListeners;_t.init;_t.listenerCount;_t.EventEmitter;_t.defaultMaxListeners;_t.init;_t.listenerCount});var Fy=ot(()=>{C();R();O();is();_t.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)})};_t.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 us(){throw new Error("setTimeout has not been defined")}function cs(){throw new Error("clearTimeout has not been defined")}function im(t){if(Jt===setTimeout)return setTimeout(t,0);if((Jt===us||!Jt)&&setTimeout)return Jt=setTimeout,setTimeout(t,0);try{return Jt(t,0)}catch{try{return Jt.call(null,t,0)}catch{return Jt.call(this||sr,t,0)}}}function HB(){or&&Dn&&(or=!1,Dn.length?Xt=Dn.concat(Xt):ka=-1,Xt.length&&am())}function am(){if(!or){var t=im(HB);or=!0;for(var e=Xt.length;e;){for(Dn=Xt,Xt=[];++ka<e;)Dn&&Dn[ka].run();ka=-1,e=Xt.length}Dn=null,or=!1,(function(n){if(Yt===clearTimeout)return clearTimeout(n);if((Yt===cs||!Yt)&&clearTimeout)return Yt=clearTimeout,clearTimeout(n);try{Yt(n)}catch{try{return Yt.call(null,n)}catch{return Yt.call(this||sr,n)}}})(t)}}function Wy(t,e){(this||sr).fun=t,(this||sr).array=e}function Vt(){}function Un(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 qy(t){return bt&&Pt?St(t)!==void 0:fm(t)||dm(t)||pm(t)||gm(t)||ym(t)||mm(t)||hm(t)||vm(t)||Tm(t)||_m(t)||bm(t)}function fm(t){return bt&&Pt?St(t)==="Uint8Array":We(t)==="[object Uint8Array]"||qB(t)&&t.buffer!==void 0}function dm(t){return bt&&Pt?St(t)==="Uint8ClampedArray":We(t)==="[object Uint8ClampedArray]"}function pm(t){return bt&&Pt?St(t)==="Uint16Array":We(t)==="[object Uint16Array]"}function gm(t){return bt&&Pt?St(t)==="Uint32Array":We(t)==="[object Uint32Array]"}function ym(t){return bt&&Pt?St(t)==="Int8Array":We(t)==="[object Int8Array]"}function mm(t){return bt&&Pt?St(t)==="Int16Array":We(t)==="[object Int16Array]"}function hm(t){return bt&&Pt?St(t)==="Int32Array":We(t)==="[object Int32Array]"}function vm(t){return bt&&Pt?St(t)==="Float32Array":We(t)==="[object Float32Array]"}function Tm(t){return bt&&Pt?St(t)==="Float64Array":We(t)==="[object Float64Array]"}function _m(t){return bt&&Pt?St(t)==="BigInt64Array":We(t)==="[object BigInt64Array]"}function bm(t){return bt&&Pt?St(t)==="BigUint64Array":We(t)==="[object BigUint64Array]"}function xa(t){return We(t)==="[object Map]"}function Pa(t){return We(t)==="[object Set]"}function Ba(t){return We(t)==="[object WeakMap]"}function as(t){return We(t)==="[object WeakSet]"}function Aa(t){return We(t)==="[object ArrayBuffer]"}function Gy(t){return typeof ArrayBuffer<"u"&&(Aa.working?Aa(t):t instanceof ArrayBuffer)}function Ca(t){return We(t)==="[object DataView]"}function Vy(t){return typeof DataView<"u"&&(Ca.working?Ca(t):t instanceof DataView)}function Oa(t){return We(t)==="[object SharedArrayBuffer]"}function Jy(t){return typeof SharedArrayBuffer<"u"&&(Oa.working?Oa(t):t instanceof SharedArrayBuffer)}function Yy(t){return Jr(t,XB)}function Xy(t){return Jr(t,QB)}function Qy(t){return Jr(t,eE)}function em(t){return cm&&Jr(t,tE)}function tm(t){return ds&&Jr(t,nE)}function fn(t,e){var n={seen:[],stylize:aE};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),Hn(n.showHidden)&&(n.showHidden=!1),Hn(n.depth)&&(n.depth=2),Hn(n.colors)&&(n.colors=!1),Hn(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=iE),Ra(n,t,n.depth)}function iE(t,e){var n=fn.styles[e];return n?"\x1B["+fn.colors[n][0]+"m"+t+"\x1B["+fn.colors[n][1]+"m":t}function aE(t,e){return t}function Ra(t,e,n){if(t.customInspect&&e&&Ia(e.inspect)&&e.inspect!==L.inspect&&(!e.constructor||e.constructor.prototype!==e)){var r=e.inspect(n,t);return Ma(r)||(r=Ra(t,r,n)),r}var a=(function(g,h){if(Hn(h))return g.stylize("undefined","undefined");if(Ma(h)){var w="'"+JSON.stringify(h).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return g.stylize(w,"string")}if(Pm(h))return g.stylize(""+h,"number");if(ps(h))return g.stylize(""+h,"boolean");if(Ha(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)),Vr(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return os(e);if(o.length===0){if(Ia(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(Na(e))return t.stylize(Date.prototype.toString.call(e),"date");if(Vr(e))return os(e)}var l,f="",p=!1,y=["{","}"];return xm(e)&&(p=!0,y=["[","]"]),Ia(e)&&(f=" [Function"+(e.name?": "+e.name:"")+"]"),Gr(e)&&(f=" "+RegExp.prototype.toString.call(e)),Na(e)&&(f=" "+Date.prototype.toUTCString.call(e)),Vr(e)&&(f=" "+os(e)),o.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)Bm(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,o):o.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+
|
|
1
|
+
var Xa=Object.defineProperty;var $v=Object.getOwnPropertyDescriptor;var jv=Object.getOwnPropertyNames;var Kv=Object.prototype.hasOwnProperty;var ot=(t,e)=>()=>(t&&(e=t(t=0)),e);var Ln=(t,e)=>{for(var n in e)Xa(t,n,{get:e[n],enumerable:!0})},Lv=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of jv(e))!Kv.call(t,a)&&a!==n&&Xa(t,a,{get:()=>e[a],enumerable:!(r=$v(e,a))||r.enumerable});return t};var Fv=t=>Lv(Xa({},"__esModule",{value:!0}),t);var O=ot(()=>{});var J={};Ln(J,{_debugEnd:()=>Du,_debugProcess:()=>Nu,_events:()=>Xu,_eventsCount:()=>Qu,_exiting:()=>mu,_fatalExceptions:()=>Cu,_getActiveHandles:()=>_u,_getActiveRequests:()=>Tu,_kill:()=>wu,_linkedBinding:()=>gu,_maxListeners:()=>Yu,_preload_modules:()=>Gu,_rawDebug:()=>du,_startProfilerIdleNotifier:()=>Hu,_stopProfilerIdleNotifier:()=>Uu,_tickCallback:()=>Mu,abort:()=>Ku,addListener:()=>ec,allowedNodeEnvironmentFlags:()=>ku,arch:()=>Xl,argv:()=>tu,argv0:()=>qu,assert:()=>Iu,binding:()=>ou,browser:()=>fu,chdir:()=>uu,config:()=>hu,cpuUsage:()=>fi,cwd:()=>lu,debugPort:()=>zu,default:()=>uc,dlopen:()=>vu,domain:()=>yu,emit:()=>ac,emitWarning:()=>au,env:()=>eu,execArgv:()=>nu,execPath:()=>Wu,exit:()=>Eu,features:()=>Au,hasUncaughtExceptionCaptureCallback:()=>Ru,hrtime:()=>ci,kill:()=>Bu,listeners:()=>lc,memoryUsage:()=>Pu,moduleLoadList:()=>pu,nextTick:()=>Vl,off:()=>nc,on:()=>Kt,once:()=>tc,openStdin:()=>Su,pid:()=>Lu,platform:()=>Ql,ppid:()=>Fu,prependListener:()=>oc,prependOnceListener:()=>sc,reallyExit:()=>bu,release:()=>cu,removeAllListeners:()=>ic,removeListener:()=>rc,resourceUsage:()=>xu,setSourceMapsEnabled:()=>Vu,setUncaughtExceptionCaptureCallback:()=>Ou,stderr:()=>$u,stdin:()=>ju,stdout:()=>Zu,title:()=>Yl,umask:()=>su,uptime:()=>Ju,version:()=>ru,versions:()=>iu});function to(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function Wv(){!Fn||!mn||(Fn=!1,mn.length?jt=mn.concat(jt):ui=-1,jt.length&&Gl())}function Gl(){if(!Fn){var t=setTimeout(Wv,0);Fn=!0;for(var e=jt.length;e;){for(mn=jt,jt=[];++ui<e;)mn&&mn[ui].run();ui=-1,e=jt.length}mn=null,Fn=!1,clearTimeout(t)}}function Vl(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 Jl(t,e)),jt.length===1&&!Fn&&setTimeout(Gl,0)}function Jl(t,e){this.fun=t,this.array=e}function lt(){}function gu(t){to("_linkedBinding")}function vu(t){to("dlopen")}function Tu(){return[]}function _u(){return[]}function Iu(t,e){if(!t)throw new Error(e||"assertion error")}function Ru(){return!1}function Ju(){return an.now()/1e3}function ci(t){var e=Math.floor((Date.now()-an.now())*.001),n=an.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+=eo)),[r,a]}function Kt(){return uc}function lc(t){return[]}var jt,Fn,mn,ui,Yl,Xl,Ql,eu,tu,nu,ru,iu,au,ou,su,lu,uu,cu,fu,du,pu,yu,mu,hu,bu,wu,fi,xu,Pu,Bu,Eu,Su,ku,Au,Cu,Ou,Mu,Nu,Du,Hu,Uu,Zu,$u,ju,Ku,Lu,Fu,Wu,zu,qu,Gu,Vu,an,Qa,eo,Yu,Xu,Qu,ec,tc,nc,rc,ic,ac,oc,sc,uc,cc=ot(()=>{O();M();R();jt=[],Fn=!1,ui=-1;Jl.prototype.run=function(){this.fun.apply(null,this.array)};Yl="browser",Xl="x64",Ql="browser",eu={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},tu=["/usr/bin/node"],nu=[],ru="v16.8.0",iu={},au=function(t,e){console.warn((e?e+": ":"")+t)},ou=function(t){to("binding")},su=function(t){return 0},lu=function(){return"/"},uu=function(t){},cu={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};fu=!0,du=lt,pu=[];yu={},mu=!1,hu={};bu=lt,wu=lt,fi=function(){return{}},xu=fi,Pu=fi,Bu=lt,Eu=lt,Su=lt,ku={};Au={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Cu=lt,Ou=lt;Mu=lt,Nu=lt,Du=lt,Hu=lt,Uu=lt,Zu=void 0,$u=void 0,ju=void 0,Ku=lt,Lu=2,Fu=1,Wu="/bin/usr/node",zu=9229,qu="node",Gu=[],Vu=lt,an={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};an.now===void 0&&(Qa=Date.now(),an.timing&&an.timing.navigationStart&&(Qa=an.timing.navigationStart),an.now=()=>Date.now()-Qa);eo=1e9;ci.bigint=function(t){var e=ci(t);return typeof BigInt>"u"?e[0]*eo+e[1]:BigInt(e[0]*eo)+BigInt(e[1])};Yu=10,Xu={},Qu=0;ec=Kt,tc=Kt,nc=Kt,rc=Kt,ic=Kt,ac=lt,oc=Kt,sc=Kt;uc={version:ru,versions:iu,arch:Xl,platform:Ql,browser:fu,release:cu,_rawDebug:du,moduleLoadList:pu,binding:ou,_linkedBinding:gu,_events:Xu,_eventsCount:Qu,_maxListeners:Yu,on:Kt,addListener:ec,once:tc,off:nc,removeListener:rc,removeAllListeners:ic,emit:ac,prependListener:oc,prependOnceListener:sc,listeners:lc,domain:yu,_exiting:mu,config:hu,dlopen:vu,uptime:Ju,_getActiveRequests:Tu,_getActiveHandles:_u,reallyExit:bu,_kill:wu,cpuUsage:fi,resourceUsage:xu,memoryUsage:Pu,kill:Bu,exit:Eu,openStdin:Su,allowedNodeEnvironmentFlags:ku,assert:Iu,features:Au,_fatalExceptions:Cu,setUncaughtExceptionCaptureCallback:Ou,hasUncaughtExceptionCaptureCallback:Ru,emitWarning:au,nextTick:Vl,_tickCallback:Mu,_debugProcess:Nu,_debugEnd:Du,_startProfilerIdleNotifier:Hu,_stopProfilerIdleNotifier:Uu,stdout:Zu,stdin:ju,stderr:$u,abort:Ku,umask:su,chdir:uu,cwd:lu,env:eu,title:Yl,argv:tu,execArgv:nu,pid:Lu,ppid:Fu,execPath:Wu,debugPort:zu,hrtime:ci,argv0:qu,_preload_modules:Gu,setSourceMapsEnabled:Vu}});var R=ot(()=>{cc()});function zv(){if(fc)return vr;fc=!0,vr.byteLength=s,vr.toByteArray=f,vr.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[45]=62,e[95]=63;function i(h){var v=h.length;if(v%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var P=h.indexOf("=");P===-1&&(P=v);var B=P===v?0:4-P%4;return[P,B]}function s(h){var v=i(h),P=v[0],B=v[1];return(P+B)*3/4-B}function l(h,v,P){return(v+P)*3/4-P}function f(h){var v,P=i(h),B=P[0],T=P[1],S=new n(l(h,B,T)),E=0,H=T>0?B-4:B,j;for(j=0;j<H;j+=4)v=e[h.charCodeAt(j)]<<18|e[h.charCodeAt(j+1)]<<12|e[h.charCodeAt(j+2)]<<6|e[h.charCodeAt(j+3)],S[E++]=v>>16&255,S[E++]=v>>8&255,S[E++]=v&255;return T===2&&(v=e[h.charCodeAt(j)]<<2|e[h.charCodeAt(j+1)]>>4,S[E++]=v&255),T===1&&(v=e[h.charCodeAt(j)]<<10|e[h.charCodeAt(j+1)]<<4|e[h.charCodeAt(j+2)]>>2,S[E++]=v>>8&255,S[E++]=v&255),S}function p(h){return t[h>>18&63]+t[h>>12&63]+t[h>>6&63]+t[h&63]}function y(h,v,P){for(var B,T=[],S=v;S<P;S+=3)B=(h[S]<<16&16711680)+(h[S+1]<<8&65280)+(h[S+2]&255),T.push(p(B));return T.join("")}function g(h){for(var v,P=h.length,B=P%3,T=[],S=16383,E=0,H=P-B;E<H;E+=S)T.push(y(h,E,E+S>H?H:E+S));return B===1?(v=h[P-1],T.push(t[v>>2]+t[v<<4&63]+"==")):B===2&&(v=(h[P-2]<<8)+h[P-1],T.push(t[v>>10]+t[v>>4&63]+t[v<<2&63]+"=")),T.join("")}return vr}function qv(){if(dc)return di;dc=!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,v=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+=v,s/=256,a-=8);for(i=i<<a|s,f+=a;f>0;t[n+h]=i&255,h+=v,i/=256,f-=8);t[n+h-v]|=P*128},di}function Dt(){if(pc)return hn;pc=!0;let t=zv(),e=qv(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;hn.Buffer=i,hn.SlowBuffer=T,hn.INSPECT_MAX_BYTES=50;let r=2147483647;hn.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(xt(m,ArrayBuffer)||m&&xt(m.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(xt(m,SharedArrayBuffer)||m&&xt(m.buffer,SharedArrayBuffer)))return v(m,u,c);if(typeof m=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let _=m.valueOf&&m.valueOf();if(_!=null&&_!==m)return i.from(_,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,_=o(c),I=_.write(m,u);return I!==c&&(_=_.slice(0,I)),_}function g(m){let u=m.length<0?0:B(m.length)|0,c=o(u);for(let _=0;_<u;_+=1)c[_]=m[_]&255;return c}function h(m){if(xt(m,Uint8Array)){let u=new Uint8Array(m);return v(u.buffer,u.byteOffset,u.byteLength)}return g(m)}function v(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 _;return u===void 0&&c===void 0?_=new Uint8Array(m):c===void 0?_=new Uint8Array(m,u):_=new Uint8Array(m,u,c),Object.setPrototypeOf(_,i.prototype),_}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"||mr(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 T(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(xt(u,Uint8Array)&&(u=i.from(u,u.offset,u.byteLength)),xt(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 _=u.length,I=c.length;for(let U=0,W=Math.min(_,I);U<W;++U)if(u[U]!==c[U]){_=u[U],I=c[U];break}return _<I?-1:I<_?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 _;if(c===void 0)for(c=0,_=0;_<u.length;++_)c+=u[_].length;let I=i.allocUnsafe(c),U=0;for(_=0;_<u.length;++_){let W=u[_];if(xt(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)||xt(m,ArrayBuffer))return m.byteLength;if(typeof m!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof m);let c=m.length,_=arguments.length>2&&arguments[2]===!0;if(!_&&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 Ct(m).length;default:if(I)return _?-1:Me(m).length;u=(""+u).toLowerCase(),I=!0}}i.byteLength=S;function E(m,u,c){let _=!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 ht(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(_)throw new TypeError("Unknown encoding: "+m);m=(m+"").toLowerCase(),_=!0}}i.prototype._isBuffer=!0;function H(m,u,c){let _=m[u];m[u]=m[c],m[c]=_}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=hn.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,_,I,U){if(xt(u,Uint8Array)&&(u=i.from(u,u.offset,u.byteLength)),!i.isBuffer(u))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof u);if(c===void 0&&(c=0),_===void 0&&(_=u?u.length:0),I===void 0&&(I=0),U===void 0&&(U=this.length),c<0||_>u.length||I<0||U>this.length)throw new RangeError("out of range index");if(I>=U&&c>=_)return 0;if(I>=U)return-1;if(c>=_)return 1;if(c>>>=0,_>>>=0,I>>>=0,U>>>=0,this===u)return 0;let W=U-I,Be=_-c,qe=Math.min(W,Be),$e=this.slice(I,U),Ge=u.slice(c,_);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 j(m,u,c,_,I){if(m.length===0)return-1;if(typeof c=="string"?(_=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,_)),i.isBuffer(u))return u.length===0?-1:re(m,u,c,_,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):re(m,[u],c,_,I);throw new TypeError("val must be string, number or Buffer")}function re(m,u,c,_,I){let U=1,W=m.length,Be=u.length;if(_!==void 0&&(_=String(_).toLowerCase(),_==="ucs2"||_==="ucs-2"||_==="utf16le"||_==="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,_){return this.indexOf(u,c,_)!==-1},i.prototype.indexOf=function(u,c,_){return j(this,u,c,_,!0)},i.prototype.lastIndexOf=function(u,c,_){return j(this,u,c,_,!1)};function ee(m,u,c,_){c=Number(c)||0;let I=m.length-c;_?(_=Number(_),_>I&&(_=I)):_=I;let U=u.length;_>U/2&&(_=U/2);let W;for(W=0;W<_;++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,_){return Nt(Me(u,m.length-c),m,c,_)}function oe(m,u,c,_){return Nt(_e(u),m,c,_)}function ie(m,u,c,_){return Nt(Ct(u),m,c,_)}function Oe(m,u,c,_){return Nt(Z(u,m.length-c),m,c,_)}i.prototype.write=function(u,c,_,I){if(c===void 0)I="utf8",_=this.length,c=0;else if(_===void 0&&typeof c=="string")I=c,_=this.length,c=0;else if(isFinite(c))c=c>>>0,isFinite(_)?(_=_>>>0,I===void 0&&(I="utf8")):(I=_,_=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let U=this.length-c;if((_===void 0||_>U)&&(_=U),u.length>0&&(_<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,_);case"utf8":case"utf-8":return ge(this,u,c,_);case"ascii":case"latin1":case"binary":return oe(this,u,c,_);case"base64":return ie(this,u,c,_);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Oe(this,u,c,_);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 _=[],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,_.push(W>>>10&1023|55296),W=56320|W&1023),_.push(W),I+=Be}return Je(_)}let Ve=4096;function Je(m){let u=m.length;if(u<=Ve)return String.fromCharCode.apply(String,m);let c="",_=0;for(;_<u;)c+=String.fromCharCode.apply(String,m.slice(_,_+=Ve));return c}function ht(m,u,c){let _="";c=Math.min(m.length,c);for(let I=u;I<c;++I)_+=String.fromCharCode(m[I]&127);return _}function Ue(m,u,c){let _="";c=Math.min(m.length,c);for(let I=u;I<c;++I)_+=String.fromCharCode(m[I]);return _}function Pe(m,u,c){let _=m.length;(!u||u<0)&&(u=0),(!c||c<0||c>_)&&(c=_);let I="";for(let U=u;U<c;++U)I+=li[m[U]];return I}function Se(m,u,c){let _=m.slice(u,c),I="";for(let U=0;U<_.length-1;U+=2)I+=String.fromCharCode(_[U]+_[U+1]*256);return I}i.prototype.slice=function(u,c){let _=this.length;u=~~u,c=c===void 0?_:~~c,u<0?(u+=_,u<0&&(u=0)):u>_&&(u=_),c<0?(c+=_,c<0&&(c=0)):c>_&&(c=_),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,_){u=u>>>0,c=c>>>0,_||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,_){u=u>>>0,c=c>>>0,_||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=Et(function(u){u=u>>>0,w(u,"offset");let c=this[u],_=this[u+7];(c===void 0||_===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+_*2**24;return BigInt(I)+(BigInt(U)<<BigInt(32))}),i.prototype.readBigUInt64BE=Et(function(u){u=u>>>0,w(u,"offset");let c=this[u],_=this[u+7];(c===void 0||_===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+_;return(BigInt(I)<<BigInt(32))+BigInt(U)}),i.prototype.readIntLE=function(u,c,_){u=u>>>0,c=c>>>0,_||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,_){u=u>>>0,c=c>>>0,_||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 _=this[u]|this[u+1]<<8;return _&32768?_|4294901760:_},i.prototype.readInt16BE=function(u,c){u=u>>>0,c||fe(u,2,this.length);let _=this[u+1]|this[u]<<8;return _&32768?_|4294901760:_},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=Et(function(u){u=u>>>0,w(u,"offset");let c=this[u],_=this[u+7];(c===void 0||_===void 0)&&x(u,this.length-8);let I=this[u+4]+this[u+5]*2**8+this[u+6]*2**16+(_<<24);return(BigInt(I)<<BigInt(32))+BigInt(c+this[++u]*2**8+this[++u]*2**16+this[++u]*2**24)}),i.prototype.readBigInt64BE=Et(function(u){u=u>>>0,w(u,"offset");let c=this[u],_=this[u+7];(c===void 0||_===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+_)}),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,_,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+_>m.length)throw new RangeError("Index out of range")}i.prototype.writeUintLE=i.prototype.writeUIntLE=function(u,c,_,I){if(u=+u,c=c>>>0,_=_>>>0,!I){let Be=Math.pow(2,8*_)-1;ve(this,u,c,_,Be,0)}let U=1,W=0;for(this[c]=u&255;++W<_&&(U*=256);)this[c+W]=u/U&255;return c+_},i.prototype.writeUintBE=i.prototype.writeUIntBE=function(u,c,_,I){if(u=+u,c=c>>>0,_=_>>>0,!I){let Be=Math.pow(2,8*_)-1;ve(this,u,c,_,Be,0)}let U=_-1,W=1;for(this[c+U]=u&255;--U>=0&&(W*=256);)this[c+U]=u/W&255;return c+_},i.prototype.writeUint8=i.prototype.writeUInt8=function(u,c,_){return u=+u,c=c>>>0,_||ve(this,u,c,1,255,0),this[c]=u&255,c+1},i.prototype.writeUint16LE=i.prototype.writeUInt16LE=function(u,c,_){return u=+u,c=c>>>0,_||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,_){return u=+u,c=c>>>0,_||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,_){return u=+u,c=c>>>0,_||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,_){return u=+u,c=c>>>0,_||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,_,I){ae(u,_,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 K(m,u,c,_,I){ae(u,_,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=Et(function(u,c=0){return D(this,u,c,BigInt(0),BigInt("0xffffffffffffffff"))}),i.prototype.writeBigUInt64BE=Et(function(u,c=0){return K(this,u,c,BigInt(0),BigInt("0xffffffffffffffff"))}),i.prototype.writeIntLE=function(u,c,_,I){if(u=+u,c=c>>>0,!I){let qe=Math.pow(2,8*_-1);ve(this,u,c,_,qe-1,-qe)}let U=0,W=1,Be=0;for(this[c]=u&255;++U<_&&(W*=256);)u<0&&Be===0&&this[c+U-1]!==0&&(Be=1),this[c+U]=(u/W>>0)-Be&255;return c+_},i.prototype.writeIntBE=function(u,c,_,I){if(u=+u,c=c>>>0,!I){let qe=Math.pow(2,8*_-1);ve(this,u,c,_,qe-1,-qe)}let U=_-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+_},i.prototype.writeInt8=function(u,c,_){return u=+u,c=c>>>0,_||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,_){return u=+u,c=c>>>0,_||ve(this,u,c,2,32767,-32768),this[c]=u&255,this[c+1]=u>>>8,c+2},i.prototype.writeInt16BE=function(u,c,_){return u=+u,c=c>>>0,_||ve(this,u,c,2,32767,-32768),this[c]=u>>>8,this[c+1]=u&255,c+2},i.prototype.writeInt32LE=function(u,c,_){return u=+u,c=c>>>0,_||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,_){return u=+u,c=c>>>0,_||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=Et(function(u,c=0){return D(this,u,c,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),i.prototype.writeBigInt64BE=Et(function(u,c=0){return K(this,u,c,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function F(m,u,c,_,I,U){if(c+_>m.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("Index out of range")}function de(m,u,c,_,I){return u=+u,c=c>>>0,I||F(m,u,c,4),e.write(m,u,c,_,23,4),c+4}i.prototype.writeFloatLE=function(u,c,_){return de(this,u,c,!0,_)},i.prototype.writeFloatBE=function(u,c,_){return de(this,u,c,!1,_)};function Te(m,u,c,_,I){return u=+u,c=c>>>0,I||F(m,u,c,8),e.write(m,u,c,_,52,8),c+8}i.prototype.writeDoubleLE=function(u,c,_){return Te(this,u,c,!0,_)},i.prototype.writeDoubleBE=function(u,c,_){return Te(this,u,c,!1,_)},i.prototype.copy=function(u,c,_,I){if(!i.isBuffer(u))throw new TypeError("argument should be a Buffer");if(_||(_=0),!I&&I!==0&&(I=this.length),c>=u.length&&(c=u.length),c||(c=0),I>0&&I<_&&(I=_),I===_||u.length===0||this.length===0)return 0;if(c<0)throw new RangeError("targetStart out of bounds");if(_<0||_>=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-_&&(I=u.length-c+_);let U=I-_;return this===u&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(c,_,I):Uint8Array.prototype.set.call(u,this.subarray(_,I),c),U},i.prototype.fill=function(u,c,_,I){if(typeof u=="string"){if(typeof c=="string"?(I=c,c=0,_=this.length):typeof _=="string"&&(I=_,_=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<_)throw new RangeError("Out of range index");if(_<=c)return this;c=c>>>0,_=_===void 0?this.length:_>>>0,u||(u=0);let U;if(typeof u=="number")for(U=c;U<_;++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<_-c;++U)this[U+c]=W[U%Be]}return this};let C={};function k(m,u,c){C[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 _=`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"),_+=` It must be ${u}. Received ${I}`,_},RangeError);function $(m){let u="",c=m.length,_=m[0]==="-"?1:0;for(;c>=_+4;c-=3)u=`_${m.slice(c-3,c)}${u}`;return`${m.slice(0,c)}${u}`}function Y(m,u,c){w(u,"offset"),(m[u]===void 0||m[u+c]===void 0)&&x(u,m.length-(c+1))}function ae(m,u,c,_,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 C.ERR_OUT_OF_RANGE("value",Be,m)}Y(_,I,U)}function w(m,u){if(typeof m!="number")throw new C.ERR_INVALID_ARG_TYPE(u,"number",m)}function x(m,u,c){throw Math.floor(m)!==m?(w(m,c),new C.ERR_OUT_OF_RANGE("offset","an integer",m)):u<0?new C.ERR_BUFFER_OUT_OF_BOUNDS:new C.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,_=m.length,I=null,U=[];for(let W=0;W<_;++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===_){(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,_,I,U=[];for(let W=0;W<m.length&&!((u-=2)<0);++W)c=m.charCodeAt(W),_=c>>8,I=c%256,U.push(I),U.push(_);return U}function Ct(m){return t.toByteArray(Q(m))}function Nt(m,u,c,_){let I;for(I=0;I<_&&!(I+c>=u.length||I>=m.length);++I)u[I+c]=m[I];return I}function xt(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 li=(function(){let m="0123456789abcdef",u=new Array(256);for(let c=0;c<16;++c){let _=c*16;for(let I=0;I<16;++I)u[_+I]=m[c]+m[I]}return u})();function Et(m){return typeof BigInt>"u"?hr:m}function hr(){throw new Error("BigInt not supported")}return hn}var vr,fc,di,dc,hn,pc,pi=ot(()=>{O();M();R();vr={},fc=!1;di={},dc=!1;hn={},pc=!1});var vn,q,gA,yA,gc=ot(()=>{O();M();R();pi();vn=Dt();vn.Buffer;vn.SlowBuffer;vn.INSPECT_MAX_BYTES;vn.kMaxLength;q=vn.Buffer,gA=vn.INSPECT_MAX_BYTES,yA=vn.kMaxLength});var M=ot(()=>{gc()});function Ht(){return Ny||(Ny=!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,Ny,is=ot(()=>{O();M();R();ba={},Ny=!1});function Ne(){Ne.init.call(this)}function wa(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function Wy(t){return t._maxListeners===void 0?Ne.defaultMaxListeners:t._maxListeners}function Zy(t,e,n,r){var a,o,i,s;if(wa(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=Wy(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 $B(){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 $y(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},a=$B.bind(r);return a.listener=n,r.wrapFn=a,a}function jy(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):zy(a,a.length)}function Ky(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 zy(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}var Ly,Fy,ar,Dy,Hy,Uy,_t,as=ot(()=>{O();M();R();ar=typeof Reflect=="object"?Reflect:null,Dy=ar&&typeof ar.apply=="function"?ar.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};Fy=ar&&typeof ar.ownKeys=="function"?ar.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};Hy=Number.isNaN||function(t){return t!=t};Ly=Ne,Ne.EventEmitter=Ne,Ne.prototype._events=void 0,Ne.prototype._eventsCount=0,Ne.prototype._maxListeners=void 0;Uy=10;Object.defineProperty(Ne,"defaultMaxListeners",{enumerable:!0,get:function(){return Uy},set:function(t){if(typeof t!="number"||t<0||Hy(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Uy=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||Hy(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 Wy(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")Dy(s,this,e);else{var l=s.length,f=zy(s,l);for(n=0;n<l;++n)Dy(f[n],this,e)}return!0},Ne.prototype.addListener=function(t,e){return Zy(this,t,e,!1)},Ne.prototype.on=Ne.prototype.addListener,Ne.prototype.prependListener=function(t,e){return Zy(this,t,e,!0)},Ne.prototype.once=function(t,e){return wa(e),this.on(t,$y(this,t,e)),this},Ne.prototype.prependOnceListener=function(t,e){return wa(e),this.prependListener(t,$y(this,t,e)),this},Ne.prototype.removeListener=function(t,e){var n,r,a,o,i;if(wa(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 jy(this,t,!0)},Ne.prototype.rawListeners=function(t){return jy(this,t,!1)},Ne.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Ky.call(t,e)},Ne.prototype.listenerCount=Ky,Ne.prototype.eventNames=function(){return this._eventsCount>0?Fy(this._events):[]};_t=Ly;_t.EventEmitter;_t.defaultMaxListeners;_t.init;_t.listenerCount;_t.EventEmitter;_t.defaultMaxListeners;_t.init;_t.listenerCount});var qy=ot(()=>{O();M();R();as();_t.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)})};_t.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 sm(t){if(Jt===setTimeout)return setTimeout(t,0);if((Jt===cs||!Jt)&&setTimeout)return Jt=setTimeout,setTimeout(t,0);try{return Jt(t,0)}catch{try{return Jt.call(null,t,0)}catch{return Jt.call(this||sr,t,0)}}}function jB(){or&&Dn&&(or=!1,Dn.length?Xt=Dn.concat(Xt):ka=-1,Xt.length&&lm())}function lm(){if(!or){var t=sm(jB);or=!0;for(var e=Xt.length;e;){for(Dn=Xt,Xt=[];++ka<e;)Dn&&Dn[ka].run();ka=-1,e=Xt.length}Dn=null,or=!1,(function(n){if(Yt===clearTimeout)return clearTimeout(n);if((Yt===fs||!Yt)&&clearTimeout)return Yt=clearTimeout,clearTimeout(n);try{Yt(n)}catch{try{return Yt.call(null,n)}catch{return Yt.call(this||sr,n)}}})(t)}}function Gy(t,e){(this||sr).fun=t,(this||sr).array=e}function Vt(){}function Un(t){return t.call.bind(t)}function Yr(t,e){if(typeof t!="object")return!1;try{return e(t),!0}catch{return!1}}function Jy(t){return bt&&Pt?St(t)!==void 0:gm(t)||ym(t)||mm(t)||hm(t)||vm(t)||Tm(t)||_m(t)||bm(t)||wm(t)||xm(t)||Pm(t)}function gm(t){return bt&&Pt?St(t)==="Uint8Array":We(t)==="[object Uint8Array]"||YB(t)&&t.buffer!==void 0}function ym(t){return bt&&Pt?St(t)==="Uint8ClampedArray":We(t)==="[object Uint8ClampedArray]"}function mm(t){return bt&&Pt?St(t)==="Uint16Array":We(t)==="[object Uint16Array]"}function hm(t){return bt&&Pt?St(t)==="Uint32Array":We(t)==="[object Uint32Array]"}function vm(t){return bt&&Pt?St(t)==="Int8Array":We(t)==="[object Int8Array]"}function Tm(t){return bt&&Pt?St(t)==="Int16Array":We(t)==="[object Int16Array]"}function _m(t){return bt&&Pt?St(t)==="Int32Array":We(t)==="[object Int32Array]"}function bm(t){return bt&&Pt?St(t)==="Float32Array":We(t)==="[object Float32Array]"}function wm(t){return bt&&Pt?St(t)==="Float64Array":We(t)==="[object Float64Array]"}function xm(t){return bt&&Pt?St(t)==="BigInt64Array":We(t)==="[object BigInt64Array]"}function Pm(t){return bt&&Pt?St(t)==="BigUint64Array":We(t)==="[object BigUint64Array]"}function xa(t){return We(t)==="[object Map]"}function Pa(t){return We(t)==="[object Set]"}function Ba(t){return We(t)==="[object WeakMap]"}function os(t){return We(t)==="[object WeakSet]"}function Aa(t){return We(t)==="[object ArrayBuffer]"}function Yy(t){return typeof ArrayBuffer<"u"&&(Aa.working?Aa(t):t instanceof ArrayBuffer)}function Ca(t){return We(t)==="[object DataView]"}function Xy(t){return typeof DataView<"u"&&(Ca.working?Ca(t):t instanceof DataView)}function Oa(t){return We(t)==="[object SharedArrayBuffer]"}function Qy(t){return typeof SharedArrayBuffer<"u"&&(Oa.working?Oa(t):t instanceof SharedArrayBuffer)}function em(t){return Yr(t,nE)}function tm(t){return Yr(t,rE)}function nm(t){return Yr(t,iE)}function rm(t){return pm&&Yr(t,aE)}function im(t){return ps&&Yr(t,oE)}function fn(t,e){var n={seen:[],stylize:uE};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),Hn(n.showHidden)&&(n.showHidden=!1),Hn(n.depth)&&(n.depth=2),Hn(n.colors)&&(n.colors=!1),Hn(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=lE),Ra(n,t,n.depth)}function lE(t,e){var n=fn.styles[e];return n?"\x1B["+fn.colors[n][0]+"m"+t+"\x1B["+fn.colors[n][1]+"m":t}function uE(t,e){return t}function Ra(t,e,n){if(t.customInspect&&e&&Ia(e.inspect)&&e.inspect!==L.inspect&&(!e.constructor||e.constructor.prototype!==e)){var r=e.inspect(n,t);return Ma(r)||(r=Ra(t,r,n)),r}var a=(function(g,h){if(Hn(h))return g.stylize("undefined","undefined");if(Ma(h)){var v="'"+JSON.stringify(h).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return g.stylize(v,"string")}if(Sm(h))return g.stylize(""+h,"number");if(gs(h))return g.stylize(""+h,"boolean");if(Ha(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(v,P){h[v]=!0})),h})(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),Jr(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return ss(e);if(o.length===0){if(Ia(e)){var s=e.name?": "+e.name:"";return t.stylize("[Function"+s+"]","special")}if(Vr(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(Na(e))return t.stylize(Date.prototype.toString.call(e),"date");if(Jr(e))return ss(e)}var l,f="",p=!1,y=["{","}"];return Em(e)&&(p=!0,y=["[","]"]),Ia(e)&&(f=" [Function"+(e.name?": "+e.name:"")+"]"),Vr(e)&&(f=" "+RegExp.prototype.toString.call(e)),Na(e)&&(f=" "+Date.prototype.toUTCString.call(e)),Jr(e)&&(f=" "+ss(e)),o.length!==0||p&&e.length!=0?n<0?Vr(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),l=p?(function(g,h,v,P,B){for(var T=[],S=0,E=h.length;S<E;++S)km(h,String(S))?T.push(ls(g,h,v,P,String(S),!0)):T.push("");return B.forEach((function(H){H.match(/^\d+$/)||T.push(ls(g,h,v,P,H,!0))})),T})(t,e,n,i,o):o.map((function(g){return ls(t,e,n,i,g,p)})),t.seen.pop(),(function(g,h,v){var P=0;return g.reduce((function(B,T){return P++,T.indexOf(`
|
|
2
|
+
`)>=0&&P++,B+T.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60?v[0]+(h===""?"":h+`
|
|
3
3
|
`)+" "+g.join(`,
|
|
4
|
-
`)+" "+
|
|
4
|
+
`)+" "+v[1]:v[0]+h+" "+g.join(", ")+" "+v[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")),km(r,a)||(i="["+a+"]"),s||(t.seen.indexOf(l.value)<0?(s=Ha(n)?Ra(t,l.value,null):Ra(t,l.value,n-1)).indexOf(`
|
|
5
5
|
`)>-1&&(s=o?s.split(`
|
|
6
6
|
`).map((function(f){return" "+f})).join(`
|
|
7
7
|
`).substr(2):`
|
|
8
8
|
`+s.split(`
|
|
9
9
|
`).map((function(f){return" "+f})).join(`
|
|
10
|
-
`)):s=t.stylize("[Circular]","special")),Hn(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 xm(t){return Array.isArray(t)}function ps(t){return typeof t=="boolean"}function Ha(t){return t===null}function Pm(t){return typeof t=="number"}function Ma(t){return typeof t=="string"}function Hn(t){return t===void 0}function Gr(t){return lr(t)&&gs(t)==="[object RegExp]"}function lr(t){return typeof t=="object"&&t!==null}function Na(t){return lr(t)&&gs(t)==="[object Date]"}function Vr(t){return lr(t)&&(gs(t)==="[object Error]"||t instanceof Error)}function Ia(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 sE(){var t=new Date,e=[ls(t.getHours()),ls(t.getMinutes()),ls(t.getSeconds())].join(":");return[t.getDate(),oE[t.getMonth()],e].join(" ")}function Bm(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function lE(t,e){if(!t){var n=new Error("Promise was rejected with a falsy value");n.reason=t,t=n}return e(t)}var rm,Jt,Yt,sr,Qe,Dn,Xt,or,ka,je,UB,fs,Da,om,ZB,$B,jB,KB,LB,sm,lm,zy,FB,WB,zB,um,Ee,qB,GB,VB,cm,ds,Pt,bt,JB,We,XB,QB,eE,qr,L,Ut,nm,rE,Ea,wm,Sa,oE,Nn,_C,Ua=ot(()=>{C();R();O();sr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,Qe=rm={};(function(){try{Jt=typeof setTimeout=="function"?setTimeout:us}catch{Jt=us}try{Yt=typeof clearTimeout=="function"?clearTimeout:cs}catch{Yt=cs}})();Xt=[],or=!1,ka=-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];Xt.push(new Wy(t,e)),Xt.length!==1||or||im(am)},Wy.prototype.run=function(){(this||sr).fun.apply(null,(this||sr).array)},Qe.title="browser",Qe.browser=!0,Qe.env={},Qe.argv=[],Qe.version="",Qe.versions={},Qe.on=Vt,Qe.addListener=Vt,Qe.once=Vt,Qe.off=Vt,Qe.removeListener=Vt,Qe.removeAllListeners=Vt,Qe.emit=Vt,Qe.prependListener=Vt,Qe.prependOnceListener=Vt,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=rm;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;UB=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",fs=Object.prototype.toString,Da=function(t){return!(UB&&t&&typeof t=="object"&&Symbol.toStringTag in t)&&fs.call(t)==="[object Arguments]"},om=function(t){return!!Da(t)||t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&fs.call(t)!=="[object Array]"&&fs.call(t.callee)==="[object Function]"},ZB=(function(){return Da(arguments)})();Da.isLegacyArguments=om;$B=ZB?Da:om,jB=Object.prototype.toString,KB=Function.prototype.toString,LB=/^\s*(?:function)?\*/,sm=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",lm=Object.getPrototypeOf,zy=(function(){if(!sm)return!1;try{return Function("return function*() {}")()}catch{}})(),FB=zy?lm(zy):{},WB=function(t){return typeof t=="function"&&(!!LB.test(KB.call(t))||(sm?lm(t)===FB:jB.call(t)==="[object GeneratorFunction]"))},zB=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}},um=function(t){return t&&typeof t=="object"&&typeof t.copy=="function"&&typeof t.fill=="function"&&typeof t.readUInt8=="function"},Ee={},qB=um,GB=$B,VB=WB;cm=typeof BigInt<"u",ds=typeof Symbol<"u",Pt=ds&&Symbol.toStringTag!==void 0,bt=typeof Uint8Array<"u",JB=typeof ArrayBuffer<"u";if(bt&&Pt)var YB=Object.getPrototypeOf(Uint8Array.prototype),St=Un(Object.getOwnPropertyDescriptor(YB,Symbol.toStringTag).get);We=Un(Object.prototype.toString),XB=Un(Number.prototype.valueOf),QB=Un(String.prototype.valueOf),eE=Un(Boolean.prototype.valueOf);if(cm)var tE=Un(BigInt.prototype.valueOf);if(ds)var nE=Un(Symbol.prototype.valueOf);Ee.isArgumentsObject=GB,Ee.isGeneratorFunction=VB,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 JB&&ArrayBuffer.isView?ArrayBuffer.isView(t):qy(t)||Vy(t)},Ee.isTypedArray=qy,Ee.isUint8Array=fm,Ee.isUint8ClampedArray=dm,Ee.isUint16Array=pm,Ee.isUint32Array=gm,Ee.isInt8Array=ym,Ee.isInt16Array=mm,Ee.isInt32Array=hm,Ee.isFloat32Array=vm,Ee.isFloat64Array=Tm,Ee.isBigInt64Array=_m,Ee.isBigUint64Array=bm,xa.working=typeof Map<"u"&&xa(new Map),Ee.isMap=function(t){return typeof Map<"u"&&(xa.working?xa(t):t instanceof Map)},Pa.working=typeof Set<"u"&&Pa(new Set),Ee.isSet=function(t){return typeof Set<"u"&&(Pa.working?Pa(t):t instanceof Set)},Ba.working=typeof WeakMap<"u"&&Ba(new WeakMap),Ee.isWeakMap=function(t){return typeof WeakMap<"u"&&(Ba.working?Ba(t):t instanceof WeakMap)},as.working=typeof WeakSet<"u"&&as(new WeakSet),Ee.isWeakSet=function(t){return as(t)},Aa.working=typeof ArrayBuffer<"u"&&Aa(new ArrayBuffer),Ee.isArrayBuffer=Gy,Ca.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&Ca(new DataView(new ArrayBuffer(1),0,1)),Ee.isDataView=Vy,Oa.working=typeof SharedArrayBuffer<"u"&&Oa(new SharedArrayBuffer),Ee.isSharedArrayBuffer=Jy,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=Yy,Ee.isStringObject=Xy,Ee.isBooleanObject=Qy,Ee.isBigIntObject=em,Ee.isSymbolObject=tm,Ee.isBoxedPrimitive=function(t){return Yy(t)||Xy(t)||Qy(t)||em(t)||tm(t)},Ee.isAnyArrayBuffer=function(t){return bt&&(Gy(t)||Jy(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={},Ut=je,nm=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},rE=/%[sdj%]/g;L.format=function(t){if(!Ma(t)){for(var e=[],n=0;n<arguments.length;n++)e.push(fn(arguments[n]));return e.join(" ")}n=1;for(var r=arguments,a=r.length,o=String(t).replace(rE,(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])Ha(i)||!lr(i)?o+=" "+i:o+=" "+fn(i);return o},L.deprecate=function(t,e){if(Ut!==void 0&&Ut.noDeprecation===!0)return t;if(Ut===void 0)return function(){return L.deprecate(t,e).apply(this||qr,arguments)};var n=!1;return function(){if(!n){if(Ut.throwDeprecation)throw new Error(e);Ut.traceDeprecation?console.trace(e):console.error(e),n=!0}return t.apply(this||qr,arguments)}};Ea={},wm=/^$/;Ut.env.NODE_DEBUG&&(Sa=Ut.env.NODE_DEBUG,Sa=Sa.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),wm=new RegExp("^"+Sa+"$","i"));L.debuglog=function(t){if(t=t.toUpperCase(),!Ea[t])if(wm.test(t)){var e=Ut.pid;Ea[t]=function(){var n=L.format.apply(L,arguments);console.error("%s %d: %s",t,e,n)}}else Ea[t]=function(){};return Ea[t]},L.inspect=fn,fn.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]},fn.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},L.types=Ee,L.isArray=xm,L.isBoolean=ps,L.isNull=Ha,L.isNullOrUndefined=function(t){return t==null},L.isNumber=Pm,L.isString=Ma,L.isSymbol=function(t){return typeof t=="symbol"},L.isUndefined=Hn,L.isRegExp=Gr,L.types.isRegExp=Gr,L.isObject=lr,L.isDate=Na,L.types.isDate=Na,L.isError=Vr,L.types.isNativeError=Vr,L.isFunction=Ia,L.isPrimitive=function(t){return t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||typeof t=="symbol"||t===void 0},L.isBuffer=um;oE=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];L.log=function(){console.log("%s - %s",sE(),L.format.apply(L,arguments))},L.inherits=zB,L._extend=function(t,e){if(!e||!lr(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t};Nn=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(Nn&&t[Nn]){var e;if(typeof(e=t[Nn])!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,Nn,{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||qr,o)}catch(s){r(s)}return a}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Nn&&Object.defineProperty(e,Nn,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,nm(t))},L.promisify.custom=Nn,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||qr,i=function(){return a.apply(o,arguments)};t.apply(this||qr,n).then((function(s){Ut.nextTick(i.bind(null,null,s))}),(function(s){Ut.nextTick(lE.bind(null,s,i))}))}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Object.defineProperties(e,nm(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,Em=ot(()=>{C();R();O();Ua();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 uE(){!ur||!Zn||(ur=!1,Zn.length?Qt=Zn.concat(Qt):Za=-1,Qt.length&&Sm())}function Sm(){if(!ur){var t=setTimeout(uE,0);ur=!0;for(var e=Qt.length;e;){for(Zn=Qt,Qt=[];++Za<e;)Zn&&Zn[Za].run();Za=-1,e=Qt.length}Zn=null,ur=!1,clearTimeout(t)}}function cE(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];Qt.push(new km(t,e)),Qt.length===1&&!ur&&setTimeout(Sm,0)}function km(t,e){this.fun=t,this.array=e}function ct(){}function SE(t){vs("_linkedBinding")}function CE(t){vs("dlopen")}function OE(){return[]}function RE(){return[]}function KE(t,e){if(!t)throw new Error(e||"assertion error")}function zE(){return!1}function uS(){return dn.now()/1e3}function hs(t){var e=Math.floor((Date.now()-dn.now())*.001),n=dn.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+=ms)),[r,a]}function pn(){return Ot}function bS(t){return[]}var Qt,ur,Zn,Za,fE,dE,pE,gE,yE,mE,hE,vE,TE,_E,bE,wE,xE,PE,BE,EE,kE,IE,AE,ME,NE,Ts,DE,HE,UE,ZE,$E,jE,LE,FE,WE,qE,GE,VE,JE,YE,XE,QE,eS,tS,nS,rS,iS,aS,oS,sS,lS,dn,ys,ms,cS,fS,dS,pS,gS,yS,mS,hS,vS,TS,_S,Ot,_s=ot(()=>{C();R();O();Qt=[],ur=!1,Za=-1;km.prototype.run=function(){this.fun.apply(null,this.array)};fE="browser",dE="x64",pE="browser",gE={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},yE=["/usr/bin/node"],mE=[],hE="v16.8.0",vE={},TE=function(t,e){console.warn((e?e+": ":"")+t)},_E=function(t){vs("binding")},bE=function(t){return 0},wE=function(){return"/"},xE=function(t){},PE={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};BE=ct,EE=[];kE={},IE=!1,AE={};ME=ct,NE=ct,Ts=function(){return{}},DE=Ts,HE=Ts,UE=ct,ZE=ct,$E=ct,jE={};LE={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},FE=ct,WE=ct;qE=ct,GE=ct,VE=ct,JE=ct,YE=ct,XE=void 0,QE=void 0,eS=void 0,tS=ct,nS=2,rS=1,iS="/bin/usr/node",aS=9229,oS="node",sS=[],lS=ct,dn={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};dn.now===void 0&&(ys=Date.now(),dn.timing&&dn.timing.navigationStart&&(ys=dn.timing.navigationStart),dn.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])};cS=10,fS={},dS=0;pS=pn,gS=pn,yS=pn,mS=pn,hS=pn,vS=ct,TS=pn,_S=pn;Ot={version:hE,versions:vE,arch:dE,platform:pE,release:PE,_rawDebug:BE,moduleLoadList:EE,binding:_E,_linkedBinding:SE,_events:fS,_eventsCount:dS,_maxListeners:cS,on:pn,addListener:pS,once:gS,off:yS,removeListener:mS,removeAllListeners:hS,emit:vS,prependListener:TS,prependOnceListener:_S,listeners:bS,domain:kE,_exiting:IE,config:AE,dlopen:CE,uptime:uS,_getActiveRequests:OE,_getActiveHandles:RE,reallyExit:ME,_kill:NE,cpuUsage:Ts,resourceUsage:DE,memoryUsage:HE,kill:UE,exit:ZE,openStdin:$E,allowedNodeEnvironmentFlags:jE,assert:KE,features:LE,_fatalExceptions:FE,setUncaughtExceptionCaptureCallback:WE,hasUncaughtExceptionCaptureCallback:zE,emitWarning:TE,nextTick:cE,_tickCallback:qE,_debugProcess:GE,_debugEnd:VE,_startProfilerIdleNotifier:JE,_stopProfilerIdleNotifier:YE,stdout:XE,stdin:eS,stderr:QE,abort:tS,umask:bE,chdir:xE,cwd:wE,env:gE,title:fE,argv:yE,execArgv:mE,pid:nS,ppid:rS,execPath:iS,debugPort:aS,hrtime:hs,argv0:oS,_preload_modules:sS,setSourceMapsEnabled:lS}});function Am(){if(Im)return bs;Im=!0,bs=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||ws,arguments)}return o}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,Im,ws,Cm=ot(()=>{C();R();O();bs={},Im=!1,ws=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global});function wS(){if(Om)return Yr;Om=!0;var t=Dt(),e=t.Buffer;function n(a,o){for(var i in a)o[i]=a[i]}e.from&&e.alloc&&e.allocUnsafe&&e.allocUnsafeSlow?Yr=t:(n(t,Yr),Yr.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)},Yr}function xS(){if(Rm)return xs;Rm=!0;var t=wS().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=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 xs}var Yr,Om,xs,Rm,Xr,$C,Mm=ot(()=>{C();R();O();di();Yr={},Om=!1;xs={},Rm=!1;Xr=xS();Xr.StringDecoder;$C=Xr.StringDecoder});function PS(){if(Nm)return Ps;Nm=!0;var t=Ps={},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||cr,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||cr,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||cr).fun=P,(this||cr).array=B}h.prototype.run=function(){(this||cr).fun.apply(null,(this||cr).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,Nm,cr,Ke,Bs=ot(()=>{C();R();O();Ps={},Nm=!1,cr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ke=PS();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 BS(){if(Dm)return Es;Dm=!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,Es=a,Es}function $n(t){throw new RangeError(IS[t])}function Um(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(kS,".")).split("."),e).join(".");return r+a}function qm(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 CS(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function kt(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function ei(t,e,n){if(t&&Zt.isObject(t)&&t instanceof kt)return t;var r=new kt;return r.parse(t,e,n),r}function jS(){if(Wm)return As;Wm=!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,As=a,As}function QS(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?ek(t):tk(t)}function ek(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(qS,"\\"),n=decodeURIComponent(n),e!=="")return`\\\\${e}${n}`;{let r=n.codePointAt(1)|32,a=n[2];if(r<WS||r>zS||a!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return n.slice(1)}}function tk(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 nk(t){let e=zm.resolve(t),n=t.charCodeAt(t.length-1);(n===FS||Os&&n===LS)&&e[e.length-1]!==zm.sep&&(e+="/");let r=new URL("file://");return e.includes("%")&&(e=e.replace(GS,"%25")),!Os&&e.includes("\\")&&(e=e.replace(VS,"%5C")),e.includes(`
|
|
11
|
-
`)&&(e=e.replace(
|
|
12
|
-
`)&&(e=e.replace(
|
|
13
|
-
`," "]),Cs=["'"].concat(US),Km=["%","/","?",";","#"].concat(Cs),Lm=["/","?","#"],Fm=/^[+a-z0-9A-Z_-]{0,63}$/,ZS=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,$S={javascript:!0,"javascript:":!0},ks={javascript:!0,"javascript:":!0},fr={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Is=en;kt.prototype.parse=function(t,e,n){if(!Zt.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=HS.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=NS.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&&!fr[l])){for(var y,g,h=-1,w=0;w<Lm.length;w++)(P=i.indexOf(Lm[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<Km.length;w++){var P;(P=i.indexOf(Km[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(Fm)){for(var H="",K=0,ae=E.length;K<ae;K++)E.charCodeAt(K)>127?H+="x":H+=E[K];if(!H.match(Fm)){var ee=v.slice(0,w),ge=v.slice(w+1),oe=E.match(ZS);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=MS.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(!$S[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),fr[f]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){re=this.pathname||"";var ht=this.search||"";this.path=re+ht}return this.href=this.format(),this},kt.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var e=this.protocol||"",n=this.pathname||"",r=this.hash||"",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&&Zt.isObject(this.query)&&Object.keys(this.query).length&&(o=Is.stringify(this.query));var i=this.search||o&&"?"+o||"";return e&&e.substr(-1)!==":"&&(e+=":"),this.slashes||(!e||fr[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},kt.prototype.resolve=function(t){return this.resolveObject(ei(t,!1,!0)).format()},kt.prototype.resolveObject=function(t){if(Zt.isString(t)){var e=new kt;e.parse(t,!1,!0),t=e}for(var n=new kt,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 fr[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(t.protocol&&t.protocol!==n.protocol){if(!fr[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&&!fr[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(!Zt.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,Zt.isNull(n.pathname)&&Zt.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),Zt.isNull(n.pathname)&&Zt.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=t.auth||n.auth,n.slashes=n.slashes||t.slashes,n.href=n.format(),n},kt.prototype.parseHost=function(){var t=this.host,e=DS.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={},Wm=!1;zm=jS(),KS=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;De.URL=typeof URL<"u"?URL:null;De.pathToFileURL=nk;De.fileURLToPath=QS;De.Url;De.format;De.resolve;De.resolveObject;De.URL;LS=92,FS=47,WS=97,zS=122,Os=KS==="win32",qS=/\//g,GS=/%/g,VS=/\\/g,JS=/\n/g,YS=/\r/g,XS=/\t/g;rk=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;De.URL=typeof URL<"u"?URL:null;De.pathToFileURL=hk;De.fileURLToPath=gk;De.Url;De.format;De.resolve;De.resolveObject;De.parse;De.URL;ik=92,ak=47,ok=97,sk=122,Rs=rk==="win32",lk=/\//g,uk=/%/g,ck=/\\/g,fk=/\n/g,dk=/\r/g,pk=/\t/g});var kh={};Ln(kh,{Agent:()=>kk,ClientRequest:()=>Ik,IncomingMessage:()=>Ak,METHODS:()=>Ck,STATUS_CODES:()=>Ok,default:()=>tn,get:()=>Rk,globalAgent:()=>Mk,request:()=>Nk});function Th(){if(Jm)return Bt;Jm=!0,Bt.fetch=r(jn.fetch)&&r(jn.ReadableStream),Bt.writableStream=r(jn.WritableStream),Bt.abortController=r(jn.AbortController);var t;function e(){if(t!==void 0)return t;if(jn.XMLHttpRequest){t=new jn.XMLHttpRequest;try{t.open("GET",jn.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}Bt.arraybuffer=Bt.fetch||n("arraybuffer"),Bt.msstream=!Bt.fetch&&n("ms-stream"),Bt.mozchunkedarraybuffer=!Bt.fetch&&n("moz-chunked-arraybuffer"),Bt.overrideMimeType=Bt.fetch||(e()?r(e().overrideMimeType):!1);function r(a){return typeof a=="function"}return t=null,Bt}function _h(){return Ym||(Ym=!0,Ms=_t.EventEmitter),Ms}function vk(){if(Xm)return Ns;Xm=!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=Dt(),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 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})(),Ns}function bh(){if(Qm)return Ds;Qm=!0;var t=Ot;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 Ds={destroy:e,undestroy:a,errorOrDestroy:i},Ds}function gr(){if(eh)return Hs;eh=!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"),Hs.codes=t,Hs}function wh(){if(th)return Us;th=!0;var t=gr().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 Us={getHighWaterMark:n},Us}function xh(){if(nh)return Zs;nh=!0;var t=Ot;Zs=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:Am()},a=_h(),o=Dt().Buffer,i=(typeof rh<"u"?rh: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=bh(),p=wh(),y=p.getHighWaterMark,g=gr().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;Ht()(oe,a);function ae(){}function ee(A,k,$){n=n||pr(),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 Y=A.decodeStrings===!1;this.decodeStrings=!Y,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||pr();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,$,Y){var ie;return $===null?ie=new S:typeof $!="string"&&!k.objectMode&&(ie=new h("chunk",["string","Buffer"],$)),ie?(K(A,ie),t.nextTick(Y,ie),!1):!0}oe.prototype.write=function(A,k,$){var Y=this._writableState,ie=!1,b=!Y.objectMode&&l(A);return b&&!o.isBuffer(A)&&(A=s(A)),typeof k=="function"&&($=k,k=null),b?k="buffer":k||(k=Y.defaultEncoding),typeof $!="function"&&($=ae),Y.ending?re(this,$):(b||Oe(this,Y,A,$))&&(Y.pendingcb++,ie=tt(this,Y,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,$,Y,ie,b){if(!$){var x=ze(k,Y,ie);Y!==x&&($=!0,ie="buffer",Y=x)}var z=k.objectMode?1:Y.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:Y,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,Y,ie,b);return Q}function Ve(A,k,$,Y,ie,b,x){k.writelen=Y,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,$,Y,ie){--k.pendingcb,$?(t.nextTick(ie,Y),t.nextTick(F,A,k),A._writableState.errorEmitted=!0,K(A,Y)):(ie(Y),A._writableState.errorEmitted=!0,K(A,Y),F(A,k))}function ht(A){A.writing=!1,A.writecb=null,A.length-=A.writelen,A.writelen=0}function Ue(A,k){var $=A._writableState,Y=$.sync,ie=$.writecb;if(typeof ie!="function")throw new P;if(ht($),k)Je(A,$,Y,k,ie);else{var b=ve($)||A.destroyed;!b&&!$.corked&&!$.bufferProcessing&&$.bufferedRequest&&fe(A,$),Y?t.nextTick(Pe,A,$,b,ie):Pe(A,$,b,ie)}}function Pe(A,k,$,Y){$||Se(A,k),k.pendingcb--,Y(),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 Y=k.bufferedRequestCount,ie=new Array(Y),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 Y=this._writableState;return typeof A=="function"?($=A,A=null,k=null):typeof k=="function"&&($=k,k=null),A!=null&&this.write(A,k),Y.corked&&(Y.corked=1,this.uncork()),Y.ending||de(this,Y,$),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 Y=A._readableState;(!Y||Y.autoDestroy&&Y.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 Y=A.entry;for(A.entry=null;Y;){var ie=Y.callback;k.pendingcb--,ie($),Y=Y.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)},Zs}function pr(){if(ih)return $s;ih=!0;var t=Ot,e=Object.keys||function(p){var y=[];for(var g in p)y.push(g);return y};$s=s;var n=Ph(),r=xh();Ht()(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)}}),$s}function Xs(){if(ah)return js;ah=!0;var t=gr().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 js=a,js}function Tk(){if(oh)return Ks;oh=!0;var t=Ot,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=Xs(),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 Ks=E,Ks}function _k(){return sh||(sh=!0,Ls=function(){throw new Error("Readable.from is not available in the browser")}),Ls}function Ph(){if(lh)return Fs;lh=!0;var t=Ot;Fs=re;var e;re.ReadableState=oe,_t.EventEmitter;var n=function(x,z){return x.listeners(z).length},r=_h(),a=Dt().Buffer,o=(typeof uh<"u"?uh: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=vk(),y=bh(),g=wh(),h=g.getHighWaterMark,w=gr().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;Ht()(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||pr(),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=Xr.StringDecoder),this.decoder=new E(b.encoding),this.encoding=b.encoding)}function re(b){if(e=e||pr(),!(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=Xr.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 ht(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=ht(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=ht(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?At: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 At(){f("onend"),b.end()}var Nt=D(z);b.on("drain",Nt);var xt=!1;function mr(){f("cleanup"),b.removeListener("close",hr),b.removeListener("finish",m),b.removeListener("drain",Nt),b.removeListener("error",Et),b.removeListener("unpipe",Z),z.removeListener("end",At),z.removeListener("end",u),z.removeListener("data",si),xt=!0,Q.awaitDrain&&(!b._writableState||b._writableState.needDrain)&&Nt()}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)&&!xt&&(f("false write response, pause",Q.awaitDrain),Q.awaitDrain++),z.pause())}function Et(c){f("onerror",c),u(),b.removeListener("error",Et),n(b,"error")===0&&ae(b,c)}ge(b,"error",Et);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 At=x.push(Z);At||(Q=!0,b.pause())}});for(var Me in b)this[Me]===void 0&&typeof b[Me]=="function"&&(this[Me]=(function(At){return function(){return b[At].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=Tk()),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(Y,x,b))}function Y(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=_k()),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 Bh(){if(ch)return Ws;ch=!0,Ws=s;var t=gr().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=pr();Ht()(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 Ws}function bk(){if(fh)return zs;fh=!0,zs=e;var t=Bh();Ht()(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)},zs}function wk(){if(dh)return qs;dh=!0;var t;function e(g){var h=!1;return function(){h||(h=!0,g.apply(void 0,arguments))}}var n=gr().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=Xs()),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 qs=y,qs}function Eh(){return ph||(ph=!0,wt=wt=Ph(),wt.Stream=wt,wt.Readable=wt,wt.Writable=xh(),wt.Duplex=pr(),wt.Transform=Bh(),wt.PassThrough=bk(),wt.finished=Xs(),wt.pipeline=wk()),wt}function Sh(){if(gh)return $a;gh=!0;var t=Dt().Buffer,e=Ot,n=Th(),r=Ht(),a=Eh(),o=$a.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},i=$a.IncomingMessage=function(s,l,f,p){var y=this||ja;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||ja,l=s._resumeFetch;l&&(s._resumeFetch=null,l())},i.prototype._onXHRProgress=function(s){var l=this||ja,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 ja.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))},$a}function xk(){if(yh)return Gs;yh=!0;var t=Dt().Buffer,e=Ot,n=Th(),r=Ht(),a=Sh(),o=Eh(),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=Gs=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 Gs}function Pk(){if(mh)return Vs;mh=!0,Vs=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 Vs}function Bk(){return hh||(hh=!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 Sk(){if(vh)return Ys;vh=!0;var t=xk(),e=Sh(),n=Pk(),r=Bk(),a=De,o=Ys;return o.request=function(i,s){typeof i=="string"?i=a.parse(i):i=n(i);var l=Ek.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 Bt,Jm,jn,Ms,Ym,Ns,Xm,Ds,Qm,Hs,eh,Us,th,Zs,nh,rh,$s,ih,js,ah,Ks,oh,Ls,sh,Fs,lh,uh,Ws,ch,zs,fh,qs,dh,wt,ph,$a,gh,ja,Gs,yh,at,Vs,mh,Js,hh,Ys,vh,Ek,tn,kk,Ik,Ak,Ck,Ok,Rk,Mk,Nk,Ih=ot(()=>{C();R();O();rs();Fy();is();di();Em();Ua();_s();Cm();Mm();Vm();Bs();Bt={},Jm=!1,jn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ms={},Ym=!1;Ns={},Xm=!1;Ds={},Qm=!1;Hs={},eh=!1;Us={},th=!1;Zs={},nh=!1,rh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;$s={},ih=!1;js={},ah=!1;Ks={},oh=!1;Ls={},sh=!1;Fs={},lh=!1,uh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ws={},ch=!1;zs={},fh=!1;qs={},dh=!1;wt={},ph=!1;$a={},gh=!1,ja=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Gs={},yh=!1,at=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Vs={},mh=!1;Js={},hh=!1;Ys={},vh=!1,Ek=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;tn=Sk(),kk=tn.Agent,Ik=tn.ClientRequest,Ak=tn.IncomingMessage,Ck=tn.METHODS,Ok=tn.STATUS_CODES,Rk=tn.get,Mk=tn.globalAgent,Nk=tn.request});C();R();O();var Cy={};Ln(Cy,{defaults:()=>NB,markdown:()=>MB});C();R();O();C();R();O();C();R();O();var Po=Object.defineProperty,Wv=Object.defineProperties,zv=Object.getOwnPropertyDescriptors,Pi=Object.getOwnPropertySymbols,Yc=Object.prototype.hasOwnProperty,Xc=Object.prototype.propertyIsEnumerable,gc=(t,e,n)=>e in t?Po(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,_=(t,e)=>{for(var n in e||(e={}))Yc.call(e,n)&&gc(t,n,e[n]);if(Pi)for(var n of Pi(e))Xc.call(e,n)&&gc(t,n,e[n]);return t},N=(t,e)=>Wv(t,zv(e)),d=(t,e)=>Po(t,"name",{value:e,configurable:!0}),Qc=(t,e)=>{var n={};for(var r in t)Yc.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&&Xc.call(t,r)&&(n[r]=t[r]);return n},aa=(t,e)=>{for(var n in e)Po(t,n,{get:e[n],enumerable:!0})},qv={};aa(qv,{errors:()=>rf,fromJSONSchema:()=>Vg,fromJSONSchemaLegacy:()=>iB,fromObject:()=>wo,toJSONSchema:()=>st,toJSONSchemaLegacy:()=>AB,toTypescriptSchema:()=>Do,toTypescriptType:()=>Bo});var X={};aa(X,{BRAND:()=>Mx,DIRTY:()=>Vn,EMPTY_PATH:()=>Ax,INVALID:()=>pe,NEVER:()=>MP,OK:()=>gt,ParseInputLazyPath:()=>Ct,ParseStatus:()=>Tt,Schema:()=>he,ZodAny:()=>jr,ZodArray:()=>Kr,ZodBigInt:()=>$o,ZodBoolean:()=>jo,ZodBranded:()=>Ko,ZodCatch:()=>Lo,ZodDate:()=>Fo,ZodDefault:()=>ma,ZodDiscriminatedUnion:()=>fg,ZodEffects:()=>Sn,ZodEnum:()=>ir,ZodError:()=>Wt,ZodFirstPartyTypeKind:()=>Xp,ZodFunction:()=>pg,ZodIntersection:()=>zo,ZodIssueCode:()=>G,ZodLazy:()=>qo,ZodLiteral:()=>Go,ZodMap:()=>yg,ZodNaN:()=>hg,ZodNativeEnum:()=>Vo,ZodNever:()=>Wr,ZodNull:()=>Jo,ZodNullable:()=>Qn,ZodNumber:()=>Yo,ZodObject:()=>er,ZodOptional:()=>ln,ZodParsedType:()=>ne,ZodPipeline:()=>Xo,ZodPromise:()=>va,ZodReadonly:()=>Ta,ZodRecord:()=>Pg,ZodRef:()=>Eg,ZodSchema:()=>he,ZodSet:()=>Sg,ZodString:()=>yt,ZodSymbol:()=>Ug,ZodTransformer:()=>Sn,ZodTuple:()=>nr,ZodType:()=>he,ZodUndefined:()=>_a,ZodUnion:()=>Qo,ZodUnknown:()=>Nr,ZodVoid:()=>Kg,addIssueToContext:()=>te,agent:()=>jx,aimodel:()=>zx,any:()=>rP,array:()=>sP,bigint:()=>Xx,boolean:()=>Wg,coerce:()=>RP,conversation:()=>Ux,createZodEnum:()=>ha,cuid2Regex:()=>Ig,cuidRegex:()=>kg,custom:()=>ug,datasource:()=>qx,date:()=>Qx,default:()=>SP,discriminatedUnion:()=>fP,effect:()=>Gc,emailRegex:()=>Og,enum:()=>wP,errorUtil:()=>ue,event:()=>Kx,function:()=>TP,getErrorMap:()=>Zr,getParsedType:()=>sn,instanceof:()=>Jx,intent:()=>Wx,intersection:()=>dP,ipv4Regex:()=>Mg,ipv6Regex:()=>Ng,isAborted:()=>To,isAsync:()=>Si,isDirty:()=>_o,isEmojiRegex:()=>Nx,isValid:()=>$r,knowledgebase:()=>Gx,late:()=>Vx,lazy:()=>_P,literal:()=>bP,makeIssue:()=>Ei,map:()=>hP,message:()=>$x,nan:()=>Yx,nativeEnum:()=>xP,never:()=>aP,null:()=>nP,nullable:()=>EP,number:()=>Fg,object:()=>lP,objectUtil:()=>vo,oboolean:()=>OP,onumber:()=>CP,optional:()=>BP,ostring:()=>AP,pipeline:()=>IP,preprocess:()=>kP,processCreateParams:()=>me,promise:()=>PP,quotelessJson:()=>Ix,readonly:()=>mP,record:()=>gP,ref:()=>yP,set:()=>vP,setErrorMap:()=>tg,strictObject:()=>uP,string:()=>Lg,symbol:()=>eP,table:()=>Lx,tablerow:()=>Fx,transformer:()=>Gc,tuple:()=>pP,ulidRegex:()=>Ag,undefined:()=>tP,union:()=>cP,unknown:()=>iP,user:()=>Zx,util:()=>be,uuidRegex:()=>Cg,variable:()=>Hx,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 Jn(t){return typeof t>"u"?"undefined":JSON.stringify(t)}d(Jn,"unknownToTypescriptValue");var tf=d((t,e)=>{let n=Object.entries(t),r=e?" as const":"";return`{ ${n.map(([a,o])=>`${lo(a)}: ${Jn(o)}`).join(", ")} }${r}`},"recordOfUnknownToTypescriptRecord"),lo=d(t=>/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t)?t:se(t),"toPropertyKey"),Gv=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(Gv).filter(r=>!!r).join("")},"toTypeArgumentName"),nt=d(t=>{let e=(t??"").split(`
|
|
14
|
-
|
|
15
|
-
* ${
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
${
|
|
20
|
-
|
|
21
|
-
|
|
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 Yv=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"),Qv=d((t,e)=>{let n=Xv(e),r=t.getReferences();if(n==="none"){if(r.length>0)throw new co;return new yi({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 co;return new yi({type:"variable",identifier:a,schema:t})}return new yi({type:"type",identifier:a,schema:t,args:r})},"getDeclarationProps"),eT=typeof global=="object"&&global&&global.Object===Object&&global,Sf=eT,tT=typeof self=="object"&&self&&self.Object===Object&&self,nT=Sf||tT||Function("return this")(),qt=nT,rT=qt.Symbol,un=rT,kf=Object.prototype,iT=kf.hasOwnProperty,aT=kf.toString,Tr=un?un.toStringTag:void 0;function If(t){var e=iT.call(t,Tr),n=t[Tr];try{t[Tr]=void 0;var r=!0}catch{}var a=aT.call(t);return r&&(e?t[Tr]=n:delete t[Tr]),a}d(If,"getRawTag");var oT=If,sT=Object.prototype,lT=sT.toString;function Af(t){return lT.call(t)}d(Af,"objectToString");var uT=Af,cT="[object Null]",fT="[object Undefined]",vc=un?un.toStringTag:void 0;function Cf(t){return t==null?t===void 0?fT:cT:vc&&vc in Object(t)?oT(t):uT(t)}d(Cf,"baseGetTag");var kn=Cf;function Of(t){return t!=null&&typeof t=="object"}d(Of,"isObjectLike");var En=Of,dT="[object Symbol]";function Rf(t){return typeof t=="symbol"||En(t)&&kn(t)==dT}d(Rf,"isSymbol");var Eo=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,pT=Array.isArray,zt=pT,gT=1/0,Tc=un?un.prototype:void 0,_c=Tc?Tc.toString:void 0;function So(t){if(typeof t=="string")return t;if(zt(t))return Nf(t,So)+"";if(Eo(t))return _c?_c.call(t):"";var e=t+"";return e=="0"&&1/t==-gT?"-0":e}d(So,"baseToString");var yT=So;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 mT=Hf,hT="[object AsyncFunction]",vT="[object Function]",TT="[object GeneratorFunction]",_T="[object Proxy]";function Uf(t){if(!Xn(t))return!1;var e=kn(t);return e==vT||e==TT||e==hT||e==_T}d(Uf,"isFunction");var Zf=Uf,bT=qt["__core-js_shared__"],no=bT,bc=(function(){var t=/[^.]+$/.exec(no&&no.keys&&no.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function $f(t){return!!bc&&bc in t}d($f,"isMasked");var wT=$f,xT=Function.prototype,PT=xT.toString;function jf(t){if(t!=null){try{return PT.call(t)}catch{}try{return t+""}catch{}}return""}d(jf,"toSource");var In=jf,BT=/[\\^$.*+?()[\]{}|]/g,ET=/^\[object .+?Constructor\]$/,ST=Function.prototype,kT=Object.prototype,IT=ST.toString,AT=kT.hasOwnProperty,CT=RegExp("^"+IT.call(AT).replace(BT,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Kf(t){if(!Xn(t)||wT(t))return!1;var e=Zf(t)?CT:ET;return e.test(In(t))}d(Kf,"baseIsNative");var OT=Kf;function Lf(t,e){return t?.[e]}d(Lf,"getValue");var RT=Lf;function Ff(t,e){var n=RT(t,e);return OT(n)?n:void 0}d(Ff,"getNative");var An=Ff,MT=An(qt,"WeakMap"),fo=MT,NT=(function(){try{var t=An(Object,"defineProperty");return t({},"",{}),t}catch{}})(),wc=NT,DT=9007199254740991,HT=/^(?:0|[1-9]\d*)$/;function Wf(t,e){var n=typeof t;return e=e??DT,!!e&&(n=="number"||n!="symbol"&&HT.test(t))&&t>-1&&t%1==0&&t<e}d(Wf,"isIndex");var ko=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 Io=Gf,UT=Object.prototype,ZT=UT.hasOwnProperty;function Vf(t,e,n){var r=t[e];(!(ZT.call(t,e)&&Io(r,n))||n===void 0&&!(e in t))&&qf(t,e,n)}d(Vf,"assignValue");var $T=Vf,jT=9007199254740991;function Jf(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=jT}d(Jf,"isLength");var Ao=Jf;function Yf(t){return t!=null&&Ao(t.length)&&!Zf(t)}d(Yf,"isArrayLike");var Xf=Yf,KT=Object.prototype;function Qf(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||KT;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 LT=td,FT="[object Arguments]";function nd(t){return En(t)&&kn(t)==FT}d(nd,"baseIsArguments");var xc=nd,rd=Object.prototype,WT=rd.hasOwnProperty,zT=rd.propertyIsEnumerable,qT=xc((function(){return arguments})())?xc:function(t){return En(t)&&WT.call(t,"callee")&&!zT.call(t,"callee")},id=qT;function ad(){return!1}d(ad,"stubFalse");var GT=ad,od=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Pc=od&&typeof module=="object"&&module&&!module.nodeType&&module,VT=Pc&&Pc.exports===od,Bc=VT?qt.Buffer:void 0,JT=Bc?Bc.isBuffer:void 0,YT=JT||GT,po=YT,XT="[object Arguments]",QT="[object Array]",e_="[object Boolean]",t_="[object Date]",n_="[object Error]",r_="[object Function]",i_="[object Map]",a_="[object Number]",o_="[object Object]",s_="[object RegExp]",l_="[object Set]",u_="[object String]",c_="[object WeakMap]",f_="[object ArrayBuffer]",d_="[object DataView]",p_="[object Float32Array]",g_="[object Float64Array]",y_="[object Int8Array]",m_="[object Int16Array]",h_="[object Int32Array]",v_="[object Uint8Array]",T_="[object Uint8ClampedArray]",__="[object Uint16Array]",b_="[object Uint32Array]",Ze={};Ze[p_]=Ze[g_]=Ze[y_]=Ze[m_]=Ze[h_]=Ze[v_]=Ze[T_]=Ze[__]=Ze[b_]=!0;Ze[XT]=Ze[QT]=Ze[f_]=Ze[e_]=Ze[d_]=Ze[t_]=Ze[n_]=Ze[r_]=Ze[i_]=Ze[a_]=Ze[o_]=Ze[s_]=Ze[l_]=Ze[u_]=Ze[c_]=!1;function sd(t){return En(t)&&Ao(t.length)&&!!Ze[kn(t)]}d(sd,"baseIsTypedArray");var w_=sd;function ld(t){return function(e){return t(e)}}d(ld,"baseUnary");var x_=ld,ud=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Rr=ud&&typeof module=="object"&&module&&!module.nodeType&&module,P_=Rr&&Rr.exports===ud,ro=P_&&Sf.process,B_=(function(){try{var t=Rr&&Rr.require&&Rr.require("util").types;return t||ro&&ro.binding&&ro.binding("util")}catch{}})(),Ec=B_,Sc=Ec&&Ec.isTypedArray,E_=Sc?x_(Sc):w_,cd=E_,S_=Object.prototype,k_=S_.hasOwnProperty;function fd(t,e){var n=zt(t),r=!n&&id(t),a=!n&&!r&&po(t),o=!n&&!r&&!a&&cd(t),i=n||r||a||o,s=i?LT(t.length,String):[],l=s.length;for(var f in t)(e||k_.call(t,f))&&!(i&&(f=="length"||a&&(f=="offset"||f=="parent")||o&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||ko(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,I_=gd(Object.keys,Object),A_=I_,C_=Object.prototype,O_=C_.hasOwnProperty;function yd(t){if(!ed(t))return A_(t);var e=[];for(var n in Object(t))O_.call(t,n)&&n!="constructor"&&e.push(n);return e}d(yd,"baseKeys");var R_=yd;function md(t){return Xf(t)?dd(t):R_(t)}d(md,"keys");var Co=md;function hd(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}d(hd,"nativeKeysIn");var M_=hd,N_=Object.prototype,D_=N_.hasOwnProperty;function vd(t){if(!Xn(t))return M_(t);var e=ed(t),n=[];for(var r in t)r=="constructor"&&(e||!D_.call(t,r))||n.push(r);return n}d(vd,"baseKeysIn");var H_=vd;function Td(t){return Xf(t)?dd(t,!0):H_(t)}d(Td,"keysIn");var U_=Td,Z_=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$_=/^\w*$/;function _d(t,e){if(zt(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||Eo(t)?!0:$_.test(t)||!Z_.test(t)||e!=null&&t in Object(e)}d(_d,"isKey");var Oo=_d,j_=An(Object,"create"),Dr=j_;function bd(){this.__data__=Dr?Dr(null):{},this.size=0}d(bd,"hashClear");var K_=bd;function wd(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}d(wd,"hashDelete");var L_=wd,F_="__lodash_hash_undefined__",W_=Object.prototype,z_=W_.hasOwnProperty;function xd(t){var e=this.__data__;if(Dr){var n=e[t];return n===F_?void 0:n}return z_.call(e,t)?e[t]:void 0}d(xd,"hashGet");var q_=xd,G_=Object.prototype,V_=G_.hasOwnProperty;function Pd(t){var e=this.__data__;return Dr?e[t]!==void 0:V_.call(e,t)}d(Pd,"hashHas");var J_=Pd,Y_="__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?Y_:e,this}d(Bd,"hashSet");var X_=Bd;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,"Hash");Cn.prototype.clear=K_;Cn.prototype.delete=L_;Cn.prototype.get=q_;Cn.prototype.has=J_;Cn.prototype.set=X_;var kc=Cn;function Ed(){this.__data__=[],this.size=0}d(Ed,"listCacheClear");var Q_=Ed;function Sd(t,e){for(var n=t.length;n--;)if(Io(t[n][0],e))return n;return-1}d(Sd,"assocIndexOf");var ua=Sd,eb=Array.prototype,tb=eb.splice;function kd(t){var e=this.__data__,n=ua(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():tb.call(e,n,1),--this.size,!0}d(kd,"listCacheDelete");var nb=kd;function Id(t){var e=this.__data__,n=ua(e,t);return n<0?void 0:e[n][1]}d(Id,"listCacheGet");var rb=Id;function Ad(t){return ua(this.__data__,t)>-1}d(Ad,"listCacheHas");var ib=Ad;function Cd(t,e){var n=this.__data__,r=ua(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}d(Cd,"listCacheSet");var ab=Cd;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,"ListCache");On.prototype.clear=Q_;On.prototype.delete=nb;On.prototype.get=rb;On.prototype.has=ib;On.prototype.set=ab;var ca=On,ob=An(qt,"Map"),Hr=ob;function Od(){this.size=0,this.__data__={hash:new kc,map:new(Hr||ca),string:new kc}}d(Od,"mapCacheClear");var sb=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 lb=Rd;function Md(t,e){var n=t.__data__;return lb(e)?n[typeof e=="string"?"string":"hash"]:n.map}d(Md,"getMapData");var fa=Md;function Nd(t){var e=fa(this,t).delete(t);return this.size-=e?1:0,e}d(Nd,"mapCacheDelete");var ub=Nd;function Dd(t){return fa(this,t).get(t)}d(Dd,"mapCacheGet");var cb=Dd;function Hd(t){return fa(this,t).has(t)}d(Hd,"mapCacheHas");var fb=Hd;function Ud(t,e){var n=fa(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}d(Ud,"mapCacheSet");var db=Ud;function Rn(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(Rn,"MapCache");Rn.prototype.clear=sb;Rn.prototype.delete=ub;Rn.prototype.get=cb;Rn.prototype.has=fb;Rn.prototype.set=db;var da=Rn,pb="Expected a function";function pa(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(pb);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(pa.Cache||da),n}d(pa,"memoize");pa.Cache=da;var gb=pa,yb=500;function Zd(t){var e=gb(t,function(r){return n.size===yb&&n.clear(),r}),n=e.cache;return e}d(Zd,"memoizeCapped");var mb=Zd,hb=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,vb=/\\(\\)?/g,Tb=mb(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(hb,function(n,r,a,o){e.push(a?o.replace(vb,"$1"):r||n)}),e}),_b=Tb;function $d(t){return t==null?"":yT(t)}d($d,"toString");var bb=$d;function jd(t,e){return zt(t)?t:Oo(t,e)?[t]:_b(bb(t))}d(jd,"castPath");var ga=jd,wb=1/0;function Kd(t){if(typeof t=="string"||Eo(t))return t;var e=t+"";return e=="0"&&1/t==-wb?"-0":e}d(Kd,"toKey");var Fr=Kd;function Ld(t,e){e=ga(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 Ro=Ld;function Fd(t,e,n){var r=t==null?void 0:Ro(t,e);return r===void 0?n:r}d(Fd,"get");var xb=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,Pb=gd(Object.getPrototypeOf,Object),qd=Pb,Bb="[object Object]",Eb=Function.prototype,Sb=Object.prototype,Gd=Eb.toString,kb=Sb.hasOwnProperty,Ib=Gd.call(Object);function Vd(t){if(!En(t)||kn(t)!=Bb)return!1;var e=qd(t);if(e===null)return!0;var n=kb.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&Gd.call(n)==Ib}d(Vd,"isPlainObject");var Ic=Vd;function Jd(){this.__data__=new ca,this.size=0}d(Jd,"stackClear");var Ab=Jd;function Yd(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}d(Yd,"stackDelete");var Cb=Yd;function Xd(t){return this.__data__.get(t)}d(Xd,"stackGet");var Ob=Xd;function Qd(t){return this.__data__.has(t)}d(Qd,"stackHas");var Rb=Qd,Mb=200;function ep(t,e){var n=this.__data__;if(n instanceof ca){var r=n.__data__;if(!Hr||r.length<Mb-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new da(r)}return n.set(t,e),this.size=n.size,this}d(ep,"stackSet");var Nb=ep;function Mn(t){var e=this.__data__=new ca(t);this.size=e.size}d(Mn,"Stack");Mn.prototype.clear=Ab;Mn.prototype.delete=Cb;Mn.prototype.get=Ob;Mn.prototype.has=Rb;Mn.prototype.set=Nb;var mi=Mn;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 Db=tp;function np(){return[]}d(np,"stubArray");var rp=np,Hb=Object.prototype,Ub=Hb.propertyIsEnumerable,Ac=Object.getOwnPropertySymbols,Zb=Ac?function(t){return t==null?[]:(t=Object(t),Db(Ac(t),function(e){return Ub.call(t,e)}))}:rp,ip=Zb,$b=Object.getOwnPropertySymbols,jb=$b?function(t){for(var e=[];t;)zd(e,ip(t)),t=qd(t);return e}:rp,Kb=jb;function ap(t,e,n){var r=e(t);return zt(t)?r:zd(r,n(t))}d(ap,"baseGetAllKeys");var op=ap;function sp(t){return op(t,Co,ip)}d(sp,"getAllKeys");var Cc=sp;function lp(t){return op(t,U_,Kb)}d(lp,"getAllKeysIn");var Lb=lp,Fb=An(qt,"DataView"),go=Fb,Wb=An(qt,"Promise"),yo=Wb,zb=An(qt,"Set"),mo=zb,Oc="[object Map]",qb="[object Object]",Rc="[object Promise]",Mc="[object Set]",Nc="[object WeakMap]",Dc="[object DataView]",Gb=In(go),Vb=In(Hr),Jb=In(yo),Yb=In(mo),Xb=In(fo),bn=kn;(go&&bn(new go(new ArrayBuffer(1)))!=Dc||Hr&&bn(new Hr)!=Oc||yo&&bn(yo.resolve())!=Rc||mo&&bn(new mo)!=Mc||fo&&bn(new fo)!=Nc)&&(bn=d(function(t){var e=kn(t),n=e==qb?t.constructor:void 0,r=n?In(n):"";if(r)switch(r){case Gb:return Dc;case Vb:return Oc;case Jb:return Rc;case Yb:return Mc;case Xb:return Nc}return e},"getTag"));var Hc=bn,Qb=qt.Uint8Array,Uc=Qb,ew="__lodash_hash_undefined__";function up(t){return this.__data__.set(t,ew),this}d(up,"setCacheAdd");var tw=up;function cp(t){return this.__data__.has(t)}d(cp,"setCacheHas");var nw=cp;function Ur(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new da;++e<n;)this.add(t[e])}d(Ur,"SetCache");Ur.prototype.add=Ur.prototype.push=tw;Ur.prototype.has=nw;var rw=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 iw=fp;function dp(t,e){return t.has(e)}d(dp,"cacheHas");var aw=dp,ow=1,sw=2;function pp(t,e,n,r,a,o){var i=n&ow,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&sw?new rw: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(!iw(e,function(v,S){if(!aw(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 lw=yp;function mp(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}d(mp,"setToArray");var uw=mp,cw=1,fw=2,dw="[object Boolean]",pw="[object Date]",gw="[object Error]",yw="[object Map]",mw="[object Number]",hw="[object RegExp]",vw="[object Set]",Tw="[object String]",_w="[object Symbol]",bw="[object ArrayBuffer]",ww="[object DataView]",Zc=un?un.prototype:void 0,io=Zc?Zc.valueOf:void 0;function hp(t,e,n,r,a,o,i){switch(n){case ww:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case bw:return!(t.byteLength!=e.byteLength||!o(new Uc(t),new Uc(e)));case dw:case pw:case mw:return Io(+t,+e);case gw:return t.name==e.name&&t.message==e.message;case hw:case Tw:return t==e+"";case yw:var s=lw;case vw:var l=r&cw;if(s||(s=uw),t.size!=e.size&&!l)return!1;var f=i.get(t);if(f)return f==e;r|=fw,i.set(t,e);var p=gp(s(t),s(e),r,a,o,i);return i.delete(t),p;case _w:if(io)return io.call(t)==io.call(e)}return!1}d(hp,"equalByTag");var xw=hp,Pw=1,Bw=Object.prototype,Ew=Bw.hasOwnProperty;function vp(t,e,n,r,a,o){var i=n&Pw,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:Ew.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 Sw=vp,kw=1,$c="[object Arguments]",jc="[object Array]",gi="[object Object]",Iw=Object.prototype,Kc=Iw.hasOwnProperty;function Tp(t,e,n,r,a,o){var i=zt(t),s=zt(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&&po(t)){if(!po(e))return!1;i=!0,p=!1}if(g&&!p)return o||(o=new mi),i||cd(t)?gp(t,e,n,r,a,o):xw(t,e,l,n,r,a,o);if(!(n&kw)){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 mi),a(P,B,n,r,o)}}return g?(o||(o=new mi),Sw(t,e,n,r,a,o)):!1}d(Tp,"baseIsEqualDeep");var Aw=Tp;function Mo(t,e,n,r,a){return t===e?!0:t==null||e==null||!En(t)&&!En(e)?t!==t&&e!==e:Aw(t,e,n,r,Mo,a)}d(Mo,"baseIsEqual");var ya=Mo,Cw=1,Ow=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 mi;if(r)var g=r(f,p,l,t,e,y);if(!(g===void 0?ya(p,f,Cw|Ow,r,y):g))return!1}}return!0}d(_p,"baseIsMatch");var Rw=_p;function bp(t){return t===t&&!Xn(t)}d(bp,"isStrictComparable");var wp=bp;function xp(t){for(var e=Co(t),n=e.length;n--;){var r=e[n],a=t[r];e[n]=[r,a,wp(a)]}return e}d(xp,"getMatchData");var Mw=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=Mw(t);return e.length==1&&e[0][2]?Bp(e[0][0],e[0][1]):function(n){return n===t||Rw(n,t,e)}}d(Ep,"baseMatches");var Nw=Ep;function Sp(t,e){return t!=null&&e in Object(t)}d(Sp,"baseHasIn");var Dw=Sp;function kp(t,e,n){e=ga(e,t);for(var r=-1,a=e.length,o=!1;++r<a;){var i=Fr(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&&Ao(a)&&ko(i,a)&&(zt(t)||id(t)))}d(kp,"hasPath");var Hw=kp;function Ip(t,e){return t!=null&&Hw(t,e,Dw)}d(Ip,"hasIn");var Uw=Ip,Zw=1,$w=2;function Ap(t,e){return Oo(t)&&wp(e)?Bp(Fr(t),e):function(n){var r=xb(n,t);return r===void 0&&r===e?Uw(n,t):ya(e,r,Zw|$w)}}d(Ap,"baseMatchesProperty");var jw=Ap;function Cp(t){return function(e){return e?.[t]}}d(Cp,"baseProperty");var Kw=Cp;function Op(t){return function(e){return Ro(e,t)}}d(Op,"basePropertyDeep");var Lw=Op;function Rp(t){return Oo(t)?Kw(Fr(t)):Lw(t)}d(Rp,"property");var Fw=Rp;function Mp(t){return typeof t=="function"?t:t==null?mT:typeof t=="object"?zt(t)?jw(t[0],t[1]):Nw(t):Fw(t)}d(Mp,"baseIteratee");var No=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 Ww=Np,zw=Ww(),qw=zw;function Dp(t,e){return t&&qw(t,e,Co)}d(Dp,"baseForOwn");var Gw=Dp;function Hp(t,e){return ya(t,e)}d(Hp,"isEqual");var Yn=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?ya(t,e,void 0,n):!!r}d(Up,"isEqualWith");var Vw=Up;function Zp(t){return t===void 0}d(Zp,"isUndefined");var Lc=Zp;function $p(t,e){var n={};return e=No(e,3),Gw(t,function(r,a,o){qf(n,a,e(r,a,o))}),n}d($p,"mapValues");var Jw=$p,Yw="Expected a function";function jp(t){if(typeof t!="function")throw new TypeError(Yw);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=ga(e,t);for(var a=-1,o=e.length,i=o-1,s=t;s!=null&&++a<o;){var l=Fr(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=Xn(p)?p:ko(e[a+1])?[]:{})}$T(s,l,f),s=s[l]}return t}d(Kp,"baseSet");var Qw=Kp;function Lp(t,e,n){for(var r=-1,a=e.length,o={};++r<a;){var i=e[r],s=Ro(t,i);n(s,i)&&Qw(o,ga(i,t),s)}return o}d(Lp,"basePickBy");var ex=Lp;function Fp(t,e){if(t==null)return{};var n=Nf(Lb(t),function(r){return[r]});return e=No(e),ex(t,n,function(r,a){return e(r,a[0])})}d(Fp,"pickBy");var tx=Fp;function Wp(t,e){return tx(t,Xw(No(e)))}d(Wp,"omitBy");var Fc=Wp,nx=d(t=>{let e=t.checks;return e.length===0?"":e.map(rx).join("")},"generateStringChecks"),rx=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=Jn({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(${Jn({message:t.message,precision:r,offset:t.offset})})`;case"ip":return`.ip(${Jn({message:t.message,version:t.version})})`;default:return""}},"_generateStringCheck"),ix=d(t=>{let e=t.checks;return e.length===0?"":e.map(ax).join("")},"generateNumberChecks"),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"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(sx).join("")},"generateBigIntChecks"),sx=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"),lx=d(t=>{let e=t.checks;return e.length===0?"":e.map(ux).join("")},"generateDateChecks"),ux=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"),cx=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"),fx=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 Do(t){return Fe(t)}d(Do,"toTypescriptSchema");function Fe(t){let n=t._def;switch(n.typeName){case M.ZodFirstPartyTypeKind.ZodString:return`z.string()${nx(n)}${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodNumber:return`z.number()${ix(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()${lx(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)})${cx(n)}${Ce(n)}${Ae(n)}`;case M.ZodFirstPartyTypeKind.ZodObject:let r=Jw(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)})${fx(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 _n(M.ZodFirstPartyTypeKind.ZodEffects);case M.ZodFirstPartyTypeKind.ZodNativeEnum:throw new _n(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=Jn(n.defaultValue());return`z.default(${Fe(n.innerType)}, ${K})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodCatch:throw new _n(M.ZodFirstPartyTypeKind.ZodCatch);case M.ZodFirstPartyTypeKind.ZodPromise:return`z.promise(${Fe(n.type)})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodBranded:throw new _n(M.ZodFirstPartyTypeKind.ZodBranded);case M.ZodFirstPartyTypeKind.ZodPipeline:throw new _n(M.ZodFirstPartyTypeKind.ZodPipeline);case M.ZodFirstPartyTypeKind.ZodSymbol:throw new _n(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=>`${dx(t)}${px(t)}${gx(t)}${yx(t)}${mx(t)}${hx(t)}${vx(t)}`,"_addZuiExtensions"),dx=d(t=>{var e;return(e=t[le])!=null&&e.title?`.title(${se(t[le].title)})`:""},"_maybeTitle"),px=d(t=>{var e;return(e=t[le])!=null&&e.displayAs?`.displayAs(${tf({id:t[le].displayAs[0],params:t[le].displayAs[1]})})`:""},"_maybeDisplayAs"),gx=d(t=>{var e;return(e=t[le])!=null&&e.disabled?`.disabled(${t[le].disabled})`:""},"_maybeDisabled"),yx=d(t=>{var e;return(e=t[le])!=null&&e.hidden?`.hidden(${t[le].hidden})`:""},"_maybeHidden"),mx=d(t=>{var e;return(e=t[le])!=null&&e.placeholder?`.placeholder(${se(t[le].placeholder)})`:""},"_maybePlaceholder"),hx=d(t=>{var e;return(e=t[le])!=null&&e.secret?".secret()":""},"_maybeSecret"),vx=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"),Tx=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)",_x="Z",Gp="(\\.\\d+)?",ho="\\.\\d{",bx="}",Vp=d(t=>{let e=t.precision?ho+t.precision+bx:t.precision===0?"":Gp,n=t.offset?qp:_x;return new RegExp(`^${zp}${e}${n}$`)},"generateDatetimeRegex"),wx=d(t=>({precision:xx(t),offset:t.endsWith(`${qp}$`)}),"extractPrecisionAndOffset"),xx=d(t=>{let e=t.slice(1+zp.length);return e.startsWith(Gp)?null:e.startsWith(ho)?parseInt(e.slice(ho.length)):0},"_extractPrecision"),Mr={};aa(Mr,{escapeSpecialChars:()=>Px});var Px=d(t=>t.replaceAll(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeSpecialChars");function Ho(t,e,n,r){r?.errorMessages&&n&&(t.errorMessage=N(_({},t.errorMessage),{[e]:n}))}d(Ho,"addErrorMessage");function Re(t,e,n,r,a){t[e]=n,Ho(t,e,r,a)}d(Re,"setResponseValueAndErrors");var Xe={cuid:"^[cC][^\\s-]{8,}$",cuid2:"^[a-z][a-z0-9]*$",ulid:"^[0-9A-HJKMNP-TV-Z]{26}$",email:"^(?!\\.)(?!.*\\.\\.)([a-zA-Z0-9_+-\\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\\-]*\\.)+[a-zA-Z]{2,}$",emoji:"^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",uuid:"^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$",ipv4:"^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$",ipv6:"^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$"};function Uo(t,e){let n=_({type:"string"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{});function r(a){return e.patternStrategy==="escape"?Mr.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":Tn(n,"email",a.message,e);break;case"format:idn-email":Tn(n,"idn-email",a.message,e);break;case"pattern:zod":Lt(n,Xe.email,a.message,e);break}break;case"url":Tn(n,"uri",a.message,e);break;case"uuid":Tn(n,"uuid",a.message,e);break;case"regex":Lt(n,a.regex.source,a.message,e);break;case"cuid":Lt(n,Xe.cuid,a.message,e);break;case"cuid2":Lt(n,Xe.cuid2,a.message,e);break;case"startsWith":Lt(n,"^"+r(a.value),a.message,e);break;case"endsWith":Lt(n,r(a.value)+"$",a.message,e);break;case"datetime":Tn(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":{Lt(n,r(a.value),a.message,e);break}case"ip":{a.version!=="v6"&&Tn(n,"ipv4",a.message,e),a.version!=="v4"&&Tn(n,"ipv6",a.message,e);break}case"emoji":Lt(n,Xe.emoji,a.message,e);break;case"ulid":{Lt(n,Xe.ulid,a.message,e);break}case"toLowerCase":case"toUpperCase":case"trim":break;default:}return n}d(Uo,"parseStringDef");var Tn=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"),Lt=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"),Bx=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=Xe.cuid;break;case"cuid2":e.format="cuid2",e.pattern=Xe.cuid2;break;case"ulid":e.format="ulid",e.pattern=Xe.ulid;break;case"uuid":e.format="uuid",e.pattern=Xe.uuid;break;case"emoji":e.format="emoji",e.pattern=Xe.emoji;break;case"email":e.format="email",e.pattern=Xe.email;break;case"ip":e.format=n.version==="v6"?"ipv6":"ipv4",e.pattern=n.version==="v6"?Xe.ipv6:Xe.ipv4;break;case"datetime":e.format="date-time",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"),Ex=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"),Sx=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"),kx=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 Bx(e);case M.ZodFirstPartyTypeKind.ZodNumber:return Tx(e);case M.ZodFirstPartyTypeKind.ZodNaN:throw new pt(M.ZodFirstPartyTypeKind.ZodNaN);case M.ZodFirstPartyTypeKind.ZodBigInt:throw new pt(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 pt(M.ZodFirstPartyTypeKind.ZodDate,{suggestedAlternative:"use z.string().datetime() instead"});case M.ZodFirstPartyTypeKind.ZodUndefined:return ao(n);case M.ZodFirstPartyTypeKind.ZodNull:return oo(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 pt(M.ZodFirstPartyTypeKind.ZodVoid);case M.ZodFirstPartyTypeKind.ZodArray:return Ex(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 kx(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 pt(M.ZodFirstPartyTypeKind.ZodMap);case M.ZodFirstPartyTypeKind.ZodSet:return Sx(e,st);case M.ZodFirstPartyTypeKind.ZodFunction:throw new pt(M.ZodFirstPartyTypeKind.ZodFunction);case M.ZodFirstPartyTypeKind.ZodLazy:throw new pt(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 oo(n);if(n.value===void 0)return ao(n);{M.util.assertEqual(!0);let p=typeof n.value;throw new sa(`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 pt(M.ZodFirstPartyTypeKind.ZodEffects);case M.ZodFirstPartyTypeKind.ZodNativeEnum:throw new pt(M.ZodFirstPartyTypeKind.ZodNativeEnum);case M.ZodFirstPartyTypeKind.ZodOptional:return{description:n.description,anyOf:[st(n.innerType),ao()],"x-zui":N(_({},n["x-zui"]),{def:{typeName:M.ZodFirstPartyTypeKind.ZodOptional}})};case M.ZodFirstPartyTypeKind.ZodNullable:return{anyOf:[st(n.innerType),oo()],"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 pt(M.ZodFirstPartyTypeKind.ZodCatch);case M.ZodFirstPartyTypeKind.ZodPromise:throw new pt(M.ZodFirstPartyTypeKind.ZodPromise);case M.ZodFirstPartyTypeKind.ZodBranded:throw new pt(M.ZodFirstPartyTypeKind.ZodBranded);case M.ZodFirstPartyTypeKind.ZodPipeline:throw new pt(M.ZodFirstPartyTypeKind.ZodPipeline);case M.ZodFirstPartyTypeKind.ZodSymbol:throw new pt(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 ao=d(t=>({not:!0,description:t?.description,"x-zui":N(_({},t?.["x-zui"]),{def:{typeName:M.ZodFirstPartyTypeKind.ZodUndefined}})}),"undefinedSchema"),oo=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 Ct=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 Wt(t.common.issues);return this._error=n,this._error}}},"handleResult"),Yp=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 sn(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:sn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Tt,ctx:{common:e.parent.common,data:e.data,parsedType:sn(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 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:sn(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:sn(e)},a=this._parse({data:e,path:r.path,parent:r}),o=await(Si(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 Sn({schema:this,typeName:"ZodEffects",effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return ln.create(this,this._def)}nullable(){return Qn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Kr.create(this,this._def)}promise(){return va.create(this,this._def)}mandatory(){return this}or(e){return Qo.create([this,e],this._def)}and(e){return zo.create(this,e,this._def)}transform(e){return new Sn(N(_({},me(this._def)),{schema:this,typeName:"ZodEffects",effect:{type:"transform",transform:e}}))}default(e){let n=typeof e=="function"?e:()=>e;return new ma(N(_({},me(this._def)),{innerType:this,defaultValue:n,typeName:"ZodDefault"}))}brand(){return new Ko(_({typeName:"ZodBranded",type:this},me(this._def)))}catch(e){let n=typeof e=="function"?e:()=>e;return new Lo(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 Xo.create(this,e)}readonly(){return Ta.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 Bo(this,e)}toTypescriptSchema(){return Do(this)}naked(){return this}};d(Yp,"ZodType");var he=Yp,Xp=(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))(Xp||{}),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 vo;(t=>{t.mergeShapes=d((e,n)=>_(_({},e),n),"mergeShapes")})(vo||(vo={}));var ne=be.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),sn=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 Zo=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=Zo,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"]),Ix=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(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(Bi,"ZodError");Bi.create=d(t=>new Bi(t),"create");var Wt=Bi,eg=Zo;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: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"),Ax=[];function te(t,e){let n=Ei({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Zr(),Zo].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 Tt=ng,pe=Object.freeze({status:"aborted"}),Vn=d(t=>({status:"dirty",value:t}),"DIRTY"),gt=d(t=>({status:"valid",value:t}),"OK"),To=d(t=>t.status==="aborted","isAborted"),_o=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 gt(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 wn extends he{dereference(e){return new wn(N(_({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new wn(N(_({},this._def),{type:this._def.type.clone()}))}isEqual(e){var n,r,a,o,i,s;return e instanceof wn?Yn((n=this._def.exactLength)==null?void 0:n.value,(r=e._def.exactLength)==null?void 0:r.value)&&Yn((a=this._def.maxLength)==null?void 0:a.value,(o=e._def.maxLength)==null?void 0:o.value)&&Yn((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 Ct(n,i,n.path,s)))).then(i=>Tt.mergeArray(r,i));let o=[...n.data].map((i,s)=>a.type._parseSync(new Ct(n,i,n.path,s)));return Tt.mergeArray(r,o)}get element(){return this._def.type}min(e,n){return new wn(N(_({},this._def),{minLength:{value:e,message:ue.toString(n)}}))}max(e,n){return new wn(N(_({},this._def),{maxLength:{value:e,message:ue.toString(n)}}))}length(e,n){return new wn(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,Cx=d((t,e)=>ag(t,e,new WeakSet),"isEqual"),ag=d((t,e,n)=>Vw(t,e,Ox(n)),"_isEqualWithVisitedTracking"),Ox=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"),Rx={compare:Cx},og=class{constructor(e=[],n={}){this._options=_(_({},Rx),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,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 o=this._getOrReturnCtx(e);return te(o,{code:G.invalid_type,expected:ne.bigint,received:o.parsedType}),pe}let r,a=new Tt;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 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,a){return new hi(N(_({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ue.toString(a)}]}))}_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 $o=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 gt(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 jo=Ci,Mx=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 Ko=lg,Oi=class wr 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 Si(a)?a.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Wt(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Wt(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 Lo=Oi,ug=d((t,e={},n)=>t?jr.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}))}}):jr.create(),"custom"),Ri=class bo 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 Tt,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 bo(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 bo))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 Fo=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)&&Yn(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 ma=Mi,Gt=d(t=>Array.from(new Set(t)),"unique"),Ft=d(t=>t instanceof qo?Ft(t.schema):t instanceof Sn?Ft(t.innerType()):t instanceof Go?[t.value]:t instanceof ir?t.options:t instanceof Vo?be.objectValues(t.enum):t instanceof ma?Ft(t._def.innerType):t instanceof _a?[void 0]:t instanceof Jo?[null]:t instanceof ln?[void 0,...Ft(t.unwrap())]:t instanceof Qn?[null,...Ft(t.unwrap())]:t instanceof Ko||t instanceof Ta?Ft(t.unwrap()):t instanceof Lo?Ft(t._def.innerType):[],"getDiscriminator"),cg=class xn extends he{dereference(e){let n=this.options.map(a=>a.dereference(e)),r=xn._getOptionsMap(this.discriminator,n);return new xn(N(_({},this._def),{options:n,optionsMap:r}))}getReferences(){return Gt(this.options.flatMap(e=>e.getReferences()))}clone(){let e=this.options.map(n=>n.clone());return new xn(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=xn._getOptionsMap(e,n);return new xn(_({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=Ft(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 xn)||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 ha(t,e){return new ir(_({values:t,typeName:"ZodEnum"},me(e)))}d(ha,"createZodEnum");var Wo=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 gt(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return 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(Wo,"ZodEnum");Wo.create=ha;var ir=Wo,dg=class Pn 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 Pn(N(_({},this._def),{args:n,returns:r}))}getReferences(){return Gt([...this._def.args.getReferences(),...this._def.returns.getReferences()])}clone(){return new Pn(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 a(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(a,"makeReturnsIssue");let o={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof va){let s=this;return gt(async function(...l){let f=new Wt([]),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 gt(function(...l){let f=s._def.args.safeParse(l,o);if(!f.success)throw new Wt([r(l,f.error)]);let p=Reflect.apply(i,this,f.data),y=s._def.returns.safeParse(p,o);if(!y.success)throw new Wt([a(p,y.error)]);return y.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Pn(N(_({},this._def),{args:nr.create(e).rest(Nr.create())}))}returns(e){return new Pn(N(_({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new Pn(_({args:e||nr.create([]).rest(Nr.create()),returns:n||Nr.create(),typeName:"ZodFunction"},me(r)))}isEqual(e){return e instanceof Pn&&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=sn(t),r=sn(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=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 a=[];for(let o=0;o<t.length;o++){let i=t[o],s=e[o],l=Ni(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(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 Gt([...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),a=d((o,i)=>{if(To(o)||To(i))return pe;let s=Ni(o.value,i.value);return s.valid?((_o(o)||_o(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 Ti))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(Di,"ZodIntersection");Di.create=d((t,e,n)=>new Di(_({left:t,right:e,typeName:"ZodIntersection"},me(n))),"create");var zo=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 qo=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?Yn(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 Go=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 Gt([...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 a=this._def.keyType,o=this._def.valueType,i=[...r.data.entries()].map(([s,l],f)=>({key:a._parse(new Ct(r,s,r.path,[f,"key"])),value:o._parse(new Ct(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 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 gt(e.data)}get enum(){return this._def.values}isEqual(e){return e instanceof vg?Yn(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 Vo=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 gt(e.data)}isEqual(e){return e instanceof _g}};d(Li,"ZodNull");Li.create=d(t=>new Li(_({typeName:"ZodNull"},me(t))),"create");var Jo=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?gt(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 Qn=Fi;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 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 o=this._getOrReturnCtx(e);return te(o,{code:G.invalid_type,expected:ne.number,received:o.parsedType}),pe}let r,a=new Tt;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 bi(N(_({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ue.toString(a)}]}))}_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 Yo=Wi;function Bn(t){if(t instanceof er){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=ln.create(Bn(r))}return new er(N(_({},t._def),{shape:d(()=>e,"shape")}))}else return t instanceof Kr?new Kr(N(_({},t._def),{type:Bn(t.element)})):t instanceof ln?ln.create(Bn(t.unwrap())):t instanceof Qn?Qn.create(Bn(t.unwrap())):t instanceof nr?nr.create(t.items.map(e=>Bn(e))):t}d(Bn,"deepPartialify");var cn=class vt extends he{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=be.objectKeys(e);return this._cached={shape:e,keys:n}}dereference(e){let n=this._def.shape(),r={};for(let a in n)r[a]=n[a].dereference(e);return new vt(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 Gt(n)}clone(){let e={},n=this._def.shape();for(let[r,a]of Object.entries(n))e[r]=a.clone();return new vt(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 Ct(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 Ct(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=>Tt.mergeObjectSync(r,p)):Tt.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return ue.errToObj,new vt(_(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 vt(N(_({},this._def),{unknownKeys:"strip"}))}passthrough(){return new vt(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 vt(N(_({},this._def),{shape:d(()=>_(_({},this._def.shape()),e),"shape")}))}merge(e){return new vt({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 vt(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 vt(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 vt(N(_({},this._def),{shape:d(()=>n,"shape")}))}deepPartial(){return Bn(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 vt(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 ln;)o=o._def.innerType;n[r]=o}}),new vt(N(_({},this._def),{shape:d(()=>n,"shape")}))}keyof(){return ha(be.objectKeys(this.shape))}isEqual(e){if(!(e instanceof vt)||!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(cn,"ZodObject");cn.create=d((t,e)=>new cn(_({shape:d(()=>t,"shape"),unknownKeys:"strip",typeName:"ZodObject"},me(e))),"create");cn.strictCreate=d((t,e)=>new cn(_({shape:d(()=>t,"shape"),unknownKeys:"strict",typeName:"ZodObject"},me(e))),"strictCreate");cn.lazycreate=d((t,e)=>new cn(_({shape:t,unknownKeys:"strip",typeName:"ZodObject"},me(e))),"lazycreate");var er=cn,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?gt(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 ln=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 Gt([...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 o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?pe:o.status==="dirty"?(n.dirty(),Vn(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 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 Xo=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 gt(r.then(a=>this._def.type.parseAsync(a,{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 va=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 Ta=Gi,xg=class zn 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 zn(N(_({},this._def),{keyType:n,valueType:r}))}getReferences(){return Gt([...this._def.keyType.getReferences(),...this._def.valueType.getReferences()])}clone(){return new zn(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 Ct(r,s,r.path,s)),value:i._parse(new Ct(r,r.data[s],r.path,s))});return r.common.async?Tt.mergeObjectAsync(n,a):Tt.mergeObjectSync(n,a)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof he?new zn(_({keyType:e,valueType:n,typeName:"ZodRecord"},me(r))):new zn(_({keyType:yt.create(),valueType:e,typeName:"ZodRecord"},me(n)))}isEqual(e){return!(!(e instanceof zn)||!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 qn extends he{dereference(e){return new qn(N(_({},this._def),{valueType:this._def.valueType.dereference(e)}))}getReferences(){return this._def.valueType.getReferences()}clone(){return new qn(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 Ct(r,l,r.path,f)));return r.common.async?Promise.all(s).then(l=>i(l)):i(s)}min(e,n){return new qn(N(_({},this._def),{minSize:{value:e,message:ue.toString(n)}}))}max(e,n){return new qn(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 qn))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(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})+$",Nx=d(t=>t===Rg,"isEmojiRegex"),so,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 Gn 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 Tt,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")so||(so=new RegExp(Rg,"u")),so.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 Gn(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 Gn(N(_({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}secret(){return this._def[le]=N(_({},this._def[le]),{secret:!0}),this}toLowerCase(){return new Gn(N(_({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new Gn(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 Gn))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 yt=Yi,Xi=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 gt(e.data)}isEqual(e){return e instanceof Hg}};d(Xi,"ZodSymbol");Xi.create=d(t=>new Xi(_({typeName:"ZodSymbol"},me(t))),"create");var Ug=Xi,tr=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),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"?Vn(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"?Vn(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(!$r(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=>$r(i)?Promise.resolve(a.transform(i.value,o)).then(s=>({status:n.value,value:s})):i);be.assertNever(a)}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(tr,"ZodEffects");tr.create=d((t,e,n)=>new tr(_({schema:t,typeName:"ZodEffects",effect:e},me(n))),"create");tr.createWithPreprocess=d((t,e,n)=>new tr(_({schema:e,effect:{type:"preprocess",transform:t},typeName:"ZodEffects"},me(n))),"createWithPreprocess");var Sn=tr,Qi=class Ir 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 Ir(N(_({},this._def),{items:n,rest:r}))}getReferences(){return Gt([...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 o=[...r.data].map((i,s)=>{let l=this._def.items[s]||this._def.rest;return l?l._parse(new Ct(r,i,r.path,s)):null}).filter(i=>!!i);return r.common.async?Promise.all(o).then(i=>Tt.mergeArray(n,i)):Tt.mergeArray(n,o)}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((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(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 nr=Qi,ea=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 gt(e.data)}isEqual(e){return e instanceof Zg}mandatory(){return Wr.create(_({},this._def))}};d(ea,"ZodUndefined");ea.create=d(t=>new ea(_({typeName:"ZodUndefined"},me(t))),"create");var _a=ea,ta=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 Gt(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 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 Wt(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 Wt(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((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 _a)).map(o=>o.mandatory()),[n,r,...a]=e;return n?r?new Ar(N(_({},this._def),{options:[n,r,...a]})):n:Wr.create(_({},this._def))}};d(ta,"ZodUnion");ta.create=d((t,e)=>new ta(_({options:t,typeName:"ZodUnion"},me(e))),"create");var Qo=ta,na=class $g extends he{constructor(){super(...arguments),this._unknown=!0}_parse(e){return gt(e.data)}isEqual(e){return e instanceof $g}};d(na,"ZodUnknown");na.create=d(t=>new na(_({typeName:"ZodUnknown"},me(t))),"create");var Nr=na,ra=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 gt(e.data)}isEqual(e){return e instanceof jg}};d(ra,"ZodVoid");ra.create=d(t=>new ra(_({typeName:"ZodVoid"},me(t))),"create");var Kg=ra,Dx=["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=ir.create(["any","string","number","boolean","object","pattern","date","array","target","time","enum"]),Hx=d(t=>yt.create().displayAs({id:"variable",params:_({type:t?.type||"any"},t?.params)}),"variable"),Ux=d(t=>yt.create().displayAs({id:"conversation",params:_({},t?.params)}),"conversation"),Zx=d(t=>yt.create().displayAs({id:"user",params:_({},t?.params)}),"user"),$x=d(t=>yt.create().displayAs({id:"message",params:_({},t?.params)}),"message"),jx=d(t=>yt.create().displayAs({id:"agent",params:_({},t?.params)}),"agent"),Kx=d(t=>yt.create().displayAs({id:"event",params:_({},t?.params)}),"event"),Lx=d(t=>yt.create().displayAs({id:"table",params:_({},t?.params)}),"table"),Fx=d(t=>yt.create().displayAs({id:"tablerow",params:_({},t?.params)}),"tablerow"),Wx=d(t=>yt.create().displayAs({id:"intent",params:_({},t?.params)}),"intent"),zx=d(()=>ir.create(Dx).displayAs({id:"dropdown",params:{}}),"aimodel"),qx=d(t=>yt.create().displayAs({id:"datasource",params:_({},t)}),"datasource"),Gx=d(t=>yt.create().displayAs({id:"knowledgebase",params:_({},t)}),"knowledgebase"),Vx={object:er.lazycreate},Jx=d((t,e={message:`Input not instance of ${t.name}`})=>ug(n=>n instanceof t,e),"instanceOfType"),Lg=yt.create,Fg=Yo.create,Yx=hg.create,Xx=$o.create,Wg=jo.create,Qx=Fo.create,eP=Ug.create,tP=_a.create,nP=Jo.create,rP=jr.create,iP=Nr.create,aP=Wr.create,oP=Kg.create,sP=Kr.create,lP=er.create,uP=er.strictCreate,cP=Qo.create,fP=fg.create,dP=zo.create,pP=nr.create,gP=Pg.create,yP=Eg.create,mP=Ta.create,hP=yg.create,vP=Sg.create,TP=pg.create,_P=qo.create,bP=Go.create,wP=ir.create,xP=Vo.create,PP=va.create,Gc=Sn.create,BP=ln.create,EP=Qn.create,SP=ma.create,kP=Sn.createWithPreprocess,IP=Xo.create,AP=d(()=>Lg().optional(),"ostring"),CP=d(()=>Fg().optional(),"onumber"),OP=d(()=>Wg().optional(),"oboolean"),RP={string:d(t=>yt.create(N(_({},t),{coerce:!0})),"string"),number:d(t=>Yo.create(N(_({},t),{coerce:!0})),"number"),boolean:d(t=>jo.create(N(_({},t),{coerce:!0})),"boolean"),bigint:d(t=>$o.create(N(_({},t),{coerce:!0})),"bigint"),date:d(t=>Fo.create(N(_({},t),{coerce:!0})),"date")},MP=pe,M=X,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"),NP=d(t=>{var e;return(e=t[le])!=null&&e.coerce?"z.coerce.boolean()":"z.boolean()"},"parseBoolean"),DP=d(t=>"z.any()","parseDefault"),HP=d((t,e)=>`z.union([${t.type.map(n=>it(N(_({},t),{type:n}),e)).join(", ")}])`,"parseMultipleType"),UP=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"),ZP=d(t=>"z.null()","parseNull"),$P=d(t=>[t.slice(0,t.length/2),t.slice(t.length/2)],"half"),jP=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 Cr=Symbol("Original index"),KP=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]=$P(KP(t.allOf));return`z.intersection(${Lr({allOf:n},e)}, ${Lr({allOf:r},e)})`}}d(Lr,"parseAllOf");var LP=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"),FP=d(t=>`z.literal(${JSON.stringify(t.const)})`,"parseConst"),WP=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"),zP=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) => {
|
|
10
|
+
`)):s=t.stylize("[Circular]","special")),Hn(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 Em(t){return Array.isArray(t)}function gs(t){return typeof t=="boolean"}function Ha(t){return t===null}function Sm(t){return typeof t=="number"}function Ma(t){return typeof t=="string"}function Hn(t){return t===void 0}function Vr(t){return lr(t)&&ys(t)==="[object RegExp]"}function lr(t){return typeof t=="object"&&t!==null}function Na(t){return lr(t)&&ys(t)==="[object Date]"}function Jr(t){return lr(t)&&(ys(t)==="[object Error]"||t instanceof Error)}function Ia(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 fE(){var t=new Date,e=[us(t.getHours()),us(t.getMinutes()),us(t.getSeconds())].join(":");return[t.getDate(),cE[t.getMonth()],e].join(" ")}function km(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function dE(t,e){if(!t){var n=new Error("Promise was rejected with a falsy value");n.reason=t,t=n}return e(t)}var om,Jt,Yt,sr,Qe,Dn,Xt,or,ka,je,KB,ds,Da,um,LB,FB,WB,zB,qB,cm,fm,Vy,GB,VB,JB,dm,Ee,YB,XB,QB,pm,ps,Pt,bt,eE,We,nE,rE,iE,Gr,L,Ut,am,sE,Ea,Bm,Sa,cE,Nn,BC,Ua=ot(()=>{O();M();R();sr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,Qe=om={};(function(){try{Jt=typeof setTimeout=="function"?setTimeout:cs}catch{Jt=cs}try{Yt=typeof clearTimeout=="function"?clearTimeout:fs}catch{Yt=fs}})();Xt=[],or=!1,ka=-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];Xt.push(new Gy(t,e)),Xt.length!==1||or||sm(lm)},Gy.prototype.run=function(){(this||sr).fun.apply(null,(this||sr).array)},Qe.title="browser",Qe.browser=!0,Qe.env={},Qe.argv=[],Qe.version="",Qe.versions={},Qe.on=Vt,Qe.addListener=Vt,Qe.once=Vt,Qe.off=Vt,Qe.removeListener=Vt,Qe.removeAllListeners=Vt,Qe.emit=Vt,Qe.prependListener=Vt,Qe.prependOnceListener=Vt,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=om;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;KB=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",ds=Object.prototype.toString,Da=function(t){return!(KB&&t&&typeof t=="object"&&Symbol.toStringTag in t)&&ds.call(t)==="[object Arguments]"},um=function(t){return!!Da(t)||t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&ds.call(t)!=="[object Array]"&&ds.call(t.callee)==="[object Function]"},LB=(function(){return Da(arguments)})();Da.isLegacyArguments=um;FB=LB?Da:um,WB=Object.prototype.toString,zB=Function.prototype.toString,qB=/^\s*(?:function)?\*/,cm=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",fm=Object.getPrototypeOf,Vy=(function(){if(!cm)return!1;try{return Function("return function*() {}")()}catch{}})(),GB=Vy?fm(Vy):{},VB=function(t){return typeof t=="function"&&(!!qB.test(zB.call(t))||(cm?fm(t)===GB:WB.call(t)==="[object GeneratorFunction]"))},JB=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}},dm=function(t){return t&&typeof t=="object"&&typeof t.copy=="function"&&typeof t.fill=="function"&&typeof t.readUInt8=="function"},Ee={},YB=dm,XB=FB,QB=VB;pm=typeof BigInt<"u",ps=typeof Symbol<"u",Pt=ps&&Symbol.toStringTag!==void 0,bt=typeof Uint8Array<"u",eE=typeof ArrayBuffer<"u";if(bt&&Pt)var tE=Object.getPrototypeOf(Uint8Array.prototype),St=Un(Object.getOwnPropertyDescriptor(tE,Symbol.toStringTag).get);We=Un(Object.prototype.toString),nE=Un(Number.prototype.valueOf),rE=Un(String.prototype.valueOf),iE=Un(Boolean.prototype.valueOf);if(pm)var aE=Un(BigInt.prototype.valueOf);if(ps)var oE=Un(Symbol.prototype.valueOf);Ee.isArgumentsObject=XB,Ee.isGeneratorFunction=QB,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 eE&&ArrayBuffer.isView?ArrayBuffer.isView(t):Jy(t)||Xy(t)},Ee.isTypedArray=Jy,Ee.isUint8Array=gm,Ee.isUint8ClampedArray=ym,Ee.isUint16Array=mm,Ee.isUint32Array=hm,Ee.isInt8Array=vm,Ee.isInt16Array=Tm,Ee.isInt32Array=_m,Ee.isFloat32Array=bm,Ee.isFloat64Array=wm,Ee.isBigInt64Array=xm,Ee.isBigUint64Array=Pm,xa.working=typeof Map<"u"&&xa(new Map),Ee.isMap=function(t){return typeof Map<"u"&&(xa.working?xa(t):t instanceof Map)},Pa.working=typeof Set<"u"&&Pa(new Set),Ee.isSet=function(t){return typeof Set<"u"&&(Pa.working?Pa(t):t instanceof Set)},Ba.working=typeof WeakMap<"u"&&Ba(new WeakMap),Ee.isWeakMap=function(t){return typeof WeakMap<"u"&&(Ba.working?Ba(t):t instanceof WeakMap)},os.working=typeof WeakSet<"u"&&os(new WeakSet),Ee.isWeakSet=function(t){return os(t)},Aa.working=typeof ArrayBuffer<"u"&&Aa(new ArrayBuffer),Ee.isArrayBuffer=Yy,Ca.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&Ca(new DataView(new ArrayBuffer(1),0,1)),Ee.isDataView=Xy,Oa.working=typeof SharedArrayBuffer<"u"&&Oa(new SharedArrayBuffer),Ee.isSharedArrayBuffer=Qy,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=em,Ee.isStringObject=tm,Ee.isBooleanObject=nm,Ee.isBigIntObject=rm,Ee.isSymbolObject=im,Ee.isBoxedPrimitive=function(t){return em(t)||tm(t)||nm(t)||rm(t)||im(t)},Ee.isAnyArrayBuffer=function(t){return bt&&(Yy(t)||Qy(t))},["isProxy","isExternal","isModuleNamespaceObject"].forEach((function(t){Object.defineProperty(Ee,t,{enumerable:!1,value:function(){throw new Error(t+" is not supported in userland")}})}));Gr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,L={},Ut=je,am=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},sE=/%[sdj%]/g;L.format=function(t){if(!Ma(t)){for(var e=[],n=0;n<arguments.length;n++)e.push(fn(arguments[n]));return e.join(" ")}n=1;for(var r=arguments,a=r.length,o=String(t).replace(sE,(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])Ha(i)||!lr(i)?o+=" "+i:o+=" "+fn(i);return o},L.deprecate=function(t,e){if(Ut!==void 0&&Ut.noDeprecation===!0)return t;if(Ut===void 0)return function(){return L.deprecate(t,e).apply(this||Gr,arguments)};var n=!1;return function(){if(!n){if(Ut.throwDeprecation)throw new Error(e);Ut.traceDeprecation?console.trace(e):console.error(e),n=!0}return t.apply(this||Gr,arguments)}};Ea={},Bm=/^$/;Ut.env.NODE_DEBUG&&(Sa=Ut.env.NODE_DEBUG,Sa=Sa.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),Bm=new RegExp("^"+Sa+"$","i"));L.debuglog=function(t){if(t=t.toUpperCase(),!Ea[t])if(Bm.test(t)){var e=Ut.pid;Ea[t]=function(){var n=L.format.apply(L,arguments);console.error("%s %d: %s",t,e,n)}}else Ea[t]=function(){};return Ea[t]},L.inspect=fn,fn.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]},fn.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},L.types=Ee,L.isArray=Em,L.isBoolean=gs,L.isNull=Ha,L.isNullOrUndefined=function(t){return t==null},L.isNumber=Sm,L.isString=Ma,L.isSymbol=function(t){return typeof t=="symbol"},L.isUndefined=Hn,L.isRegExp=Vr,L.types.isRegExp=Vr,L.isObject=lr,L.isDate=Na,L.types.isDate=Na,L.isError=Jr,L.types.isNativeError=Jr,L.isFunction=Ia,L.isPrimitive=function(t){return t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||typeof t=="symbol"||t===void 0},L.isBuffer=dm;cE=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];L.log=function(){console.log("%s - %s",fE(),L.format.apply(L,arguments))},L.inherits=JB,L._extend=function(t,e){if(!e||!lr(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t};Nn=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(Nn&&t[Nn]){var e;if(typeof(e=t[Nn])!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,Nn,{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||Gr,o)}catch(s){r(s)}return a}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Nn&&Object.defineProperty(e,Nn,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,am(t))},L.promisify.custom=Nn,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||Gr,i=function(){return a.apply(o,arguments)};t.apply(this||Gr,n).then((function(s){Ut.nextTick(i.bind(null,null,s))}),(function(s){Ut.nextTick(dE.bind(null,s,i))}))}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Object.defineProperties(e,am(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;BC=L.promisify;L.types});var CC,Im=ot(()=>{O();M();R();Ua();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;CC=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 pE(){!ur||!Zn||(ur=!1,Zn.length?Qt=Zn.concat(Qt):Za=-1,Qt.length&&Am())}function Am(){if(!ur){var t=setTimeout(pE,0);ur=!0;for(var e=Qt.length;e;){for(Zn=Qt,Qt=[];++Za<e;)Zn&&Zn[Za].run();Za=-1,e=Qt.length}Zn=null,ur=!1,clearTimeout(t)}}function gE(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];Qt.push(new Cm(t,e)),Qt.length===1&&!ur&&setTimeout(Am,0)}function Cm(t,e){this.fun=t,this.array=e}function ct(){}function CE(t){Ts("_linkedBinding")}function NE(t){Ts("dlopen")}function DE(){return[]}function HE(){return[]}function zE(t,e){if(!t)throw new Error(e||"assertion error")}function JE(){return!1}function pS(){return dn.now()/1e3}function vs(t){var e=Math.floor((Date.now()-dn.now())*.001),n=dn.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 pn(){return Rt}function BS(t){return[]}var Qt,ur,Zn,Za,yE,mE,hE,vE,TE,_E,bE,wE,xE,PE,BE,EE,SE,kE,IE,AE,OE,RE,ME,UE,ZE,_s,$E,jE,KE,LE,FE,WE,qE,GE,VE,YE,XE,QE,eS,tS,nS,rS,iS,aS,oS,sS,lS,uS,cS,fS,dS,dn,ms,hs,gS,yS,mS,hS,vS,TS,_S,bS,wS,xS,PS,Rt,bs=ot(()=>{O();M();R();Qt=[],ur=!1,Za=-1;Cm.prototype.run=function(){this.fun.apply(null,this.array)};yE="browser",mE="x64",hE="browser",vE={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},TE=["/usr/bin/node"],_E=[],bE="v16.8.0",wE={},xE=function(t,e){console.warn((e?e+": ":"")+t)},PE=function(t){Ts("binding")},BE=function(t){return 0},EE=function(){return"/"},SE=function(t){},kE={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};IE=ct,AE=[];OE={},RE=!1,ME={};UE=ct,ZE=ct,_s=function(){return{}},$E=_s,jE=_s,KE=ct,LE=ct,FE=ct,WE={};qE={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},GE=ct,VE=ct;YE=ct,XE=ct,QE=ct,eS=ct,tS=ct,nS=void 0,rS=void 0,iS=void 0,aS=ct,oS=2,sS=1,lS="/bin/usr/node",uS=9229,cS="node",fS=[],dS=ct,dn={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};dn.now===void 0&&(ms=Date.now(),dn.timing&&dn.timing.navigationStart&&(ms=dn.timing.navigationStart),dn.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])};gS=10,yS={},mS=0;hS=pn,vS=pn,TS=pn,_S=pn,bS=pn,wS=ct,xS=pn,PS=pn;Rt={version:bE,versions:wE,arch:mE,platform:hE,release:kE,_rawDebug:IE,moduleLoadList:AE,binding:PE,_linkedBinding:CE,_events:yS,_eventsCount:mS,_maxListeners:gS,on:pn,addListener:hS,once:vS,off:TS,removeListener:_S,removeAllListeners:bS,emit:wS,prependListener:xS,prependOnceListener:PS,listeners:BS,domain:OE,_exiting:RE,config:ME,dlopen:NE,uptime:pS,_getActiveRequests:DE,_getActiveHandles:HE,reallyExit:UE,_kill:ZE,cpuUsage:_s,resourceUsage:$E,memoryUsage:jE,kill:KE,exit:LE,openStdin:FE,allowedNodeEnvironmentFlags:WE,assert:zE,features:qE,_fatalExceptions:GE,setUncaughtExceptionCaptureCallback:VE,hasUncaughtExceptionCaptureCallback:JE,emitWarning:xE,nextTick:gE,_tickCallback:YE,_debugProcess:XE,_debugEnd:QE,_startProfilerIdleNotifier:eS,_stopProfilerIdleNotifier:tS,stdout:nS,stdin:iS,stderr:rS,abort:aS,umask:BE,chdir:SE,cwd:EE,env:vE,title:yE,argv:TE,execArgv:_E,pid:oS,ppid:sS,execPath:lS,debugPort:uS,hrtime:vs,argv0:cS,_preload_modules:fS,setSourceMapsEnabled:dS}});function Rm(){if(Om)return ws;Om=!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,Om,xs,Mm=ot(()=>{O();M();R();ws={},Om=!1,xs=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global});function ES(){if(Nm)return Xr;Nm=!0;var t=Dt(),e=t.Buffer;function n(a,o){for(var i in a)o[i]=a[i]}e.from&&e.alloc&&e.allocUnsafe&&e.allocUnsafeSlow?Xr=t:(n(t,Xr),Xr.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)},Xr}function SS(){if(Dm)return Ps;Dm=!0;var t=ES().Buffer,e=t.isEncoding||function(T){switch(T=""+T,T&&T.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(T){if(!T)return"utf8";for(var S;;)switch(T){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 T;default:if(S)return;T=(""+T).toLowerCase(),S=!0}}function r(T){var S=n(T);if(typeof S!="string"&&(t.isEncoding===e||!e(T)))throw new Error("Unknown encoding: "+T);return S||T}Ps.StringDecoder=a;function a(T){this.encoding=r(T);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=v,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(T){if(T.length===0)return"";var S,E;if(this.lastNeed){if(S=this.fillLast(T),S===void 0)return"";E=this.lastNeed,this.lastNeed=0}else E=0;return E<T.length?S?S+this.text(T,E):this.text(T,E):S||""},a.prototype.end=p,a.prototype.text=f,a.prototype.fillLast=function(T){if(this.lastNeed<=T.length)return T.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);T.copy(this.lastChar,this.lastTotal-this.lastNeed,0,T.length),this.lastNeed-=T.length};function o(T){return T<=127?0:T>>5===6?2:T>>4===14?3:T>>3===30?4:T>>6===2?-1:-2}function i(T,S,E){var H=S.length-1;if(H<E)return 0;var j=o(S[H]);return j>=0?(j>0&&(T.lastNeed=j-1),j):--H<E||j===-2?0:(j=o(S[H]),j>=0?(j>0&&(T.lastNeed=j-2),j):--H<E||j===-2?0:(j=o(S[H]),j>=0?(j>0&&(j===2?j=0:T.lastNeed=j-3),j):0))}function s(T,S,E){if((S[0]&192)!==128)return T.lastNeed=0,"\uFFFD";if(T.lastNeed>1&&S.length>1){if((S[1]&192)!==128)return T.lastNeed=1,"\uFFFD";if(T.lastNeed>2&&S.length>2&&(S[2]&192)!==128)return T.lastNeed=2,"\uFFFD"}}function l(T){var S=this.lastTotal-this.lastNeed,E=s(this,T);if(E!==void 0)return E;if(this.lastNeed<=T.length)return T.copy(this.lastChar,S,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);T.copy(this.lastChar,S,0,T.length),this.lastNeed-=T.length}function f(T,S){var E=i(this,T,S);if(!this.lastNeed)return T.toString("utf8",S);this.lastTotal=E;var H=T.length-(E-this.lastNeed);return T.copy(this.lastChar,0,H),T.toString("utf8",S,H)}function p(T){var S=T&&T.length?this.write(T):"";return this.lastNeed?S+"\uFFFD":S}function y(T,S){if((T.length-S)%2===0){var E=T.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]=T[T.length-2],this.lastChar[1]=T[T.length-1],E.slice(0,-1)}return E}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=T[T.length-1],T.toString("utf16le",S,T.length-1)}function g(T){var S=T&&T.length?this.write(T):"";if(this.lastNeed){var E=this.lastTotal-this.lastNeed;return S+this.lastChar.toString("utf16le",0,E)}return S}function h(T,S){var E=(T.length-S)%3;return E===0?T.toString("base64",S):(this.lastNeed=3-E,this.lastTotal=3,E===1?this.lastChar[0]=T[T.length-1]:(this.lastChar[0]=T[T.length-2],this.lastChar[1]=T[T.length-1]),T.toString("base64",S,T.length-E))}function v(T){var S=T&&T.length?this.write(T):"";return this.lastNeed?S+this.lastChar.toString("base64",0,3-this.lastNeed):S}function P(T){return T.toString(this.encoding)}function B(T){return T&&T.length?this.write(T):""}return Ps}var Xr,Nm,Ps,Dm,Qr,WC,Hm=ot(()=>{O();M();R();pi();Xr={},Nm=!1;Ps={},Dm=!1;Qr=SS();Qr.StringDecoder;WC=Qr.StringDecoder});function kS(){if(Um)return Bs;Um=!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||cr,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||cr,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 T=1;T<arguments.length;T++)B[T-1]=arguments[T];s.push(new h(P,B)),s.length===1&&!l&&o(g)};function h(P,B){(this||cr).fun=P,(this||cr).array=B}h.prototype.run=function(){(this||cr).fun.apply(null,(this||cr).array)},t.title="browser",t.browser=!0,t.env={},t.argv=[],t.version="",t.versions={};function v(){}return t.on=v,t.addListener=v,t.once=v,t.off=v,t.removeListener=v,t.removeAllListeners=v,t.emit=v,t.prependListener=v,t.prependOnceListener=v,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,Um,cr,Ke,Es=ot(()=>{O();M();R();Bs={},Um=!1,cr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ke=kS();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 IS(){if(Zm)return Ss;Zm=!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,v=p<h?p:h,P=-1,B=0;B<=v;++B){if(B===v){if(h>v){if(s.charCodeAt(y+B)===47)return s.slice(y+B+1);if(B===0)return s.slice(y+B)}else p>v&&(i.charCodeAt(l+B)===47?P=B:B===0&&(P=0));break}var T=i.charCodeAt(l+B),S=s.charCodeAt(y+B);if(T!==S)break;T===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 v=i.charCodeAt(y);if(v===47){if(!p){l=y+1;break}}else h===-1&&(p=!1,h=y+1),g>=0&&(v===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,v=!0,P=i.length-1,B=0;P>=p;--P){if(l=i.charCodeAt(P),l===47){if(!v){g=P+1;break}continue}h===-1&&(v=!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 $n(t){throw new RangeError(RS[t])}function jm(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(OS,".")).split("."),e).join(".");return r+a}function Jm(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 NS(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function kt(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function ti(t,e,n){if(t&&Zt.isObject(t)&&t instanceof kt)return t;var r=new kt;return r.parse(t,e,n),r}function WS(){if(Gm)return Cs;Gm=!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,v=p<h?p:h,P=-1,B=0;B<=v;++B){if(B===v){if(h>v){if(s.charCodeAt(y+B)===47)return s.slice(y+B+1);if(B===0)return s.slice(y+B)}else p>v&&(i.charCodeAt(l+B)===47?P=B:B===0&&(P=0));break}var T=i.charCodeAt(l+B),S=s.charCodeAt(y+B);if(T!==S)break;T===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 v=i.charCodeAt(y);if(v===47){if(!p){l=y+1;break}}else h===-1&&(p=!1,h=y+1),g>=0&&(v===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,v=!0,P=i.length-1,B=0;P>=p;--P){if(l=i.charCodeAt(P),l===47){if(!v){g=P+1;break}continue}h===-1&&(v=!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 rk(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?ik(t):ak(t)}function ik(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(YS,"\\"),n=decodeURIComponent(n),e!=="")return`\\\\${e}${n}`;{let r=n.codePointAt(1)|32,a=n[2];if(r<VS||r>JS||a!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return n.slice(1)}}function ak(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 ok(t){let e=Vm.resolve(t),n=t.charCodeAt(t.length-1);(n===GS||Rs&&n===qS)&&e[e.length-1]!==Vm.sep&&(e+="/");let r=new URL("file://");return e.includes("%")&&(e=e.replace(XS,"%25")),!Rs&&e.includes("\\")&&(e=e.replace(QS,"%5C")),e.includes(`
|
|
11
|
+
`)&&(e=e.replace(ek,"%0A")),e.includes("\r")&&(e=e.replace(tk,"%0D")),e.includes(" ")&&(e=e.replace(nk,"%09")),r.pathname=e,r}function vk(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?Tk(t):_k(t)}function Tk(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(dk,"\\"),n=decodeURIComponent(n),e!=="")return`\\\\${e}${n}`;{let r=n.codePointAt(1)|32,a=n[2];if(r<ck||r>fk||a!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return n.slice(1)}}function _k(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 bk(t){let e=$m.resolve(t),n=t.charCodeAt(t.length-1);(n===uk||Ms&&n===lk)&&e[e.length-1]!==$m.sep&&(e+="/");let r=new URL("file://");return e.includes("%")&&(e=e.replace(pk,"%25")),!Ms&&e.includes("\\")&&(e=e.replace(gk,"%5C")),e.includes(`
|
|
12
|
+
`)&&(e=e.replace(yk,"%0A")),e.includes("\r")&&(e=e.replace(mk,"%0D")),e.includes(" ")&&(e=e.replace(hk,"%09")),r.pathname=e,r}var Ss,Zm,$m,dr,AS,CS,OS,RS,$t,ks,Km,Ym,Lm,Fm,MS,DS,ei,HS,en,De,US,Zt,ZS,$S,jS,KS,Os,Wm,zm,qm,LS,FS,Is,fr,As,Cs,Gm,Vm,zS,qS,GS,VS,JS,Rs,YS,XS,QS,ek,tk,nk,sk,lk,uk,ck,fk,Ms,dk,pk,gk,yk,mk,hk,Xm=ot(()=>{O();M();R();Ua();Es();Ss={},Zm=!1;$m=IS(),dr=2147483647,AS=/^xn--/,CS=/[^\0-\x7E]/,OS=/[\x2E\u3002\uFF0E\uFF61]/g,RS={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},$t=Math.floor,ks=String.fromCharCode;Km=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},Ym=function(t,e,n){let r=0;for(t=n?$t(t/700):t>>1,t+=$t(t/e);t>455;r+=36)t=$t(t/35);return $t(r+36*t/(t+38))},Lm=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&&$n("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&&$n("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>$t((dr-r)/y))&&$n("overflow"),r+=h*y;let v=g<=o?1:g>=o+26?26:g-o;if(h<v)break;let P=36-v;y>$t(dr/P)&&$n("overflow"),y*=P}let p=e.length+1;o=Ym(r-f,p,f==0),$t(r/p)>dr-a&&$n("overflow"),a+=$t(r/p),r%=p,e.splice(r++,0,a)}var s;return String.fromCodePoint(...e)},Fm=function(t){let e=[],n=(t=Jm(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=dr;for(let p of t)p>=r&&p<l&&(l=p);let f=s+1;l-r>$t((dr-a)/f)&&$n("overflow"),a+=(l-r)*f,r=l;for(let p of t)if(p<r&&++a>dr&&$n("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 v=y-h,P=36-h;e.push(ks(Km(h+v%P,0))),y=$t(v/P)}e.push(ks(Km(y,0))),o=Ym(a,f,s==i),a=0,++s}++a,++r}return e.join("")},MS={version:"2.1.0",ucs2:{decode:Jm,encode:t=>String.fromCodePoint(...t)},decode:Lm,encode:Fm,toASCII:function(t){return jm(t,(function(e){return CS.test(e)?"xn--"+Fm(e):e}))},toUnicode:function(t){return jm(t,(function(e){return AS.test(e)?Lm(e.slice(4).toLowerCase()):e}))}};DS=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"),v=h.indexOf(n);v>=0?(f=h.substr(0,v),p=h.substr(v+1)):(f=h,p=""),y=decodeURIComponent(f),g=decodeURIComponent(p),NS(a,y)?Array.isArray(a[y])?a[y].push(g):a[y]=[a[y],g]:a[y]=g}return a},ei=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}},HS=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(ei(a))+n;return Array.isArray(t[a])?t[a].map((function(i){return o+encodeURIComponent(ei(i))})).join(e):o+encodeURIComponent(ei(t[a]))})).join(e):r?encodeURIComponent(ei(r))+n+encodeURIComponent(ei(t)):""},en={};en.decode=en.parse=DS,en.encode=en.stringify=HS;en.decode;en.encode;en.parse;en.stringify;De={},US=MS,Zt={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=ti,De.resolve=function(t,e){return ti(t,!1,!0).resolve(e)},De.resolveObject=function(t,e){return t?ti(t,!1,!0).resolveObject(e):e},De.format=function(t){return Zt.isString(t)&&(t=ti(t)),t instanceof kt?t.format():kt.prototype.format.call(t)},De.Url=kt;ZS=/^([a-z0-9.+-]+:)/i,$S=/:[0-9]*$/,jS=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,KS=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r",`
|
|
13
|
+
`," "]),Os=["'"].concat(KS),Wm=["%","/","?",";","#"].concat(Os),zm=["/","?","#"],qm=/^[+a-z0-9A-Z_-]{0,63}$/,LS=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,FS={javascript:!0,"javascript:":!0},Is={javascript:!0,"javascript:":!0},fr={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},As=en;kt.prototype.parse=function(t,e,n){if(!Zt.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=jS.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=ZS.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&&!fr[l])){for(var y,g,h=-1,v=0;v<zm.length;v++)(P=i.indexOf(zm[v]))!==-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,v=0;v<Wm.length;v++){var P;(P=i.indexOf(Wm[v]))!==-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 T=this.hostname.split(/\./),S=(v=0,T.length);v<S;v++){var E=T[v];if(E&&!E.match(qm)){for(var H="",j=0,re=E.length;j<re;j++)E.charCodeAt(j)>127?H+="x":H+=E[j];if(!H.match(qm)){var ee=T.slice(0,v),ge=T.slice(v+1),oe=E.match(LS);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=US.toASCII(this.hostname));var ie=this.port?":"+this.port:"",Oe=this.hostname||"";this.host=Oe+ie,this.href+=this.host,B&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),i[0]!=="/"&&(i="/"+i))}if(!FS[f])for(v=0,S=Os.length;v<S;v++){var ze=Os[v];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),fr[f]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){ie=this.pathname||"";var ht=this.search||"";this.path=ie+ht}return this.href=this.format(),this},kt.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var e=this.protocol||"",n=this.pathname||"",r=this.hash||"",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&&Zt.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||fr[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},kt.prototype.resolve=function(t){return this.resolveObject(ti(t,!1,!0)).format()},kt.prototype.resolveObject=function(t){if(Zt.isString(t)){var e=new kt;e.parse(t,!1,!0),t=e}for(var n=new kt,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 fr[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(t.protocol&&t.protocol!==n.protocol){if(!fr[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||"",v=n.search||"";n.path=h+v}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)==="/",T=B||P||n.host&&t.pathname,S=T,E=n.pathname&&n.pathname.split("/")||[],H=(g=t.pathname&&t.pathname.split("/")||[],n.protocol&&!fr[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),T=T&&(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(!Zt.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,Zt.isNull(n.pathname)&&Zt.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 j=E.slice(-1)[0],re=(n.host||t.host||E.length>1)&&(j==="."||j==="..")||j==="",ee=0,ge=E.length;ge>=0;ge--)(j=E[ge])==="."?E.splice(ge,1):j===".."?(E.splice(ge,1),ee++):ee&&(E.splice(ge,1),ee--);if(!T&&!S)for(;ee--;ee)E.unshift("..");!T||E[0]===""||E[0]&&E[0].charAt(0)==="/"||E.unshift(""),re&&E.join("/").substr(-1)!=="/"&&E.push("");var oe,ie=E[0]===""||E[0]&&E[0].charAt(0)==="/";return H&&(n.hostname=n.host=ie?"":E.length?E.shift():"",(oe=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=oe.shift(),n.host=n.hostname=oe.shift())),(T=T||n.host&&E.length)&&!ie&&E.unshift(""),E.length?n.pathname=E.join("/"):(n.pathname=null,n.path=null),Zt.isNull(n.pathname)&&Zt.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=t.auth||n.auth,n.slashes=n.slashes||t.slashes,n.href=n.format(),n},kt.prototype.parseHost=function(){var t=this.host,e=$S.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={},Gm=!1;Vm=WS(),zS=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;De.URL=typeof URL<"u"?URL:null;De.pathToFileURL=ok;De.fileURLToPath=rk;De.Url;De.format;De.resolve;De.resolveObject;De.URL;qS=92,GS=47,VS=97,JS=122,Rs=zS==="win32",YS=/\//g,XS=/%/g,QS=/\\/g,ek=/\n/g,tk=/\r/g,nk=/\t/g;sk=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;De.URL=typeof URL<"u"?URL:null;De.pathToFileURL=bk;De.fileURLToPath=vk;De.Url;De.format;De.resolve;De.resolveObject;De.parse;De.URL;lk=92,uk=47,ck=97,fk=122,Ms=sk==="win32",dk=/\//g,pk=/%/g,gk=/\\/g,yk=/\n/g,mk=/\r/g,hk=/\t/g});var Ch={};Ln(Ch,{Agent:()=>Ok,ClientRequest:()=>Rk,IncomingMessage:()=>Mk,METHODS:()=>Nk,STATUS_CODES:()=>Dk,default:()=>tn,get:()=>Hk,globalAgent:()=>Uk,request:()=>Zk});function wh(){if(Qm)return Bt;Qm=!0,Bt.fetch=r(jn.fetch)&&r(jn.ReadableStream),Bt.writableStream=r(jn.WritableStream),Bt.abortController=r(jn.AbortController);var t;function e(){if(t!==void 0)return t;if(jn.XMLHttpRequest){t=new jn.XMLHttpRequest;try{t.open("GET",jn.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}Bt.arraybuffer=Bt.fetch||n("arraybuffer"),Bt.msstream=!Bt.fetch&&n("ms-stream"),Bt.mozchunkedarraybuffer=!Bt.fetch&&n("moz-chunked-arraybuffer"),Bt.overrideMimeType=Bt.fetch||(e()?r(e().overrideMimeType):!1);function r(a){return typeof a=="function"}return t=null,Bt}function xh(){return eh||(eh=!0,Ns=_t.EventEmitter),Ns}function wk(){if(th)return Ds;th=!0;function t(v,P){var B=Object.keys(v);if(Object.getOwnPropertySymbols){var T=Object.getOwnPropertySymbols(v);P&&(T=T.filter(function(S){return Object.getOwnPropertyDescriptor(v,S).enumerable})),B.push.apply(B,T)}return B}function e(v){for(var P=1;P<arguments.length;P++){var B=arguments[P]!=null?arguments[P]:{};P%2?t(Object(B),!0).forEach(function(T){n(v,T,B[T])}):Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(B)):t(Object(B)).forEach(function(T){Object.defineProperty(v,T,Object.getOwnPropertyDescriptor(B,T))})}return v}function n(v,P,B){return P=i(P),P in v?Object.defineProperty(v,P,{value:B,enumerable:!0,configurable:!0,writable:!0}):v[P]=B,v}function r(v,P){if(!(v instanceof P))throw new TypeError("Cannot call a class as a function")}function a(v,P){for(var B=0;B<P.length;B++){var T=P[B];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(v,i(T.key),T)}}function o(v,P,B){return P&&a(v.prototype,P),Object.defineProperty(v,"prototype",{writable:!1}),v}function i(v){var P=s(v,"string");return typeof P=="symbol"?P:String(P)}function s(v,P){if(typeof v!="object"||v===null)return v;var B=v[Symbol.toPrimitive];if(B!==void 0){var T=B.call(v,P||"default");if(typeof T!="object")return T;throw new TypeError("@@toPrimitive must return a primitive value.")}return(P==="string"?String:Number)(v)}var l=Dt(),f=l.Buffer,p=L,y=p.inspect,g=y&&y.custom||"inspect";function h(v,P,B){f.prototype.copy.call(v,P,B)}return Ds=(function(){function v(){r(this,v),this.head=null,this.tail=null,this.length=0}return o(v,[{key:"push",value:function(B){var T={data:B,next:null};this.length>0?this.tail.next=T:this.head=T,this.tail=T,++this.length}},{key:"unshift",value:function(B){var T={data:B,next:this.head};this.length===0&&(this.tail=T),this.head=T,++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 T=this.head,S=""+T.data;T=T.next;)S+=B+T.data;return S}},{key:"concat",value:function(B){if(this.length===0)return f.alloc(0);for(var T=f.allocUnsafe(B>>>0),S=this.head,E=0;S;)h(S.data,T,E),E+=S.data.length,S=S.next;return T}},{key:"consume",value:function(B,T){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=T?this._getString(B):this._getBuffer(B),S}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(B){var T=this.head,S=1,E=T.data;for(B-=E.length;T=T.next;){var H=T.data,j=B>H.length?H.length:B;if(j===H.length?E+=H:E+=H.slice(0,B),B-=j,B===0){j===H.length?(++S,T.next?this.head=T.next:this.head=this.tail=null):(this.head=T,T.data=H.slice(j));break}++S}return this.length-=S,E}},{key:"_getBuffer",value:function(B){var T=f.allocUnsafe(B),S=this.head,E=1;for(S.data.copy(T),B-=S.data.length;S=S.next;){var H=S.data,j=B>H.length?H.length:B;if(H.copy(T,T.length-B,0,j),B-=j,B===0){j===H.length?(++E,S.next?this.head=S.next:this.head=this.tail=null):(this.head=S,S.data=H.slice(j));break}++E}return this.length-=E,T}},{key:g,value:function(B,T){return y(this,e(e({},T),{},{depth:0,customInspect:!1}))}}]),v})(),Ds}function Ph(){if(nh)return Hs;nh=!0;var t=Rt;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 gr(){if(rh)return Us;rh=!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,v){super(f(g,h,v))}}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 Bh(){if(ih)return Zs;ih=!0;var t=gr().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 Eh(){if(ah)return $s;ah=!0;var t=Rt;$s=oe;function e(C){var k=this;this.next=null,this.entry=null,this.finish=function(){Te(k,C)}}var n;oe.WritableState=ee;var r={deprecate:Rm()},a=xh(),o=Dt().Buffer,i=(typeof oh<"u"?oh:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function s(C){return o.from(C)}function l(C){return o.isBuffer(C)||C instanceof i}var f=Ph(),p=Bh(),y=p.getHighWaterMark,g=gr().codes,h=g.ERR_INVALID_ARG_TYPE,v=g.ERR_METHOD_NOT_IMPLEMENTED,P=g.ERR_MULTIPLE_CALLBACK,B=g.ERR_STREAM_CANNOT_PIPE,T=g.ERR_STREAM_DESTROYED,S=g.ERR_STREAM_NULL_VALUES,E=g.ERR_STREAM_WRITE_AFTER_END,H=g.ERR_UNKNOWN_ENCODING,j=f.errorOrDestroy;Ht()(oe,a);function re(){}function ee(C,k,$){n=n||pr(),C=C||{},typeof $!="boolean"&&($=k instanceof n),this.objectMode=!!C.objectMode,$&&(this.objectMode=this.objectMode||!!C.writableObjectMode),this.highWaterMark=y(this,C,"writableHighWaterMark",$),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var Y=C.decodeStrings===!1;this.decodeStrings=!Y,this.defaultEncoding=C.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(ae){Ue(k,ae)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=C.emitClose!==!1,this.autoDestroy=!!C.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(C){n=n||pr();var k=this instanceof n;if(!k&&!ge.call(oe,this))return new oe(C);this._writableState=new ee(C,this,k),this.writable=!0,C&&(typeof C.write=="function"&&(this._write=C.write),typeof C.writev=="function"&&(this._writev=C.writev),typeof C.destroy=="function"&&(this._destroy=C.destroy),typeof C.final=="function"&&(this._final=C.final)),a.call(this)}oe.prototype.pipe=function(){j(this,new B)};function ie(C,k){var $=new E;j(C,$),t.nextTick(k,$)}function Oe(C,k,$,Y){var ae;return $===null?ae=new S:typeof $!="string"&&!k.objectMode&&(ae=new h("chunk",["string","Buffer"],$)),ae?(j(C,ae),t.nextTick(Y,ae),!1):!0}oe.prototype.write=function(C,k,$){var Y=this._writableState,ae=!1,w=!Y.objectMode&&l(C);return w&&!o.isBuffer(C)&&(C=s(C)),typeof k=="function"&&($=k,k=null),w?k="buffer":k||(k=Y.defaultEncoding),typeof $!="function"&&($=re),Y.ending?ie(this,$):(w||Oe(this,Y,C,$))&&(Y.pendingcb++,ae=tt(this,Y,w,C,k,$)),ae},oe.prototype.cork=function(){this._writableState.corked++},oe.prototype.uncork=function(){var C=this._writableState;C.corked&&(C.corked--,!C.writing&&!C.corked&&!C.bufferProcessing&&C.bufferedRequest&&fe(this,C))},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(C,k,$){return!C.objectMode&&C.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(C,k,$,Y,ae,w){if(!$){var x=ze(k,Y,ae);Y!==x&&($=!0,ae="buffer",Y=x)}var z=k.objectMode?1:Y.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:Y,encoding:ae,isBuf:$,callback:w,next:null},Me?Me.next=k.lastBufferedRequest:k.bufferedRequest=k.lastBufferedRequest,k.bufferedRequestCount+=1}else Ve(C,k,!1,z,Y,ae,w);return Q}function Ve(C,k,$,Y,ae,w,x){k.writelen=Y,k.writecb=x,k.writing=!0,k.sync=!0,k.destroyed?k.onwrite(new T("write")):$?C._writev(ae,k.onwrite):C._write(ae,w,k.onwrite),k.sync=!1}function Je(C,k,$,Y,ae){--k.pendingcb,$?(t.nextTick(ae,Y),t.nextTick(F,C,k),C._writableState.errorEmitted=!0,j(C,Y)):(ae(Y),C._writableState.errorEmitted=!0,j(C,Y),F(C,k))}function ht(C){C.writing=!1,C.writecb=null,C.length-=C.writelen,C.writelen=0}function Ue(C,k){var $=C._writableState,Y=$.sync,ae=$.writecb;if(typeof ae!="function")throw new P;if(ht($),k)Je(C,$,Y,k,ae);else{var w=ve($)||C.destroyed;!w&&!$.corked&&!$.bufferProcessing&&$.bufferedRequest&&fe(C,$),Y?t.nextTick(Pe,C,$,w,ae):Pe(C,$,w,ae)}}function Pe(C,k,$,Y){$||Se(C,k),k.pendingcb--,Y(),F(C,k)}function Se(C,k){k.length===0&&k.needDrain&&(k.needDrain=!1,C.emit("drain"))}function fe(C,k){k.bufferProcessing=!0;var $=k.bufferedRequest;if(C._writev&&$&&$.next){var Y=k.bufferedRequestCount,ae=new Array(Y),w=k.corkedRequestsFree;w.entry=$;for(var x=0,z=!0;$;)ae[x]=$,$.isBuf||(z=!1),$=$.next,x+=1;ae.allBuffers=z,Ve(C,k,!0,k.length,ae,"",w.finish),k.pendingcb++,k.lastBufferedRequest=null,w.next?(k.corkedRequestsFree=w.next,w.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(C,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(C,k,$){$(new v("_write()"))},oe.prototype._writev=null,oe.prototype.end=function(C,k,$){var Y=this._writableState;return typeof C=="function"?($=C,C=null,k=null):typeof k=="function"&&($=k,k=null),C!=null&&this.write(C,k),Y.corked&&(Y.corked=1,this.uncork()),Y.ending||de(this,Y,$),this},Object.defineProperty(oe.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function ve(C){return C.ending&&C.length===0&&C.bufferedRequest===null&&!C.finished&&!C.writing}function D(C,k){C._final(function($){k.pendingcb--,$&&j(C,$),k.prefinished=!0,C.emit("prefinish"),F(C,k)})}function K(C,k){!k.prefinished&&!k.finalCalled&&(typeof C._final=="function"&&!k.destroyed?(k.pendingcb++,k.finalCalled=!0,t.nextTick(D,C,k)):(k.prefinished=!0,C.emit("prefinish")))}function F(C,k){var $=ve(k);if($&&(K(C,k),k.pendingcb===0&&(k.finished=!0,C.emit("finish"),k.autoDestroy))){var Y=C._readableState;(!Y||Y.autoDestroy&&Y.endEmitted)&&C.destroy()}return $}function de(C,k,$){k.ending=!0,F(C,k),$&&(k.finished?t.nextTick($):C.once("finish",$)),k.ended=!0,C.writable=!1}function Te(C,k,$){var Y=C.entry;for(C.entry=null;Y;){var ae=Y.callback;k.pendingcb--,ae($),Y=Y.next}k.corkedRequestsFree.next=C}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(C,k){k(C)},$s}function pr(){if(sh)return js;sh=!0;var t=Rt,e=Object.keys||function(p){var y=[];for(var g in p)y.push(g);return y};js=s;var n=Sh(),r=Eh();Ht()(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(lh)return Ks;lh=!0;var t=gr().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,v=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)},T=function(){o.req.on("finish",g)};return r(o)?(o.on("complete",g),o.on("abort",B),o.req?T():o.on("request",T)):f&&!o._writableState&&(o.on("end",p),o.on("close",p)),o.on("end",v),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",T),o.req&&o.req.removeListener("finish",g),o.removeListener("end",p),o.removeListener("close",p),o.removeListener("finish",g),o.removeListener("end",v),o.removeListener("error",P),o.removeListener("close",B)}}return Ks=a,Ks}function xk(){if(uh)return Ls;uh=!0;var t=Rt,e;function n(H,j,re){return j=r(j),j in H?Object.defineProperty(H,j,{value:re,enumerable:!0,configurable:!0,writable:!0}):H[j]=re,H}function r(H){var j=a(H,"string");return typeof j=="symbol"?j:String(j)}function a(H,j){if(typeof H!="object"||H===null)return H;var re=H[Symbol.toPrimitive];if(re!==void 0){var ee=re.call(H,j||"default");if(typeof ee!="object")return ee;throw new TypeError("@@toPrimitive must return a primitive value.")}return(j==="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,j){return{value:H,done:j}}function v(H){var j=H[i];if(j!==null){var re=H[g].read();re!==null&&(H[p]=null,H[i]=null,H[s]=null,j(h(re,!1)))}}function P(H){t.nextTick(v,H)}function B(H,j){return function(re,ee){H.then(function(){if(j[f]){re(h(void 0,!0));return}j[y](re,ee)},ee)}}var T=Object.getPrototypeOf(function(){}),S=Object.setPrototypeOf((e={get stream(){return this[g]},next:function(){var j=this,re=this[l];if(re!==null)return Promise.reject(re);if(this[f])return Promise.resolve(h(void 0,!0));if(this[g].destroyed)return new Promise(function(ie,Oe){t.nextTick(function(){j[l]?Oe(j[l]):ie(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 j=this;return new Promise(function(re,ee){j[g].destroy(null,function(ge){if(ge){ee(ge);return}re(h(void 0,!0))})})}),e),T),E=function(j){var re,ee=Object.create(S,(re={},n(re,g,{value:j,writable:!0}),n(re,i,{value:null,writable:!0}),n(re,s,{value:null,writable:!0}),n(re,l,{value:null,writable:!0}),n(re,f,{value:j._readableState.endEmitted,writable:!0}),n(re,y,{value:function(oe,ie){var Oe=ee[g].read();Oe?(ee[p]=null,ee[i]=null,ee[s]=null,oe(h(Oe,!1))):(ee[i]=oe,ee[s]=ie)},writable:!0}),re));return ee[p]=null,o(j,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 ie=ee[i];ie!==null&&(ee[p]=null,ee[i]=null,ee[s]=null,ie(h(void 0,!0))),ee[f]=!0}),j.on("readable",P.bind(null,ee)),ee};return Ls=E,Ls}function Pk(){return ch||(ch=!0,Fs=function(){throw new Error("Readable.from is not available in the browser")}),Fs}function Sh(){if(fh)return Ws;fh=!0;var t=Rt;Ws=ie;var e;ie.ReadableState=oe,_t.EventEmitter;var n=function(x,z){return x.listeners(z).length},r=xh(),a=Dt().Buffer,o=(typeof dh<"u"?dh:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function i(w){return a.from(w)}function s(w){return a.isBuffer(w)||w instanceof o}var l=L,f;l&&l.debuglog?f=l.debuglog("stream"):f=function(){};var p=wk(),y=Ph(),g=Bh(),h=g.getHighWaterMark,v=gr().codes,P=v.ERR_INVALID_ARG_TYPE,B=v.ERR_STREAM_PUSH_AFTER_EOF,T=v.ERR_METHOD_NOT_IMPLEMENTED,S=v.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,E,H,j;Ht()(ie,r);var re=y.errorOrDestroy,ee=["error","close","destroy","pause","resume"];function ge(w,x,z){if(typeof w.prependListener=="function")return w.prependListener(x,z);!w._events||!w._events[x]?w.on(x,z):Array.isArray(w._events[x])?w._events[x].unshift(z):w._events[x]=[z,w._events[x]]}function oe(w,x,z){e=e||pr(),w=w||{},typeof z!="boolean"&&(z=x instanceof e),this.objectMode=!!w.objectMode,z&&(this.objectMode=this.objectMode||!!w.readableObjectMode),this.highWaterMark=h(this,w,"readableHighWaterMark",z),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=w.emitClose!==!1,this.autoDestroy=!!w.autoDestroy,this.destroyed=!1,this.defaultEncoding=w.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,w.encoding&&(E||(E=Qr.StringDecoder),this.decoder=new E(w.encoding),this.encoding=w.encoding)}function ie(w){if(e=e||pr(),!(this instanceof ie))return new ie(w);var x=this instanceof e;this._readableState=new oe(w,this,x),this.readable=!0,w&&(typeof w.read=="function"&&(this._read=w.read),typeof w.destroy=="function"&&(this._destroy=w.destroy)),r.call(this)}Object.defineProperty(ie.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(x){this._readableState&&(this._readableState.destroyed=x)}}),ie.prototype.destroy=y.destroy,ie.prototype._undestroy=y.undestroy,ie.prototype._destroy=function(w,x){x(w)},ie.prototype.push=function(w,x){var z=this._readableState,Q;return z.objectMode?Q=!0:typeof w=="string"&&(x=x||z.defaultEncoding,x!==z.encoding&&(w=a.from(w,x),x=""),Q=!0),Oe(this,w,x,!1,Q)},ie.prototype.unshift=function(w){return Oe(this,w,null,!0,!1)};function Oe(w,x,z,Q,Me){f("readableAddChunk",x);var _e=w._readableState;if(x===null)_e.reading=!1,Ue(w,_e);else{var Z;if(Me||(Z=tt(_e,x)),Z)re(w,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?re(w,new S):ze(w,_e,x,!0);else if(_e.ended)re(w,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(w,_e,x,!1):fe(w,_e)):ze(w,_e,x,!1)}else Q||(_e.reading=!1,fe(w,_e))}return!_e.ended&&(_e.length<_e.highWaterMark||_e.length===0)}function ze(w,x,z,Q){x.flowing&&x.length===0&&!x.sync?(x.awaitDrain=0,w.emit("data",z)):(x.length+=x.objectMode?1:z.length,Q?x.buffer.unshift(z):x.buffer.push(z),x.needReadable&&Pe(w)),fe(w,x)}function tt(w,x){var z;return!s(x)&&typeof x!="string"&&x!==void 0&&!w.objectMode&&(z=new P("chunk",["string","Buffer","Uint8Array"],x)),z}ie.prototype.isPaused=function(){return this._readableState.flowing===!1},ie.prototype.setEncoding=function(w){E||(E=Qr.StringDecoder);var x=new E(w);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(w){return w>=Ve?w=Ve:(w--,w|=w>>>1,w|=w>>>2,w|=w>>>4,w|=w>>>8,w|=w>>>16,w++),w}function ht(w,x){return w<=0||x.length===0&&x.ended?0:x.objectMode?1:w!==w?x.flowing&&x.length?x.buffer.head.data.length:x.length:(w>x.highWaterMark&&(x.highWaterMark=Je(w)),w<=x.length?w:x.ended?x.length:(x.needReadable=!0,0))}ie.prototype.read=function(w){f("read",w),w=parseInt(w,10);var x=this._readableState,z=w;if(w!==0&&(x.emittedReadable=!1),w===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(w=ht(w,x),w===0&&x.ended)return x.length===0&&$(this),null;var Q=x.needReadable;f("need readable",Q),(x.length===0||x.length-w<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||(w=ht(z,x)));var Me;return w>0?Me=k(w,x):Me=null,Me===null?(x.needReadable=x.length<=x.highWaterMark,w=0):(x.length-=w,x.awaitDrain=0),x.length===0&&(x.ended||(x.needReadable=!0),z!==w&&x.ended&&$(this)),Me!==null&&this.emit("data",Me),Me};function Ue(w,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(w):(x.needReadable=!1,x.emittedReadable||(x.emittedReadable=!0,Se(w)))}}function Pe(w){var x=w._readableState;f("emitReadable",x.needReadable,x.emittedReadable),x.needReadable=!1,x.emittedReadable||(f("emitReadable",x.flowing),x.emittedReadable=!0,t.nextTick(Se,w))}function Se(w){var x=w._readableState;f("emitReadable_",x.destroyed,x.length,x.ended),!x.destroyed&&(x.length||x.ended)&&(w.emit("readable"),x.emittedReadable=!1),x.needReadable=!x.flowing&&!x.ended&&x.length<=x.highWaterMark,C(w)}function fe(w,x){x.readingMore||(x.readingMore=!0,t.nextTick(ve,w,x))}function ve(w,x){for(;!x.reading&&!x.ended&&(x.length<x.highWaterMark||x.flowing&&x.length===0);){var z=x.length;if(f("maybeReadMore read 0"),w.read(0),z===x.length)break}x.readingMore=!1}ie.prototype._read=function(w){re(this,new T("_read()"))},ie.prototype.pipe=function(w,x){var z=this,Q=this._readableState;switch(Q.pipesCount){case 0:Q.pipes=w;break;case 1:Q.pipes=[Q.pipes,w];break;default:Q.pipes.push(w);break}Q.pipesCount+=1,f("pipe count=%d opts=%j",Q.pipesCount,x);var Me=(!x||x.end!==!1)&&w!==t.stdout&&w!==t.stderr,_e=Me?Ct:u;Q.endEmitted?t.nextTick(_e):z.once("end",_e),w.on("unpipe",Z);function Z(c,_){f("onunpipe"),c===z&&_&&_.hasUnpiped===!1&&(_.hasUnpiped=!0,mr())}function Ct(){f("onend"),w.end()}var Nt=D(z);w.on("drain",Nt);var xt=!1;function mr(){f("cleanup"),w.removeListener("close",hr),w.removeListener("finish",m),w.removeListener("drain",Nt),w.removeListener("error",Et),w.removeListener("unpipe",Z),z.removeListener("end",Ct),z.removeListener("end",u),z.removeListener("data",li),xt=!0,Q.awaitDrain&&(!w._writableState||w._writableState.needDrain)&&Nt()}z.on("data",li);function li(c){f("ondata");var _=w.write(c);f("dest.write",_),_===!1&&((Q.pipesCount===1&&Q.pipes===w||Q.pipesCount>1&&ae(Q.pipes,w)!==-1)&&!xt&&(f("false write response, pause",Q.awaitDrain),Q.awaitDrain++),z.pause())}function Et(c){f("onerror",c),u(),w.removeListener("error",Et),n(w,"error")===0&&re(w,c)}ge(w,"error",Et);function hr(){w.removeListener("finish",m),u()}w.once("close",hr);function m(){f("onfinish"),w.removeListener("close",hr),u()}w.once("finish",m);function u(){f("unpipe"),z.unpipe(w)}return w.emit("pipe",z),Q.flowing||(f("pipe resume"),z.resume()),w};function D(w){return function(){var z=w._readableState;f("pipeOnDrain",z.awaitDrain),z.awaitDrain&&z.awaitDrain--,z.awaitDrain===0&&n(w,"data")&&(z.flowing=!0,C(w))}}ie.prototype.unpipe=function(w){var x=this._readableState,z={hasUnpiped:!1};if(x.pipesCount===0)return this;if(x.pipesCount===1)return w&&w!==x.pipes?this:(w||(w=x.pipes),x.pipes=null,x.pipesCount=0,x.flowing=!1,w&&w.emit("unpipe",this,z),this);if(!w){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=ae(x.pipes,w);return Z===-1?this:(x.pipes.splice(Z,1),x.pipesCount-=1,x.pipesCount===1&&(x.pipes=x.pipes[0]),w.emit("unpipe",this,z),this)},ie.prototype.on=function(w,x){var z=r.prototype.on.call(this,w,x),Q=this._readableState;return w==="data"?(Q.readableListening=this.listenerCount("readable")>0,Q.flowing!==!1&&this.resume()):w==="readable"&&!Q.endEmitted&&!Q.readableListening&&(Q.readableListening=Q.needReadable=!0,Q.flowing=!1,Q.emittedReadable=!1,f("on readable",Q.length,Q.reading),Q.length?Pe(this):Q.reading||t.nextTick(F,this)),z},ie.prototype.addListener=ie.prototype.on,ie.prototype.removeListener=function(w,x){var z=r.prototype.removeListener.call(this,w,x);return w==="readable"&&t.nextTick(K,this),z},ie.prototype.removeAllListeners=function(w){var x=r.prototype.removeAllListeners.apply(this,arguments);return(w==="readable"||w===void 0)&&t.nextTick(K,this),x};function K(w){var x=w._readableState;x.readableListening=w.listenerCount("readable")>0,x.resumeScheduled&&!x.paused?x.flowing=!0:w.listenerCount("data")>0&&w.resume()}function F(w){f("readable nexttick read 0"),w.read(0)}ie.prototype.resume=function(){var w=this._readableState;return w.flowing||(f("resume"),w.flowing=!w.readableListening,de(this,w)),w.paused=!1,this};function de(w,x){x.resumeScheduled||(x.resumeScheduled=!0,t.nextTick(Te,w,x))}function Te(w,x){f("resume",x.reading),x.reading||w.read(0),x.resumeScheduled=!1,w.emit("resume"),C(w),x.flowing&&!x.reading&&w.read(0)}ie.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 C(w){var x=w._readableState;for(f("flow",x.flowing);x.flowing&&w.read()!==null;);}ie.prototype.wrap=function(w){var x=this,z=this._readableState,Q=!1;w.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)}),w.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 Ct=x.push(Z);Ct||(Q=!0,w.pause())}});for(var Me in w)this[Me]===void 0&&typeof w[Me]=="function"&&(this[Me]=(function(Ct){return function(){return w[Ct].apply(w,arguments)}})(Me));for(var _e=0;_e<ee.length;_e++)w.on(ee[_e],this.emit.bind(this,ee[_e]));return this._read=function(Z){f("wrapped _read",Z),Q&&(Q=!1,w.resume())},this},typeof Symbol=="function"&&(ie.prototype[Symbol.asyncIterator]=function(){return H===void 0&&(H=xk()),H(this)}),Object.defineProperty(ie.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(ie.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(ie.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(x){this._readableState&&(this._readableState.flowing=x)}}),ie._fromList=k,Object.defineProperty(ie.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function k(w,x){if(x.length===0)return null;var z;return x.objectMode?z=x.buffer.shift():!w||w>=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(w,x.decoder),z}function $(w){var x=w._readableState;f("endReadable",x.endEmitted),x.endEmitted||(x.ended=!0,t.nextTick(Y,x,w))}function Y(w,x){if(f("endReadableNT",w.endEmitted,w.length),!w.endEmitted&&w.length===0&&(w.endEmitted=!0,x.readable=!1,x.emit("end"),w.autoDestroy)){var z=x._writableState;(!z||z.autoDestroy&&z.finished)&&x.destroy()}}typeof Symbol=="function"&&(ie.from=function(w,x){return j===void 0&&(j=Pk()),j(ie,w,x)});function ae(w,x){for(var z=0,Q=w.length;z<Q;z++)if(w[z]===x)return z;return-1}return Ws}function kh(){if(ph)return zs;ph=!0,zs=s;var t=gr().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=pr();Ht()(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 v=this._readableState;v.reading=!1,(v.needReadable||v.length<v.highWaterMark)&&this._read(v.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 v=this._readableState;(h.needTransform||v.needReadable||v.length<v.highWaterMark)&&this._read(v.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 Bk(){if(gh)return qs;gh=!0,qs=e;var t=kh();Ht()(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 Ek(){if(yh)return Gs;yh=!0;var t;function e(g){var h=!1;return function(){h||(h=!0,g.apply(void 0,arguments))}}var n=gr().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,v,P){P=e(P);var B=!1;g.on("close",function(){B=!0}),t===void 0&&(t=Qs()),t(g,{readable:h,writable:v},function(S){if(S)return P(S);B=!0,P()});var T=!1;return function(S){if(!B&&!T){if(T=!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),v=0;v<g;v++)h[v]=arguments[v];var P=p(h);if(Array.isArray(h[0])&&(h=h[0]),h.length<2)throw new r("streams");var B,T=h.map(function(S,E){var H=E<h.length-1,j=E>0;return s(S,H,j,function(re){B||(B=re),re&&T.forEach(l),!H&&(T.forEach(l),P(B))})});return h.reduce(f)}return Gs=y,Gs}function Ih(){return mh||(mh=!0,wt=wt=Sh(),wt.Stream=wt,wt.Readable=wt,wt.Writable=Eh(),wt.Duplex=pr(),wt.Transform=kh(),wt.PassThrough=Bk(),wt.finished=Qs(),wt.pipeline=Ek()),wt}function Ah(){if(hh)return $a;hh=!0;var t=Dt().Buffer,e=Rt,n=wh(),r=Ht(),a=Ih(),o=$a.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},i=$a.IncomingMessage=function(s,l,f,p){var y=this||ja;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 T=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)),T()}}).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();T()}else{y._xhr=s,y._pos=0,y.url=s.responseURL,y.statusCode=s.status,y.statusMessage=s.statusText;var v=s.getAllResponseHeaders().split(/\r?\n/);if(v.forEach(function(T){var S=T.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||ja,l=s._resumeFetch;l&&(s._resumeFetch=null,l())},i.prototype._onXHRProgress=function(s){var l=this||ja,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 v=new ja.MSStreamReader;v.onprogress=function(){v.result.byteLength>l._pos&&(l.push(t.from(new Uint8Array(v.result.slice(l._pos)))),l._pos=v.result.byteLength)},v.onload=function(){s(!0),l.push(null)},v.readAsArrayBuffer(p);break}l._xhr.readyState===o.DONE&&l._mode!=="ms-stream"&&(s(!0),l.push(null))},$a}function Sk(){if(vh)return Vs;vh=!0;var t=Dt().Buffer,e=Rt,n=wh(),r=Ht(),a=Ah(),o=Ih(),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 v,P=!0;if(g.mode==="disable-fetch"||"requestTimeout"in g&&!n.abortController)P=!1,v=!0;else if(g.mode==="prefer-streaming")v=!1;else if(g.mode==="allow-wrong-content-type")v=!n.overrideMimeType;else if(!g.mode||g.mode==="default"||g.mode==="prefer-fast")v=!0;else throw new Error("Invalid value for opts.mode");h._mode=l(v,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 v=this||at,P=g.toLowerCase();y.indexOf(P)===-1&&(v._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 v=g._headers,P=null;h.method!=="GET"&&h.method!=="HEAD"&&(P=new Blob(g._body,{type:(v["content-type"]||{}).value||""}));var B=[];if(Object.keys(v).forEach(function(H){var j=v[H].name,re=v[H].value;Array.isArray(re)?re.forEach(function(ee){B.push([j,ee])}):B.push([j,re])}),g._mode==="fetch"){var T=null;if(n.abortController){var S=new AbortController;T=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:T}).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,v){var P=this||at;P._body.push(g),v()},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,v){var P=this||at;typeof g=="function"&&(v=g,g=void 0),o.Writable.prototype.end.call(P,g,h,v)},f.prototype.setTimeout=function(g,h){var v=this||at;h&&v.once("timeout",h),v._socketTimeout=g,v._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 kk(){if(Th)return Js;Th=!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 Ik(){return _h||(_h=!0,Ys={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"}),Ys}function Ck(){if(bh)return Xs;bh=!0;var t=Sk(),e=Ah(),n=kk(),r=Ik(),a=De,o=Xs;return o.request=function(i,s){typeof i=="string"?i=a.parse(i):i=n(i);var l=Ak.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"],Xs}var Bt,Qm,jn,Ns,eh,Ds,th,Hs,nh,Us,rh,Zs,ih,$s,ah,oh,js,sh,Ks,lh,Ls,uh,Fs,ch,Ws,fh,dh,zs,ph,qs,gh,Gs,yh,wt,mh,$a,hh,ja,Vs,vh,at,Js,Th,Ys,_h,Xs,bh,Ak,tn,Ok,Rk,Mk,Nk,Dk,Hk,Uk,Zk,Oh=ot(()=>{O();M();R();is();qy();as();pi();Im();Ua();bs();Mm();Hm();Xm();Es();Bt={},Qm=!1,jn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ns={},eh=!1;Ds={},th=!1;Hs={},nh=!1;Us={},rh=!1;Zs={},ih=!1;$s={},ah=!1,oh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;js={},sh=!1;Ks={},lh=!1;Ls={},uh=!1;Fs={},ch=!1;Ws={},fh=!1,dh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;zs={},ph=!1;qs={},gh=!1;Gs={},yh=!1;wt={},mh=!1;$a={},hh=!1,ja=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Vs={},vh=!1,at=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Js={},Th=!1;Ys={},_h=!1;Xs={},bh=!1,Ak=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;tn=Ck(),Ok=tn.Agent,Rk=tn.ClientRequest,Mk=tn.IncomingMessage,Nk=tn.METHODS,Dk=tn.STATUS_CODES,Hk=tn.get,Uk=tn.globalAgent,Zk=tn.request});O();M();R();var My={};Ln(My,{defaults:()=>ZB,markdown:()=>UB});O();M();R();O();M();R();O();M();R();var Bo=Object.defineProperty,Gv=Object.defineProperties,Vv=Object.getOwnPropertyDescriptors,Pi=Object.getOwnPropertySymbols,Qc=Object.prototype.hasOwnProperty,ef=Object.prototype.propertyIsEnumerable,yc=(t,e,n)=>e in t?Bo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,b=(t,e)=>{for(var n in e||(e={}))Qc.call(e,n)&&yc(t,n,e[n]);if(Pi)for(var n of Pi(e))ef.call(e,n)&&yc(t,n,e[n]);return t},N=(t,e)=>Gv(t,Vv(e)),d=(t,e)=>Bo(t,"name",{value:e,configurable:!0}),tf=(t,e)=>{var n={};for(var r in t)Qc.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&&ef.call(t,r)&&(n[r]=t[r]);return n},aa=(t,e)=>{for(var n in e)Bo(t,n,{get:e[n],enumerable:!0})},wA={},Jv={};aa(Jv,{errors:()=>sf,fromJSONSchema:()=>Xg,fromJSONSchemaLegacy:()=>lB,fromObject:()=>xo,toJSONSchema:()=>st,toJSONSchemaLegacy:()=>MB,toTypescriptSchema:()=>Ho,toTypescriptType:()=>Eo});var X={};aa(X,{BRAND:()=>Ux,DIRTY:()=>Vn,EMPTY_PATH:()=>Mx,INVALID:()=>pe,NEVER:()=>UP,OK:()=>gt,ParseInputLazyPath:()=>Ot,ParseStatus:()=>Tt,Schema:()=>he,ZodAny:()=>Kr,ZodArray:()=>Lr,ZodBigInt:()=>jo,ZodBoolean:()=>Ko,ZodBranded:()=>Lo,ZodCatch:()=>Fo,ZodDate:()=>Wo,ZodDefault:()=>ma,ZodDiscriminatedUnion:()=>gg,ZodEffects:()=>Sn,ZodEnum:()=>ir,ZodError:()=>Wt,ZodFirstPartyTypeKind:()=>tg,ZodFunction:()=>mg,ZodIntersection:()=>qo,ZodIssueCode:()=>G,ZodLazy:()=>Go,ZodLiteral:()=>Vo,ZodMap:()=>vg,ZodNaN:()=>_g,ZodNativeEnum:()=>Jo,ZodNever:()=>zr,ZodNull:()=>Yo,ZodNullable:()=>Qn,ZodNumber:()=>Xo,ZodObject:()=>er,ZodOptional:()=>ln,ZodParsedType:()=>ne,ZodPipeline:()=>Qo,ZodPromise:()=>va,ZodReadonly:()=>Ta,ZodRecord:()=>Sg,ZodRef:()=>Ig,ZodSchema:()=>he,ZodSet:()=>Ag,ZodString:()=>yt,ZodSymbol:()=>jg,ZodTransformer:()=>Sn,ZodTuple:()=>nr,ZodType:()=>he,ZodUndefined:()=>_a,ZodUnion:()=>es,ZodUnknown:()=>Dr,ZodVoid:()=>Wg,addIssueToContext:()=>te,agent:()=>Wx,aimodel:()=>Jx,any:()=>sP,array:()=>fP,bigint:()=>nP,boolean:()=>Gg,coerce:()=>HP,conversation:()=>Kx,createZodEnum:()=>ha,cuid2Regex:()=>Og,cuidRegex:()=>Cg,custom:()=>dg,datasource:()=>Yx,date:()=>rP,default:()=>CP,discriminatedUnion:()=>yP,effect:()=>Jc,emailRegex:()=>Ng,enum:()=>EP,errorUtil:()=>ue,event:()=>zx,function:()=>xP,getErrorMap:()=>$r,getParsedType:()=>sn,instanceof:()=>eP,intent:()=>Vx,intersection:()=>mP,ipv4Regex:()=>Hg,ipv6Regex:()=>Ug,isAborted:()=>_o,isAsync:()=>Si,isDirty:()=>bo,isEmojiRegex:()=>Zx,isValid:()=>jr,knowledgebase:()=>Xx,late:()=>Qx,lazy:()=>PP,literal:()=>BP,makeIssue:()=>Ei,map:()=>bP,message:()=>Fx,nan:()=>tP,nativeEnum:()=>SP,never:()=>uP,null:()=>oP,nullable:()=>AP,number:()=>qg,object:()=>dP,objectUtil:()=>To,oboolean:()=>DP,onumber:()=>NP,optional:()=>IP,ostring:()=>MP,pipeline:()=>RP,preprocess:()=>OP,processCreateParams:()=>me,promise:()=>kP,quotelessJson:()=>Rx,readonly:()=>_P,record:()=>vP,ref:()=>TP,set:()=>wP,setErrorMap:()=>ig,strictObject:()=>pP,string:()=>zg,symbol:()=>iP,table:()=>qx,tablerow:()=>Gx,transformer:()=>Jc,tuple:()=>hP,ulidRegex:()=>Rg,undefined:()=>aP,union:()=>gP,unknown:()=>lP,user:()=>Lx,util:()=>be,uuidRegex:()=>Mg,variable:()=>jx,void:()=>cP});var le="x-zui";function nf(t){return typeof t=="symbol"?"symbol":typeof t=="bigint"?`${t.toString()}n`:se(t)}d(nf,"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()})`:typeof t=="string"?of(t):JSON.stringify(t)}d(se,"primitiveToTypescriptValue");function Jn(t){return typeof t>"u"?"undefined":JSON.stringify(t)}d(Jn,"unknownToTypescriptValue");var rf=d((t,e)=>{let n=Object.entries(t),r=e?" as const":"";return`{ ${n.map(([a,o])=>`${uo(a)}: ${Jn(o)}`).join(", ")} }${r}`},"recordOfUnknownToTypescriptRecord"),uo=d(t=>/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t)?t:se(t),"toPropertyKey"),Yv=d(t=>t.charAt(0).toUpperCase()+t.slice(1),"capitalize"),af=d(t=>{let e=/[^a-zA-Z0-9_]/g;return t.split(e).map(Yv).filter(r=>!!r).join("")},"toTypeArgumentName"),mc=d(t=>{for(var e;t.length&&!((e=t[0])!=null&&e.trim());)t.shift();for(;t.length&&!t[t.length-1].trim();)t.pop()},"trimEmptyLinesInPlace"),nt=d(t=>{t=t?.replace(/(\n(\s*)?){3,}/g,`
|
|
14
|
+
|
|
15
|
+
`);let e=d(a=>a.startsWith("* ")?` ${a}`:` * ${a}`,"ensureLineStartsWithAsterisk"),n=d(a=>a.replace(/\*\//g,"*\\/"),"escapeCommentEnd"),r=(t??"").split(`
|
|
16
|
+
`).map(a=>a.trim());return mc(r),r.length&&(r[0]=r[0].replace(/^\/\*\*?/,""),r[r.length-1]=r[r.length-1].replace(/\*\/$/,"")),mc(r),r.length===0?"":r.length===1?`/** ${n(r[0])} */`:`/**
|
|
17
|
+
${r.map(e).map(n).join(`
|
|
18
|
+
`)}
|
|
19
|
+
*/`},"getMultilineComment");function of(t){if(typeof t!="string")return"";let n=String.raw`${t}`.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/"/g,'\\"').replace(/'/g,"\\'");return n.includes("`")?`"${n}"`:n.includes("'")?`"${n}"`:`'${n}'`}d(of,"escapeString");var sf={};aa(sf,{JSONSchemaToZuiError:()=>oa,ObjectToZuiError:()=>co,UnrepresentableGenericError:()=>fo,UnsupportedJSONSchemaToZuiError:()=>on,UnsupportedZuiCheckToJSONSchemaError:()=>gf,UnsupportedZuiToJSONSchemaError:()=>pt,UnsupportedZuiToTypescriptSchemaError:()=>_n,UnsupportedZuiToTypescriptTypeError:()=>bf,UntitledDeclarationError:()=>xf,ZuiToJSONSchemaError:()=>sa,ZuiToTypescriptSchemaError:()=>hf,ZuiToTypescriptTypeError:()=>la,ZuiTransformError:()=>rr});var lf=class extends Error{constructor(e,n){super(n),this.transform=e}};d(lf,"ZuiTransformError");var rr=lf,uf=class extends rr{constructor(e){super("json-schema-to-zui",e)}};d(uf,"JSONSchemaToZuiError");var oa=uf,cf=class extends rr{constructor(e){super("object-to-zui",e)}};d(cf,"ObjectToZuiError");var co=cf,ff=class extends rr{constructor(e){super("zui-to-json-schema",e)}};d(ff,"ZuiToJSONSchemaError");var sa=ff,df=class extends sa{constructor(e,{suggestedAlternative:n}={}){super(`Zod type ${e} cannot be transformed to JSON Schema.`+(n?` Suggested alternative: ${n}`:""))}};d(df,"UnsupportedZuiToJSONSchemaError");var pt=df,pf=class extends sa{constructor({zodType:e,checkKind:n}){super(`Zod check .${n}() of type ${e} cannot be transformed to JSON Schema.`)}};d(pf,"UnsupportedZuiCheckToJSONSchemaError");var gf=pf,yf=class extends oa{constructor(e){super(`JSON Schema ${JSON.stringify(e)} cannot be transformed to ZUI type.`)}};d(yf,"UnsupportedJSONSchemaToZuiError");var on=yf,mf=class extends rr{constructor(e){super("zui-to-typescript-schema",e)}};d(mf,"ZuiToTypescriptSchemaError");var hf=mf,vf=class extends hf{constructor(e){super(`Zod type ${e} cannot be transformed to TypeScript schema.`)}};d(vf,"UnsupportedZuiToTypescriptSchemaError");var _n=vf,Tf=class extends rr{constructor(e){super("zui-to-typescript-type",e)}};d(Tf,"ZuiToTypescriptTypeError");var la=Tf,_f=class extends la{constructor(e){super(`Zod type ${e} cannot be transformed to TypeScript type.`)}};d(_f,"UnsupportedZuiToTypescriptTypeError");var bf=_f,wf=class extends la{constructor(){super("Schema must have a title to be transformed to a TypeScript type with a declaration.")}};d(wf,"UntitledDeclarationError");var xf=wf,Pf=class extends la{constructor(){super('ZodRef can only be transformed to a TypeScript type with a "type" declaration.')}};d(Pf,"UnrepresentableGenericError");var fo=Pf,Bf=["string","number","boolean","unknown","void","any","null","undefined","never","bigint","symbol","object"],Xv=5,Qv=d(t=>Bf.includes(t),"isPrimitive"),eT=d(t=>Bf.map(e=>`${e}[]`).includes(t),"isArrayOfPrimitives"),no=d(t=>t.replace(/ +/g," ").trim(),"stripSpaces"),Ef=class{constructor(e,n){this.key=e,this.value=n}};d(Ef,"KeyValue");var gi=Ef,Sf=class{constructor(e){this.schema=e}};d(Sf,"FnParameters");var hc=Sf,kf=class{constructor(e){this.schema=e}};d(kf,"FnReturn");var vc=kf,If=class{constructor(e){this.props=e}};d(If,"Declaration");var Rr=If;function Eo(t,e={}){let n=rT(t,e),r=ke(n,e);return e.formatter&&(r=e.formatter(r)),r}d(Eo,"toTypescriptType");var Tc=d(t=>t.endsWith("?")?t:`${t}?`,"_optionalKey");function ke(t,e){var n,r,a;let o=N(b({},e),{declaration:!1,parent:t});if(t===null)return"";if(t instanceof Rr)return tT(t,o);if(t instanceof gi){let l;if(t.value instanceof A.ZodOptional?l=t.value:t.value instanceof A.ZodDefault&&e.treatDefaultAsOptional&&(l=t.value._def.innerType.optional()),l){let v=l._def.innerType;return v instanceof A.Schema&&!v.description&&l.description&&(v=v?.describe(l.description)),ke(new gi(Tc(t.key),v),o)}let f=nt(t.value._def.description||t.value.description),p=f?.trim().length>0?`
|
|
20
|
+
`:"",y=t.value.describe(""),h=t.value instanceof A.ZodAny?Tc(t.key):t.key;return`${p}${f}${p}${h}: ${ke(y,o)}${p}`}if(t instanceof hc){if(t.schema instanceof A.ZodTuple){let y="";for(let g=0;g<t.schema.items.length;g++){let h=(a=(r=(n=t.schema.items[g])==null?void 0:n.ui)==null?void 0:r.title)!=null?a:`arg${g}`,v=t.schema.items[g];y+=`${ke(new gi(uo(h),v),o)}${g<t.schema.items.length-1?", ":""} `}return y}let l=t.schema.naked()instanceof A.ZodLiteral,f=ke(t.schema,o).trim();return f.startsWith("{")&&f.endsWith("}")||f.startsWith("[")&&f.endsWith("]")||f.startsWith("(")&&f.endsWith(")")||f.startsWith("Array<")&&f.endsWith(">")||f.startsWith("Record<")&&f.endsWith(">")||eT(f)||l?`args: ${f}`:f}if(t instanceof vc)return t.schema instanceof A.ZodOptional?`${ke(t.schema.unwrap(),o)} | undefined`:ke(t.schema,o);let i=t,s=i._def;switch(s.typeName){case A.ZodFirstPartyTypeKind.ZodString:return`${nt(i.description)} string`.trim();case A.ZodFirstPartyTypeKind.ZodNumber:case A.ZodFirstPartyTypeKind.ZodNaN:case A.ZodFirstPartyTypeKind.ZodBigInt:return`${nt(i.description)} number`.trim();case A.ZodFirstPartyTypeKind.ZodBoolean:return`${nt(i.description)} boolean`.trim();case A.ZodFirstPartyTypeKind.ZodDate:return`${nt(i.description)} Date`.trim();case A.ZodFirstPartyTypeKind.ZodUndefined:return`${nt(i.description)} undefined`.trim();case A.ZodFirstPartyTypeKind.ZodNull:return`${nt(i.description)} null`.trim();case A.ZodFirstPartyTypeKind.ZodAny:return`${nt(i.description)} any`.trim();case A.ZodFirstPartyTypeKind.ZodUnknown:return`${nt(i.description)} unknown`.trim();case A.ZodFirstPartyTypeKind.ZodNever:return`${nt(i.description)} never`.trim();case A.ZodFirstPartyTypeKind.ZodVoid:return`${nt(i.description)} void`.trim();case A.ZodFirstPartyTypeKind.ZodArray:let l=ke(s.type,o);return Qv(l)?`${l}[]`:`Array<${l}>`;case A.ZodFirstPartyTypeKind.ZodObject:return`{ ${Object.entries(s.shape()).map(([j,re])=>re instanceof A.Schema?ke(new gi(uo(j),re),o):`${j}: unknown`).join("; ")} }`;case A.ZodFirstPartyTypeKind.ZodUnion:let p=s.options.map(j=>ke(j,o));return`${nt(i.description)}
|
|
21
|
+
${p.join(" | ")}`;case A.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:let y=s.options.map(j=>ke(j,o));return`${nt(i.description)}
|
|
22
|
+
${y.join(" | ")}`;case A.ZodFirstPartyTypeKind.ZodIntersection:return`${ke(s.left,o)} & ${ke(s.right,o)}`;case A.ZodFirstPartyTypeKind.ZodTuple:return s.items.length===0?"[]":`[${s.items.map(j=>ke(j,o)).join(", ")}]`;case A.ZodFirstPartyTypeKind.ZodRecord:let h=ke(s.keyType,o),v=ke(s.valueType,o);return`${nt(i.description)} { [key: ${h}]: ${v} }`;case A.ZodFirstPartyTypeKind.ZodMap:return`Map<${ke(s.keyType,o)}, ${ke(s.valueType,o)}>`;case A.ZodFirstPartyTypeKind.ZodSet:return`Set<${ke(s.valueType,o)}>`;case A.ZodFirstPartyTypeKind.ZodFunction:let P=ke(new hc(s.args),o),B=ke(new vc(s.returns),o),T=e?.parent instanceof Rr&&e?.parent.props.type==="type";return e?.declaration&&!T?`${nt(i.description)}
|
|
23
|
+
(${P}): ${B}`:`${nt(i.description)}
|
|
24
|
+
(${P}) => ${B}`;case A.ZodFirstPartyTypeKind.ZodLazy:return ke(s.getter(),o);case A.ZodFirstPartyTypeKind.ZodLiteral:let S=nf(s.value);return`${nt(i.description)}
|
|
25
|
+
${S}`.trim();case A.ZodFirstPartyTypeKind.ZodEnum:return s.values.map(se).join(" | ");case A.ZodFirstPartyTypeKind.ZodEffects:return ke(s.schema,o);case A.ZodFirstPartyTypeKind.ZodNativeEnum:throw new bf(A.ZodFirstPartyTypeKind.ZodNativeEnum);case A.ZodFirstPartyTypeKind.ZodOptional:return`${ke(s.innerType,o)} | undefined`;case A.ZodFirstPartyTypeKind.ZodNullable:return`${ke(s.innerType,o)} | null`;case A.ZodFirstPartyTypeKind.ZodDefault:let H=e.treatDefaultAsOptional?s.innerType.optional():s.innerType;return ke(H,o);case A.ZodFirstPartyTypeKind.ZodCatch:return ke(s.innerType,o);case A.ZodFirstPartyTypeKind.ZodPromise:return`Promise<${ke(s.type,o)}>`;case A.ZodFirstPartyTypeKind.ZodBranded:return ke(s.type,o);case A.ZodFirstPartyTypeKind.ZodPipeline:return ke(s.in,o);case A.ZodFirstPartyTypeKind.ZodSymbol:return`${nt(i.description)} symbol`.trim();case A.ZodFirstPartyTypeKind.ZodReadonly:return`Readonly<${ke(s.innerType,o)}>`;case A.ZodFirstPartyTypeKind.ZodRef:return af(s.uri);default:be.assertNever(s)}}d(ke,"sUnwrapZod");var tT=d((t,e)=>{if(t.props.type==="none")return ke(t.props.schema,e);let{schema:n,identifier:r}=t.props,a=nt(n.description),o=n.describe(""),i=ke(o,N(b({},e),{declaration:!0})),l=i.split(`
|
|
26
|
+
`).length>=Xv&&e.includeClosingTags?`// end of ${r}`:"";if(t.props.type!=="type"&&n instanceof A.ZodFunction)return no(`${a}
|
|
27
|
+
declare function ${r}${i};${l}`);if(t.props.type==="variable")return no(`${a}declare const ${r}: ${i};${l}`);let f=t.props.args.length>0?`<${t.props.args.map(af).join(", ")}>`:"";return no(`${a}type ${t.props.identifier}${f} = ${i};${l}`)},"unwrapDeclaration"),nT=d(t=>t.declaration?t.declaration===!0?"variable":t.declaration:"none","getDeclarationType"),rT=d((t,e)=>{let n=nT(e),r=t.getReferences();if(n==="none"){if(r.length>0)throw new fo;return new Rr({type:"none",schema:t})}let a="title"in t.ui?t.ui.title:null;if(!a)throw new xf;if(n==="variable"){if(r.length>0)throw new fo;return new Rr({type:"variable",identifier:a,schema:t})}return new Rr({type:"type",identifier:a,schema:t,args:r})},"getDeclarationProps"),iT=typeof global=="object"&&global&&global.Object===Object&&global,Af=iT,aT=typeof self=="object"&&self&&self.Object===Object&&self,oT=Af||aT||Function("return this")(),qt=oT,sT=qt.Symbol,un=sT,Cf=Object.prototype,lT=Cf.hasOwnProperty,uT=Cf.toString,Tr=un?un.toStringTag:void 0;function Of(t){var e=lT.call(t,Tr),n=t[Tr];try{t[Tr]=void 0;var r=!0}catch{}var a=uT.call(t);return r&&(e?t[Tr]=n:delete t[Tr]),a}d(Of,"getRawTag");var cT=Of,fT=Object.prototype,dT=fT.toString;function Rf(t){return dT.call(t)}d(Rf,"objectToString");var pT=Rf,gT="[object Null]",yT="[object Undefined]",_c=un?un.toStringTag:void 0;function Mf(t){return t==null?t===void 0?yT:gT:_c&&_c in Object(t)?cT(t):pT(t)}d(Mf,"baseGetTag");var kn=Mf;function Nf(t){return t!=null&&typeof t=="object"}d(Nf,"isObjectLike");var En=Nf,mT="[object Symbol]";function Df(t){return typeof t=="symbol"||En(t)&&kn(t)==mT}d(Df,"isSymbol");var So=Df;function Hf(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(Hf,"arrayMap");var Uf=Hf,hT=Array.isArray,zt=hT,vT=1/0,bc=un?un.prototype:void 0,wc=bc?bc.toString:void 0;function ko(t){if(typeof t=="string")return t;if(zt(t))return Uf(t,ko)+"";if(So(t))return wc?wc.call(t):"";var e=t+"";return e=="0"&&1/t==-vT?"-0":e}d(ko,"baseToString");var TT=ko;function Zf(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}d(Zf,"isObject");var Xn=Zf;function $f(t){return t}d($f,"identity");var _T=$f,bT="[object AsyncFunction]",wT="[object Function]",xT="[object GeneratorFunction]",PT="[object Proxy]";function jf(t){if(!Xn(t))return!1;var e=kn(t);return e==wT||e==xT||e==bT||e==PT}d(jf,"isFunction");var Kf=jf,BT=qt["__core-js_shared__"],ro=BT,xc=(function(){var t=/[^.]+$/.exec(ro&&ro.keys&&ro.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function Lf(t){return!!xc&&xc in t}d(Lf,"isMasked");var ET=Lf,ST=Function.prototype,kT=ST.toString;function Ff(t){if(t!=null){try{return kT.call(t)}catch{}try{return t+""}catch{}}return""}d(Ff,"toSource");var In=Ff,IT=/[\\^$.*+?()[\]{}|]/g,AT=/^\[object .+?Constructor\]$/,CT=Function.prototype,OT=Object.prototype,RT=CT.toString,MT=OT.hasOwnProperty,NT=RegExp("^"+RT.call(MT).replace(IT,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Wf(t){if(!Xn(t)||ET(t))return!1;var e=Kf(t)?NT:AT;return e.test(In(t))}d(Wf,"baseIsNative");var DT=Wf;function zf(t,e){return t?.[e]}d(zf,"getValue");var HT=zf;function qf(t,e){var n=HT(t,e);return DT(n)?n:void 0}d(qf,"getNative");var An=qf,UT=An(qt,"WeakMap"),po=UT,ZT=(function(){try{var t=An(Object,"defineProperty");return t({},"",{}),t}catch{}})(),Pc=ZT,$T=9007199254740991,jT=/^(?:0|[1-9]\d*)$/;function Gf(t,e){var n=typeof t;return e=e??$T,!!e&&(n=="number"||n!="symbol"&&jT.test(t))&&t>-1&&t%1==0&&t<e}d(Gf,"isIndex");var Io=Gf;function Vf(t,e,n){e=="__proto__"&&Pc?Pc(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}d(Vf,"baseAssignValue");var Jf=Vf;function Yf(t,e){return t===e||t!==t&&e!==e}d(Yf,"eq");var Ao=Yf,KT=Object.prototype,LT=KT.hasOwnProperty;function Xf(t,e,n){var r=t[e];(!(LT.call(t,e)&&Ao(r,n))||n===void 0&&!(e in t))&&Jf(t,e,n)}d(Xf,"assignValue");var FT=Xf,WT=9007199254740991;function Qf(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=WT}d(Qf,"isLength");var Co=Qf;function ed(t){return t!=null&&Co(t.length)&&!Kf(t)}d(ed,"isArrayLike");var td=ed,zT=Object.prototype;function nd(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||zT;return t===n}d(nd,"isPrototype");var rd=nd;function id(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}d(id,"baseTimes");var qT=id,GT="[object Arguments]";function ad(t){return En(t)&&kn(t)==GT}d(ad,"baseIsArguments");var Bc=ad,od=Object.prototype,VT=od.hasOwnProperty,JT=od.propertyIsEnumerable,YT=Bc((function(){return arguments})())?Bc:function(t){return En(t)&&VT.call(t,"callee")&&!JT.call(t,"callee")},sd=YT;function ld(){return!1}d(ld,"stubFalse");var XT=ld,ud=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ec=ud&&typeof module=="object"&&module&&!module.nodeType&&module,QT=Ec&&Ec.exports===ud,Sc=QT?qt.Buffer:void 0,e_=Sc?Sc.isBuffer:void 0,t_=e_||XT,go=t_,n_="[object Arguments]",r_="[object Array]",i_="[object Boolean]",a_="[object Date]",o_="[object Error]",s_="[object Function]",l_="[object Map]",u_="[object Number]",c_="[object Object]",f_="[object RegExp]",d_="[object Set]",p_="[object String]",g_="[object WeakMap]",y_="[object ArrayBuffer]",m_="[object DataView]",h_="[object Float32Array]",v_="[object Float64Array]",T_="[object Int8Array]",__="[object Int16Array]",b_="[object Int32Array]",w_="[object Uint8Array]",x_="[object Uint8ClampedArray]",P_="[object Uint16Array]",B_="[object Uint32Array]",Ze={};Ze[h_]=Ze[v_]=Ze[T_]=Ze[__]=Ze[b_]=Ze[w_]=Ze[x_]=Ze[P_]=Ze[B_]=!0;Ze[n_]=Ze[r_]=Ze[y_]=Ze[i_]=Ze[m_]=Ze[a_]=Ze[o_]=Ze[s_]=Ze[l_]=Ze[u_]=Ze[c_]=Ze[f_]=Ze[d_]=Ze[p_]=Ze[g_]=!1;function cd(t){return En(t)&&Co(t.length)&&!!Ze[kn(t)]}d(cd,"baseIsTypedArray");var E_=cd;function fd(t){return function(e){return t(e)}}d(fd,"baseUnary");var S_=fd,dd=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Mr=dd&&typeof module=="object"&&module&&!module.nodeType&&module,k_=Mr&&Mr.exports===dd,io=k_&&Af.process,I_=(function(){try{var t=Mr&&Mr.require&&Mr.require("util").types;return t||io&&io.binding&&io.binding("util")}catch{}})(),kc=I_,Ic=kc&&kc.isTypedArray,A_=Ic?S_(Ic):E_,pd=A_,C_=Object.prototype,O_=C_.hasOwnProperty;function gd(t,e){var n=zt(t),r=!n&&sd(t),a=!n&&!r&&go(t),o=!n&&!r&&!a&&pd(t),i=n||r||a||o,s=i?qT(t.length,String):[],l=s.length;for(var f in t)(e||O_.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(gd,"arrayLikeKeys");var yd=gd;function md(t,e){return function(n){return t(e(n))}}d(md,"overArg");var hd=md,R_=hd(Object.keys,Object),M_=R_,N_=Object.prototype,D_=N_.hasOwnProperty;function vd(t){if(!rd(t))return M_(t);var e=[];for(var n in Object(t))D_.call(t,n)&&n!="constructor"&&e.push(n);return e}d(vd,"baseKeys");var H_=vd;function Td(t){return td(t)?yd(t):H_(t)}d(Td,"keys");var Oo=Td;function _d(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}d(_d,"nativeKeysIn");var U_=_d,Z_=Object.prototype,$_=Z_.hasOwnProperty;function bd(t){if(!Xn(t))return U_(t);var e=rd(t),n=[];for(var r in t)r=="constructor"&&(e||!$_.call(t,r))||n.push(r);return n}d(bd,"baseKeysIn");var j_=bd;function wd(t){return td(t)?yd(t,!0):j_(t)}d(wd,"keysIn");var K_=wd,L_=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,F_=/^\w*$/;function xd(t,e){if(zt(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||So(t)?!0:F_.test(t)||!L_.test(t)||e!=null&&t in Object(e)}d(xd,"isKey");var Ro=xd,W_=An(Object,"create"),Hr=W_;function Pd(){this.__data__=Hr?Hr(null):{},this.size=0}d(Pd,"hashClear");var z_=Pd;function Bd(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}d(Bd,"hashDelete");var q_=Bd,G_="__lodash_hash_undefined__",V_=Object.prototype,J_=V_.hasOwnProperty;function Ed(t){var e=this.__data__;if(Hr){var n=e[t];return n===G_?void 0:n}return J_.call(e,t)?e[t]:void 0}d(Ed,"hashGet");var Y_=Ed,X_=Object.prototype,Q_=X_.hasOwnProperty;function Sd(t){var e=this.__data__;return Hr?e[t]!==void 0:Q_.call(e,t)}d(Sd,"hashHas");var eb=Sd,tb="__lodash_hash_undefined__";function kd(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Hr&&e===void 0?tb:e,this}d(kd,"hashSet");var nb=kd;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,"Hash");Cn.prototype.clear=z_;Cn.prototype.delete=q_;Cn.prototype.get=Y_;Cn.prototype.has=eb;Cn.prototype.set=nb;var Ac=Cn;function Id(){this.__data__=[],this.size=0}d(Id,"listCacheClear");var rb=Id;function Ad(t,e){for(var n=t.length;n--;)if(Ao(t[n][0],e))return n;return-1}d(Ad,"assocIndexOf");var ua=Ad,ib=Array.prototype,ab=ib.splice;function Cd(t){var e=this.__data__,n=ua(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():ab.call(e,n,1),--this.size,!0}d(Cd,"listCacheDelete");var ob=Cd;function Od(t){var e=this.__data__,n=ua(e,t);return n<0?void 0:e[n][1]}d(Od,"listCacheGet");var sb=Od;function Rd(t){return ua(this.__data__,t)>-1}d(Rd,"listCacheHas");var lb=Rd;function Md(t,e){var n=this.__data__,r=ua(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}d(Md,"listCacheSet");var ub=Md;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,"ListCache");On.prototype.clear=rb;On.prototype.delete=ob;On.prototype.get=sb;On.prototype.has=lb;On.prototype.set=ub;var ca=On,cb=An(qt,"Map"),Ur=cb;function Nd(){this.size=0,this.__data__={hash:new Ac,map:new(Ur||ca),string:new Ac}}d(Nd,"mapCacheClear");var fb=Nd;function Dd(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}d(Dd,"isKeyable");var db=Dd;function Hd(t,e){var n=t.__data__;return db(e)?n[typeof e=="string"?"string":"hash"]:n.map}d(Hd,"getMapData");var fa=Hd;function Ud(t){var e=fa(this,t).delete(t);return this.size-=e?1:0,e}d(Ud,"mapCacheDelete");var pb=Ud;function Zd(t){return fa(this,t).get(t)}d(Zd,"mapCacheGet");var gb=Zd;function $d(t){return fa(this,t).has(t)}d($d,"mapCacheHas");var yb=$d;function jd(t,e){var n=fa(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}d(jd,"mapCacheSet");var mb=jd;function Rn(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(Rn,"MapCache");Rn.prototype.clear=fb;Rn.prototype.delete=pb;Rn.prototype.get=gb;Rn.prototype.has=yb;Rn.prototype.set=mb;var da=Rn,hb="Expected a function";function pa(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(hb);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(pa.Cache||da),n}d(pa,"memoize");pa.Cache=da;var vb=pa,Tb=500;function Kd(t){var e=vb(t,function(r){return n.size===Tb&&n.clear(),r}),n=e.cache;return e}d(Kd,"memoizeCapped");var _b=Kd,bb=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,wb=/\\(\\)?/g,xb=_b(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(bb,function(n,r,a,o){e.push(a?o.replace(wb,"$1"):r||n)}),e}),Pb=xb;function Ld(t){return t==null?"":TT(t)}d(Ld,"toString");var Bb=Ld;function Fd(t,e){return zt(t)?t:Ro(t,e)?[t]:Pb(Bb(t))}d(Fd,"castPath");var ga=Fd,Eb=1/0;function Wd(t){if(typeof t=="string"||So(t))return t;var e=t+"";return e=="0"&&1/t==-Eb?"-0":e}d(Wd,"toKey");var Wr=Wd;function zd(t,e){e=ga(e,t);for(var n=0,r=e.length;t!=null&&n<r;)t=t[Wr(e[n++])];return n&&n==r?t:void 0}d(zd,"baseGet");var Mo=zd;function qd(t,e,n){var r=t==null?void 0:Mo(t,e);return r===void 0?n:r}d(qd,"get");var Sb=qd;function Gd(t,e){for(var n=-1,r=e.length,a=t.length;++n<r;)t[a+n]=e[n];return t}d(Gd,"arrayPush");var Vd=Gd,kb=hd(Object.getPrototypeOf,Object),Jd=kb,Ib="[object Object]",Ab=Function.prototype,Cb=Object.prototype,Yd=Ab.toString,Ob=Cb.hasOwnProperty,Rb=Yd.call(Object);function Xd(t){if(!En(t)||kn(t)!=Ib)return!1;var e=Jd(t);if(e===null)return!0;var n=Ob.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&Yd.call(n)==Rb}d(Xd,"isPlainObject");var Cc=Xd;function Qd(){this.__data__=new ca,this.size=0}d(Qd,"stackClear");var Mb=Qd;function ep(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}d(ep,"stackDelete");var Nb=ep;function tp(t){return this.__data__.get(t)}d(tp,"stackGet");var Db=tp;function np(t){return this.__data__.has(t)}d(np,"stackHas");var Hb=np,Ub=200;function rp(t,e){var n=this.__data__;if(n instanceof ca){var r=n.__data__;if(!Ur||r.length<Ub-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new da(r)}return n.set(t,e),this.size=n.size,this}d(rp,"stackSet");var Zb=rp;function Mn(t){var e=this.__data__=new ca(t);this.size=e.size}d(Mn,"Stack");Mn.prototype.clear=Mb;Mn.prototype.delete=Nb;Mn.prototype.get=Db;Mn.prototype.has=Hb;Mn.prototype.set=Zb;var mi=Mn;function ip(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(ip,"arrayFilter");var $b=ip;function ap(){return[]}d(ap,"stubArray");var op=ap,jb=Object.prototype,Kb=jb.propertyIsEnumerable,Oc=Object.getOwnPropertySymbols,Lb=Oc?function(t){return t==null?[]:(t=Object(t),$b(Oc(t),function(e){return Kb.call(t,e)}))}:op,sp=Lb,Fb=Object.getOwnPropertySymbols,Wb=Fb?function(t){for(var e=[];t;)Vd(e,sp(t)),t=Jd(t);return e}:op,zb=Wb;function lp(t,e,n){var r=e(t);return zt(t)?r:Vd(r,n(t))}d(lp,"baseGetAllKeys");var up=lp;function cp(t){return up(t,Oo,sp)}d(cp,"getAllKeys");var Rc=cp;function fp(t){return up(t,K_,zb)}d(fp,"getAllKeysIn");var qb=fp,Gb=An(qt,"DataView"),yo=Gb,Vb=An(qt,"Promise"),mo=Vb,Jb=An(qt,"Set"),ho=Jb,Mc="[object Map]",Yb="[object Object]",Nc="[object Promise]",Dc="[object Set]",Hc="[object WeakMap]",Uc="[object DataView]",Xb=In(yo),Qb=In(Ur),ew=In(mo),tw=In(ho),nw=In(po),bn=kn;(yo&&bn(new yo(new ArrayBuffer(1)))!=Uc||Ur&&bn(new Ur)!=Mc||mo&&bn(mo.resolve())!=Nc||ho&&bn(new ho)!=Dc||po&&bn(new po)!=Hc)&&(bn=d(function(t){var e=kn(t),n=e==Yb?t.constructor:void 0,r=n?In(n):"";if(r)switch(r){case Xb:return Uc;case Qb:return Mc;case ew:return Nc;case tw:return Dc;case nw:return Hc}return e},"getTag"));var Zc=bn,rw=qt.Uint8Array,$c=rw,iw="__lodash_hash_undefined__";function dp(t){return this.__data__.set(t,iw),this}d(dp,"setCacheAdd");var aw=dp;function pp(t){return this.__data__.has(t)}d(pp,"setCacheHas");var ow=pp;function Zr(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new da;++e<n;)this.add(t[e])}d(Zr,"SetCache");Zr.prototype.add=Zr.prototype.push=aw;Zr.prototype.has=ow;var sw=Zr;function gp(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(gp,"arraySome");var lw=gp;function yp(t,e){return t.has(e)}d(yp,"cacheHas");var uw=yp,cw=1,fw=2;function mp(t,e,n,r,a,o){var i=n&cw,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&fw?new sw:void 0;for(o.set(t,e),o.set(e,t);++y<s;){var v=t[y],P=e[y];if(r)var B=i?r(P,v,y,e,t,o):r(v,P,y,t,e,o);if(B!==void 0){if(B)continue;g=!1;break}if(h){if(!lw(e,function(T,S){if(!uw(h,S)&&(v===T||a(v,T,n,r,o)))return h.push(S)})){g=!1;break}}else if(!(v===P||a(v,P,n,r,o))){g=!1;break}}return o.delete(t),o.delete(e),g}d(mp,"equalArrays");var hp=mp;function vp(t){var e=-1,n=Array(t.size);return t.forEach(function(r,a){n[++e]=[a,r]}),n}d(vp,"mapToArray");var dw=vp;function Tp(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}d(Tp,"setToArray");var pw=Tp,gw=1,yw=2,mw="[object Boolean]",hw="[object Date]",vw="[object Error]",Tw="[object Map]",_w="[object Number]",bw="[object RegExp]",ww="[object Set]",xw="[object String]",Pw="[object Symbol]",Bw="[object ArrayBuffer]",Ew="[object DataView]",jc=un?un.prototype:void 0,ao=jc?jc.valueOf:void 0;function _p(t,e,n,r,a,o,i){switch(n){case Ew:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Bw:return!(t.byteLength!=e.byteLength||!o(new $c(t),new $c(e)));case mw:case hw:case _w:return Ao(+t,+e);case vw:return t.name==e.name&&t.message==e.message;case bw:case xw:return t==e+"";case Tw:var s=dw;case ww:var l=r&gw;if(s||(s=pw),t.size!=e.size&&!l)return!1;var f=i.get(t);if(f)return f==e;r|=yw,i.set(t,e);var p=hp(s(t),s(e),r,a,o,i);return i.delete(t),p;case Pw:if(ao)return ao.call(t)==ao.call(e)}return!1}d(_p,"equalByTag");var Sw=_p,kw=1,Iw=Object.prototype,Aw=Iw.hasOwnProperty;function bp(t,e,n,r,a,o){var i=n&kw,s=Rc(t),l=s.length,f=Rc(e),p=f.length;if(l!=p&&!i)return!1;for(var y=l;y--;){var g=s[y];if(!(i?g in e:Aw.call(e,g)))return!1}var h=o.get(t),v=o.get(e);if(h&&v)return h==e&&v==t;var P=!0;o.set(t,e),o.set(e,t);for(var B=i;++y<l;){g=s[y];var T=t[g],S=e[g];if(r)var E=i?r(S,T,g,e,t,o):r(T,S,g,t,e,o);if(!(E===void 0?T===S||a(T,S,n,r,o):E)){P=!1;break}B||(B=g=="constructor")}if(P&&!B){var H=t.constructor,j=e.constructor;H!=j&&"constructor"in t&&"constructor"in e&&!(typeof H=="function"&&H instanceof H&&typeof j=="function"&&j instanceof j)&&(P=!1)}return o.delete(t),o.delete(e),P}d(bp,"equalObjects");var Cw=bp,Ow=1,Kc="[object Arguments]",Lc="[object Array]",yi="[object Object]",Rw=Object.prototype,Fc=Rw.hasOwnProperty;function wp(t,e,n,r,a,o){var i=zt(t),s=zt(e),l=i?Lc:Zc(t),f=s?Lc:Zc(e);l=l==Kc?yi:l,f=f==Kc?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 mi),i||pd(t)?hp(t,e,n,r,a,o):Sw(t,e,l,n,r,a,o);if(!(n&Ow)){var h=p&&Fc.call(t,"__wrapped__"),v=y&&Fc.call(e,"__wrapped__");if(h||v){var P=h?t.value():t,B=v?e.value():e;return o||(o=new mi),a(P,B,n,r,o)}}return g?(o||(o=new mi),Cw(t,e,n,r,a,o)):!1}d(wp,"baseIsEqualDeep");var Mw=wp;function No(t,e,n,r,a){return t===e?!0:t==null||e==null||!En(t)&&!En(e)?t!==t&&e!==e:Mw(t,e,n,r,No,a)}d(No,"baseIsEqual");var ya=No,Nw=1,Dw=2;function xp(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 mi;if(r)var g=r(f,p,l,t,e,y);if(!(g===void 0?ya(p,f,Nw|Dw,r,y):g))return!1}}return!0}d(xp,"baseIsMatch");var Hw=xp;function Pp(t){return t===t&&!Xn(t)}d(Pp,"isStrictComparable");var Bp=Pp;function Ep(t){for(var e=Oo(t),n=e.length;n--;){var r=e[n],a=t[r];e[n]=[r,a,Bp(a)]}return e}d(Ep,"getMatchData");var Uw=Ep;function Sp(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}d(Sp,"matchesStrictComparable");var kp=Sp;function Ip(t){var e=Uw(t);return e.length==1&&e[0][2]?kp(e[0][0],e[0][1]):function(n){return n===t||Hw(n,t,e)}}d(Ip,"baseMatches");var Zw=Ip;function Ap(t,e){return t!=null&&e in Object(t)}d(Ap,"baseHasIn");var $w=Ap;function Cp(t,e,n){e=ga(e,t);for(var r=-1,a=e.length,o=!1;++r<a;){var i=Wr(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)&&(zt(t)||sd(t)))}d(Cp,"hasPath");var jw=Cp;function Op(t,e){return t!=null&&jw(t,e,$w)}d(Op,"hasIn");var Kw=Op,Lw=1,Fw=2;function Rp(t,e){return Ro(t)&&Bp(e)?kp(Wr(t),e):function(n){var r=Sb(n,t);return r===void 0&&r===e?Kw(n,t):ya(e,r,Lw|Fw)}}d(Rp,"baseMatchesProperty");var Ww=Rp;function Mp(t){return function(e){return e?.[t]}}d(Mp,"baseProperty");var zw=Mp;function Np(t){return function(e){return Mo(e,t)}}d(Np,"basePropertyDeep");var qw=Np;function Dp(t){return Ro(t)?zw(Wr(t)):qw(t)}d(Dp,"property");var Gw=Dp;function Hp(t){return typeof t=="function"?t:t==null?_T:typeof t=="object"?zt(t)?Ww(t[0],t[1]):Zw(t):Gw(t)}d(Hp,"baseIteratee");var Do=Hp;function Up(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(Up,"createBaseFor");var Vw=Up,Jw=Vw(),Yw=Jw;function Zp(t,e){return t&&Yw(t,e,Oo)}d(Zp,"baseForOwn");var Xw=Zp;function $p(t,e){return ya(t,e)}d($p,"isEqual");var Yn=$p;function jp(t,e,n){n=typeof n=="function"?n:void 0;var r=n?n(t,e):void 0;return r===void 0?ya(t,e,void 0,n):!!r}d(jp,"isEqualWith");var Qw=jp;function Kp(t){return t===void 0}d(Kp,"isUndefined");var Wc=Kp;function Lp(t,e){var n={};return e=Do(e,3),Xw(t,function(r,a,o){Jf(n,a,e(r,a,o))}),n}d(Lp,"mapValues");var ex=Lp,tx="Expected a function";function Fp(t){if(typeof t!="function")throw new TypeError(tx);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(Fp,"negate");var nx=Fp;function Wp(t,e,n,r){if(!Xn(t))return t;e=ga(e,t);for(var a=-1,o=e.length,i=o-1,s=t;s!=null&&++a<o;){var l=Wr(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=Xn(p)?p:Io(e[a+1])?[]:{})}FT(s,l,f),s=s[l]}return t}d(Wp,"baseSet");var rx=Wp;function zp(t,e,n){for(var r=-1,a=e.length,o={};++r<a;){var i=e[r],s=Mo(t,i);n(s,i)&&rx(o,ga(i,t),s)}return o}d(zp,"basePickBy");var ix=zp;function qp(t,e){if(t==null)return{};var n=Uf(qb(t),function(r){return[r]});return e=Do(e),ix(t,n,function(r,a){return e(r,a[0])})}d(qp,"pickBy");var ax=qp;function Gp(t,e){return ax(t,nx(Do(e)))}d(Gp,"omitBy");var zc=Gp,ox=d(t=>{let e=t.checks;return e.length===0?"":e.map(sx).join("")},"generateStringChecks"),sx=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=Jn({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(${Jn({message:t.message,precision:r,offset:t.offset})})`;case"ip":return`.ip(${Jn({message:t.message,version:t.version})})`;default:return""}},"_generateStringCheck"),lx=d(t=>{let e=t.checks;return e.length===0?"":e.map(ux).join("")},"generateNumberChecks"),ux=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"),cx=d(t=>{let e=t.checks;return e.length===0?"":e.map(fx).join("")},"generateBigIntChecks"),fx=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"),dx=d(t=>{let e=t.checks;return e.length===0?"":e.map(px).join("")},"generateDateChecks"),px=d(t=>{switch(t.kind){case"min":return`.min(${qc(t.value)}, ${se(t.message)})`;case"max":return`.max(${qc(t.value)}, ${se(t.message)})`;default:return""}},"_generateDateCheck"),qc=d(t=>`new Date(${t})`,"dateTs"),gx=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"),yx=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 A.ZodFirstPartyTypeKind.ZodString:return`z.string()${ox(n)}${Ce(n)}${Ae(n)}`.trim();case A.ZodFirstPartyTypeKind.ZodNumber:return`z.number()${lx(n)}${Ce(n)}${Ae(n)}`.trim();case A.ZodFirstPartyTypeKind.ZodNaN:return`z.nan()${Ce(n)}${Ae(n)}`.trim();case A.ZodFirstPartyTypeKind.ZodBigInt:return`z.bigint()${cx(n)}${Ce(n)}${Ae(n)}`.trim();case A.ZodFirstPartyTypeKind.ZodBoolean:return`z.boolean()${Ce(n)}${Ae(t._def)}`.trim();case A.ZodFirstPartyTypeKind.ZodDate:return`z.date()${dx(n)}${Ce(n)}${Ae(n)}`.trim();case A.ZodFirstPartyTypeKind.ZodUndefined:return`z.undefined()${Ce(n)}${Ae(n)}`.trim();case A.ZodFirstPartyTypeKind.ZodNull:return`z.null()${Ce(n)}${Ae(n)}`.trim();case A.ZodFirstPartyTypeKind.ZodAny:return`z.any()${Ce(n)}${Ae(n)}`.trim();case A.ZodFirstPartyTypeKind.ZodUnknown:return`z.unknown()${Ce(n)}${Ae(n)}`.trim();case A.ZodFirstPartyTypeKind.ZodNever:return`z.never()${Ce(n)}${Ae(n)}`.trim();case A.ZodFirstPartyTypeKind.ZodVoid:return`z.void()${Ce(n)}${Ae(n)}`.trim();case A.ZodFirstPartyTypeKind.ZodArray:return`z.array(${Fe(n.type)})${gx(n)}${Ce(n)}${Ae(n)}`;case A.ZodFirstPartyTypeKind.ZodObject:let r=ex(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(`
|
|
28
|
+
`).trim();case A.ZodFirstPartyTypeKind.ZodUnion:return`z.union([${n.options.map(Fe).join(", ")}])${Ce(n)}${Ae(n)}`.trim();case A.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:let s=n.options.map(Fe);return`z.discriminatedUnion(${se(n.discriminator)}, [${s.join(", ")}])${Ce(n)}${Ae(n)}`.trim();case A.ZodFirstPartyTypeKind.ZodIntersection:let f=Fe(n.left),p=Fe(n.right);return`z.intersection(${f}, ${p})${Ce(n)}${Ae(n)}`.trim();case A.ZodFirstPartyTypeKind.ZodTuple:return`z.tuple([${n.items.map(Fe).join(", ")}])${Ce(n)}${Ae(n)}`.trim();case A.ZodFirstPartyTypeKind.ZodRecord:let g=Fe(n.keyType),h=Fe(n.valueType);return`z.record(${g}, ${h})${Ce(n)}${Ae(n)}`.trim();case A.ZodFirstPartyTypeKind.ZodMap:let v=Fe(n.keyType),P=Fe(n.valueType);return`z.map(${v}, ${P})${Ce(n)}${Ae(n)}`.trim();case A.ZodFirstPartyTypeKind.ZodSet:return`z.set(${Fe(n.valueType)})${yx(n)}${Ce(n)}${Ae(n)}`.trim();case A.ZodFirstPartyTypeKind.ZodFunction:let B=n.args.items.map(Fe),T=B.length?`.args(${B.join(", ")})`:"",S=Fe(n.returns);return`z.function()${T}.returns(${S})${Ce(n)}${Ae(n)}`.trim();case A.ZodFirstPartyTypeKind.ZodLazy:return`z.lazy(() => ${Fe(n.getter())})${Ce(n)}${Ae(n)}`.trim();case A.ZodFirstPartyTypeKind.ZodLiteral:return`z.literal(${se(n.value)})${Ce(n)}${Ae(n)}`.trim();case A.ZodFirstPartyTypeKind.ZodEnum:return`z.enum([${n.values.map(se).join(", ")}])${Ce(n)}${Ae(n)}`.trim();case A.ZodFirstPartyTypeKind.ZodEffects:throw new _n(A.ZodFirstPartyTypeKind.ZodEffects);case A.ZodFirstPartyTypeKind.ZodNativeEnum:throw new _n(A.ZodFirstPartyTypeKind.ZodNativeEnum);case A.ZodFirstPartyTypeKind.ZodOptional:return`z.optional(${Fe(n.innerType)})${Ce(n)}${Ae(n)}`.trim();case A.ZodFirstPartyTypeKind.ZodNullable:return`z.nullable(${Fe(n.innerType)})${Ce(n)}${Ae(n)}`.trim();case A.ZodFirstPartyTypeKind.ZodDefault:let j=Jn(n.defaultValue());return`z.default(${Fe(n.innerType)}, ${j})${Ce(n)}${Ae(n)}`.trim();case A.ZodFirstPartyTypeKind.ZodCatch:throw new _n(A.ZodFirstPartyTypeKind.ZodCatch);case A.ZodFirstPartyTypeKind.ZodPromise:return`z.promise(${Fe(n.type)})${Ce(n)}${Ae(n)}`.trim();case A.ZodFirstPartyTypeKind.ZodBranded:throw new _n(A.ZodFirstPartyTypeKind.ZodBranded);case A.ZodFirstPartyTypeKind.ZodPipeline:throw new _n(A.ZodFirstPartyTypeKind.ZodPipeline);case A.ZodFirstPartyTypeKind.ZodSymbol:throw new _n(A.ZodFirstPartyTypeKind.ZodSymbol);case A.ZodFirstPartyTypeKind.ZodReadonly:return`z.readonly(${Fe(n.innerType)})${Ce(n)}${Ae(n)}`.trim();case A.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=>`${mx(t)}${hx(t)}${vx(t)}${Tx(t)}${_x(t)}${bx(t)}${wx(t)}`,"_addZuiExtensions"),mx=d(t=>{var e;return(e=t[le])!=null&&e.title?`.title(${se(t[le].title)})`:""},"_maybeTitle"),hx=d(t=>{var e;return(e=t[le])!=null&&e.displayAs?`.displayAs(${rf({id:t[le].displayAs[0],params:t[le].displayAs[1]})})`:""},"_maybeDisplayAs"),vx=d(t=>{var e;return(e=t[le])!=null&&e.disabled?`.disabled(${t[le].disabled})`:""},"_maybeDisabled"),Tx=d(t=>{var e;return(e=t[le])!=null&&e.hidden?`.hidden(${t[le].hidden})`:""},"_maybeHidden"),_x=d(t=>{var e;return(e=t[le])!=null&&e.placeholder?`.placeholder(${se(t[le].placeholder)})`:""},"_maybePlaceholder"),bx=d(t=>{var e;return(e=t[le])!=null&&e.secret?".secret()":""},"_maybeSecret"),wx=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(${rf(Object.fromEntries(r))})`:""},"_maybeSetMetadata"),xx=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"),Vp="\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}",Jp="(([+-]\\d{2}(:?\\d{2})?)|Z)",Px="Z",Yp="(\\.\\d+)?",vo="\\.\\d{",Bx="}",Xp=d(t=>{let e=t.precision?vo+t.precision+Bx:t.precision===0?"":Yp,n=t.offset?Jp:Px;return new RegExp(`^${Vp}${e}${n}$`)},"generateDatetimeRegex"),Ex=d(t=>({precision:Sx(t),offset:t.endsWith(`${Jp}$`)}),"extractPrecisionAndOffset"),Sx=d(t=>{let e=t.slice(1+Vp.length);return e.startsWith(Yp)?null:e.startsWith(vo)?parseInt(e.slice(vo.length)):0},"_extractPrecision"),Nr={};aa(Nr,{escapeSpecialChars:()=>kx});var kx=d(t=>t.replaceAll(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeSpecialChars");function Uo(t,e,n,r){r?.errorMessages&&n&&(t.errorMessage=N(b({},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 Xe={cuid:"^[cC][^\\s-]{8,}$",cuid2:"^[a-z][a-z0-9]*$",ulid:"^[0-9A-HJKMNP-TV-Z]{26}$",email:"^(?!\\.)(?!.*\\.\\.)([a-zA-Z0-9_+-\\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\\-]*\\.)+[a-zA-Z]{2,}$",emoji:"^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",uuid:"^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$",ipv4:"^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$",ipv6:"^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$"};function Zo(t,e){let n=b({type:"string"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{});function r(a){return e.patternStrategy==="escape"?Nr.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":Tn(n,"email",a.message,e);break;case"format:idn-email":Tn(n,"idn-email",a.message,e);break;case"pattern:zod":Lt(n,Xe.email,a.message,e);break}break;case"url":Tn(n,"uri",a.message,e);break;case"uuid":Tn(n,"uuid",a.message,e);break;case"regex":Lt(n,a.regex.source,a.message,e);break;case"cuid":Lt(n,Xe.cuid,a.message,e);break;case"cuid2":Lt(n,Xe.cuid2,a.message,e);break;case"startsWith":Lt(n,"^"+r(a.value),a.message,e);break;case"endsWith":Lt(n,r(a.value)+"$",a.message,e);break;case"datetime":Tn(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":{Lt(n,r(a.value),a.message,e);break}case"ip":{a.version!=="v6"&&Tn(n,"ipv4",a.message,e),a.version!=="v4"&&Tn(n,"ipv6",a.message,e);break}case"emoji":Lt(n,Xe.emoji,a.message,e);break;case"ulid":{Lt(n,Xe.ulid,a.message,e);break}case"toLowerCase":case"toUpperCase":case"trim":break;default:}return n}d(Zo,"parseStringDef");var Tn=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(b({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(b({format:e},n&&r.errorMessages&&{errorMessage:{format:n}}))):Re(t,"format",e,n,r)},"addFormat"),Lt=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(b({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(b({pattern:e},n&&r.errorMessages&&{errorMessage:{pattern:n}}))):Re(t,"pattern",e,n,r)},"addPattern"),Ix=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=Xe.cuid;break;case"cuid2":e.format="cuid2",e.pattern=Xe.cuid2;break;case"ulid":e.format="ulid",e.pattern=Xe.ulid;break;case"uuid":e.format="uuid",e.pattern=Xe.uuid;break;case"emoji":e.format="emoji",e.pattern=Xe.emoji;break;case"email":e.format="email",e.pattern=Xe.email;break;case"ip":e.format=n.version==="v6"?"ipv6":"ipv4",e.pattern=n.version==="v6"?Xe.ipv6:Xe.ipv4;break;case"datetime":e.format="date-time",e.pattern=Xp(n).source,e[le]=N(b({},e[le]),{precision:n.precision,offset:n.offset});break;case"url":e.format="uri";break;case"endsWith":e.pattern=`${Nr.escapeSpecialChars(n.value)}$`;break;case"startsWith":e.pattern=`^${Nr.escapeSpecialChars(n.value)}`;break;case"includes":let r=n.position&&n.position>=1?`^(?:.{${n.position}}).*`:"";e.pattern=`${r}${Nr.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 gf({zodType:A.ZodFirstPartyTypeKind.ZodString,checkKind:n.kind})}return e},"zodStringToJsonString"),Ax=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"),Cx=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"),Ox=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 A.ZodFirstPartyTypeKind.ZodString:return Ix(e);case A.ZodFirstPartyTypeKind.ZodNumber:return xx(e);case A.ZodFirstPartyTypeKind.ZodNaN:throw new pt(A.ZodFirstPartyTypeKind.ZodNaN);case A.ZodFirstPartyTypeKind.ZodBigInt:throw new pt(A.ZodFirstPartyTypeKind.ZodBigInt,{suggestedAlternative:"serialize bigint to string"});case A.ZodFirstPartyTypeKind.ZodBoolean:return{type:"boolean",description:n.description,"x-zui":n["x-zui"]};case A.ZodFirstPartyTypeKind.ZodDate:throw new pt(A.ZodFirstPartyTypeKind.ZodDate,{suggestedAlternative:"use z.string().datetime() instead"});case A.ZodFirstPartyTypeKind.ZodUndefined:return oo(n);case A.ZodFirstPartyTypeKind.ZodNull:return so(n);case A.ZodFirstPartyTypeKind.ZodAny:return{description:n.description,"x-zui":n["x-zui"]};case A.ZodFirstPartyTypeKind.ZodUnknown:return{description:n.description,"x-zui":N(b({},n["x-zui"]),{def:{typeName:A.ZodFirstPartyTypeKind.ZodUnknown}})};case A.ZodFirstPartyTypeKind.ZodNever:return{not:!0,description:n.description,"x-zui":n["x-zui"]};case A.ZodFirstPartyTypeKind.ZodVoid:throw new pt(A.ZodFirstPartyTypeKind.ZodVoid);case A.ZodFirstPartyTypeKind.ZodArray:return Ax(e,st);case A.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 A.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 A.ZodFirstPartyTypeKind.ZodUnion:return{description:n.description,anyOf:n.options.map(p=>st(p)),"x-zui":n["x-zui"]};case A.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:return{description:n.description,anyOf:n.options.map(p=>st(p)),"x-zui":n["x-zui"]};case A.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 A.ZodFirstPartyTypeKind.ZodTuple:return Ox(e,st);case A.ZodFirstPartyTypeKind.ZodRecord:return{type:"object",description:n.description,additionalProperties:st(n.valueType),"x-zui":n["x-zui"]};case A.ZodFirstPartyTypeKind.ZodMap:throw new pt(A.ZodFirstPartyTypeKind.ZodMap);case A.ZodFirstPartyTypeKind.ZodSet:return Cx(e,st);case A.ZodFirstPartyTypeKind.ZodFunction:throw new pt(A.ZodFirstPartyTypeKind.ZodFunction);case A.ZodFirstPartyTypeKind.ZodLazy:throw new pt(A.ZodFirstPartyTypeKind.ZodLazy);case A.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);{A.util.assertEqual(!0);let p=typeof n.value;throw new sa(`Unsupported literal type: "${p}"`)}case A.ZodFirstPartyTypeKind.ZodEnum:return{type:"string",description:n.description,enum:n.values,"x-zui":n["x-zui"]};case A.ZodFirstPartyTypeKind.ZodEffects:throw new pt(A.ZodFirstPartyTypeKind.ZodEffects);case A.ZodFirstPartyTypeKind.ZodNativeEnum:throw new pt(A.ZodFirstPartyTypeKind.ZodNativeEnum);case A.ZodFirstPartyTypeKind.ZodOptional:return{description:n.description,anyOf:[st(n.innerType),oo()],"x-zui":N(b({},n["x-zui"]),{def:{typeName:A.ZodFirstPartyTypeKind.ZodOptional}})};case A.ZodFirstPartyTypeKind.ZodNullable:return{anyOf:[st(n.innerType),so()],"x-zui":N(b({},n["x-zui"]),{def:{typeName:A.ZodFirstPartyTypeKind.ZodNullable}})};case A.ZodFirstPartyTypeKind.ZodDefault:return N(b({},st(n.innerType)),{default:n.defaultValue()});case A.ZodFirstPartyTypeKind.ZodCatch:throw new pt(A.ZodFirstPartyTypeKind.ZodCatch);case A.ZodFirstPartyTypeKind.ZodPromise:throw new pt(A.ZodFirstPartyTypeKind.ZodPromise);case A.ZodFirstPartyTypeKind.ZodBranded:throw new pt(A.ZodFirstPartyTypeKind.ZodBranded);case A.ZodFirstPartyTypeKind.ZodPipeline:throw new pt(A.ZodFirstPartyTypeKind.ZodPipeline);case A.ZodFirstPartyTypeKind.ZodSymbol:throw new pt(A.ZodFirstPartyTypeKind.ZodPipeline);case A.ZodFirstPartyTypeKind.ZodReadonly:return N(b({},st(n.innerType)),{readOnly:!0});case A.ZodFirstPartyTypeKind.ZodRef:return{$ref:n.uri,description:n.description,"x-zui":n["x-zui"]};default:A.util.assertNever(n)}}d(st,"toJSONSchema");var oo=d(t=>({not:!0,description:t?.description,"x-zui":N(b({},t?.["x-zui"]),{def:{typeName:A.ZodFirstPartyTypeKind.ZodUndefined}})}),"undefinedSchema"),so=d(t=>({type:"null",description:t?.description,"x-zui":t?.["x-zui"]}),"nullSchema"),Qp=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(Qp,"ParseInputLazyPath");var Ot=Qp,Gc=d((t,e)=>{if(jr(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 Wt(t.common.issues);return this._error=n,this._error}}},"handleResult"),eg=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(b({},this._def))}_getType(e){return sn(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:sn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Tt,ctx:{common:e.parent.common,data:e.data,parsedType:sn(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 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:sn(e)},o=this._parseSync({data:e,path:a.path,parent:a});return Gc(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:sn(e)},a=this._parse({data:e,path:r.path,parent:r}),o=await(Si(a)?a:Promise.resolve(a));return Gc(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(b({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 Sn({schema:this,typeName:"ZodEffects",effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return ln.create(this,this._def)}nullable(){return Qn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Lr.create(this,this._def)}promise(){return va.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 Sn(N(b({},me(this._def)),{schema:this,typeName:"ZodEffects",effect:{type:"transform",transform:e}}))}default(e){let n=typeof e=="function"?e:()=>e;return new ma(N(b({},me(this._def)),{innerType:this,defaultValue:n,typeName:"ZodDefault"}))}brand(){return new Lo(b({typeName:"ZodBranded",type:this},me(this._def)))}catch(e){let n=typeof e=="function"?e:()=>e;return new Fo(N(b({},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 Ta.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(b({},i._def[le]),{[s]:l});return o}getMetadata(){return b({},this._metadataRoot._def[le])}setMetadata(e){this._metadataRoot._def[le]=b({},e)}get ui(){return b({},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(eg,"ZodType");var he=eg,tg=(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))(tg||{}),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)=>b(b({},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"]),sn=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"),Vc=$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"]),Rx=d(t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),Bi=class ng 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 ng))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(Bi,"ZodError");Bi.create=d(t=>new Bi(t),"create");var Wt=Bi,rg=$o;function ig(t){rg=t}d(ig,"setErrorMap");function $r(){return rg}d($r,"getErrorMap");var Ei=d(t=>{var e;let{data:n,path:r,errorMaps:a,issueData:o}=t,i=[...r,...o.path||[]],s=N(b({},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(b({},o),{path:i,message:(e=o.message)!=null?e:l})},"makeIssue"),Mx=[];function te(t,e){let n=Ei({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,$r(),$o].filter(r=>!!r)});t.common.issues.push(n)}d(te,"addIssueToContext");var ag=class og{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 og.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(ag,"ParseStatus");var Tt=ag,pe=Object.freeze({status:"aborted"}),Vn=d(t=>({status:"dirty",value:t}),"DIRTY"),gt=d(t=>({status:"valid",value:t}),"OK"),_o=d(t=>t.status==="aborted","isAborted"),bo=d(t=>t.status==="dirty","isDirty"),jr=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 sg extends he{constructor(){super(...arguments),this._any=!0}_parse(e){return gt(e.data)}isEqual(e){return e instanceof sg}};d(ki,"ZodAny");ki.create=d(t=>new ki(b({typeName:"ZodAny"},me(t))),"create");var Kr=ki,Ii=class wn extends he{dereference(e){return new wn(N(b({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new wn(N(b({},this._def),{type:this._def.type.clone()}))}isEqual(e){var n,r,a,o,i,s;return e instanceof wn?Yn((n=this._def.exactLength)==null?void 0:n.value,(r=e._def.exactLength)==null?void 0:r.value)&&Yn((a=this._def.maxLength)==null?void 0:a.value,(o=e._def.maxLength)==null?void 0:o.value)&&Yn((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 Ot(n,i,n.path,s)))).then(i=>Tt.mergeArray(r,i));let o=[...n.data].map((i,s)=>a.type._parseSync(new Ot(n,i,n.path,s)));return Tt.mergeArray(r,o)}get element(){return this._def.type}min(e,n){return new wn(N(b({},this._def),{minLength:{value:e,message:ue.toString(n)}}))}max(e,n){return new wn(N(b({},this._def),{maxLength:{value:e,message:ue.toString(n)}}))}length(e,n){return new wn(N(b({},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(b({type:t,minLength:null,maxLength:null,exactLength:null,typeName:"ZodArray"},me(e))),"create");var Lr=Ii,Nx=d((t,e)=>lg(t,e,new WeakSet),"isEqual"),lg=d((t,e,n)=>Qw(t,e,Dx(n)),"_isEqualWithVisitedTracking"),Dx=d(t=>(e,n)=>{if(Cc(e)&&!t.has(e)&&Cc(n)&&!t.has(n)){let r=zc(e,Wc),a=zc(n,Wc);return t.add(r).add(a).add(e).add(n),lg(r,a,t)}},"_customizerWithVisitedTracking"),Hx={compare:Nx},ug=class{constructor(e=[],n={}){this._options=b(b({},Hx),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(ug,"CustomSet");var et=ug,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 o=this._getOrReturnCtx(e);return te(o,{code:G.invalid_type,expected:ne.bigint,received:o.parsedType}),pe}let r,a=new Tt;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 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,a){return new hi(N(b({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ue.toString(a)}]}))}_addCheck(e){return new hi(N(b({},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(b({checks:[],typeName:"ZodBigInt",coerce:(e=t?.coerce)!=null?e:!1},me(t)))},"create");var jo=Ai,Ci=class cg 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 gt(e.data)}isEqual(e){return e instanceof cg?this._def.coerce===e._def.coerce:!1}};d(Ci,"ZodBoolean");Ci.create=d(t=>new Ci(b({typeName:"ZodBoolean",coerce:t?.coerce||!1},me(t))),"create");var Ko=Ci,Ux=Symbol("zod_brand"),fg=class br extends he{dereference(e){return new br(N(b({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new br(N(b({},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(b({},this._def),{type:this._def.type.mandatory()}))}};d(fg,"ZodBranded");var Lo=fg,Oi=class wr extends he{_parse(e){let{ctx:n}=this._processInputParams(e),r=N(b({},n),{common:N(b({},n.common),{issues:[]})}),a=this._def.innerType._parse({data:r.data,path:r.path,parent:b({},r)});return Si(a)?a.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Wt(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Wt(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(b({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new wr(N(b({},this._def),{innerType:this._def.innerType.clone()}))}naked(){return this._def.innerType.naked()}mandatory(){return new wr(N(b({},this._def),{innerType:this._def.innerType.mandatory()}))}};d(Oi,"ZodCatch");Oi.create=d((t,e)=>new Oi(b({innerType:t,typeName:"ZodCatch",catchValue:typeof e.catch=="function"?e.catch:()=>e.catch},me(e))),"create");var Fo=Oi,dg=d((t,e={},n)=>t?Kr.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(b({code:"custom"},f),{fatal:l}))}}):Kr.create(),"custom"),Ri=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 Tt,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(b({},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(Ri,"ZodDate");Ri.create=d(t=>new Ri(b({checks:[],coerce:t?.coerce||!1,typeName:"ZodDate"},me(t))),"create");var Wo=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(b({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new xr(N(b({},this._def),{innerType:this._def.innerType.clone()}))}isEqual(e){return e instanceof xr?this._def.innerType.isEqual(e._def.innerType)&&Yn(this._def.defaultValue(),e._def.defaultValue()):!1}unwrap(){return this._def.innerType}naked(){return this._def.innerType.naked()}mandatory(){return new xr(N(b({},this._def),{innerType:this._def.innerType.mandatory()}))}};d(Mi,"ZodDefault");Mi.create=d((t,e,n)=>new Mi(b({innerType:t,typeName:"ZodDefault",defaultValue:typeof e=="function"?e:()=>e},me(n))),"create");var ma=Mi,Gt=d(t=>Array.from(new Set(t)),"unique"),Ft=d(t=>t instanceof Go?Ft(t.schema):t instanceof Sn?Ft(t.innerType()):t instanceof Vo?[t.value]:t instanceof ir?t.options:t instanceof Jo?be.objectValues(t.enum):t instanceof ma?Ft(t._def.innerType):t instanceof _a?[void 0]:t instanceof Yo?[null]:t instanceof ln?[void 0,...Ft(t.unwrap())]:t instanceof Qn?[null,...Ft(t.unwrap())]:t instanceof Lo||t instanceof Ta?Ft(t.unwrap()):t instanceof Fo?Ft(t._def.innerType):[],"getDiscriminator"),pg=class xn extends he{dereference(e){let n=this.options.map(a=>a.dereference(e)),r=xn._getOptionsMap(this.discriminator,n);return new xn(N(b({},this._def),{options:n,optionsMap:r}))}getReferences(){return Gt(this.options.flatMap(e=>e.getReferences()))}clone(){let e=this.options.map(n=>n.clone());return new xn(N(b({},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=xn._getOptionsMap(e,n);return new xn(b({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=Ft(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 xn)||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(pg,"ZodDiscriminatedUnion");var gg=pg;function ha(t,e){return new ir(b({values:t,typeName:"ZodEnum"},me(e)))}d(ha,"createZodEnum");var zo=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 gt(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return vi.create(e,b(b({},this._def),n))}exclude(e,n=this._def){return vi.create(this.options.filter(r=>!e.includes(r)),b(b({},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(zo,"ZodEnum");zo.create=ha;var ir=zo,yg=class Pn 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 Pn(N(b({},this._def),{args:n,returns:r}))}getReferences(){return Gt([...this._def.args.getReferences(),...this._def.returns.getReferences()])}clone(){return new Pn(N(b({},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,$r(),Vc].filter(f=>!!f),issueData:{code:G.invalid_arguments,argumentsError:l}})}d(r,"makeArgsIssue");function a(s,l){return Ei({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,$r(),Vc].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 va){let s=this;return gt(async function(...l){let f=new Wt([]),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 gt(function(...l){let f=s._def.args.safeParse(l,o);if(!f.success)throw new Wt([r(l,f.error)]);let p=Reflect.apply(i,this,f.data),y=s._def.returns.safeParse(p,o);if(!y.success)throw new Wt([a(p,y.error)]);return y.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Pn(N(b({},this._def),{args:nr.create(e).rest(Dr.create())}))}returns(e){return new Pn(N(b({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new Pn(b({args:e||nr.create([]).rest(Dr.create()),returns:n||Dr.create(),typeName:"ZodFunction"},me(r)))}isEqual(e){return e instanceof Pn&&this._def.args.isEqual(e._def.args)&&this._def.returns.isEqual(e._def.returns)}};d(yg,"ZodFunction");var mg=yg;function Ni(t,e){let n=sn(t),r=sn(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=b(b({},t),e);for(let s of o){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 a=[];for(let o=0;o<t.length;o++){let i=t[o],s=e[o],l=Ni(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(Ni,"mergeValues");var Di=class Ti extends he{dereference(e){return new Ti(N(b({},this._def),{left:this._def.left.dereference(e),right:this._def.right.dereference(e)}))}getReferences(){return Gt([...this._def.left.getReferences(),...this._def.right.getReferences()])}clone(){return new Ti(N(b({},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=Ni(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 Ti))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(Di,"ZodIntersection");Di.create=d((t,e,n)=>new Di(b({left:t,right:e,typeName:"ZodIntersection"},me(n))),"create");var qo=Di,Hi=class Pr extends he{get schema(){return this._def.getter()}dereference(e){return new Pr(N(b({},this._def),{getter:d(()=>this._def.getter().dereference(e),"getter")}))}getReferences(){return this._def.getter().getReferences()}clone(){return new Pr(N(b({},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(b({},this._def),{getter:d(()=>this._def.getter().mandatory(),"getter")}))}};d(Hi,"ZodLazy");Hi.create=d((t,e)=>new Hi(b({getter:t,typeName:"ZodLazy"},me(e))),"create");var Go=Hi,Ui=class hg 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 hg?Yn(this._def.value,e._def.value):!1}};d(Ui,"ZodLiteral");Ui.create=d((t,e)=>new Ui(b({value:t,typeName:"ZodLiteral"},me(e))),"create");var Vo=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(b({},this._def),{keyType:n,valueType:r}))}getReferences(){return Gt([...this._def.keyType.getReferences(),...this._def.valueType.getReferences()])}clone(){return new _i(N(b({},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 Ot(r,s,r.path,[f,"key"])),value:o._parse(new Ot(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(b({valueType:e,keyType:t,typeName:"ZodMap"},me(n))),"create");var vg=Zi,$i=class Tg 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 Tg}};d($i,"ZodNaN");$i.create=d(t=>new $i(b({typeName:"ZodNaN"},me(t))),"create");var _g=$i,ji=class bg 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 gt(e.data)}get enum(){return this._def.values}isEqual(e){return e instanceof bg?Yn(this._def.values,e._def.values):!1}};d(ji,"ZodNativeEnum");ji.create=d((t,e)=>new ji(b({values:t,typeName:"ZodNativeEnum"},me(e))),"create");var Jo=ji,Ki=class wg 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 wg}};d(Ki,"ZodNever");Ki.create=d(t=>new Ki(b({typeName:"ZodNever"},me(t))),"create");var zr=Ki,Li=class xg 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 gt(e.data)}isEqual(e){return e instanceof xg}};d(Li,"ZodNull");Li.create=d(t=>new Li(b({typeName:"ZodNull"},me(t))),"create");var Yo=Li,Fi=class Br extends he{dereference(e){return new Br(N(b({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Br(N(b({},this._def),{innerType:this._def.innerType.clone()}))}_parse(e){return this._getType(e)===ne.null?gt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}isEqual(e){return e instanceof Br?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return new Br(N(b({},this._def),{innerType:this._def.innerType.mandatory()}))}};d(Fi,"ZodNullable");Fi.create=d((t,e)=>new Fi(b({innerType:t,typeName:"ZodNullable"},me(e))),"create");var Qn=Fi;function Pg(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(Pg,"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 o=this._getOrReturnCtx(e);return te(o,{code:G.invalid_type,expected:ne.number,received:o.parsedType}),pe}let r,a=new Tt;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"?Pg(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 bi(N(b({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ue.toString(a)}]}))}_addCheck(e){return new bi(N(b({},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(b({checks:[],typeName:"ZodNumber",coerce:t?.coerce||!1},me(t))),"create");var Xo=Wi;function Bn(t){if(t instanceof er){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=ln.create(Bn(r))}return new er(N(b({},t._def),{shape:d(()=>e,"shape")}))}else return t instanceof Lr?new Lr(N(b({},t._def),{type:Bn(t.element)})):t instanceof ln?ln.create(Bn(t.unwrap())):t instanceof Qn?Qn.create(Bn(t.unwrap())):t instanceof nr?nr.create(t.items.map(e=>Bn(e))):t}d(Bn,"deepPartialify");var cn=class vt extends he{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=be.objectKeys(e);return this._cached={shape:e,keys:n}}dereference(e){let n=this._def.shape(),r={};for(let a in n)r[a]=n[a].dereference(e);return new vt(N(b({},this._def),{shape:d(()=>r,"shape")}))}getReferences(){let e=this._def.shape(),n=[];for(let r in e)n.push(...e[r].getReferences());return Gt(n)}clone(){let e={},n=this._def.shape();for(let[r,a]of Object.entries(n))e[r]=a.clone();return new vt(N(b({},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 Ot(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 Ot(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=>Tt.mergeObjectSync(r,p)):Tt.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return ue.errToObj,new vt(b(N(b({},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 vt(N(b({},this._def),{unknownKeys:"strip"}))}passthrough(){return new vt(N(b({},this._def),{unknownKeys:"passthrough"}))}additionalProperties(){if(this._def.unknownKeys instanceof he)return this._def.unknownKeys;if(this._def.unknownKeys==="passthrough")return Kr.create();if(this._def.unknownKeys==="strict")return zr.create()}extend(e){return new vt(N(b({},this._def),{shape:d(()=>b(b({},this._def.shape()),e),"shape")}))}merge(e){return new vt({unknownKeys:e._def.unknownKeys,shape:d(()=>b(b({},this._def.shape()),e._def.shape()),"shape"),typeName:"ZodObject"})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new vt(N(b({},this._def),{unknownKeys:e}))}pick(e){let n={};return be.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new vt(N(b({},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 vt(N(b({},this._def),{shape:d(()=>n,"shape")}))}deepPartial(){return Bn(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 vt(N(b({},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 ln;)o=o._def.innerType;n[r]=o}}),new vt(N(b({},this._def),{shape:d(()=>n,"shape")}))}keyof(){return ha(be.objectKeys(this.shape))}isEqual(e){if(!(e instanceof vt)||!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(cn,"ZodObject");cn.create=d((t,e)=>new cn(b({shape:d(()=>t,"shape"),unknownKeys:"strip",typeName:"ZodObject"},me(e))),"create");cn.strictCreate=d((t,e)=>new cn(b({shape:d(()=>t,"shape"),unknownKeys:"strict",typeName:"ZodObject"},me(e))),"strictCreate");cn.lazycreate=d((t,e)=>new cn(b({shape:t,unknownKeys:"strip",typeName:"ZodObject"},me(e))),"lazycreate");var er=cn,zi=class wi extends he{dereference(e){return new wi(N(b({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new wi(N(b({},this._def),{innerType:this._def.innerType.clone()}))}_parse(e){return this._getType(e)===ne.undefined?gt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}isEqual(e){return e instanceof 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(b({innerType:t,typeName:"ZodOptional"},me(e))),"create");var ln=zi,Bg=class Er extends he{dereference(e){return new Er(N(b({},this._def),{in:this._def.in.dereference(e),out:this._def.out.dereference(e)}))}getReferences(){return Gt([...this._def.in.getReferences(),...this._def.out.getReferences()])}clone(){return new Er(N(b({},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(),Vn(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 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(Bg,"ZodPipeline");var Qo=Bg,qi=class xi extends he{unwrap(){return this._def.type}dereference(e){return new xi(N(b({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new xi(N(b({},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 gt(r.then(a=>this._def.type.parseAsync(a,{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(b({type:t,typeName:"ZodPromise"},me(e))),"create");var va=qi,Gi=class Sr extends he{dereference(e){return new Sr(N(b({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Sr(N(b({},this._def),{innerType:this._def.innerType.clone()}))}_parse(e){let n=this._def.innerType._parse(e);return jr(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(b({},this._def),{innerType:this._def.innerType.mandatory()}))}};d(Gi,"ZodReadonly");Gi.create=d((t,e)=>new Gi(b({innerType:t,typeName:"ZodReadonly"},me(e))),"create");var Ta=Gi,Eg=class zn 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 zn(N(b({},this._def),{keyType:n,valueType:r}))}getReferences(){return Gt([...this._def.keyType.getReferences(),...this._def.valueType.getReferences()])}clone(){return new zn(N(b({},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 Ot(r,s,r.path,s)),value:i._parse(new Ot(r,r.data[s],r.path,s))});return r.common.async?Tt.mergeObjectAsync(n,a):Tt.mergeObjectSync(n,a)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof he?new zn(b({keyType:e,valueType:n,typeName:"ZodRecord"},me(r))):new zn(b({keyType:yt.create(),valueType:e,typeName:"ZodRecord"},me(n)))}isEqual(e){return!(!(e instanceof zn)||!this._def.keyType.isEqual(e._def.keyType)||!this._def.valueType.isEqual(e._def.valueType))}};d(Eg,"ZodRecord");var Sg=Eg,Vi=class kg 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 kg?this._def.uri===e._def.uri:!1}};d(Vi,"ZodRef");Vi.create=d(t=>new Vi({typeName:"ZodRef",uri:t}),"create");var Ig=Vi,Ji=class qn extends he{dereference(e){return new qn(N(b({},this._def),{valueType:this._def.valueType.dereference(e)}))}getReferences(){return this._def.valueType.getReferences()}clone(){return new qn(N(b({},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 Ot(r,l,r.path,f)));return r.common.async?Promise.all(s).then(l=>i(l)):i(s)}min(e,n){return new qn(N(b({},this._def),{minSize:{value:e,message:ue.toString(n)}}))}max(e,n){return new qn(N(b({},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 qn))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(Ji,"ZodSet");Ji.create=d((t,e)=>new Ji(b({valueType:t,minSize:null,maxSize:null,typeName:"ZodSet"},me(e))),"create");var Ag=Ji,Cg=/^c[^\s-]{8,}$/i,Og=/^[a-z][a-z0-9]*$/,Rg=/^[0-9A-HJKMNP-TV-Z]{26}$/,Mg=/^[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,Ng=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Dg="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Zx=d(t=>t===Dg,"isEmojiRegex"),lo,Hg=/^(((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}))$/,Ug=/^(([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 Zg(t,e){return!!((e==="v4"||!e)&&Hg.test(t)||(e==="v6"||!e)&&Ug.test(t))}d(Zg,"isValidIP");var Yi=class Gn 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 Tt,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")Ng.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(Dg,"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")Mg.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")Cg.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")Og.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")Rg.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"?Xp(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"?Zg(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),b({validation:n,code:G.invalid_string},ue.errToObj(r)))}_addCheck(e){return new Gn(N(b({},this._def),{checks:[...this._def.checks,e]}))}email(e){return this._addCheck(b({kind:"email"},ue.errToObj(e)))}url(e){return this._addCheck(b({kind:"url"},ue.errToObj(e)))}emoji(e){return this._addCheck(b({kind:"emoji"},ue.errToObj(e)))}uuid(e){return this._addCheck(b({kind:"uuid"},ue.errToObj(e)))}cuid(e){return this._addCheck(b({kind:"cuid"},ue.errToObj(e)))}cuid2(e){return this._addCheck(b({kind:"cuid2"},ue.errToObj(e)))}ulid(e){return this._addCheck(b({kind:"ulid"},ue.errToObj(e)))}ip(e){return this._addCheck(b({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(b({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(b({kind:"regex",regex:e},ue.errToObj(n)))}includes(e,n){return this._addCheck(b({kind:"includes",value:e,position:n?.position},ue.errToObj(n?.message)))}startsWith(e,n){return this._addCheck(b({kind:"startsWith",value:e},ue.errToObj(n)))}endsWith(e,n){return this._addCheck(b({kind:"endsWith",value:e},ue.errToObj(n)))}min(e,n){return this._addCheck(b({kind:"min",value:e},ue.errToObj(n)))}max(e,n){return this._addCheck(b({kind:"max",value:e},ue.errToObj(n)))}length(e,n){return this._addCheck(b({kind:"length",value:e},ue.errToObj(n)))}nonempty(e){return this.min(1,ue.errToObj(e))}trim(){return new Gn(N(b({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}secret(){return this._def[le]=N(b({},this._def[le]),{secret:!0}),this}toLowerCase(){return new Gn(N(b({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new Gn(N(b({},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 Gn))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(b({checks:[],typeName:"ZodString",coerce:(e=t?.coerce)!=null?e:!1},me(N(b({},t),{supportsExtensions:["secret"]}))))},"create");var yt=Yi,Xi=class $g 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 gt(e.data)}isEqual(e){return e instanceof $g}};d(Xi,"ZodSymbol");Xi.create=d(t=>new Xi(b({typeName:"ZodSymbol"},me(t))),"create");var jg=Xi,tr=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(b({},this._def),{schema:this._def.schema.dereference(e)}))}getReferences(){return this._def.schema.getReferences()}clone(){return new kr(N(b({},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"?Vn(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"?Vn(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(!jr(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=>jr(i)?Promise.resolve(a.transform(i.value,o)).then(s=>({status:n.value,value:s})):i);be.assertNever(a)}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(b({},this._def),{schema:this._def.schema.mandatory()}))}};d(tr,"ZodEffects");tr.create=d((t,e,n)=>new tr(b({schema:t,typeName:"ZodEffects",effect:e},me(n))),"create");tr.createWithPreprocess=d((t,e,n)=>new tr(b({schema:e,effect:{type:"preprocess",transform:t},typeName:"ZodEffects"},me(n))),"createWithPreprocess");var Sn=tr,Qi=class Ir 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 Ir(N(b({},this._def),{items:n,rest:r}))}getReferences(){return Gt([...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(b({},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 Ot(r,i,r.path,s)):null}).filter(i=>!!i);return r.common.async?Promise.all(o).then(i=>Tt.mergeArray(n,i)):Tt.mergeArray(n,o)}get items(){return this._def.items}rest(e){return new Ir(N(b({},this._def),{rest:e}))}isEqual(e){if(!(e instanceof Ir)||!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(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(b({items:t,typeName:"ZodTuple",rest:null},me(e)))},"create");var nr=Qi,ea=class Kg 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 gt(e.data)}isEqual(e){return e instanceof Kg}mandatory(){return zr.create(b({},this._def))}};d(ea,"ZodUndefined");ea.create=d(t=>new ea(b({typeName:"ZodUndefined"},me(t))),"create");var _a=ea,ta=class Ar extends he{dereference(e){let n=this._def.options.map(r=>r.dereference(e));return new Ar(N(b({},this._def),{options:n}))}getReferences(){return Gt(this._def.options.reduce((e,n)=>[...e,...n.getReferences()],[]))}clone(){let e=this._def.options.map(n=>n.clone());return new Ar(N(b({},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 Wt(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(b({},n),{common:N(b({},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(b({},n),{common:N(b({},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 Wt(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((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 _a)).map(o=>o.mandatory()),[n,r,...a]=e;return n?r?new Ar(N(b({},this._def),{options:[n,r,...a]})):n:zr.create(b({},this._def))}};d(ta,"ZodUnion");ta.create=d((t,e)=>new ta(b({options:t,typeName:"ZodUnion"},me(e))),"create");var es=ta,na=class Lg extends he{constructor(){super(...arguments),this._unknown=!0}_parse(e){return gt(e.data)}isEqual(e){return e instanceof Lg}};d(na,"ZodUnknown");na.create=d(t=>new na(b({typeName:"ZodUnknown"},me(t))),"create");var Dr=na,ra=class Fg 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 gt(e.data)}isEqual(e){return e instanceof Fg}};d(ra,"ZodVoid");ra.create=d(t=>new ra(b({typeName:"ZodVoid"},me(t))),"create");var Wg=ra,$x=["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"],LA=ir.create(["any","string","number","boolean","object","pattern","date","array","target","time","enum"]),jx=d(t=>yt.create().displayAs({id:"variable",params:b({type:t?.type||"any"},t?.params)}),"variable"),Kx=d(t=>yt.create().displayAs({id:"conversation",params:b({},t?.params)}),"conversation"),Lx=d(t=>yt.create().displayAs({id:"user",params:b({},t?.params)}),"user"),Fx=d(t=>yt.create().displayAs({id:"message",params:b({},t?.params)}),"message"),Wx=d(t=>yt.create().displayAs({id:"agent",params:b({},t?.params)}),"agent"),zx=d(t=>yt.create().displayAs({id:"event",params:b({},t?.params)}),"event"),qx=d(t=>yt.create().displayAs({id:"table",params:b({},t?.params)}),"table"),Gx=d(t=>yt.create().displayAs({id:"tablerow",params:b({},t?.params)}),"tablerow"),Vx=d(t=>yt.create().displayAs({id:"intent",params:b({},t?.params)}),"intent"),Jx=d(()=>ir.create($x).displayAs({id:"dropdown",params:{}}),"aimodel"),Yx=d(t=>yt.create().displayAs({id:"datasource",params:b({},t)}),"datasource"),Xx=d(t=>yt.create().displayAs({id:"knowledgebase",params:b({},t)}),"knowledgebase"),Qx={object:er.lazycreate},eP=d((t,e={message:`Input not instance of ${t.name}`})=>dg(n=>n instanceof t,e),"instanceOfType"),zg=yt.create,qg=Xo.create,tP=_g.create,nP=jo.create,Gg=Ko.create,rP=Wo.create,iP=jg.create,aP=_a.create,oP=Yo.create,sP=Kr.create,lP=Dr.create,uP=zr.create,cP=Wg.create,fP=Lr.create,dP=er.create,pP=er.strictCreate,gP=es.create,yP=gg.create,mP=qo.create,hP=nr.create,vP=Sg.create,TP=Ig.create,_P=Ta.create,bP=vg.create,wP=Ag.create,xP=mg.create,PP=Go.create,BP=Vo.create,EP=ir.create,SP=Jo.create,kP=va.create,Jc=Sn.create,IP=ln.create,AP=Qn.create,CP=ma.create,OP=Sn.createWithPreprocess,RP=Qo.create,MP=d(()=>zg().optional(),"ostring"),NP=d(()=>qg().optional(),"onumber"),DP=d(()=>Gg().optional(),"oboolean"),HP={string:d(t=>yt.create(N(b({},t),{coerce:!0})),"string"),number:d(t=>Xo.create(N(b({},t),{coerce:!0})),"number"),boolean:d(t=>Ko.create(N(b({},t),{coerce:!0})),"boolean"),bigint:d(t=>jo.create(N(b({},t),{coerce:!0})),"bigint"),date:d(t=>Wo.create(N(b({},t),{coerce:!0})),"date")},UP=pe,A=X,Vg=d((t,e)=>t.anyOf.length?t.anyOf.length===1?it(t.anyOf[0],N(b({},e),{path:[...e.path,"anyOf",0]})):`z.union([${t.anyOf.map((n,r)=>it(n,N(b({},e),{path:[...e.path,"anyOf",r]}))).join(", ")}])`:"z.any()","parseAnyOf"),ZP=d(t=>{var e;return(e=t[le])!=null&&e.coerce?"z.coerce.boolean()":"z.boolean()"},"parseBoolean"),$P=d(t=>"z.any()","parseDefault"),jP=d((t,e)=>`z.union([${t.type.map(n=>it(N(b({},t),{type:n}),e)).join(", ")}])`,"parseMultipleType"),KP=d((t,e)=>`z.any().refine((value) => !${it(t.not,N(b({},e),{path:[...e.path,"not"]}))}.safeParse(value).success, "Invalid input: Should NOT be valid against schema")`,"parseNot"),LP=d(t=>"z.null()","parseNull"),FP=d(t=>[t.slice(0,t.length/2),t.slice(t.length/2)],"half"),WP=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 Cr=Symbol("Original index"),zP=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(b({},r),{[Cr]:n}))}}return e},"ensureOriginalIndex");function Fr(t,e){if(t.allOf.length===0)return"z.never()";if(t.allOf.length===1){let n=t.allOf[0];return it(n,N(b({},e),{path:[...e.path,"allOf",n[Cr]]}))}else{let[n,r]=FP(zP(t.allOf));return`z.intersection(${Fr({allOf:n},e)}, ${Fr({allOf:r},e)})`}}d(Fr,"parseAllOf");var qP=d((t,e)=>{if(Array.isArray(t.items))return`z.tuple([${t.items.map((r,a)=>it(r,N(b({},e),{path:[...e.path,"items",a]})))}])`;let n=t.items?`z.array(${it(t.items,N(b({},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"),GP=d(t=>`z.literal(${JSON.stringify(t.const)})`,"parseConst"),VP=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"),JP=d((t,e)=>{let n=it(t.if,N(b({},e),{path:[...e.path,"if"]})),r=it(t.then,N(b({},e),{path:[...e.path,"then"]})),a=it(t.else,N(b({},e),{path:[...e.path,"else"]}));return`z.union([${r}, ${a}]).superRefine((value,ctx) => {
|
|
24
29
|
const result = ${n}.safeParse(value).success
|
|
25
30
|
? ${r}.safeParse(value)
|
|
26
31
|
: ${a}.safeParse(value);
|
|
27
32
|
if (!result.success) {
|
|
28
33
|
result.error.errors.forEach((error) => ctx.addIssue(error))
|
|
29
34
|
}
|
|
30
|
-
})`},"parseIfThenElse"),
|
|
31
|
-
const schemas = [${t.oneOf.map((n,r)=>it(n,N(
|
|
35
|
+
})`},"parseIfThenElse"),YP=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(b({},e),{path:[...e.path,"oneOf",0]})):`z.any().superRefine((x, ctx) => {
|
|
36
|
+
const schemas = [${t.oneOf.map((n,r)=>it(n,N(b({},e),{path:[...e.path,"oneOf",r]}))).join(", ")}];
|
|
32
37
|
const errors = schemas.reduce(
|
|
33
38
|
(errors: z.ZodError[], schema) =>
|
|
34
39
|
((result) => ("error" in result ? [...errors, result.error] : errors))(
|
|
@@ -44,7 +49,7 @@ ${v}`.trim();case M.ZodFirstPartyTypeKind.ZodEnum:return s.values.map(se).join("
|
|
|
44
49
|
message: "Invalid input: Should pass single schema",
|
|
45
50
|
});
|
|
46
51
|
}
|
|
47
|
-
})`:"z.any()","parseOneOf");function
|
|
52
|
+
})`:"z.any()","parseOneOf");function Jg(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(b({},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(b({},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(b({},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
53
|
`,a+=`for (const key in value) {
|
|
49
54
|
`,r&&(t.properties?a+=`let evaluated = [${Object.keys(t.properties).map(s=>JSON.stringify(s)).join(", ")}].includes(key)
|
|
50
55
|
`:a+=`let evaluated = false
|
|
@@ -76,16 +81,16 @@ ${v}`.trim();case M.ZodFirstPartyTypeKind.ZodEnum:return s.values.map(se).join("
|
|
|
76
81
|
`,a+=`}
|
|
77
82
|
`,a+=`}
|
|
78
83
|
`),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 Ye.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)})`),Ye.a.oneOf(t)&&(o+=`.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)})`),Ye.an.allOf(t)&&(o+=`.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)})`),o}d(qg,"parseObject");var GP=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"),VP=d((t,e)=>`${it(jP(t,"nullable"),e,!0)}.nullable()`,"parseNullable"),JP=d(t=>`z.ref('${t.$ref}')`,"parseRef"),YP=d((t,e)=>{var n,r;if(t.oneOf.length<=1||!((n=t.discriminator)!=null&&n.propertyName))return es(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=eB(t,e);return n||(a=XP(t,a),e.withoutDefaults||(a=QP(t,a))),r.r=a,a},"parseSchema"),XP=d((t,e)=>(t.description&&(e+=`.describe(${JSON.stringify(t.description)})`),e),"addMeta"),QP=d((t,e)=>(t.default!==void 0&&(e+=`.default(${JSON.stringify(t.default)})`),e),"addDefaults"),eB=d((t,e)=>Ye.a.nullable(t)?VP(t,e):Ye.an.object(t)?qg(t,e):Ye.an.array(t)?LP(t,e):Ye.an.anyOf(t)?zg(t,e):Ye.an.allOf(t)?Lr(t,e):Ye.a.discriminator(t)?YP(t,e):Ye.a.oneOf(t)?es(t,e):Ye.a.not(t)?UP(t,e):Ye.an.enum(t)?WP(t):Ye.a.const(t)?FP(t):Ye.a.multipleType(t)?HP(t,e):Ye.a.primitive(t,"string")?GP(t):Ye.a.primitive(t,"number")||Ye.a.primitive(t,"integer")?qP(t):Ye.a.primitive(t,"boolean")?NP(t):Ye.a.primitive(t,"null")?ZP(t):Ye.a.conditional(t)?zP(t,e):Ye.a.ref(t)?JP(t):DP(t),"selectParser"),Ye={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")}},tB=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"),nB=d(t=>it(t,{seen:new Map,path:[]}),"jsonSchemaToZodStr"),rB=d(t=>{let e=nB(t);e=e.replaceAll("errors: z.ZodError[]","errors");let n=tB(e);if(!n.sucess)throw new oa(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(([a,o])=>{let i=typeof t._def.shape=="function"?t._def.shape():t._def.shape;i[a]&&Or(i[a],o)}),((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 a=e.items;if(typeof a=="object"&&!Array.isArray(a)){let o=t._def.type;o&&Or(o,a)}else Array.isArray(a)&&a.forEach((o,i)=>{let s=t._def;s.typeName===X.ZodFirstPartyTypeKind.ZodTuple&&Or(s.items[i],o)})}},"applyZuiPropsRecursively"),iB=d(t=>{let e=rB(t);return Or(e,t),e},"fromJSONSchemaLegacy"),aB=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"),sB=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"),lB=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"),uB=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===Xe.cuid)a=a.cuid();else if(t==="cuid2"||e===Xe.cuid2)a=a.cuid2();else if(t==="emoji"||e===Xe.emoji)a=a.emoji();else if(t==="ulid"||e===Xe.ulid)a=a.ulid();else if(t==="date-time"){let{precision:o,offset:i}=e?wx(e):{};a=a.datetime({precision:o,offset:i})}else t==="email"||e===Xe.email?a=a.email():t==="ipv4"||e===Xe.ipv4?a=a.ip():t==="ipv6"||e===Xe.ipv6?a=a.ip("v6"):t==="uri"?a=a.url():t==="uuid"||e===Xe.uuid?a=a.uuid():e&&(a=a.regex(new RegExp(e)));return a},"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),[a]=r;if(!a){if(t==="string"&&e.type==="string")return uB(e);if(t==="number"&&(e.type==="number"||e.type==="integer"))return lB(e);if(t==="boolean")return M.boolean();if(t==="null")return M.null();throw new oa(`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"),cB=d((t,e)=>fB(t)?pB(t,e):dB(t)?gB(t,e):yB(t,e),"arrayJSONSchemaToZuiArray"),fB=d(t=>Array.isArray(t.items),"_isTuple"),dB=d(t=>t.items!==void 0&&t.uniqueItems,"_isSet"),pB=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"),gB=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"),yB=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"),Wn=M.any();function Vg(t){return rt(t)}d(Vg,"fromJSONSchema");function rt(t){var e;if(t===void 0)return Wn;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 on({oneOf:t.oneOf});if(t.patternProperties!==void 0)throw new on({patternProperties:t.patternProperties});if(t.propertyNames!==void 0)throw new on({propertyNames:t.propertyNames});if(t.if!==void 0)throw new on({if:t.if});if(t.then!==void 0)throw new on({then:t.then});if(t.else!==void 0)throw new on({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 on({not:t.not})}if(Array.isArray(t.type)){if(t.type.length===0)return Wn;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):_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 cB(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(Wn)}if(t.anyOf!==void 0){if(t.anyOf.length===0)return Wn;if(t.anyOf.length===1)return rt(t.anyOf[0]);if(aB(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 Wn;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 sB(t)?M.unknown():Wn}d(rt,"_fromJSONSchema");var mB=/^\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))?$/,wo=d((t,e,n=!0)=>{if(typeof t!="object")throw new uo("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(X.null());else switch(typeof l){case"string":i[s]=mB.test(l)?r(X.string().datetime()):r(X.string());break;case"number":i[s]=r(X.number());break;case"boolean":i[s]=r(X.boolean());break;case"object":Array.isArray(l)?l.length===0?i[s]=r(X.array(X.unknown())):typeof l[0]=="object"?i[s]=r(X.array(wo(l[0],e,!1))):["string","number","boolean"].includes(typeof l[0])&&(i[s]=r(X.array(X[typeof l[0]]()))):i[s]=r(wo(l,e,!1));break;default:throw new uo(`Unsupported type for key ${s}`)}return i},{}),o=Object.keys(a).length>0;return e?.passtrough||!n&&!o?X.object(a).passthrough():X.object(a)},"fromObject");function Jg(){return{}}d(Jg,"parseAnyDef");function Yg(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(Yg,"parseArrayDef");function Xg(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(Xg,"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 hB=d((t,e)=>Ie(t.innerType._def,e),"parseCatchDef");function ty(t,e){return e.dateStrategy=="integer"?vB(t,e):_({type:"string",format:"date-time"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{})}d(ty,"parseDateDef");var vB=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 TB=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(TB(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 ts(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(Uo(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(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 ia={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 ia&&(!r._def.checks||!r._def.checks.length))){let r=n.reduce((a,o)=>{let i=ia[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:ia[r._def.typeName],nullable:!0};return xo(r._def,e,o)}let a={type:[ia[r._def.typeName],"null"]};return xo(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",Ho(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 _B=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:_B(t,e)});return n.required.length||delete n.required,n}d(gy,"parseObjectDef");var bB=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"),wB=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 xB=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=PB(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=EB(t,t.typeName,e);return o&&xo(t,e,o),a.jsonSchema=o,o}d(Ie,"parseDef");var PB=d((t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:BB(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"),BB=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"),EB=d((t,e,n)=>{switch(e){case"ZodString":return Uo(t,n);case"ZodNumber":return py(t,n);case"ZodObject":return gy(t,n);case"ZodBigInt":return Xg(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 Yg(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 ts(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 bB(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 xB(t,n);case"ZodCatch":return hB(t,n);case"ZodPipeline":return wB(t,n);case"ZodFunction":case"ZodVoid":case"ZodSymbol":return;default:return(r=>{})(e)}},"selectParser"),xo=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"},SB=d(t=>typeof t=="string"?N(_({},Jc),{name:t}):_(_({},Jc),t),"getDefaultOptions"),kB=d(t=>{let e=SB(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"),IB=d((t,e)=>{var n;let r=kB(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"),AB=d((t,e={target:"openApi3"})=>{let n=IB(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===X.ZodFirstPartyTypeKind.ZodObject&&r.typeName===X.ZodFirstPartyTypeKind.ZodObject){let a=n.shape(),o=r.shape();return X.object({...a,...o})}if(n.typeName===X.ZodFirstPartyTypeKind.ZodRecord&&r.typeName===X.ZodFirstPartyTypeKind.ZodRecord)return X.record(X.intersection(n.valueType,r.valueType));throw new Error("Cannot merge object schemas with record schemas")},by=X;var mt=X.string().min(1),xy=X.object({text:mt}),Py=X.object({markdown:mt}),By=X.object({imageUrl:mt}),Ey=X.object({audioUrl:mt}),Sy=X.object({videoUrl:mt}),ky=X.object({fileUrl:mt,title:mt.optional()}),Iy=X.object({latitude:X.number(),longitude:X.number(),address:X.string().optional(),title:X.string().optional()}),Ay=X.object({title:mt,subtitle:mt.optional(),imageUrl:mt.optional(),actions:X.array(X.object({action:X.enum(["postback","url","say"]),label:mt,value:mt}))}),wy=X.object({text:mt,options:X.array(X.object({label:mt,value:mt}))}),CB=X.object({items:X.array(Ay)}),OB=X.union([X.object({type:X.literal("text"),payload:xy}),X.object({type:X.literal("markdown"),payload:Py}),X.object({type:X.literal("image"),payload:By}),X.object({type:X.literal("audio"),payload:Ey}),X.object({type:X.literal("video"),payload:Sy}),X.object({type:X.literal("file"),payload:ky}),X.object({type:X.literal("location"),payload:Iy})]),RB=X.object({items:X.array(OB)}),MB={schema:Py},NB={text:{schema:xy},image:{schema:By},audio:{schema:Ey},video:{schema:Sy},file:{schema:ky},location:{schema:Iy},carousel:{schema:CB},card:{schema:Ay},dropdown:{schema:wy},choice:{schema:wy},bloc:{schema:RB}};C();R();O();var QA={HIDDEN_IN_STUDIO:{bpActionHiddenInStudio:"true"},AWAIT_RETURN:{bpActionAwaitReturn:"true"}};C();R();O();import{isNode as Dk}from"browser-or-node";C();R();O();var ns=console;function Rt(t){if(!t.body)throw new Error("Missing body");return JSON.parse(t.body)}async function Ka(t,e=8072,n=$k){if(!Dk)throw new Error("This function can only be called in Node.js");let a=(Ih(),jv(kh)).createServer(async(o,i)=>{try{let s=await Hk(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){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 a.listen(e,()=>n(e)),a}async function Hk(t){let e=await Zk(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:Uk(r.search,"?"),headers:n,method:t.method?.toUpperCase()??"GET"}}function Uk(t,e){return t.indexOf(e)===0?t.slice(e.length):t}async function Zk(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 $k(t){ns.info(`Listening on port ${t}`)}import{isApiError as uU,RuntimeError as cU}from"@botpress/client";C();R();O();C();R();O();C();R();O();C();R();O();var Le={};Ln(Le,{mapKeys:()=>Lk,mapValues:()=>Kk,mergeRecords:()=>Wk,pairs:()=>La,stripUndefinedProps:()=>Fk,values:()=>jk});C();R();O();var La=t=>Object.entries(t),jk=t=>Object.values(t),Kk=(t,e)=>Object.fromEntries(La(t).map(([n,r])=>[n,e(r,n)])),Lk=(t,e)=>Object.fromEntries(La(t).map(([n,r])=>[e(n),r])),Fk=t=>Object.fromEntries(La(t).filter(([,e])=>e!==void 0)),Wk=(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={};Ln(ye,{safePush:()=>zk,unique:()=>qk});C();R();O();var zk=(t,...e)=>t?[...t,...e]:[...e],qk=t=>Array.from(new Set(t));C();R();O();var ft={};Ln(ft,{setName:()=>Gk});C();R();O();var Gk=(t,e)=>(Object.defineProperty(t,"name",{value:e}),t);var Ah=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 Fa=Symbol("schemaName"),Ch=t=>t?Le.mapValues(t,(n,r)=>({...n,[Fa]:r})):{},Oh=t=>Fa in t&&t[Fa]!==void 0,Rh=t=>t[Fa];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: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}=Ah({...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:Ch(this.entities)},o=n(a),i=Le.pairs(o.entities).find(([l,f])=>!Oh(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:Rh(l),schema:l.schema})),actions:o.actions??{},events:o.events??{},channels:o.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),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:zr(e.schema,n.schema)})};C();R();O();C();R();O();import{isApiError as PI,Client as BI,RuntimeError as xv,InvalidPayloadError as EI}from"@botpress/client";C();R();O();import*as Mh from"@botpress/client";var Wa={retries:3,retryCondition:t=>Mh.axiosRetry.isNetworkOrIdempotentRequestError(t)||[429,502].includes(t.response?.status??0),retryDelay:(t,e)=>(Vk(e.response?.headers??{})??t)*1e3},Vk=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 Jk(String(r))}},Jk=t=>{let e=Yk(t)?Xk(t):t.length>0?parseInt(t,10):void 0;return e===void 0||isNaN(e)?void 0:e},Yk=t=>t.includes(" "),Xk=t=>{let e=Qk(t);if(!e)return;let n=new Date;return Math.max(0,Math.floor((e.getTime()-n.getTime())/1e3))},Qk=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 za=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 gn="#",qa="x-bot-id",Nh="x-bot-user-id",Dh="x-integration-id",Hh="x-integration-alias",Uh="x-webhook-id",Zh="x-bp-configuration-type",Ga="x-bp-configuration",Va="x-bp-operation",$h="x-bp-type";C();R();O();var Mt=t=>{throw t instanceof Error?t:new Error(t)};var OR=X.enum(["webhook_received","message_created","action_triggered","register","unregister","ping","create_user","create_conversation"]),jh=t=>({botId:t[qa]||Mt("Missing bot header"),botUserId:t[Nh]||Mt("Missing bot user header"),integrationId:t[Dh]||Mt("Missing integration header"),integrationAlias:t[Hh],webhookId:t[Uh]||Mt("Missing webhook header"),operation:t[Va]||Mt("Missing operation header"),configurationType:t[Zh]??null,configuration:JSON.parse(q.from(t[Ga]||Mt("Missing configuration header"),"base64").toString("utf-8"))});C();R();O();C();R();O();C();R();O();C();R();O();var tl={},Kh=!1;function bl(){return Kh||(Kh=!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 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}),tl}var nl={},Lh=!1;function eI(){return Lh||(Lh=!0,nl=Error),nl}var rl={},Fh=!1;function tI(){return Fh||(Fh=!0,rl=EvalError),rl}var il={},Wh=!1;function nI(){return Wh||(Wh=!0,il=RangeError),il}var al={},zh=!1;function rI(){return zh||(zh=!0,al=ReferenceError),al}var ol={},qh=!1;function uv(){return qh||(qh=!0,ol=SyntaxError),ol}var sl={},Gh=!1;function Ja(){return Gh||(Gh=!0,sl=TypeError),sl}var ll={},Vh=!1;function iI(){return Vh||(Vh=!0,ll=URIError),ll}var ul={},Jh=!1;function aI(){if(Jh)return ul;Jh=!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={},Yh=!1;function oI(){if(Yh)return cl;Yh=!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 sI(){if(Xh)return fl;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 fl=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},fl}var dl={},Qh=!1;function wl(){if(Qh)return dl;Qh=!0;var t=sI();return dl=Function.prototype.bind||t,dl}var pl={},ev=!1;function lI(){if(ev)return pl;ev=!0;var t=Function.prototype.call,e=Object.prototype.hasOwnProperty,n=wl();return pl=n.call(t,e),pl}var gl={},tv=!1;function ri(){if(tv)return gl;tv=!0;var t,e=eI(),n=tI(),r=nI(),a=rI(),o=uv(),i=Ja(),s=iI(),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=aI()(),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%":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=wl(),ee=lI(),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},ht=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 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 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=ht("%"+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],Y=Oe($,0,1),ie=Oe($,-1);if((Y==='"'||Y==="'"||Y==="`"||ie==='"'||ie==="'"||ie==="`")&&Y!==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},gl}var yl={},nv=!1;function xl(){if(nv)return yl;nv=!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={},rv=!1;function Ya(){if(rv)return ml;rv=!0;var t=ri(),e=t("%Object.getOwnPropertyDescriptor%",!0);if(e)try{e([],"length")}catch{e=null}return ml=e,ml}var hl={},iv=!1;function uI(){if(iv)return hl;iv=!0;var t=xl(),e=uv(),n=Ja(),r=Ya();return hl=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.")},hl}var vl={},av=!1;function cI(){if(av)return vl;av=!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 fI(){if(ov)return Tl;ov=!0;var t=ri(),e=uI(),n=cI()(),r=Ya(),a=Ja(),o=t("%Math.floor%");return Tl=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},Tl}var ni={},sv=!1;function Pl(){if(sv)return ni;sv=!0;var t=wl(),e=ri(),n=fI(),r=Ja(),a=e("%Function.prototype.apply%"),o=e("%Function.prototype.call%"),i=e("%Reflect.apply%",!0)||t.call(o,a),s=xl(),l=e("%Math.max%");ni=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(ni,"apply",{value:f}):ni.apply=f,ni}var _l={},lv=!1;function Bl(){if(lv)return _l;lv=!0;var t=ri(),e=Pl(),n=e(t("String.prototype.indexOf"));return _l=function(a,o){var i=t(a,!!o);return typeof i=="function"&&n(a,".prototype.")>-1?e(i):i},_l}rs();_s();var El={},cv=!1;function Dl(){if(cv)return El;cv=!0;var t=bl();return El=function(){return t()&&!!Symbol.toStringTag},El}var Sl={},fv=!1;function dI(){if(fv)return Sl;fv=!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]"},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,Sl=o?r:a,Sl}var kl={},dv=!1;function pI(){if(dv)return kl;dv=!0;var t=Object.prototype.toString,e=Function.prototype.toString,n=/^\s*(?:function)?\*/,r=Dl()(),a=Object.getPrototypeOf,o=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(!a)return!1;if(typeof i>"u"){var p=o();i=p?a(p):!1}return a(l)===i},kl}var Il={},pv=!1;function gI(){if(pv)return Il;pv=!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 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!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)},Il}var Al={},gv=!1;function yI(){if(gv)return Al;gv=!0;var t=gI(),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 Al=i,Al}var Cl={},yv=!1;function mI(){return yv||(yv=!0,Cl=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),Cl}var Ol={},mv=!1,hI=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function vI(){if(mv)return Ol;mv=!0;var t=mI(),e=typeof globalThis>"u"?hI:globalThis;return Ol=function(){for(var r=[],a=0;a<t.length;a++)typeof e[t[a]]=="function"&&(r[r.length]=t[a]);return r},Ol}var Rl={},hv=!1,TI=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function wv(){if(hv)return Rl;hv=!0;var t=yI(),e=vI(),n=Pl(),r=Bl(),a=Ya(),o=r("Object.prototype.toString"),i=Dl()(),s=typeof globalThis>"u"?TI: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 Rl=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},Rl}var Ml={},vv=!1;function _I(){if(vv)return Ml;vv=!0;var t=wv();return Ml=function(n){return!!t(n)},Ml}var we={},Tv=!1;function bI(){if(Tv)return we;Tv=!0;var t=dI(),e=pI(),n=wv(),r=_I();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,At){if(typeof Z!="object")return!1;try{return At(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 ht(Z){return typeof WeakMap>"u"?!1:Je.working?Je(Z):Z instanceof WeakMap}we.isWeakMap=ht;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 Y(Z){return s(Z)==="[object WebAssembly.Module]"}we.isWebAssemblyCompiledModule=Y;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 Nl={},_v=!1;function wI(){return _v||(_v=!0,Nl=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"}),Nl}var xe={},bv=!1,ii=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function xI(){if(bv)return xe;bv=!0;var t=Ot,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||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={},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 Y="",ie=!1,b=["{","}"];if(B(j)&&(ie=!0,b=["[","]"]),ze(j)){var x=j.name?": "+j.name:"";Y=" [Function"+x+"]"}if(ge(j)&&(Y=" "+RegExp.prototype.toString.call(j)),re(j)&&(Y=" "+Date.prototype.toUTCString.call(j)),Oe(j)&&(Y=" "+g(j)),A.length===0&&(!ie||j.length==0))return b[0]+Y+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,Y,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(Y){Y.match(/^\d+$/)||A.push(w(D,j,F,de,Y,!0))}),A}function w(D,j,F,de,Te,A){var k,$,Y;if(Y=Object.getOwnPropertyDescriptor(j,Te)||{value:j[Te]},Y.get?Y.set?$=D.stylize("[Getter/Setter]","special"):$=D.stylize("[Getter]","special"):Y.set&&($=D.stylize("[Setter]","special")),Pe(de,Te)||(k="["+Te+"]"),$||(D.seen.indexOf(Y.value)<0?(S(F)?$=p(D,Y.value,null):$=p(D,Y.value,F-1),$.indexOf(`
|
|
80
|
-
`)>-1&&(
|
|
81
|
-
`).map(function(
|
|
84
|
+
`,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 Ye.an.anyOf(t)&&(o+=`.and(${Vg(N(b({},t),{anyOf:t.anyOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?N(b({},i),{type:"object"}):i)}),e)})`),Ye.a.oneOf(t)&&(o+=`.and(${ts(N(b({},t),{oneOf:t.oneOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?N(b({},i),{type:"object"}):i)}),e)})`),Ye.an.allOf(t)&&(o+=`.and(${Fr(N(b({},t),{allOf:t.allOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?N(b({},i),{type:"object"}):i)}),e)})`),o}d(Jg,"parseObject");var XP=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"),QP=d((t,e)=>`${it(WP(t,"nullable"),e,!0)}.nullable()`,"parseNullable"),eB=d(t=>`z.ref('${t.$ref}')`,"parseRef"),tB=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(b({},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=iB(t,e);return n||(a=nB(t,a),e.withoutDefaults||(a=rB(t,a))),r.r=a,a},"parseSchema"),nB=d((t,e)=>(t.description&&(e+=`.describe(${JSON.stringify(t.description)})`),e),"addMeta"),rB=d((t,e)=>(t.default!==void 0&&(e+=`.default(${JSON.stringify(t.default)})`),e),"addDefaults"),iB=d((t,e)=>Ye.a.nullable(t)?QP(t,e):Ye.an.object(t)?Jg(t,e):Ye.an.array(t)?qP(t,e):Ye.an.anyOf(t)?Vg(t,e):Ye.an.allOf(t)?Fr(t,e):Ye.a.discriminator(t)?tB(t,e):Ye.a.oneOf(t)?ts(t,e):Ye.a.not(t)?KP(t,e):Ye.an.enum(t)?VP(t):Ye.a.const(t)?GP(t):Ye.a.multipleType(t)?jP(t,e):Ye.a.primitive(t,"string")?XP(t):Ye.a.primitive(t,"number")||Ye.a.primitive(t,"integer")?YP(t):Ye.a.primitive(t,"boolean")?ZP(t):Ye.a.primitive(t,"null")?LP(t):Ye.a.conditional(t)?JP(t,e):Ye.a.ref(t)?eB(t):$P(t),"selectParser"),Ye={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")}},aB=d(t=>{let e;try{e=new Function("z",`return ${t}`)(A)}catch(n){return{sucess:!1,error:`Failed to evaluate schema: ${(n instanceof Error?n:new Error(String(n))).message}`}}return e instanceof A.ZodType?{sucess:!0,value:e}:{sucess:!1,error:`String "${t}" does not evaluate to a Zod schema`}},"evalZuiString"),oB=d(t=>it(t,{seen:new Map,path:[]}),"jsonSchemaToZodStr"),sB=d(t=>{let e=oB(t);e=e.replaceAll("errors: z.ZodError[]","errors");let n=aB(e);if(!n.sucess)throw new oa(n.error);return n.value},"jsonSchemaToZod"),Or=d((t,e)=>{var n,r;if(e[le]&&t._def&&(t.naked()._def[le]=e[le]),((n=t._def)==null?void 0:n.typeName)==="ZodObject"&&e.type==="object"&&e.properties&&Object.entries(e.properties).forEach(([a,o])=>{let i=typeof t._def.shape=="function"?t._def.shape():t._def.shape;i[a]&&Or(i[a],o)}),((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 a=e.items;if(typeof a=="object"&&!Array.isArray(a)){let o=t._def.type;o&&Or(o,a)}else Array.isArray(a)&&a.forEach((o,i)=>{let s=t._def;s.typeName===X.ZodFirstPartyTypeKind.ZodTuple&&Or(s.items[i],o)})}},"applyZuiPropsRecursively"),lB=d(t=>{let e=sB(t);return Or(e,t),e},"fromJSONSchemaLegacy"),uB=d(t=>{var e,n;return t.anyOf!==void 0&&t.anyOf.length===2&&t.anyOf.some(r=>typeof r!="boolean"&&Yg(r))&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)===A.ZodFirstPartyTypeKind.ZodOptional},"isOptionalSchema"),cB=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)===A.ZodFirstPartyTypeKind.ZodNullable},"isNullableSchema"),Yg=d(t=>{var e,n;return t.not===!0&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)===A.ZodFirstPartyTypeKind.ZodUndefined},"isUndefinedSchema"),fB=d(t=>{var e,n;return!t.not&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)===A.ZodFirstPartyTypeKind.ZodUnknown},"isUnknownSchema"),dB=d(({type:t,minimum:e,exclusiveMinimum:n,maximum:r,exclusiveMaximum:a,multipleOf:o,format:i})=>{let s=A.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"),pB=d(({format:t,pattern:e,minLength:n,maxLength:r})=>{let a=A.string();if(n&&r&&n===r?a=a.length(n):(n&&(a=a.min(n)),r&&(a=a.max(r))),t==="cuid"||e===Xe.cuid)a=a.cuid();else if(t==="cuid2"||e===Xe.cuid2)a=a.cuid2();else if(t==="emoji"||e===Xe.emoji)a=a.emoji();else if(t==="ulid"||e===Xe.ulid)a=a.ulid();else if(t==="date-time"){let{precision:o,offset:i}=e?Ex(e):{};a=a.datetime({precision:o,offset:i})}else t==="email"||e===Xe.email?a=a.email():t==="ipv4"||e===Xe.ipv4?a=a.ip():t==="ipv6"||e===Xe.ipv6?a=a.ip("v6"):t==="uri"?a=a.url():t==="uuid"||e===Xe.uuid?a=a.uuid():e&&(a=a.regex(new RegExp(e)));return a},"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),[a]=r;if(!a){if(t==="string"&&e.type==="string")return pB(e);if(t==="number"&&(e.type==="number"||e.type==="integer"))return dB(e);if(t==="boolean")return A.boolean();if(t==="null")return A.null();throw new oa(`Unknown primitive type: "${t}"`)}if(r.length===1)return A.literal(a);let o=r.map(i=>A.literal(i));return A.union(o)},"toZuiPrimitive"),gB=d((t,e)=>yB(t)?hB(t,e):mB(t)?vB(t,e):TB(t,e),"arrayJSONSchemaToZuiArray"),yB=d(t=>Array.isArray(t.items),"_isTuple"),mB=d(t=>t.items!==void 0&&t.uniqueItems,"_isSet"),hB=d(({items:t,additionalItems:e},n)=>{let r=t.map(n),a=A.tuple(r);return e!==void 0&&(a=a.rest(n(e))),a},"_handleTuple"),vB=d(({items:t,minItems:e,maxItems:n},r)=>{let a=A.set(r(t));return e&&(a=a.min(e)),n&&(a=a.max(n)),a},"_handleSet"),TB=d(({minItems:t,maxItems:e,items:n},r)=>{let a=A.array(r(n));return t&&t===e?a.length(t):(t&&(a=a.min(t)),e&&(a=a.max(e)),a)},"_handleArray"),Wn=A.any();function Xg(t){return rt(t)}d(Xg,"fromJSONSchema");function rt(t){var e;if(t===void 0)return Wn;if(t===!0)return A.any();if(t===!1)return A.never();if(t.default!==void 0)return rt(N(b({},t),{default:void 0})).default(t.default);if(t.readOnly)return rt(N(b({},t),{readOnly:void 0})).readonly();if(t.oneOf!==void 0)throw new on({oneOf:t.oneOf});if(t.patternProperties!==void 0)throw new on({patternProperties:t.patternProperties});if(t.propertyNames!==void 0)throw new on({propertyNames:t.propertyNames});if(t.if!==void 0)throw new on({if:t.if});if(t.then!==void 0)throw new on({then:t.then});if(t.else!==void 0)throw new on({else:t.else});if(t.$ref!==void 0)return A.ref(t.$ref);if(t.not!==void 0){if(Yg(t))return A.undefined();if(t.not===!0)return A.never();throw new on({not:t.not})}if(Array.isArray(t.type)){if(t.type.length===0)return Wn;if(t.type.length===1)return rt(N(b({},t),{type:t.type[0]}));let n=t,{type:r}=n,a=tf(n,["type"]),o=t.type.map(i=>rt(N(b({},a),{type:i})));return A.union(o)}if(t.type==="string")return t.enum&&t.enum.length>0?A.enum(t.enum):_r("string",t);if(t.type==="integer"){let n=_r("number",t);return n instanceof A.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 gB(t,rt);if(t.type==="object"){if(t.additionalProperties!==void 0&&t.properties!==void 0){let n=rt(t.additionalProperties);return rt(N(b({},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 A.object(n)}if(t.additionalProperties!==void 0){let n=rt(t.additionalProperties);return A.record(n)}return A.record(Wn)}if(t.anyOf!==void 0){if(t.anyOf.length===0)return Wn;if(t.anyOf.length===1)return rt(t.anyOf[0]);if(uB(t))return rt(t.anyOf[0]).optional();if(cB(t))return rt(t.anyOf[0]).nullable();let n=t.anyOf.map(rt);return A.union(n)}if(t.allOf!==void 0){if(t.allOf.length===0)return Wn;if(t.allOf.length===1)return rt(t.allOf[0]);let[n,...r]=t.allOf,a=rt(n),o=rt({allOf:r});return A.intersection(a,o)}return fB(t)?A.unknown():Wn}d(rt,"_fromJSONSchema");var _B=/^\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(X.null());else switch(typeof l){case"string":i[s]=_B.test(l)?r(X.string().datetime()):r(X.string());break;case"number":i[s]=r(X.number());break;case"boolean":i[s]=r(X.boolean());break;case"object":Array.isArray(l)?l.length===0?i[s]=r(X.array(X.unknown())):typeof l[0]=="object"?i[s]=r(X.array(xo(l[0],e,!1))):["string","number","boolean"].includes(typeof l[0])&&(i[s]=r(X.array(X[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?X.object(a).passthrough():X.object(a)},"fromObject");function Qg(){return{}}d(Qg,"parseAnyDef");function ey(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(b({},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(ey,"parseArrayDef");function ty(t,e){let n=b({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(ty,"parseBigintDef");function ny(t){return b({type:"boolean"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{})}d(ny,"parseBooleanDef");function ry(t,e){return Ie(t.type._def,e)}d(ry,"parseBrandedDef");var bB=d((t,e)=>Ie(t.innerType._def,e),"parseCatchDef");function iy(t,e){return e.dateStrategy=="integer"?wB(t,e):b({type:"string",format:"date-time"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{})}d(iy,"parseDateDef");var wB=d((t,e)=>{let n=b({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 ay(t,e){return N(b({},Ie(t.innerType._def,e)),{default:t.defaultValue()})}d(ay,"parseDefaultDef");function oy(t,e){return e.effectStrategy==="input"?Ie(t.schema._def,e):{}}d(oy,"parseEffectsDef");function sy(t){return{type:"string",enum:t.values}}d(sy,"parseEnumDef");var xB=d(t=>"type"in t&&t.type==="string"?!1:"allOf"in t,"isJsonSchema7AllOfType");function ly(t,e){let n=[Ie(t.left._def,N(b({},e),{currentPath:[...e.currentPath,"allOf","0"]})),Ie(t.right._def,N(b({},e),{currentPath:[...e.currentPath,"allOf","1"]}))].filter(o=>!!o),r=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,a=[];return n.forEach(o=>{if(xB(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=tf(s,["additionalProperties"])}else r=void 0;a.push(i)}}),a.length?b({allOf:a},r):void 0}d(ly,"parseIntersectionDef");function uy(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(uy,"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(b({},l),{[f]:(p=Ie(t.valueType._def,N(b({},e),{currentPath:[...e.currentPath,"properties",f]})))!=null?p:{}})},{}),additionalProperties:!1};let s={type:"object",additionalProperties:(r=Ie(t.valueType._def,N(b({},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(b({},f),{[p]:y}),{});return N(b({},s),{propertyNames:l})}else if(((i=t.keyType)==null?void 0:i._def.typeName)==="ZodEnum")return N(b({},s),{propertyNames:{enum:t.keyType._def.values}});return s}d(ns,"parseRecordDef");function cy(t,e){if(e.mapStrategy==="record")return ns(t,e);let n=Ie(t.keyType._def,N(b({},e),{currentPath:[...e.currentPath,"items","items","0"]}))||{},r=Ie(t.valueType._def,N(b({},e),{currentPath:[...e.currentPath,"items","items","1"]}))||{};return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}d(cy,"parseMapDef");function fy(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(fy,"parseNativeEnumDef");function dy(){return{not:{}}}d(dy,"parseNeverDef");function py(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}d(py,"parseNullDef");var ia={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function gy(t,e){if(e.target==="openApi3")return Yc(t,e);let n=t.options instanceof Map?Array.from(t.options.values()):t.options;if(n.every(r=>r._def.typeName in ia&&(!r._def.checks||!r._def.checks.length))){let r=n.reduce((a,o)=>{let i=ia[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 Yc(t,e)}d(gy,"parseUnionDef");var Yc=d((t,e)=>{let n=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((a,o)=>Ie(a._def,N(b({},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"?b({anyOf:n},r):b({oneOf:n},r)},"asUnionOf");function yy(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:ia[r._def.typeName],nullable:!0};return Po(r._def,e,o)}let a={type:[ia[r._def.typeName],"null"]};return Po(r._def,e,a)}if(e.target==="openApi3"){let r=Ie(t.innerType._def,N(b({},e),{currentPath:[...e.currentPath]}));return r&&N(b({},r),{nullable:!0})}let n=Ie(t.innerType._def,N(b({},e),{currentPath:[...e.currentPath,"anyOf","0"]}));return n&&{anyOf:[n,{type:"null"}]}}d(yy,"parseNullableDef");function my(t,e){let n=b({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(my,"parseNumberDef");var PB=d((t,e)=>{var n;return t.unknownKeys instanceof he?(n=Ie(t.unknownKeys._def,N(b({},e),{currentPath:[...e.currentPath,"additionalProperties"]})))!=null?n:!0:t.unknownKeys==="passthrough"},"getAdditionalProperties");function hy(t,e){let n=N(b({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(b({},e),{currentPath:[...e.currentPath,"properties",a],propertyPath:[...e.currentPath,"properties",a]}));return i===void 0?r:{properties:N(b({},r.properties),{[a]:i}),required:o.isOptional()?r.required:[...r.required,a]}},{properties:{},required:[]})),{additionalProperties:PB(t,e)});return n.required.length||delete n.required,n}d(hy,"parseObjectDef");var BB=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(b({},e),{currentPath:[...e.currentPath,"anyOf","1"]}));return r?{anyOf:[{not:{}},r]}:{}},"parseOptionalDef"),EB=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(b({},e),{currentPath:[...e.currentPath,"allOf","0"]})),r=Ie(t.out._def,N(b({},e),{currentPath:[...e.currentPath,"allOf",n?"1":"0"]}));return{allOf:[n,r].filter(a=>a!==void 0)}},"parsePipelineDef");function vy(t,e){return Ie(t.type._def,e)}d(vy,"parsePromiseDef");function Ty(t,e){let r={type:"array",uniqueItems:!0,items:Ie(t.valueType._def,N(b({},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(Ty,"parseSetDef");function _y(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((n,r)=>Ie(n._def,N(b({},e),{currentPath:[...e.currentPath,"items",`${r}`]}))).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:Ie(t.rest._def,N(b({},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(b({},e),{currentPath:[...e.currentPath,"items",`${r}`]}))).reduce((n,r)=>r===void 0?n:[...n,r],[])}}d(_y,"parseTupleDef");function by(){return{not:{}}}d(by,"parseUndefinedDef");function wy(){return{}}d(wy,"parseUnknownDef");var SB=d((t,e)=>Ie(t.innerType._def,e),"parseReadonlyDef");function xy(t){return{$ref:t.uri}}d(xy,"parseRefDef");function Ie(t,e,n=!1){let r=e.seen.get(t);if(r&&!n){let i=kB(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=AB(t,t.typeName,e);return o&&Po(t,e,o),a.jsonSchema=o,o}d(Ie,"parseDef");var kB=d((t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:IB(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"),IB=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"),AB=d((t,e,n)=>{switch(e){case"ZodString":return Zo(t,n);case"ZodNumber":return my(t,n);case"ZodObject":return hy(t,n);case"ZodBigInt":return ty(t,n);case"ZodBoolean":return ny(t);case"ZodDate":return iy(t,n);case"ZodUndefined":return by();case"ZodNull":return py(n);case"ZodArray":return ey(t,n);case"ZodUnion":case"ZodDiscriminatedUnion":return gy(t,n);case"ZodIntersection":return ly(t,n);case"ZodTuple":return _y(t,n);case"ZodRecord":return ns(t,n);case"ZodRef":return xy(t);case"ZodLiteral":return uy(t,n);case"ZodEnum":return sy(t);case"ZodNativeEnum":return fy(t);case"ZodNullable":return yy(t,n);case"ZodOptional":return BB(t,n);case"ZodMap":return cy(t,n);case"ZodSet":return Ty(t,n);case"ZodLazy":return Ie(t.getter()._def,n);case"ZodPromise":return vy(t,n);case"ZodNaN":case"ZodNever":return dy();case"ZodEffects":return oy(t,n);case"ZodAny":return Qg();case"ZodUnknown":return wy();case"ZodDefault":return ay(t,n);case"ZodBranded":return ry(t,n);case"ZodReadonly":return SB(t,n);case"ZodCatch":return bB(t,n);case"ZodPipeline":return EB(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]:b(b({},t[le]),n[le])}),n),"addMeta"),Xc={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"},CB=d(t=>typeof t=="string"?N(b({},Xc),{name:t}):b(b({},Xc),t),"getDefaultOptions"),OB=d(t=>{let e=CB(t),n=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return N(b({},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"),RB=d((t,e)=>{var n;let r=OB(e),a=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[f,p])=>{var y;return N(b({},l),{[f]:(y=Ie(p._def,N(b({},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(b({},r),{currentPath:[...r.basePath,r.definitionPath,o]}),!1))!=null?n:{},s=o===void 0?a?N(b({},i),{[r.definitionPath]:a}):i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,o].join("/"),[r.definitionPath]:N(b({},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"),MB=d((t,e={target:"openApi3"})=>{let n=RB(t,e);return e.$schemaUrl===!1?delete n.$schema:typeof e.$schemaUrl=="string"&&(n.$schema=e.$schemaUrl),n},"toJSONSchemaLegacy");var qr=(t,e)=>{let n=t._def,r=e._def;if(n.typeName===X.ZodFirstPartyTypeKind.ZodObject&&r.typeName===X.ZodFirstPartyTypeKind.ZodObject){let a=n.shape(),o=r.shape();return X.object({...a,...o})}if(n.typeName===X.ZodFirstPartyTypeKind.ZodRecord&&r.typeName===X.ZodFirstPartyTypeKind.ZodRecord)return X.record(X.intersection(n.valueType,r.valueType));throw new Error("Cannot merge object schemas with record schemas")},Py=X;var mt=X.string().min(1),Ey=X.object({text:mt}),Sy=X.object({markdown:mt}),ky=X.object({imageUrl:mt}),Iy=X.object({audioUrl:mt}),Ay=X.object({videoUrl:mt}),Cy=X.object({fileUrl:mt,title:mt.optional()}),Oy=X.object({latitude:X.number(),longitude:X.number(),address:X.string().optional(),title:X.string().optional()}),Ry=X.object({title:mt,subtitle:mt.optional(),imageUrl:mt.optional(),actions:X.array(X.object({action:X.enum(["postback","url","say"]),label:mt,value:mt}))}),By=X.object({text:mt,options:X.array(X.object({label:mt,value:mt}))}),NB=X.object({items:X.array(Ry)}),DB=X.union([X.object({type:X.literal("text"),payload:Ey}),X.object({type:X.literal("markdown"),payload:Sy}),X.object({type:X.literal("image"),payload:ky}),X.object({type:X.literal("audio"),payload:Iy}),X.object({type:X.literal("video"),payload:Ay}),X.object({type:X.literal("file"),payload:Cy}),X.object({type:X.literal("location"),payload:Oy})]),HB=X.object({items:X.array(DB)}),UB={schema:Sy},ZB={text:{schema:Ey},image:{schema:ky},audio:{schema:Iy},video:{schema:Ay},file:{schema:Cy},location:{schema:Oy},carousel:{schema:NB},card:{schema:Ry},dropdown:{schema:By},choice:{schema:By},bloc:{schema:HB}};O();M();R();var iC={HIDDEN_IN_STUDIO:{bpActionHiddenInStudio:"true"},AWAIT_RETURN:{bpActionAwaitReturn:"true"}};O();M();R();import{isNode as $k}from"browser-or-node";O();M();R();var rs=console;function Mt(t){if(!t.body)throw new Error("Missing body");return JSON.parse(t.body)}async function Ka(t,e=8072,n=Fk){if(!$k)throw new Error("This function can only be called in Node.js");let a=(Oh(),Fv(Ch)).createServer(async(o,i)=>{try{let s=await jk(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 jk(t){let e=await Lk(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:Kk(r.search,"?"),headers:n,method:t.method?.toUpperCase()??"GET"}}function Kk(t,e){return t.indexOf(e)===0?t.slice(e.length):t}async function Lk(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 Fk(t){rs.info(`Listening on port ${t}`)}import{isApiError as gU,RuntimeError as yU}from"@botpress/client";O();M();R();O();M();R();O();M();R();O();M();R();var Le={};Ln(Le,{mapKeys:()=>qk,mapValues:()=>zk,mergeRecords:()=>Vk,pairs:()=>La,stripUndefinedProps:()=>Gk,values:()=>Wk});O();M();R();var La=t=>Object.entries(t),Wk=t=>Object.values(t),zk=(t,e)=>Object.fromEntries(La(t).map(([n,r])=>[n,e(r,n)])),qk=(t,e)=>Object.fromEntries(La(t).map(([n,r])=>[e(n),r])),Gk=t=>Object.fromEntries(La(t).filter(([,e])=>e!==void 0)),Vk=(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={};Ln(ye,{safePush:()=>Jk,unique:()=>Yk});O();M();R();var Jk=(t,...e)=>t?[...t,...e]:[...e],Yk=t=>Array.from(new Set(t));O();M();R();var ft={};Ln(ft,{setName:()=>Xk});O();M();R();var Xk=(t,e)=>(Object.defineProperty(t,"name",{value:e}),t);var Rh=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}};O();M();R();var Fa=Symbol("schemaName"),Mh=t=>t?Le.mapValues(t,(n,r)=>({...n,[Fa]:r})):{},Nh=t=>Fa in t&&t[Fa]!==void 0,Dh=t=>t[Fa];O();M();R();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}=Rh({...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:Mh(this.entities)},o=n(a),i=Le.pairs(o.entities).find(([l,f])=>!Nh(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:Dh(l),schema:l.schema})),actions:o.actions??{},events:o.events??{},channels:o.channels??{}}}_mergeActions=(e,n)=>({...e,...n,input:{schema:qr(e.input.schema,n.input.schema)},output:{schema:qr(e.output.schema,n.output.schema)}});_mergeEvents=(e,n)=>({...e,...n,schema:qr(e.schema,n.schema)});_mergeChannels=(e,n)=>{let r=Le.mergeRecords(e.messages,n.messages,this._mergeMessage),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:qr(e.schema,n.schema)})};O();M();R();O();M();R();import{isApiError as kI,Client as II,RuntimeError as Ev,InvalidPayloadError as AI}from"@botpress/client";O();M();R();import*as Hh from"@botpress/client";var Wa={retries:3,retryCondition:t=>Hh.axiosRetry.isNetworkOrIdempotentRequestError(t)||[429,502].includes(t.response?.status??0),retryDelay:(t,e)=>(Qk(e.response?.headers??{})??t)*1e3},Qk=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 eI(String(r))}},eI=t=>{let e=tI(t)?nI(t):t.length>0?parseInt(t,10):void 0;return e===void 0||isNaN(e)?void 0:e},tI=t=>t.includes(" "),nI=t=>{let e=rI(t);if(!e)return;let n=new Date;return Math.max(0,Math.floor((e.getTime()-n.getTime())/1e3))},rI=t=>{let e=new Date(t);return isNaN(e.getTime())?void 0:e};O();M();R();O();M();R();var ni=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)};O();M();R();var za=class{_cost=0;get cost(){return this._cost}setCost(e){this._cost=e}toJSON(){return{cost:this.cost}}};O();M();R();O();M();R();var gn="#",qa="x-bot-id",Uh="x-bot-user-id",Zh="x-integration-id",$h="x-integration-alias",jh="x-webhook-id",Kh="x-bp-configuration-type",Ga="x-bp-configuration",Va="x-bp-operation",Lh="x-bp-type";O();M();R();var It=t=>{throw t instanceof Error?t:new Error(t)};var HR=X.enum(["webhook_received","message_created","action_triggered","register","unregister","ping","create_user","create_conversation"]),Fh=t=>({botId:t[qa]||It("Missing bot header"),botUserId:t[Uh]||It("Missing bot user header"),integrationId:t[Zh]||It("Missing integration header"),integrationAlias:t[$h]||It("Missing integration alias header"),webhookId:t[jh]||It("Missing webhook header"),operation:t[Va]||It("Missing operation header"),configurationType:t[Kh]??null,configuration:JSON.parse(q.from(t[Ga]||It("Missing configuration header"),"base64").toString("utf-8"))});O();M();R();O();M();R();O();M();R();O();M();R();var nl={},Wh=!1;function wl(){return Wh||(Wh=!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={},zh=!1;function iI(){return zh||(zh=!0,rl=Error),rl}var il={},qh=!1;function aI(){return qh||(qh=!0,il=EvalError),il}var al={},Gh=!1;function oI(){return Gh||(Gh=!0,al=RangeError),al}var ol={},Vh=!1;function sI(){return Vh||(Vh=!0,ol=ReferenceError),ol}var sl={},Jh=!1;function dv(){return Jh||(Jh=!0,sl=SyntaxError),sl}var ll={},Yh=!1;function Ja(){return Yh||(Yh=!0,ll=TypeError),ll}var ul={},Xh=!1;function lI(){return Xh||(Xh=!0,ul=URIError),ul}var cl={},Qh=!1;function uI(){if(Qh)return cl;Qh=!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={},ev=!1;function cI(){if(ev)return fl;ev=!0;var t={__proto__:null,foo:{}},e=Object;return fl=function(){return{__proto__:t}.foo===t.foo&&!(t instanceof e)},fl}var dl={},tv=!1;function fI(){if(tv)return dl;tv=!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 T=f.apply(this,a(p,arguments));return Object(T)===T?T:this}return f.apply(l,a(p,arguments))},h=n(0,f.length-p.length),v=[],P=0;P<h;P++)v[P]="$"+P;if(y=Function("binder","return function ("+i(v,",")+"){ 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={},nv=!1;function xl(){if(nv)return pl;nv=!0;var t=fI();return pl=Function.prototype.bind||t,pl}var gl={},rv=!1;function dI(){if(rv)return gl;rv=!0;var t=Function.prototype.call,e=Object.prototype.hasOwnProperty,n=xl();return gl=n.call(t,e),gl}var yl={},iv=!1;function ii(){if(iv)return yl;iv=!0;var t,e=iI(),n=aI(),r=oI(),a=sI(),o=dv(),i=Ja(),s=lI(),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=uI()(),v=cI()(),P=Object.getPrototypeOf||(v?function(Ue){return Ue.__proto__}:null),B={},T=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%":T,"%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},j={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},re=xl(),ee=dI(),ge=re.call(Function.call,Array.prototype.concat),oe=re.call(Function.apply,Array.prototype.splice),ie=re.call(Function.call,String.prototype.replace),Oe=re.call(Function.call,String.prototype.slice),ze=re.call(Function.call,RegExp.prototype.exec),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 ie(Pe,tt,function(D,K,F,de){ve[ve.length]=F?ie(de,Ve,"$1"):K||D}),ve},ht=function(Pe,Se){var fe=Pe,ve;if(ee(j,fe)&&(ve=j[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=ht("%"+ve+"%",Se),K=D.name,F=D.value,de=!1,Te=D.alias;Te&&(ve=Te[0],oe(fe,ge([0,1],Te)));for(var C=1,k=!0;C<fe.length;C+=1){var $=fe[C],Y=Oe($,0,1),ae=Oe($,-1);if((Y==='"'||Y==="'"||Y==="`"||ae==='"'||ae==="'"||ae==="`")&&Y!==ae)throw new o("property names with quotes must have matching quotes");if(($==="constructor"||!k)&&(de=!0),ve+="."+$,K="%"+ve+"%",ee(S,K))F=S[K];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&&C+1>=fe.length){var w=p(F,$);k=!!w,k&&"get"in w&&!("originalValue"in w.get)?F=w.get:F=F[$]}else k=ee(F,$),F=F[$];k&&!de&&(S[K]=F)}}return F},yl}var ml={},av=!1;function Pl(){if(av)return ml;av=!0;var t=ii(),e=t("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return ml=e,ml}var hl={},ov=!1;function Ya(){if(ov)return hl;ov=!0;var t=ii(),e=t("%Object.getOwnPropertyDescriptor%",!0);if(e)try{e([],"length")}catch{e=null}return hl=e,hl}var vl={},sv=!1;function pI(){if(sv)return vl;sv=!0;var t=Pl(),e=dv(),n=Ja(),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={},lv=!1;function gI(){if(lv)return Tl;lv=!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={},uv=!1;function yI(){if(uv)return _l;uv=!0;var t=ii(),e=pI(),n=gI()(),r=Ya(),a=Ja(),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 ri={},cv=!1;function Bl(){if(cv)return ri;cv=!0;var t=xl(),e=ii(),n=yI(),r=Ja(),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%");ri=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(ri,"apply",{value:f}):ri.apply=f,ri}var bl={},fv=!1;function El(){if(fv)return bl;fv=!0;var t=ii(),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={},pv=!1;function Hl(){if(pv)return Sl;pv=!0;var t=wl();return Sl=function(){return t()&&!!Symbol.toStringTag},Sl}var kl={},gv=!1;function mI(){if(gv)return kl;gv=!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={},yv=!1;function hI(){if(yv)return Il;yv=!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={},mv=!1;function vI(){if(mv)return Al;mv=!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]",v=typeof Symbol=="function"&&!!Symbol.toStringTag,P=!(0 in[,]),B=function(){return!1};if(typeof document=="object"){var T=document.all;s.call(T)===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(v)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={},hv=!1;function TI(){if(hv)return Cl;hv=!0;var t=vI(),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={},vv=!1;function _I(){return vv||(vv=!0,Ol=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),Ol}var Rl={},Tv=!1,bI=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function wI(){if(Tv)return Rl;Tv=!0;var t=_I(),e=typeof globalThis>"u"?bI: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={},_v=!1,xI=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function Bv(){if(_v)return Ml;_v=!0;var t=TI(),e=wI(),n=Bl(),r=El(),a=Ya(),o=r("Object.prototype.toString"),i=Hl()(),s=typeof globalThis>"u"?xI:globalThis,l=e(),f=r("String.prototype.slice"),p=Object.getPrototypeOf,y=r("Array.prototype.indexOf",!0)||function(B,T){for(var S=0;S<B.length;S+=1)if(B[S]===T)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 T=p(B),S=a(T,Symbol.toStringTag);if(!S){var E=p(T);S=a(E,Symbol.toStringTag)}g["$"+P]=n(S.get)}}):t(l,function(P){var B=new s[P],T=B.slice||B.set;T&&(g["$"+P]=n(T))});var h=function(B){var T=!1;return t(g,function(S,E){if(!T)try{"$"+S(B)===E&&(T=f(E,1))}catch{}}),T},v=function(B){var T=!1;return t(g,function(S,E){if(!T)try{S(B),T=f(E,1)}catch{}}),T};return Ml=function(B){if(!B||typeof B!="object")return!1;if(!i){var T=f(o(B),8,-1);return y(l,T)>-1?T:T!=="Object"?!1:v(B)}return a?h(B):null},Ml}var Nl={},bv=!1;function PI(){if(bv)return Nl;bv=!0;var t=Bv();return Nl=function(n){return!!t(n)},Nl}var we={},wv=!1;function BI(){if(wv)return we;wv=!0;var t=mI(),e=hI(),n=Bv(),r=PI();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,Ct){if(typeof Z!="object")return!1;try{return Ct(Z),!0}catch{return!1}}we.isArgumentsObject=t,we.isGeneratorFunction=e,we.isTypedArray=r;function v(Z){return typeof Promise<"u"&&Z instanceof Promise||Z!==null&&typeof Z=="object"&&typeof Z.then=="function"&&typeof Z.catch=="function"}we.isPromise=v;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 T(Z){return n(Z)==="Uint8ClampedArray"}we.isUint8ClampedArray=T;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 j(Z){return n(Z)==="Int16Array"}we.isInt16Array=j;function re(Z){return n(Z)==="Int32Array"}we.isInt32Array=re;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 ie(Z){return n(Z)==="BigUint64Array"}we.isBigUint64Array=ie;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 ht(Z){return typeof WeakMap>"u"?!1:Je.working?Je(Z):Z instanceof WeakMap}we.isWeakMap=ht;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 K=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function F(Z){return s(Z)==="[object SharedArrayBuffer]"}function de(Z){return typeof K>"u"?!1:(typeof F.working>"u"&&(F.working=F(new K)),F.working?F(Z):Z instanceof K)}we.isSharedArrayBuffer=de;function Te(Z){return s(Z)==="[object AsyncFunction]"}we.isAsyncFunction=Te;function C(Z){return s(Z)==="[object Map Iterator]"}we.isMapIterator=C;function k(Z){return s(Z)==="[object Set Iterator]"}we.isSetIterator=k;function $(Z){return s(Z)==="[object Generator]"}we.isGeneratorObject=$;function Y(Z){return s(Z)==="[object WebAssembly.Module]"}we.isWebAssemblyCompiledModule=Y;function ae(Z){return h(Z,l)}we.isNumberObject=ae;function w(Z){return h(Z,f)}we.isStringObject=w;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 ae(Z)||w(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={},xv=!1;function EI(){return xv||(xv=!0,Dl=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"}),Dl}var xe={},Pv=!1,ai=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function SI(){if(Pv)return xe;Pv=!0;var t=Rt,e=Object.getOwnPropertyDescriptors||function(K){for(var F=Object.keys(K),de={},Te=0;Te<F.length;Te++)de[F[Te]]=Object.getOwnPropertyDescriptor(K,F[Te]);return de},n=/%[sdj%]/g;xe.format=function(D){if(!j(D)){for(var K=[],F=0;F<arguments.length;F++)K.push(i(arguments[F]));return K.join(" ")}for(var F=1,de=arguments,Te=de.length,C=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)?C+=" "+k:C+=" "+i(k);return C},xe.deprecate=function(D,K){if(typeof t<"u"&&t.noDeprecation===!0)return D;if(typeof t>"u")return function(){return xe.deprecate(D,K).apply(this||ai,arguments)};var F=!1;function de(){if(!F){if(t.throwDeprecation)throw new Error(K);t.traceDeprecation?console.trace(K):console.error(K),F=!0}return D.apply(this||ai,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 K=t.pid;r[D]=function(){var F=xe.format.apply(xe,arguments);console.error("%s %d: %s",D,K,F)}}else r[D]=function(){};return r[D]};function i(D,K){var F={seen:[],stylize:l};return arguments.length>=3&&(F.depth=arguments[2]),arguments.length>=4&&(F.colors=arguments[3]),T(K)?F.showHidden=K:K&&xe._extend(F,K),ee(F.showHidden)&&(F.showHidden=!1),ee(F.depth)&&(F.depth=2),ee(F.colors)&&(F.colors=!1),ee(F.customInspect)&&(F.customInspect=!0),F.colors&&(F.stylize=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,K){var F=i.styles[K];return F?"\x1B["+i.colors[F][0]+"m"+D+"\x1B["+i.colors[F][1]+"m":D}function l(D,K){return D}function f(D){var K={};return D.forEach(function(F,de){K[F]=!0}),K}function p(D,K,F){if(D.customInspect&&K&&ze(K.inspect)&&K.inspect!==xe.inspect&&!(K.constructor&&K.constructor.prototype===K)){var de=K.inspect(F,D);return j(de)||(de=p(D,de,F)),de}var Te=y(D,K);if(Te)return Te;var C=Object.keys(K),k=f(C);if(D.showHidden&&(C=Object.getOwnPropertyNames(K)),Oe(K)&&(C.indexOf("message")>=0||C.indexOf("description")>=0))return g(K);if(C.length===0){if(ze(K)){var $=K.name?": "+K.name:"";return D.stylize("[Function"+$+"]","special")}if(ge(K))return D.stylize(RegExp.prototype.toString.call(K),"regexp");if(ie(K))return D.stylize(Date.prototype.toString.call(K),"date");if(Oe(K))return g(K)}var Y="",ae=!1,w=["{","}"];if(B(K)&&(ae=!0,w=["[","]"]),ze(K)){var x=K.name?": "+K.name:"";Y=" [Function"+x+"]"}if(ge(K)&&(Y=" "+RegExp.prototype.toString.call(K)),ie(K)&&(Y=" "+Date.prototype.toUTCString.call(K)),Oe(K)&&(Y=" "+g(K)),C.length===0&&(!ae||K.length==0))return w[0]+Y+w[1];if(F<0)return ge(K)?D.stylize(RegExp.prototype.toString.call(K),"regexp"):D.stylize("[Object]","special");D.seen.push(K);var z;return ae?z=h(D,K,F,k,C):z=C.map(function(Q){return v(D,K,F,k,Q,ae)}),D.seen.pop(),P(z,Y,w)}function y(D,K){if(ee(K))return D.stylize("undefined","undefined");if(j(K)){var F="'"+JSON.stringify(K).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return D.stylize(F,"string")}if(H(K))return D.stylize(""+K,"number");if(T(K))return D.stylize(""+K,"boolean");if(S(K))return D.stylize("null","null")}function g(D){return"["+Error.prototype.toString.call(D)+"]"}function h(D,K,F,de,Te){for(var C=[],k=0,$=K.length;k<$;++k)Pe(K,String(k))?C.push(v(D,K,F,de,String(k),!0)):C.push("");return Te.forEach(function(Y){Y.match(/^\d+$/)||C.push(v(D,K,F,de,Y,!0))}),C}function v(D,K,F,de,Te,C){var k,$,Y;if(Y=Object.getOwnPropertyDescriptor(K,Te)||{value:K[Te]},Y.get?Y.set?$=D.stylize("[Getter/Setter]","special"):$=D.stylize("[Getter]","special"):Y.set&&($=D.stylize("[Setter]","special")),Pe(de,Te)||(k="["+Te+"]"),$||(D.seen.indexOf(Y.value)<0?(S(F)?$=p(D,Y.value,null):$=p(D,Y.value,F-1),$.indexOf(`
|
|
85
|
+
`)>-1&&(C?$=$.split(`
|
|
86
|
+
`).map(function(ae){return" "+ae}).join(`
|
|
82
87
|
`).slice(2):$=`
|
|
83
88
|
`+$.split(`
|
|
84
|
-
`).map(function(
|
|
85
|
-
`))):$=D.stylize("[Circular]","special")),ee(k)){if(
|
|
86
|
-
`)>=0,Te+
|
|
89
|
+
`).map(function(ae){return" "+ae}).join(`
|
|
90
|
+
`))):$=D.stylize("[Circular]","special")),ee(k)){if(C&&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,K,F){var de=D.reduce(function(Te,C){return C.indexOf(`
|
|
91
|
+
`)>=0,Te+C.replace(/\u001b\[\d\d?m/g,"").length+1},0);return de>60?F[0]+(K===""?"":K+`
|
|
87
92
|
`)+" "+D.join(`,
|
|
88
|
-
`)+" "+F[1]:F[0]+j+" "+D.join(", ")+" "+F[1]}xe.types=bI();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=wI();function Ve(D){return Object.prototype.toString.call(D)}function Je(D){return D<10?"0"+D.toString(10):D.toString(10)}var ht=["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(),ht[D.getMonth()],j].join(" ")}xe.log=function(){console.log("%s - %s",Ue(),xe.format.apply(xe,arguments))},xe.inherits=Ht(),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(Y,ie){de=Y,Te=ie}),k=[],$=0;$<arguments.length;$++)k.push(arguments[$]);k.push(function(Y,ie){Y?Te(Y):de(ie)});try{j.apply(this||ii,k)}catch(Y){Te(Y)}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=xI();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 FR=ce._extend,WR=ce.callbackify,zR=ce.debuglog,qR=ce.deprecate,GR=ce.format,VR=ce.inherits,JR=ce.inspect,YR=ce.isArray,XR=ce.isBoolean,QR=ce.isBuffer,e0=ce.isDate,t0=ce.isError,n0=ce.isFunction,r0=ce.isNull,i0=ce.isNullOrUndefined,a0=ce.isNumber,o0=ce.isObject,s0=ce.isPrimitive,l0=ce.isRegExp,u0=ce.isString,c0=ce.isSymbol,f0=ce.isUndefined,d0=ce.log,p0=ce.promisify,g0=ce.types,y0=ce.TextEncoder=globalThis.TextEncoder,m0=ce.TextDecoder=globalThis.TextDecoder;var yr=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 ai=class t extends yr{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 SI=t=>["traceparent","tracestate","sentry-trace"].reduce((e,n)=>(t[n]&&(e[n]=t[n]),e),{}),kI=(t,e,n)=>{let[,r]=(e.headers.traceparent||"").split("-"),a=new BI({botId:t.botId,integrationId:t.integrationId,integrationAlias:t.integrationAlias,retry:Wa,headers:SI(e.headers)}),o=new ti(a),i=new ai({traceId:r});return{ctx:t,req:e,client:o,logger:i,instance:n}},II=async t=>{let{ctx:e}=t;switch(e.operation){case"webhook_received":return await CI(t);case"register":return await OI(t);case"unregister":return await RI(t);case"message_created":return await DI(t);case"action_triggered":return await HI(t);case"ping":return await AI(t);case"create_user":return await MI(t);case"create_conversation":return await NI(t);default:throw new EI(`Unknown operation ${e.operation}`)}},Pv=t=>async e=>{let n=jh(e.headers),r=kI(n,e,t),{logger:a}=r;try{let o;return o=await UI(r),o?{...o,status:o.status??200}:(o=await II(r),o?{...o,status:o.status??200}:{status:200})}catch(o){if(PI(o)){let s=o.type==="Runtime"?o:new xv(o.message,o);return a.forBot().error(s.message),{status:s.code,body:JSON.stringify(s.toJSON())}}console.error(o);let i=new xv("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())}}},AI=async t=>{},CI=async({client:t,ctx:e,req:n,logger:r,instance:a})=>{let{req:o}=Rt(n);return a.webhook({client:t,ctx:e,req:o,logger:r})},OI=async({client:t,ctx:e,req:n,logger:r,instance:a})=>{if(!a.register)return;let{webhookUrl:o}=Rt(n);await a.register({client:t,ctx:e,webhookUrl:o,logger:r})},RI=async({client:t,ctx:e,req:n,logger:r,instance:a})=>{if(!a.unregister)return;let{webhookUrl:o}=Rt(n);await a.unregister({ctx:e,webhookUrl:o,client:t,logger:r})},MI=async({client:t,ctx:e,req:n,logger:r,instance:a})=>{if(!a.createUser)return;let{tags:o}=Rt(n);return await a.createUser({ctx:e,client:t,tags:o,logger:r})},NI=async({client:t,ctx:e,req:n,logger:r,instance:a})=>{if(!a.createConversation)return;let{channel:o,tags:i}=Rt(n);return await a.createConversation({ctx:e,client:t,channel:o,tags:i,logger:r})},DI=async({ctx:t,req:e,client:n,logger:r,instance:a})=>{let{conversation:o,user:i,type:s,payload:l,message:f}=Rt(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})},HI=async({req:t,ctx:e,client:n,logger:r,instance:a})=>{let{input:o,type:i}=Rt(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 za,p={output:await s({ctx:e,input:o,client:n,type:i,logger:r,metadata:l}),meta:l.toJSON()};return{body:JSON.stringify(p)}},UI=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 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=Pv(this);start=e=>Ka(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.__advanced=e.__advanced,this.withPlugins={user:e.user,conversation:e.conversation,message:e.message,states:e.states,events:e.events,recurringEvents:e.recurringEvents,actions:e.actions,tables:e.tables,workflows:e.workflows}}integrations;plugins;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;workflows;attributes;__advanced;withPlugins;addIntegration(e,n){let r=this;r.integrations||(r.integrations={});let a=n?.alias??e.name.replace("/","-");if(r.integrations[a])throw new Error(`Another integration with alias "${a}" is already installed in the bot`);return r.integrations[a]={...e,alias:a,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("/","-");if(r.plugins[a])throw new Error(`Another plugin with alias "${a}" is already installed in the bot`);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}${gn}${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 Sv}from"@botpress/client";C();R();O();var oi=class t extends yr{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 nn=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();var ZI=X.enum(["event_received","register","unregister","ping","action_triggered"]),Bv=t=>({botId:t[qa]||Mt("Missing bot id header"),operation:ZI.parse(t[Va]),type:t[$h]||Mt("Missing type header"),configuration:JSON.parse(q.from(t[Ga]||Mt("Missing configuration header"),"base64").toString("utf-8"))});C();R();O();var dt={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 $I=["child_workflow_deleted","child_workflow_finished","workflow_timedout","workflow_started","workflow_continued"],Ev=async(t,e)=>{if(t.ctx.type!=="workflow_update"||!$I.includes(e.payload.type))throw new Error("Unexpected event type");let n={...t,logger:jI(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),dt;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 KI(n,e);default:e.payload.type}return dt},jI=(t,e)=>t.logger.with({eventId:e.id,workflowId:e.payload.workflow.id,conversationId:e.payload.conversation?.id,userId:e.payload.user?.id}),KI=async(t,e)=>{let n=Zl(e.payload.type),r=t.self.workflowHandlers[n]?.[e.payload.workflow.name];if(!r||r.length===0)return t.logger.warn(`No ${n} handler found for workflow "${e.payload.workflow.name}"`),dt;let{updatedWorkflow:a}=await LI(t,e);return a.status==="pending"&&t.logger.warn(`Workflow "${e.payload.workflow.name}" is still in pending status after processing "${n}" event. This may indicate that the workflow was not properly acknowledged or terminated by the handler. `),dt},LI=async(t,e)=>{let n=Zl(e.payload.type),r=t.self.workflowHandlers[n]?.[e.payload.workflow.name],a=structuredClone(e.payload.workflow);for(let o of r??[])a=await o({...t,event:e,conversation:e.payload.conversation,user:e.payload.user,workflow:a});return{updatedWorkflow:a}};C();R();O();var kv=t=>async e=>{let n=Bv(e.headers),r=new oi,a=new WI({botId:n.botId,retry:Wa}),o=new nn(a,{before:{createMessage:async s=>{let l=t.hookHandlers.before_outgoing_message[s.type]??[];for(let f of l){let p=new nn(a);s=(await f({client:p,ctx:n,logger:r.with({conversationId:s.conversationId,userId:s.userId}),data:s}))?.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 nn(a);s=(await f({client:p,ctx:n,logger:r,data:s}))?.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 nn(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}))?.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 nn(a);s=(await y({client:g,ctx:n,logger:r,data:{type:f,...s}}))?.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 Sv(l.message,l);return r.error(p.message),{status:p.code,body:JSON.stringify(p.toJSON())}}let f=new Sv("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=>dt,qI=async t=>dt,GI=async t=>dt,VI=async t=>{let{ctx:e,logger:n,req:r,client:a,self:o}=t,i={client:a,ctx:e,logger:n},s=Rt(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 Ev(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 dt}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 dt}return dt}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 dt}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 dt}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 dt}return dt},JI=async({ctx:t,logger:e,req:n,client:r,self:a})=>{let{input:o,type:i}=Rt(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}});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}),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}});i=h?.data?.type??i,f=h?.data?.output??f}return{status:200,body:JSON.stringify({output:f})}};C();R();O();C();R();O();var rn=t=>new Proxy({},{get:(e,n)=>({listInstances:{all:r=>yn({workflowName:n,client:t,input:r}),running:r=>yn({workflowName:n,client:t,input:r,statuses:["in_progress"]}),scheduled:r=>yn({workflowName:n,client:t,input:r,statuses:["pending","listening"]}),allFinished:r=>yn({workflowName:n,client:t,input:r,statuses:["completed","cancelled","failed","timedout"]}),cancelled:r=>yn({workflowName:n,client:t,input:r,statuses:["cancelled"]}),failed:r=>yn({workflowName:n,client:t,input:r,statuses:["failed"]}),succeeded:r=>yn({workflowName:n,client:t,input:r,statuses:["completed"]}),timedOut:r=>yn({workflowName:n,client:t,input:r,statuses:["timedout"]})},startNewInstance:async r=>{let{workflow:a}=await t.createWorkflow({name:n,status:"pending",...r});return{workflow:It({client:t,workflow:a})}}})}),yn=async t=>{let e=await t.client.listWorkflows({name:t.workflowName,statuses:t.statuses,...t.input});return{...e,workflows:e.workflows.map(n=>It({client:t.client,workflow:n}))}},It=t=>{let e=!1;return{...t.workflow,async update(n){let{workflow:r}=await t.client.updateWorkflow({id:t.workflow.id,...n});return await t.onWorkflowUpdate?.(r),{workflow:It({...t,workflow:r})}},async acknowledgeStartOfProcessing(){if(!t.event||t.workflow.status!=="pending"||e)return{workflow:It(t)};let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,status:"in_progress",eventId:t.event.id});return e=!0,await t.onWorkflowUpdate?.(n),{workflow:It({...t,workflow:n})}},async setFailed({failureReason:n}){let{workflow:r}=await t.client.updateWorkflow({id:t.workflow.id,status:"failed",failureReason:n});return await t.onWorkflowUpdate?.(r),{workflow:It({...t,workflow:r})}},async setCompleted({output:n}={}){let{workflow:r}=await t.client.updateWorkflow({id:t.workflow.id,status:"completed",output:n});return await t.onWorkflowUpdate?.(r),{workflow:It({...t,workflow:r})}},async cancel(){let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,status:"cancelled"});return await t.onWorkflowUpdate?.(n),{workflow:It({...t,workflow:n})}}}};C();R();O();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[a,o]of Object.entries(this._plugins)){let[i,s]=n.split(gn);if(!(i!==a||!s)&&(r=o.actionHandlers[s],r))return ft.setName(l=>r({...l,workflows:rn(l.client)}),r.name)}}})}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]).map(s=>ft.setName(l=>s({...l,workflows:rn(l.client)}),s.name))}})}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]).map(s=>ft.setName(l=>s({...l,workflows:rn(l.client)}),s.name))}})}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]).map(s=>ft.setName(l=>s({...l,workflows:rn(l.client)}),s.name))}})}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]).map(y=>ft.setName(g=>y({...g,workflows:rn(g.client)}),y.name))}})}})}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]).map(l=>ft.setName(async f=>{let p=f.workflow;return await l({...f,workflow:It({...f,onWorkflowUpdate(y){p=y}}),workflows:rn(f.client)}),p},l.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++})}};handler=kv(this);start=e=>Ka(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,this.__advanced=e.__advanced;let n=this._getEntityReference(this.entities),r=e.events===void 0?{}:Le.mapValues(e.events,i=>({...i,schema:i.schema(n)})),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;__advanced;_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 Kl=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,X.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.__advanced=e.__advanced,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;__advanced;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(X.record(X.string(),X.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 Ll=":";var Iv=t=>{let[e,n]=t.split(Ll);return!e||!n?null:{namespace:e,eventName:n}},Av=t=>`${t.namespace}${Ll}${t.actionName}`,Cv=t=>`${t.namespace}${Ll}${t.eventName}`,Ov=(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}},Rv=(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 Mv=(t,e)=>new Proxy({},{get:(n,r)=>new Proxy({},{get:(a,o)=>i=>YI({client:t,interfaces:e.interfaces,integrationOrInterfaceName:r,methodName:o,input:i})})}),YI=async({client:t,interfaces:e,integrationOrInterfaceName:n,methodName:r,input:a})=>{let o=Ov({namespace:n,actionName:r},e),i=Av(o);return(await t.callAction({type:i,input:a})).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: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 t({...this._props,conversationId:e})}withUserId(e){return new t({...this._props,userId:e})}withMessageId(e){return new t({...this._props,messageId:e})}},Nv=(t,e)=>new Proxy({},{get:(n,r)=>{let a=e.alias!==void 0?`${e.alias}${gn}${r}`:r;return new Fl({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})}},Dv=(t,e)=>new Proxy({},{get:(n,r)=>new Proxy({},{get:(a,o)=>{let i=e.alias!==void 0?`${e.alias}${gn}${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=Mv(e,this._runtime),i=Dv(e,this._runtime),s=rn(e),l=Nv(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 ft.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})=>ft.setName(s=>i({...s,message:s.message,...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})=>ft.setName(l=>s({...l,event:l.event,...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})=>ft.setName(s=>i({...s,state:s.state,...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})=>ft.setName(y=>p({...y,data:y.data,...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})=>ft.setName(async l=>{let f=l.workflow;return await s({...l,workflow:It({...l,onWorkflowUpdate(p){f=p}}),...this._getTools(l.client)}),f},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=Iv(e);if(!r)return!1;let a=Rv(r,this._runtime.interfaces);return Cv(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{Mx as BRAND,$l as Bot,Ul as BotDefinition,oi as BotLogger,nn as BotSpecificClient,Vn as DIRTY,Ax as EMPTY_PATH,pe as INVALID,Hl as Integration,Qs as IntegrationDefinition,ai as IntegrationLogger,ti as IntegrationSpecificClient,jl as InterfaceDefinition,MP as NEVER,gt as OK,Ct as ParseInputLazyPath,Tt as ParseStatus,zl as Plugin,Kl as PluginDefinition,cU as RuntimeError,he as Schema,QA as WELL_KNOWN_ATTRIBUTES,jr as ZodAny,Kr as ZodArray,$o as ZodBigInt,jo as ZodBoolean,Ko as ZodBranded,Lo as ZodCatch,Fo as ZodDate,ma as ZodDefault,fg as ZodDiscriminatedUnion,Sn as ZodEffects,ir as ZodEnum,Wt as ZodError,Xp as ZodFirstPartyTypeKind,pg as ZodFunction,zo as ZodIntersection,G as ZodIssueCode,qo as ZodLazy,Go as ZodLiteral,yg as ZodMap,hg as ZodNaN,Vo as ZodNativeEnum,Wr as ZodNever,Jo as ZodNull,Qn as ZodNullable,Yo as ZodNumber,er as ZodObject,ln as ZodOptional,ne as ZodParsedType,Xo as ZodPipeline,va as ZodPromise,Ta as ZodReadonly,Pg as ZodRecord,Eg as ZodRef,he as ZodSchema,Sg as ZodSet,yt as ZodString,Ug as ZodSymbol,Sn as ZodTransformer,nr as ZodTuple,he as ZodType,_a as ZodUndefined,Qo as ZodUnion,Nr as ZodUnknown,Kg as ZodVoid,te as addIssueToContext,jx as agent,zx as aimodel,rP as any,sP as array,Xx as bigint,Wg as boolean,RP as coerce,Ux as conversation,ha as createZodEnum,Ig as cuid2Regex,kg as cuidRegex,ug as custom,qx as datasource,Qx as date,fP as discriminatedUnion,Gc as effect,Og as emailRegex,wP as enum,ue as errorUtil,Kx as event,TP as function,Zr as getErrorMap,sn as getParsedType,Jx as instanceof,Wx as intent,dP as intersection,Mg as ipv4Regex,Ng as ipv6Regex,To as isAborted,uU as isApiError,Si as isAsync,_o as isDirty,Nx as isEmojiRegex,$r as isValid,Gx as knowledgebase,Vx as late,_P as lazy,bP as literal,Ei as makeIssue,hP as map,zr as mergeObjectSchemas,$x as message,Cy as messages,Yx as nan,xP as nativeEnum,aP as never,nP as null,EP as nullable,Fg as number,lP as object,vo as objectUtil,OP as oboolean,CP as onumber,BP as optional,AP as ostring,Rt as parseBody,IP as pipeline,kP as preprocess,me as processCreateParams,PP as promise,Ix as quotelessJson,mP as readonly,gP as record,yP as ref,Ka as serve,vP as set,tg as setErrorMap,uP as strictObject,Lg as string,eP as symbol,Lx as table,Fx as tablerow,Gc as transformer,qv as transforms,pP as tuple,Ag as ulidRegex,tP as undefined,cP as union,iP as unknown,Zx as user,be as util,Cg as uuidRegex,Hx as variable,oP as void,X as z};
|
|
93
|
+
`)+" "+F[1]:F[0]+K+" "+D.join(", ")+" "+F[1]}xe.types=BI();function B(D){return Array.isArray(D)}xe.isArray=B;function T(D){return typeof D=="boolean"}xe.isBoolean=T;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 j(D){return typeof D=="string"}xe.isString=j;function re(D){return typeof D=="symbol"}xe.isSymbol=re;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 ie(D){return oe(D)&&Ve(D)==="[object Date]"}xe.isDate=ie,xe.types.isDate=ie;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=EI();function Ve(D){return Object.prototype.toString.call(D)}function Je(D){return D<10?"0"+D.toString(10):D.toString(10)}var ht=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ue(){var D=new Date,K=[Je(D.getHours()),Je(D.getMinutes()),Je(D.getSeconds())].join(":");return[D.getDate(),ht[D.getMonth()],K].join(" ")}xe.log=function(){console.log("%s - %s",Ue(),xe.format.apply(xe,arguments))},xe.inherits=Ht(),xe._extend=function(D,K){if(!K||!oe(K))return D;for(var F=Object.keys(K),de=F.length;de--;)D[F[de]]=K[F[de]];return D};function Pe(D,K){return Object.prototype.hasOwnProperty.call(D,K)}var Se=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;xe.promisify=function(K){if(typeof K!="function")throw new TypeError('The "original" argument must be of type Function');if(Se&&K[Se]){if(F=K[Se],typeof F!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(F,Se,{value:F,enumerable:!1,writable:!1,configurable:!0}),F}function F(){for(var de,Te,C=new Promise(function(Y,ae){de=Y,Te=ae}),k=[],$=0;$<arguments.length;$++)k.push(arguments[$]);k.push(function(Y,ae){Y?Te(Y):de(ae)});try{K.apply(this||ai,k)}catch(Y){Te(Y)}return C}return Object.setPrototypeOf(F,Object.getPrototypeOf(K)),Se&&Object.defineProperty(F,Se,{value:F,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(F,e(K))},xe.promisify.custom=Se;function fe(D,K){if(!D){var F=new Error("Promise was rejected with a falsy value");F.reason=D,D=F}return K(D)}function ve(D){if(typeof D!="function")throw new TypeError('The "original" argument must be of type Function');function K(){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 C=this||ai,k=function(){return Te.apply(C,arguments)};D.apply(this||ai,F).then(function($){t.nextTick(k.bind(null,null,$))},function($){t.nextTick(fe.bind(null,$,k))})}return Object.setPrototypeOf(K,Object.getPrototypeOf(D)),Object.defineProperties(K,e(D)),K}return xe.callbackify=ve,xe}var ce=SI();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 VR=ce._extend,JR=ce.callbackify,YR=ce.debuglog,XR=ce.deprecate,QR=ce.format,e0=ce.inherits,t0=ce.inspect,n0=ce.isArray,r0=ce.isBoolean,i0=ce.isBuffer,a0=ce.isDate,o0=ce.isError,s0=ce.isFunction,l0=ce.isNull,u0=ce.isNullOrUndefined,c0=ce.isNumber,f0=ce.isObject,d0=ce.isPrimitive,p0=ce.isRegExp,g0=ce.isString,y0=ce.isSymbol,m0=ce.isUndefined,h0=ce.log,v0=ce.promisify,T0=ce.types,_0=ce.TextEncoder=globalThis.TextEncoder,b0=ce.TextDecoder=globalThis.TextDecoder;var yr=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 yr{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})}};O();M();R();var CI=t=>["traceparent","tracestate","sentry-trace"].reduce((e,n)=>(t[n]&&(e[n]=t[n]),e),{}),OI=(t,e,n)=>{let[,r]=(e.headers.traceparent||"").split("-"),a=new II({botId:t.botId,integrationId:t.integrationId,integrationAlias:t.integrationAlias,retry:Wa,headers:CI(e.headers)}),o=new ni(a),i=new oi({traceId:r});return{ctx:t,req:e,client:o,logger:i,instance:n}},RI=async t=>{let{ctx:e}=t;switch(e.operation){case"webhook_received":return await NI(t);case"register":return await DI(t);case"unregister":return await HI(t);case"message_created":return await $I(t);case"action_triggered":return await jI(t);case"ping":return await MI(t);case"create_user":return await UI(t);case"create_conversation":return await ZI(t);default:throw new AI(`Unknown operation ${e.operation}`)}},Sv=t=>async e=>{let n=Fh(e.headers),r=OI(n,e,t),{logger:a}=r;try{let o;return o=await KI(r),o?{...o,status:o.status??200}:(o=await RI(r),o?{...o,status:o.status??200}:{status:200})}catch(o){if(kI(o)){let s=o.type==="Runtime"?o:new Ev(o.message,o);return a.forBot().error(s.message),{status:s.code,body:JSON.stringify(s.toJSON())}}console.error(o);let i=new Ev("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())}}},MI=async t=>{},NI=async({client:t,ctx:e,req:n,logger:r,instance:a})=>{let{req:o}=Mt(n);return a.webhook({client:t,ctx:e,req:o,logger:r})},DI=async({client:t,ctx:e,req:n,logger:r,instance:a})=>{if(!a.register)return;let{webhookUrl:o}=Mt(n);await a.register({client:t,ctx:e,webhookUrl:o,logger:r})},HI=async({client:t,ctx:e,req:n,logger:r,instance:a})=>{if(!a.unregister)return;let{webhookUrl:o}=Mt(n);await a.unregister({ctx:e,webhookUrl:o,client:t,logger:r})},UI=async({client:t,ctx:e,req:n,logger:r,instance:a})=>{if(!a.createUser)return;let{tags:o}=Mt(n);return await a.createUser({ctx:e,client:t,tags:o,logger:r})},ZI=async({client:t,ctx:e,req:n,logger:r,instance:a})=>{if(!a.createConversation)return;let{channel:o,tags:i}=Mt(n);return await a.createConversation({ctx:e,client:t,channel:o,tags:i,logger:r})},$I=async({ctx:t,req:e,client:n,logger:r,instance:a})=>{let{conversation:o,user:i,type:s,payload:l,message:f}=Mt(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})},jI=async({req:t,ctx:e,client:n,logger:r,instance:a})=>{let{input:o,type:i}=Mt(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 za,p={output:await s({ctx:e,input:o,client:n,type:i,logger:r,metadata:l}),meta:l.toJSON()};return{body:JSON.stringify(p)}},KI=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=Sv(this);start=e=>Ka(this.handler,e)};O();M();R();O();M();R();O();M();R();O();M();R();O();M();R();var Zl=class{constructor(e){this.props=e;this.integrations=e.integrations,this.plugins=e.plugins,this.user=e.user,this.conversation=e.conversation,this.message=e.message,this.states=e.states,this.configuration=e.configuration,this.events=e.events,this.recurringEvents=e.recurringEvents,this.actions=e.actions,this.tables=e.tables,this.workflows=e.workflows,this.attributes=e.attributes,this.__advanced=e.__advanced,this.withPlugins={user:e.user,conversation:e.conversation,message:e.message,states:e.states,events:e.events,recurringEvents:e.recurringEvents,actions:e.actions,tables:e.tables,workflows:e.workflows}}integrations;plugins;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;workflows;attributes;__advanced;withPlugins;addIntegration(e,n){let r=this;r.integrations||(r.integrations={});let a=n?.alias??e.name.replace("/","-");if(r.integrations[a])throw new Error(`Another integration with alias "${a}" is already installed in the bot`);return r.integrations[a]={...e,alias:a,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("/","-");if(r.plugins[a])throw new Error(`Another plugin with alias "${a}" is already installed in the bot`);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}${gn}${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)}}]))}};O();M();R();O();M();R();import{isApiError as GI,Client as VI,RuntimeError as Av}from"@botpress/client";O();M();R();var si=class t extends yr{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})}};O();M();R();O();M();R();var nn=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}};O();M();R();var LI=X.enum(["event_received","register","unregister","ping","action_triggered"]),kv=t=>({botId:t[qa]||It("Missing bot id header"),operation:LI.parse(t[Va]),type:t[Lh]||It("Missing type header"),configuration:JSON.parse(q.from(t[Ga]||It("Missing configuration header"),"base64").toString("utf-8"))});O();M();R();var dt={status:200};O();M();R();O();M();R();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 FI=["child_workflow_deleted","child_workflow_finished","workflow_timedout","workflow_started","workflow_continued"],Iv=async(t,e)=>{if(t.ctx.type!=="workflow_update"||!FI.includes(e.payload.type))throw new Error("Unexpected event type");let n={...t,logger:WI(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),dt;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 zI(n,e);default:e.payload.type}return dt},WI=(t,e)=>t.logger.with({eventId:e.id,workflowId:e.payload.workflow.id,conversationId:e.payload.conversation?.id,userId:e.payload.user?.id}),zI=async(t,e)=>{let n=$l(e.payload.type),r=t.self.workflowHandlers[n]?.[e.payload.workflow.name];if(!r||r.length===0)return t.logger.warn(`No ${n} handler found for workflow "${e.payload.workflow.name}"`),dt;let{updatedWorkflow:a}=await qI(t,e);return a.status==="pending"&&t.logger.warn(`Workflow "${e.payload.workflow.name}" is still in pending status after processing "${n}" event. This may indicate that the workflow was not properly acknowledged or terminated by the handler. `),dt},qI=async(t,e)=>{let n=$l(e.payload.type),r=t.self.workflowHandlers[n]?.[e.payload.workflow.name],a=structuredClone(e.payload.workflow);for(let o of r??[])a=await o({...t,event:e,conversation:e.payload.conversation,user:e.payload.user,workflow:a});return{updatedWorkflow:a}};O();M();R();var Cv=t=>async e=>{let n=kv(e.headers),r=new si,a=new VI({botId:n.botId,retry:Wa}),o=new nn(a,{before:{createMessage:async s=>{let l=t.hookHandlers.before_outgoing_message[s.type]??[];for(let f of l){let p=new nn(a);s=(await f({client:p,ctx:n,logger:r.with({conversationId:s.conversationId,userId:s.userId}),data:s}))?.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 nn(a);s=(await f({client:p,ctx:n,logger:r,data:s}))?.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 nn(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}))?.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 nn(a);s=(await y({client:g,ctx:n,logger:r,data:{type:f,...s}}))?.data??s}return s}}}),i={req:e,ctx:n,logger:r,client:o,self:t};try{switch(n.operation){case"action_triggered":return await eA(i);case"event_received":return await QI(i);case"register":return await YI(i);case"unregister":return await XI(i);case"ping":return await JI(i);default:throw new Error(`Unknown operation ${n.operation}`)}}catch(s){let l=s instanceof Error?s:new Error(String(s));if(GI(l)){let p=l.type==="Runtime"?l:new Av(l.message,l);return r.error(p.message),{status:p.code,body:JSON.stringify(p.toJSON())}}let f=new Av("An unexpected error occurred in the bot.",l);return r.error(f.message,l),{status:f.code,body:JSON.stringify(f.toJSON())}}},JI=async t=>dt,YI=async t=>dt,XI=async t=>dt,QI=async t=>{let{ctx:e,logger:n,req:r,client:a,self:o}=t,i={client:a,ctx:e,logger:n},s=Mt(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 Iv(t,s.event);if(e.type==="message_created"){let h=s.event,v=h.payload.message;i.logger=i.logger.with({messageId:v.id,conversationId:v.conversationId,userId:v.userId});let P=o.hookHandlers.before_incoming_message[v.type]??[];for(let E of P){let H=await E({...i,data:v});if(v=H?.data??v,H?.stop)return dt}let B={...i,user:h.payload.user,conversation:h.payload.conversation,message:v,event:h},T=o.messageHandlers[v.type]??[];for(let E of T)await E(B);let S=o.hookHandlers.after_incoming_message[v.type]??[];for(let E of S){let H=await E({...i,data:v});if(v=H?.data??v,H?.stop)return dt}return dt}if(e.type==="state_expired"){let v=s.event.payload.state,P={...i,state:v},B=o.stateExpiredHandlers[v.name]??[];for(let T of B)await T(P);return dt}let l=s.event,f=o.hookHandlers.before_incoming_event[l.type]??[];for(let h of f){let v=await h({...i,data:l});if(l=v?.data??l,v?.stop)return dt}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 v=await h({...i,data:l});if(l=v?.data??l,v?.stop)return dt}return dt},eA=async({ctx:t,logger:e,req:n,client:r,self:a})=>{let{input:o,type:i}=Mt(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}});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}),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}});i=h?.data?.type??i,f=h?.data?.output??f}return{status:200,body:JSON.stringify({output:f})}};O();M();R();O();M();R();var rn=t=>new Proxy({},{get:(e,n)=>({listInstances:{all:r=>yn({workflowName:n,client:t,input:r}),running:r=>yn({workflowName:n,client:t,input:r,statuses:["in_progress"]}),scheduled:r=>yn({workflowName:n,client:t,input:r,statuses:["pending","listening"]}),allFinished:r=>yn({workflowName:n,client:t,input:r,statuses:["completed","cancelled","failed","timedout"]}),cancelled:r=>yn({workflowName:n,client:t,input:r,statuses:["cancelled"]}),failed:r=>yn({workflowName:n,client:t,input:r,statuses:["failed"]}),succeeded:r=>yn({workflowName:n,client:t,input:r,statuses:["completed"]}),timedOut:r=>yn({workflowName:n,client:t,input:r,statuses:["timedout"]})},startNewInstance:async r=>{let{workflow:a}=await t.createWorkflow({name:n,status:"pending",...r});return{workflow:At({client:t,workflow:a})}}})}),yn=async t=>{let e=await t.client.listWorkflows({name:t.workflowName,statuses:t.statuses,...t.input});return{...e,workflows:e.workflows.map(n=>At({client:t.client,workflow:n}))}},At=t=>{let e=!1;return{...t.workflow,async update(n){let{workflow:r}=await t.client.updateWorkflow({id:t.workflow.id,...n});return await t.onWorkflowUpdate?.(r),{workflow:At({...t,workflow:r})}},async acknowledgeStartOfProcessing(){if(!t.event||t.workflow.status!=="pending"||e)return{workflow:At(t)};let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,status:"in_progress",eventId:t.event.id});return e=!0,await t.onWorkflowUpdate?.(n),{workflow:At({...t,workflow:n})}},async setFailed({failureReason:n}){let{workflow:r}=await t.client.updateWorkflow({id:t.workflow.id,status:"failed",failureReason:n});return await t.onWorkflowUpdate?.(r),{workflow:At({...t,workflow:r})}},async setCompleted({output:n}={}){let{workflow:r}=await t.client.updateWorkflow({id:t.workflow.id,status:"completed",output:n});return await t.onWorkflowUpdate?.(r),{workflow:At({...t,workflow:r})}},async cancel(){let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,status:"cancelled"});return await t.onWorkflowUpdate?.(n),{workflow:At({...t,workflow:n})}}}};O();M();R();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(gn);if(!(i!==a||!s)&&(r=o.actionHandlers[s],r))return ft.setName(l=>r({...l,workflows:rn(l.client)}),r.name)}}})}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]).map(s=>ft.setName(l=>s({...l,workflows:rn(l.client)}),s.name))}})}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]).map(s=>ft.setName(l=>s({...l,workflows:rn(l.client)}),s.name))}})}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]).map(s=>ft.setName(l=>s({...l,workflows:rn(l.client)}),s.name))}})}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]).map(y=>ft.setName(g=>y({...g,workflows:rn(g.client)}),y.name))}})}})}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]).map(l=>ft.setName(async f=>{let p=f.workflow;return await l({...f,workflow:At({...f,onWorkflowUpdate(y){p=y}}),workflows:rn(f.client)}),p},l.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++})}};handler=Cv(this);start=e=>Ka(this.handler,e)};O();M();R();O();M();R();O();M();R();O();M();R();O();M();R();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,this.__advanced=e.__advanced;let n=this._getEntityReference(this.entities),r=e.events===void 0?{}:Le.mapValues(e.events,i=>({...i,schema:i.schema(n)})),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;__advanced;_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=Py.ref(r);o&&s.title(o),i&&s.describe(i),n[r]=s}return n}};O();M();R();O();M();R();O();M();R();O();M();R();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,X.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.__advanced=e.__advanced,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;__advanced;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(X.record(X.string(),X.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)}}]))}};O();M();R();O();M();R();O();M();R();O();M();R();var Fl=":";var Ov=t=>{let[e,n]=t.split(Fl);return!e||!n?null:{namespace:e,eventName:n}},Rv=t=>`${t.namespace}${Fl}${t.actionName}`,Mv=t=>`${t.namespace}${Fl}${t.eventName}`,Nv=(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}},Dv=(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 Hv=(t,e)=>new Proxy({},{get:(n,r)=>new Proxy({},{get:(a,o)=>i=>tA({client:t,interfaces:e.interfaces,integrationOrInterfaceName:r,methodName:o,input:i})})}),tA=async({client:t,interfaces:e,integrationOrInterfaceName:n,methodName:r,input:a})=>{let o=Nv({namespace:n,actionName:r},e),i=Rv(o);return(await t.callAction({type:i,input:a})).output};O();M();R();O();M();R();O();M();R();var Wl=class t{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 t({...this._props,conversationId:e})}withUserId(e){return new t({...this._props,userId:e})}withMessageId(e){return new t({...this._props,messageId:e})}},Uv=(t,e)=>new Proxy({},{get:(n,r)=>{let a=e.alias!==void 0?`${e.alias}${gn}${r}`:r;return new Wl({client:t,eventName:a})}});O();M();R();O();M();R();O();M();R();var zl=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})}},Zv=(t,e)=>new Proxy({},{get:(n,r)=>new Proxy({},{get:(a,o)=>{let i=e.alias!==void 0?`${e.alias}${gn}${o}`:o;return new zl(t,r,i)}})});O();M();R();var ql=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=Hv(e,this._runtime),i=Zv(e,this._runtime),s=rn(e),l=Uv(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 ft.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})=>ft.setName(s=>i({...s,message:s.message,...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})=>ft.setName(l=>s({...l,event:l.event,...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})=>ft.setName(s=>i({...s,state:s.state,...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})=>ft.setName(y=>p({...y,data:y.data,...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})=>ft.setName(async l=>{let f=l.workflow;return await s({...l,workflow:At({...l,onWorkflowUpdate(p){f=p}}),...this._getTools(l.client)}),f},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=Ov(e);if(!r)return!1;let a=Dv(r,this._runtime.interfaces);return Mv(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}};O();M();R();O();M();R();O();M();R();O();M();R();O();M();R();O();M();R();export{Ux as BRAND,jl as Bot,Zl as BotDefinition,si as BotLogger,nn as BotSpecificClient,Vn as DIRTY,Mx as EMPTY_PATH,pe as INVALID,Ul as Integration,el as IntegrationDefinition,oi as IntegrationLogger,ni as IntegrationSpecificClient,Kl as InterfaceDefinition,UP as NEVER,gt as OK,Ot as ParseInputLazyPath,Tt as ParseStatus,ql as Plugin,Ll as PluginDefinition,yU as RuntimeError,he as Schema,iC as WELL_KNOWN_ATTRIBUTES,Kr as ZodAny,Lr as ZodArray,jo as ZodBigInt,Ko as ZodBoolean,Lo as ZodBranded,Fo as ZodCatch,Wo as ZodDate,ma as ZodDefault,gg as ZodDiscriminatedUnion,Sn as ZodEffects,ir as ZodEnum,Wt as ZodError,tg as ZodFirstPartyTypeKind,mg as ZodFunction,qo as ZodIntersection,G as ZodIssueCode,Go as ZodLazy,Vo as ZodLiteral,vg as ZodMap,_g as ZodNaN,Jo as ZodNativeEnum,zr as ZodNever,Yo as ZodNull,Qn as ZodNullable,Xo as ZodNumber,er as ZodObject,ln as ZodOptional,ne as ZodParsedType,Qo as ZodPipeline,va as ZodPromise,Ta as ZodReadonly,Sg as ZodRecord,Ig as ZodRef,he as ZodSchema,Ag as ZodSet,yt as ZodString,jg as ZodSymbol,Sn as ZodTransformer,nr as ZodTuple,he as ZodType,_a as ZodUndefined,es as ZodUnion,Dr as ZodUnknown,Wg as ZodVoid,te as addIssueToContext,Wx as agent,Jx as aimodel,sP as any,fP as array,nP as bigint,Gg as boolean,HP as coerce,Kx as conversation,ha as createZodEnum,Og as cuid2Regex,Cg as cuidRegex,dg as custom,Yx as datasource,rP as date,yP as discriminatedUnion,Jc as effect,Ng as emailRegex,EP as enum,ue as errorUtil,zx as event,xP as function,$r as getErrorMap,sn as getParsedType,eP as instanceof,Vx as intent,mP as intersection,Hg as ipv4Regex,Ug as ipv6Regex,_o as isAborted,gU as isApiError,Si as isAsync,bo as isDirty,Zx as isEmojiRegex,jr as isValid,wA as json,Xx as knowledgebase,Qx as late,PP as lazy,BP as literal,Ei as makeIssue,bP as map,qr as mergeObjectSchemas,Fx as message,My as messages,tP as nan,SP as nativeEnum,uP as never,oP as null,AP as nullable,qg as number,dP as object,To as objectUtil,DP as oboolean,NP as onumber,IP as optional,MP as ostring,Mt as parseBody,RP as pipeline,OP as preprocess,me as processCreateParams,kP as promise,Rx as quotelessJson,_P as readonly,vP as record,TP as ref,Ka as serve,wP as set,ig as setErrorMap,pP as strictObject,zg as string,iP as symbol,qx as table,Gx as tablerow,Jc as transformer,Jv as transforms,hP as tuple,Rg as ulidRegex,aP as undefined,gP as union,lP as unknown,Lx as user,be as util,Mg as uuidRegex,jx as variable,cP as void,X as z};
|
|
89
94
|
/*! Bundled license information:
|
|
90
95
|
|
|
91
96
|
@jspm/core/nodelibs/browser/chunk-DtuTasat.js:
|