@botpress/sdk 6.11.2 → 6.12.0
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/bot/definition.d.ts +5 -0
- package/dist/common/recurring-events.d.ts +9 -0
- package/dist/common/recurring-events.test.d.ts +1 -0
- package/dist/index.cjs +15 -15
- package/dist/index.cjs.map +4 -4
- package/dist/index.mjs +20 -20
- package/dist/index.mjs.map +4 -4
- package/dist/plugin/definition.d.ts +1 -0
- package/dist/plugin/definition.test.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var Mo=Object.defineProperty;var VT=Object.getOwnPropertyDescriptor;var JT=Object.getOwnPropertyNames;var YT=Object.prototype.hasOwnProperty;var ot=(t,e)=>()=>(t&&(e=t(t=0)),e);var pn=(t,e)=>{for(var n in e)Mo(t,n,{get:e[n],enumerable:!0})},XT=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of JT(e))!YT.call(t,i)&&i!==n&&Mo(t,i,{get:()=>e[i],enumerable:!(r=VT(e,i))||r.enumerable});return t};var QT=t=>XT(Mo({},"__esModule",{value:!0}),t);var E=ot(()=>{});var G={};pn(G,{_debugEnd:()=>Au,_debugProcess:()=>ku,_events:()=>zu,_eventsCount:()=>qu,_exiting:()=>cu,_fatalExceptions:()=>Iu,_getActiveHandles:()=>gu,_getActiveRequests:()=>pu,_kill:()=>yu,_linkedBinding:()=>lu,_maxListeners:()=>Fu,_preload_modules:()=>Lu,_rawDebug:()=>su,_startProfilerIdleNotifier:()=>Cu,_stopProfilerIdleNotifier:()=>Ou,_tickCallback:()=>Eu,abort:()=>Du,addListener:()=>Gu,allowedNodeEnvironmentFlags:()=>wu,arch:()=>zl,argv:()=>Vl,argv0:()=>Zu,assert:()=>xu,binding:()=>eu,browser:()=>ou,chdir:()=>ru,config:()=>du,cpuUsage:()=>hi,cwd:()=>nu,debugPort:()=>$u,default:()=>rc,dlopen:()=>fu,domain:()=>uu,emit:()=>Qu,emitWarning:()=>Ql,env:()=>Gl,execArgv:()=>Jl,execPath:()=>ju,exit:()=>_u,features:()=>Pu,hasUncaughtExceptionCaptureCallback:()=>Su,hrtime:()=>yi,kill:()=>vu,listeners:()=>nc,memoryUsage:()=>Tu,moduleLoadList:()=>au,nextTick:()=>Wl,off:()=>Ju,on:()=>Vt,once:()=>Vu,openStdin:()=>bu,pid:()=>Hu,platform:()=>ql,ppid:()=>Uu,prependListener:()=>ec,prependOnceListener:()=>tc,reallyExit:()=>mu,release:()=>iu,removeAllListeners:()=>Xu,removeListener:()=>Yu,resourceUsage:()=>hu,setSourceMapsEnabled:()=>Wu,setUncaughtExceptionCaptureCallback:()=>Bu,stderr:()=>Mu,stdin:()=>Nu,stdout:()=>Ru,title:()=>Fl,umask:()=>tu,uptime:()=>Ku,version:()=>Yl,versions:()=>Xl});function Ho(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function ev(){!er||!wn||(er=!1,wn.length?Gt=wn.concat(Gt):mi=-1,Gt.length&&Ll())}function Ll(){if(!er){var t=setTimeout(ev,0);er=!0;for(var e=Gt.length;e;){for(wn=Gt,Gt=[];++mi<e;)wn&&wn[mi].run();mi=-1,e=Gt.length}wn=null,er=!1,clearTimeout(t)}}function Wl(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];Gt.push(new Kl(t,e)),Gt.length===1&&!er&&setTimeout(Ll,0)}function Kl(t,e){this.fun=t,this.array=e}function st(){}function lu(t){Ho("_linkedBinding")}function fu(t){Ho("dlopen")}function pu(){return[]}function gu(){return[]}function xu(t,e){if(!t)throw new Error(e||"assertion error")}function Su(){return!1}function Ku(){return gn.now()/1e3}function yi(t){var e=Math.floor((Date.now()-gn.now())*.001),n=gn.now()*.001,r=Math.floor(n)+e,i=Math.floor(n%1*1e9);return t&&(r=r-t[0],i=i-t[1],i<0&&(r--,i+=Do)),[r,i]}function Vt(){return rc}function nc(t){return[]}var Gt,er,wn,mi,Fl,zl,ql,Gl,Vl,Jl,Yl,Xl,Ql,eu,tu,nu,ru,iu,ou,su,au,uu,cu,du,mu,yu,hi,hu,Tu,vu,_u,bu,wu,Pu,Iu,Bu,Eu,ku,Au,Cu,Ou,Ru,Mu,Nu,Du,Hu,Uu,ju,$u,Zu,Lu,Wu,gn,No,Do,Fu,zu,qu,Gu,Vu,Ju,Yu,Xu,Qu,ec,tc,rc,ic=ot(()=>{E();A();k();Gt=[],er=!1,mi=-1;Kl.prototype.run=function(){this.fun.apply(null,this.array)};Fl="browser",zl="x64",ql="browser",Gl={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},Vl=["/usr/bin/node"],Jl=[],Yl="v16.8.0",Xl={},Ql=function(t,e){console.warn((e?e+": ":"")+t)},eu=function(t){Ho("binding")},tu=function(t){return 0},nu=function(){return"/"},ru=function(t){},iu={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};ou=!0,su=st,au=[];uu={},cu=!1,du={};mu=st,yu=st,hi=function(){return{}},hu=hi,Tu=hi,vu=st,_u=st,bu=st,wu={};Pu={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Iu=st,Bu=st;Eu=st,ku=st,Au=st,Cu=st,Ou=st,Ru=void 0,Mu=void 0,Nu=void 0,Du=st,Hu=2,Uu=1,ju="/bin/usr/node",$u=9229,Zu="node",Lu=[],Wu=st,gn={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};gn.now===void 0&&(No=Date.now(),gn.timing&&gn.timing.navigationStart&&(No=gn.timing.navigationStart),gn.now=()=>Date.now()-No);Do=1e9;yi.bigint=function(t){var e=yi(t);return typeof BigInt>"u"?e[0]*Do+e[1]:BigInt(e[0]*Do)+BigInt(e[1])};Fu=10,zu={},qu=0;Gu=Vt,Vu=Vt,Ju=Vt,Yu=Vt,Xu=Vt,Qu=st,ec=Vt,tc=Vt;rc={version:Yl,versions:Xl,arch:zl,platform:ql,browser:ou,release:iu,_rawDebug:su,moduleLoadList:au,binding:eu,_linkedBinding:lu,_events:zu,_eventsCount:qu,_maxListeners:Fu,on:Vt,addListener:Gu,once:Vu,off:Ju,removeListener:Yu,removeAllListeners:Xu,emit:Qu,prependListener:ec,prependOnceListener:tc,listeners:nc,domain:uu,_exiting:cu,config:du,dlopen:fu,uptime:Ku,_getActiveRequests:pu,_getActiveHandles:gu,reallyExit:mu,_kill:yu,cpuUsage:hi,resourceUsage:hu,memoryUsage:Tu,kill:vu,exit:_u,openStdin:bu,allowedNodeEnvironmentFlags:wu,assert:xu,features:Pu,_fatalExceptions:Iu,setUncaughtExceptionCaptureCallback:Bu,hasUncaughtExceptionCaptureCallback:Su,emitWarning:Ql,nextTick:Wl,_tickCallback:Eu,_debugProcess:ku,_debugEnd:Au,_startProfilerIdleNotifier:Cu,_stopProfilerIdleNotifier:Ou,stdout:Ru,stdin:Nu,stderr:Mu,abort:Du,umask:tu,chdir:ru,cwd:nu,env:Gl,title:Fl,argv:Vl,execArgv:Jl,pid:Hu,ppid:Uu,execPath:ju,debugPort:$u,hrtime:yi,argv0:Zu,_preload_modules:Lu,setSourceMapsEnabled:Wu}});var k=ot(()=>{ic()});function tv(){if(oc)return br;oc=!0,br.byteLength=a,br.toByteArray=c,br.fromByteArray=g;for(var t=[],e=[],n=typeof Uint8Array<"u"?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,s=r.length;i<s;++i)t[i]=r[i],e[r.charCodeAt(i)]=i;e[45]=62,e[95]=63;function o(y){var T=y.length;if(T%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var P=y.indexOf("=");P===-1&&(P=T);var I=P===T?0:4-P%4;return[P,I]}function a(y){var T=o(y),P=T[0],I=T[1];return(P+I)*3/4-I}function l(y,T,P){return(T+P)*3/4-P}function c(y){var T,P=o(y),I=P[0],_=P[1],S=new n(l(y,I,_)),B=0,D=_>0?I-4:I,$;for($=0;$<D;$+=4)T=e[y.charCodeAt($)]<<18|e[y.charCodeAt($+1)]<<12|e[y.charCodeAt($+2)]<<6|e[y.charCodeAt($+3)],S[B++]=T>>16&255,S[B++]=T>>8&255,S[B++]=T&255;return _===2&&(T=e[y.charCodeAt($)]<<2|e[y.charCodeAt($+1)]>>4,S[B++]=T&255),_===1&&(T=e[y.charCodeAt($)]<<10|e[y.charCodeAt($+1)]<<4|e[y.charCodeAt($+2)]>>2,S[B++]=T>>8&255,S[B++]=T&255),S}function f(y){return t[y>>18&63]+t[y>>12&63]+t[y>>6&63]+t[y&63]}function p(y,T,P){for(var I,_=[],S=T;S<P;S+=3)I=(y[S]<<16&16711680)+(y[S+1]<<8&65280)+(y[S+2]&255),_.push(f(I));return _.join("")}function g(y){for(var T,P=y.length,I=P%3,_=[],S=16383,B=0,D=P-I;B<D;B+=S)_.push(p(y,B,B+S>D?D:B+S));return I===1?(T=y[P-1],_.push(t[T>>2]+t[T<<4&63]+"==")):I===2&&(T=(y[P-2]<<8)+y[P-1],_.push(t[T>>10]+t[T>>4&63]+t[T<<2&63]+"=")),_.join("")}return br}function nv(){if(sc)return Ti;sc=!0;return Ti.read=function(t,e,n,r,i){var s,o,a=i*8-r-1,l=(1<<a)-1,c=l>>1,f=-7,p=n?i-1:0,g=n?-1:1,y=t[e+p];for(p+=g,s=y&(1<<-f)-1,y>>=-f,f+=a;f>0;s=s*256+t[e+p],p+=g,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=r;f>0;o=o*256+t[e+p],p+=g,f-=8);if(s===0)s=1-c;else{if(s===l)return o?NaN:(y?-1:1)*(1/0);o=o+Math.pow(2,r),s=s-c}return(y?-1:1)*o*Math.pow(2,s-r)},Ti.write=function(t,e,n,r,i,s){var o,a,l,c=s*8-i-1,f=(1<<c)-1,p=f>>1,g=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=r?0:s-1,T=r?1:-1,P=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+p>=1?e+=g/l:e+=g*Math.pow(2,1-p),e*l>=2&&(o++,l/=2),o+p>=f?(a=0,o=f):o+p>=1?(a=(e*l-1)*Math.pow(2,i),o=o+p):(a=e*Math.pow(2,p-1)*Math.pow(2,i),o=0));i>=8;t[n+y]=a&255,y+=T,a/=256,i-=8);for(o=o<<i|a,c+=i;c>0;t[n+y]=o&255,y+=T,o/=256,c-=8);t[n+y-T]|=P*128},Ti}function $t(){if(ac)return xn;ac=!0;let t=tv(),e=nv(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;xn.Buffer=o,xn.SlowBuffer=_,xn.INSPECT_MAX_BYTES=50;let r=2147483647;xn.kMaxLength=r,o.TYPED_ARRAY_SUPPORT=i(),!o.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 i(){try{let h=new Uint8Array(1),u={foo:function(){return 42}};return Object.setPrototypeOf(u,Uint8Array.prototype),Object.setPrototypeOf(h,u),h.foo()===42}catch{return!1}}Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}});function s(h){if(h>r)throw new RangeError('The value "'+h+'" is invalid for option "size"');let u=new Uint8Array(h);return Object.setPrototypeOf(u,o.prototype),u}function o(h,u,d){if(typeof h=="number"){if(typeof u=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return f(h)}return a(h,u,d)}o.poolSize=8192;function a(h,u,d){if(typeof h=="string")return p(h,u);if(ArrayBuffer.isView(h))return y(h);if(h==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof h);if(_t(h,ArrayBuffer)||h&&_t(h.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(_t(h,SharedArrayBuffer)||h&&_t(h.buffer,SharedArrayBuffer)))return T(h,u,d);if(typeof h=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let v=h.valueOf&&h.valueOf();if(v!=null&&v!==h)return o.from(v,u,d);let O=P(h);if(O)return O;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof h[Symbol.toPrimitive]=="function")return o.from(h[Symbol.toPrimitive]("string"),u,d);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof h)}o.from=function(h,u,d){return a(h,u,d)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function l(h){if(typeof h!="number")throw new TypeError('"size" argument must be of type number');if(h<0)throw new RangeError('The value "'+h+'" is invalid for option "size"')}function c(h,u,d){return l(h),h<=0?s(h):u!==void 0?typeof d=="string"?s(h).fill(u,d):s(h).fill(u):s(h)}o.alloc=function(h,u,d){return c(h,u,d)};function f(h){return l(h),s(h<0?0:I(h)|0)}o.allocUnsafe=function(h){return f(h)},o.allocUnsafeSlow=function(h){return f(h)};function p(h,u){if((typeof u!="string"||u==="")&&(u="utf8"),!o.isEncoding(u))throw new TypeError("Unknown encoding: "+u);let d=S(h,u)|0,v=s(d),O=v.write(h,u);return O!==d&&(v=v.slice(0,O)),v}function g(h){let u=h.length<0?0:I(h.length)|0,d=s(u);for(let v=0;v<u;v+=1)d[v]=h[v]&255;return d}function y(h){if(_t(h,Uint8Array)){let u=new Uint8Array(h);return T(u.buffer,u.byteOffset,u.byteLength)}return g(h)}function T(h,u,d){if(u<0||h.byteLength<u)throw new RangeError('"offset" is outside of buffer bounds');if(h.byteLength<u+(d||0))throw new RangeError('"length" is outside of buffer bounds');let v;return u===void 0&&d===void 0?v=new Uint8Array(h):d===void 0?v=new Uint8Array(h,u):v=new Uint8Array(h,u,d),Object.setPrototypeOf(v,o.prototype),v}function P(h){if(o.isBuffer(h)){let u=I(h.length)|0,d=s(u);return d.length===0||h.copy(d,0,0,u),d}if(h.length!==void 0)return typeof h.length!="number"||vr(h.length)?s(0):g(h);if(h.type==="Buffer"&&Array.isArray(h.data))return g(h.data)}function I(h){if(h>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return h|0}function _(h){return+h!=h&&(h=0),o.alloc(+h)}o.isBuffer=function(u){return u!=null&&u._isBuffer===!0&&u!==o.prototype},o.compare=function(u,d){if(_t(u,Uint8Array)&&(u=o.from(u,u.offset,u.byteLength)),_t(d,Uint8Array)&&(d=o.from(d,d.offset,d.byteLength)),!o.isBuffer(u)||!o.isBuffer(d))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(u===d)return 0;let v=u.length,O=d.length;for(let H=0,K=Math.min(v,O);H<K;++H)if(u[H]!==d[H]){v=u[H],O=d[H];break}return v<O?-1:O<v?1:0},o.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}},o.concat=function(u,d){if(!Array.isArray(u))throw new TypeError('"list" argument must be an Array of Buffers');if(u.length===0)return o.alloc(0);let v;if(d===void 0)for(d=0,v=0;v<u.length;++v)d+=u[v].length;let O=o.allocUnsafe(d),H=0;for(v=0;v<u.length;++v){let K=u[v];if(_t(K,Uint8Array))H+K.length>O.length?(o.isBuffer(K)||(K=o.from(K)),K.copy(O,H)):Uint8Array.prototype.set.call(O,K,H);else if(o.isBuffer(K))K.copy(O,H);else throw new TypeError('"list" argument must be an Array of Buffers');H+=K.length}return O};function S(h,u){if(o.isBuffer(h))return h.length;if(ArrayBuffer.isView(h)||_t(h,ArrayBuffer))return h.byteLength;if(typeof h!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof h);let d=h.length,v=arguments.length>2&&arguments[2]===!0;if(!v&&d===0)return 0;let O=!1;for(;;)switch(u){case"ascii":case"latin1":case"binary":return d;case"utf8":case"utf-8":return ke(h).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d*2;case"hex":return d>>>1;case"base64":return At(h).length;default:if(O)return v?-1:ke(h).length;u=(""+u).toLowerCase(),O=!0}}o.byteLength=S;function B(h,u,d){let v=!1;if((u===void 0||u<0)&&(u=0),u>this.length||((d===void 0||d>this.length)&&(d=this.length),d<=0)||(d>>>=0,u>>>=0,d<=u))return"";for(h||(h="utf8");;)switch(h){case"hex":return ve(this,u,d);case"utf8":case"utf-8":return Qe(this,u,d);case"ascii":return pt(this,u,d);case"latin1":case"binary":return Me(this,u,d);case"base64":return We(this,u,d);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return we(this,u,d);default:if(v)throw new TypeError("Unknown encoding: "+h);h=(h+"").toLowerCase(),v=!0}}o.prototype._isBuffer=!0;function D(h,u,d){let v=h[u];h[u]=h[d],h[d]=v}o.prototype.swap16=function(){let u=this.length;if(u%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let d=0;d<u;d+=2)D(this,d,d+1);return this},o.prototype.swap32=function(){let u=this.length;if(u%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let d=0;d<u;d+=4)D(this,d,d+3),D(this,d+1,d+2);return this},o.prototype.swap64=function(){let u=this.length;if(u%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let d=0;d<u;d+=8)D(this,d,d+7),D(this,d+1,d+6),D(this,d+2,d+5),D(this,d+3,d+4);return this},o.prototype.toString=function(){let u=this.length;return u===0?"":arguments.length===0?Qe(this,0,u):B.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(u){if(!o.isBuffer(u))throw new TypeError("Argument must be a Buffer");return this===u?!0:o.compare(this,u)===0},o.prototype.inspect=function(){let u="",d=xn.INSPECT_MAX_BYTES;return u=this.toString("hex",0,d).replace(/(.{2})/g,"$1 ").trim(),this.length>d&&(u+=" ... "),"<Buffer "+u+">"},n&&(o.prototype[n]=o.prototype.inspect),o.prototype.compare=function(u,d,v,O,H){if(_t(u,Uint8Array)&&(u=o.from(u,u.offset,u.byteLength)),!o.isBuffer(u))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof u);if(d===void 0&&(d=0),v===void 0&&(v=u?u.length:0),O===void 0&&(O=0),H===void 0&&(H=this.length),d<0||v>u.length||O<0||H>this.length)throw new RangeError("out of range index");if(O>=H&&d>=v)return 0;if(O>=H)return-1;if(d>=v)return 1;if(d>>>=0,v>>>=0,O>>>=0,H>>>=0,this===u)return 0;let K=H-O,_e=v-d,Ke=Math.min(K,_e),He=this.slice(O,H),Fe=u.slice(d,v);for(let Re=0;Re<Ke;++Re)if(He[Re]!==Fe[Re]){K=He[Re],_e=Fe[Re];break}return K<_e?-1:_e<K?1:0};function $(h,u,d,v,O){if(h.length===0)return-1;if(typeof d=="string"?(v=d,d=0):d>2147483647?d=2147483647:d<-2147483648&&(d=-2147483648),d=+d,vr(d)&&(d=O?0:h.length-1),d<0&&(d=h.length+d),d>=h.length){if(O)return-1;d=h.length-1}else if(d<0)if(O)d=0;else return-1;if(typeof u=="string"&&(u=o.from(u,v)),o.isBuffer(u))return u.length===0?-1:te(h,u,d,v,O);if(typeof u=="number")return u=u&255,typeof Uint8Array.prototype.indexOf=="function"?O?Uint8Array.prototype.indexOf.call(h,u,d):Uint8Array.prototype.lastIndexOf.call(h,u,d):te(h,[u],d,v,O);throw new TypeError("val must be string, number or Buffer")}function te(h,u,d,v,O){let H=1,K=h.length,_e=u.length;if(v!==void 0&&(v=String(v).toLowerCase(),v==="ucs2"||v==="ucs-2"||v==="utf16le"||v==="utf-16le")){if(h.length<2||u.length<2)return-1;H=2,K/=2,_e/=2,d/=2}function Ke(Fe,Re){return H===1?Fe[Re]:Fe.readUInt16BE(Re*H)}let He;if(O){let Fe=-1;for(He=d;He<K;He++)if(Ke(h,He)===Ke(u,Fe===-1?0:He-Fe)){if(Fe===-1&&(Fe=He),He-Fe+1===_e)return Fe*H}else Fe!==-1&&(He-=He-Fe),Fe=-1}else for(d+_e>K&&(d=K-_e),He=d;He>=0;He--){let Fe=!0;for(let Re=0;Re<_e;Re++)if(Ke(h,He+Re)!==Ke(u,Re)){Fe=!1;break}if(Fe)return He}return-1}o.prototype.includes=function(u,d,v){return this.indexOf(u,d,v)!==-1},o.prototype.indexOf=function(u,d,v){return $(this,u,d,v,!0)},o.prototype.lastIndexOf=function(u,d,v){return $(this,u,d,v,!1)};function Q(h,u,d,v){d=Number(d)||0;let O=h.length-d;v?(v=Number(v),v>O&&(v=O)):v=O;let H=u.length;v>H/2&&(v=H/2);let K;for(K=0;K<v;++K){let _e=parseInt(u.substr(K*2,2),16);if(vr(_e))return K;h[d+K]=_e}return K}function ce(h,u,d,v){return jt(ke(u,h.length-d),h,d,v)}function Y(h,u,d,v){return jt(me(u),h,d,v)}function J(h,u,d,v){return jt(At(u),h,d,v)}function Be(h,u,d,v){return jt(U(u,h.length-d),h,d,v)}o.prototype.write=function(u,d,v,O){if(d===void 0)O="utf8",v=this.length,d=0;else if(v===void 0&&typeof d=="string")O=d,v=this.length,d=0;else if(isFinite(d))d=d>>>0,isFinite(v)?(v=v>>>0,O===void 0&&(O="utf8")):(O=v,v=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let H=this.length-d;if((v===void 0||v>H)&&(v=H),u.length>0&&(v<0||d<0)||d>this.length)throw new RangeError("Attempt to write outside buffer bounds");O||(O="utf8");let K=!1;for(;;)switch(O){case"hex":return Q(this,u,d,v);case"utf8":case"utf-8":return ce(this,u,d,v);case"ascii":case"latin1":case"binary":return Y(this,u,d,v);case"base64":return J(this,u,d,v);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Be(this,u,d,v);default:if(K)throw new TypeError("Unknown encoding: "+O);O=(""+O).toLowerCase(),K=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function We(h,u,d){return u===0&&d===h.length?t.fromByteArray(h):t.fromByteArray(h.slice(u,d))}function Qe(h,u,d){d=Math.min(h.length,d);let v=[],O=u;for(;O<d;){let H=h[O],K=null,_e=H>239?4:H>223?3:H>191?2:1;if(O+_e<=d){let Ke,He,Fe,Re;switch(_e){case 1:H<128&&(K=H);break;case 2:Ke=h[O+1],(Ke&192)===128&&(Re=(H&31)<<6|Ke&63,Re>127&&(K=Re));break;case 3:Ke=h[O+1],He=h[O+2],(Ke&192)===128&&(He&192)===128&&(Re=(H&15)<<12|(Ke&63)<<6|He&63,Re>2047&&(Re<55296||Re>57343)&&(K=Re));break;case 4:Ke=h[O+1],He=h[O+2],Fe=h[O+3],(Ke&192)===128&&(He&192)===128&&(Fe&192)===128&&(Re=(H&15)<<18|(Ke&63)<<12|(He&63)<<6|Fe&63,Re>65535&&Re<1114112&&(K=Re))}}K===null?(K=65533,_e=1):K>65535&&(K-=65536,v.push(K>>>10&1023|55296),K=56320|K&1023),v.push(K),O+=_e}return Ge(v)}let qe=4096;function Ge(h){let u=h.length;if(u<=qe)return String.fromCharCode.apply(String,h);let d="",v=0;for(;v<u;)d+=String.fromCharCode.apply(String,h.slice(v,v+=qe));return d}function pt(h,u,d){let v="";d=Math.min(h.length,d);for(let O=u;O<d;++O)v+=String.fromCharCode(h[O]&127);return v}function Me(h,u,d){let v="";d=Math.min(h.length,d);for(let O=u;O<d;++O)v+=String.fromCharCode(h[O]);return v}function ve(h,u,d){let v=h.length;(!u||u<0)&&(u=0),(!d||d<0||d>v)&&(d=v);let O="";for(let H=u;H<d;++H)O+=gi[h[H]];return O}function we(h,u,d){let v=h.slice(u,d),O="";for(let H=0;H<v.length-1;H+=2)O+=String.fromCharCode(v[H]+v[H+1]*256);return O}o.prototype.slice=function(u,d){let v=this.length;u=~~u,d=d===void 0?v:~~d,u<0?(u+=v,u<0&&(u=0)):u>v&&(u=v),d<0?(d+=v,d<0&&(d=0)):d>v&&(d=v),d<u&&(d=u);let O=this.subarray(u,d);return Object.setPrototypeOf(O,o.prototype),O};function se(h,u,d){if(h%1!==0||h<0)throw new RangeError("offset is not uint");if(h+u>d)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(u,d,v){u=u>>>0,d=d>>>0,v||se(u,d,this.length);let O=this[u],H=1,K=0;for(;++K<d&&(H*=256);)O+=this[u+K]*H;return O},o.prototype.readUintBE=o.prototype.readUIntBE=function(u,d,v){u=u>>>0,d=d>>>0,v||se(u,d,this.length);let O=this[u+--d],H=1;for(;d>0&&(H*=256);)O+=this[u+--d]*H;return O},o.prototype.readUint8=o.prototype.readUInt8=function(u,d){return u=u>>>0,d||se(u,1,this.length),this[u]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(u,d){return u=u>>>0,d||se(u,2,this.length),this[u]|this[u+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(u,d){return u=u>>>0,d||se(u,2,this.length),this[u]<<8|this[u+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(u,d){return u=u>>>0,d||se(u,4,this.length),(this[u]|this[u+1]<<8|this[u+2]<<16)+this[u+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(u,d){return u=u>>>0,d||se(u,4,this.length),this[u]*16777216+(this[u+1]<<16|this[u+2]<<8|this[u+3])},o.prototype.readBigUInt64LE=Pt(function(u){u=u>>>0,b(u,"offset");let d=this[u],v=this[u+7];(d===void 0||v===void 0)&&x(u,this.length-8);let O=d+this[++u]*2**8+this[++u]*2**16+this[++u]*2**24,H=this[++u]+this[++u]*2**8+this[++u]*2**16+v*2**24;return BigInt(O)+(BigInt(H)<<BigInt(32))}),o.prototype.readBigUInt64BE=Pt(function(u){u=u>>>0,b(u,"offset");let d=this[u],v=this[u+7];(d===void 0||v===void 0)&&x(u,this.length-8);let O=d*2**24+this[++u]*2**16+this[++u]*2**8+this[++u],H=this[++u]*2**24+this[++u]*2**16+this[++u]*2**8+v;return(BigInt(O)<<BigInt(32))+BigInt(H)}),o.prototype.readIntLE=function(u,d,v){u=u>>>0,d=d>>>0,v||se(u,d,this.length);let O=this[u],H=1,K=0;for(;++K<d&&(H*=256);)O+=this[u+K]*H;return H*=128,O>=H&&(O-=Math.pow(2,8*d)),O},o.prototype.readIntBE=function(u,d,v){u=u>>>0,d=d>>>0,v||se(u,d,this.length);let O=d,H=1,K=this[u+--O];for(;O>0&&(H*=256);)K+=this[u+--O]*H;return H*=128,K>=H&&(K-=Math.pow(2,8*d)),K},o.prototype.readInt8=function(u,d){return u=u>>>0,d||se(u,1,this.length),this[u]&128?(255-this[u]+1)*-1:this[u]},o.prototype.readInt16LE=function(u,d){u=u>>>0,d||se(u,2,this.length);let v=this[u]|this[u+1]<<8;return v&32768?v|4294901760:v},o.prototype.readInt16BE=function(u,d){u=u>>>0,d||se(u,2,this.length);let v=this[u+1]|this[u]<<8;return v&32768?v|4294901760:v},o.prototype.readInt32LE=function(u,d){return u=u>>>0,d||se(u,4,this.length),this[u]|this[u+1]<<8|this[u+2]<<16|this[u+3]<<24},o.prototype.readInt32BE=function(u,d){return u=u>>>0,d||se(u,4,this.length),this[u]<<24|this[u+1]<<16|this[u+2]<<8|this[u+3]},o.prototype.readBigInt64LE=Pt(function(u){u=u>>>0,b(u,"offset");let d=this[u],v=this[u+7];(d===void 0||v===void 0)&&x(u,this.length-8);let O=this[u+4]+this[u+5]*2**8+this[u+6]*2**16+(v<<24);return(BigInt(O)<<BigInt(32))+BigInt(d+this[++u]*2**8+this[++u]*2**16+this[++u]*2**24)}),o.prototype.readBigInt64BE=Pt(function(u){u=u>>>0,b(u,"offset");let d=this[u],v=this[u+7];(d===void 0||v===void 0)&&x(u,this.length-8);let O=(d<<24)+this[++u]*2**16+this[++u]*2**8+this[++u];return(BigInt(O)<<BigInt(32))+BigInt(this[++u]*2**24+this[++u]*2**16+this[++u]*2**8+v)}),o.prototype.readFloatLE=function(u,d){return u=u>>>0,d||se(u,4,this.length),e.read(this,u,!0,23,4)},o.prototype.readFloatBE=function(u,d){return u=u>>>0,d||se(u,4,this.length),e.read(this,u,!1,23,4)},o.prototype.readDoubleLE=function(u,d){return u=u>>>0,d||se(u,8,this.length),e.read(this,u,!0,52,8)},o.prototype.readDoubleBE=function(u,d){return u=u>>>0,d||se(u,8,this.length),e.read(this,u,!1,52,8)};function de(h,u,d,v,O,H){if(!o.isBuffer(h))throw new TypeError('"buffer" argument must be a Buffer instance');if(u>O||u<H)throw new RangeError('"value" argument is out of bounds');if(d+v>h.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(u,d,v,O){if(u=+u,d=d>>>0,v=v>>>0,!O){let _e=Math.pow(2,8*v)-1;de(this,u,d,v,_e,0)}let H=1,K=0;for(this[d]=u&255;++K<v&&(H*=256);)this[d+K]=u/H&255;return d+v},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(u,d,v,O){if(u=+u,d=d>>>0,v=v>>>0,!O){let _e=Math.pow(2,8*v)-1;de(this,u,d,v,_e,0)}let H=v-1,K=1;for(this[d+H]=u&255;--H>=0&&(K*=256);)this[d+H]=u/K&255;return d+v},o.prototype.writeUint8=o.prototype.writeUInt8=function(u,d,v){return u=+u,d=d>>>0,v||de(this,u,d,1,255,0),this[d]=u&255,d+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(u,d,v){return u=+u,d=d>>>0,v||de(this,u,d,2,65535,0),this[d]=u&255,this[d+1]=u>>>8,d+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(u,d,v){return u=+u,d=d>>>0,v||de(this,u,d,2,65535,0),this[d]=u>>>8,this[d+1]=u&255,d+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(u,d,v){return u=+u,d=d>>>0,v||de(this,u,d,4,4294967295,0),this[d+3]=u>>>24,this[d+2]=u>>>16,this[d+1]=u>>>8,this[d]=u&255,d+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(u,d,v){return u=+u,d=d>>>0,v||de(this,u,d,4,4294967295,0),this[d]=u>>>24,this[d+1]=u>>>16,this[d+2]=u>>>8,this[d+3]=u&255,d+4};function N(h,u,d,v,O){ne(u,v,O,h,d,7);let H=Number(u&BigInt(4294967295));h[d++]=H,H=H>>8,h[d++]=H,H=H>>8,h[d++]=H,H=H>>8,h[d++]=H;let K=Number(u>>BigInt(32)&BigInt(4294967295));return h[d++]=K,K=K>>8,h[d++]=K,K=K>>8,h[d++]=K,K=K>>8,h[d++]=K,d}function Z(h,u,d,v,O){ne(u,v,O,h,d,7);let H=Number(u&BigInt(4294967295));h[d+7]=H,H=H>>8,h[d+6]=H,H=H>>8,h[d+5]=H,H=H>>8,h[d+4]=H;let K=Number(u>>BigInt(32)&BigInt(4294967295));return h[d+3]=K,K=K>>8,h[d+2]=K,K=K>>8,h[d+1]=K,K=K>>8,h[d]=K,d+8}o.prototype.writeBigUInt64LE=Pt(function(u,d=0){return N(this,u,d,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=Pt(function(u,d=0){return Z(this,u,d,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(u,d,v,O){if(u=+u,d=d>>>0,!O){let Ke=Math.pow(2,8*v-1);de(this,u,d,v,Ke-1,-Ke)}let H=0,K=1,_e=0;for(this[d]=u&255;++H<v&&(K*=256);)u<0&&_e===0&&this[d+H-1]!==0&&(_e=1),this[d+H]=(u/K>>0)-_e&255;return d+v},o.prototype.writeIntBE=function(u,d,v,O){if(u=+u,d=d>>>0,!O){let Ke=Math.pow(2,8*v-1);de(this,u,d,v,Ke-1,-Ke)}let H=v-1,K=1,_e=0;for(this[d+H]=u&255;--H>=0&&(K*=256);)u<0&&_e===0&&this[d+H+1]!==0&&(_e=1),this[d+H]=(u/K>>0)-_e&255;return d+v},o.prototype.writeInt8=function(u,d,v){return u=+u,d=d>>>0,v||de(this,u,d,1,127,-128),u<0&&(u=255+u+1),this[d]=u&255,d+1},o.prototype.writeInt16LE=function(u,d,v){return u=+u,d=d>>>0,v||de(this,u,d,2,32767,-32768),this[d]=u&255,this[d+1]=u>>>8,d+2},o.prototype.writeInt16BE=function(u,d,v){return u=+u,d=d>>>0,v||de(this,u,d,2,32767,-32768),this[d]=u>>>8,this[d+1]=u&255,d+2},o.prototype.writeInt32LE=function(u,d,v){return u=+u,d=d>>>0,v||de(this,u,d,4,2147483647,-2147483648),this[d]=u&255,this[d+1]=u>>>8,this[d+2]=u>>>16,this[d+3]=u>>>24,d+4},o.prototype.writeInt32BE=function(u,d,v){return u=+u,d=d>>>0,v||de(this,u,d,4,2147483647,-2147483648),u<0&&(u=4294967295+u+1),this[d]=u>>>24,this[d+1]=u>>>16,this[d+2]=u>>>8,this[d+3]=u&255,d+4},o.prototype.writeBigInt64LE=Pt(function(u,d=0){return N(this,u,d,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=Pt(function(u,d=0){return Z(this,u,d,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function W(h,u,d,v,O,H){if(d+v>h.length)throw new RangeError("Index out of range");if(d<0)throw new RangeError("Index out of range")}function le(h,u,d,v,O){return u=+u,d=d>>>0,O||W(h,u,d,4),e.write(h,u,d,v,23,4),d+4}o.prototype.writeFloatLE=function(u,d,v){return le(this,u,d,!0,v)},o.prototype.writeFloatBE=function(u,d,v){return le(this,u,d,!1,v)};function ge(h,u,d,v,O){return u=+u,d=d>>>0,O||W(h,u,d,8),e.write(h,u,d,v,52,8),d+8}o.prototype.writeDoubleLE=function(u,d,v){return ge(this,u,d,!0,v)},o.prototype.writeDoubleBE=function(u,d,v){return ge(this,u,d,!1,v)},o.prototype.copy=function(u,d,v,O){if(!o.isBuffer(u))throw new TypeError("argument should be a Buffer");if(v||(v=0),!O&&O!==0&&(O=this.length),d>=u.length&&(d=u.length),d||(d=0),O>0&&O<v&&(O=v),O===v||u.length===0||this.length===0)return 0;if(d<0)throw new RangeError("targetStart out of bounds");if(v<0||v>=this.length)throw new RangeError("Index out of range");if(O<0)throw new RangeError("sourceEnd out of bounds");O>this.length&&(O=this.length),u.length-d<O-v&&(O=u.length-d+v);let H=O-v;return this===u&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(d,v,O):Uint8Array.prototype.set.call(u,this.subarray(v,O),d),H},o.prototype.fill=function(u,d,v,O){if(typeof u=="string"){if(typeof d=="string"?(O=d,d=0,v=this.length):typeof v=="string"&&(O=v,v=this.length),O!==void 0&&typeof O!="string")throw new TypeError("encoding must be a string");if(typeof O=="string"&&!o.isEncoding(O))throw new TypeError("Unknown encoding: "+O);if(u.length===1){let K=u.charCodeAt(0);(O==="utf8"&&K<128||O==="latin1")&&(u=K)}}else typeof u=="number"?u=u&255:typeof u=="boolean"&&(u=Number(u));if(d<0||this.length<d||this.length<v)throw new RangeError("Out of range index");if(v<=d)return this;d=d>>>0,v=v===void 0?this.length:v>>>0,u||(u=0);let H;if(typeof u=="number")for(H=d;H<v;++H)this[H]=u;else{let K=o.isBuffer(u)?u:o.from(u,O),_e=K.length;if(_e===0)throw new TypeError('The value "'+u+'" is invalid for argument "value"');for(H=0;H<v-d;++H)this[H+d]=K[H%_e]}return this};let R={};function C(h,u,d){R[h]=class extends d{constructor(){super(),Object.defineProperty(this,"message",{value:u.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${h}]`,this.stack,delete this.name}get code(){return h}set code(O){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:O,writable:!0})}toString(){return`${this.name} [${h}]: ${this.message}`}}}C("ERR_BUFFER_OUT_OF_BOUNDS",function(h){return h?`${h} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),C("ERR_INVALID_ARG_TYPE",function(h,u){return`The "${h}" argument must be of type number. Received type ${typeof u}`},TypeError),C("ERR_OUT_OF_RANGE",function(h,u,d){let v=`The value of "${h}" is out of range.`,O=d;return Number.isInteger(d)&&Math.abs(d)>2**32?O=j(String(d)):typeof d=="bigint"&&(O=String(d),(d>BigInt(2)**BigInt(32)||d<-(BigInt(2)**BigInt(32)))&&(O=j(O)),O+="n"),v+=` It must be ${u}. Received ${O}`,v},RangeError);function j(h){let u="",d=h.length,v=h[0]==="-"?1:0;for(;d>=v+4;d-=3)u=`_${h.slice(d-3,d)}${u}`;return`${h.slice(0,d)}${u}`}function V(h,u,d){b(u,"offset"),(h[u]===void 0||h[u+d]===void 0)&&x(u,h.length-(d+1))}function ne(h,u,d,v,O,H){if(h>d||h<u){let K=typeof u=="bigint"?"n":"",_e;throw u===0||u===BigInt(0)?_e=`>= 0${K} and < 2${K} ** ${(H+1)*8}${K}`:_e=`>= -(2${K} ** ${(H+1)*8-1}${K}) and < 2 ** ${(H+1)*8-1}${K}`,new R.ERR_OUT_OF_RANGE("value",_e,h)}V(v,O,H)}function b(h,u){if(typeof h!="number")throw new R.ERR_INVALID_ARG_TYPE(u,"number",h)}function x(h,u,d){throw Math.floor(h)!==h?(b(h,d),new R.ERR_OUT_OF_RANGE("offset","an integer",h)):u<0?new R.ERR_BUFFER_OUT_OF_BOUNDS:new R.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${u}`,h)}let F=/[^+/0-9A-Za-z-_]/g;function X(h){if(h=h.split("=")[0],h=h.trim().replace(F,""),h.length<2)return"";for(;h.length%4!==0;)h=h+"=";return h}function ke(h,u){u=u||1/0;let d,v=h.length,O=null,H=[];for(let K=0;K<v;++K){if(d=h.charCodeAt(K),d>55295&&d<57344){if(!O){if(d>56319){(u-=3)>-1&&H.push(239,191,189);continue}else if(K+1===v){(u-=3)>-1&&H.push(239,191,189);continue}O=d;continue}if(d<56320){(u-=3)>-1&&H.push(239,191,189),O=d;continue}d=(O-55296<<10|d-56320)+65536}else O&&(u-=3)>-1&&H.push(239,191,189);if(O=null,d<128){if((u-=1)<0)break;H.push(d)}else if(d<2048){if((u-=2)<0)break;H.push(d>>6|192,d&63|128)}else if(d<65536){if((u-=3)<0)break;H.push(d>>12|224,d>>6&63|128,d&63|128)}else if(d<1114112){if((u-=4)<0)break;H.push(d>>18|240,d>>12&63|128,d>>6&63|128,d&63|128)}else throw new Error("Invalid code point")}return H}function me(h){let u=[];for(let d=0;d<h.length;++d)u.push(h.charCodeAt(d)&255);return u}function U(h,u){let d,v,O,H=[];for(let K=0;K<h.length&&!((u-=2)<0);++K)d=h.charCodeAt(K),v=d>>8,O=d%256,H.push(O),H.push(v);return H}function At(h){return t.toByteArray(X(h))}function jt(h,u,d,v){let O;for(O=0;O<v&&!(O+d>=u.length||O>=h.length);++O)u[O+d]=h[O];return O}function _t(h,u){return h instanceof u||h!=null&&h.constructor!=null&&h.constructor.name!=null&&h.constructor.name===u.name}function vr(h){return h!==h}let gi=(function(){let h="0123456789abcdef",u=new Array(256);for(let d=0;d<16;++d){let v=d*16;for(let O=0;O<16;++O)u[v+O]=h[d]+h[O]}return u})();function Pt(h){return typeof BigInt>"u"?_r:h}function _r(){throw new Error("BigInt not supported")}return xn}var br,oc,Ti,sc,xn,ac,vi=ot(()=>{E();A();k();br={},oc=!1;Ti={},sc=!1;xn={},ac=!1});var Pn,z,PA,IA,lc=ot(()=>{E();A();k();vi();Pn=$t();Pn.Buffer;Pn.SlowBuffer;Pn.INSPECT_MAX_BYTES;Pn.kMaxLength;z=Pn.Buffer,PA=Pn.INSPECT_MAX_BYTES,IA=Pn.kMaxLength});var A=ot(()=>{lc()});function Wt(){return zm||(zm=!0,typeof Object.create=="function"?no=function(e,n){n&&(e.super_=n,e.prototype=Object.create(n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:no=function(e,n){if(n){e.super_=n;var r=function(){};r.prototype=n.prototype,e.prototype=new r,e.prototype.constructor=e}}),no}var no,zm,Vs=ot(()=>{E();A();k();no={},zm=!1});function Ce(){Ce.init.call(this)}function ro(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function ny(t){return t._maxListeners===void 0?Ce.defaultMaxListeners:t._maxListeners}function Jm(t,e,n,r){var i,s,o,a;if(ro(n),(s=t._events)===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,n.listener?n.listener:n),s=t._events),o=s[e]),o===void 0)o=s[e]=n,++t._eventsCount;else if(typeof o=="function"?o=s[e]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),(i=ny(t))>0&&o.length>i&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=o.length,a=l,console&&console.warn&&console.warn(a)}return t}function zI(){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 Ym(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=zI.bind(r);return i.listener=n,r.wrapFn=i,i}function Xm(t,e,n){var r=t._events;if(r===void 0)return[];var i=r[e];return i===void 0?[]:typeof i=="function"?n?[i.listener||i]:[i]:n?(function(s){for(var o=new Array(s.length),a=0;a<o.length;++a)o[a]=s[a].listener||s[a];return o})(i):ry(i,i.length)}function Qm(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 ry(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}var ey,ty,lr,qm,Gm,Vm,yt,Js=ot(()=>{E();A();k();lr=typeof Reflect=="object"?Reflect:null,qm=lr&&typeof lr.apply=="function"?lr.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};ty=lr&&typeof lr.ownKeys=="function"?lr.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};Gm=Number.isNaN||function(t){return t!=t};ey=Ce,Ce.EventEmitter=Ce,Ce.prototype._events=void 0,Ce.prototype._eventsCount=0,Ce.prototype._maxListeners=void 0;Vm=10;Object.defineProperty(Ce,"defaultMaxListeners",{enumerable:!0,get:function(){return Vm},set:function(t){if(typeof t!="number"||t<0||Gm(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Vm=t}}),Ce.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},Ce.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||Gm(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},Ce.prototype.getMaxListeners=function(){return ny(this)},Ce.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var r=t==="error",i=this._events;if(i!==void 0)r=r&&i.error===void 0;else if(!r)return!1;if(r){var s;if(e.length>0&&(s=e[0]),s instanceof Error)throw s;var o=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw o.context=s,o}var a=i[t];if(a===void 0)return!1;if(typeof a=="function")qm(a,this,e);else{var l=a.length,c=ry(a,l);for(n=0;n<l;++n)qm(c[n],this,e)}return!0},Ce.prototype.addListener=function(t,e){return Jm(this,t,e,!1)},Ce.prototype.on=Ce.prototype.addListener,Ce.prototype.prependListener=function(t,e){return Jm(this,t,e,!0)},Ce.prototype.once=function(t,e){return ro(e),this.on(t,Ym(this,t,e)),this},Ce.prototype.prependOnceListener=function(t,e){return ro(e),this.prependListener(t,Ym(this,t,e)),this},Ce.prototype.removeListener=function(t,e){var n,r,i,s,o;if(ro(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(i=-1,s=n.length-1;s>=0;s--)if(n[s]===e||n[s].listener===e){o=n[s].listener,i=s;break}if(i<0)return this;i===0?n.shift():(function(a,l){for(;l+1<a.length;l++)a[l]=a[l+1];a.pop()})(n,i),n.length===1&&(r[t]=n[0]),r.removeListener!==void 0&&this.emit("removeListener",t,o||e)}return this},Ce.prototype.off=Ce.prototype.removeListener,Ce.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 i,s=Object.keys(n);for(r=0;r<s.length;++r)(i=s[r])!=="removeListener"&&this.removeAllListeners(i);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},Ce.prototype.listeners=function(t){return Xm(this,t,!0)},Ce.prototype.rawListeners=function(t){return Xm(this,t,!1)},Ce.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Qm.call(t,e)},Ce.prototype.listenerCount=Qm,Ce.prototype.eventNames=function(){return this._eventsCount>0?ty(this._events):[]};yt=ey;yt.EventEmitter;yt.defaultMaxListeners;yt.init;yt.listenerCount;yt.EventEmitter;yt.defaultMaxListeners;yt.init;yt.listenerCount});var iy=ot(()=>{E();A();k();Js();yt.once=function(t,e){return new Promise((n,r)=>{function i(...o){s!==void 0&&t.removeListener("error",s),n(o)}let s;e!=="error"&&(s=o=>{t.removeListener(name,i),r(o)},t.once("error",s)),t.once(e,i)})};yt.on=function(t,e){let n=[],r=[],i=null,s=!1,o={async next(){let c=n.shift();if(c)return createIterResult(c,!1);if(i){let f=Promise.reject(i);return i=null,f}return s?createIterResult(void 0,!0):new Promise((f,p)=>r.push({resolve:f,reject:p}))},async return(){t.removeListener(e,a),t.removeListener("error",l),s=!0;for(let c of r)c.resolve(createIterResult(void 0,!0));return createIterResult(void 0,!0)},throw(c){i=c,t.removeListener(e,a),t.removeListener("error",l)},[Symbol.asyncIterator](){return this}};return t.on(e,a),t.on("error",l),o;function a(...c){let f=r.shift();f?f.resolve(createIterResult(c,!1)):n.push(c)}function l(c){s=!0;let f=r.shift();f?f.reject(c):i=c,o.return()}}});function ta(){throw new Error("setTimeout has not been defined")}function na(){throw new Error("clearTimeout has not been defined")}function Ty(t){if(on===setTimeout)return setTimeout(t,0);if((on===ta||!on)&&setTimeout)return on=setTimeout,setTimeout(t,0);try{return on(t,0)}catch{try{return on.call(null,t,0)}catch{return on.call(this||cr,t,0)}}}function qI(){ur&&zn&&(ur=!1,zn.length?an=zn.concat(an):uo=-1,an.length&&vy())}function vy(){if(!ur){var t=Ty(qI);ur=!0;for(var e=an.length;e;){for(zn=an,an=[];++uo<e;)zn&&zn[uo].run();uo=-1,e=an.length}zn=null,ur=!1,(function(n){if(sn===clearTimeout)return clearTimeout(n);if((sn===na||!sn)&&clearTimeout)return sn=clearTimeout,clearTimeout(n);try{sn(n)}catch{try{return sn.call(null,n)}catch{return sn.call(this||cr,n)}}})(t)}}function oy(t,e){(this||cr).fun=t,(this||cr).array=e}function rn(){}function Gn(t){return t.call.bind(t)}function ni(t,e){if(typeof t!="object")return!1;try{return e(t),!0}catch{return!1}}function ay(t){return ht&&wt?It(t)!==void 0:Iy(t)||By(t)||Sy(t)||Ey(t)||ky(t)||Ay(t)||Cy(t)||Oy(t)||Ry(t)||My(t)||Ny(t)}function Iy(t){return ht&&wt?It(t)==="Uint8Array":Le(t)==="[object Uint8Array]"||rB(t)&&t.buffer!==void 0}function By(t){return ht&&wt?It(t)==="Uint8ClampedArray":Le(t)==="[object Uint8ClampedArray]"}function Sy(t){return ht&&wt?It(t)==="Uint16Array":Le(t)==="[object Uint16Array]"}function Ey(t){return ht&&wt?It(t)==="Uint32Array":Le(t)==="[object Uint32Array]"}function ky(t){return ht&&wt?It(t)==="Int8Array":Le(t)==="[object Int8Array]"}function Ay(t){return ht&&wt?It(t)==="Int16Array":Le(t)==="[object Int16Array]"}function Cy(t){return ht&&wt?It(t)==="Int32Array":Le(t)==="[object Int32Array]"}function Oy(t){return ht&&wt?It(t)==="Float32Array":Le(t)==="[object Float32Array]"}function Ry(t){return ht&&wt?It(t)==="Float64Array":Le(t)==="[object Float64Array]"}function My(t){return ht&&wt?It(t)==="BigInt64Array":Le(t)==="[object BigInt64Array]"}function Ny(t){return ht&&wt?It(t)==="BigUint64Array":Le(t)==="[object BigUint64Array]"}function io(t){return Le(t)==="[object Map]"}function oo(t){return Le(t)==="[object Set]"}function so(t){return Le(t)==="[object WeakMap]"}function Ys(t){return Le(t)==="[object WeakSet]"}function fo(t){return Le(t)==="[object ArrayBuffer]"}function ly(t){return typeof ArrayBuffer<"u"&&(fo.working?fo(t):t instanceof ArrayBuffer)}function po(t){return Le(t)==="[object DataView]"}function uy(t){return typeof DataView<"u"&&(po.working?po(t):t instanceof DataView)}function go(t){return Le(t)==="[object SharedArrayBuffer]"}function cy(t){return typeof SharedArrayBuffer<"u"&&(go.working?go(t):t instanceof SharedArrayBuffer)}function dy(t){return ni(t,lB)}function fy(t){return ni(t,uB)}function py(t){return ni(t,cB)}function gy(t){return Py&&ni(t,dB)}function my(t){return ia&&ni(t,fB)}function Tn(t,e){var n={seen:[],stylize:mB};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),oa(e)?n.showHidden=e:e&&L._extend(n,e),qn(n.showHidden)&&(n.showHidden=!1),qn(n.depth)&&(n.depth=2),qn(n.colors)&&(n.colors=!1),qn(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=gB),mo(n,t,n.depth)}function gB(t,e){var n=Tn.styles[e];return n?"\x1B["+Tn.colors[n][0]+"m"+t+"\x1B["+Tn.colors[n][1]+"m":t}function mB(t,e){return t}function mo(t,e,n){if(t.customInspect&&e&&co(e.inspect)&&e.inspect!==L.inspect&&(!e.constructor||e.constructor.prototype!==e)){var r=e.inspect(n,t);return yo(r)||(r=mo(t,r,n)),r}var i=(function(g,y){if(qn(y))return g.stylize("undefined","undefined");if(yo(y)){var T="'"+JSON.stringify(y).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return g.stylize(T,"string")}if(Uy(y))return g.stylize(""+y,"number");if(oa(y))return g.stylize(""+y,"boolean");if(vo(y))return g.stylize("null","null")})(t,e);if(i)return i;var s=Object.keys(e),o=(function(g){var y={};return g.forEach((function(T,P){y[T]=!0})),y})(s);if(t.showHidden&&(s=Object.getOwnPropertyNames(e)),ti(e)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return Xs(e);if(s.length===0){if(co(e)){var a=e.name?": "+e.name:"";return t.stylize("[Function"+a+"]","special")}if(ei(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(ho(e))return t.stylize(Date.prototype.toString.call(e),"date");if(ti(e))return Xs(e)}var l,c="",f=!1,p=["{","}"];return Hy(e)&&(f=!0,p=["[","]"]),co(e)&&(c=" [Function"+(e.name?": "+e.name:"")+"]"),ei(e)&&(c=" "+RegExp.prototype.toString.call(e)),ho(e)&&(c=" "+Date.prototype.toUTCString.call(e)),ti(e)&&(c=" "+Xs(e)),s.length!==0||f&&e.length!=0?n<0?ei(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),l=f?(function(g,y,T,P,I){for(var _=[],S=0,B=y.length;S<B;++S)jy(y,String(S))?_.push(Qs(g,y,T,P,String(S),!0)):_.push("");return I.forEach((function(D){D.match(/^\d+$/)||_.push(Qs(g,y,T,P,D,!0))})),_})(t,e,n,o,s):s.map((function(g){return Qs(t,e,n,o,g,f)})),t.seen.pop(),(function(g,y,T){var P=0;return g.reduce((function(I,_){return P++,_.indexOf(`
|
|
1
|
+
var Do=Object.defineProperty;var YT=Object.getOwnPropertyDescriptor;var XT=Object.getOwnPropertyNames;var QT=Object.prototype.hasOwnProperty;var ot=(t,e)=>()=>(t&&(e=t(t=0)),e);var pn=(t,e)=>{for(var n in e)Do(t,n,{get:e[n],enumerable:!0})},ev=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of XT(e))!QT.call(t,i)&&i!==n&&Do(t,i,{get:()=>e[i],enumerable:!(r=YT(e,i))||r.enumerable});return t};var tv=t=>ev(Do({},"__esModule",{value:!0}),t);var S=ot(()=>{});var G={};pn(G,{_debugEnd:()=>Ou,_debugProcess:()=>Cu,_events:()=>Gu,_eventsCount:()=>Vu,_exiting:()=>fu,_fatalExceptions:()=>Eu,_getActiveHandles:()=>yu,_getActiveRequests:()=>mu,_kill:()=>Tu,_linkedBinding:()=>cu,_maxListeners:()=>qu,_preload_modules:()=>Ku,_rawDebug:()=>lu,_startProfilerIdleNotifier:()=>Ru,_stopProfilerIdleNotifier:()=>Mu,_tickCallback:()=>Au,abort:()=>Uu,addListener:()=>Ju,allowedNodeEnvironmentFlags:()=>Pu,arch:()=>Gl,argv:()=>Yl,argv0:()=>Wu,assert:()=>Iu,binding:()=>nu,browser:()=>au,chdir:()=>ou,config:()=>pu,cpuUsage:()=>hi,cwd:()=>iu,debugPort:()=>Lu,default:()=>oc,dlopen:()=>gu,domain:()=>du,emit:()=>tc,emitWarning:()=>tu,env:()=>Jl,execArgv:()=>Xl,execPath:()=>Zu,exit:()=>wu,features:()=>Bu,hasUncaughtExceptionCaptureCallback:()=>ku,hrtime:()=>yi,kill:()=>bu,listeners:()=>ic,memoryUsage:()=>_u,moduleLoadList:()=>uu,nextTick:()=>Fl,off:()=>Xu,on:()=>Vt,once:()=>Yu,openStdin:()=>xu,pid:()=>ju,platform:()=>Vl,ppid:()=>$u,prependListener:()=>nc,prependOnceListener:()=>rc,reallyExit:()=>hu,release:()=>su,removeAllListeners:()=>ec,removeListener:()=>Qu,resourceUsage:()=>vu,setSourceMapsEnabled:()=>Fu,setUncaughtExceptionCaptureCallback:()=>Su,stderr:()=>Du,stdin:()=>Hu,stdout:()=>Nu,title:()=>ql,umask:()=>ru,uptime:()=>zu,version:()=>Ql,versions:()=>eu});function jo(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function nv(){!er||!wn||(er=!1,wn.length?Gt=wn.concat(Gt):mi=-1,Gt.length&&Kl())}function Kl(){if(!er){var t=setTimeout(nv,0);er=!0;for(var e=Gt.length;e;){for(wn=Gt,Gt=[];++mi<e;)wn&&wn[mi].run();mi=-1,e=Gt.length}wn=null,er=!1,clearTimeout(t)}}function Fl(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];Gt.push(new zl(t,e)),Gt.length===1&&!er&&setTimeout(Kl,0)}function zl(t,e){this.fun=t,this.array=e}function st(){}function cu(t){jo("_linkedBinding")}function gu(t){jo("dlopen")}function mu(){return[]}function yu(){return[]}function Iu(t,e){if(!t)throw new Error(e||"assertion error")}function ku(){return!1}function zu(){return gn.now()/1e3}function yi(t){var e=Math.floor((Date.now()-gn.now())*.001),n=gn.now()*.001,r=Math.floor(n)+e,i=Math.floor(n%1*1e9);return t&&(r=r-t[0],i=i-t[1],i<0&&(r--,i+=Uo)),[r,i]}function Vt(){return oc}function ic(t){return[]}var Gt,er,wn,mi,ql,Gl,Vl,Jl,Yl,Xl,Ql,eu,tu,nu,ru,iu,ou,su,au,lu,uu,du,fu,pu,hu,Tu,hi,vu,_u,bu,wu,xu,Pu,Bu,Eu,Su,Au,Cu,Ou,Ru,Mu,Nu,Du,Hu,Uu,ju,$u,Zu,Lu,Wu,Ku,Fu,gn,Ho,Uo,qu,Gu,Vu,Ju,Yu,Xu,Qu,ec,tc,nc,rc,oc,sc=ot(()=>{S();A();k();Gt=[],er=!1,mi=-1;zl.prototype.run=function(){this.fun.apply(null,this.array)};ql="browser",Gl="x64",Vl="browser",Jl={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},Yl=["/usr/bin/node"],Xl=[],Ql="v16.8.0",eu={},tu=function(t,e){console.warn((e?e+": ":"")+t)},nu=function(t){jo("binding")},ru=function(t){return 0},iu=function(){return"/"},ou=function(t){},su={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};au=!0,lu=st,uu=[];du={},fu=!1,pu={};hu=st,Tu=st,hi=function(){return{}},vu=hi,_u=hi,bu=st,wu=st,xu=st,Pu={};Bu={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Eu=st,Su=st;Au=st,Cu=st,Ou=st,Ru=st,Mu=st,Nu=void 0,Du=void 0,Hu=void 0,Uu=st,ju=2,$u=1,Zu="/bin/usr/node",Lu=9229,Wu="node",Ku=[],Fu=st,gn={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};gn.now===void 0&&(Ho=Date.now(),gn.timing&&gn.timing.navigationStart&&(Ho=gn.timing.navigationStart),gn.now=()=>Date.now()-Ho);Uo=1e9;yi.bigint=function(t){var e=yi(t);return typeof BigInt>"u"?e[0]*Uo+e[1]:BigInt(e[0]*Uo)+BigInt(e[1])};qu=10,Gu={},Vu=0;Ju=Vt,Yu=Vt,Xu=Vt,Qu=Vt,ec=Vt,tc=st,nc=Vt,rc=Vt;oc={version:Ql,versions:eu,arch:Gl,platform:Vl,browser:au,release:su,_rawDebug:lu,moduleLoadList:uu,binding:nu,_linkedBinding:cu,_events:Gu,_eventsCount:Vu,_maxListeners:qu,on:Vt,addListener:Ju,once:Yu,off:Xu,removeListener:Qu,removeAllListeners:ec,emit:tc,prependListener:nc,prependOnceListener:rc,listeners:ic,domain:du,_exiting:fu,config:pu,dlopen:gu,uptime:zu,_getActiveRequests:mu,_getActiveHandles:yu,reallyExit:hu,_kill:Tu,cpuUsage:hi,resourceUsage:vu,memoryUsage:_u,kill:bu,exit:wu,openStdin:xu,allowedNodeEnvironmentFlags:Pu,assert:Iu,features:Bu,_fatalExceptions:Eu,setUncaughtExceptionCaptureCallback:Su,hasUncaughtExceptionCaptureCallback:ku,emitWarning:tu,nextTick:Fl,_tickCallback:Au,_debugProcess:Cu,_debugEnd:Ou,_startProfilerIdleNotifier:Ru,_stopProfilerIdleNotifier:Mu,stdout:Nu,stdin:Hu,stderr:Du,abort:Uu,umask:ru,chdir:ou,cwd:iu,env:Jl,title:ql,argv:Yl,execArgv:Xl,pid:ju,ppid:$u,execPath:Zu,debugPort:Lu,hrtime:yi,argv0:Wu,_preload_modules:Ku,setSourceMapsEnabled:Fu}});var k=ot(()=>{sc()});function rv(){if(ac)return br;ac=!0,br.byteLength=a,br.toByteArray=c,br.fromByteArray=g;for(var t=[],e=[],n=typeof Uint8Array<"u"?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,s=r.length;i<s;++i)t[i]=r[i],e[r.charCodeAt(i)]=i;e[45]=62,e[95]=63;function o(y){var T=y.length;if(T%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var P=y.indexOf("=");P===-1&&(P=T);var I=P===T?0:4-P%4;return[P,I]}function a(y){var T=o(y),P=T[0],I=T[1];return(P+I)*3/4-I}function l(y,T,P){return(T+P)*3/4-P}function c(y){var T,P=o(y),I=P[0],_=P[1],E=new n(l(y,I,_)),B=0,D=_>0?I-4:I,$;for($=0;$<D;$+=4)T=e[y.charCodeAt($)]<<18|e[y.charCodeAt($+1)]<<12|e[y.charCodeAt($+2)]<<6|e[y.charCodeAt($+3)],E[B++]=T>>16&255,E[B++]=T>>8&255,E[B++]=T&255;return _===2&&(T=e[y.charCodeAt($)]<<2|e[y.charCodeAt($+1)]>>4,E[B++]=T&255),_===1&&(T=e[y.charCodeAt($)]<<10|e[y.charCodeAt($+1)]<<4|e[y.charCodeAt($+2)]>>2,E[B++]=T>>8&255,E[B++]=T&255),E}function f(y){return t[y>>18&63]+t[y>>12&63]+t[y>>6&63]+t[y&63]}function p(y,T,P){for(var I,_=[],E=T;E<P;E+=3)I=(y[E]<<16&16711680)+(y[E+1]<<8&65280)+(y[E+2]&255),_.push(f(I));return _.join("")}function g(y){for(var T,P=y.length,I=P%3,_=[],E=16383,B=0,D=P-I;B<D;B+=E)_.push(p(y,B,B+E>D?D:B+E));return I===1?(T=y[P-1],_.push(t[T>>2]+t[T<<4&63]+"==")):I===2&&(T=(y[P-2]<<8)+y[P-1],_.push(t[T>>10]+t[T>>4&63]+t[T<<2&63]+"=")),_.join("")}return br}function iv(){if(lc)return Ti;lc=!0;return Ti.read=function(t,e,n,r,i){var s,o,a=i*8-r-1,l=(1<<a)-1,c=l>>1,f=-7,p=n?i-1:0,g=n?-1:1,y=t[e+p];for(p+=g,s=y&(1<<-f)-1,y>>=-f,f+=a;f>0;s=s*256+t[e+p],p+=g,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=r;f>0;o=o*256+t[e+p],p+=g,f-=8);if(s===0)s=1-c;else{if(s===l)return o?NaN:(y?-1:1)*(1/0);o=o+Math.pow(2,r),s=s-c}return(y?-1:1)*o*Math.pow(2,s-r)},Ti.write=function(t,e,n,r,i,s){var o,a,l,c=s*8-i-1,f=(1<<c)-1,p=f>>1,g=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=r?0:s-1,T=r?1:-1,P=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+p>=1?e+=g/l:e+=g*Math.pow(2,1-p),e*l>=2&&(o++,l/=2),o+p>=f?(a=0,o=f):o+p>=1?(a=(e*l-1)*Math.pow(2,i),o=o+p):(a=e*Math.pow(2,p-1)*Math.pow(2,i),o=0));i>=8;t[n+y]=a&255,y+=T,a/=256,i-=8);for(o=o<<i|a,c+=i;c>0;t[n+y]=o&255,y+=T,o/=256,c-=8);t[n+y-T]|=P*128},Ti}function $t(){if(uc)return xn;uc=!0;let t=rv(),e=iv(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;xn.Buffer=o,xn.SlowBuffer=_,xn.INSPECT_MAX_BYTES=50;let r=2147483647;xn.kMaxLength=r,o.TYPED_ARRAY_SUPPORT=i(),!o.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 i(){try{let h=new Uint8Array(1),u={foo:function(){return 42}};return Object.setPrototypeOf(u,Uint8Array.prototype),Object.setPrototypeOf(h,u),h.foo()===42}catch{return!1}}Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}});function s(h){if(h>r)throw new RangeError('The value "'+h+'" is invalid for option "size"');let u=new Uint8Array(h);return Object.setPrototypeOf(u,o.prototype),u}function o(h,u,d){if(typeof h=="number"){if(typeof u=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return f(h)}return a(h,u,d)}o.poolSize=8192;function a(h,u,d){if(typeof h=="string")return p(h,u);if(ArrayBuffer.isView(h))return y(h);if(h==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof h);if(_t(h,ArrayBuffer)||h&&_t(h.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(_t(h,SharedArrayBuffer)||h&&_t(h.buffer,SharedArrayBuffer)))return T(h,u,d);if(typeof h=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let v=h.valueOf&&h.valueOf();if(v!=null&&v!==h)return o.from(v,u,d);let O=P(h);if(O)return O;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof h[Symbol.toPrimitive]=="function")return o.from(h[Symbol.toPrimitive]("string"),u,d);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof h)}o.from=function(h,u,d){return a(h,u,d)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function l(h){if(typeof h!="number")throw new TypeError('"size" argument must be of type number');if(h<0)throw new RangeError('The value "'+h+'" is invalid for option "size"')}function c(h,u,d){return l(h),h<=0?s(h):u!==void 0?typeof d=="string"?s(h).fill(u,d):s(h).fill(u):s(h)}o.alloc=function(h,u,d){return c(h,u,d)};function f(h){return l(h),s(h<0?0:I(h)|0)}o.allocUnsafe=function(h){return f(h)},o.allocUnsafeSlow=function(h){return f(h)};function p(h,u){if((typeof u!="string"||u==="")&&(u="utf8"),!o.isEncoding(u))throw new TypeError("Unknown encoding: "+u);let d=E(h,u)|0,v=s(d),O=v.write(h,u);return O!==d&&(v=v.slice(0,O)),v}function g(h){let u=h.length<0?0:I(h.length)|0,d=s(u);for(let v=0;v<u;v+=1)d[v]=h[v]&255;return d}function y(h){if(_t(h,Uint8Array)){let u=new Uint8Array(h);return T(u.buffer,u.byteOffset,u.byteLength)}return g(h)}function T(h,u,d){if(u<0||h.byteLength<u)throw new RangeError('"offset" is outside of buffer bounds');if(h.byteLength<u+(d||0))throw new RangeError('"length" is outside of buffer bounds');let v;return u===void 0&&d===void 0?v=new Uint8Array(h):d===void 0?v=new Uint8Array(h,u):v=new Uint8Array(h,u,d),Object.setPrototypeOf(v,o.prototype),v}function P(h){if(o.isBuffer(h)){let u=I(h.length)|0,d=s(u);return d.length===0||h.copy(d,0,0,u),d}if(h.length!==void 0)return typeof h.length!="number"||vr(h.length)?s(0):g(h);if(h.type==="Buffer"&&Array.isArray(h.data))return g(h.data)}function I(h){if(h>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return h|0}function _(h){return+h!=h&&(h=0),o.alloc(+h)}o.isBuffer=function(u){return u!=null&&u._isBuffer===!0&&u!==o.prototype},o.compare=function(u,d){if(_t(u,Uint8Array)&&(u=o.from(u,u.offset,u.byteLength)),_t(d,Uint8Array)&&(d=o.from(d,d.offset,d.byteLength)),!o.isBuffer(u)||!o.isBuffer(d))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(u===d)return 0;let v=u.length,O=d.length;for(let H=0,K=Math.min(v,O);H<K;++H)if(u[H]!==d[H]){v=u[H],O=d[H];break}return v<O?-1:O<v?1:0},o.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}},o.concat=function(u,d){if(!Array.isArray(u))throw new TypeError('"list" argument must be an Array of Buffers');if(u.length===0)return o.alloc(0);let v;if(d===void 0)for(d=0,v=0;v<u.length;++v)d+=u[v].length;let O=o.allocUnsafe(d),H=0;for(v=0;v<u.length;++v){let K=u[v];if(_t(K,Uint8Array))H+K.length>O.length?(o.isBuffer(K)||(K=o.from(K)),K.copy(O,H)):Uint8Array.prototype.set.call(O,K,H);else if(o.isBuffer(K))K.copy(O,H);else throw new TypeError('"list" argument must be an Array of Buffers');H+=K.length}return O};function E(h,u){if(o.isBuffer(h))return h.length;if(ArrayBuffer.isView(h)||_t(h,ArrayBuffer))return h.byteLength;if(typeof h!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof h);let d=h.length,v=arguments.length>2&&arguments[2]===!0;if(!v&&d===0)return 0;let O=!1;for(;;)switch(u){case"ascii":case"latin1":case"binary":return d;case"utf8":case"utf-8":return ke(h).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d*2;case"hex":return d>>>1;case"base64":return At(h).length;default:if(O)return v?-1:ke(h).length;u=(""+u).toLowerCase(),O=!0}}o.byteLength=E;function B(h,u,d){let v=!1;if((u===void 0||u<0)&&(u=0),u>this.length||((d===void 0||d>this.length)&&(d=this.length),d<=0)||(d>>>=0,u>>>=0,d<=u))return"";for(h||(h="utf8");;)switch(h){case"hex":return ve(this,u,d);case"utf8":case"utf-8":return Qe(this,u,d);case"ascii":return pt(this,u,d);case"latin1":case"binary":return Me(this,u,d);case"base64":return We(this,u,d);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return we(this,u,d);default:if(v)throw new TypeError("Unknown encoding: "+h);h=(h+"").toLowerCase(),v=!0}}o.prototype._isBuffer=!0;function D(h,u,d){let v=h[u];h[u]=h[d],h[d]=v}o.prototype.swap16=function(){let u=this.length;if(u%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let d=0;d<u;d+=2)D(this,d,d+1);return this},o.prototype.swap32=function(){let u=this.length;if(u%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let d=0;d<u;d+=4)D(this,d,d+3),D(this,d+1,d+2);return this},o.prototype.swap64=function(){let u=this.length;if(u%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let d=0;d<u;d+=8)D(this,d,d+7),D(this,d+1,d+6),D(this,d+2,d+5),D(this,d+3,d+4);return this},o.prototype.toString=function(){let u=this.length;return u===0?"":arguments.length===0?Qe(this,0,u):B.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(u){if(!o.isBuffer(u))throw new TypeError("Argument must be a Buffer");return this===u?!0:o.compare(this,u)===0},o.prototype.inspect=function(){let u="",d=xn.INSPECT_MAX_BYTES;return u=this.toString("hex",0,d).replace(/(.{2})/g,"$1 ").trim(),this.length>d&&(u+=" ... "),"<Buffer "+u+">"},n&&(o.prototype[n]=o.prototype.inspect),o.prototype.compare=function(u,d,v,O,H){if(_t(u,Uint8Array)&&(u=o.from(u,u.offset,u.byteLength)),!o.isBuffer(u))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof u);if(d===void 0&&(d=0),v===void 0&&(v=u?u.length:0),O===void 0&&(O=0),H===void 0&&(H=this.length),d<0||v>u.length||O<0||H>this.length)throw new RangeError("out of range index");if(O>=H&&d>=v)return 0;if(O>=H)return-1;if(d>=v)return 1;if(d>>>=0,v>>>=0,O>>>=0,H>>>=0,this===u)return 0;let K=H-O,_e=v-d,Ke=Math.min(K,_e),He=this.slice(O,H),Fe=u.slice(d,v);for(let Re=0;Re<Ke;++Re)if(He[Re]!==Fe[Re]){K=He[Re],_e=Fe[Re];break}return K<_e?-1:_e<K?1:0};function $(h,u,d,v,O){if(h.length===0)return-1;if(typeof d=="string"?(v=d,d=0):d>2147483647?d=2147483647:d<-2147483648&&(d=-2147483648),d=+d,vr(d)&&(d=O?0:h.length-1),d<0&&(d=h.length+d),d>=h.length){if(O)return-1;d=h.length-1}else if(d<0)if(O)d=0;else return-1;if(typeof u=="string"&&(u=o.from(u,v)),o.isBuffer(u))return u.length===0?-1:te(h,u,d,v,O);if(typeof u=="number")return u=u&255,typeof Uint8Array.prototype.indexOf=="function"?O?Uint8Array.prototype.indexOf.call(h,u,d):Uint8Array.prototype.lastIndexOf.call(h,u,d):te(h,[u],d,v,O);throw new TypeError("val must be string, number or Buffer")}function te(h,u,d,v,O){let H=1,K=h.length,_e=u.length;if(v!==void 0&&(v=String(v).toLowerCase(),v==="ucs2"||v==="ucs-2"||v==="utf16le"||v==="utf-16le")){if(h.length<2||u.length<2)return-1;H=2,K/=2,_e/=2,d/=2}function Ke(Fe,Re){return H===1?Fe[Re]:Fe.readUInt16BE(Re*H)}let He;if(O){let Fe=-1;for(He=d;He<K;He++)if(Ke(h,He)===Ke(u,Fe===-1?0:He-Fe)){if(Fe===-1&&(Fe=He),He-Fe+1===_e)return Fe*H}else Fe!==-1&&(He-=He-Fe),Fe=-1}else for(d+_e>K&&(d=K-_e),He=d;He>=0;He--){let Fe=!0;for(let Re=0;Re<_e;Re++)if(Ke(h,He+Re)!==Ke(u,Re)){Fe=!1;break}if(Fe)return He}return-1}o.prototype.includes=function(u,d,v){return this.indexOf(u,d,v)!==-1},o.prototype.indexOf=function(u,d,v){return $(this,u,d,v,!0)},o.prototype.lastIndexOf=function(u,d,v){return $(this,u,d,v,!1)};function Q(h,u,d,v){d=Number(d)||0;let O=h.length-d;v?(v=Number(v),v>O&&(v=O)):v=O;let H=u.length;v>H/2&&(v=H/2);let K;for(K=0;K<v;++K){let _e=parseInt(u.substr(K*2,2),16);if(vr(_e))return K;h[d+K]=_e}return K}function ce(h,u,d,v){return jt(ke(u,h.length-d),h,d,v)}function Y(h,u,d,v){return jt(me(u),h,d,v)}function J(h,u,d,v){return jt(At(u),h,d,v)}function Be(h,u,d,v){return jt(U(u,h.length-d),h,d,v)}o.prototype.write=function(u,d,v,O){if(d===void 0)O="utf8",v=this.length,d=0;else if(v===void 0&&typeof d=="string")O=d,v=this.length,d=0;else if(isFinite(d))d=d>>>0,isFinite(v)?(v=v>>>0,O===void 0&&(O="utf8")):(O=v,v=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let H=this.length-d;if((v===void 0||v>H)&&(v=H),u.length>0&&(v<0||d<0)||d>this.length)throw new RangeError("Attempt to write outside buffer bounds");O||(O="utf8");let K=!1;for(;;)switch(O){case"hex":return Q(this,u,d,v);case"utf8":case"utf-8":return ce(this,u,d,v);case"ascii":case"latin1":case"binary":return Y(this,u,d,v);case"base64":return J(this,u,d,v);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Be(this,u,d,v);default:if(K)throw new TypeError("Unknown encoding: "+O);O=(""+O).toLowerCase(),K=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function We(h,u,d){return u===0&&d===h.length?t.fromByteArray(h):t.fromByteArray(h.slice(u,d))}function Qe(h,u,d){d=Math.min(h.length,d);let v=[],O=u;for(;O<d;){let H=h[O],K=null,_e=H>239?4:H>223?3:H>191?2:1;if(O+_e<=d){let Ke,He,Fe,Re;switch(_e){case 1:H<128&&(K=H);break;case 2:Ke=h[O+1],(Ke&192)===128&&(Re=(H&31)<<6|Ke&63,Re>127&&(K=Re));break;case 3:Ke=h[O+1],He=h[O+2],(Ke&192)===128&&(He&192)===128&&(Re=(H&15)<<12|(Ke&63)<<6|He&63,Re>2047&&(Re<55296||Re>57343)&&(K=Re));break;case 4:Ke=h[O+1],He=h[O+2],Fe=h[O+3],(Ke&192)===128&&(He&192)===128&&(Fe&192)===128&&(Re=(H&15)<<18|(Ke&63)<<12|(He&63)<<6|Fe&63,Re>65535&&Re<1114112&&(K=Re))}}K===null?(K=65533,_e=1):K>65535&&(K-=65536,v.push(K>>>10&1023|55296),K=56320|K&1023),v.push(K),O+=_e}return Ge(v)}let qe=4096;function Ge(h){let u=h.length;if(u<=qe)return String.fromCharCode.apply(String,h);let d="",v=0;for(;v<u;)d+=String.fromCharCode.apply(String,h.slice(v,v+=qe));return d}function pt(h,u,d){let v="";d=Math.min(h.length,d);for(let O=u;O<d;++O)v+=String.fromCharCode(h[O]&127);return v}function Me(h,u,d){let v="";d=Math.min(h.length,d);for(let O=u;O<d;++O)v+=String.fromCharCode(h[O]);return v}function ve(h,u,d){let v=h.length;(!u||u<0)&&(u=0),(!d||d<0||d>v)&&(d=v);let O="";for(let H=u;H<d;++H)O+=gi[h[H]];return O}function we(h,u,d){let v=h.slice(u,d),O="";for(let H=0;H<v.length-1;H+=2)O+=String.fromCharCode(v[H]+v[H+1]*256);return O}o.prototype.slice=function(u,d){let v=this.length;u=~~u,d=d===void 0?v:~~d,u<0?(u+=v,u<0&&(u=0)):u>v&&(u=v),d<0?(d+=v,d<0&&(d=0)):d>v&&(d=v),d<u&&(d=u);let O=this.subarray(u,d);return Object.setPrototypeOf(O,o.prototype),O};function se(h,u,d){if(h%1!==0||h<0)throw new RangeError("offset is not uint");if(h+u>d)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(u,d,v){u=u>>>0,d=d>>>0,v||se(u,d,this.length);let O=this[u],H=1,K=0;for(;++K<d&&(H*=256);)O+=this[u+K]*H;return O},o.prototype.readUintBE=o.prototype.readUIntBE=function(u,d,v){u=u>>>0,d=d>>>0,v||se(u,d,this.length);let O=this[u+--d],H=1;for(;d>0&&(H*=256);)O+=this[u+--d]*H;return O},o.prototype.readUint8=o.prototype.readUInt8=function(u,d){return u=u>>>0,d||se(u,1,this.length),this[u]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(u,d){return u=u>>>0,d||se(u,2,this.length),this[u]|this[u+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(u,d){return u=u>>>0,d||se(u,2,this.length),this[u]<<8|this[u+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(u,d){return u=u>>>0,d||se(u,4,this.length),(this[u]|this[u+1]<<8|this[u+2]<<16)+this[u+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(u,d){return u=u>>>0,d||se(u,4,this.length),this[u]*16777216+(this[u+1]<<16|this[u+2]<<8|this[u+3])},o.prototype.readBigUInt64LE=Pt(function(u){u=u>>>0,b(u,"offset");let d=this[u],v=this[u+7];(d===void 0||v===void 0)&&x(u,this.length-8);let O=d+this[++u]*2**8+this[++u]*2**16+this[++u]*2**24,H=this[++u]+this[++u]*2**8+this[++u]*2**16+v*2**24;return BigInt(O)+(BigInt(H)<<BigInt(32))}),o.prototype.readBigUInt64BE=Pt(function(u){u=u>>>0,b(u,"offset");let d=this[u],v=this[u+7];(d===void 0||v===void 0)&&x(u,this.length-8);let O=d*2**24+this[++u]*2**16+this[++u]*2**8+this[++u],H=this[++u]*2**24+this[++u]*2**16+this[++u]*2**8+v;return(BigInt(O)<<BigInt(32))+BigInt(H)}),o.prototype.readIntLE=function(u,d,v){u=u>>>0,d=d>>>0,v||se(u,d,this.length);let O=this[u],H=1,K=0;for(;++K<d&&(H*=256);)O+=this[u+K]*H;return H*=128,O>=H&&(O-=Math.pow(2,8*d)),O},o.prototype.readIntBE=function(u,d,v){u=u>>>0,d=d>>>0,v||se(u,d,this.length);let O=d,H=1,K=this[u+--O];for(;O>0&&(H*=256);)K+=this[u+--O]*H;return H*=128,K>=H&&(K-=Math.pow(2,8*d)),K},o.prototype.readInt8=function(u,d){return u=u>>>0,d||se(u,1,this.length),this[u]&128?(255-this[u]+1)*-1:this[u]},o.prototype.readInt16LE=function(u,d){u=u>>>0,d||se(u,2,this.length);let v=this[u]|this[u+1]<<8;return v&32768?v|4294901760:v},o.prototype.readInt16BE=function(u,d){u=u>>>0,d||se(u,2,this.length);let v=this[u+1]|this[u]<<8;return v&32768?v|4294901760:v},o.prototype.readInt32LE=function(u,d){return u=u>>>0,d||se(u,4,this.length),this[u]|this[u+1]<<8|this[u+2]<<16|this[u+3]<<24},o.prototype.readInt32BE=function(u,d){return u=u>>>0,d||se(u,4,this.length),this[u]<<24|this[u+1]<<16|this[u+2]<<8|this[u+3]},o.prototype.readBigInt64LE=Pt(function(u){u=u>>>0,b(u,"offset");let d=this[u],v=this[u+7];(d===void 0||v===void 0)&&x(u,this.length-8);let O=this[u+4]+this[u+5]*2**8+this[u+6]*2**16+(v<<24);return(BigInt(O)<<BigInt(32))+BigInt(d+this[++u]*2**8+this[++u]*2**16+this[++u]*2**24)}),o.prototype.readBigInt64BE=Pt(function(u){u=u>>>0,b(u,"offset");let d=this[u],v=this[u+7];(d===void 0||v===void 0)&&x(u,this.length-8);let O=(d<<24)+this[++u]*2**16+this[++u]*2**8+this[++u];return(BigInt(O)<<BigInt(32))+BigInt(this[++u]*2**24+this[++u]*2**16+this[++u]*2**8+v)}),o.prototype.readFloatLE=function(u,d){return u=u>>>0,d||se(u,4,this.length),e.read(this,u,!0,23,4)},o.prototype.readFloatBE=function(u,d){return u=u>>>0,d||se(u,4,this.length),e.read(this,u,!1,23,4)},o.prototype.readDoubleLE=function(u,d){return u=u>>>0,d||se(u,8,this.length),e.read(this,u,!0,52,8)},o.prototype.readDoubleBE=function(u,d){return u=u>>>0,d||se(u,8,this.length),e.read(this,u,!1,52,8)};function de(h,u,d,v,O,H){if(!o.isBuffer(h))throw new TypeError('"buffer" argument must be a Buffer instance');if(u>O||u<H)throw new RangeError('"value" argument is out of bounds');if(d+v>h.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(u,d,v,O){if(u=+u,d=d>>>0,v=v>>>0,!O){let _e=Math.pow(2,8*v)-1;de(this,u,d,v,_e,0)}let H=1,K=0;for(this[d]=u&255;++K<v&&(H*=256);)this[d+K]=u/H&255;return d+v},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(u,d,v,O){if(u=+u,d=d>>>0,v=v>>>0,!O){let _e=Math.pow(2,8*v)-1;de(this,u,d,v,_e,0)}let H=v-1,K=1;for(this[d+H]=u&255;--H>=0&&(K*=256);)this[d+H]=u/K&255;return d+v},o.prototype.writeUint8=o.prototype.writeUInt8=function(u,d,v){return u=+u,d=d>>>0,v||de(this,u,d,1,255,0),this[d]=u&255,d+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(u,d,v){return u=+u,d=d>>>0,v||de(this,u,d,2,65535,0),this[d]=u&255,this[d+1]=u>>>8,d+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(u,d,v){return u=+u,d=d>>>0,v||de(this,u,d,2,65535,0),this[d]=u>>>8,this[d+1]=u&255,d+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(u,d,v){return u=+u,d=d>>>0,v||de(this,u,d,4,4294967295,0),this[d+3]=u>>>24,this[d+2]=u>>>16,this[d+1]=u>>>8,this[d]=u&255,d+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(u,d,v){return u=+u,d=d>>>0,v||de(this,u,d,4,4294967295,0),this[d]=u>>>24,this[d+1]=u>>>16,this[d+2]=u>>>8,this[d+3]=u&255,d+4};function N(h,u,d,v,O){ne(u,v,O,h,d,7);let H=Number(u&BigInt(4294967295));h[d++]=H,H=H>>8,h[d++]=H,H=H>>8,h[d++]=H,H=H>>8,h[d++]=H;let K=Number(u>>BigInt(32)&BigInt(4294967295));return h[d++]=K,K=K>>8,h[d++]=K,K=K>>8,h[d++]=K,K=K>>8,h[d++]=K,d}function Z(h,u,d,v,O){ne(u,v,O,h,d,7);let H=Number(u&BigInt(4294967295));h[d+7]=H,H=H>>8,h[d+6]=H,H=H>>8,h[d+5]=H,H=H>>8,h[d+4]=H;let K=Number(u>>BigInt(32)&BigInt(4294967295));return h[d+3]=K,K=K>>8,h[d+2]=K,K=K>>8,h[d+1]=K,K=K>>8,h[d]=K,d+8}o.prototype.writeBigUInt64LE=Pt(function(u,d=0){return N(this,u,d,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=Pt(function(u,d=0){return Z(this,u,d,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(u,d,v,O){if(u=+u,d=d>>>0,!O){let Ke=Math.pow(2,8*v-1);de(this,u,d,v,Ke-1,-Ke)}let H=0,K=1,_e=0;for(this[d]=u&255;++H<v&&(K*=256);)u<0&&_e===0&&this[d+H-1]!==0&&(_e=1),this[d+H]=(u/K>>0)-_e&255;return d+v},o.prototype.writeIntBE=function(u,d,v,O){if(u=+u,d=d>>>0,!O){let Ke=Math.pow(2,8*v-1);de(this,u,d,v,Ke-1,-Ke)}let H=v-1,K=1,_e=0;for(this[d+H]=u&255;--H>=0&&(K*=256);)u<0&&_e===0&&this[d+H+1]!==0&&(_e=1),this[d+H]=(u/K>>0)-_e&255;return d+v},o.prototype.writeInt8=function(u,d,v){return u=+u,d=d>>>0,v||de(this,u,d,1,127,-128),u<0&&(u=255+u+1),this[d]=u&255,d+1},o.prototype.writeInt16LE=function(u,d,v){return u=+u,d=d>>>0,v||de(this,u,d,2,32767,-32768),this[d]=u&255,this[d+1]=u>>>8,d+2},o.prototype.writeInt16BE=function(u,d,v){return u=+u,d=d>>>0,v||de(this,u,d,2,32767,-32768),this[d]=u>>>8,this[d+1]=u&255,d+2},o.prototype.writeInt32LE=function(u,d,v){return u=+u,d=d>>>0,v||de(this,u,d,4,2147483647,-2147483648),this[d]=u&255,this[d+1]=u>>>8,this[d+2]=u>>>16,this[d+3]=u>>>24,d+4},o.prototype.writeInt32BE=function(u,d,v){return u=+u,d=d>>>0,v||de(this,u,d,4,2147483647,-2147483648),u<0&&(u=4294967295+u+1),this[d]=u>>>24,this[d+1]=u>>>16,this[d+2]=u>>>8,this[d+3]=u&255,d+4},o.prototype.writeBigInt64LE=Pt(function(u,d=0){return N(this,u,d,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=Pt(function(u,d=0){return Z(this,u,d,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function W(h,u,d,v,O,H){if(d+v>h.length)throw new RangeError("Index out of range");if(d<0)throw new RangeError("Index out of range")}function le(h,u,d,v,O){return u=+u,d=d>>>0,O||W(h,u,d,4),e.write(h,u,d,v,23,4),d+4}o.prototype.writeFloatLE=function(u,d,v){return le(this,u,d,!0,v)},o.prototype.writeFloatBE=function(u,d,v){return le(this,u,d,!1,v)};function ge(h,u,d,v,O){return u=+u,d=d>>>0,O||W(h,u,d,8),e.write(h,u,d,v,52,8),d+8}o.prototype.writeDoubleLE=function(u,d,v){return ge(this,u,d,!0,v)},o.prototype.writeDoubleBE=function(u,d,v){return ge(this,u,d,!1,v)},o.prototype.copy=function(u,d,v,O){if(!o.isBuffer(u))throw new TypeError("argument should be a Buffer");if(v||(v=0),!O&&O!==0&&(O=this.length),d>=u.length&&(d=u.length),d||(d=0),O>0&&O<v&&(O=v),O===v||u.length===0||this.length===0)return 0;if(d<0)throw new RangeError("targetStart out of bounds");if(v<0||v>=this.length)throw new RangeError("Index out of range");if(O<0)throw new RangeError("sourceEnd out of bounds");O>this.length&&(O=this.length),u.length-d<O-v&&(O=u.length-d+v);let H=O-v;return this===u&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(d,v,O):Uint8Array.prototype.set.call(u,this.subarray(v,O),d),H},o.prototype.fill=function(u,d,v,O){if(typeof u=="string"){if(typeof d=="string"?(O=d,d=0,v=this.length):typeof v=="string"&&(O=v,v=this.length),O!==void 0&&typeof O!="string")throw new TypeError("encoding must be a string");if(typeof O=="string"&&!o.isEncoding(O))throw new TypeError("Unknown encoding: "+O);if(u.length===1){let K=u.charCodeAt(0);(O==="utf8"&&K<128||O==="latin1")&&(u=K)}}else typeof u=="number"?u=u&255:typeof u=="boolean"&&(u=Number(u));if(d<0||this.length<d||this.length<v)throw new RangeError("Out of range index");if(v<=d)return this;d=d>>>0,v=v===void 0?this.length:v>>>0,u||(u=0);let H;if(typeof u=="number")for(H=d;H<v;++H)this[H]=u;else{let K=o.isBuffer(u)?u:o.from(u,O),_e=K.length;if(_e===0)throw new TypeError('The value "'+u+'" is invalid for argument "value"');for(H=0;H<v-d;++H)this[H+d]=K[H%_e]}return this};let R={};function C(h,u,d){R[h]=class extends d{constructor(){super(),Object.defineProperty(this,"message",{value:u.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${h}]`,this.stack,delete this.name}get code(){return h}set code(O){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:O,writable:!0})}toString(){return`${this.name} [${h}]: ${this.message}`}}}C("ERR_BUFFER_OUT_OF_BOUNDS",function(h){return h?`${h} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),C("ERR_INVALID_ARG_TYPE",function(h,u){return`The "${h}" argument must be of type number. Received type ${typeof u}`},TypeError),C("ERR_OUT_OF_RANGE",function(h,u,d){let v=`The value of "${h}" is out of range.`,O=d;return Number.isInteger(d)&&Math.abs(d)>2**32?O=j(String(d)):typeof d=="bigint"&&(O=String(d),(d>BigInt(2)**BigInt(32)||d<-(BigInt(2)**BigInt(32)))&&(O=j(O)),O+="n"),v+=` It must be ${u}. Received ${O}`,v},RangeError);function j(h){let u="",d=h.length,v=h[0]==="-"?1:0;for(;d>=v+4;d-=3)u=`_${h.slice(d-3,d)}${u}`;return`${h.slice(0,d)}${u}`}function V(h,u,d){b(u,"offset"),(h[u]===void 0||h[u+d]===void 0)&&x(u,h.length-(d+1))}function ne(h,u,d,v,O,H){if(h>d||h<u){let K=typeof u=="bigint"?"n":"",_e;throw u===0||u===BigInt(0)?_e=`>= 0${K} and < 2${K} ** ${(H+1)*8}${K}`:_e=`>= -(2${K} ** ${(H+1)*8-1}${K}) and < 2 ** ${(H+1)*8-1}${K}`,new R.ERR_OUT_OF_RANGE("value",_e,h)}V(v,O,H)}function b(h,u){if(typeof h!="number")throw new R.ERR_INVALID_ARG_TYPE(u,"number",h)}function x(h,u,d){throw Math.floor(h)!==h?(b(h,d),new R.ERR_OUT_OF_RANGE("offset","an integer",h)):u<0?new R.ERR_BUFFER_OUT_OF_BOUNDS:new R.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${u}`,h)}let F=/[^+/0-9A-Za-z-_]/g;function X(h){if(h=h.split("=")[0],h=h.trim().replace(F,""),h.length<2)return"";for(;h.length%4!==0;)h=h+"=";return h}function ke(h,u){u=u||1/0;let d,v=h.length,O=null,H=[];for(let K=0;K<v;++K){if(d=h.charCodeAt(K),d>55295&&d<57344){if(!O){if(d>56319){(u-=3)>-1&&H.push(239,191,189);continue}else if(K+1===v){(u-=3)>-1&&H.push(239,191,189);continue}O=d;continue}if(d<56320){(u-=3)>-1&&H.push(239,191,189),O=d;continue}d=(O-55296<<10|d-56320)+65536}else O&&(u-=3)>-1&&H.push(239,191,189);if(O=null,d<128){if((u-=1)<0)break;H.push(d)}else if(d<2048){if((u-=2)<0)break;H.push(d>>6|192,d&63|128)}else if(d<65536){if((u-=3)<0)break;H.push(d>>12|224,d>>6&63|128,d&63|128)}else if(d<1114112){if((u-=4)<0)break;H.push(d>>18|240,d>>12&63|128,d>>6&63|128,d&63|128)}else throw new Error("Invalid code point")}return H}function me(h){let u=[];for(let d=0;d<h.length;++d)u.push(h.charCodeAt(d)&255);return u}function U(h,u){let d,v,O,H=[];for(let K=0;K<h.length&&!((u-=2)<0);++K)d=h.charCodeAt(K),v=d>>8,O=d%256,H.push(O),H.push(v);return H}function At(h){return t.toByteArray(X(h))}function jt(h,u,d,v){let O;for(O=0;O<v&&!(O+d>=u.length||O>=h.length);++O)u[O+d]=h[O];return O}function _t(h,u){return h instanceof u||h!=null&&h.constructor!=null&&h.constructor.name!=null&&h.constructor.name===u.name}function vr(h){return h!==h}let gi=(function(){let h="0123456789abcdef",u=new Array(256);for(let d=0;d<16;++d){let v=d*16;for(let O=0;O<16;++O)u[v+O]=h[d]+h[O]}return u})();function Pt(h){return typeof BigInt>"u"?_r:h}function _r(){throw new Error("BigInt not supported")}return xn}var br,ac,Ti,lc,xn,uc,vi=ot(()=>{S();A();k();br={},ac=!1;Ti={},lc=!1;xn={},uc=!1});var Pn,z,BA,EA,cc=ot(()=>{S();A();k();vi();Pn=$t();Pn.Buffer;Pn.SlowBuffer;Pn.INSPECT_MAX_BYTES;Pn.kMaxLength;z=Pn.Buffer,BA=Pn.INSPECT_MAX_BYTES,EA=Pn.kMaxLength});var A=ot(()=>{cc()});function Wt(){return Gm||(Gm=!0,typeof Object.create=="function"?no=function(e,n){n&&(e.super_=n,e.prototype=Object.create(n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:no=function(e,n){if(n){e.super_=n;var r=function(){};r.prototype=n.prototype,e.prototype=new r,e.prototype.constructor=e}}),no}var no,Gm,Ys=ot(()=>{S();A();k();no={},Gm=!1});function Ce(){Ce.init.call(this)}function ro(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function iy(t){return t._maxListeners===void 0?Ce.defaultMaxListeners:t._maxListeners}function Xm(t,e,n,r){var i,s,o,a;if(ro(n),(s=t._events)===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,n.listener?n.listener:n),s=t._events),o=s[e]),o===void 0)o=s[e]=n,++t._eventsCount;else if(typeof o=="function"?o=s[e]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),(i=iy(t))>0&&o.length>i&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=o.length,a=l,console&&console.warn&&console.warn(a)}return t}function GI(){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 Qm(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=GI.bind(r);return i.listener=n,r.wrapFn=i,i}function ey(t,e,n){var r=t._events;if(r===void 0)return[];var i=r[e];return i===void 0?[]:typeof i=="function"?n?[i.listener||i]:[i]:n?(function(s){for(var o=new Array(s.length),a=0;a<o.length;++a)o[a]=s[a].listener||s[a];return o})(i):oy(i,i.length)}function ty(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 oy(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}var ny,ry,lr,Vm,Jm,Ym,yt,Xs=ot(()=>{S();A();k();lr=typeof Reflect=="object"?Reflect:null,Vm=lr&&typeof lr.apply=="function"?lr.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};ry=lr&&typeof lr.ownKeys=="function"?lr.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};Jm=Number.isNaN||function(t){return t!=t};ny=Ce,Ce.EventEmitter=Ce,Ce.prototype._events=void 0,Ce.prototype._eventsCount=0,Ce.prototype._maxListeners=void 0;Ym=10;Object.defineProperty(Ce,"defaultMaxListeners",{enumerable:!0,get:function(){return Ym},set:function(t){if(typeof t!="number"||t<0||Jm(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Ym=t}}),Ce.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},Ce.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||Jm(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},Ce.prototype.getMaxListeners=function(){return iy(this)},Ce.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var r=t==="error",i=this._events;if(i!==void 0)r=r&&i.error===void 0;else if(!r)return!1;if(r){var s;if(e.length>0&&(s=e[0]),s instanceof Error)throw s;var o=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw o.context=s,o}var a=i[t];if(a===void 0)return!1;if(typeof a=="function")Vm(a,this,e);else{var l=a.length,c=oy(a,l);for(n=0;n<l;++n)Vm(c[n],this,e)}return!0},Ce.prototype.addListener=function(t,e){return Xm(this,t,e,!1)},Ce.prototype.on=Ce.prototype.addListener,Ce.prototype.prependListener=function(t,e){return Xm(this,t,e,!0)},Ce.prototype.once=function(t,e){return ro(e),this.on(t,Qm(this,t,e)),this},Ce.prototype.prependOnceListener=function(t,e){return ro(e),this.prependListener(t,Qm(this,t,e)),this},Ce.prototype.removeListener=function(t,e){var n,r,i,s,o;if(ro(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(i=-1,s=n.length-1;s>=0;s--)if(n[s]===e||n[s].listener===e){o=n[s].listener,i=s;break}if(i<0)return this;i===0?n.shift():(function(a,l){for(;l+1<a.length;l++)a[l]=a[l+1];a.pop()})(n,i),n.length===1&&(r[t]=n[0]),r.removeListener!==void 0&&this.emit("removeListener",t,o||e)}return this},Ce.prototype.off=Ce.prototype.removeListener,Ce.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 i,s=Object.keys(n);for(r=0;r<s.length;++r)(i=s[r])!=="removeListener"&&this.removeAllListeners(i);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},Ce.prototype.listeners=function(t){return ey(this,t,!0)},Ce.prototype.rawListeners=function(t){return ey(this,t,!1)},Ce.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):ty.call(t,e)},Ce.prototype.listenerCount=ty,Ce.prototype.eventNames=function(){return this._eventsCount>0?ry(this._events):[]};yt=ny;yt.EventEmitter;yt.defaultMaxListeners;yt.init;yt.listenerCount;yt.EventEmitter;yt.defaultMaxListeners;yt.init;yt.listenerCount});var sy=ot(()=>{S();A();k();Xs();yt.once=function(t,e){return new Promise((n,r)=>{function i(...o){s!==void 0&&t.removeListener("error",s),n(o)}let s;e!=="error"&&(s=o=>{t.removeListener(name,i),r(o)},t.once("error",s)),t.once(e,i)})};yt.on=function(t,e){let n=[],r=[],i=null,s=!1,o={async next(){let c=n.shift();if(c)return createIterResult(c,!1);if(i){let f=Promise.reject(i);return i=null,f}return s?createIterResult(void 0,!0):new Promise((f,p)=>r.push({resolve:f,reject:p}))},async return(){t.removeListener(e,a),t.removeListener("error",l),s=!0;for(let c of r)c.resolve(createIterResult(void 0,!0));return createIterResult(void 0,!0)},throw(c){i=c,t.removeListener(e,a),t.removeListener("error",l)},[Symbol.asyncIterator](){return this}};return t.on(e,a),t.on("error",l),o;function a(...c){let f=r.shift();f?f.resolve(createIterResult(c,!1)):n.push(c)}function l(c){s=!0;let f=r.shift();f?f.reject(c):i=c,o.return()}}});function ra(){throw new Error("setTimeout has not been defined")}function ia(){throw new Error("clearTimeout has not been defined")}function _y(t){if(on===setTimeout)return setTimeout(t,0);if((on===ra||!on)&&setTimeout)return on=setTimeout,setTimeout(t,0);try{return on(t,0)}catch{try{return on.call(null,t,0)}catch{return on.call(this||cr,t,0)}}}function VI(){ur&&zn&&(ur=!1,zn.length?an=zn.concat(an):uo=-1,an.length&&by())}function by(){if(!ur){var t=_y(VI);ur=!0;for(var e=an.length;e;){for(zn=an,an=[];++uo<e;)zn&&zn[uo].run();uo=-1,e=an.length}zn=null,ur=!1,(function(n){if(sn===clearTimeout)return clearTimeout(n);if((sn===ia||!sn)&&clearTimeout)return sn=clearTimeout,clearTimeout(n);try{sn(n)}catch{try{return sn.call(null,n)}catch{return sn.call(this||cr,n)}}})(t)}}function ay(t,e){(this||cr).fun=t,(this||cr).array=e}function rn(){}function Gn(t){return t.call.bind(t)}function ni(t,e){if(typeof t!="object")return!1;try{return e(t),!0}catch{return!1}}function uy(t){return ht&&wt?It(t)!==void 0:Ey(t)||Sy(t)||ky(t)||Ay(t)||Cy(t)||Oy(t)||Ry(t)||My(t)||Ny(t)||Dy(t)||Hy(t)}function Ey(t){return ht&&wt?It(t)==="Uint8Array":Le(t)==="[object Uint8Array]"||oB(t)&&t.buffer!==void 0}function Sy(t){return ht&&wt?It(t)==="Uint8ClampedArray":Le(t)==="[object Uint8ClampedArray]"}function ky(t){return ht&&wt?It(t)==="Uint16Array":Le(t)==="[object Uint16Array]"}function Ay(t){return ht&&wt?It(t)==="Uint32Array":Le(t)==="[object Uint32Array]"}function Cy(t){return ht&&wt?It(t)==="Int8Array":Le(t)==="[object Int8Array]"}function Oy(t){return ht&&wt?It(t)==="Int16Array":Le(t)==="[object Int16Array]"}function Ry(t){return ht&&wt?It(t)==="Int32Array":Le(t)==="[object Int32Array]"}function My(t){return ht&&wt?It(t)==="Float32Array":Le(t)==="[object Float32Array]"}function Ny(t){return ht&&wt?It(t)==="Float64Array":Le(t)==="[object Float64Array]"}function Dy(t){return ht&&wt?It(t)==="BigInt64Array":Le(t)==="[object BigInt64Array]"}function Hy(t){return ht&&wt?It(t)==="BigUint64Array":Le(t)==="[object BigUint64Array]"}function io(t){return Le(t)==="[object Map]"}function oo(t){return Le(t)==="[object Set]"}function so(t){return Le(t)==="[object WeakMap]"}function Qs(t){return Le(t)==="[object WeakSet]"}function fo(t){return Le(t)==="[object ArrayBuffer]"}function cy(t){return typeof ArrayBuffer<"u"&&(fo.working?fo(t):t instanceof ArrayBuffer)}function po(t){return Le(t)==="[object DataView]"}function dy(t){return typeof DataView<"u"&&(po.working?po(t):t instanceof DataView)}function go(t){return Le(t)==="[object SharedArrayBuffer]"}function fy(t){return typeof SharedArrayBuffer<"u"&&(go.working?go(t):t instanceof SharedArrayBuffer)}function py(t){return ni(t,cB)}function gy(t){return ni(t,dB)}function my(t){return ni(t,fB)}function yy(t){return By&&ni(t,pB)}function hy(t){return sa&&ni(t,gB)}function Tn(t,e){var n={seen:[],stylize:hB};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),aa(e)?n.showHidden=e:e&&L._extend(n,e),qn(n.showHidden)&&(n.showHidden=!1),qn(n.depth)&&(n.depth=2),qn(n.colors)&&(n.colors=!1),qn(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=yB),mo(n,t,n.depth)}function yB(t,e){var n=Tn.styles[e];return n?"\x1B["+Tn.colors[n][0]+"m"+t+"\x1B["+Tn.colors[n][1]+"m":t}function hB(t,e){return t}function mo(t,e,n){if(t.customInspect&&e&&co(e.inspect)&&e.inspect!==L.inspect&&(!e.constructor||e.constructor.prototype!==e)){var r=e.inspect(n,t);return yo(r)||(r=mo(t,r,n)),r}var i=(function(g,y){if(qn(y))return g.stylize("undefined","undefined");if(yo(y)){var T="'"+JSON.stringify(y).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return g.stylize(T,"string")}if($y(y))return g.stylize(""+y,"number");if(aa(y))return g.stylize(""+y,"boolean");if(vo(y))return g.stylize("null","null")})(t,e);if(i)return i;var s=Object.keys(e),o=(function(g){var y={};return g.forEach((function(T,P){y[T]=!0})),y})(s);if(t.showHidden&&(s=Object.getOwnPropertyNames(e)),ti(e)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return ea(e);if(s.length===0){if(co(e)){var a=e.name?": "+e.name:"";return t.stylize("[Function"+a+"]","special")}if(ei(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(ho(e))return t.stylize(Date.prototype.toString.call(e),"date");if(ti(e))return ea(e)}var l,c="",f=!1,p=["{","}"];return jy(e)&&(f=!0,p=["[","]"]),co(e)&&(c=" [Function"+(e.name?": "+e.name:"")+"]"),ei(e)&&(c=" "+RegExp.prototype.toString.call(e)),ho(e)&&(c=" "+Date.prototype.toUTCString.call(e)),ti(e)&&(c=" "+ea(e)),s.length!==0||f&&e.length!=0?n<0?ei(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),l=f?(function(g,y,T,P,I){for(var _=[],E=0,B=y.length;E<B;++E)Zy(y,String(E))?_.push(ta(g,y,T,P,String(E),!0)):_.push("");return I.forEach((function(D){D.match(/^\d+$/)||_.push(ta(g,y,T,P,D,!0))})),_})(t,e,n,o,s):s.map((function(g){return ta(t,e,n,o,g,f)})),t.seen.pop(),(function(g,y,T){var P=0;return g.reduce((function(I,_){return P++,_.indexOf(`
|
|
2
2
|
`)>=0&&P++,I+_.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60?T[0]+(y===""?"":y+`
|
|
3
3
|
`)+" "+g.join(`,
|
|
4
|
-
`)+" "+T[1]:T[0]+y+" "+g.join(", ")+" "+T[1]})(l,c,p)):p[0]+c+p[1]}function
|
|
4
|
+
`)+" "+T[1]:T[0]+y+" "+g.join(", ")+" "+T[1]})(l,c,p)):p[0]+c+p[1]}function ea(t){return"["+Error.prototype.toString.call(t)+"]"}function ta(t,e,n,r,i,s){var o,a,l;if((l=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?a=l.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):l.set&&(a=t.stylize("[Setter]","special")),Zy(r,i)||(o="["+i+"]"),a||(t.seen.indexOf(l.value)<0?(a=vo(n)?mo(t,l.value,null):mo(t,l.value,n-1)).indexOf(`
|
|
5
5
|
`)>-1&&(a=s?a.split(`
|
|
6
6
|
`).map((function(c){return" "+c})).join(`
|
|
7
7
|
`).substr(2):`
|
|
8
8
|
`+a.split(`
|
|
9
9
|
`).map((function(c){return" "+c})).join(`
|
|
10
|
-
`)):a=t.stylize("[Circular]","special")),qn(o)){if(s&&i.match(/^\d+$/))return a;(o=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+a}function Hy(t){return Array.isArray(t)}function oa(t){return typeof t=="boolean"}function vo(t){return t===null}function Uy(t){return typeof t=="number"}function yo(t){return typeof t=="string"}function qn(t){return t===void 0}function ei(t){return dr(t)&&sa(t)==="[object RegExp]"}function dr(t){return typeof t=="object"&&t!==null}function ho(t){return dr(t)&&sa(t)==="[object Date]"}function ti(t){return dr(t)&&(sa(t)==="[object Error]"||t instanceof Error)}function co(t){return typeof t=="function"}function sa(t){return Object.prototype.toString.call(t)}function ea(t){return t<10?"0"+t.toString(10):t.toString(10)}function hB(){var t=new Date,e=[ea(t.getHours()),ea(t.getMinutes()),ea(t.getSeconds())].join(":");return[t.getDate(),yB[t.getMonth()],e].join(" ")}function jy(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function TB(t,e){if(!t){var n=new Error("Promise was rejected with a falsy value");n.reason=t,t=n}return e(t)}var hy,on,sn,cr,Xe,zn,an,ur,uo,Ue,GI,ra,To,_y,VI,JI,YI,XI,QI,by,wy,sy,eB,tB,nB,xy,be,rB,iB,oB,Py,ia,wt,ht,sB,Le,lB,uB,cB,Qr,L,Kt,yy,pB,ao,Dy,lo,yB,Fn,DC,_o=ot(()=>{E();A();k();cr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,Xe=hy={};(function(){try{on=typeof setTimeout=="function"?setTimeout:ta}catch{on=ta}try{sn=typeof clearTimeout=="function"?clearTimeout:na}catch{sn=na}})();an=[],ur=!1,uo=-1;Xe.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];an.push(new oy(t,e)),an.length!==1||ur||Ty(vy)},oy.prototype.run=function(){(this||cr).fun.apply(null,(this||cr).array)},Xe.title="browser",Xe.browser=!0,Xe.env={},Xe.argv=[],Xe.version="",Xe.versions={},Xe.on=rn,Xe.addListener=rn,Xe.once=rn,Xe.off=rn,Xe.removeListener=rn,Xe.removeAllListeners=rn,Xe.emit=rn,Xe.prependListener=rn,Xe.prependOnceListener=rn,Xe.listeners=function(t){return[]},Xe.binding=function(t){throw new Error("process.binding is not supported")},Xe.cwd=function(){return"/"},Xe.chdir=function(t){throw new Error("process.chdir is not supported")},Xe.umask=function(){return 0};Ue=hy;Ue.addListener;Ue.argv;Ue.binding;Ue.browser;Ue.chdir;Ue.cwd;Ue.emit;Ue.env;Ue.listeners;Ue.nextTick;Ue.off;Ue.on;Ue.once;Ue.prependListener;Ue.prependOnceListener;Ue.removeAllListeners;Ue.removeListener;Ue.title;Ue.umask;Ue.version;Ue.versions;GI=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",ra=Object.prototype.toString,To=function(t){return!(GI&&t&&typeof t=="object"&&Symbol.toStringTag in t)&&ra.call(t)==="[object Arguments]"},_y=function(t){return!!To(t)||t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&ra.call(t)!=="[object Array]"&&ra.call(t.callee)==="[object Function]"},VI=(function(){return To(arguments)})();To.isLegacyArguments=_y;JI=VI?To:_y,YI=Object.prototype.toString,XI=Function.prototype.toString,QI=/^\s*(?:function)?\*/,by=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",wy=Object.getPrototypeOf,sy=(function(){if(!by)return!1;try{return Function("return function*() {}")()}catch{}})(),eB=sy?wy(sy):{},tB=function(t){return typeof t=="function"&&(!!QI.test(XI.call(t))||(by?wy(t)===eB:YI.call(t)==="[object GeneratorFunction]"))},nB=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}},xy=function(t){return t&&typeof t=="object"&&typeof t.copy=="function"&&typeof t.fill=="function"&&typeof t.readUInt8=="function"},be={},rB=xy,iB=JI,oB=tB;Py=typeof BigInt<"u",ia=typeof Symbol<"u",wt=ia&&Symbol.toStringTag!==void 0,ht=typeof Uint8Array<"u",sB=typeof ArrayBuffer<"u";if(ht&&wt)var aB=Object.getPrototypeOf(Uint8Array.prototype),It=Gn(Object.getOwnPropertyDescriptor(aB,Symbol.toStringTag).get);Le=Gn(Object.prototype.toString),lB=Gn(Number.prototype.valueOf),uB=Gn(String.prototype.valueOf),cB=Gn(Boolean.prototype.valueOf);if(Py)var dB=Gn(BigInt.prototype.valueOf);if(ia)var fB=Gn(Symbol.prototype.valueOf);be.isArgumentsObject=iB,be.isGeneratorFunction=oB,be.isPromise=function(t){return typeof Promise<"u"&&t instanceof Promise||t!==null&&typeof t=="object"&&typeof t.then=="function"&&typeof t.catch=="function"},be.isArrayBufferView=function(t){return sB&&ArrayBuffer.isView?ArrayBuffer.isView(t):ay(t)||uy(t)},be.isTypedArray=ay,be.isUint8Array=Iy,be.isUint8ClampedArray=By,be.isUint16Array=Sy,be.isUint32Array=Ey,be.isInt8Array=ky,be.isInt16Array=Ay,be.isInt32Array=Cy,be.isFloat32Array=Oy,be.isFloat64Array=Ry,be.isBigInt64Array=My,be.isBigUint64Array=Ny,io.working=typeof Map<"u"&&io(new Map),be.isMap=function(t){return typeof Map<"u"&&(io.working?io(t):t instanceof Map)},oo.working=typeof Set<"u"&&oo(new Set),be.isSet=function(t){return typeof Set<"u"&&(oo.working?oo(t):t instanceof Set)},so.working=typeof WeakMap<"u"&&so(new WeakMap),be.isWeakMap=function(t){return typeof WeakMap<"u"&&(so.working?so(t):t instanceof WeakMap)},Ys.working=typeof WeakSet<"u"&&Ys(new WeakSet),be.isWeakSet=function(t){return Ys(t)},fo.working=typeof ArrayBuffer<"u"&&fo(new ArrayBuffer),be.isArrayBuffer=ly,po.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&po(new DataView(new ArrayBuffer(1),0,1)),be.isDataView=uy,go.working=typeof SharedArrayBuffer<"u"&&go(new SharedArrayBuffer),be.isSharedArrayBuffer=cy,be.isAsyncFunction=function(t){return Le(t)==="[object AsyncFunction]"},be.isMapIterator=function(t){return Le(t)==="[object Map Iterator]"},be.isSetIterator=function(t){return Le(t)==="[object Set Iterator]"},be.isGeneratorObject=function(t){return Le(t)==="[object Generator]"},be.isWebAssemblyCompiledModule=function(t){return Le(t)==="[object WebAssembly.Module]"},be.isNumberObject=dy,be.isStringObject=fy,be.isBooleanObject=py,be.isBigIntObject=gy,be.isSymbolObject=my,be.isBoxedPrimitive=function(t){return dy(t)||fy(t)||py(t)||gy(t)||my(t)},be.isAnyArrayBuffer=function(t){return ht&&(ly(t)||cy(t))},["isProxy","isExternal","isModuleNamespaceObject"].forEach((function(t){Object.defineProperty(be,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={},Kt=Ue,yy=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},pB=/%[sdj%]/g;L.format=function(t){if(!yo(t)){for(var e=[],n=0;n<arguments.length;n++)e.push(Tn(arguments[n]));return e.join(" ")}n=1;for(var r=arguments,i=r.length,s=String(t).replace(pB,(function(a){if(a==="%%")return"%";if(n>=i)return a;switch(a){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch{return"[Circular]"}default:return a}})),o=r[n];n<i;o=r[++n])vo(o)||!dr(o)?s+=" "+o:s+=" "+Tn(o);return s},L.deprecate=function(t,e){if(Kt!==void 0&&Kt.noDeprecation===!0)return t;if(Kt===void 0)return function(){return L.deprecate(t,e).apply(this||Qr,arguments)};var n=!1;return function(){if(!n){if(Kt.throwDeprecation)throw new Error(e);Kt.traceDeprecation?console.trace(e):console.error(e),n=!0}return t.apply(this||Qr,arguments)}};ao={},Dy=/^$/;Kt.env.NODE_DEBUG&&(lo=Kt.env.NODE_DEBUG,lo=lo.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),Dy=new RegExp("^"+lo+"$","i"));L.debuglog=function(t){if(t=t.toUpperCase(),!ao[t])if(Dy.test(t)){var e=Kt.pid;ao[t]=function(){var n=L.format.apply(L,arguments);console.error("%s %d: %s",t,e,n)}}else ao[t]=function(){};return ao[t]},L.inspect=Tn,Tn.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]},Tn.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},L.types=be,L.isArray=Hy,L.isBoolean=oa,L.isNull=vo,L.isNullOrUndefined=function(t){return t==null},L.isNumber=Uy,L.isString=yo,L.isSymbol=function(t){return typeof t=="symbol"},L.isUndefined=qn,L.isRegExp=ei,L.types.isRegExp=ei,L.isObject=dr,L.isDate=ho,L.types.isDate=ho,L.isError=ti,L.types.isNativeError=ti,L.isFunction=co,L.isPrimitive=function(t){return t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||typeof t=="symbol"||t===void 0},L.isBuffer=xy;yB=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];L.log=function(){console.log("%s - %s",hB(),L.format.apply(L,arguments))},L.inherits=nB,L._extend=function(t,e){if(!e||!dr(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t};Fn=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(Fn&&t[Fn]){var e;if(typeof(e=t[Fn])!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,Fn,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var n,r,i=new Promise((function(a,l){n=a,r=l})),s=[],o=0;o<arguments.length;o++)s.push(arguments[o]);s.push((function(a,l){a?r(a):n(l)}));try{t.apply(this||Qr,s)}catch(a){r(a)}return i}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Fn&&Object.defineProperty(e,Fn,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,yy(t))},L.promisify.custom=Fn,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 i=n.pop();if(typeof i!="function")throw new TypeError("The last argument must be of type Function");var s=this||Qr,o=function(){return i.apply(s,arguments)};t.apply(this||Qr,n).then((function(a){Kt.nextTick(o.bind(null,null,a))}),(function(a){Kt.nextTick(TB.bind(null,a,o))}))}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Object.defineProperties(e,yy(t)),e};L._extend;L.callbackify;L.debuglog;L.deprecate;L.format;L.inherits;L.inspect;L.isArray;L.isBoolean;L.isBuffer;L.isDate;L.isError;L.isFunction;L.isNull;L.isNullOrUndefined;L.isNumber;L.isObject;L.isPrimitive;L.isRegExp;L.isString;L.isSymbol;L.isUndefined;L.log;L.promisify;L._extend;L.callbackify;L.debuglog;L.deprecate;L.format;L.inherits;L.inspect;L.isArray;L.isBoolean;L.isBuffer;L.isDate;L.isError;L.isFunction;L.isNull;L.isNullOrUndefined;L.isNumber;L.isObject;L.isPrimitive;L.isRegExp;L.isString;L.isSymbol;L.isUndefined;L.log;DC=L.promisify;L.types});var LC,$y=ot(()=>{E();A();k();_o();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;LC=L.promisify;L.types;L.TextEncoder=globalThis.TextEncoder;L.TextDecoder=globalThis.TextDecoder});function ca(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function vB(){!fr||!Vn||(fr=!1,Vn.length?ln=Vn.concat(ln):bo=-1,ln.length&&Zy())}function Zy(){if(!fr){var t=setTimeout(vB,0);fr=!0;for(var e=ln.length;e;){for(Vn=ln,ln=[];++bo<e;)Vn&&Vn[bo].run();bo=-1,e=ln.length}Vn=null,fr=!1,clearTimeout(t)}}function _B(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];ln.push(new Ly(t,e)),ln.length===1&&!fr&&setTimeout(Zy,0)}function Ly(t,e){this.fun=t,this.array=e}function lt(){}function HB(t){ca("_linkedBinding")}function ZB(t){ca("dlopen")}function LB(){return[]}function WB(){return[]}function XB(t,e){if(!t)throw new Error(e||"assertion error")}function nS(){return!1}function vS(){return vn.now()/1e3}function ua(t){var e=Math.floor((Date.now()-vn.now())*.001),n=vn.now()*.001,r=Math.floor(n)+e,i=Math.floor(n%1*1e9);return t&&(r=r-t[0],i=i-t[1],i<0&&(r--,i+=la)),[r,i]}function _n(){return Mt}function CS(t){return[]}var ln,fr,Vn,bo,bB,wB,xB,PB,IB,BB,SB,EB,kB,AB,CB,OB,RB,MB,NB,DB,UB,jB,$B,KB,FB,da,zB,qB,GB,VB,JB,YB,QB,eS,tS,rS,iS,oS,sS,aS,lS,uS,cS,dS,fS,pS,gS,mS,yS,hS,TS,vn,aa,la,_S,bS,wS,xS,PS,IS,BS,SS,ES,kS,AS,Mt,fa=ot(()=>{E();A();k();ln=[],fr=!1,bo=-1;Ly.prototype.run=function(){this.fun.apply(null,this.array)};bB="browser",wB="x64",xB="browser",PB={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},IB=["/usr/bin/node"],BB=[],SB="v16.8.0",EB={},kB=function(t,e){console.warn((e?e+": ":"")+t)},AB=function(t){ca("binding")},CB=function(t){return 0},OB=function(){return"/"},RB=function(t){},MB={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};NB=lt,DB=[];UB={},jB=!1,$B={};KB=lt,FB=lt,da=function(){return{}},zB=da,qB=da,GB=lt,VB=lt,JB=lt,YB={};QB={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},eS=lt,tS=lt;rS=lt,iS=lt,oS=lt,sS=lt,aS=lt,lS=void 0,uS=void 0,cS=void 0,dS=lt,fS=2,pS=1,gS="/bin/usr/node",mS=9229,yS="node",hS=[],TS=lt,vn={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};vn.now===void 0&&(aa=Date.now(),vn.timing&&vn.timing.navigationStart&&(aa=vn.timing.navigationStart),vn.now=()=>Date.now()-aa);la=1e9;ua.bigint=function(t){var e=ua(t);return typeof BigInt>"u"?e[0]*la+e[1]:BigInt(e[0]*la)+BigInt(e[1])};_S=10,bS={},wS=0;xS=_n,PS=_n,IS=_n,BS=_n,SS=_n,ES=lt,kS=_n,AS=_n;Mt={version:SB,versions:EB,arch:wB,platform:xB,release:MB,_rawDebug:NB,moduleLoadList:DB,binding:AB,_linkedBinding:HB,_events:bS,_eventsCount:wS,_maxListeners:_S,on:_n,addListener:xS,once:PS,off:IS,removeListener:BS,removeAllListeners:SS,emit:ES,prependListener:kS,prependOnceListener:AS,listeners:CS,domain:UB,_exiting:jB,config:$B,dlopen:ZB,uptime:vS,_getActiveRequests:LB,_getActiveHandles:WB,reallyExit:KB,_kill:FB,cpuUsage:da,resourceUsage:zB,memoryUsage:qB,kill:GB,exit:VB,openStdin:JB,allowedNodeEnvironmentFlags:YB,assert:XB,features:QB,_fatalExceptions:eS,setUncaughtExceptionCaptureCallback:tS,hasUncaughtExceptionCaptureCallback:nS,emitWarning:kB,nextTick:_B,_tickCallback:rS,_debugProcess:iS,_debugEnd:oS,_startProfilerIdleNotifier:sS,_stopProfilerIdleNotifier:aS,stdout:lS,stdin:cS,stderr:uS,abort:dS,umask:CB,chdir:RB,cwd:OB,env:PB,title:bB,argv:IB,execArgv:BB,pid:fS,ppid:pS,execPath:gS,debugPort:mS,hrtime:ua,argv0:yS,_preload_modules:hS,setSourceMapsEnabled:TS}});function Ky(){if(Wy)return pa;Wy=!0,pa=t;function t(n,r){if(e("noDeprecation"))return n;var i=!1;function s(){if(!i){if(e("throwDeprecation"))throw new Error(r);e("traceDeprecation")?console.trace(r):console.warn(r),i=!0}return n.apply(this||ga,arguments)}return s}function e(n){try{if(!ga.localStorage)return!1}catch{return!1}var r=ga.localStorage[n];return r==null?!1:String(r).toLowerCase()==="true"}return pa}var pa,Wy,ga,Fy=ot(()=>{E();A();k();pa={},Wy=!1,ga=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global});function OS(){if(zy)return ri;zy=!0;var t=$t(),e=t.Buffer;function n(i,s){for(var o in i)s[o]=i[o]}e.from&&e.alloc&&e.allocUnsafe&&e.allocUnsafeSlow?ri=t:(n(t,ri),ri.Buffer=r);function r(i,s,o){return e(i,s,o)}return r.prototype=Object.create(e.prototype),n(e,r),r.from=function(i,s,o){if(typeof i=="number")throw new TypeError("Argument must not be a number");return e(i,s,o)},r.alloc=function(i,s,o){if(typeof i!="number")throw new TypeError("Argument must be a number");var a=e(i);return s!==void 0?typeof o=="string"?a.fill(s,o):a.fill(s):a.fill(0),a},r.allocUnsafe=function(i){if(typeof i!="number")throw new TypeError("Argument must be a number");return e(i)},r.allocUnsafeSlow=function(i){if(typeof i!="number")throw new TypeError("Argument must be a number");return t.SlowBuffer(i)},ri}function RS(){if(qy)return ma;qy=!0;var t=OS().Buffer,e=t.isEncoding||function(_){switch(_=""+_,_&&_.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function n(_){if(!_)return"utf8";for(var S;;)switch(_){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return _;default:if(S)return;_=(""+_).toLowerCase(),S=!0}}function r(_){var S=n(_);if(typeof S!="string"&&(t.isEncoding===e||!e(_)))throw new Error("Unknown encoding: "+_);return S||_}ma.StringDecoder=i;function i(_){this.encoding=r(_);var S;switch(this.encoding){case"utf16le":this.text=p,this.end=g,S=4;break;case"utf8":this.fillLast=l,S=4;break;case"base64":this.text=y,this.end=T,S=3;break;default:this.write=P,this.end=I;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(S)}i.prototype.write=function(_){if(_.length===0)return"";var S,B;if(this.lastNeed){if(S=this.fillLast(_),S===void 0)return"";B=this.lastNeed,this.lastNeed=0}else B=0;return B<_.length?S?S+this.text(_,B):this.text(_,B):S||""},i.prototype.end=f,i.prototype.text=c,i.prototype.fillLast=function(_){if(this.lastNeed<=_.length)return _.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);_.copy(this.lastChar,this.lastTotal-this.lastNeed,0,_.length),this.lastNeed-=_.length};function s(_){return _<=127?0:_>>5===6?2:_>>4===14?3:_>>3===30?4:_>>6===2?-1:-2}function o(_,S,B){var D=S.length-1;if(D<B)return 0;var $=s(S[D]);return $>=0?($>0&&(_.lastNeed=$-1),$):--D<B||$===-2?0:($=s(S[D]),$>=0?($>0&&(_.lastNeed=$-2),$):--D<B||$===-2?0:($=s(S[D]),$>=0?($>0&&($===2?$=0:_.lastNeed=$-3),$):0))}function a(_,S,B){if((S[0]&192)!==128)return _.lastNeed=0,"\uFFFD";if(_.lastNeed>1&&S.length>1){if((S[1]&192)!==128)return _.lastNeed=1,"\uFFFD";if(_.lastNeed>2&&S.length>2&&(S[2]&192)!==128)return _.lastNeed=2,"\uFFFD"}}function l(_){var S=this.lastTotal-this.lastNeed,B=a(this,_);if(B!==void 0)return B;if(this.lastNeed<=_.length)return _.copy(this.lastChar,S,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);_.copy(this.lastChar,S,0,_.length),this.lastNeed-=_.length}function c(_,S){var B=o(this,_,S);if(!this.lastNeed)return _.toString("utf8",S);this.lastTotal=B;var D=_.length-(B-this.lastNeed);return _.copy(this.lastChar,0,D),_.toString("utf8",S,D)}function f(_){var S=_&&_.length?this.write(_):"";return this.lastNeed?S+"\uFFFD":S}function p(_,S){if((_.length-S)%2===0){var B=_.toString("utf16le",S);if(B){var D=B.charCodeAt(B.length-1);if(D>=55296&&D<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=_[_.length-2],this.lastChar[1]=_[_.length-1],B.slice(0,-1)}return B}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=_[_.length-1],_.toString("utf16le",S,_.length-1)}function g(_){var S=_&&_.length?this.write(_):"";if(this.lastNeed){var B=this.lastTotal-this.lastNeed;return S+this.lastChar.toString("utf16le",0,B)}return S}function y(_,S){var B=(_.length-S)%3;return B===0?_.toString("base64",S):(this.lastNeed=3-B,this.lastTotal=3,B===1?this.lastChar[0]=_[_.length-1]:(this.lastChar[0]=_[_.length-2],this.lastChar[1]=_[_.length-1]),_.toString("base64",S,_.length-B))}function T(_){var S=_&&_.length?this.write(_):"";return this.lastNeed?S+this.lastChar.toString("base64",0,3-this.lastNeed):S}function P(_){return _.toString(this.encoding)}function I(_){return _&&_.length?this.write(_):""}return ma}var ri,zy,ma,qy,ii,nO,Gy=ot(()=>{E();A();k();vi();ri={},zy=!1;ma={},qy=!1;ii=RS();ii.StringDecoder;nO=ii.StringDecoder});function MS(){if(Vy)return ya;Vy=!0;var t=ya={},e,n;function r(){throw new Error("setTimeout has not been defined")}function i(){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=i}catch{n=i}})();function s(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||pr,P,0)}}}function o(P){if(n===clearTimeout)return clearTimeout(P);if((n===i||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(P);try{return n(P)}catch{try{return n.call(null,P)}catch{return n.call(this||pr,P)}}}var a=[],l=!1,c,f=-1;function p(){!l||!c||(l=!1,c.length?a=c.concat(a):f=-1,a.length&&g())}function g(){if(!l){var P=s(p);l=!0;for(var I=a.length;I;){for(c=a,a=[];++f<I;)c&&c[f].run();f=-1,I=a.length}c=null,l=!1,o(P)}}t.nextTick=function(P){var I=new Array(arguments.length-1);if(arguments.length>1)for(var _=1;_<arguments.length;_++)I[_-1]=arguments[_];a.push(new y(P,I)),a.length===1&&!l&&s(g)};function y(P,I){(this||pr).fun=P,(this||pr).array=I}y.prototype.run=function(){(this||pr).fun.apply(null,(this||pr).array)},t.title="browser",t.browser=!0,t.env={},t.argv=[],t.version="",t.versions={};function T(){}return t.on=T,t.addListener=T,t.once=T,t.off=T,t.removeListener=T,t.removeAllListeners=T,t.emit=T,t.prependListener=T,t.prependOnceListener=T,t.listeners=function(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},ya}var ya,Vy,pr,je,ha=ot(()=>{E();A();k();ya={},Vy=!1,pr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;je=MS();je.platform="browser";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});function NS(){if(Jy)return Ta;Jy=!0;var t=je;function e(s){if(typeof s!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(s))}function n(s,o){for(var a="",l=0,c=-1,f=0,p,g=0;g<=s.length;++g){if(g<s.length)p=s.charCodeAt(g);else{if(p===47)break;p=47}if(p===47){if(!(c===g-1||f===1))if(c!==g-1&&f===2){if(a.length<2||l!==2||a.charCodeAt(a.length-1)!==46||a.charCodeAt(a.length-2)!==46){if(a.length>2){var y=a.lastIndexOf("/");if(y!==a.length-1){y===-1?(a="",l=0):(a=a.slice(0,y),l=a.length-1-a.lastIndexOf("/")),c=g,f=0;continue}}else if(a.length===2||a.length===1){a="",l=0,c=g,f=0;continue}}o&&(a.length>0?a+="/..":a="..",l=2)}else a.length>0?a+="/"+s.slice(c+1,g):a=s.slice(c+1,g),l=g-c-1;c=g,f=0}else p===46&&f!==-1?++f:f=-1}return a}function r(s,o){var a=o.dir||o.root,l=o.base||(o.name||"")+(o.ext||"");return a?a===o.root?a+l:a+s+l:l}var i={resolve:function(){for(var o="",a=!1,l,c=arguments.length-1;c>=-1&&!a;c--){var f;c>=0?f=arguments[c]:(l===void 0&&(l=t.cwd()),f=l),e(f),f.length!==0&&(o=f+"/"+o,a=f.charCodeAt(0)===47)}return o=n(o,!a),a?o.length>0?"/"+o:"/":o.length>0?o:"."},normalize:function(o){if(e(o),o.length===0)return".";var a=o.charCodeAt(0)===47,l=o.charCodeAt(o.length-1)===47;return o=n(o,!a),o.length===0&&!a&&(o="."),o.length>0&&l&&(o+="/"),a?"/"+o:o},isAbsolute:function(o){return e(o),o.length>0&&o.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var o,a=0;a<arguments.length;++a){var l=arguments[a];e(l),l.length>0&&(o===void 0?o=l:o+="/"+l)}return o===void 0?".":i.normalize(o)},relative:function(o,a){if(e(o),e(a),o===a||(o=i.resolve(o),a=i.resolve(a),o===a))return"";for(var l=1;l<o.length&&o.charCodeAt(l)===47;++l);for(var c=o.length,f=c-l,p=1;p<a.length&&a.charCodeAt(p)===47;++p);for(var g=a.length,y=g-p,T=f<y?f:y,P=-1,I=0;I<=T;++I){if(I===T){if(y>T){if(a.charCodeAt(p+I)===47)return a.slice(p+I+1);if(I===0)return a.slice(p+I)}else f>T&&(o.charCodeAt(l+I)===47?P=I:I===0&&(P=0));break}var _=o.charCodeAt(l+I),S=a.charCodeAt(p+I);if(_!==S)break;_===47&&(P=I)}var B="";for(I=l+P+1;I<=c;++I)(I===c||o.charCodeAt(I)===47)&&(B.length===0?B+="..":B+="/..");return B.length>0?B+a.slice(p+P):(p+=P,a.charCodeAt(p)===47&&++p,a.slice(p))},_makeLong:function(o){return o},dirname:function(o){if(e(o),o.length===0)return".";for(var a=o.charCodeAt(0),l=a===47,c=-1,f=!0,p=o.length-1;p>=1;--p)if(a=o.charCodeAt(p),a===47){if(!f){c=p;break}}else f=!1;return c===-1?l?"/":".":l&&c===1?"//":o.slice(0,c)},basename:function(o,a){if(a!==void 0&&typeof a!="string")throw new TypeError('"ext" argument must be a string');e(o);var l=0,c=-1,f=!0,p;if(a!==void 0&&a.length>0&&a.length<=o.length){if(a.length===o.length&&a===o)return"";var g=a.length-1,y=-1;for(p=o.length-1;p>=0;--p){var T=o.charCodeAt(p);if(T===47){if(!f){l=p+1;break}}else y===-1&&(f=!1,y=p+1),g>=0&&(T===a.charCodeAt(g)?--g===-1&&(c=p):(g=-1,c=y))}return l===c?c=y:c===-1&&(c=o.length),o.slice(l,c)}else{for(p=o.length-1;p>=0;--p)if(o.charCodeAt(p)===47){if(!f){l=p+1;break}}else c===-1&&(f=!1,c=p+1);return c===-1?"":o.slice(l,c)}},extname:function(o){e(o);for(var a=-1,l=0,c=-1,f=!0,p=0,g=o.length-1;g>=0;--g){var y=o.charCodeAt(g);if(y===47){if(!f){l=g+1;break}continue}c===-1&&(f=!1,c=g+1),y===46?a===-1?a=g:p!==1&&(p=1):a!==-1&&(p=-1)}return a===-1||c===-1||p===0||p===1&&a===c-1&&a===l+1?"":o.slice(a,c)},format:function(o){if(o===null||typeof o!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof o);return r("/",o)},parse:function(o){e(o);var a={root:"",dir:"",base:"",ext:"",name:""};if(o.length===0)return a;var l=o.charCodeAt(0),c=l===47,f;c?(a.root="/",f=1):f=0;for(var p=-1,g=0,y=-1,T=!0,P=o.length-1,I=0;P>=f;--P){if(l=o.charCodeAt(P),l===47){if(!T){g=P+1;break}continue}y===-1&&(T=!1,y=P+1),l===46?p===-1?p=P:I!==1&&(I=1):p!==-1&&(I=-1)}return p===-1||y===-1||I===0||I===1&&p===y-1&&p===g+1?y!==-1&&(g===0&&c?a.base=a.name=o.slice(1,y):a.base=a.name=o.slice(g,y)):(g===0&&c?(a.name=o.slice(1,p),a.base=o.slice(1,y)):(a.name=o.slice(g,p),a.base=o.slice(g,y)),a.ext=o.slice(p,y)),g>0?a.dir=o.slice(0,g-1):c&&(a.dir="/"),a},sep:"/",delimiter:":",win32:null,posix:null};return i.posix=i,Ta=i,Ta}function Jn(t){throw new RangeError(jS[t])}function Xy(t,e){let n=t.split("@"),r="";n.length>1&&(r=n[0]+"@",t=n[1]);let i=(function(s,o){let a=[],l=s.length;for(;l--;)a[l]=o(s[l]);return a})((t=t.replace(US,".")).split("."),e).join(".");return r+i}function ah(t){let e=[],n=0,r=t.length;for(;n<r;){let i=t.charCodeAt(n++);if(i>=55296&&i<=56319&&n<r){let s=t.charCodeAt(n++);(64512&s)==56320?e.push(((1023&i)<<10)+(1023&s)+65536):(e.push(i),n--)}else e.push(i)}return e}function ZS(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Bt(){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 si(t,e,n){if(t&&Ft.isObject(t)&&t instanceof Bt)return t;var r=new Bt;return r.parse(t,e,n),r}function YS(){if(oh)return wa;oh=!0;var t=Ue;function e(s){if(typeof s!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(s))}function n(s,o){for(var a="",l=0,c=-1,f=0,p,g=0;g<=s.length;++g){if(g<s.length)p=s.charCodeAt(g);else{if(p===47)break;p=47}if(p===47){if(!(c===g-1||f===1))if(c!==g-1&&f===2){if(a.length<2||l!==2||a.charCodeAt(a.length-1)!==46||a.charCodeAt(a.length-2)!==46){if(a.length>2){var y=a.lastIndexOf("/");if(y!==a.length-1){y===-1?(a="",l=0):(a=a.slice(0,y),l=a.length-1-a.lastIndexOf("/")),c=g,f=0;continue}}else if(a.length===2||a.length===1){a="",l=0,c=g,f=0;continue}}o&&(a.length>0?a+="/..":a="..",l=2)}else a.length>0?a+="/"+s.slice(c+1,g):a=s.slice(c+1,g),l=g-c-1;c=g,f=0}else p===46&&f!==-1?++f:f=-1}return a}function r(s,o){var a=o.dir||o.root,l=o.base||(o.name||"")+(o.ext||"");return a?a===o.root?a+l:a+s+l:l}var i={resolve:function(){for(var o="",a=!1,l,c=arguments.length-1;c>=-1&&!a;c--){var f;c>=0?f=arguments[c]:(l===void 0&&(l=t.cwd()),f=l),e(f),f.length!==0&&(o=f+"/"+o,a=f.charCodeAt(0)===47)}return o=n(o,!a),a?o.length>0?"/"+o:"/":o.length>0?o:"."},normalize:function(o){if(e(o),o.length===0)return".";var a=o.charCodeAt(0)===47,l=o.charCodeAt(o.length-1)===47;return o=n(o,!a),o.length===0&&!a&&(o="."),o.length>0&&l&&(o+="/"),a?"/"+o:o},isAbsolute:function(o){return e(o),o.length>0&&o.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var o,a=0;a<arguments.length;++a){var l=arguments[a];e(l),l.length>0&&(o===void 0?o=l:o+="/"+l)}return o===void 0?".":i.normalize(o)},relative:function(o,a){if(e(o),e(a),o===a||(o=i.resolve(o),a=i.resolve(a),o===a))return"";for(var l=1;l<o.length&&o.charCodeAt(l)===47;++l);for(var c=o.length,f=c-l,p=1;p<a.length&&a.charCodeAt(p)===47;++p);for(var g=a.length,y=g-p,T=f<y?f:y,P=-1,I=0;I<=T;++I){if(I===T){if(y>T){if(a.charCodeAt(p+I)===47)return a.slice(p+I+1);if(I===0)return a.slice(p+I)}else f>T&&(o.charCodeAt(l+I)===47?P=I:I===0&&(P=0));break}var _=o.charCodeAt(l+I),S=a.charCodeAt(p+I);if(_!==S)break;_===47&&(P=I)}var B="";for(I=l+P+1;I<=c;++I)(I===c||o.charCodeAt(I)===47)&&(B.length===0?B+="..":B+="/..");return B.length>0?B+a.slice(p+P):(p+=P,a.charCodeAt(p)===47&&++p,a.slice(p))},_makeLong:function(o){return o},dirname:function(o){if(e(o),o.length===0)return".";for(var a=o.charCodeAt(0),l=a===47,c=-1,f=!0,p=o.length-1;p>=1;--p)if(a=o.charCodeAt(p),a===47){if(!f){c=p;break}}else f=!1;return c===-1?l?"/":".":l&&c===1?"//":o.slice(0,c)},basename:function(o,a){if(a!==void 0&&typeof a!="string")throw new TypeError('"ext" argument must be a string');e(o);var l=0,c=-1,f=!0,p;if(a!==void 0&&a.length>0&&a.length<=o.length){if(a.length===o.length&&a===o)return"";var g=a.length-1,y=-1;for(p=o.length-1;p>=0;--p){var T=o.charCodeAt(p);if(T===47){if(!f){l=p+1;break}}else y===-1&&(f=!1,y=p+1),g>=0&&(T===a.charCodeAt(g)?--g===-1&&(c=p):(g=-1,c=y))}return l===c?c=y:c===-1&&(c=o.length),o.slice(l,c)}else{for(p=o.length-1;p>=0;--p)if(o.charCodeAt(p)===47){if(!f){l=p+1;break}}else c===-1&&(f=!1,c=p+1);return c===-1?"":o.slice(l,c)}},extname:function(o){e(o);for(var a=-1,l=0,c=-1,f=!0,p=0,g=o.length-1;g>=0;--g){var y=o.charCodeAt(g);if(y===47){if(!f){l=g+1;break}continue}c===-1&&(f=!1,c=g+1),y===46?a===-1?a=g:p!==1&&(p=1):a!==-1&&(p=-1)}return a===-1||c===-1||p===0||p===1&&a===c-1&&a===l+1?"":o.slice(a,c)},format:function(o){if(o===null||typeof o!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof o);return r("/",o)},parse:function(o){e(o);var a={root:"",dir:"",base:"",ext:"",name:""};if(o.length===0)return a;var l=o.charCodeAt(0),c=l===47,f;c?(a.root="/",f=1):f=0;for(var p=-1,g=0,y=-1,T=!0,P=o.length-1,I=0;P>=f;--P){if(l=o.charCodeAt(P),l===47){if(!T){g=P+1;break}continue}y===-1&&(T=!1,y=P+1),l===46?p===-1?p=P:I!==1&&(I=1):p!==-1&&(I=-1)}return p===-1||y===-1||I===0||I===1&&p===y-1&&p===g+1?y!==-1&&(g===0&&c?a.base=a.name=o.slice(1,y):a.base=a.name=o.slice(g,y)):(g===0&&c?(a.name=o.slice(1,p),a.base=o.slice(1,y)):(a.name=o.slice(g,p),a.base=o.slice(g,y)),a.ext=o.slice(p,y)),g>0?a.dir=o.slice(0,g-1):c&&(a.dir="/"),a},sep:"/",delimiter:":",win32:null,posix:null};return i.posix=i,wa=i,wa}function uE(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 Pa?cE(t):dE(t)}function cE(t){let e=t.hostname,n=t.pathname;for(let r=0;r<n.length;r++)if(n[r]==="%"){let i=n.codePointAt(r+2)||32;if(n[r+1]==="2"&&i===102||n[r+1]==="5"&&i===99)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(n=n.replace(rE,"\\"),n=decodeURIComponent(n),e!=="")return`\\\\${e}${n}`;{let r=n.codePointAt(1)|32,i=n[2];if(r<tE||r>nE||i!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return n.slice(1)}}function dE(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 fE(t){let e=sh.resolve(t),n=t.charCodeAt(t.length-1);(n===eE||Pa&&n===QS)&&e[e.length-1]!==sh.sep&&(e+="/");let r=new URL("file://");return e.includes("%")&&(e=e.replace(iE,"%25")),!Pa&&e.includes("\\")&&(e=e.replace(oE,"%5C")),e.includes(`
|
|
11
|
-
`)&&(e=e.replace(
|
|
12
|
-
`)&&(e=e.replace(
|
|
13
|
-
`," "]),xa=["'"].concat(GS),nh=["%","/","?",";","#"].concat(xa),rh=["/","?","#"],ih=/^[+a-z0-9A-Z_-]{0,63}$/,VS=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,JS={javascript:!0,"javascript:":!0},_a={javascript:!0,"javascript:":!0},gr={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},ba=un;Bt.prototype.parse=function(t,e,n){if(!Ft.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var r=t.indexOf("?"),i=r!==-1&&r<t.indexOf("#")?"?":"#",s=t.split(i);s[0]=s[0].replace(/\\/g,"/");var o=t=s.join(i);if(o=o.trim(),!n&&t.split("#").length===1){var a=qS.exec(o);if(a)return this.path=o,this.href=o,this.pathname=a[1],a[2]?(this.search=a[2],this.query=e?ba.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var l=FS.exec(o);if(l){var c=(l=l[0]).toLowerCase();this.protocol=c,o=o.substr(l.length)}if(n||l||o.match(/^\/\/[^@\/]+@[^@\/]+/)){var f=o.substr(0,2)==="//";!f||l&&_a[l]||(o=o.substr(2),this.slashes=!0)}if(!_a[l]&&(f||l&&!gr[l])){for(var p,g,y=-1,T=0;T<rh.length;T++)(P=o.indexOf(rh[T]))!==-1&&(y===-1||P<y)&&(y=P);for((g=y===-1?o.lastIndexOf("@"):o.lastIndexOf("@",y))!==-1&&(p=o.slice(0,g),o=o.slice(g+1),this.auth=decodeURIComponent(p)),y=-1,T=0;T<nh.length;T++){var P;(P=o.indexOf(nh[T]))!==-1&&(y===-1||P<y)&&(y=P)}y===-1&&(y=o.length),this.host=o.slice(0,y),o=o.slice(y),this.parseHost(),this.hostname=this.hostname||"";var I=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!I)for(var _=this.hostname.split(/\./),S=(T=0,_.length);T<S;T++){var B=_[T];if(B&&!B.match(ih)){for(var D="",$=0,te=B.length;$<te;$++)B.charCodeAt($)>127?D+="x":D+=B[$];if(!D.match(ih)){var Q=_.slice(0,T),ce=_.slice(T+1),Y=B.match(VS);Y&&(Q.push(Y[1]),ce.unshift(Y[2])),ce.length&&(o="/"+ce.join(".")+o),this.hostname=Q.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),I||(this.hostname=KS.toASCII(this.hostname));var J=this.port?":"+this.port:"",Be=this.hostname||"";this.host=Be+J,this.href+=this.host,I&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),o[0]!=="/"&&(o="/"+o))}if(!JS[c])for(T=0,S=xa.length;T<S;T++){var We=xa[T];if(o.indexOf(We)!==-1){var Qe=encodeURIComponent(We);Qe===We&&(Qe=escape(We)),o=o.split(We).join(Qe)}}var qe=o.indexOf("#");qe!==-1&&(this.hash=o.substr(qe),o=o.slice(0,qe));var Ge=o.indexOf("?");if(Ge!==-1?(this.search=o.substr(Ge),this.query=o.substr(Ge+1),e&&(this.query=ba.parse(this.query)),o=o.slice(0,Ge)):e&&(this.search="",this.query={}),o&&(this.pathname=o),gr[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){J=this.pathname||"";var pt=this.search||"";this.path=J+pt}return this.href=this.format(),this},Bt.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||"",i=!1,s="";this.host?i=t+this.host:this.hostname&&(i=t+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(i+=":"+this.port)),this.query&&Ft.isObject(this.query)&&Object.keys(this.query).length&&(s=ba.stringify(this.query));var o=this.search||s&&"?"+s||"";return e&&e.substr(-1)!==":"&&(e+=":"),this.slashes||(!e||gr[e])&&i!==!1?(i="//"+(i||""),n&&n.charAt(0)!=="/"&&(n="/"+n)):i||(i=""),r&&r.charAt(0)!=="#"&&(r="#"+r),o&&o.charAt(0)!=="?"&&(o="?"+o),e+i+(n=n.replace(/[?#]/g,(function(a){return encodeURIComponent(a)})))+(o=o.replace("#","%23"))+r},Bt.prototype.resolve=function(t){return this.resolveObject(si(t,!1,!0)).format()},Bt.prototype.resolveObject=function(t){if(Ft.isString(t)){var e=new Bt;e.parse(t,!1,!0),t=e}for(var n=new Bt,r=Object.keys(this),i=0;i<r.length;i++){var s=r[i];n[s]=this[s]}if(n.hash=t.hash,t.href==="")return n.href=n.format(),n;if(t.slashes&&!t.protocol){for(var o=Object.keys(t),a=0;a<o.length;a++){var l=o[a];l!=="protocol"&&(n[l]=t[l])}return gr[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(t.protocol&&t.protocol!==n.protocol){if(!gr[t.protocol]){for(var c=Object.keys(t),f=0;f<c.length;f++){var p=c[f];n[p]=t[p]}return n.href=n.format(),n}if(n.protocol=t.protocol,t.host||_a[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 y=n.pathname||"",T=n.search||"";n.path=y+T}return n.slashes=n.slashes||t.slashes,n.href=n.format(),n}var P=n.pathname&&n.pathname.charAt(0)==="/",I=t.host||t.pathname&&t.pathname.charAt(0)==="/",_=I||P||n.host&&t.pathname,S=_,B=n.pathname&&n.pathname.split("/")||[],D=(g=t.pathname&&t.pathname.split("/")||[],n.protocol&&!gr[n.protocol]);if(D&&(n.hostname="",n.port=null,n.host&&(B[0]===""?B[0]=n.host:B.unshift(n.host)),n.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(g[0]===""?g[0]=t.host:g.unshift(t.host)),t.host=null),_=_&&(g[0]===""||B[0]==="")),I)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,B=g;else if(g.length)B||(B=[]),B.pop(),B=B.concat(g),n.search=t.search,n.query=t.query;else if(!Ft.isNullOrUndefined(t.search))return D&&(n.hostname=n.host=B.shift(),(Y=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=Y.shift(),n.host=n.hostname=Y.shift())),n.search=t.search,n.query=t.query,Ft.isNull(n.pathname)&&Ft.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n;if(!B.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var $=B.slice(-1)[0],te=(n.host||t.host||B.length>1)&&($==="."||$==="..")||$==="",Q=0,ce=B.length;ce>=0;ce--)($=B[ce])==="."?B.splice(ce,1):$===".."?(B.splice(ce,1),Q++):Q&&(B.splice(ce,1),Q--);if(!_&&!S)for(;Q--;Q)B.unshift("..");!_||B[0]===""||B[0]&&B[0].charAt(0)==="/"||B.unshift(""),te&&B.join("/").substr(-1)!=="/"&&B.push("");var Y,J=B[0]===""||B[0]&&B[0].charAt(0)==="/";return D&&(n.hostname=n.host=J?"":B.length?B.shift():"",(Y=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=Y.shift(),n.host=n.hostname=Y.shift())),(_=_||n.host&&B.length)&&!J&&B.unshift(""),B.length?n.pathname=B.join("/"):(n.pathname=null,n.path=null),Ft.isNull(n.pathname)&&Ft.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},Bt.prototype.parseHost=function(){var t=this.host,e=zS.exec(t);e&&((e=e[0])!==":"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};Oe.Url;Oe.format;Oe.resolve;Oe.resolveObject;wa={},oh=!1;sh=YS(),XS=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;Oe.URL=typeof URL<"u"?URL:null;Oe.pathToFileURL=fE;Oe.fileURLToPath=uE;Oe.Url;Oe.format;Oe.resolve;Oe.resolveObject;Oe.URL;QS=92,eE=47,tE=97,nE=122,Pa=XS==="win32",rE=/\//g,iE=/%/g,oE=/\\/g,sE=/\n/g,aE=/\r/g,lE=/\t/g;pE=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;Oe.URL=typeof URL<"u"?URL:null;Oe.pathToFileURL=SE;Oe.fileURLToPath=PE;Oe.Url;Oe.format;Oe.resolve;Oe.resolveObject;Oe.parse;Oe.URL;gE=92,mE=47,yE=97,hE=122,Ia=pE==="win32",TE=/\//g,vE=/%/g,_E=/\\/g,bE=/\n/g,wE=/\r/g,xE=/\t/g});var Lh={};pn(Lh,{Agent:()=>UE,ClientRequest:()=>jE,IncomingMessage:()=>$E,METHODS:()=>ZE,STATUS_CODES:()=>LE,default:()=>cn,get:()=>WE,globalAgent:()=>KE,request:()=>FE});function Rh(){if(ch)return xt;ch=!0,xt.fetch=r(Yn.fetch)&&r(Yn.ReadableStream),xt.writableStream=r(Yn.WritableStream),xt.abortController=r(Yn.AbortController);var t;function e(){if(t!==void 0)return t;if(Yn.XMLHttpRequest){t=new Yn.XMLHttpRequest;try{t.open("GET",Yn.XDomainRequest?"/":"https://example.com")}catch{t=null}}else t=null;return t}function n(i){var s=e();if(!s)return!1;try{return s.responseType=i,s.responseType===i}catch{}return!1}xt.arraybuffer=xt.fetch||n("arraybuffer"),xt.msstream=!xt.fetch&&n("ms-stream"),xt.mozchunkedarraybuffer=!xt.fetch&&n("moz-chunked-arraybuffer"),xt.overrideMimeType=xt.fetch||(e()?r(e().overrideMimeType):!1);function r(i){return typeof i=="function"}return t=null,xt}function Mh(){return dh||(dh=!0,Ba=yt.EventEmitter),Ba}function EE(){if(fh)return Sa;fh=!0;function t(T,P){var I=Object.keys(T);if(Object.getOwnPropertySymbols){var _=Object.getOwnPropertySymbols(T);P&&(_=_.filter(function(S){return Object.getOwnPropertyDescriptor(T,S).enumerable})),I.push.apply(I,_)}return I}function e(T){for(var P=1;P<arguments.length;P++){var I=arguments[P]!=null?arguments[P]:{};P%2?t(Object(I),!0).forEach(function(_){n(T,_,I[_])}):Object.getOwnPropertyDescriptors?Object.defineProperties(T,Object.getOwnPropertyDescriptors(I)):t(Object(I)).forEach(function(_){Object.defineProperty(T,_,Object.getOwnPropertyDescriptor(I,_))})}return T}function n(T,P,I){return P=o(P),P in T?Object.defineProperty(T,P,{value:I,enumerable:!0,configurable:!0,writable:!0}):T[P]=I,T}function r(T,P){if(!(T instanceof P))throw new TypeError("Cannot call a class as a function")}function i(T,P){for(var I=0;I<P.length;I++){var _=P[I];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(T,o(_.key),_)}}function s(T,P,I){return P&&i(T.prototype,P),Object.defineProperty(T,"prototype",{writable:!1}),T}function o(T){var P=a(T,"string");return typeof P=="symbol"?P:String(P)}function a(T,P){if(typeof T!="object"||T===null)return T;var I=T[Symbol.toPrimitive];if(I!==void 0){var _=I.call(T,P||"default");if(typeof _!="object")return _;throw new TypeError("@@toPrimitive must return a primitive value.")}return(P==="string"?String:Number)(T)}var l=$t(),c=l.Buffer,f=L,p=f.inspect,g=p&&p.custom||"inspect";function y(T,P,I){c.prototype.copy.call(T,P,I)}return Sa=(function(){function T(){r(this,T),this.head=null,this.tail=null,this.length=0}return s(T,[{key:"push",value:function(I){var _={data:I,next:null};this.length>0?this.tail.next=_:this.head=_,this.tail=_,++this.length}},{key:"unshift",value:function(I){var _={data:I,next:this.head};this.length===0&&(this.tail=_),this.head=_,++this.length}},{key:"shift",value:function(){if(this.length!==0){var I=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,I}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(I){if(this.length===0)return"";for(var _=this.head,S=""+_.data;_=_.next;)S+=I+_.data;return S}},{key:"concat",value:function(I){if(this.length===0)return c.alloc(0);for(var _=c.allocUnsafe(I>>>0),S=this.head,B=0;S;)y(S.data,_,B),B+=S.data.length,S=S.next;return _}},{key:"consume",value:function(I,_){var S;return I<this.head.data.length?(S=this.head.data.slice(0,I),this.head.data=this.head.data.slice(I)):I===this.head.data.length?S=this.shift():S=_?this._getString(I):this._getBuffer(I),S}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(I){var _=this.head,S=1,B=_.data;for(I-=B.length;_=_.next;){var D=_.data,$=I>D.length?D.length:I;if($===D.length?B+=D:B+=D.slice(0,I),I-=$,I===0){$===D.length?(++S,_.next?this.head=_.next:this.head=this.tail=null):(this.head=_,_.data=D.slice($));break}++S}return this.length-=S,B}},{key:"_getBuffer",value:function(I){var _=c.allocUnsafe(I),S=this.head,B=1;for(S.data.copy(_),I-=S.data.length;S=S.next;){var D=S.data,$=I>D.length?D.length:I;if(D.copy(_,_.length-I,0,$),I-=$,I===0){$===D.length?(++B,S.next?this.head=S.next:this.head=this.tail=null):(this.head=S,S.data=D.slice($));break}++B}return this.length-=B,_}},{key:g,value:function(I,_){return p(this,e(e({},_),{},{depth:0,customInspect:!1}))}}]),T})(),Sa}function Nh(){if(ph)return Ea;ph=!0;var t=Mt;function e(a,l){var c=this,f=this._readableState&&this._readableState.destroyed,p=this._writableState&&this._writableState.destroyed;return f||p?(l?l(a):a&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(s,this,a)):t.nextTick(s,this,a)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(a||null,function(g){!l&&g?c._writableState?c._writableState.errorEmitted?t.nextTick(r,c):(c._writableState.errorEmitted=!0,t.nextTick(n,c,g)):t.nextTick(n,c,g):l?(t.nextTick(r,c),l(g)):t.nextTick(r,c)}),this)}function n(a,l){s(a,l),r(a)}function r(a){a._writableState&&!a._writableState.emitClose||a._readableState&&!a._readableState.emitClose||a.emit("close")}function i(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function s(a,l){a.emit("error",l)}function o(a,l){var c=a._readableState,f=a._writableState;c&&c.autoDestroy||f&&f.autoDestroy?a.destroy(l):a.emit("error",l)}return Ea={destroy:e,undestroy:i,errorOrDestroy:o},Ea}function hr(){if(gh)return ka;gh=!0;let t={};function e(o,a,l){l||(l=Error);function c(p,g,y){return typeof a=="string"?a:a(p,g,y)}class f extends l{constructor(g,y,T){super(c(g,y,T))}}f.prototype.name=l.name,f.prototype.code=o,t[o]=f}function n(o,a){if(Array.isArray(o)){let l=o.length;return o=o.map(c=>String(c)),l>2?`one of ${a} ${o.slice(0,l-1).join(", ")}, or `+o[l-1]:l===2?`one of ${a} ${o[0]} or ${o[1]}`:`of ${a} ${o[0]}`}else return`of ${a} ${String(o)}`}function r(o,a,l){return o.substr(0,a.length)===a}function i(o,a,l){return(l===void 0||l>o.length)&&(l=o.length),o.substring(l-a.length,l)===a}function s(o,a,l){return typeof l!="number"&&(l=0),l+a.length>o.length?!1:o.indexOf(a,l)!==-1}return e("ERR_INVALID_OPT_VALUE",function(o,a){return'The value "'+a+'" is invalid for option "'+o+'"'},TypeError),e("ERR_INVALID_ARG_TYPE",function(o,a,l){let c;typeof a=="string"&&r(a,"not ")?(c="must not be",a=a.replace(/^not /,"")):c="must be";let f;if(i(o," argument"))f=`The ${o} ${c} ${n(a,"type")}`;else{let p=s(o,".")?"property":"argument";f=`The "${o}" ${p} ${c} ${n(a,"type")}`}return f+=`. Received type ${typeof l}`,f},TypeError),e("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),e("ERR_METHOD_NOT_IMPLEMENTED",function(o){return"The "+o+" method is not implemented"}),e("ERR_STREAM_PREMATURE_CLOSE","Premature close"),e("ERR_STREAM_DESTROYED",function(o){return"Cannot call "+o+" 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(o){return"Unknown encoding: "+o},TypeError),e("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),ka.codes=t,ka}function Dh(){if(mh)return Aa;mh=!0;var t=hr().codes.ERR_INVALID_OPT_VALUE;function e(r,i,s){return r.highWaterMark!=null?r.highWaterMark:i?r[s]:null}function n(r,i,s,o){var a=e(i,o,s);if(a!=null){if(!(isFinite(a)&&Math.floor(a)===a)||a<0){var l=o?s:"highWaterMark";throw new t(l,a)}return Math.floor(a)}return r.objectMode?16:16*1024}return Aa={getHighWaterMark:n},Aa}function Hh(){if(yh)return Ca;yh=!0;var t=Mt;Ca=Y;function e(R){var C=this;this.next=null,this.entry=null,this.finish=function(){ge(C,R)}}var n;Y.WritableState=Q;var r={deprecate:Ky()},i=Mh(),s=$t().Buffer,o=(typeof hh<"u"?hh:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function a(R){return s.from(R)}function l(R){return s.isBuffer(R)||R instanceof o}var c=Nh(),f=Dh(),p=f.getHighWaterMark,g=hr().codes,y=g.ERR_INVALID_ARG_TYPE,T=g.ERR_METHOD_NOT_IMPLEMENTED,P=g.ERR_MULTIPLE_CALLBACK,I=g.ERR_STREAM_CANNOT_PIPE,_=g.ERR_STREAM_DESTROYED,S=g.ERR_STREAM_NULL_VALUES,B=g.ERR_STREAM_WRITE_AFTER_END,D=g.ERR_UNKNOWN_ENCODING,$=c.errorOrDestroy;Wt()(Y,i);function te(){}function Q(R,C,j){n=n||yr(),R=R||{},typeof j!="boolean"&&(j=C instanceof n),this.objectMode=!!R.objectMode,j&&(this.objectMode=this.objectMode||!!R.writableObjectMode),this.highWaterMark=p(this,R,"writableHighWaterMark",j),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var V=R.decodeStrings===!1;this.decodeStrings=!V,this.defaultEncoding=R.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(ne){Me(C,ne)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=R.emitClose!==!1,this.autoDestroy=!!R.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}Q.prototype.getBuffer=function(){for(var C=this.bufferedRequest,j=[];C;)j.push(C),C=C.next;return j},(function(){try{Object.defineProperty(Q.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var ce;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(ce=Function.prototype[Symbol.hasInstance],Object.defineProperty(Y,Symbol.hasInstance,{value:function(C){return ce.call(this,C)?!0:this!==Y?!1:C&&C._writableState instanceof Q}})):ce=function(C){return C instanceof this};function Y(R){n=n||yr();var C=this instanceof n;if(!C&&!ce.call(Y,this))return new Y(R);this._writableState=new Q(R,this,C),this.writable=!0,R&&(typeof R.write=="function"&&(this._write=R.write),typeof R.writev=="function"&&(this._writev=R.writev),typeof R.destroy=="function"&&(this._destroy=R.destroy),typeof R.final=="function"&&(this._final=R.final)),i.call(this)}Y.prototype.pipe=function(){$(this,new I)};function J(R,C){var j=new B;$(R,j),t.nextTick(C,j)}function Be(R,C,j,V){var ne;return j===null?ne=new S:typeof j!="string"&&!C.objectMode&&(ne=new y("chunk",["string","Buffer"],j)),ne?($(R,ne),t.nextTick(V,ne),!1):!0}Y.prototype.write=function(R,C,j){var V=this._writableState,ne=!1,b=!V.objectMode&&l(R);return b&&!s.isBuffer(R)&&(R=a(R)),typeof C=="function"&&(j=C,C=null),b?C="buffer":C||(C=V.defaultEncoding),typeof j!="function"&&(j=te),V.ending?J(this,j):(b||Be(this,V,R,j))&&(V.pendingcb++,ne=Qe(this,V,b,R,C,j)),ne},Y.prototype.cork=function(){this._writableState.corked++},Y.prototype.uncork=function(){var R=this._writableState;R.corked&&(R.corked--,!R.writing&&!R.corked&&!R.bufferProcessing&&R.bufferedRequest&&se(this,R))},Y.prototype.setDefaultEncoding=function(C){if(typeof C=="string"&&(C=C.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((C+"").toLowerCase())>-1))throw new D(C);return this._writableState.defaultEncoding=C,this},Object.defineProperty(Y.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function We(R,C,j){return!R.objectMode&&R.decodeStrings!==!1&&typeof C=="string"&&(C=s.from(C,j)),C}Object.defineProperty(Y.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Qe(R,C,j,V,ne,b){if(!j){var x=We(C,V,ne);V!==x&&(j=!0,ne="buffer",V=x)}var F=C.objectMode?1:V.length;C.length+=F;var X=C.length<C.highWaterMark;if(X||(C.needDrain=!0),C.writing||C.corked){var ke=C.lastBufferedRequest;C.lastBufferedRequest={chunk:V,encoding:ne,isBuf:j,callback:b,next:null},ke?ke.next=C.lastBufferedRequest:C.bufferedRequest=C.lastBufferedRequest,C.bufferedRequestCount+=1}else qe(R,C,!1,F,V,ne,b);return X}function qe(R,C,j,V,ne,b,x){C.writelen=V,C.writecb=x,C.writing=!0,C.sync=!0,C.destroyed?C.onwrite(new _("write")):j?R._writev(ne,C.onwrite):R._write(ne,b,C.onwrite),C.sync=!1}function Ge(R,C,j,V,ne){--C.pendingcb,j?(t.nextTick(ne,V),t.nextTick(W,R,C),R._writableState.errorEmitted=!0,$(R,V)):(ne(V),R._writableState.errorEmitted=!0,$(R,V),W(R,C))}function pt(R){R.writing=!1,R.writecb=null,R.length-=R.writelen,R.writelen=0}function Me(R,C){var j=R._writableState,V=j.sync,ne=j.writecb;if(typeof ne!="function")throw new P;if(pt(j),C)Ge(R,j,V,C,ne);else{var b=de(j)||R.destroyed;!b&&!j.corked&&!j.bufferProcessing&&j.bufferedRequest&&se(R,j),V?t.nextTick(ve,R,j,b,ne):ve(R,j,b,ne)}}function ve(R,C,j,V){j||we(R,C),C.pendingcb--,V(),W(R,C)}function we(R,C){C.length===0&&C.needDrain&&(C.needDrain=!1,R.emit("drain"))}function se(R,C){C.bufferProcessing=!0;var j=C.bufferedRequest;if(R._writev&&j&&j.next){var V=C.bufferedRequestCount,ne=new Array(V),b=C.corkedRequestsFree;b.entry=j;for(var x=0,F=!0;j;)ne[x]=j,j.isBuf||(F=!1),j=j.next,x+=1;ne.allBuffers=F,qe(R,C,!0,C.length,ne,"",b.finish),C.pendingcb++,C.lastBufferedRequest=null,b.next?(C.corkedRequestsFree=b.next,b.next=null):C.corkedRequestsFree=new e(C),C.bufferedRequestCount=0}else{for(;j;){var X=j.chunk,ke=j.encoding,me=j.callback,U=C.objectMode?1:X.length;if(qe(R,C,!1,U,X,ke,me),j=j.next,C.bufferedRequestCount--,C.writing)break}j===null&&(C.lastBufferedRequest=null)}C.bufferedRequest=j,C.bufferProcessing=!1}Y.prototype._write=function(R,C,j){j(new T("_write()"))},Y.prototype._writev=null,Y.prototype.end=function(R,C,j){var V=this._writableState;return typeof R=="function"?(j=R,R=null,C=null):typeof C=="function"&&(j=C,C=null),R!=null&&this.write(R,C),V.corked&&(V.corked=1,this.uncork()),V.ending||le(this,V,j),this},Object.defineProperty(Y.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function de(R){return R.ending&&R.length===0&&R.bufferedRequest===null&&!R.finished&&!R.writing}function N(R,C){R._final(function(j){C.pendingcb--,j&&$(R,j),C.prefinished=!0,R.emit("prefinish"),W(R,C)})}function Z(R,C){!C.prefinished&&!C.finalCalled&&(typeof R._final=="function"&&!C.destroyed?(C.pendingcb++,C.finalCalled=!0,t.nextTick(N,R,C)):(C.prefinished=!0,R.emit("prefinish")))}function W(R,C){var j=de(C);if(j&&(Z(R,C),C.pendingcb===0&&(C.finished=!0,R.emit("finish"),C.autoDestroy))){var V=R._readableState;(!V||V.autoDestroy&&V.endEmitted)&&R.destroy()}return j}function le(R,C,j){C.ending=!0,W(R,C),j&&(C.finished?t.nextTick(j):R.once("finish",j)),C.ended=!0,R.writable=!1}function ge(R,C,j){var V=R.entry;for(R.entry=null;V;){var ne=V.callback;C.pendingcb--,ne(j),V=V.next}C.corkedRequestsFree.next=R}return Object.defineProperty(Y.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(C){this._writableState&&(this._writableState.destroyed=C)}}),Y.prototype.destroy=c.destroy,Y.prototype._undestroy=c.undestroy,Y.prototype._destroy=function(R,C){C(R)},Ca}function yr(){if(Th)return Oa;Th=!0;var t=Mt,e=Object.keys||function(f){var p=[];for(var g in f)p.push(g);return p};Oa=a;var n=Uh(),r=Hh();Wt()(a,n);for(var i=e(r.prototype),s=0;s<i.length;s++){var o=i[s];a.prototype[o]||(a.prototype[o]=r.prototype[o])}function a(f){if(!(this instanceof a))return new a(f);n.call(this,f),r.call(this,f),this.allowHalfOpen=!0,f&&(f.readable===!1&&(this.readable=!1),f.writable===!1&&(this.writable=!1),f.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",l)))}Object.defineProperty(a.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(a.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(a.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function l(){this._writableState.ended||t.nextTick(c,this)}function c(f){f.end()}return Object.defineProperty(a.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(p){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=p,this._writableState.destroyed=p)}}),Oa}function Ka(){if(vh)return Ra;vh=!0;var t=hr().codes.ERR_STREAM_PREMATURE_CLOSE;function e(s){var o=!1;return function(){if(!o){o=!0;for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];s.apply(this,l)}}}function n(){}function r(s){return s.setHeader&&typeof s.abort=="function"}function i(s,o,a){if(typeof o=="function")return i(s,null,o);o||(o={}),a=e(a||n);var l=o.readable||o.readable!==!1&&s.readable,c=o.writable||o.writable!==!1&&s.writable,f=function(){s.writable||g()},p=s._writableState&&s._writableState.finished,g=function(){c=!1,p=!0,l||a.call(s)},y=s._readableState&&s._readableState.endEmitted,T=function(){l=!1,y=!0,c||a.call(s)},P=function(B){a.call(s,B)},I=function(){var B;if(l&&!y)return(!s._readableState||!s._readableState.ended)&&(B=new t),a.call(s,B);if(c&&!p)return(!s._writableState||!s._writableState.ended)&&(B=new t),a.call(s,B)},_=function(){s.req.on("finish",g)};return r(s)?(s.on("complete",g),s.on("abort",I),s.req?_():s.on("request",_)):c&&!s._writableState&&(s.on("end",f),s.on("close",f)),s.on("end",T),s.on("finish",g),o.error!==!1&&s.on("error",P),s.on("close",I),function(){s.removeListener("complete",g),s.removeListener("abort",I),s.removeListener("request",_),s.req&&s.req.removeListener("finish",g),s.removeListener("end",f),s.removeListener("close",f),s.removeListener("finish",g),s.removeListener("end",T),s.removeListener("error",P),s.removeListener("close",I)}}return Ra=i,Ra}function kE(){if(_h)return Ma;_h=!0;var t=Mt,e;function n(D,$,te){return $=r($),$ in D?Object.defineProperty(D,$,{value:te,enumerable:!0,configurable:!0,writable:!0}):D[$]=te,D}function r(D){var $=i(D,"string");return typeof $=="symbol"?$:String($)}function i(D,$){if(typeof D!="object"||D===null)return D;var te=D[Symbol.toPrimitive];if(te!==void 0){var Q=te.call(D,$||"default");if(typeof Q!="object")return Q;throw new TypeError("@@toPrimitive must return a primitive value.")}return($==="string"?String:Number)(D)}var s=Ka(),o=Symbol("lastResolve"),a=Symbol("lastReject"),l=Symbol("error"),c=Symbol("ended"),f=Symbol("lastPromise"),p=Symbol("handlePromise"),g=Symbol("stream");function y(D,$){return{value:D,done:$}}function T(D){var $=D[o];if($!==null){var te=D[g].read();te!==null&&(D[f]=null,D[o]=null,D[a]=null,$(y(te,!1)))}}function P(D){t.nextTick(T,D)}function I(D,$){return function(te,Q){D.then(function(){if($[c]){te(y(void 0,!0));return}$[p](te,Q)},Q)}}var _=Object.getPrototypeOf(function(){}),S=Object.setPrototypeOf((e={get stream(){return this[g]},next:function(){var $=this,te=this[l];if(te!==null)return Promise.reject(te);if(this[c])return Promise.resolve(y(void 0,!0));if(this[g].destroyed)return new Promise(function(J,Be){t.nextTick(function(){$[l]?Be($[l]):J(y(void 0,!0))})});var Q=this[f],ce;if(Q)ce=new Promise(I(Q,this));else{var Y=this[g].read();if(Y!==null)return Promise.resolve(y(Y,!1));ce=new Promise(this[p])}return this[f]=ce,ce}},n(e,Symbol.asyncIterator,function(){return this}),n(e,"return",function(){var $=this;return new Promise(function(te,Q){$[g].destroy(null,function(ce){if(ce){Q(ce);return}te(y(void 0,!0))})})}),e),_),B=function($){var te,Q=Object.create(S,(te={},n(te,g,{value:$,writable:!0}),n(te,o,{value:null,writable:!0}),n(te,a,{value:null,writable:!0}),n(te,l,{value:null,writable:!0}),n(te,c,{value:$._readableState.endEmitted,writable:!0}),n(te,p,{value:function(Y,J){var Be=Q[g].read();Be?(Q[f]=null,Q[o]=null,Q[a]=null,Y(y(Be,!1))):(Q[o]=Y,Q[a]=J)},writable:!0}),te));return Q[f]=null,s($,function(ce){if(ce&&ce.code!=="ERR_STREAM_PREMATURE_CLOSE"){var Y=Q[a];Y!==null&&(Q[f]=null,Q[o]=null,Q[a]=null,Y(ce)),Q[l]=ce;return}var J=Q[o];J!==null&&(Q[f]=null,Q[o]=null,Q[a]=null,J(y(void 0,!0))),Q[c]=!0}),$.on("readable",P.bind(null,Q)),Q};return Ma=B,Ma}function AE(){return bh||(bh=!0,Na=function(){throw new Error("Readable.from is not available in the browser")}),Na}function Uh(){if(wh)return Da;wh=!0;var t=Mt;Da=J;var e;J.ReadableState=Y,yt.EventEmitter;var n=function(x,F){return x.listeners(F).length},r=Mh(),i=$t().Buffer,s=(typeof xh<"u"?xh:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function o(b){return i.from(b)}function a(b){return i.isBuffer(b)||b instanceof s}var l=L,c;l&&l.debuglog?c=l.debuglog("stream"):c=function(){};var f=EE(),p=Nh(),g=Dh(),y=g.getHighWaterMark,T=hr().codes,P=T.ERR_INVALID_ARG_TYPE,I=T.ERR_STREAM_PUSH_AFTER_EOF,_=T.ERR_METHOD_NOT_IMPLEMENTED,S=T.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,B,D,$;Wt()(J,r);var te=p.errorOrDestroy,Q=["error","close","destroy","pause","resume"];function ce(b,x,F){if(typeof b.prependListener=="function")return b.prependListener(x,F);!b._events||!b._events[x]?b.on(x,F):Array.isArray(b._events[x])?b._events[x].unshift(F):b._events[x]=[F,b._events[x]]}function Y(b,x,F){e=e||yr(),b=b||{},typeof F!="boolean"&&(F=x instanceof e),this.objectMode=!!b.objectMode,F&&(this.objectMode=this.objectMode||!!b.readableObjectMode),this.highWaterMark=y(this,b,"readableHighWaterMark",F),this.buffer=new f,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=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&&(B||(B=ii.StringDecoder),this.decoder=new B(b.encoding),this.encoding=b.encoding)}function J(b){if(e=e||yr(),!(this instanceof J))return new J(b);var x=this instanceof e;this._readableState=new Y(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(J.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(x){this._readableState&&(this._readableState.destroyed=x)}}),J.prototype.destroy=p.destroy,J.prototype._undestroy=p.undestroy,J.prototype._destroy=function(b,x){x(b)},J.prototype.push=function(b,x){var F=this._readableState,X;return F.objectMode?X=!0:typeof b=="string"&&(x=x||F.defaultEncoding,x!==F.encoding&&(b=i.from(b,x),x=""),X=!0),Be(this,b,x,!1,X)},J.prototype.unshift=function(b){return Be(this,b,null,!0,!1)};function Be(b,x,F,X,ke){c("readableAddChunk",x);var me=b._readableState;if(x===null)me.reading=!1,Me(b,me);else{var U;if(ke||(U=Qe(me,x)),U)te(b,U);else if(me.objectMode||x&&x.length>0)if(typeof x!="string"&&!me.objectMode&&Object.getPrototypeOf(x)!==i.prototype&&(x=o(x)),X)me.endEmitted?te(b,new S):We(b,me,x,!0);else if(me.ended)te(b,new I);else{if(me.destroyed)return!1;me.reading=!1,me.decoder&&!F?(x=me.decoder.write(x),me.objectMode||x.length!==0?We(b,me,x,!1):se(b,me)):We(b,me,x,!1)}else X||(me.reading=!1,se(b,me))}return!me.ended&&(me.length<me.highWaterMark||me.length===0)}function We(b,x,F,X){x.flowing&&x.length===0&&!x.sync?(x.awaitDrain=0,b.emit("data",F)):(x.length+=x.objectMode?1:F.length,X?x.buffer.unshift(F):x.buffer.push(F),x.needReadable&&ve(b)),se(b,x)}function Qe(b,x){var F;return!a(x)&&typeof x!="string"&&x!==void 0&&!b.objectMode&&(F=new P("chunk",["string","Buffer","Uint8Array"],x)),F}J.prototype.isPaused=function(){return this._readableState.flowing===!1},J.prototype.setEncoding=function(b){B||(B=ii.StringDecoder);var x=new B(b);this._readableState.decoder=x,this._readableState.encoding=this._readableState.decoder.encoding;for(var F=this._readableState.buffer.head,X="";F!==null;)X+=x.write(F.data),F=F.next;return this._readableState.buffer.clear(),X!==""&&this._readableState.buffer.push(X),this._readableState.length=X.length,this};var qe=1073741824;function Ge(b){return b>=qe?b=qe:(b--,b|=b>>>1,b|=b>>>2,b|=b>>>4,b|=b>>>8,b|=b>>>16,b++),b}function pt(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=Ge(b)),b<=x.length?b:x.ended?x.length:(x.needReadable=!0,0))}J.prototype.read=function(b){c("read",b),b=parseInt(b,10);var x=this._readableState,F=b;if(b!==0&&(x.emittedReadable=!1),b===0&&x.needReadable&&((x.highWaterMark!==0?x.length>=x.highWaterMark:x.length>0)||x.ended))return c("read: emitReadable",x.length,x.ended),x.length===0&&x.ended?j(this):ve(this),null;if(b=pt(b,x),b===0&&x.ended)return x.length===0&&j(this),null;var X=x.needReadable;c("need readable",X),(x.length===0||x.length-b<x.highWaterMark)&&(X=!0,c("length less than watermark",X)),x.ended||x.reading?(X=!1,c("reading or ended",X)):X&&(c("do read"),x.reading=!0,x.sync=!0,x.length===0&&(x.needReadable=!0),this._read(x.highWaterMark),x.sync=!1,x.reading||(b=pt(F,x)));var ke;return b>0?ke=C(b,x):ke=null,ke===null?(x.needReadable=x.length<=x.highWaterMark,b=0):(x.length-=b,x.awaitDrain=0),x.length===0&&(x.ended||(x.needReadable=!0),F!==b&&x.ended&&j(this)),ke!==null&&this.emit("data",ke),ke};function Me(b,x){if(c("onEofChunk"),!x.ended){if(x.decoder){var F=x.decoder.end();F&&F.length&&(x.buffer.push(F),x.length+=x.objectMode?1:F.length)}x.ended=!0,x.sync?ve(b):(x.needReadable=!1,x.emittedReadable||(x.emittedReadable=!0,we(b)))}}function ve(b){var x=b._readableState;c("emitReadable",x.needReadable,x.emittedReadable),x.needReadable=!1,x.emittedReadable||(c("emitReadable",x.flowing),x.emittedReadable=!0,t.nextTick(we,b))}function we(b){var x=b._readableState;c("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,R(b)}function se(b,x){x.readingMore||(x.readingMore=!0,t.nextTick(de,b,x))}function de(b,x){for(;!x.reading&&!x.ended&&(x.length<x.highWaterMark||x.flowing&&x.length===0);){var F=x.length;if(c("maybeReadMore read 0"),b.read(0),F===x.length)break}x.readingMore=!1}J.prototype._read=function(b){te(this,new _("_read()"))},J.prototype.pipe=function(b,x){var F=this,X=this._readableState;switch(X.pipesCount){case 0:X.pipes=b;break;case 1:X.pipes=[X.pipes,b];break;default:X.pipes.push(b);break}X.pipesCount+=1,c("pipe count=%d opts=%j",X.pipesCount,x);var ke=(!x||x.end!==!1)&&b!==t.stdout&&b!==t.stderr,me=ke?At:u;X.endEmitted?t.nextTick(me):F.once("end",me),b.on("unpipe",U);function U(d,v){c("onunpipe"),d===F&&v&&v.hasUnpiped===!1&&(v.hasUnpiped=!0,vr())}function At(){c("onend"),b.end()}var jt=N(F);b.on("drain",jt);var _t=!1;function vr(){c("cleanup"),b.removeListener("close",_r),b.removeListener("finish",h),b.removeListener("drain",jt),b.removeListener("error",Pt),b.removeListener("unpipe",U),F.removeListener("end",At),F.removeListener("end",u),F.removeListener("data",gi),_t=!0,X.awaitDrain&&(!b._writableState||b._writableState.needDrain)&&jt()}F.on("data",gi);function gi(d){c("ondata");var v=b.write(d);c("dest.write",v),v===!1&&((X.pipesCount===1&&X.pipes===b||X.pipesCount>1&&ne(X.pipes,b)!==-1)&&!_t&&(c("false write response, pause",X.awaitDrain),X.awaitDrain++),F.pause())}function Pt(d){c("onerror",d),u(),b.removeListener("error",Pt),n(b,"error")===0&&te(b,d)}ce(b,"error",Pt);function _r(){b.removeListener("finish",h),u()}b.once("close",_r);function h(){c("onfinish"),b.removeListener("close",_r),u()}b.once("finish",h);function u(){c("unpipe"),F.unpipe(b)}return b.emit("pipe",F),X.flowing||(c("pipe resume"),F.resume()),b};function N(b){return function(){var F=b._readableState;c("pipeOnDrain",F.awaitDrain),F.awaitDrain&&F.awaitDrain--,F.awaitDrain===0&&n(b,"data")&&(F.flowing=!0,R(b))}}J.prototype.unpipe=function(b){var x=this._readableState,F={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,F),this);if(!b){var X=x.pipes,ke=x.pipesCount;x.pipes=null,x.pipesCount=0,x.flowing=!1;for(var me=0;me<ke;me++)X[me].emit("unpipe",this,{hasUnpiped:!1});return this}var U=ne(x.pipes,b);return U===-1?this:(x.pipes.splice(U,1),x.pipesCount-=1,x.pipesCount===1&&(x.pipes=x.pipes[0]),b.emit("unpipe",this,F),this)},J.prototype.on=function(b,x){var F=r.prototype.on.call(this,b,x),X=this._readableState;return b==="data"?(X.readableListening=this.listenerCount("readable")>0,X.flowing!==!1&&this.resume()):b==="readable"&&!X.endEmitted&&!X.readableListening&&(X.readableListening=X.needReadable=!0,X.flowing=!1,X.emittedReadable=!1,c("on readable",X.length,X.reading),X.length?ve(this):X.reading||t.nextTick(W,this)),F},J.prototype.addListener=J.prototype.on,J.prototype.removeListener=function(b,x){var F=r.prototype.removeListener.call(this,b,x);return b==="readable"&&t.nextTick(Z,this),F},J.prototype.removeAllListeners=function(b){var x=r.prototype.removeAllListeners.apply(this,arguments);return(b==="readable"||b===void 0)&&t.nextTick(Z,this),x};function Z(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 W(b){c("readable nexttick read 0"),b.read(0)}J.prototype.resume=function(){var b=this._readableState;return b.flowing||(c("resume"),b.flowing=!b.readableListening,le(this,b)),b.paused=!1,this};function le(b,x){x.resumeScheduled||(x.resumeScheduled=!0,t.nextTick(ge,b,x))}function ge(b,x){c("resume",x.reading),x.reading||b.read(0),x.resumeScheduled=!1,b.emit("resume"),R(b),x.flowing&&!x.reading&&b.read(0)}J.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function R(b){var x=b._readableState;for(c("flow",x.flowing);x.flowing&&b.read()!==null;);}J.prototype.wrap=function(b){var x=this,F=this._readableState,X=!1;b.on("end",function(){if(c("wrapped end"),F.decoder&&!F.ended){var U=F.decoder.end();U&&U.length&&x.push(U)}x.push(null)}),b.on("data",function(U){if(c("wrapped data"),F.decoder&&(U=F.decoder.write(U)),!(F.objectMode&&U==null)&&!(!F.objectMode&&(!U||!U.length))){var At=x.push(U);At||(X=!0,b.pause())}});for(var ke in b)this[ke]===void 0&&typeof b[ke]=="function"&&(this[ke]=(function(At){return function(){return b[At].apply(b,arguments)}})(ke));for(var me=0;me<Q.length;me++)b.on(Q[me],this.emit.bind(this,Q[me]));return this._read=function(U){c("wrapped _read",U),X&&(X=!1,b.resume())},this},typeof Symbol=="function"&&(J.prototype[Symbol.asyncIterator]=function(){return D===void 0&&(D=kE()),D(this)}),Object.defineProperty(J.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(J.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(J.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(x){this._readableState&&(this._readableState.flowing=x)}}),J._fromList=C,Object.defineProperty(J.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function C(b,x){if(x.length===0)return null;var F;return x.objectMode?F=x.buffer.shift():!b||b>=x.length?(x.decoder?F=x.buffer.join(""):x.buffer.length===1?F=x.buffer.first():F=x.buffer.concat(x.length),x.buffer.clear()):F=x.buffer.consume(b,x.decoder),F}function j(b){var x=b._readableState;c("endReadable",x.endEmitted),x.endEmitted||(x.ended=!0,t.nextTick(V,x,b))}function V(b,x){if(c("endReadableNT",b.endEmitted,b.length),!b.endEmitted&&b.length===0&&(b.endEmitted=!0,x.readable=!1,x.emit("end"),b.autoDestroy)){var F=x._writableState;(!F||F.autoDestroy&&F.finished)&&x.destroy()}}typeof Symbol=="function"&&(J.from=function(b,x){return $===void 0&&($=AE()),$(J,b,x)});function ne(b,x){for(var F=0,X=b.length;F<X;F++)if(b[F]===x)return F;return-1}return Da}function jh(){if(Ph)return Ha;Ph=!0,Ha=a;var t=hr().codes,e=t.ERR_METHOD_NOT_IMPLEMENTED,n=t.ERR_MULTIPLE_CALLBACK,r=t.ERR_TRANSFORM_ALREADY_TRANSFORMING,i=t.ERR_TRANSFORM_WITH_LENGTH_0,s=yr();Wt()(a,s);function o(f,p){var g=this._transformState;g.transforming=!1;var y=g.writecb;if(y===null)return this.emit("error",new n);g.writechunk=null,g.writecb=null,p!=null&&this.push(p),y(f);var T=this._readableState;T.reading=!1,(T.needReadable||T.length<T.highWaterMark)&&this._read(T.highWaterMark)}function a(f){if(!(this instanceof a))return new a(f);s.call(this,f),this._transformState={afterTransform:o.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,f&&(typeof f.transform=="function"&&(this._transform=f.transform),typeof f.flush=="function"&&(this._flush=f.flush)),this.on("prefinish",l)}function l(){var f=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(p,g){c(f,p,g)}):c(this,null,null)}a.prototype.push=function(f,p){return this._transformState.needTransform=!1,s.prototype.push.call(this,f,p)},a.prototype._transform=function(f,p,g){g(new e("_transform()"))},a.prototype._write=function(f,p,g){var y=this._transformState;if(y.writecb=g,y.writechunk=f,y.writeencoding=p,!y.transforming){var T=this._readableState;(y.needTransform||T.needReadable||T.length<T.highWaterMark)&&this._read(T.highWaterMark)}},a.prototype._read=function(f){var p=this._transformState;p.writechunk!==null&&!p.transforming?(p.transforming=!0,this._transform(p.writechunk,p.writeencoding,p.afterTransform)):p.needTransform=!0},a.prototype._destroy=function(f,p){s.prototype._destroy.call(this,f,function(g){p(g)})};function c(f,p,g){if(p)return f.emit("error",p);if(g!=null&&f.push(g),f._writableState.length)throw new i;if(f._transformState.transforming)throw new r;return f.push(null)}return Ha}function CE(){if(Ih)return Ua;Ih=!0,Ua=e;var t=jh();Wt()(e,t);function e(n){if(!(this instanceof e))return new e(n);t.call(this,n)}return e.prototype._transform=function(n,r,i){i(null,n)},Ua}function OE(){if(Bh)return ja;Bh=!0;var t;function e(g){var y=!1;return function(){y||(y=!0,g.apply(void 0,arguments))}}var n=hr().codes,r=n.ERR_MISSING_ARGS,i=n.ERR_STREAM_DESTROYED;function s(g){if(g)throw g}function o(g){return g.setHeader&&typeof g.abort=="function"}function a(g,y,T,P){P=e(P);var I=!1;g.on("close",function(){I=!0}),t===void 0&&(t=Ka()),t(g,{readable:y,writable:T},function(S){if(S)return P(S);I=!0,P()});var _=!1;return function(S){if(!I&&!_){if(_=!0,o(g))return g.abort();if(typeof g.destroy=="function")return g.destroy();P(S||new i("pipe"))}}}function l(g){g()}function c(g,y){return g.pipe(y)}function f(g){return!g.length||typeof g[g.length-1]!="function"?s:g.pop()}function p(){for(var g=arguments.length,y=new Array(g),T=0;T<g;T++)y[T]=arguments[T];var P=f(y);if(Array.isArray(y[0])&&(y=y[0]),y.length<2)throw new r("streams");var I,_=y.map(function(S,B){var D=B<y.length-1,$=B>0;return a(S,D,$,function(te){I||(I=te),te&&_.forEach(l),!D&&(_.forEach(l),P(I))})});return y.reduce(c)}return ja=p,ja}function $h(){return Sh||(Sh=!0,Tt=Tt=Uh(),Tt.Stream=Tt,Tt.Readable=Tt,Tt.Writable=Hh(),Tt.Duplex=yr(),Tt.Transform=jh(),Tt.PassThrough=CE(),Tt.finished=Ka(),Tt.pipeline=OE()),Tt}function Zh(){if(Eh)return wo;Eh=!0;var t=$t().Buffer,e=Mt,n=Rh(),r=Wt(),i=$h(),s=wo.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},o=wo.IncomingMessage=function(a,l,c,f){var p=this||xo;if(i.Readable.call(p),p._mode=c,p.headers={},p.rawHeaders=[],p.trailers={},p.rawTrailers=[],p.on("end",function(){e.nextTick(function(){p.emit("close")})}),c==="fetch"){let _=function(){y.read().then(function(S){if(!p._destroyed){if(f(S.done),S.done){p.push(null);return}p.push(t.from(S.value)),_()}}).catch(function(S){f(!0),p._destroyed||p.emit("error",S)})};if(p._fetchResponse=l,p.url=l.url,p.statusCode=l.status,p.statusMessage=l.statusText,l.headers.forEach(function(S,B){p.headers[B.toLowerCase()]=S,p.rawHeaders.push(B,S)}),n.writableStream){var g=new WritableStream({write:function(S){return f(!1),new Promise(function(B,D){p._destroyed?D():p.push(t.from(S))?B():p._resumeFetch=B})},close:function(){f(!0),p._destroyed||p.push(null)},abort:function(S){f(!0),p._destroyed||p.emit("error",S)}});try{l.body.pipeTo(g).catch(function(S){f(!0),p._destroyed||p.emit("error",S)});return}catch{}}var y=l.body.getReader();_()}else{p._xhr=a,p._pos=0,p.url=a.responseURL,p.statusCode=a.status,p.statusMessage=a.statusText;var T=a.getAllResponseHeaders().split(/\r?\n/);if(T.forEach(function(_){var S=_.match(/^([^:]+):\s*(.*)/);if(S){var B=S[1].toLowerCase();B==="set-cookie"?(p.headers[B]===void 0&&(p.headers[B]=[]),p.headers[B].push(S[2])):p.headers[B]!==void 0?p.headers[B]+=", "+S[2]:p.headers[B]=S[2],p.rawHeaders.push(S[1],S[2])}}),p._charset="x-user-defined",!n.overrideMimeType){var P=p.rawHeaders["mime-type"];if(P){var I=P.match(/;\s*charset=([^;])(;|$)/);I&&(p._charset=I[1].toLowerCase())}p._charset||(p._charset="utf-8")}}};return r(o,i.Readable),o.prototype._read=function(){var a=this||xo,l=a._resumeFetch;l&&(a._resumeFetch=null,l())},o.prototype._onXHRProgress=function(a){var l=this||xo,c=l._xhr,f=null;switch(l._mode){case"text":if(f=c.responseText,f.length>l._pos){var p=f.substr(l._pos);if(l._charset==="x-user-defined"){for(var g=t.alloc(p.length),y=0;y<p.length;y++)g[y]=p.charCodeAt(y)&255;l.push(g)}else l.push(p,l._charset);l._pos=f.length}break;case"arraybuffer":if(c.readyState!==s.DONE||!c.response)break;f=c.response,l.push(t.from(new Uint8Array(f)));break;case"moz-chunked-arraybuffer":if(f=c.response,c.readyState!==s.LOADING||!f)break;l.push(t.from(new Uint8Array(f)));break;case"ms-stream":if(f=c.response,c.readyState!==s.LOADING)break;var T=new xo.MSStreamReader;T.onprogress=function(){T.result.byteLength>l._pos&&(l.push(t.from(new Uint8Array(T.result.slice(l._pos)))),l._pos=T.result.byteLength)},T.onload=function(){a(!0),l.push(null)},T.readAsArrayBuffer(f);break}l._xhr.readyState===s.DONE&&l._mode!=="ms-stream"&&(a(!0),l.push(null))},wo}function RE(){if(kh)return $a;kh=!0;var t=$t().Buffer,e=Mt,n=Rh(),r=Wt(),i=Zh(),s=$h(),o=i.IncomingMessage,a=i.readyStates;function l(g,y){return n.fetch&&y?"fetch":n.mozchunkedarraybuffer?"moz-chunked-arraybuffer":n.msstream?"ms-stream":n.arraybuffer&&g?"arraybuffer":"text"}var c=$a=function(g){var y=this||it;s.Writable.call(y),y._opts=g,y._body=[],y._headers={},g.auth&&y.setHeader("Authorization","Basic "+t.from(g.auth).toString("base64")),Object.keys(g.headers).forEach(function(I){y.setHeader(I,g.headers[I])});var T,P=!0;if(g.mode==="disable-fetch"||"requestTimeout"in g&&!n.abortController)P=!1,T=!0;else if(g.mode==="prefer-streaming")T=!1;else if(g.mode==="allow-wrong-content-type")T=!n.overrideMimeType;else if(!g.mode||g.mode==="default"||g.mode==="prefer-fast")T=!0;else throw new Error("Invalid value for opts.mode");y._mode=l(T,P),y._fetchTimer=null,y._socketTimeout=null,y._socketTimer=null,y.on("finish",function(){y._onFinish()})};r(c,s.Writable),c.prototype.setHeader=function(g,y){var T=this||it,P=g.toLowerCase();p.indexOf(P)===-1&&(T._headers[P]={name:g,value:y})},c.prototype.getHeader=function(g){var y=(this||it)._headers[g.toLowerCase()];return y?y.value:null},c.prototype.removeHeader=function(g){var y=this||it;delete y._headers[g.toLowerCase()]},c.prototype._onFinish=function(){var g=this||it;if(!g._destroyed){var y=g._opts;"timeout"in y&&y.timeout!==0&&g.setTimeout(y.timeout);var T=g._headers,P=null;y.method!=="GET"&&y.method!=="HEAD"&&(P=new Blob(g._body,{type:(T["content-type"]||{}).value||""}));var I=[];if(Object.keys(T).forEach(function(D){var $=T[D].name,te=T[D].value;Array.isArray(te)?te.forEach(function(Q){I.push([$,Q])}):I.push([$,te])}),g._mode==="fetch"){var _=null;if(n.abortController){var S=new AbortController;_=S.signal,g._fetchAbortController=S,"requestTimeout"in y&&y.requestTimeout!==0&&(g._fetchTimer=it.setTimeout(function(){g.emit("requestTimeout"),g._fetchAbortController&&g._fetchAbortController.abort()},y.requestTimeout))}it.fetch(g._opts.url,{method:g._opts.method,headers:I,body:P||void 0,mode:"cors",credentials:y.withCredentials?"include":"same-origin",signal:_}).then(function(D){g._fetchResponse=D,g._resetTimers(!1),g._connect()},function(D){g._resetTimers(!0),g._destroyed||g.emit("error",D)})}else{var B=g._xhr=new it.XMLHttpRequest;try{B.open(g._opts.method,g._opts.url,!0)}catch(D){e.nextTick(function(){g.emit("error",D)});return}"responseType"in B&&(B.responseType=g._mode),"withCredentials"in B&&(B.withCredentials=!!y.withCredentials),g._mode==="text"&&"overrideMimeType"in B&&B.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in y&&(B.timeout=y.requestTimeout,B.ontimeout=function(){g.emit("requestTimeout")}),I.forEach(function(D){B.setRequestHeader(D[0],D[1])}),g._response=null,B.onreadystatechange=function(){switch(B.readyState){case a.LOADING:case a.DONE:g._onXHRProgress();break}},g._mode==="moz-chunked-arraybuffer"&&(B.onprogress=function(){g._onXHRProgress()}),B.onerror=function(){g._destroyed||(g._resetTimers(!0),g.emit("error",new Error("XHR error")))};try{B.send(P)}catch(D){e.nextTick(function(){g.emit("error",D)});return}}}};function f(g){try{var y=g.status;return y!==null&&y!==0}catch{return!1}}c.prototype._onXHRProgress=function(){var g=this||it;g._resetTimers(!1),!(!f(g._xhr)||g._destroyed)&&(g._response||g._connect(),g._response._onXHRProgress(g._resetTimers.bind(g)))},c.prototype._connect=function(){var g=this||it;g._destroyed||(g._response=new o(g._xhr,g._fetchResponse,g._mode,g._resetTimers.bind(g)),g._response.on("error",function(y){g.emit("error",y)}),g.emit("response",g._response))},c.prototype._write=function(g,y,T){var P=this||it;P._body.push(g),T()},c.prototype._resetTimers=function(g){var y=this||it;it.clearTimeout(y._socketTimer),y._socketTimer=null,g?(it.clearTimeout(y._fetchTimer),y._fetchTimer=null):y._socketTimeout&&(y._socketTimer=it.setTimeout(function(){y.emit("timeout")},y._socketTimeout))},c.prototype.abort=c.prototype.destroy=function(g){var y=this||it;y._destroyed=!0,y._resetTimers(!0),y._response&&(y._response._destroyed=!0),y._xhr?y._xhr.abort():y._fetchAbortController&&y._fetchAbortController.abort(),g&&y.emit("error",g)},c.prototype.end=function(g,y,T){var P=this||it;typeof g=="function"&&(T=g,g=void 0),s.Writable.prototype.end.call(P,g,y,T)},c.prototype.setTimeout=function(g,y){var T=this||it;y&&T.once("timeout",y),T._socketTimeout=g,T._resetTimers(!1)},c.prototype.flushHeaders=function(){},c.prototype.setNoDelay=function(){},c.prototype.setSocketKeepAlive=function(){};var p=["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 $a}function ME(){if(Ah)return Za;Ah=!0,Za=e;var t=Object.prototype.hasOwnProperty;function e(){for(var n={},r=0;r<arguments.length;r++){var i=arguments[r];for(var s in i)t.call(i,s)&&(n[s]=i[s])}return n}return Za}function NE(){return Ch||(Ch=!0,La={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"}),La}function HE(){if(Oh)return Wa;Oh=!0;var t=RE(),e=Zh(),n=ME(),r=NE(),i=Oe,s=Wa;return s.request=function(o,a){typeof o=="string"?o=i.parse(o):o=n(o);var l=DE.location.protocol.search(/^https?:$/)===-1?"http:":"",c=o.protocol||l,f=o.hostname||o.host,p=o.port,g=o.path||"/";f&&f.indexOf(":")!==-1&&(f="["+f+"]"),o.url=(f?c+"//"+f:"")+(p?":"+p:"")+g,o.method=(o.method||"GET").toUpperCase(),o.headers=o.headers||{};var y=new t(o);return a&&y.on("response",a),y},s.get=function(a,l){var c=s.request(a,l);return c.end(),c},s.ClientRequest=t,s.IncomingMessage=e.IncomingMessage,s.Agent=function(){},s.Agent.defaultMaxSockets=4,s.globalAgent=new s.Agent,s.STATUS_CODES=r,s.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"],Wa}var xt,ch,Yn,Ba,dh,Sa,fh,Ea,ph,ka,gh,Aa,mh,Ca,yh,hh,Oa,Th,Ra,vh,Ma,_h,Na,bh,Da,wh,xh,Ha,Ph,Ua,Ih,ja,Bh,Tt,Sh,wo,Eh,xo,$a,kh,it,Za,Ah,La,Ch,Wa,Oh,DE,cn,UE,jE,$E,ZE,LE,WE,KE,FE,Wh=ot(()=>{E();A();k();Vs();iy();Js();vi();$y();_o();fa();Fy();Gy();uh();ha();xt={},ch=!1,Yn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ba={},dh=!1;Sa={},fh=!1;Ea={},ph=!1;ka={},gh=!1;Aa={},mh=!1;Ca={},yh=!1,hh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Oa={},Th=!1;Ra={},vh=!1;Ma={},_h=!1;Na={},bh=!1;Da={},wh=!1,xh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ha={},Ph=!1;Ua={},Ih=!1;ja={},Bh=!1;Tt={},Sh=!1;wo={},Eh=!1,xo=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;$a={},kh=!1,it=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Za={},Ah=!1;La={},Ch=!1;Wa={},Oh=!1,DE=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;cn=HE(),UE=cn.Agent,jE=cn.ClientRequest,$E=cn.IncomingMessage,ZE=cn.METHODS,LE=cn.STATUS_CODES,WE=cn.get,KE=cn.globalAgent,FE=cn.request});E();A();k();var Fm={};pn(Fm,{defaults:()=>FI,markdown:()=>WI,markdownBloc:()=>KI});E();A();k();E();A();k();E();A();k();var us=Object.defineProperty,rv=Object.defineProperties,iv=Object.getOwnPropertyDescriptors,Oi=Object.getOwnPropertySymbols,Fc=Object.prototype.hasOwnProperty,zc=Object.prototype.propertyIsEnumerable,uc=(t,e,n)=>e in t?us(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,w=(t,e)=>{for(var n in e||(e={}))Fc.call(e,n)&&uc(t,n,e[n]);if(Oi)for(var n of Oi(e))zc.call(e,n)&&uc(t,n,e[n]);return t},M=(t,e)=>rv(t,iv(e)),m=(t,e)=>us(t,"name",{value:e,configurable:!0}),qc=(t,e)=>{var n={};for(var r in t)Fc.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Oi)for(var r of Oi(t))e.indexOf(r)<0&&zc.call(t,r)&&(n[r]=t[r]);return n},Rt=(t,e)=>{for(var n in e)us(t,n,{get:e[n],enumerable:!0})},re={};Rt(re,{DIRTY:()=>$s,ERR:()=>js,OK:()=>Hi,any:()=>Nn,array:()=>On,bigint:()=>Gi,boolean:()=>Kn,branded:()=>Us,catch:()=>Ds,coerce:()=>kg,custom:()=>zi,date:()=>Vi,default:()=>Ns,discriminatedUnion:()=>Fr,downstream:()=>Cs,enum:()=>Yi,function:()=>Es,instanceof:()=>vs,intersection:()=>zr,is:()=>Se,lazy:()=>Bs,literal:()=>Kr,map:()=>Is,nan:()=>ws,nativeEnum:()=>xs,never:()=>Wr,null:()=>Jr,nullable:()=>Rs,number:()=>Wn,object:()=>sr,optional:()=>Os,pipeline:()=>Hs,preprocess:()=>ks,promise:()=>Ss,readonly:()=>Ms,record:()=>qr,ref:()=>Ji,set:()=>Xi,strictObject:()=>Ps,string:()=>en,symbol:()=>bs,transforms:()=>Gc,tuple:()=>Yr,undefined:()=>qi,union:()=>Rn,unknown:()=>hn,upstream:()=>As,void:()=>_s,zuiKey:()=>Ae});var Gc={};Rt(Gc,{errors:()=>Ag,fromJSONSchema:()=>Xg,fromJSONSchemaLegacy:()=>kP,fromObject:()=>FP,json:()=>$I,toJSONSchema:()=>Fs,toJSONSchemaLegacy:()=>sI,toTypescriptSchema:()=>qs,toTypescriptType:()=>zs});var tn={};Rt(tn,{DIRTY:()=>$s,ERR:()=>js,OK:()=>Hi,any:()=>Nn,array:()=>On,bigint:()=>Gi,boolean:()=>Kn,branded:()=>Us,catch:()=>Ds,coerce:()=>kg,custom:()=>zi,date:()=>Vi,default:()=>Ns,discriminatedUnion:()=>Fr,downstream:()=>Cs,enum:()=>Yi,function:()=>Es,instanceof:()=>vs,intersection:()=>zr,is:()=>Se,lazy:()=>Bs,literal:()=>Kr,map:()=>Is,nan:()=>ws,nativeEnum:()=>xs,never:()=>Wr,null:()=>Jr,nullable:()=>Rs,number:()=>Wn,object:()=>sr,optional:()=>Os,pipeline:()=>Hs,preprocess:()=>ks,promise:()=>Ss,readonly:()=>Ms,record:()=>qr,ref:()=>Ji,set:()=>Xi,strictObject:()=>Ps,string:()=>en,symbol:()=>bs,tuple:()=>Yr,undefined:()=>qi,union:()=>Rn,unknown:()=>hn,upstream:()=>As,void:()=>_s,zuiKey:()=>Ae});var Ae="x-zui",Ye={};Rt(Ye,{CustomSet:()=>ax});var Lt={};Rt(Lt,{isEqual:()=>pp,unique:()=>ox});var ov=typeof global=="object"&&global&&global.Object===Object&&global,Vc=ov,sv=typeof self=="object"&&self&&self.Object===Object&&self,av=Vc||sv||Function("return this")(),nn=av,lv=nn.Symbol,yn=lv,Jc=Object.prototype,uv=Jc.hasOwnProperty,cv=Jc.toString,wr=yn?yn.toStringTag:void 0;function Yc(t){var e=uv.call(t,wr),n=t[wr];try{t[wr]=void 0;var r=!0}catch{}var i=cv.call(t);return r&&(e?t[wr]=n:delete t[wr]),i}m(Yc,"getRawTag");var dv=Yc,fv=Object.prototype,pv=fv.toString;function Xc(t){return pv.call(t)}m(Xc,"objectToString");var gv=Xc,mv="[object Null]",yv="[object Undefined]",cc=yn?yn.toStringTag:void 0;function Qc(t){return t==null?t===void 0?yv:mv:cc&&cc in Object(t)?dv(t):gv(t)}m(Qc,"baseGetTag");var Dn=Qc;function ed(t){return t!=null&&typeof t=="object"}m(ed,"isObjectLike");var Mn=ed,hv="[object Symbol]";function td(t){return typeof t=="symbol"||Mn(t)&&Dn(t)==hv}m(td,"isSymbol");var cs=td;function nd(t,e){for(var n=-1,r=t==null?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}m(nd,"arrayMap");var rd=nd,Tv=Array.isArray,Qt=Tv,vv=1/0,dc=yn?yn.prototype:void 0,fc=dc?dc.toString:void 0;function ds(t){if(typeof t=="string")return t;if(Qt(t))return rd(t,ds)+"";if(cs(t))return fc?fc.call(t):"";var e=t+"";return e=="0"&&1/t==-vv?"-0":e}m(ds,"baseToString");var _v=ds;function id(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}m(id,"isObject");var or=id;function od(t){return t}m(od,"identity");var bv=od,wv="[object AsyncFunction]",xv="[object Function]",Pv="[object GeneratorFunction]",Iv="[object Proxy]";function sd(t){if(!or(t))return!1;var e=Dn(t);return e==xv||e==Pv||e==wv||e==Iv}m(sd,"isFunction");var ad=sd,Bv=nn["__core-js_shared__"],Uo=Bv,pc=(function(){var t=/[^.]+$/.exec(Uo&&Uo.keys&&Uo.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function ld(t){return!!pc&&pc in t}m(ld,"isMasked");var Sv=ld,Ev=Function.prototype,kv=Ev.toString;function ud(t){if(t!=null){try{return kv.call(t)}catch{}try{return t+""}catch{}}return""}m(ud,"toSource");var Hn=ud,Av=/[\\^$.*+?()[\]{}|]/g,Cv=/^\[object .+?Constructor\]$/,Ov=Function.prototype,Rv=Object.prototype,Mv=Ov.toString,Nv=Rv.hasOwnProperty,Dv=RegExp("^"+Mv.call(Nv).replace(Av,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function cd(t){if(!or(t)||Sv(t))return!1;var e=ad(t)?Dv:Cv;return e.test(Hn(t))}m(cd,"baseIsNative");var Hv=cd;function dd(t,e){return t?.[e]}m(dd,"getValue");var Uv=dd;function fd(t,e){var n=Uv(t,e);return Hv(n)?n:void 0}m(fd,"getNative");var Un=fd,jv=Un(nn,"WeakMap"),Jo=jv,$v=(function(){try{var t=Un(Object,"defineProperty");return t({},"",{}),t}catch{}})(),gc=$v,Zv=9007199254740991,Lv=/^(?:0|[1-9]\d*)$/;function pd(t,e){var n=typeof t;return e=e??Zv,!!e&&(n=="number"||n!="symbol"&&Lv.test(t))&&t>-1&&t%1==0&&t<e}m(pd,"isIndex");var fs=pd;function gd(t,e,n){e=="__proto__"&&gc?gc(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}m(gd,"baseAssignValue");var Wv=gd;function md(t,e){return t===e||t!==t&&e!==e}m(md,"eq");var ps=md,Kv=Object.prototype,Fv=Kv.hasOwnProperty;function yd(t,e,n){var r=t[e];(!(Fv.call(t,e)&&ps(r,n))||n===void 0&&!(e in t))&&Wv(t,e,n)}m(yd,"assignValue");var zv=yd,qv=9007199254740991;function hd(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=qv}m(hd,"isLength");var gs=hd;function Td(t){return t!=null&&gs(t.length)&&!ad(t)}m(Td,"isArrayLike");var vd=Td,Gv=Object.prototype;function _d(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||Gv;return t===n}m(_d,"isPrototype");var bd=_d;function wd(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}m(wd,"baseTimes");var Vv=wd,Jv="[object Arguments]";function xd(t){return Mn(t)&&Dn(t)==Jv}m(xd,"baseIsArguments");var mc=xd,Pd=Object.prototype,Yv=Pd.hasOwnProperty,Xv=Pd.propertyIsEnumerable,Qv=mc((function(){return arguments})())?mc:function(t){return Mn(t)&&Yv.call(t,"callee")&&!Xv.call(t,"callee")},Id=Qv;function Bd(){return!1}m(Bd,"stubFalse");var e_=Bd,Sd=typeof exports=="object"&&exports&&!exports.nodeType&&exports,yc=Sd&&typeof module=="object"&&module&&!module.nodeType&&module,t_=yc&&yc.exports===Sd,hc=t_?nn.Buffer:void 0,n_=hc?hc.isBuffer:void 0,r_=n_||e_,Yo=r_,i_="[object Arguments]",o_="[object Array]",s_="[object Boolean]",a_="[object Date]",l_="[object Error]",u_="[object Function]",c_="[object Map]",d_="[object Number]",f_="[object Object]",p_="[object RegExp]",g_="[object Set]",m_="[object String]",y_="[object WeakMap]",h_="[object ArrayBuffer]",T_="[object DataView]",v_="[object Float32Array]",__="[object Float64Array]",b_="[object Int8Array]",w_="[object Int16Array]",x_="[object Int32Array]",P_="[object Uint8Array]",I_="[object Uint8ClampedArray]",B_="[object Uint16Array]",S_="[object Uint32Array]",Ne={};Ne[v_]=Ne[__]=Ne[b_]=Ne[w_]=Ne[x_]=Ne[P_]=Ne[I_]=Ne[B_]=Ne[S_]=!0;Ne[i_]=Ne[o_]=Ne[h_]=Ne[s_]=Ne[T_]=Ne[a_]=Ne[l_]=Ne[u_]=Ne[c_]=Ne[d_]=Ne[f_]=Ne[p_]=Ne[g_]=Ne[m_]=Ne[y_]=!1;function Ed(t){return Mn(t)&&gs(t.length)&&!!Ne[Dn(t)]}m(Ed,"baseIsTypedArray");var E_=Ed;function kd(t){return function(e){return t(e)}}m(kd,"baseUnary");var k_=kd,Ad=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Hr=Ad&&typeof module=="object"&&module&&!module.nodeType&&module,A_=Hr&&Hr.exports===Ad,jo=A_&&Vc.process,C_=(function(){try{var t=Hr&&Hr.require&&Hr.require("util").types;return t||jo&&jo.binding&&jo.binding("util")}catch{}})(),Tc=C_,vc=Tc&&Tc.isTypedArray,O_=vc?k_(vc):E_,Cd=O_,R_=Object.prototype,M_=R_.hasOwnProperty;function Od(t,e){var n=Qt(t),r=!n&&Id(t),i=!n&&!r&&Yo(t),s=!n&&!r&&!i&&Cd(t),o=n||r||i||s,a=o?Vv(t.length,String):[],l=a.length;for(var c in t)(e||M_.call(t,c))&&!(o&&(c=="length"||i&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||fs(c,l)))&&a.push(c);return a}m(Od,"arrayLikeKeys");var Rd=Od;function Md(t,e){return function(n){return t(e(n))}}m(Md,"overArg");var Nd=Md,N_=Nd(Object.keys,Object),D_=N_,H_=Object.prototype,U_=H_.hasOwnProperty;function Dd(t){if(!bd(t))return D_(t);var e=[];for(var n in Object(t))U_.call(t,n)&&n!="constructor"&&e.push(n);return e}m(Dd,"baseKeys");var j_=Dd;function Hd(t){return vd(t)?Rd(t):j_(t)}m(Hd,"keys");var Ud=Hd;function jd(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}m(jd,"nativeKeysIn");var $_=jd,Z_=Object.prototype,L_=Z_.hasOwnProperty;function $d(t){if(!or(t))return $_(t);var e=bd(t),n=[];for(var r in t)r=="constructor"&&(e||!L_.call(t,r))||n.push(r);return n}m($d,"baseKeysIn");var W_=$d;function Zd(t){return vd(t)?Rd(t,!0):W_(t)}m(Zd,"keysIn");var K_=Zd,F_=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,z_=/^\w*$/;function Ld(t,e){if(Qt(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||cs(t)?!0:z_.test(t)||!F_.test(t)||e!=null&&t in Object(e)}m(Ld,"isKey");var ms=Ld,q_=Un(Object,"create"),$r=q_;function Wd(){this.__data__=$r?$r(null):{},this.size=0}m(Wd,"hashClear");var G_=Wd;function Kd(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}m(Kd,"hashDelete");var V_=Kd,J_="__lodash_hash_undefined__",Y_=Object.prototype,X_=Y_.hasOwnProperty;function Fd(t){var e=this.__data__;if($r){var n=e[t];return n===J_?void 0:n}return X_.call(e,t)?e[t]:void 0}m(Fd,"hashGet");var Q_=Fd,eb=Object.prototype,tb=eb.hasOwnProperty;function zd(t){var e=this.__data__;return $r?e[t]!==void 0:tb.call(e,t)}m(zd,"hashHas");var nb=zd,rb="__lodash_hash_undefined__";function qd(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=$r&&e===void 0?rb:e,this}m(qd,"hashSet");var ib=qd;function jn(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}m(jn,"Hash");jn.prototype.clear=G_;jn.prototype.delete=V_;jn.prototype.get=Q_;jn.prototype.has=nb;jn.prototype.set=ib;var _c=jn;function Gd(){this.__data__=[],this.size=0}m(Gd,"listCacheClear");var ob=Gd;function Vd(t,e){for(var n=t.length;n--;)if(ps(t[n][0],e))return n;return-1}m(Vd,"assocIndexOf");var ji=Vd,sb=Array.prototype,ab=sb.splice;function Jd(t){var e=this.__data__,n=ji(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}m(Jd,"listCacheDelete");var lb=Jd;function Yd(t){var e=this.__data__,n=ji(e,t);return n<0?void 0:e[n][1]}m(Yd,"listCacheGet");var ub=Yd;function Xd(t){return ji(this.__data__,t)>-1}m(Xd,"listCacheHas");var cb=Xd;function Qd(t,e){var n=this.__data__,r=ji(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}m(Qd,"listCacheSet");var db=Qd;function $n(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])}}m($n,"ListCache");$n.prototype.clear=ob;$n.prototype.delete=lb;$n.prototype.get=ub;$n.prototype.has=cb;$n.prototype.set=db;var $i=$n,fb=Un(nn,"Map"),Zr=fb;function ef(){this.size=0,this.__data__={hash:new _c,map:new(Zr||$i),string:new _c}}m(ef,"mapCacheClear");var pb=ef;function tf(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}m(tf,"isKeyable");var gb=tf;function nf(t,e){var n=t.__data__;return gb(e)?n[typeof e=="string"?"string":"hash"]:n.map}m(nf,"getMapData");var Zi=nf;function rf(t){var e=Zi(this,t).delete(t);return this.size-=e?1:0,e}m(rf,"mapCacheDelete");var mb=rf;function of(t){return Zi(this,t).get(t)}m(of,"mapCacheGet");var yb=of;function sf(t){return Zi(this,t).has(t)}m(sf,"mapCacheHas");var hb=sf;function af(t,e){var n=Zi(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}m(af,"mapCacheSet");var Tb=af;function Zn(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])}}m(Zn,"MapCache");Zn.prototype.clear=pb;Zn.prototype.delete=mb;Zn.prototype.get=yb;Zn.prototype.has=hb;Zn.prototype.set=Tb;var Li=Zn,vb="Expected a function";function Wi(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(vb);var n=m(function(){var r=arguments,i=e?e.apply(this,r):r[0],s=n.cache;if(s.has(i))return s.get(i);var o=t.apply(this,r);return n.cache=s.set(i,o)||s,o},"memoized");return n.cache=new(Wi.Cache||Li),n}m(Wi,"memoize");Wi.Cache=Li;var _b=Wi,bb=500;function lf(t){var e=_b(t,function(r){return n.size===bb&&n.clear(),r}),n=e.cache;return e}m(lf,"memoizeCapped");var wb=lf,xb=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Pb=/\\(\\)?/g,Ib=wb(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(xb,function(n,r,i,s){e.push(i?s.replace(Pb,"$1"):r||n)}),e}),Bb=Ib;function uf(t){return t==null?"":_v(t)}m(uf,"toString");var Sb=uf;function cf(t,e){return Qt(t)?t:ms(t,e)?[t]:Bb(Sb(t))}m(cf,"castPath");var Ki=cf,Eb=1/0;function df(t){if(typeof t=="string"||cs(t))return t;var e=t+"";return e=="0"&&1/t==-Eb?"-0":e}m(df,"toKey");var Vr=df;function ff(t,e){e=Ki(e,t);for(var n=0,r=e.length;t!=null&&n<r;)t=t[Vr(e[n++])];return n&&n==r?t:void 0}m(ff,"baseGet");var ys=ff;function pf(t,e,n){var r=t==null?void 0:ys(t,e);return r===void 0?n:r}m(pf,"get");var kb=pf;function gf(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}m(gf,"arrayPush");var mf=gf,Ab=Nd(Object.getPrototypeOf,Object),yf=Ab,Cb="[object Object]",Ob=Function.prototype,Rb=Object.prototype,hf=Ob.toString,Mb=Rb.hasOwnProperty,Nb=hf.call(Object);function Tf(t){if(!Mn(t)||Dn(t)!=Cb)return!1;var e=yf(t);if(e===null)return!0;var n=Mb.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&hf.call(n)==Nb}m(Tf,"isPlainObject");var Db=Tf;function vf(){this.__data__=new $i,this.size=0}m(vf,"stackClear");var Hb=vf;function _f(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}m(_f,"stackDelete");var Ub=_f;function bf(t){return this.__data__.get(t)}m(bf,"stackGet");var jb=bf;function wf(t){return this.__data__.has(t)}m(wf,"stackHas");var $b=wf,Zb=200;function xf(t,e){var n=this.__data__;if(n instanceof $i){var r=n.__data__;if(!Zr||r.length<Zb-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Li(r)}return n.set(t,e),this.size=n.size,this}m(xf,"stackSet");var Lb=xf;function Ln(t){var e=this.__data__=new $i(t);this.size=e.size}m(Ln,"Stack");Ln.prototype.clear=Hb;Ln.prototype.delete=Ub;Ln.prototype.get=jb;Ln.prototype.has=$b;Ln.prototype.set=Lb;var wi=Ln;function Pf(t,e){for(var n=-1,r=t==null?0:t.length,i=0,s=[];++n<r;){var o=t[n];e(o,n,t)&&(s[i++]=o)}return s}m(Pf,"arrayFilter");var Wb=Pf;function If(){return[]}m(If,"stubArray");var Bf=If,Kb=Object.prototype,Fb=Kb.propertyIsEnumerable,bc=Object.getOwnPropertySymbols,zb=bc?function(t){return t==null?[]:(t=Object(t),Wb(bc(t),function(e){return Fb.call(t,e)}))}:Bf,Sf=zb,qb=Object.getOwnPropertySymbols,Gb=qb?function(t){for(var e=[];t;)mf(e,Sf(t)),t=yf(t);return e}:Bf,Vb=Gb;function Ef(t,e,n){var r=e(t);return Qt(t)?r:mf(r,n(t))}m(Ef,"baseGetAllKeys");var kf=Ef;function Af(t){return kf(t,Ud,Sf)}m(Af,"getAllKeys");var wc=Af;function Cf(t){return kf(t,K_,Vb)}m(Cf,"getAllKeysIn");var Jb=Cf,Yb=Un(nn,"DataView"),Xo=Yb,Xb=Un(nn,"Promise"),Qo=Xb,Qb=Un(nn,"Set"),es=Qb,xc="[object Map]",ew="[object Object]",Pc="[object Promise]",Ic="[object Set]",Bc="[object WeakMap]",Sc="[object DataView]",tw=Hn(Xo),nw=Hn(Zr),rw=Hn(Qo),iw=Hn(es),ow=Hn(Jo),Sn=Dn;(Xo&&Sn(new Xo(new ArrayBuffer(1)))!=Sc||Zr&&Sn(new Zr)!=xc||Qo&&Sn(Qo.resolve())!=Pc||es&&Sn(new es)!=Ic||Jo&&Sn(new Jo)!=Bc)&&(Sn=m(function(t){var e=Dn(t),n=e==ew?t.constructor:void 0,r=n?Hn(n):"";if(r)switch(r){case tw:return Sc;case nw:return xc;case rw:return Pc;case iw:return Ic;case ow:return Bc}return e},"getTag"));var Ec=Sn,sw=nn.Uint8Array,kc=sw,aw="__lodash_hash_undefined__";function Of(t){return this.__data__.set(t,aw),this}m(Of,"setCacheAdd");var lw=Of;function Rf(t){return this.__data__.has(t)}m(Rf,"setCacheHas");var uw=Rf;function Lr(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new Li;++e<n;)this.add(t[e])}m(Lr,"SetCache");Lr.prototype.add=Lr.prototype.push=lw;Lr.prototype.has=uw;var cw=Lr;function Mf(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}m(Mf,"arraySome");var dw=Mf;function Nf(t,e){return t.has(e)}m(Nf,"cacheHas");var fw=Nf,pw=1,gw=2;function Df(t,e,n,r,i,s){var o=n&pw,a=t.length,l=e.length;if(a!=l&&!(o&&l>a))return!1;var c=s.get(t),f=s.get(e);if(c&&f)return c==e&&f==t;var p=-1,g=!0,y=n&gw?new cw:void 0;for(s.set(t,e),s.set(e,t);++p<a;){var T=t[p],P=e[p];if(r)var I=o?r(P,T,p,e,t,s):r(T,P,p,t,e,s);if(I!==void 0){if(I)continue;g=!1;break}if(y){if(!dw(e,function(_,S){if(!fw(y,S)&&(T===_||i(T,_,n,r,s)))return y.push(S)})){g=!1;break}}else if(!(T===P||i(T,P,n,r,s))){g=!1;break}}return s.delete(t),s.delete(e),g}m(Df,"equalArrays");var Hf=Df;function Uf(t){var e=-1,n=Array(t.size);return t.forEach(function(r,i){n[++e]=[i,r]}),n}m(Uf,"mapToArray");var mw=Uf;function jf(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}m(jf,"setToArray");var yw=jf,hw=1,Tw=2,vw="[object Boolean]",_w="[object Date]",bw="[object Error]",ww="[object Map]",xw="[object Number]",Pw="[object RegExp]",Iw="[object Set]",Bw="[object String]",Sw="[object Symbol]",Ew="[object ArrayBuffer]",kw="[object DataView]",Ac=yn?yn.prototype:void 0,$o=Ac?Ac.valueOf:void 0;function $f(t,e,n,r,i,s,o){switch(n){case kw:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Ew:return!(t.byteLength!=e.byteLength||!s(new kc(t),new kc(e)));case vw:case _w:case xw:return ps(+t,+e);case bw:return t.name==e.name&&t.message==e.message;case Pw:case Bw:return t==e+"";case ww:var a=mw;case Iw:var l=r&hw;if(a||(a=yw),t.size!=e.size&&!l)return!1;var c=o.get(t);if(c)return c==e;r|=Tw,o.set(t,e);var f=Hf(a(t),a(e),r,i,s,o);return o.delete(t),f;case Sw:if($o)return $o.call(t)==$o.call(e)}return!1}m($f,"equalByTag");var Aw=$f,Cw=1,Ow=Object.prototype,Rw=Ow.hasOwnProperty;function Zf(t,e,n,r,i,s){var o=n&Cw,a=wc(t),l=a.length,c=wc(e),f=c.length;if(l!=f&&!o)return!1;for(var p=l;p--;){var g=a[p];if(!(o?g in e:Rw.call(e,g)))return!1}var y=s.get(t),T=s.get(e);if(y&&T)return y==e&&T==t;var P=!0;s.set(t,e),s.set(e,t);for(var I=o;++p<l;){g=a[p];var _=t[g],S=e[g];if(r)var B=o?r(S,_,g,e,t,s):r(_,S,g,t,e,s);if(!(B===void 0?_===S||i(_,S,n,r,s):B)){P=!1;break}I||(I=g=="constructor")}if(P&&!I){var D=t.constructor,$=e.constructor;D!=$&&"constructor"in t&&"constructor"in e&&!(typeof D=="function"&&D instanceof D&&typeof $=="function"&&$ instanceof $)&&(P=!1)}return s.delete(t),s.delete(e),P}m(Zf,"equalObjects");var Mw=Zf,Nw=1,Cc="[object Arguments]",Oc="[object Array]",_i="[object Object]",Dw=Object.prototype,Rc=Dw.hasOwnProperty;function Lf(t,e,n,r,i,s){var o=Qt(t),a=Qt(e),l=o?Oc:Ec(t),c=a?Oc:Ec(e);l=l==Cc?_i:l,c=c==Cc?_i:c;var f=l==_i,p=c==_i,g=l==c;if(g&&Yo(t)){if(!Yo(e))return!1;o=!0,f=!1}if(g&&!f)return s||(s=new wi),o||Cd(t)?Hf(t,e,n,r,i,s):Aw(t,e,l,n,r,i,s);if(!(n&Nw)){var y=f&&Rc.call(t,"__wrapped__"),T=p&&Rc.call(e,"__wrapped__");if(y||T){var P=y?t.value():t,I=T?e.value():e;return s||(s=new wi),i(P,I,n,r,s)}}return g?(s||(s=new wi),Mw(t,e,n,r,i,s)):!1}m(Lf,"baseIsEqualDeep");var Hw=Lf;function hs(t,e,n,r,i){return t===e?!0:t==null||e==null||!Mn(t)&&!Mn(e)?t!==t&&e!==e:Hw(t,e,n,r,hs,i)}m(hs,"baseIsEqual");var Fi=hs,Uw=1,jw=2;function Wf(t,e,n,r){var i=n.length,s=i,o=!r;if(t==null)return!s;for(t=Object(t);i--;){var a=n[i];if(o&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++i<s;){a=n[i];var l=a[0],c=t[l],f=a[1];if(o&&a[2]){if(c===void 0&&!(l in t))return!1}else{var p=new wi;if(r)var g=r(c,f,l,t,e,p);if(!(g===void 0?Fi(f,c,Uw|jw,r,p):g))return!1}}return!0}m(Wf,"baseIsMatch");var $w=Wf;function Kf(t){return t===t&&!or(t)}m(Kf,"isStrictComparable");var Ff=Kf;function zf(t){for(var e=Ud(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,Ff(i)]}return e}m(zf,"getMatchData");var Zw=zf;function qf(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}m(qf,"matchesStrictComparable");var Gf=qf;function Vf(t){var e=Zw(t);return e.length==1&&e[0][2]?Gf(e[0][0],e[0][1]):function(n){return n===t||$w(n,t,e)}}m(Vf,"baseMatches");var Lw=Vf;function Jf(t,e){return t!=null&&e in Object(t)}m(Jf,"baseHasIn");var Ww=Jf;function Yf(t,e,n){e=Ki(e,t);for(var r=-1,i=e.length,s=!1;++r<i;){var o=Vr(e[r]);if(!(s=t!=null&&n(t,o)))break;t=t[o]}return s||++r!=i?s:(i=t==null?0:t.length,!!i&&gs(i)&&fs(o,i)&&(Qt(t)||Id(t)))}m(Yf,"hasPath");var Kw=Yf;function Xf(t,e){return t!=null&&Kw(t,e,Ww)}m(Xf,"hasIn");var Fw=Xf,zw=1,qw=2;function Qf(t,e){return ms(t)&&Ff(e)?Gf(Vr(t),e):function(n){var r=kb(n,t);return r===void 0&&r===e?Fw(n,t):Fi(e,r,zw|qw)}}m(Qf,"baseMatchesProperty");var Gw=Qf;function ep(t){return function(e){return e?.[t]}}m(ep,"baseProperty");var Vw=ep;function tp(t){return function(e){return ys(e,t)}}m(tp,"basePropertyDeep");var Jw=tp;function np(t){return ms(t)?Vw(Vr(t)):Jw(t)}m(np,"property");var Yw=np;function rp(t){return typeof t=="function"?t:t==null?bv:typeof t=="object"?Qt(t)?Gw(t[0],t[1]):Lw(t):Yw(t)}m(rp,"baseIteratee");var ip=rp;function op(t,e){return Fi(t,e)}m(op,"isEqual");var mn=op;function sp(t,e,n){n=typeof n=="function"?n:void 0;var r=n?n(t,e):void 0;return r===void 0?Fi(t,e,void 0,n):!!r}m(sp,"isEqualWith");var Xw=sp;function ap(t){return t===void 0}m(ap,"isUndefined");var Mc=ap,Qw="Expected a function";function lp(t){if(typeof t!="function")throw new TypeError(Qw);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)}}m(lp,"negate");var ex=lp;function up(t,e,n,r){if(!or(t))return t;e=Ki(e,t);for(var i=-1,s=e.length,o=s-1,a=t;a!=null&&++i<s;){var l=Vr(e[i]),c=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return t;if(i!=o){var f=a[l];c=r?r(f,l,a):void 0,c===void 0&&(c=or(f)?f:fs(e[i+1])?[]:{})}zv(a,l,c),a=a[l]}return t}m(up,"baseSet");var tx=up;function cp(t,e,n){for(var r=-1,i=e.length,s={};++r<i;){var o=e[r],a=ys(t,o);n(a,o)&&tx(s,Ki(o,t),a)}return s}m(cp,"basePickBy");var nx=cp;function dp(t,e){if(t==null)return{};var n=rd(Jb(t),function(r){return[r]});return e=ip(e),nx(t,n,function(r,i){return e(r,i[0])})}m(dp,"pickBy");var rx=dp;function fp(t,e){return rx(t,ex(ip(e)))}m(fp,"omitBy");var Nc=fp,pp=m((t,e)=>gp(t,e,new WeakSet),"isEqual"),Dc=m(t=>Db(t),"_isPlainObject"),gp=m((t,e,n)=>Xw(t,e,ix(n)),"_isEqualWithVisitedTracking"),ix=m(t=>(e,n)=>{if(Dc(e)&&!t.has(e)&&Dc(n)&&!t.has(n)){let r=Nc(e,Mc),i=Nc(n,Mc);return t.add(r).add(i).add(e).add(n),gp(r,i,t)}},"_customizerWithVisitedTracking"),ox=m(t=>Array.from(new Set(t)),"unique"),sx={compare:pp},mp=class{constructor(e=[],n={}){this._options=w(w({},sx),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))}};m(mp,"CustomSet");var ax=mp,ae={};Rt(ae,{errToObj:()=>lx,toString:()=>ux});var lx=m(t=>typeof t=="string"?{message:t}:t||{},"errToObj"),ux=m(t=>typeof t=="string"?t:t?.message,"toString"),Ot={};Rt(Ot,{assertNever:()=>yp});function yp(t){throw new Error("assertNever called")}m(yp,"assertNever");var Ct={};Rt(Ct,{compareFunctions:()=>dx,joinValues:()=>hp,jsonStringifyReplacer:()=>cx});function hp(t,e=" | "){return t.map(n=>typeof n=="string"?`'${n}'`:n).join(e)}m(hp,"joinValues");var cx=m((t,e)=>typeof e=="bigint"?e.toString():e,"jsonStringifyReplacer"),dx=m((t,e)=>t.toString()===e.toString(),"compareFunctions"),Tp={};Rt(Tp,{extractPrecisionAndOffset:()=>_p,generateDatetimeRegex:()=>vp});var vp=m(t=>{let e=t.precision?ts+t.precision+px:t.precision===0?"":xp,n=t.offset?wp:fx;return new RegExp(`^${bp}${e}${n}$`)},"generateDatetimeRegex"),_p=m(t=>({precision:gx(t),offset:t.endsWith(`${wp}$`)}),"extractPrecisionAndOffset"),bp="\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}",wp="(([+-]\\d{2}(:?\\d{2})?)|Z)",fx="Z",xp="(\\.\\d+)?",ts="\\.\\d{",px="}",gx=m(t=>{let e=t.slice(1+bp.length);return e.startsWith(xp)?null:e.startsWith(ts)?parseInt(e.slice(ts.length)):0},"_extractPrecision"),Ri=m((t,e)=>{let n;switch(t.code){case"invalid_type":t.received==="undefined"?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case"invalid_literal":n=`Invalid literal value, expected ${JSON.stringify(t.expected,Ct.jsonStringifyReplacer)}`;break;case"unrecognized_keys":n=`Unrecognized key(s) in object: ${Ct.joinValues(t.keys,", ")}`;break;case"invalid_union":n="Invalid input";break;case"invalid_union_discriminator":n=`Invalid discriminator value. Expected ${Ct.joinValues(t.options)}`;break;case"invalid_enum_value":n=`Invalid enum value. Expected ${Ct.joinValues(t.options)}, received '${t.received}'`;break;case"invalid_arguments":n="Invalid function arguments";break;case"invalid_return_type":n="Invalid function return type";break;case"invalid_date":n="Invalid date";break;case"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}"`:Ot.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case"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"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"custom":n="Invalid input";break;case"invalid_intersection_types":n="Intersection results could not be merged";break;case"not_multiple_of":n=`Number must be a multiple of ${t.multipleOf}`;break;case"not_finite":n="Number must be finite";break;case"unresolved_reference":n="Unresolved reference";break;default:n=e.defaultError,Ot.assertNever(t)}return{message:n}},"errorMap"),Mi=class Pp extends Error{constructor(e){super(),this.__type__="ZuiError",this.issues=[],this.addIssue=m(r=>{this.issues=[...this.issues,r]},"addIssue"),this.addIssues=m((r=[])=>{this.issues=[...this.issues,...r]},"addIssues");let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let n=e||function(s){return s.message},r={_errors:[]},i=m(s=>{for(let o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let a=r,l=0;for(;l<o.path.length;){let c=o.path[l];l===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(o))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}},"processError");return i(this),r}static assert(e){if(!(e instanceof Pp))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ct.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}};m(Mi,"ZodError");Mi.create=m(t=>new Mi(t),"create");var Xt=Mi,mx=Ri;function Ni(){return mx}m(Ni,"getErrorMap");var De={};function Ip(t){Object.assign(De,t)}m(Ip,"setBuilders");var ns=m(t=>{var e;let{data:n,path:r,errorMaps:i,issueData:s}=t,o=[...r,...s.path||[]],a=M(w({},s),{path:o}),l="",c=i.filter(f=>!!f).slice().reverse();for(let f of c)l=f(a,{data:n,defaultError:l}).message;return M(w({},s),{path:o,message:(e=s.message)!=null?e:l})},"makeIssue");function ee(t,e){let n=ns({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ni(),Ri].filter(r=>!!r)});t.common.issues.push(n)}m(ee,"addIssueToContext");var Bp=class Sp{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 i of n){if(i.status==="aborted")return{status:"aborted"};i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let i of n)r.push({key:await i.key,value:await i.value});return Sp.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let i of n){let{key:s,value:o}=i;if(s.status==="aborted")return{status:"aborted"};if(o.status==="aborted")return{status:"aborted"};s.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(r[s.value]=o.value)}return{status:e.value,value:r}}};m(Bp,"ParseStatus");var bt=Bp,Di=m(t=>typeof Promise<"u"&&t instanceof Promise,"isAsync"),Cn=m(t=>{switch(typeof t){case"undefined":return"undefined";case"string":return"string";case"number":return isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":typeof Promise<"u"&&t instanceof Promise||t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":"object";default:return"unknown"}},"getParsedType"),Ep=class{constructor(e,n,r,i){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=i}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}};m(Ep,"ParseInputLazyPath");var Zt=Ep,kp=class extends Error{constructor(e){super(`Cannot access property ${e} before initialization. You're probably importing ZUI incorrectly. If not, reach out to the maintainers.`)}};m(kp,"_CircularDependencyError");var Zo=kp,Ap=class{constructor(e){this.__type__="ZuiType",this.spa=this.safeParseAsync,this._handleResult=m((n,r)=>{if(r.status==="valid")return{success:!0,data:r.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let i=new Xt(n.common.issues);return this._error=i,this._error}}},"_handleResult"),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.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this.downstream=this.downstream.bind(this)}get description(){return this._metadataRoot._def.description}get typeName(){return this._def.typeName}dereference(e){return this}getReferences(){return[]}clone(){let e=this.constructor;return new e(w({},this._def))}_getType(e){return Cn(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Cn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new bt,ctx:{common:e.parent.common,data:e.data,parsedType:Cn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(Di(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 i={common:{issues:[],async:(r=n?.async)!=null?r:!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Cn(e)},s=this._parseSync({data:e,path:i.path,parent:i});return this._handleResult(i,s)}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Cn(e)},i=this._parse({data:e,path:r.path,parent:r}),s=await(Di(i)?i:Promise.resolve(i));return this._handleResult(r,s)}refine(e,n){let r=m(i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n,"getIssueProperties");return De.downstream(this,i=>{let s=e(i),o=[],a=m(()=>o.push(w({code:"custom"},r(i))),"setError");return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?{status:"valid",value:i}:(a(),{status:"dirty",value:i,issues:o})):s?{status:"valid",value:i}:(a(),{status:"dirty",value:i,issues:o})})}superRefine(e){return De.downstream(this,(n,r)=>{let i=[],s=e(n,{addIssue:o=>i.push(o),path:r.path});return typeof Promise<"u"&&s instanceof Promise?s.then(()=>i.some(o=>o.fatal)?{status:"aborted",issues:i}:i.length?{status:"dirty",value:n,issues:i}:{status:"valid",value:n}):i.some(o=>o.fatal)?{status:"aborted",issues:i}:i.length?{status:"dirty",value:n,issues:i}:{status:"valid",value:n}})}downstream(e,n){return De.downstream(this,e,n)}optional(){return De.optional(this,this._def)}nullable(){return De.nullable(this,this._def)}nullish(){return this.nullable().optional()}array(){return De.array(this,this._def)}promise(){return De.promise(this,this._def)}mandatory(){return this}or(e){return De.union([this,e])}and(e){return De.intersection(this,e)}transform(e){return De.downstream(this,(n,r)=>{let i=[],s=e(n,{addIssue:o=>i.push(o),path:r.path});return s instanceof Promise?s.then(o=>i.some(a=>a.fatal)?{status:"aborted",issues:i}:i.length?{status:"dirty",value:o,issues:i}:{status:"valid",value:o}):i.some(o=>o.fatal)?{status:"aborted",issues:i}:i.length?{status:"dirty",value:s,issues:i}:{status:"valid",value:s}},{failFast:!0})}default(e){let n=typeof e=="function"?e:()=>e;return De.default(this,n)}brand(){return De.branded(this)}catch(e){return De.catch(this,e)}describe(e){let n=this.clone();return n._metadataRoot._def.description=e,n}pipe(e){return De.pipeline(this,e)}readonly(){return De.readonly(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}metadata(e){var n,r,i;let s=this.clone(),o=s._metadataRoot;(i=(n=o._def)[r=Ae])!=null||(n[r]={});for(let[a,l]of Object.entries(e))o._def[Ae]=M(w({},o._def[Ae]),{[a]:l});return s}getMetadata(){return w({},this._metadataRoot._def[Ae])}setMetadata(e){this._metadataRoot._def[Ae]=w({},e)}get ui(){return w({},this._metadataRoot._def[Ae])}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(e){throw new Zo("toJSONSchema")}toTypescriptType(e){throw new Zo("toTypescriptType")}toTypescriptSchema(){throw new Zo("toTypescriptSchema")}naked(){return this}};m(Ap,"ZodBaseTypeImpl");var pe=Ap,Cp=class Op extends pe{constructor(){super(...arguments),this._any=!0}_parse(e){return{status:"valid",value:e.data}}isEqual(e){return e instanceof Op}};m(Cp,"ZodAnyImpl");var yx=Cp,Rp=class En extends pe{dereference(e){return new En(M(w({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new En(M(w({},this._def),{type:this._def.type.clone()}))}isEqual(e){var n,r,i,s,o,a;return e instanceof En?mn((n=this._def.exactLength)==null?void 0:n.value,(r=e._def.exactLength)==null?void 0:r.value)&&mn((i=this._def.maxLength)==null?void 0:i.value,(s=e._def.maxLength)==null?void 0:s.value)&&mn((o=this._def.minLength)==null?void 0:o.value,(a=e._def.minLength)==null?void 0:a.value)&&this._def.type.isEqual(e._def.type):!1}_parse(e){let{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!=="array")return ee(n,{code:"invalid_type",expected:"array",received:n.parsedType}),{status:"aborted"};if(i.exactLength!==null){let o=n.data.length>i.exactLength.value,a=n.data.length<i.exactLength.value;(o||a)&&(ee(n,{code:o?"too_big":"too_small",minimum:a?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(ee(n,{code:"too_small",minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(ee(n,{code:"too_big",maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>i.type._parseAsync(new Zt(n,o,n.path,a)))).then(o=>bt.mergeArray(r,o));let s=[...n.data].map((o,a)=>i.type._parseSync(new Zt(n,o,n.path,a)));return bt.mergeArray(r,s)}get element(){return this._def.type}min(e,n){return new En(M(w({},this._def),{minLength:{value:e,message:ae.toString(n)}}))}max(e,n){return new En(M(w({},this._def),{maxLength:{value:e,message:ae.toString(n)}}))}length(e,n){return new En(M(w({},this._def),{exactLength:{value:e,message:ae.toString(n)}}))}nonempty(e){return this.min(1,e)}};m(Rp,"ZodArrayImpl");var hx=Rp,Mp=class xi extends pe{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)!=="bigint"){let s=this._getOrReturnCtx(e);return ee(s,{code:"invalid_type",expected:"bigint",received:s.parsedType}),{status:"aborted"}}let r,i=new bt;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),ee(r,{code:"too_small",type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),ee(r,{code:"too_big",type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),ee(r,{code:"not_multiple_of",multipleOf:s.value,message:s.message}),i.dirty()):Ot.assertNever(s);return{status:i.value,value:e.data}}isEqual(e){if(!(e instanceof xi)||this._def.coerce!==e._def.coerce)return!1;let n=new Ye.CustomSet(this._def.checks),r=new Ye.CustomSet(e._def.checks);return n.isEqual(r)}gte(e,n){return this.setLimit("min",e,!0,ae.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ae.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ae.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ae.toString(n))}setLimit(e,n,r,i){return new xi(M(w({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ae.toString(i)}]}))}_addCheck(e){return new xi(M(w({},this._def),{checks:[...this._def.checks,e]}))}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ae.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ae.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ae.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ae.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ae.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}};m(Mp,"ZodBigIntImpl");var Tx=Mp,Np=class Dp extends pe{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!=="boolean"){let r=this._getOrReturnCtx(e);return ee(r,{code:"invalid_type",expected:"boolean",received:r.parsedType}),{status:"aborted"}}return{status:"valid",value:e.data}}isEqual(e){return e instanceof Dp?this._def.coerce===e._def.coerce:!1}};m(Np,"ZodBooleanImpl");var vx=Np,Hp=class Ir extends pe{dereference(e){return new Ir(M(w({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new Ir(M(w({},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 Ir?this._def.type.isEqual(e._def.type):!1}naked(){return this._def.type.naked()}mandatory(){return new Ir(M(w({},this._def),{type:this._def.type.mandatory()}))}};m(Hp,"ZodBrandedImpl");var _x=Hp,Up=class Br extends pe{_parse(e){let{ctx:n}=this._processInputParams(e),r=M(w({},n),{common:M(w({},n.common),{issues:[]})}),i=this._def.innerType._parse({data:r.data,path:r.path,parent:w({},r)});return Di(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Xt(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Xt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}isEqual(e){return e instanceof Br?this._def.innerType.isEqual(e._def.innerType)&&Ct.compareFunctions(this._def.catchValue,e._def.catchValue):!1}dereference(e){return new Br(M(w({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Br(M(w({},this._def),{innerType:this._def.innerType.clone()}))}naked(){return this._def.innerType.naked()}mandatory(){return new Br(M(w({},this._def),{innerType:this._def.innerType.mandatory()}))}};m(Up,"ZodCatchImpl");var bx=Up,jp=class rs extends pe{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!=="date"){let s=this._getOrReturnCtx(e);return ee(s,{code:"invalid_type",expected:"date",received:s.parsedType}),{status:"aborted"}}if(isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return ee(s,{code:"invalid_date"}),{status:"aborted"}}let r=new bt,i;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(i=this._getOrReturnCtx(e,i),ee(i,{code:"too_small",message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(i=this._getOrReturnCtx(e,i),ee(i,{code:"too_big",message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):Ot.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new rs(M(w({},this._def),{checks:[...this._def.checks,e]}))}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:ae.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:ae.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 rs))return!1;let n=new Ye.CustomSet(this._def.checks),r=new Ye.CustomSet(e._def.checks);return n.isEqual(r)&&this._def.coerce===e._def.coerce}};m(jp,"ZodDateImpl");var wx=jp,$p=class Sr extends pe{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType==="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 Sr(M(w({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Sr(M(w({},this._def),{innerType:this._def.innerType.clone()}))}isEqual(e){return e instanceof Sr?this._def.innerType.isEqual(e._def.innerType)&&mn(this._def.defaultValue(),e._def.defaultValue()):!1}unwrap(){return this._def.innerType}naked(){return this._def.innerType.naked()}mandatory(){return new Sr(M(w({},this._def),{innerType:this._def.innerType.mandatory()}))}};m($p,"ZodDefaultImpl");var xx=$p,Yt=m(t=>{let e=t;return e?e.typeName==="ZodLazy"?Yt(e.schema):e.typeName==="ZodEffects"?Yt(e.innerType()):e.typeName==="ZodLiteral"?[e.value]:e.typeName==="ZodEnum"?e.options:e.typeName==="ZodNativeEnum"?Object.values(e.enum):e.typeName==="ZodDefault"?Yt(e._def.innerType):e.typeName==="ZodUndefined"?[void 0]:e.typeName==="ZodNull"?[null]:e.typeName==="ZodOptional"?[void 0,...Yt(e.unwrap())]:e.typeName==="ZodNullable"?[null,...Yt(e.unwrap())]:e.typeName==="ZodBranded"||e.typeName==="ZodReadonly"?Yt(e.unwrap()):e.typeName==="ZodCatch"?Yt(e._def.innerType):[]:[]},"getDiscriminator"),Zp=class Er extends pe{constructor(e){let n=Er._getOptionsMap(e.discriminator,e.options);super(M(w({},e),{optionsMap:n}))}dereference(e){let n=this.options.map(r=>r.dereference(e));return new Er(M(w({},this._def),{options:n}))}getReferences(){return Lt.unique(this.options.flatMap(e=>e.getReferences()))}clone(){let e=this.options.map(n=>n.clone());return new Er(M(w({},this._def),{options:e}))}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!=="object")return ee(n,{code:"invalid_type",expected:"object",received:n.parsedType}),{status:"aborted"};let r=this.discriminator,i=n.data[r],s=this.optionsMap.get(i);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(ee(n,{code:"invalid_union_discriminator",options:Array.from(this.optionsMap.keys()),path:[r]}),{status:"aborted"})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static _getOptionsMap(e,n){let r=new Map;for(let i of n){let s=Yt(i.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of s){if(r.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);r.set(o,i)}}return r}isEqual(e){if(!(e instanceof Er)||this._def.discriminator!==e._def.discriminator)return!1;let n=m((s,o)=>s.isEqual(o),"compare"),r=new Ye.CustomSet(this._def.options,{compare:n}),i=new Ye.CustomSet(e._def.options,{compare:n});return r.isEqual(i)}};m(Zp,"ZodDiscriminatedUnionImpl");var Px=Zp,Lp=class Wp extends pe{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return ee(n,{expected:Ct.joinValues(r),received:n.parsedType,code:"invalid_type"}),{status:"aborted"}}if(this._def.values.indexOf(e.data)===-1){let n=this._getOrReturnCtx(e),r=this._def.values;return ee(n,{received:n.data,code:"invalid_enum_value",options:r}),{status:"aborted"}}return{status:"valid",value: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(){return this.enum}get Enum(){return this.enum}extract(e,n=this._def){return De.enum(e,w(w({},this._def),n))}exclude(e,n=this._def){return De.enum(this.options.filter(r=>!e.includes(r)),w(w({},this._def),n))}isEqual(e){if(!(e instanceof Wp))return!1;let n=new Ye.CustomSet(this._def.values),r=new Ye.CustomSet(e._def.values);return n.isEqual(r)}};m(Lp,"ZodEnumImpl");var Ix=Lp,Kp=class tr extends pe{constructor(){super(...arguments),this.validate=this.implement}dereference(e){let n=this._def.args.dereference(e),r=this._def.returns.dereference(e);return new tr(M(w({},this._def),{args:n,returns:r}))}getReferences(){return Lt.unique([...this._def.args.getReferences(),...this._def.returns.getReferences()])}clone(){return new tr(M(w({},this._def),{args:this._def.args.clone(),returns:this._def.returns.clone()}))}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!=="function")return ee(n,{code:"invalid_type",expected:"function",received:n.parsedType}),{status:"aborted"};function r(c,f){return ns({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Ni(),Ri].filter(p=>!!p),issueData:{code:"invalid_arguments",argumentsError:f}})}m(r,"makeArgsIssue");function i(c,f){return ns({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Ni(),Ri].filter(p=>!!p),issueData:{code:"invalid_return_type",returnTypeError:f}})}m(i,"makeReturnsIssue");let s={errorMap:n.common.contextualErrorMap},o=n.data,a=this,l=this._def.returns;return Se.zuiPromise(l)?{status:"valid",async value(...c){let f=new Xt([]),p=await a._def.args.parseAsync(c,s).catch(T=>{throw f.addIssue(r(c,T)),f}),g=await Reflect.apply(o,this,p);return await l._def.type.parseAsync(g,s).catch(T=>{throw Se.zuiError(T)?(f.addIssue(i(g,T)),f):T})}}:{status:"valid",value(...c){let f=a._def.args.safeParse(c,s);if(!f.success)throw new Xt([r(c,f.error)]);let p=Reflect.apply(o,this,f.data),g=a._def.returns.safeParse(p,s);if(!g.success)throw new Xt([i(p,g.error)]);return g.data}}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new tr(M(w({},this._def),{args:De.tuple(e).rest(De.unknown())}))}returns(e){return new tr(M(w({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}isEqual(e){return e instanceof tr&&this._def.args.isEqual(e._def.args)&&this._def.returns.isEqual(e._def.returns)}};m(Kp,"ZodFunctionImpl");var Bx=Kp,Fp=class Pi extends pe{dereference(e){return new Pi(M(w({},this._def),{left:this._def.left.dereference(e),right:this._def.right.dereference(e)}))}getReferences(){return Lt.unique([...this._def.left.getReferences(),...this._def.right.getReferences()])}clone(){return new Pi(M(w({},this._def),{left:this._def.left.clone(),right:this._def.right.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),i=m((s,o)=>{if(s.status==="aborted"||o.status==="aborted")return{status:"aborted"};let a=this._mergeValues(s.value,o.value);return a.valid?((s.status==="dirty"||o.status==="dirty")&&n.dirty(),{status:n.value,value:a.data}):(ee(r,{code:"invalid_intersection_types"}),{status:"aborted"})},"handleParsed");return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,o])=>i(s,o)):i(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 Pi))return!1;let n=m((s,o)=>s.isEqual(o),"compare"),r=new Ye.CustomSet([this._def.left,this._def.right],{compare:n}),i=new Ye.CustomSet([e._def.left,e._def.right],{compare:n});return r.isEqual(i)}_mergeValues(e,n){let r=Cn(e),i=Cn(n);if(e===n)return{valid:!0,data:e};if(r==="object"&&i==="object"){let s=Object.keys(n),o=Object.keys(e).filter(l=>s.indexOf(l)!==-1),a=w(w({},e),n);for(let l of o){let c=this._mergeValues(e[l],n[l]);if(!c.valid)return{valid:!1};a[l]=c.data}return{valid:!0,data:a}}else if(r==="array"&&i==="array"){if(e.length!==n.length)return{valid:!1};let s=[];for(let o=0;o<e.length;o++){let a=e[o],l=n[o],c=this._mergeValues(a,l);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return r==="date"&&i==="date"&&+e==+n?{valid:!0,data:e}:{valid:!1}}};m(Fp,"ZodIntersectionImpl");var Sx=Fp,zp=class kr extends pe{get schema(){return this._def.getter()}dereference(e){return new kr(M(w({},this._def),{getter:()=>this._def.getter().dereference(e)}))}getReferences(){return this._def.getter().getReferences()}clone(){return new kr(M(w({},this._def),{getter:()=>this._def.getter().clone()}))}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}isEqual(e){return e instanceof kr?this._def.getter().isEqual(e._def.getter()):!1}naked(){return this._def.getter().naked()}mandatory(){return new kr(M(w({},this._def),{getter:()=>this._def.getter().mandatory()}))}};m(zp,"ZodLazyImpl");var Ex=zp,qp=class Gp extends pe{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return ee(n,{received:n.data,code:"invalid_literal",expected:this._def.value}),{status:"aborted"}}return{status:"valid",value:e.data}}get value(){return this._def.value}isEqual(e){return e instanceof Gp?mn(this._def.value,e._def.value):!1}};m(qp,"ZodLiteralImpl");var kx=qp,Vp=class Ii extends pe{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 Ii(M(w({},this._def),{keyType:n,valueType:r}))}getReferences(){return Lt.unique([...this._def.keyType.getReferences(),...this._def.valueType.getReferences()])}clone(){return new Ii(M(w({},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!=="map")return ee(r,{code:"invalid_type",expected:"map",received:r.parsedType}),{status:"aborted"};let i=this._def.keyType,s=this._def.valueType,o=[...r.data.entries()].map(([a,l],c)=>({key:i._parse(new Zt(r,a,r.path,[c,"key"])),value:s._parse(new Zt(r,l,r.path,[c,"value"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let l of o){let c=await l.key,f=await l.value;if(c.status==="aborted"||f.status==="aborted")return{status:"aborted"};(c.status==="dirty"||f.status==="dirty")&&n.dirty(),a.set(c.value,f.value)}return{status:n.value,value:a}})}else{let a=new Map;for(let l of o){let c=l.key,f=l.value;if(c.status==="aborted"||f.status==="aborted")return{status:"aborted"};(c.status==="dirty"||f.status==="dirty")&&n.dirty(),a.set(c.value,f.value)}return{status:n.value,value:a}}}isEqual(e){return!(!(e instanceof Ii)||!this._def.keyType.isEqual(e._def.keyType)||!this._def.valueType.isEqual(e._def.valueType))}};m(Vp,"ZodMapImpl");var Ax=Vp,Jp=class Yp extends pe{_parse(e){if(this._getType(e)!=="nan"){let r=this._getOrReturnCtx(e);return ee(r,{code:"invalid_type",expected:"nan",received:r.parsedType}),{status:"aborted"}}return{status:"valid",value:e.data}}isEqual(e){return e instanceof Yp}};m(Jp,"ZodNaNImpl");var Cx=Jp,Xp=class Qp extends pe{constructor(){super(...arguments),this._getValidEnumValues=m(e=>{let n=Object.keys(e).filter(i=>typeof e[e[i]]!="number"),r={};for(let i of n)r[i]=e[i];return Object.values(r)},"_getValidEnumValues")}_parse(e){let n=this._getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!=="string"&&r.parsedType!=="number"){let i=Object.values(n);return ee(r,{expected:Ct.joinValues(i),received:r.parsedType,code:"invalid_type"}),{status:"aborted"}}if(n.indexOf(e.data)===-1){let i=Object.values(n);return ee(r,{received:r.data,code:"invalid_enum_value",options:i}),{status:"aborted"}}return{status:"valid",value:e.data}}get enum(){return this._def.values}isEqual(e){return e instanceof Qp?mn(this._def.values,e._def.values):!1}};m(Xp,"ZodNativeEnumImpl");var Ox=Xp,eg=class tg extends pe{_parse(e){let n=this._getOrReturnCtx(e);return ee(n,{code:"invalid_type",expected:"never",received:n.parsedType}),{status:"aborted"}}isEqual(e){return e instanceof tg}};m(eg,"ZodNeverImpl");var Rx=eg,ng=class rg extends pe{_parse(e){if(this._getType(e)!=="null"){let r=this._getOrReturnCtx(e);return ee(r,{code:"invalid_type",expected:"null",received:r.parsedType}),{status:"aborted"}}return{status:"valid",value:e.data}}isEqual(e){return e instanceof rg}};m(ng,"ZodNullImpl");var Mx=ng,ig=class Ar extends pe{dereference(e){return new Ar(M(w({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Ar(M(w({},this._def),{innerType:this._def.innerType.clone()}))}_parse(e){return this._getType(e)==="null"?{status:"valid",value:null}:this._def.innerType._parse(e)}unwrap(){return this._def.innerType}isEqual(e){return e instanceof Ar?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return new Ar(M(w({},this._def),{innerType:this._def.innerType.mandatory()}))}};m(ig,"ZodNullableImpl");var Nx=ig,og=class Bi extends pe{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)!=="number"){let s=this._getOrReturnCtx(e);return ee(s,{code:"invalid_type",expected:"number",received:s.parsedType}),{status:"aborted"}}let r,i=new bt;for(let s of this._def.checks)s.kind==="int"?Number.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),ee(r,{code:"invalid_type",expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),ee(r,{code:"too_small",minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),ee(r,{code:"too_big",maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?this._floatSafeRemainder(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),ee(r,{code:"not_multiple_of",multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),ee(r,{code:"not_finite",message:s.message}),i.dirty()):Ot.assertNever(s);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,ae.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ae.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ae.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ae.toString(n))}setLimit(e,n,r,i){return new Bi(M(w({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ae.toString(i)}]}))}_addCheck(e){return new Bi(M(w({},this._def),{checks:[...this._def.checks,e]}))}int(e){return this._addCheck({kind:"int",message:ae.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ae.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ae.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ae.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ae.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ae.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:ae.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ae.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ae.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"&&Number.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 Ye.CustomSet(this._def.checks),r=new Ye.CustomSet(e._def.checks);return n.isEqual(r)}_floatSafeRemainder(e,n){let r=(e.toString().split(".")[1]||"").length,i=(n.toString().split(".")[1]||"").length,s=r>i?r:i,o=parseInt(e.toFixed(s).replace(".","")),a=parseInt(n.toFixed(s).replace(".",""));return o%a/Math.pow(10,s)}};m(og,"ZodNumberImpl");var Dx=og,sg=class gt extends pe{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=Object.keys(e);return this._cached={shape:e,keys:n}}dereference(e){let n=this._def.shape(),r={};for(let i in n)r[i]=n[i].dereference(e);return new gt(M(w({},this._def),{shape:()=>r}))}getReferences(){let e=this._def.shape(),n=[];for(let r in e)n.push(...e[r].getReferences());return Lt.unique(n)}clone(){let e={},n=this._def.shape();for(let[i,s]of Object.entries(n))e[i]=s.clone();return new gt(M(w({},this._def),{shape:()=>e}))}_parse(e){if(this._getType(e)!=="object"){let f=this._getOrReturnCtx(e);return ee(f,{code:"invalid_type",expected:"object",received:f.parsedType}),{status:"aborted"}}let{status:r,ctx:i}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),a=[];if(this._def.unknownKeys!=="strip")for(let f in i.data)o.includes(f)||a.push(f);let l=[];for(let f of o){let p=s[f],g=i.data[f];l.push({key:{status:"valid",value:f},value:p._parse(new Zt(i,g,i.path,f)),alwaysSet:f in i.data})}let c=this._def.unknownKeys;if(c==="passthrough")for(let f of a)l.push({key:{status:"valid",value:f},value:{status:"valid",value:i.data[f]}});else if(c==="strict")a.length>0&&(ee(i,{code:"unrecognized_keys",keys:a}),r.dirty());else if(c!=="strip")for(let f of a){let p=i.data[f];l.push({key:{status:"valid",value:f},value:c._parse(new Zt(i,p,i.path,f)),alwaysSet:f in i.data})}return i.common.async?Promise.resolve().then(async()=>{let f=[];for(let p of l){let g=await p.key;f.push({key:g,value:await p.value,alwaysSet:p.alwaysSet})}return f}).then(f=>bt.mergeObjectSync(r,f)):bt.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return ae.errToObj,new gt(w(M(w({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:(n,r)=>{var i,s,o,a;let l=(o=(s=(i=this._def).errorMap)==null?void 0:s.call(i,n,r).message)!=null?o:r.defaultError;return n.code==="unrecognized_keys"?{message:(a=ae.errToObj(e).message)!=null?a:l}:{message:l}}}:{}))}strip(){return new gt(M(w({},this._def),{unknownKeys:"strip"}))}passthrough(){return new gt(M(w({},this._def),{unknownKeys:"passthrough"}))}additionalProperties(){if(typeof this._def.unknownKeys=="object")return this._def.unknownKeys;if(this._def.unknownKeys==="passthrough")return De.any();if(this._def.unknownKeys==="strict")return De.never()}extend(e){return new gt(M(w({},this._def),{shape:()=>w(w({},this._def.shape()),e)}))}merge(e){return new gt({unknownKeys:e._def.unknownKeys,shape:()=>w(w({},this._def.shape()),e._def.shape()),typeName:"ZodObject"})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new gt(M(w({},this._def),{unknownKeys:e}))}pick(e){let n={};return Object.keys(e).forEach(i=>{e[i]&&this.shape[i]&&(n[i]=this.shape[i])}),new gt(M(w({},this._def),{shape:()=>n}))}omit(e){let n={};return Object.entries(this.shape).forEach(([i,s])=>{e[i]||(n[i]=s)}),new gt(M(w({},this._def),{shape:()=>n}))}partial(e){let n={};return Object.keys(this.shape).forEach(i=>{let s=this.shape[i];e&&!e[i]?n[i]=s:n[i]=s?.optional()}),new gt(M(w({},this._def),{shape:()=>n}))}required(e){let n={};return Object.entries(this.shape).forEach(([r,i])=>{if(e&&!e[r])n[r]=i;else{let o=i;for(;Se.zuiOptional(o);)o=o._def.innerType;n[r]=o}}),new gt(M(w({},this._def),{shape:()=>n}))}keyof(){let e=Object.keys(this.shape);return De.enum(e)}isEqual(e){if(!(e instanceof gt)||!this._unknownKeysEqual(e))return!1;let n=this._def.shape(),r=e._def.shape(),i=m((a,l)=>a[0]===l[0]&&a[1].isEqual(l[1]),"compare"),s=new Ye.CustomSet(Object.entries(n),{compare:i}),o=new Ye.CustomSet(Object.entries(r),{compare:i});return s.isEqual(o)}_unknownKeysEqual(e){let n=this.additionalProperties(),r=e.additionalProperties();return n===void 0||r===void 0?n===r:n.isEqual(r)}};m(sg,"ZodObjectImpl");var ag=sg,lg=class Si extends pe{dereference(e){return new Si(M(w({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Si(M(w({},this._def),{innerType:this._def.innerType.clone()}))}_parse(e){return this._getType(e)==="undefined"?{status:"valid",value:void 0}:this._def.innerType._parse(e)}unwrap(){return this._def.innerType}isEqual(e){return e instanceof Si?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return this._def.innerType.mandatory()}};m(lg,"ZodOptionalImpl");var Hx=lg,ug=class Ei extends pe{dereference(e){return new Ei(M(w({},this._def),{in:this._def.in.dereference(e),out:this._def.out.dereference(e)}))}getReferences(){return Lt.unique([...this._def.in.getReferences(),...this._def.out.getReferences()])}clone(){return new Ei(M(w({},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 m(async()=>{let s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?{status:"aborted"}:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})},"handleAsync")();{let i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?{status:"aborted"}:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}isEqual(e){return!(!(e instanceof Ei)||!this._def.in.isEqual(e._def.in)||!this._def.out.isEqual(e._def.out))}};m(ug,"ZodPipelineImpl");var Ux=ug,cg=class ki extends pe{unwrap(){return this._def.type}dereference(e){return new ki(M(w({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new ki(M(w({},this._def),{type:this._def.type.clone()}))}_parse(e){let{ctx:n}=this._processInputParams(e);return n.parsedType!=="promise"&&n.common.async===!1?(ee(n,{code:"invalid_type",expected:"promise",received:n.parsedType}),{status:"aborted"}):{status:"valid",value:(n.parsedType==="promise"?n.data:Promise.resolve(n.data)).then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap}))}}isEqual(e){return e instanceof ki?this._def.type.isEqual(e._def.type):!1}naked(){return this._def.type.naked()}};m(cg,"ZodPromiseImpl");var jx=cg,dg=class Cr extends pe{constructor(){super(...arguments),this._freeze=m(e=>e.status!=="valid"?e:M(w({},e),{value:Object.freeze(e.value)}),"_freeze")}dereference(e){return new Cr(M(w({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Cr(M(w({},this._def),{innerType:this._def.innerType.clone()}))}_parse(e){let n=this._def.innerType._parse(e);return Di(n)?n.then(this._freeze):this._freeze(n)}unwrap(){return this._def.innerType}isEqual(e){return e instanceof Cr?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return new Cr(M(w({},this._def),{innerType:this._def.innerType.mandatory()}))}};m(dg,"ZodReadonlyImpl");var $x=dg,fg=class Ai extends pe{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 Ai(M(w({},this._def),{keyType:n,valueType:r}))}getReferences(){return Lt.unique([...this._def.keyType.getReferences(),...this._def.valueType.getReferences()])}clone(){return new Ai(M(w({},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!=="object")return ee(r,{code:"invalid_type",expected:"object",received:r.parsedType}),{status:"aborted"};let i=[],s=this._def.keyType,o=this._def.valueType;for(let a in r.data)i.push({key:s._parse(new Zt(r,a,r.path,a)),value:o._parse(new Zt(r,r.data[a],r.path,a))});return r.common.async?bt.mergeObjectAsync(n,i):bt.mergeObjectSync(n,i)}get element(){return this._def.valueType}isEqual(e){return!(!(e instanceof Ai)||!this._def.keyType.isEqual(e._def.keyType)||!this._def.valueType.isEqual(e._def.valueType))}};m(fg,"ZodRecordImpl");var Hc=fg,pg=class gg extends pe{dereference(e){let n=e[this._def.uri];return n||this}getReferences(){return[this._def.uri]}_parse(e){let n=this._getOrReturnCtx(e);return ee(n,{code:"unresolved_reference"}),{status:"aborted"}}isOptional(){return!1}isNullable(){return!1}isEqual(e){return e instanceof gg?this._def.uri===e._def.uri:!1}};m(pg,"ZodRefImpl");var Zx=pg,mg=class nr extends pe{dereference(e){return new nr(M(w({},this._def),{valueType:this._def.valueType.dereference(e)}))}getReferences(){return this._def.valueType.getReferences()}clone(){return new nr(M(w({},this._def),{valueType:this._def.valueType.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!=="set")return ee(r,{code:"invalid_type",expected:"set",received:r.parsedType}),{status:"aborted"};let i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(ee(r,{code:"too_small",minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(ee(r,{code:"too_big",maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());let s=this._def.valueType;function o(l){let c=new Set;for(let f of l){if(f.status==="aborted")return{status:"aborted"};f.status==="dirty"&&n.dirty(),c.add(f.value)}return{status:n.value,value:c}}m(o,"finalizeSet");let a=[...r.data.values()].map((l,c)=>s._parse(new Zt(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(e,n){return new nr(M(w({},this._def),{minSize:{value:e,message:ae.toString(n)}}))}max(e,n){return new nr(M(w({},this._def),{maxSize:{value:e,message:ae.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,i,s;if(!(e instanceof nr))return!1;let o=(n=this._def.minSize)==null?void 0:n.value,a=(r=e._def.minSize)==null?void 0:r.value;if(o!==a)return!1;let l=(i=this._def.maxSize)==null?void 0:i.value,c=(s=e._def.maxSize)==null?void 0:s.value;return l!==c?!1:this._def.valueType.isEqual(e._def.valueType)}};m(mg,"ZodSetImpl");var Lx=mg,Wx=/^c[^\s-]{8,}$/i,Kx=/^[a-z][a-z0-9]*$/,Fx=/^[0-9A-HJKMNP-TV-Z]{26}$/,zx=/^[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,qx=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Gx="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Lo,Vx=/^(((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}))$/,Jx=/^(([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 yg(t,e){return!!((e==="v4"||!e)&&Vx.test(t)||(e==="v6"||!e)&&Jx.test(t))}m(yg,"isValidIP");var hg=class rr extends pe{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!=="string"){let s=this._getOrReturnCtx(e);return ee(s,{code:"invalid_type",expected:"string",received:s.parsedType}),{status:"aborted"}}let r=new bt,i;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),ee(i,{code:"too_small",minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(i=this._getOrReturnCtx(e,i),ee(i,{code:"too_big",maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){let o=e.data.length>s.value,a=e.data.length<s.value;(o||a)&&(i=this._getOrReturnCtx(e,i),o?ee(i,{code:"too_big",maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&ee(i,{code:"too_small",minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")qx.test(e.data)||(i=this._getOrReturnCtx(e,i),ee(i,{validation:"email",code:"invalid_string",message:s.message}),r.dirty());else if(s.kind==="emoji")Lo||(Lo=new RegExp(Gx,"u")),Lo.test(e.data)||(i=this._getOrReturnCtx(e,i),ee(i,{validation:"emoji",code:"invalid_string",message:s.message}),r.dirty());else if(s.kind==="uuid")zx.test(e.data)||(i=this._getOrReturnCtx(e,i),ee(i,{validation:"uuid",code:"invalid_string",message:s.message}),r.dirty());else if(s.kind==="cuid")Wx.test(e.data)||(i=this._getOrReturnCtx(e,i),ee(i,{validation:"cuid",code:"invalid_string",message:s.message}),r.dirty());else if(s.kind==="cuid2")Kx.test(e.data)||(i=this._getOrReturnCtx(e,i),ee(i,{validation:"cuid2",code:"invalid_string",message:s.message}),r.dirty());else if(s.kind==="ulid")Fx.test(e.data)||(i=this._getOrReturnCtx(e,i),ee(i,{validation:"ulid",code:"invalid_string",message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),ee(i,{validation:"url",code:"invalid_string",message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),ee(i,{validation:"regex",code:"invalid_string",message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(e,i),ee(i,{code:"invalid_string",validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(i=this._getOrReturnCtx(e,i),ee(i,{code:"invalid_string",validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(i=this._getOrReturnCtx(e,i),ee(i,{code:"invalid_string",validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?Tp.generateDatetimeRegex(s).test(e.data)||(i=this._getOrReturnCtx(e,i),ee(i,{code:"invalid_string",validation:"datetime",message:s.message}),r.dirty()):s.kind==="ip"?yg(e.data,s.version)||(i=this._getOrReturnCtx(e,i),ee(i,{validation:"ip",code:"invalid_string",message:s.message}),r.dirty()):Ot.assertNever(s);return{status:r.value,value:e.data}}_addCheck(e){return new rr(M(w({},this._def),{checks:[...this._def.checks,e]}))}email(e){return this._addCheck(w({kind:"email"},ae.errToObj(e)))}url(e){return this._addCheck(w({kind:"url"},ae.errToObj(e)))}emoji(e){return this._addCheck(w({kind:"emoji"},ae.errToObj(e)))}uuid(e){return this._addCheck(w({kind:"uuid"},ae.errToObj(e)))}cuid(e){return this._addCheck(w({kind:"cuid"},ae.errToObj(e)))}cuid2(e){return this._addCheck(w({kind:"cuid2"},ae.errToObj(e)))}ulid(e){return this._addCheck(w({kind:"ulid"},ae.errToObj(e)))}ip(e){return this._addCheck(w({kind:"ip"},ae.errToObj(e)))}datetime(e){var n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck(w({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(n=e?.offset)!=null?n:!1},ae.errToObj(e?.message)))}regex(e,n){return this._addCheck(w({kind:"regex",regex:e},ae.errToObj(n)))}includes(e,n){return this._addCheck(w({kind:"includes",value:e,position:n?.position},ae.errToObj(n?.message)))}startsWith(e,n){return this._addCheck(w({kind:"startsWith",value:e},ae.errToObj(n)))}endsWith(e,n){return this._addCheck(w({kind:"endsWith",value:e},ae.errToObj(n)))}min(e,n){return this._addCheck(w({kind:"min",value:e},ae.errToObj(n)))}max(e,n){return this._addCheck(w({kind:"max",value:e},ae.errToObj(n)))}length(e,n){return this._addCheck(w({kind:"length",value:e},ae.errToObj(n)))}nonempty(e){return this.min(1,ae.errToObj(e))}trim(){return new rr(M(w({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}secret(){return this._def[Ae]=M(w({},this._def[Ae]),{secret:!0}),this}toLowerCase(){return new rr(M(w({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new rr(M(w({},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 rr))return!1;let n=new Ye.CustomSet(this._def.checks),r=new Ye.CustomSet(e._def.checks);return n.isEqual(r)}};m(hg,"ZodStringImpl");var Yx=hg,Tg=class vg extends pe{_parse(e){if(this._getType(e)!=="symbol"){let r=this._getOrReturnCtx(e);return ee(r,{code:"invalid_type",expected:"symbol",received:r.parsedType}),{status:"aborted"}}return{status:"valid",value:e.data}}isEqual(e){return e instanceof vg}};m(Tg,"ZodSymbolImpl");var Xx=Tg,_g=class Or extends pe{innerType(){return this._def.schema}sourceType(){return Se.zuiEffects(this._def.schema)?this._def.schema.sourceType():this._def.schema}dereference(e){return new Or(M(w({},this._def),{schema:this._def.schema.dereference(e)}))}getReferences(){return this._def.schema.getReferences()}clone(){return new Or(M(w({},this._def),{schema:this._def.schema.clone()}))}_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.effect;if(r.type==="upstream"){let i=r.effect(n.data,{path:n.path});if(n.common.async)return Promise.resolve(i).then(async s=>{if(s??(s={status:"valid",value:n.data}),this._processResult(n,s),s.status==="aborted")return{status:"aborted"};let o=await this._def.schema._parseAsync({data:s.value,path:n.path,parent:n});return o.status==="aborted"?{status:"aborted"}:o.status==="dirty"?{status:"dirty",value:o.value}:s.status==="dirty"?{status:"dirty",value:o.value}:o});{if(i instanceof Promise)throw new Error("Asynchronous upstream transform encountered during synchronous parse operation. Use .parseAsync instead.");if(i??(i={status:"valid",value:n.data}),this._processResult(n,i),i.status==="aborted")return{status:"aborted"};let s=this._def.schema._parseSync({data:i.value,path:n.path,parent:n});return s.status==="aborted"?{status:"aborted"}:s.status==="dirty"?{status:"dirty",value:s.value}:i.status==="dirty"?{status:"dirty",value:s.value}:s}}if(r.type==="downstream")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(i.status==="aborted"||i.status==="dirty"&&r.failFast)return i;let s=r.effect(i.value,{path:n.path});if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return s??(s={status:"valid",value:i.value}),this._processResult(n,s),s.status==="aborted"?{status:"aborted"}:s.status==="dirty"?{status:"dirty",value:s.value}:i.status==="dirty"?{status:"dirty",value:s.value}:s}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>i.status==="aborted"||i.status==="dirty"&&r.failFast?i:Promise.resolve(r.effect(i.value,{path:n.path})).then(s=>(s??(s={status:"valid",value:i.value}),this._processResult(n,s),s.status==="aborted"?{status:"aborted"}:s.status==="dirty"?{status:"dirty",value:s.value}:i.status==="dirty"?{status:"dirty",value:s.value}:s)));Ot.assertNever(r)}_processResult(e,n){if(n.status!=="valid")for(let r of n.issues)ee(e,r)}isEqual(e){return!(e instanceof Or)||!this._def.schema.isEqual(e._def.schema)?!1:this._def.effect.type==="upstream"?e._def.effect.type!=="upstream"?!1:Ct.compareFunctions(this._def.effect.effect,e._def.effect.effect):this._def.effect.type==="downstream"?e._def.effect.type!=="downstream"||this._def.effect.failFast!==e._def.effect.failFast?!1:Ct.compareFunctions(this._def.effect.effect,e._def.effect.effect):(this._def.effect,!1)}naked(){return this._def.schema.naked()}mandatory(){return new Or(M(w({},this._def),{schema:this._def.schema.mandatory()}))}};m(_g,"ZodEffectsImpl");var Ts=_g,bg=class Rr extends pe{dereference(e){let n=this._def.items.map(i=>i.dereference(e)),r=this._def.rest?this._def.rest.dereference(e):null;return new Rr(M(w({},this._def),{items:n,rest:r}))}getReferences(){return Lt.unique([...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 Rr(M(w({},this._def),{items:e,rest:n}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!=="array")return ee(r,{code:"invalid_type",expected:"array",received:r.parsedType}),{status:"aborted"};if(r.data.length<this._def.items.length)return ee(r,{code:"too_small",minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),{status:"aborted"};!this._def.rest&&r.data.length>this._def.items.length&&(ee(r,{code:"too_big",maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let s=[...r.data].map((o,a)=>{let l=this._def.items[a]||this._def.rest;return l?l._parse(new Zt(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(s).then(o=>bt.mergeArray(n,o)):bt.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new Rr(M(w({},this._def),{rest:e}))}isEqual(e){if(!(e instanceof Rr)||!this._restEquals(e))return!1;let n=m((s,o)=>s.isEqual(o),"compare"),r=new Ye.CustomSet(this._def.items,{compare:n}),i=new Ye.CustomSet(e._def.items,{compare:n});return r.isEqual(i)}_restEquals(e){return this._def.rest===null?e._def.rest===null:e._def.rest!==null&&this._def.rest.isEqual(e._def.rest)}};m(bg,"ZodTupleImpl");var Qx=bg,wg=class xg extends pe{_parse(e){if(this._getType(e)!=="undefined"){let r=this._getOrReturnCtx(e);return ee(r,{code:"invalid_type",expected:"undefined",received:r.parsedType}),{status:"aborted"}}return{status:"valid",value:e.data}}isEqual(e){return e instanceof xg}mandatory(){return De.never(w({},this._def))}};m(wg,"ZodUndefinedImpl");var eP=wg,Pg=class Mr extends pe{dereference(e){let n=this._def.options.map(r=>r.dereference(e));return new Mr(M(w({},this._def),{options:n}))}getReferences(){return Lt.unique(this._def.options.reduce((e,n)=>[...e,...n.getReferences()],[]))}clone(){let e=this._def.options.map(n=>n.clone());return new Mr(M(w({},this._def),{options:e}))}_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function i(s){for(let a of s)if(a.result.status==="valid")return a.result;for(let a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;let o=s.map(a=>new Xt(a.ctx.common.issues));return ee(n,{code:"invalid_union",unionErrors:o}),{status:"aborted"}}if(m(i,"handleResults"),n.common.async)return Promise.all(r.map(async s=>{let o=M(w({},n),{common:M(w({},n.common),{issues:[]}),parent:null});return{result:await s._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(i);{let s,o=[];for(let l of r){let c=M(w({},n),{common:M(w({},n.common),{issues:[]}),parent:null}),f=l._parseSync({data:n.data,path:n.path,parent:c});if(f.status==="valid")return f;f.status==="dirty"&&!s&&(s={result:f,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;let a=o.map(l=>new Xt(l));return ee(n,{code:"invalid_union",unionErrors:a}),{status:"aborted"}}}get options(){return this._def.options}isEqual(e){if(!(e instanceof Mr))return!1;let n=m((s,o)=>s.isEqual(o),"compare"),r=new Ye.CustomSet([...this._def.options],{compare:n}),i=new Ye.CustomSet([...e._def.options],{compare:n});return r.isEqual(i)}mandatory(){let e=this._def.options.filter(s=>!Se.zuiUndefined(s)).map(s=>s.mandatory()),[n,r,...i]=e;return n?r?new Mr(M(w({},this._def),{options:[n,r,...i]})):n:De.never(w({},this._def))}};m(Pg,"ZodUnionImpl");var tP=Pg,Ig=class Bg extends pe{constructor(){super(...arguments),this._unknown=!0}_parse(e){return{status:"valid",value:e.data}}isEqual(e){return e instanceof Bg}};m(Ig,"ZodUnknownImpl");var nP=Ig,Sg=class Eg extends pe{_parse(e){if(this._getType(e)!=="undefined"){let r=this._getOrReturnCtx(e);return ee(r,{code:"invalid_type",expected:"void",received:r.parsedType}),{status:"aborted"}}return{status:"valid",value:e.data}}isEqual(e){return e instanceof Eg}};m(Sg,"ZodVoidImpl");var rP=Sg,iP=m(t=>t instanceof Error,"_isError"),oP=m(t=>typeof t=="object"&&t!==null,"_isObject"),Se={zuiError:t=>t instanceof Xt||iP(t)&&"__type__"in t&&t.__type__==="ZuiError",zuiType:t=>t instanceof pe||oP(t)&&"__type__"in t&&t.__type__==="ZuiType",zuiAny:t=>t.typeName==="ZodAny",zuiArray:t=>t.typeName==="ZodArray",zuiBigInt:t=>t.typeName==="ZodBigInt",zuiBoolean:t=>t.typeName==="ZodBoolean",zuiBranded:t=>t.typeName==="ZodBranded",zuiCatch:t=>t.typeName==="ZodCatch",zuiDate:t=>t.typeName==="ZodDate",zuiDefault:t=>t.typeName==="ZodDefault",zuiDiscriminatedUnion:t=>t.typeName==="ZodDiscriminatedUnion",zuiEnum:t=>t.typeName==="ZodEnum",zuiFunction:t=>t.typeName==="ZodFunction",zuiIntersection:t=>t.typeName==="ZodIntersection",zuiLazy:t=>t.typeName==="ZodLazy",zuiLiteral:t=>t.typeName==="ZodLiteral",zuiMap:t=>t.typeName==="ZodMap",zuiNaN:t=>t.typeName==="ZodNaN",zuiNativeEnum:t=>t.typeName==="ZodNativeEnum",zuiNever:t=>t.typeName==="ZodNever",zuiNull:t=>t.typeName==="ZodNull",zuiNullable:t=>t.typeName==="ZodNullable",zuiNumber:t=>t.typeName==="ZodNumber",zuiObject:t=>t.typeName==="ZodObject",zuiOptional:t=>t.typeName==="ZodOptional",zuiPipeline:t=>t.typeName==="ZodPipeline",zuiPromise:t=>t.typeName==="ZodPromise",zuiReadonly:t=>t.typeName==="ZodReadonly",zuiRecord:t=>t.typeName==="ZodRecord",zuiRef:t=>t.typeName==="ZodRef",zuiSet:t=>t.typeName==="ZodSet",zuiString:t=>t.typeName==="ZodString",zuiSymbol:t=>t.typeName==="ZodSymbol",zuiEffects:t=>t.typeName==="ZodEffects",zuiTuple:t=>t.typeName==="ZodTuple",zuiUndefined:t=>t.typeName==="ZodUndefined",zuiUnion:t=>t.typeName==="ZodUnion",zuiUnknown:t=>t.typeName==="ZodUnknown",zuiVoid:t=>t.typeName==="ZodVoid"},ye=m(t=>{if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:i,supportsExtensions:s,[Ae]:o}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);let a=o?Object.fromEntries(Object.entries(o).filter(([c])=>c!=="secret"||s?.includes("secret"))):void 0;return e?{errorMap:e,description:i,[Ae]:a}:{errorMap:m((c,f)=>c.code!=="invalid_type"?{message:f.defaultError}:typeof f.data>"u"?{message:r??f.defaultError}:{message:n??f.defaultError},"customMap"),description:i,[Ae]:a}},"_processCreateParams"),zi=m((t,e={},n)=>t?Nn().downstream(r=>{var i,s;if(!t(r)){let o=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e;return((s=(i=o.fatal)!=null?i:n)!=null?s:!0)?js(w({code:"custom"},o)):$s(r,w({code:"custom"},o))}}):Nn(),"customType"),vs=m((t,e={message:`Input not instance of ${t.name}`})=>zi(n=>n instanceof t,e),"instanceOfType"),Nn=m(t=>new yx(w({typeName:"ZodAny"},ye(t))),"anyType"),hn=m(t=>new nP(w({typeName:"ZodUnknown"},ye(t))),"unknownType"),Wr=m(t=>new Rx(w({typeName:"ZodNever"},ye(t))),"neverType"),_s=m(t=>new rP(w({typeName:"ZodVoid"},ye(t))),"voidType"),Jr=m(t=>new Mx(w({typeName:"ZodNull"},ye(t))),"nullType"),qi=m(t=>new eP(w({typeName:"ZodUndefined"},ye(t))),"undefinedType"),bs=m(t=>new Xx(w({typeName:"ZodSymbol"},ye(t))),"symbolType"),ws=m(t=>new Cx(w({typeName:"ZodNaN"},ye(t))),"nanType"),en=m(t=>{var e;return new Yx(w({checks:[],typeName:"ZodString",coerce:(e=t?.coerce)!=null?e:!1},ye(M(w({},t),{supportsExtensions:["secret"]}))))},"stringType"),Wn=m(t=>new Dx(w({checks:[],typeName:"ZodNumber",coerce:t?.coerce||!1},ye(t))),"numberType"),Kn=m(t=>new vx(w({typeName:"ZodBoolean",coerce:t?.coerce||!1},ye(t))),"booleanType"),Gi=m(t=>{var e;return new Tx(w({checks:[],typeName:"ZodBigInt",coerce:(e=t?.coerce)!=null?e:!1},ye(t)))},"bigIntType"),Vi=m(t=>new wx(w({checks:[],coerce:t?.coerce||!1,typeName:"ZodDate"},ye(t))),"dateType"),Ji=m(t=>new Zx({typeName:"ZodRef",uri:t}),"refType"),Kr=m((t,e)=>new kx(w({value:t,typeName:"ZodLiteral"},ye(e))),"literalType"),Yi=m((t,e)=>new Ix(w({values:t,typeName:"ZodEnum"},ye(e))),"enumType"),xs=m((t,e)=>new Ox(w({values:t,typeName:"ZodNativeEnum"},ye(e))),"nativeEnumType"),On=m((t,e)=>new hx(w({type:t,minLength:null,maxLength:null,exactLength:null,typeName:"ZodArray"},ye(e))),"arrayType"),sr=m((t,e)=>new ag(w({shape:()=>t,unknownKeys:"strip",typeName:"ZodObject"},ye(e))),"objectType"),Ps=m((t,e)=>new ag(w({shape:()=>t,unknownKeys:"strict",typeName:"ZodObject"},ye(e))),"strictObjectType"),Rn=m((t,e)=>new tP(w({options:t,typeName:"ZodUnion"},ye(e))),"unionType"),Fr=m((t,e,n)=>new Px(w({typeName:"ZodDiscriminatedUnion",discriminator:t,options:e},ye(n))),"discriminatedUnionType"),zr=m((t,e,n)=>new Sx(w({left:t,right:e,typeName:"ZodIntersection"},ye(n))),"intersectionType"),Yr=m((t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Qx(w({items:t,typeName:"ZodTuple",rest:null},ye(e)))},"tupleType"),qr=m((t,e,n)=>e instanceof pe?new Hc(w({keyType:t,valueType:e,typeName:"ZodRecord"},ye(n))):new Hc(w({keyType:en(),valueType:t,typeName:"ZodRecord"},ye(e))),"recordType"),Is=m((t,e,n)=>new Ax(w({valueType:e,keyType:t,typeName:"ZodMap"},ye(n))),"mapType"),Xi=m((t,e)=>new Lx(w({valueType:t,minSize:null,maxSize:null,typeName:"ZodSet"},ye(e))),"setType"),Bs=m((t,e)=>new Ex(w({getter:t,typeName:"ZodLazy"},ye(e))),"lazyType"),Ss=m((t,e)=>new jx(w({type:t,typeName:"ZodPromise"},ye(e))),"promiseType"),Es=m((t,e,n)=>new Bx(w({args:t||Yr([]).rest(hn()),returns:e||hn(),typeName:"ZodFunction"},ye(n))),"functionType"),ks=m((t,e,n)=>new Ts(w({schema:e,effect:{type:"upstream",effect:(r,i)=>{let s=t(r,i);return s instanceof Promise?s.then(o=>Hi(o)):Hi(s)}},typeName:"ZodEffects"},ye(n))),"preprocessType"),As=m((t,e,n)=>new Ts(w({schema:e,effect:{type:"upstream",effect:t},typeName:"ZodEffects"},ye(n))),"upstreamType"),Cs=m((t,e,n)=>new Ts(w({schema:t,effect:{type:"downstream",effect:e,failFast:n?.failFast},typeName:"ZodEffects"},ye(n))),"downstreamType"),Os=m((t,e)=>new Hx(w({innerType:t,typeName:"ZodOptional"},ye(e))),"optionalType"),Rs=m((t,e)=>new Nx(w({innerType:t,typeName:"ZodNullable"},ye(e))),"nullableType"),Ms=m((t,e)=>new $x(w({innerType:t,typeName:"ZodReadonly"},ye(e))),"readonlyType"),Ns=m((t,e,n)=>new xx(w({innerType:t,typeName:"ZodDefault",defaultValue:typeof e=="function"?e:()=>e},ye(n))),"defaultType"),Ds=m((t,e,n)=>new bx(w({innerType:t,typeName:"ZodCatch",catchValue:typeof e=="function"?e:()=>e},ye(n))),"catchType"),Hs=m((t,e)=>new Ux({in:t,out:e,typeName:"ZodPipeline"}),"pipelineType"),Us=m(t=>new _x(w({typeName:"ZodBranded",type:t},ye({supportsExtensions:["secret"]}))),"brandedType");Ip({any:Nn,array:On,bigint:Gi,boolean:Kn,branded:Us,catch:Ds,custom:zi,date:Vi,default:Ns,discriminatedUnion:Fr,enum:Yi,function:Es,instanceof:vs,intersection:zr,lazy:Bs,literal:Kr,map:Is,nan:ws,nativeEnum:xs,never:Wr,null:Jr,nullable:Rs,number:Wn,object:sr,optional:Os,pipeline:Hs,preprocess:ks,upstream:As,downstream:Cs,promise:Ss,record:qr,ref:Ji,readonly:Ms,set:Xi,strictObject:Ps,string:en,symbol:bs,tuple:Yr,undefined:qi,union:Rn,unknown:hn,void:_s});var kg={string(t){return en(M(w({},t),{coerce:!0}))},number(t){return Wn(M(w({},t),{coerce:!0}))},boolean(t){return Kn(M(w({},t),{coerce:!0}))},bigint(t){return Gi(M(w({},t),{coerce:!0}))},date(t){return Vi(M(w({},t),{coerce:!0}))}},Hi=m(t=>({status:"valid",value:t}),"OK"),js=m((t,...e)=>({status:"aborted",issues:[t,...e]}),"ERR"),$s=m((t,e,...n)=>({status:"dirty",value:t,issues:[e,...n]}),"DIRTY"),Ag={};Rt(Ag,{JSONSchemaToZuiError:()=>Qi,ObjectToZuiError:()=>is,UnrepresentableGenericError:()=>os,UnsupportedJSONSchemaToZuiError:()=>kn,UnsupportedZuiCheckToJSONSchemaError:()=>Ug,UnsupportedZuiToJSONSchemaError:()=>dt,UnsupportedZuiToTypescriptSchemaError:()=>An,UnsupportedZuiToTypescriptTypeError:()=>Kg,UntitledDeclarationError:()=>zg,ZuiToJSONSchemaError:()=>eo,ZuiToTypescriptSchemaError:()=>$g,ZuiToTypescriptTypeError:()=>to,ZuiTransformError:()=>ar});var Cg=class extends Error{constructor(e,n,r){let i=r?`${r} : ${n}`:n;super(i),this.transform=e,this.path=r}};m(Cg,"ZuiTransformError");var ar=Cg,Og=class extends ar{constructor(e,n){super("json-schema-to-zui",e,n)}};m(Og,"JSONSchemaToZuiError");var Qi=Og,Rg=class extends Qi{constructor(e,n){super(`JSON Schema ${JSON.stringify(e)} cannot be transformed to ZUI type.`,n)}};m(Rg,"UnsupportedJSONSchemaToZuiError");var kn=Rg,Mg=class extends ar{constructor(e,n){super("object-to-zui",e,n)}};m(Mg,"ObjectToZuiError");var is=Mg,Ng=class extends ar{constructor(e,n){super("zui-to-json-schema",e,n)}};m(Ng,"ZuiToJSONSchemaError");var eo=Ng,Dg=class extends eo{constructor(e,n,{suggestedAlternative:r}={}){let i=r?`Zod type ${e} cannot be transformed to JSON Schema. Suggested alternative: ${r}`:`Zod type ${e} cannot be transformed to JSON Schema.`;super(i,n)}};m(Dg,"UnsupportedZuiToJSONSchemaError");var dt=Dg,Hg=class extends eo{constructor(e,n,r){super(`Zod check .${n}() of type ${e} cannot be transformed to JSON Schema.`,r)}};m(Hg,"UnsupportedZuiCheckToJSONSchemaError");var Ug=Hg,jg=class extends ar{constructor(e,n){super("zui-to-typescript-schema",e,n)}};m(jg,"ZuiToTypescriptSchemaError");var $g=jg,Zg=class extends $g{constructor(e,n){super(`Zod type ${e} cannot be transformed to TypeScript schema.`,n)}};m(Zg,"UnsupportedZuiToTypescriptSchemaError");var An=Zg,Lg=class extends ar{constructor(e,n){super("zui-to-typescript-type",e,n)}};m(Lg,"ZuiToTypescriptTypeError");var to=Lg,Wg=class extends to{constructor(e,n){super(`Zod type ${e} cannot be transformed to TypeScript type.`,n)}};m(Wg,"UnsupportedZuiToTypescriptTypeError");var Kg=Wg,Fg=class extends to{constructor(){super("Schema must have a title to be transformed to a TypeScript type with a declaration.")}};m(Fg,"UntitledDeclarationError");var zg=Fg,qg=class extends to{constructor(){super('ZodRef can only be transformed to a TypeScript type with a "type" declaration.')}};m(qg,"UnrepresentableGenericError");var os=qg,sP=m(t=>{let e;try{e=new Function("z",`return ${t}`)(tn)}catch(n){return{sucess:!1,error:`Failed to evaluate schema: ${(n instanceof Error?n:new Error(String(n))).message}`}}return Se.zuiType(e)?{sucess:!0,value:e}:{sucess:!1,error:`String "${t}" does not evaluate to a Zod schema`}},"evalZuiString"),fe={ZodString:"ZodString",ZodNumber:"ZodNumber",ZodNaN:"ZodNaN",ZodBigInt:"ZodBigInt",ZodBoolean:"ZodBoolean",ZodDate:"ZodDate",ZodSymbol:"ZodSymbol",ZodUndefined:"ZodUndefined",ZodNull:"ZodNull",ZodAny:"ZodAny",ZodUnknown:"ZodUnknown",ZodNever:"ZodNever",ZodVoid:"ZodVoid",ZodArray:"ZodArray",ZodObject:"ZodObject",ZodUnion:"ZodUnion",ZodDiscriminatedUnion:"ZodDiscriminatedUnion",ZodIntersection:"ZodIntersection",ZodTuple:"ZodTuple",ZodRecord:"ZodRecord",ZodRef:"ZodRef",ZodMap:"ZodMap",ZodSet:"ZodSet",ZodFunction:"ZodFunction",ZodLazy:"ZodLazy",ZodLiteral:"ZodLiteral",ZodEnum:"ZodEnum",ZodEffects:"ZodEffects",ZodNativeEnum:"ZodNativeEnum",ZodOptional:"ZodOptional",ZodNullable:"ZodNullable",ZodDefault:"ZodDefault",ZodCatch:"ZodCatch",ZodPromise:"ZodPromise",ZodBranded:"ZodBranded",ZodPipeline:"ZodPipeline",ZodReadonly:"ZodReadonly"},aP=m(t=>[t.slice(0,t.length/2),t.slice(t.length/2)],"half"),lP=m((t,...e)=>Object.keys(t).reduce((n,r)=>(e.includes(r)||(n[r]=t[r]),n),{}),"omit");function at(t,e,n){var r;let i=t[e],s="";if(i!==void 0){let o=n({value:i,json:JSON.stringify(i)});if(o){let a=o[0],l=o.length===3?o[1]:"",c=o.length===3?o[2]:o[1];s+=a,((r=t.errorMessage)==null?void 0:r[e])!==void 0&&(s+=l+JSON.stringify(t.errorMessage[e])),s+=c}}return s}m(at,"withMessage");var Nr=Symbol("Original index"),uP=m(t=>{let e=[];for(let n=0;n<t.length;n++){let r=t[n];if(typeof r=="boolean")e.push(r?{[Nr]:n}:{[Nr]:n,not:{}});else{if(Nr in r)return t;e.push(M(w({},r),{[Nr]:n}))}}return e},"ensureOriginalIndex");function Gr(t,e){if(t.allOf.length===0)return"z.never()";if(t.allOf.length===1){let n=t.allOf[0];return nt(n,M(w({},e),{path:[...e.path,"allOf",n[Nr]]}))}else{let[n,r]=aP(uP(t.allOf));return`z.intersection(${Gr({allOf:n},e)}, ${Gr({allOf:r},e)})`}}m(Gr,"parseAllOf");var Gg=m((t,e)=>t.anyOf.length?t.anyOf.length===1?nt(t.anyOf[0],M(w({},e),{path:[...e.path,"anyOf",0]})):`z.union([${t.anyOf.map((n,r)=>nt(n,M(w({},e),{path:[...e.path,"anyOf",r]}))).join(", ")}])`:"z.any()","parseAnyOf"),cP=m((t,e)=>{if(Array.isArray(t.items))return`z.tuple([${t.items.map((r,i)=>nt(r,M(w({},e),{path:[...e.path,"items",i]})))}])`;let n=t.items?`z.array(${nt(t.items,M(w({},e),{path:[...e.path,"items"]}))})`:"z.array(z.any())";return n+=at(t,"minItems",({json:r})=>[`.min(${r}`,", ",")"]),n+=at(t,"maxItems",({json:r})=>[`.max(${r}`,", ",")"]),n},"parseArray"),dP=m(t=>{var e;return(e=t[Ae])!=null&&e.coerce?"z.coerce.boolean()":"z.boolean()"},"parseBoolean"),fP=m(t=>`z.literal(${JSON.stringify(t.const)})`,"parseConst"),pP=m(t=>"z.any()","parseDefault"),Zs=m((t,e)=>t.oneOf.length?t.oneOf.length===1?nt(t.oneOf[0],M(w({},e),{path:[...e.path,"oneOf",0]})):`z.any().superRefine((x, ctx) => {
|
|
10
|
+
`)):a=t.stylize("[Circular]","special")),qn(o)){if(s&&i.match(/^\d+$/))return a;(o=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+a}function jy(t){return Array.isArray(t)}function aa(t){return typeof t=="boolean"}function vo(t){return t===null}function $y(t){return typeof t=="number"}function yo(t){return typeof t=="string"}function qn(t){return t===void 0}function ei(t){return dr(t)&&la(t)==="[object RegExp]"}function dr(t){return typeof t=="object"&&t!==null}function ho(t){return dr(t)&&la(t)==="[object Date]"}function ti(t){return dr(t)&&(la(t)==="[object Error]"||t instanceof Error)}function co(t){return typeof t=="function"}function la(t){return Object.prototype.toString.call(t)}function na(t){return t<10?"0"+t.toString(10):t.toString(10)}function vB(){var t=new Date,e=[na(t.getHours()),na(t.getMinutes()),na(t.getSeconds())].join(":");return[t.getDate(),TB[t.getMonth()],e].join(" ")}function Zy(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function _B(t,e){if(!t){var n=new Error("Promise was rejected with a falsy value");n.reason=t,t=n}return e(t)}var vy,on,sn,cr,Xe,zn,an,ur,uo,Ue,JI,oa,To,wy,YI,XI,QI,eB,tB,xy,Py,ly,nB,rB,iB,Iy,be,oB,sB,aB,By,sa,wt,ht,lB,Le,cB,dB,fB,Qr,L,Kt,Ty,mB,ao,Uy,lo,TB,Fn,UC,_o=ot(()=>{S();A();k();cr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,Xe=vy={};(function(){try{on=typeof setTimeout=="function"?setTimeout:ra}catch{on=ra}try{sn=typeof clearTimeout=="function"?clearTimeout:ia}catch{sn=ia}})();an=[],ur=!1,uo=-1;Xe.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];an.push(new ay(t,e)),an.length!==1||ur||_y(by)},ay.prototype.run=function(){(this||cr).fun.apply(null,(this||cr).array)},Xe.title="browser",Xe.browser=!0,Xe.env={},Xe.argv=[],Xe.version="",Xe.versions={},Xe.on=rn,Xe.addListener=rn,Xe.once=rn,Xe.off=rn,Xe.removeListener=rn,Xe.removeAllListeners=rn,Xe.emit=rn,Xe.prependListener=rn,Xe.prependOnceListener=rn,Xe.listeners=function(t){return[]},Xe.binding=function(t){throw new Error("process.binding is not supported")},Xe.cwd=function(){return"/"},Xe.chdir=function(t){throw new Error("process.chdir is not supported")},Xe.umask=function(){return 0};Ue=vy;Ue.addListener;Ue.argv;Ue.binding;Ue.browser;Ue.chdir;Ue.cwd;Ue.emit;Ue.env;Ue.listeners;Ue.nextTick;Ue.off;Ue.on;Ue.once;Ue.prependListener;Ue.prependOnceListener;Ue.removeAllListeners;Ue.removeListener;Ue.title;Ue.umask;Ue.version;Ue.versions;JI=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",oa=Object.prototype.toString,To=function(t){return!(JI&&t&&typeof t=="object"&&Symbol.toStringTag in t)&&oa.call(t)==="[object Arguments]"},wy=function(t){return!!To(t)||t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&oa.call(t)!=="[object Array]"&&oa.call(t.callee)==="[object Function]"},YI=(function(){return To(arguments)})();To.isLegacyArguments=wy;XI=YI?To:wy,QI=Object.prototype.toString,eB=Function.prototype.toString,tB=/^\s*(?:function)?\*/,xy=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",Py=Object.getPrototypeOf,ly=(function(){if(!xy)return!1;try{return Function("return function*() {}")()}catch{}})(),nB=ly?Py(ly):{},rB=function(t){return typeof t=="function"&&(!!tB.test(eB.call(t))||(xy?Py(t)===nB:QI.call(t)==="[object GeneratorFunction]"))},iB=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}},Iy=function(t){return t&&typeof t=="object"&&typeof t.copy=="function"&&typeof t.fill=="function"&&typeof t.readUInt8=="function"},be={},oB=Iy,sB=XI,aB=rB;By=typeof BigInt<"u",sa=typeof Symbol<"u",wt=sa&&Symbol.toStringTag!==void 0,ht=typeof Uint8Array<"u",lB=typeof ArrayBuffer<"u";if(ht&&wt)var uB=Object.getPrototypeOf(Uint8Array.prototype),It=Gn(Object.getOwnPropertyDescriptor(uB,Symbol.toStringTag).get);Le=Gn(Object.prototype.toString),cB=Gn(Number.prototype.valueOf),dB=Gn(String.prototype.valueOf),fB=Gn(Boolean.prototype.valueOf);if(By)var pB=Gn(BigInt.prototype.valueOf);if(sa)var gB=Gn(Symbol.prototype.valueOf);be.isArgumentsObject=sB,be.isGeneratorFunction=aB,be.isPromise=function(t){return typeof Promise<"u"&&t instanceof Promise||t!==null&&typeof t=="object"&&typeof t.then=="function"&&typeof t.catch=="function"},be.isArrayBufferView=function(t){return lB&&ArrayBuffer.isView?ArrayBuffer.isView(t):uy(t)||dy(t)},be.isTypedArray=uy,be.isUint8Array=Ey,be.isUint8ClampedArray=Sy,be.isUint16Array=ky,be.isUint32Array=Ay,be.isInt8Array=Cy,be.isInt16Array=Oy,be.isInt32Array=Ry,be.isFloat32Array=My,be.isFloat64Array=Ny,be.isBigInt64Array=Dy,be.isBigUint64Array=Hy,io.working=typeof Map<"u"&&io(new Map),be.isMap=function(t){return typeof Map<"u"&&(io.working?io(t):t instanceof Map)},oo.working=typeof Set<"u"&&oo(new Set),be.isSet=function(t){return typeof Set<"u"&&(oo.working?oo(t):t instanceof Set)},so.working=typeof WeakMap<"u"&&so(new WeakMap),be.isWeakMap=function(t){return typeof WeakMap<"u"&&(so.working?so(t):t instanceof WeakMap)},Qs.working=typeof WeakSet<"u"&&Qs(new WeakSet),be.isWeakSet=function(t){return Qs(t)},fo.working=typeof ArrayBuffer<"u"&&fo(new ArrayBuffer),be.isArrayBuffer=cy,po.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&po(new DataView(new ArrayBuffer(1),0,1)),be.isDataView=dy,go.working=typeof SharedArrayBuffer<"u"&&go(new SharedArrayBuffer),be.isSharedArrayBuffer=fy,be.isAsyncFunction=function(t){return Le(t)==="[object AsyncFunction]"},be.isMapIterator=function(t){return Le(t)==="[object Map Iterator]"},be.isSetIterator=function(t){return Le(t)==="[object Set Iterator]"},be.isGeneratorObject=function(t){return Le(t)==="[object Generator]"},be.isWebAssemblyCompiledModule=function(t){return Le(t)==="[object WebAssembly.Module]"},be.isNumberObject=py,be.isStringObject=gy,be.isBooleanObject=my,be.isBigIntObject=yy,be.isSymbolObject=hy,be.isBoxedPrimitive=function(t){return py(t)||gy(t)||my(t)||yy(t)||hy(t)},be.isAnyArrayBuffer=function(t){return ht&&(cy(t)||fy(t))},["isProxy","isExternal","isModuleNamespaceObject"].forEach((function(t){Object.defineProperty(be,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={},Kt=Ue,Ty=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},mB=/%[sdj%]/g;L.format=function(t){if(!yo(t)){for(var e=[],n=0;n<arguments.length;n++)e.push(Tn(arguments[n]));return e.join(" ")}n=1;for(var r=arguments,i=r.length,s=String(t).replace(mB,(function(a){if(a==="%%")return"%";if(n>=i)return a;switch(a){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch{return"[Circular]"}default:return a}})),o=r[n];n<i;o=r[++n])vo(o)||!dr(o)?s+=" "+o:s+=" "+Tn(o);return s},L.deprecate=function(t,e){if(Kt!==void 0&&Kt.noDeprecation===!0)return t;if(Kt===void 0)return function(){return L.deprecate(t,e).apply(this||Qr,arguments)};var n=!1;return function(){if(!n){if(Kt.throwDeprecation)throw new Error(e);Kt.traceDeprecation?console.trace(e):console.error(e),n=!0}return t.apply(this||Qr,arguments)}};ao={},Uy=/^$/;Kt.env.NODE_DEBUG&&(lo=Kt.env.NODE_DEBUG,lo=lo.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),Uy=new RegExp("^"+lo+"$","i"));L.debuglog=function(t){if(t=t.toUpperCase(),!ao[t])if(Uy.test(t)){var e=Kt.pid;ao[t]=function(){var n=L.format.apply(L,arguments);console.error("%s %d: %s",t,e,n)}}else ao[t]=function(){};return ao[t]},L.inspect=Tn,Tn.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]},Tn.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},L.types=be,L.isArray=jy,L.isBoolean=aa,L.isNull=vo,L.isNullOrUndefined=function(t){return t==null},L.isNumber=$y,L.isString=yo,L.isSymbol=function(t){return typeof t=="symbol"},L.isUndefined=qn,L.isRegExp=ei,L.types.isRegExp=ei,L.isObject=dr,L.isDate=ho,L.types.isDate=ho,L.isError=ti,L.types.isNativeError=ti,L.isFunction=co,L.isPrimitive=function(t){return t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||typeof t=="symbol"||t===void 0},L.isBuffer=Iy;TB=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];L.log=function(){console.log("%s - %s",vB(),L.format.apply(L,arguments))},L.inherits=iB,L._extend=function(t,e){if(!e||!dr(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t};Fn=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(Fn&&t[Fn]){var e;if(typeof(e=t[Fn])!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,Fn,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var n,r,i=new Promise((function(a,l){n=a,r=l})),s=[],o=0;o<arguments.length;o++)s.push(arguments[o]);s.push((function(a,l){a?r(a):n(l)}));try{t.apply(this||Qr,s)}catch(a){r(a)}return i}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Fn&&Object.defineProperty(e,Fn,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,Ty(t))},L.promisify.custom=Fn,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 i=n.pop();if(typeof i!="function")throw new TypeError("The last argument must be of type Function");var s=this||Qr,o=function(){return i.apply(s,arguments)};t.apply(this||Qr,n).then((function(a){Kt.nextTick(o.bind(null,null,a))}),(function(a){Kt.nextTick(_B.bind(null,a,o))}))}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Object.defineProperties(e,Ty(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;UC=L.promisify;L.types});var KC,Ly=ot(()=>{S();A();k();_o();L._extend;L.callbackify;L.debuglog;L.deprecate;L.format;L.inherits;L.inspect;L.isArray;L.isBoolean;L.isBuffer;L.isDate;L.isError;L.isFunction;L.isNull;L.isNullOrUndefined;L.isNumber;L.isObject;L.isPrimitive;L.isRegExp;L.isString;L.isSymbol;L.isUndefined;L.log;KC=L.promisify;L.types;L.TextEncoder=globalThis.TextEncoder;L.TextDecoder=globalThis.TextDecoder});function fa(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function bB(){!fr||!Vn||(fr=!1,Vn.length?ln=Vn.concat(ln):bo=-1,ln.length&&Wy())}function Wy(){if(!fr){var t=setTimeout(bB,0);fr=!0;for(var e=ln.length;e;){for(Vn=ln,ln=[];++bo<e;)Vn&&Vn[bo].run();bo=-1,e=ln.length}Vn=null,fr=!1,clearTimeout(t)}}function wB(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];ln.push(new Ky(t,e)),ln.length===1&&!fr&&setTimeout(Wy,0)}function Ky(t,e){this.fun=t,this.array=e}function lt(){}function jB(t){fa("_linkedBinding")}function WB(t){fa("dlopen")}function KB(){return[]}function FB(){return[]}function eE(t,e){if(!t)throw new Error(e||"assertion error")}function iE(){return!1}function bE(){return vn.now()/1e3}function da(t){var e=Math.floor((Date.now()-vn.now())*.001),n=vn.now()*.001,r=Math.floor(n)+e,i=Math.floor(n%1*1e9);return t&&(r=r-t[0],i=i-t[1],i<0&&(r--,i+=ca)),[r,i]}function _n(){return Mt}function RE(t){return[]}var ln,fr,Vn,bo,xB,PB,IB,BB,EB,SB,kB,AB,CB,OB,RB,MB,NB,DB,HB,UB,$B,ZB,LB,zB,qB,pa,GB,VB,JB,YB,XB,QB,tE,nE,rE,oE,sE,aE,lE,uE,cE,dE,fE,pE,gE,mE,yE,hE,TE,vE,_E,vn,ua,ca,wE,xE,PE,IE,BE,EE,SE,kE,AE,CE,OE,Mt,ga=ot(()=>{S();A();k();ln=[],fr=!1,bo=-1;Ky.prototype.run=function(){this.fun.apply(null,this.array)};xB="browser",PB="x64",IB="browser",BB={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},EB=["/usr/bin/node"],SB=[],kB="v16.8.0",AB={},CB=function(t,e){console.warn((e?e+": ":"")+t)},OB=function(t){fa("binding")},RB=function(t){return 0},MB=function(){return"/"},NB=function(t){},DB={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};HB=lt,UB=[];$B={},ZB=!1,LB={};zB=lt,qB=lt,pa=function(){return{}},GB=pa,VB=pa,JB=lt,YB=lt,XB=lt,QB={};tE={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},nE=lt,rE=lt;oE=lt,sE=lt,aE=lt,lE=lt,uE=lt,cE=void 0,dE=void 0,fE=void 0,pE=lt,gE=2,mE=1,yE="/bin/usr/node",hE=9229,TE="node",vE=[],_E=lt,vn={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};vn.now===void 0&&(ua=Date.now(),vn.timing&&vn.timing.navigationStart&&(ua=vn.timing.navigationStart),vn.now=()=>Date.now()-ua);ca=1e9;da.bigint=function(t){var e=da(t);return typeof BigInt>"u"?e[0]*ca+e[1]:BigInt(e[0]*ca)+BigInt(e[1])};wE=10,xE={},PE=0;IE=_n,BE=_n,EE=_n,SE=_n,kE=_n,AE=lt,CE=_n,OE=_n;Mt={version:kB,versions:AB,arch:PB,platform:IB,release:DB,_rawDebug:HB,moduleLoadList:UB,binding:OB,_linkedBinding:jB,_events:xE,_eventsCount:PE,_maxListeners:wE,on:_n,addListener:IE,once:BE,off:EE,removeListener:SE,removeAllListeners:kE,emit:AE,prependListener:CE,prependOnceListener:OE,listeners:RE,domain:$B,_exiting:ZB,config:LB,dlopen:WB,uptime:bE,_getActiveRequests:KB,_getActiveHandles:FB,reallyExit:zB,_kill:qB,cpuUsage:pa,resourceUsage:GB,memoryUsage:VB,kill:JB,exit:YB,openStdin:XB,allowedNodeEnvironmentFlags:QB,assert:eE,features:tE,_fatalExceptions:nE,setUncaughtExceptionCaptureCallback:rE,hasUncaughtExceptionCaptureCallback:iE,emitWarning:CB,nextTick:wB,_tickCallback:oE,_debugProcess:sE,_debugEnd:aE,_startProfilerIdleNotifier:lE,_stopProfilerIdleNotifier:uE,stdout:cE,stdin:fE,stderr:dE,abort:pE,umask:RB,chdir:NB,cwd:MB,env:BB,title:xB,argv:EB,execArgv:SB,pid:gE,ppid:mE,execPath:yE,debugPort:hE,hrtime:da,argv0:TE,_preload_modules:vE,setSourceMapsEnabled:_E}});function zy(){if(Fy)return ma;Fy=!0,ma=t;function t(n,r){if(e("noDeprecation"))return n;var i=!1;function s(){if(!i){if(e("throwDeprecation"))throw new Error(r);e("traceDeprecation")?console.trace(r):console.warn(r),i=!0}return n.apply(this||ya,arguments)}return s}function e(n){try{if(!ya.localStorage)return!1}catch{return!1}var r=ya.localStorage[n];return r==null?!1:String(r).toLowerCase()==="true"}return ma}var ma,Fy,ya,qy=ot(()=>{S();A();k();ma={},Fy=!1,ya=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global});function ME(){if(Gy)return ri;Gy=!0;var t=$t(),e=t.Buffer;function n(i,s){for(var o in i)s[o]=i[o]}e.from&&e.alloc&&e.allocUnsafe&&e.allocUnsafeSlow?ri=t:(n(t,ri),ri.Buffer=r);function r(i,s,o){return e(i,s,o)}return r.prototype=Object.create(e.prototype),n(e,r),r.from=function(i,s,o){if(typeof i=="number")throw new TypeError("Argument must not be a number");return e(i,s,o)},r.alloc=function(i,s,o){if(typeof i!="number")throw new TypeError("Argument must be a number");var a=e(i);return s!==void 0?typeof o=="string"?a.fill(s,o):a.fill(s):a.fill(0),a},r.allocUnsafe=function(i){if(typeof i!="number")throw new TypeError("Argument must be a number");return e(i)},r.allocUnsafeSlow=function(i){if(typeof i!="number")throw new TypeError("Argument must be a number");return t.SlowBuffer(i)},ri}function NE(){if(Vy)return ha;Vy=!0;var t=ME().Buffer,e=t.isEncoding||function(_){switch(_=""+_,_&&_.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function n(_){if(!_)return"utf8";for(var E;;)switch(_){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return _;default:if(E)return;_=(""+_).toLowerCase(),E=!0}}function r(_){var E=n(_);if(typeof E!="string"&&(t.isEncoding===e||!e(_)))throw new Error("Unknown encoding: "+_);return E||_}ha.StringDecoder=i;function i(_){this.encoding=r(_);var E;switch(this.encoding){case"utf16le":this.text=p,this.end=g,E=4;break;case"utf8":this.fillLast=l,E=4;break;case"base64":this.text=y,this.end=T,E=3;break;default:this.write=P,this.end=I;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(E)}i.prototype.write=function(_){if(_.length===0)return"";var E,B;if(this.lastNeed){if(E=this.fillLast(_),E===void 0)return"";B=this.lastNeed,this.lastNeed=0}else B=0;return B<_.length?E?E+this.text(_,B):this.text(_,B):E||""},i.prototype.end=f,i.prototype.text=c,i.prototype.fillLast=function(_){if(this.lastNeed<=_.length)return _.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);_.copy(this.lastChar,this.lastTotal-this.lastNeed,0,_.length),this.lastNeed-=_.length};function s(_){return _<=127?0:_>>5===6?2:_>>4===14?3:_>>3===30?4:_>>6===2?-1:-2}function o(_,E,B){var D=E.length-1;if(D<B)return 0;var $=s(E[D]);return $>=0?($>0&&(_.lastNeed=$-1),$):--D<B||$===-2?0:($=s(E[D]),$>=0?($>0&&(_.lastNeed=$-2),$):--D<B||$===-2?0:($=s(E[D]),$>=0?($>0&&($===2?$=0:_.lastNeed=$-3),$):0))}function a(_,E,B){if((E[0]&192)!==128)return _.lastNeed=0,"\uFFFD";if(_.lastNeed>1&&E.length>1){if((E[1]&192)!==128)return _.lastNeed=1,"\uFFFD";if(_.lastNeed>2&&E.length>2&&(E[2]&192)!==128)return _.lastNeed=2,"\uFFFD"}}function l(_){var E=this.lastTotal-this.lastNeed,B=a(this,_);if(B!==void 0)return B;if(this.lastNeed<=_.length)return _.copy(this.lastChar,E,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);_.copy(this.lastChar,E,0,_.length),this.lastNeed-=_.length}function c(_,E){var B=o(this,_,E);if(!this.lastNeed)return _.toString("utf8",E);this.lastTotal=B;var D=_.length-(B-this.lastNeed);return _.copy(this.lastChar,0,D),_.toString("utf8",E,D)}function f(_){var E=_&&_.length?this.write(_):"";return this.lastNeed?E+"\uFFFD":E}function p(_,E){if((_.length-E)%2===0){var B=_.toString("utf16le",E);if(B){var D=B.charCodeAt(B.length-1);if(D>=55296&&D<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=_[_.length-2],this.lastChar[1]=_[_.length-1],B.slice(0,-1)}return B}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=_[_.length-1],_.toString("utf16le",E,_.length-1)}function g(_){var E=_&&_.length?this.write(_):"";if(this.lastNeed){var B=this.lastTotal-this.lastNeed;return E+this.lastChar.toString("utf16le",0,B)}return E}function y(_,E){var B=(_.length-E)%3;return B===0?_.toString("base64",E):(this.lastNeed=3-B,this.lastTotal=3,B===1?this.lastChar[0]=_[_.length-1]:(this.lastChar[0]=_[_.length-2],this.lastChar[1]=_[_.length-1]),_.toString("base64",E,_.length-B))}function T(_){var E=_&&_.length?this.write(_):"";return this.lastNeed?E+this.lastChar.toString("base64",0,3-this.lastNeed):E}function P(_){return _.toString(this.encoding)}function I(_){return _&&_.length?this.write(_):""}return ha}var ri,Gy,ha,Vy,ii,iO,Jy=ot(()=>{S();A();k();vi();ri={},Gy=!1;ha={},Vy=!1;ii=NE();ii.StringDecoder;iO=ii.StringDecoder});function DE(){if(Yy)return Ta;Yy=!0;var t=Ta={},e,n;function r(){throw new Error("setTimeout has not been defined")}function i(){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=i}catch{n=i}})();function s(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||pr,P,0)}}}function o(P){if(n===clearTimeout)return clearTimeout(P);if((n===i||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(P);try{return n(P)}catch{try{return n.call(null,P)}catch{return n.call(this||pr,P)}}}var a=[],l=!1,c,f=-1;function p(){!l||!c||(l=!1,c.length?a=c.concat(a):f=-1,a.length&&g())}function g(){if(!l){var P=s(p);l=!0;for(var I=a.length;I;){for(c=a,a=[];++f<I;)c&&c[f].run();f=-1,I=a.length}c=null,l=!1,o(P)}}t.nextTick=function(P){var I=new Array(arguments.length-1);if(arguments.length>1)for(var _=1;_<arguments.length;_++)I[_-1]=arguments[_];a.push(new y(P,I)),a.length===1&&!l&&s(g)};function y(P,I){(this||pr).fun=P,(this||pr).array=I}y.prototype.run=function(){(this||pr).fun.apply(null,(this||pr).array)},t.title="browser",t.browser=!0,t.env={},t.argv=[],t.version="",t.versions={};function T(){}return t.on=T,t.addListener=T,t.once=T,t.off=T,t.removeListener=T,t.removeAllListeners=T,t.emit=T,t.prependListener=T,t.prependOnceListener=T,t.listeners=function(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},Ta}var Ta,Yy,pr,je,va=ot(()=>{S();A();k();Ta={},Yy=!1,pr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;je=DE();je.platform="browser";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});function HE(){if(Xy)return _a;Xy=!0;var t=je;function e(s){if(typeof s!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(s))}function n(s,o){for(var a="",l=0,c=-1,f=0,p,g=0;g<=s.length;++g){if(g<s.length)p=s.charCodeAt(g);else{if(p===47)break;p=47}if(p===47){if(!(c===g-1||f===1))if(c!==g-1&&f===2){if(a.length<2||l!==2||a.charCodeAt(a.length-1)!==46||a.charCodeAt(a.length-2)!==46){if(a.length>2){var y=a.lastIndexOf("/");if(y!==a.length-1){y===-1?(a="",l=0):(a=a.slice(0,y),l=a.length-1-a.lastIndexOf("/")),c=g,f=0;continue}}else if(a.length===2||a.length===1){a="",l=0,c=g,f=0;continue}}o&&(a.length>0?a+="/..":a="..",l=2)}else a.length>0?a+="/"+s.slice(c+1,g):a=s.slice(c+1,g),l=g-c-1;c=g,f=0}else p===46&&f!==-1?++f:f=-1}return a}function r(s,o){var a=o.dir||o.root,l=o.base||(o.name||"")+(o.ext||"");return a?a===o.root?a+l:a+s+l:l}var i={resolve:function(){for(var o="",a=!1,l,c=arguments.length-1;c>=-1&&!a;c--){var f;c>=0?f=arguments[c]:(l===void 0&&(l=t.cwd()),f=l),e(f),f.length!==0&&(o=f+"/"+o,a=f.charCodeAt(0)===47)}return o=n(o,!a),a?o.length>0?"/"+o:"/":o.length>0?o:"."},normalize:function(o){if(e(o),o.length===0)return".";var a=o.charCodeAt(0)===47,l=o.charCodeAt(o.length-1)===47;return o=n(o,!a),o.length===0&&!a&&(o="."),o.length>0&&l&&(o+="/"),a?"/"+o:o},isAbsolute:function(o){return e(o),o.length>0&&o.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var o,a=0;a<arguments.length;++a){var l=arguments[a];e(l),l.length>0&&(o===void 0?o=l:o+="/"+l)}return o===void 0?".":i.normalize(o)},relative:function(o,a){if(e(o),e(a),o===a||(o=i.resolve(o),a=i.resolve(a),o===a))return"";for(var l=1;l<o.length&&o.charCodeAt(l)===47;++l);for(var c=o.length,f=c-l,p=1;p<a.length&&a.charCodeAt(p)===47;++p);for(var g=a.length,y=g-p,T=f<y?f:y,P=-1,I=0;I<=T;++I){if(I===T){if(y>T){if(a.charCodeAt(p+I)===47)return a.slice(p+I+1);if(I===0)return a.slice(p+I)}else f>T&&(o.charCodeAt(l+I)===47?P=I:I===0&&(P=0));break}var _=o.charCodeAt(l+I),E=a.charCodeAt(p+I);if(_!==E)break;_===47&&(P=I)}var B="";for(I=l+P+1;I<=c;++I)(I===c||o.charCodeAt(I)===47)&&(B.length===0?B+="..":B+="/..");return B.length>0?B+a.slice(p+P):(p+=P,a.charCodeAt(p)===47&&++p,a.slice(p))},_makeLong:function(o){return o},dirname:function(o){if(e(o),o.length===0)return".";for(var a=o.charCodeAt(0),l=a===47,c=-1,f=!0,p=o.length-1;p>=1;--p)if(a=o.charCodeAt(p),a===47){if(!f){c=p;break}}else f=!1;return c===-1?l?"/":".":l&&c===1?"//":o.slice(0,c)},basename:function(o,a){if(a!==void 0&&typeof a!="string")throw new TypeError('"ext" argument must be a string');e(o);var l=0,c=-1,f=!0,p;if(a!==void 0&&a.length>0&&a.length<=o.length){if(a.length===o.length&&a===o)return"";var g=a.length-1,y=-1;for(p=o.length-1;p>=0;--p){var T=o.charCodeAt(p);if(T===47){if(!f){l=p+1;break}}else y===-1&&(f=!1,y=p+1),g>=0&&(T===a.charCodeAt(g)?--g===-1&&(c=p):(g=-1,c=y))}return l===c?c=y:c===-1&&(c=o.length),o.slice(l,c)}else{for(p=o.length-1;p>=0;--p)if(o.charCodeAt(p)===47){if(!f){l=p+1;break}}else c===-1&&(f=!1,c=p+1);return c===-1?"":o.slice(l,c)}},extname:function(o){e(o);for(var a=-1,l=0,c=-1,f=!0,p=0,g=o.length-1;g>=0;--g){var y=o.charCodeAt(g);if(y===47){if(!f){l=g+1;break}continue}c===-1&&(f=!1,c=g+1),y===46?a===-1?a=g:p!==1&&(p=1):a!==-1&&(p=-1)}return a===-1||c===-1||p===0||p===1&&a===c-1&&a===l+1?"":o.slice(a,c)},format:function(o){if(o===null||typeof o!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof o);return r("/",o)},parse:function(o){e(o);var a={root:"",dir:"",base:"",ext:"",name:""};if(o.length===0)return a;var l=o.charCodeAt(0),c=l===47,f;c?(a.root="/",f=1):f=0;for(var p=-1,g=0,y=-1,T=!0,P=o.length-1,I=0;P>=f;--P){if(l=o.charCodeAt(P),l===47){if(!T){g=P+1;break}continue}y===-1&&(T=!1,y=P+1),l===46?p===-1?p=P:I!==1&&(I=1):p!==-1&&(I=-1)}return p===-1||y===-1||I===0||I===1&&p===y-1&&p===g+1?y!==-1&&(g===0&&c?a.base=a.name=o.slice(1,y):a.base=a.name=o.slice(g,y)):(g===0&&c?(a.name=o.slice(1,p),a.base=o.slice(1,y)):(a.name=o.slice(g,p),a.base=o.slice(g,y)),a.ext=o.slice(p,y)),g>0?a.dir=o.slice(0,g-1):c&&(a.dir="/"),a},sep:"/",delimiter:":",win32:null,posix:null};return i.posix=i,_a=i,_a}function Jn(t){throw new RangeError(ZE[t])}function eh(t,e){let n=t.split("@"),r="";n.length>1&&(r=n[0]+"@",t=n[1]);let i=(function(s,o){let a=[],l=s.length;for(;l--;)a[l]=o(s[l]);return a})((t=t.replace($E,".")).split("."),e).join(".");return r+i}function uh(t){let e=[],n=0,r=t.length;for(;n<r;){let i=t.charCodeAt(n++);if(i>=55296&&i<=56319&&n<r){let s=t.charCodeAt(n++);(64512&s)==56320?e.push(((1023&i)<<10)+(1023&s)+65536):(e.push(i),n--)}else e.push(i)}return e}function WE(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Bt(){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 si(t,e,n){if(t&&Ft.isObject(t)&&t instanceof Bt)return t;var r=new Bt;return r.parse(t,e,n),r}function QE(){if(ah)return Pa;ah=!0;var t=Ue;function e(s){if(typeof s!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(s))}function n(s,o){for(var a="",l=0,c=-1,f=0,p,g=0;g<=s.length;++g){if(g<s.length)p=s.charCodeAt(g);else{if(p===47)break;p=47}if(p===47){if(!(c===g-1||f===1))if(c!==g-1&&f===2){if(a.length<2||l!==2||a.charCodeAt(a.length-1)!==46||a.charCodeAt(a.length-2)!==46){if(a.length>2){var y=a.lastIndexOf("/");if(y!==a.length-1){y===-1?(a="",l=0):(a=a.slice(0,y),l=a.length-1-a.lastIndexOf("/")),c=g,f=0;continue}}else if(a.length===2||a.length===1){a="",l=0,c=g,f=0;continue}}o&&(a.length>0?a+="/..":a="..",l=2)}else a.length>0?a+="/"+s.slice(c+1,g):a=s.slice(c+1,g),l=g-c-1;c=g,f=0}else p===46&&f!==-1?++f:f=-1}return a}function r(s,o){var a=o.dir||o.root,l=o.base||(o.name||"")+(o.ext||"");return a?a===o.root?a+l:a+s+l:l}var i={resolve:function(){for(var o="",a=!1,l,c=arguments.length-1;c>=-1&&!a;c--){var f;c>=0?f=arguments[c]:(l===void 0&&(l=t.cwd()),f=l),e(f),f.length!==0&&(o=f+"/"+o,a=f.charCodeAt(0)===47)}return o=n(o,!a),a?o.length>0?"/"+o:"/":o.length>0?o:"."},normalize:function(o){if(e(o),o.length===0)return".";var a=o.charCodeAt(0)===47,l=o.charCodeAt(o.length-1)===47;return o=n(o,!a),o.length===0&&!a&&(o="."),o.length>0&&l&&(o+="/"),a?"/"+o:o},isAbsolute:function(o){return e(o),o.length>0&&o.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var o,a=0;a<arguments.length;++a){var l=arguments[a];e(l),l.length>0&&(o===void 0?o=l:o+="/"+l)}return o===void 0?".":i.normalize(o)},relative:function(o,a){if(e(o),e(a),o===a||(o=i.resolve(o),a=i.resolve(a),o===a))return"";for(var l=1;l<o.length&&o.charCodeAt(l)===47;++l);for(var c=o.length,f=c-l,p=1;p<a.length&&a.charCodeAt(p)===47;++p);for(var g=a.length,y=g-p,T=f<y?f:y,P=-1,I=0;I<=T;++I){if(I===T){if(y>T){if(a.charCodeAt(p+I)===47)return a.slice(p+I+1);if(I===0)return a.slice(p+I)}else f>T&&(o.charCodeAt(l+I)===47?P=I:I===0&&(P=0));break}var _=o.charCodeAt(l+I),E=a.charCodeAt(p+I);if(_!==E)break;_===47&&(P=I)}var B="";for(I=l+P+1;I<=c;++I)(I===c||o.charCodeAt(I)===47)&&(B.length===0?B+="..":B+="/..");return B.length>0?B+a.slice(p+P):(p+=P,a.charCodeAt(p)===47&&++p,a.slice(p))},_makeLong:function(o){return o},dirname:function(o){if(e(o),o.length===0)return".";for(var a=o.charCodeAt(0),l=a===47,c=-1,f=!0,p=o.length-1;p>=1;--p)if(a=o.charCodeAt(p),a===47){if(!f){c=p;break}}else f=!1;return c===-1?l?"/":".":l&&c===1?"//":o.slice(0,c)},basename:function(o,a){if(a!==void 0&&typeof a!="string")throw new TypeError('"ext" argument must be a string');e(o);var l=0,c=-1,f=!0,p;if(a!==void 0&&a.length>0&&a.length<=o.length){if(a.length===o.length&&a===o)return"";var g=a.length-1,y=-1;for(p=o.length-1;p>=0;--p){var T=o.charCodeAt(p);if(T===47){if(!f){l=p+1;break}}else y===-1&&(f=!1,y=p+1),g>=0&&(T===a.charCodeAt(g)?--g===-1&&(c=p):(g=-1,c=y))}return l===c?c=y:c===-1&&(c=o.length),o.slice(l,c)}else{for(p=o.length-1;p>=0;--p)if(o.charCodeAt(p)===47){if(!f){l=p+1;break}}else c===-1&&(f=!1,c=p+1);return c===-1?"":o.slice(l,c)}},extname:function(o){e(o);for(var a=-1,l=0,c=-1,f=!0,p=0,g=o.length-1;g>=0;--g){var y=o.charCodeAt(g);if(y===47){if(!f){l=g+1;break}continue}c===-1&&(f=!1,c=g+1),y===46?a===-1?a=g:p!==1&&(p=1):a!==-1&&(p=-1)}return a===-1||c===-1||p===0||p===1&&a===c-1&&a===l+1?"":o.slice(a,c)},format:function(o){if(o===null||typeof o!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof o);return r("/",o)},parse:function(o){e(o);var a={root:"",dir:"",base:"",ext:"",name:""};if(o.length===0)return a;var l=o.charCodeAt(0),c=l===47,f;c?(a.root="/",f=1):f=0;for(var p=-1,g=0,y=-1,T=!0,P=o.length-1,I=0;P>=f;--P){if(l=o.charCodeAt(P),l===47){if(!T){g=P+1;break}continue}y===-1&&(T=!1,y=P+1),l===46?p===-1?p=P:I!==1&&(I=1):p!==-1&&(I=-1)}return p===-1||y===-1||I===0||I===1&&p===y-1&&p===g+1?y!==-1&&(g===0&&c?a.base=a.name=o.slice(1,y):a.base=a.name=o.slice(g,y)):(g===0&&c?(a.name=o.slice(1,p),a.base=o.slice(1,y)):(a.name=o.slice(g,p),a.base=o.slice(g,y)),a.ext=o.slice(p,y)),g>0?a.dir=o.slice(0,g-1):c&&(a.dir="/"),a},sep:"/",delimiter:":",win32:null,posix:null};return i.posix=i,Pa=i,Pa}function dS(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 Ba?fS(t):pS(t)}function fS(t){let e=t.hostname,n=t.pathname;for(let r=0;r<n.length;r++)if(n[r]==="%"){let i=n.codePointAt(r+2)||32;if(n[r+1]==="2"&&i===102||n[r+1]==="5"&&i===99)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(n=n.replace(oS,"\\"),n=decodeURIComponent(n),e!=="")return`\\\\${e}${n}`;{let r=n.codePointAt(1)|32,i=n[2];if(r<rS||r>iS||i!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return n.slice(1)}}function pS(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 gS(t){let e=lh.resolve(t),n=t.charCodeAt(t.length-1);(n===nS||Ba&&n===tS)&&e[e.length-1]!==lh.sep&&(e+="/");let r=new URL("file://");return e.includes("%")&&(e=e.replace(sS,"%25")),!Ba&&e.includes("\\")&&(e=e.replace(aS,"%5C")),e.includes(`
|
|
11
|
+
`)&&(e=e.replace(lS,"%0A")),e.includes("\r")&&(e=e.replace(uS,"%0D")),e.includes(" ")&&(e=e.replace(cS,"%09")),r.pathname=e,r}function BS(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 Ea?ES(t):SS(t)}function ES(t){let e=t.hostname,n=t.pathname;for(let r=0;r<n.length;r++)if(n[r]==="%"){let i=n.codePointAt(r+2)||32;if(n[r+1]==="2"&&i===102||n[r+1]==="5"&&i===99)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(n=n.replace(_S,"\\"),n=decodeURIComponent(n),e!=="")return`\\\\${e}${n}`;{let r=n.codePointAt(1)|32,i=n[2];if(r<TS||r>vS||i!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return n.slice(1)}}function SS(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 kS(t){let e=Qy.resolve(t),n=t.charCodeAt(t.length-1);(n===hS||Ea&&n===yS)&&e[e.length-1]!==Qy.sep&&(e+="/");let r=new URL("file://");return e.includes("%")&&(e=e.replace(bS,"%25")),!Ea&&e.includes("\\")&&(e=e.replace(wS,"%5C")),e.includes(`
|
|
12
|
+
`)&&(e=e.replace(xS,"%0A")),e.includes("\r")&&(e=e.replace(PS,"%0D")),e.includes(" ")&&(e=e.replace(IS,"%09")),r.pathname=e,r}var _a,Xy,Qy,mr,UE,jE,$E,ZE,zt,ba,th,ch,nh,rh,LE,KE,oi,FE,un,Oe,zE,Ft,qE,GE,VE,JE,Ia,ih,oh,sh,YE,XE,wa,gr,xa,Pa,ah,lh,eS,tS,nS,rS,iS,Ba,oS,sS,aS,lS,uS,cS,mS,yS,hS,TS,vS,Ea,_S,bS,wS,xS,PS,IS,dh=ot(()=>{S();A();k();_o();va();_a={},Xy=!1;Qy=HE(),mr=2147483647,UE=/^xn--/,jE=/[^\0-\x7E]/,$E=/[\x2E\u3002\uFF0E\uFF61]/g,ZE={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},zt=Math.floor,ba=String.fromCharCode;th=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},ch=function(t,e,n){let r=0;for(t=n?zt(t/700):t>>1,t+=zt(t/e);t>455;r+=36)t=zt(t/35);return zt(r+36*t/(t+38))},nh=function(t){let e=[],n=t.length,r=0,i=128,s=72,o=t.lastIndexOf("-");o<0&&(o=0);for(let l=0;l<o;++l)t.charCodeAt(l)>=128&&Jn("not-basic"),e.push(t.charCodeAt(l));for(let l=o>0?o+1:0;l<n;){let c=r;for(let p=1,g=36;;g+=36){l>=n&&Jn("invalid-input");let y=(a=t.charCodeAt(l++))-48<10?a-22:a-65<26?a-65:a-97<26?a-97:36;(y>=36||y>zt((mr-r)/p))&&Jn("overflow"),r+=y*p;let T=g<=s?1:g>=s+26?26:g-s;if(y<T)break;let P=36-T;p>zt(mr/P)&&Jn("overflow"),p*=P}let f=e.length+1;s=ch(r-c,f,c==0),zt(r/f)>mr-i&&Jn("overflow"),i+=zt(r/f),r%=f,e.splice(r++,0,i)}var a;return String.fromCodePoint(...e)},rh=function(t){let e=[],n=(t=uh(t)).length,r=128,i=0,s=72;for(let l of t)l<128&&e.push(ba(l));let o=e.length,a=o;for(o&&e.push("-");a<n;){let l=mr;for(let f of t)f>=r&&f<l&&(l=f);let c=a+1;l-r>zt((mr-i)/c)&&Jn("overflow"),i+=(l-r)*c,r=l;for(let f of t)if(f<r&&++i>mr&&Jn("overflow"),f==r){let p=i;for(let g=36;;g+=36){let y=g<=s?1:g>=s+26?26:g-s;if(p<y)break;let T=p-y,P=36-y;e.push(ba(th(y+T%P,0))),p=zt(T/P)}e.push(ba(th(p,0))),s=ch(i,c,a==o),i=0,++a}++i,++r}return e.join("")},LE={version:"2.1.0",ucs2:{decode:uh,encode:t=>String.fromCodePoint(...t)},decode:nh,encode:rh,toASCII:function(t){return eh(t,(function(e){return jE.test(e)?"xn--"+rh(e):e}))},toUnicode:function(t){return eh(t,(function(e){return UE.test(e)?nh(e.slice(4).toLowerCase()):e}))}};KE=function(t,e,n,r){e=e||"&",n=n||"=";var i={};if(typeof t!="string"||t.length===0)return i;var s=/\+/g;t=t.split(e);var o=1e3;r&&typeof r.maxKeys=="number"&&(o=r.maxKeys);var a=t.length;o>0&&a>o&&(a=o);for(var l=0;l<a;++l){var c,f,p,g,y=t[l].replace(s,"%20"),T=y.indexOf(n);T>=0?(c=y.substr(0,T),f=y.substr(T+1)):(c=y,f=""),p=decodeURIComponent(c),g=decodeURIComponent(f),WE(i,p)?Array.isArray(i[p])?i[p].push(g):i[p]=[i[p],g]:i[p]=g}return i},oi=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}},FE=function(t,e,n,r){return e=e||"&",n=n||"=",t===null&&(t=void 0),typeof t=="object"?Object.keys(t).map((function(i){var s=encodeURIComponent(oi(i))+n;return Array.isArray(t[i])?t[i].map((function(o){return s+encodeURIComponent(oi(o))})).join(e):s+encodeURIComponent(oi(t[i]))})).join(e):r?encodeURIComponent(oi(r))+n+encodeURIComponent(oi(t)):""},un={};un.decode=un.parse=KE,un.encode=un.stringify=FE;un.decode;un.encode;un.parse;un.stringify;Oe={},zE=LE,Ft={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}};Oe.parse=si,Oe.resolve=function(t,e){return si(t,!1,!0).resolve(e)},Oe.resolveObject=function(t,e){return t?si(t,!1,!0).resolveObject(e):e},Oe.format=function(t){return Ft.isString(t)&&(t=si(t)),t instanceof Bt?t.format():Bt.prototype.format.call(t)},Oe.Url=Bt;qE=/^([a-z0-9.+-]+:)/i,GE=/:[0-9]*$/,VE=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,JE=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r",`
|
|
13
|
+
`," "]),Ia=["'"].concat(JE),ih=["%","/","?",";","#"].concat(Ia),oh=["/","?","#"],sh=/^[+a-z0-9A-Z_-]{0,63}$/,YE=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,XE={javascript:!0,"javascript:":!0},wa={javascript:!0,"javascript:":!0},gr={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},xa=un;Bt.prototype.parse=function(t,e,n){if(!Ft.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var r=t.indexOf("?"),i=r!==-1&&r<t.indexOf("#")?"?":"#",s=t.split(i);s[0]=s[0].replace(/\\/g,"/");var o=t=s.join(i);if(o=o.trim(),!n&&t.split("#").length===1){var a=VE.exec(o);if(a)return this.path=o,this.href=o,this.pathname=a[1],a[2]?(this.search=a[2],this.query=e?xa.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var l=qE.exec(o);if(l){var c=(l=l[0]).toLowerCase();this.protocol=c,o=o.substr(l.length)}if(n||l||o.match(/^\/\/[^@\/]+@[^@\/]+/)){var f=o.substr(0,2)==="//";!f||l&&wa[l]||(o=o.substr(2),this.slashes=!0)}if(!wa[l]&&(f||l&&!gr[l])){for(var p,g,y=-1,T=0;T<oh.length;T++)(P=o.indexOf(oh[T]))!==-1&&(y===-1||P<y)&&(y=P);for((g=y===-1?o.lastIndexOf("@"):o.lastIndexOf("@",y))!==-1&&(p=o.slice(0,g),o=o.slice(g+1),this.auth=decodeURIComponent(p)),y=-1,T=0;T<ih.length;T++){var P;(P=o.indexOf(ih[T]))!==-1&&(y===-1||P<y)&&(y=P)}y===-1&&(y=o.length),this.host=o.slice(0,y),o=o.slice(y),this.parseHost(),this.hostname=this.hostname||"";var I=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!I)for(var _=this.hostname.split(/\./),E=(T=0,_.length);T<E;T++){var B=_[T];if(B&&!B.match(sh)){for(var D="",$=0,te=B.length;$<te;$++)B.charCodeAt($)>127?D+="x":D+=B[$];if(!D.match(sh)){var Q=_.slice(0,T),ce=_.slice(T+1),Y=B.match(YE);Y&&(Q.push(Y[1]),ce.unshift(Y[2])),ce.length&&(o="/"+ce.join(".")+o),this.hostname=Q.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),I||(this.hostname=zE.toASCII(this.hostname));var J=this.port?":"+this.port:"",Be=this.hostname||"";this.host=Be+J,this.href+=this.host,I&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),o[0]!=="/"&&(o="/"+o))}if(!XE[c])for(T=0,E=Ia.length;T<E;T++){var We=Ia[T];if(o.indexOf(We)!==-1){var Qe=encodeURIComponent(We);Qe===We&&(Qe=escape(We)),o=o.split(We).join(Qe)}}var qe=o.indexOf("#");qe!==-1&&(this.hash=o.substr(qe),o=o.slice(0,qe));var Ge=o.indexOf("?");if(Ge!==-1?(this.search=o.substr(Ge),this.query=o.substr(Ge+1),e&&(this.query=xa.parse(this.query)),o=o.slice(0,Ge)):e&&(this.search="",this.query={}),o&&(this.pathname=o),gr[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){J=this.pathname||"";var pt=this.search||"";this.path=J+pt}return this.href=this.format(),this},Bt.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||"",i=!1,s="";this.host?i=t+this.host:this.hostname&&(i=t+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(i+=":"+this.port)),this.query&&Ft.isObject(this.query)&&Object.keys(this.query).length&&(s=xa.stringify(this.query));var o=this.search||s&&"?"+s||"";return e&&e.substr(-1)!==":"&&(e+=":"),this.slashes||(!e||gr[e])&&i!==!1?(i="//"+(i||""),n&&n.charAt(0)!=="/"&&(n="/"+n)):i||(i=""),r&&r.charAt(0)!=="#"&&(r="#"+r),o&&o.charAt(0)!=="?"&&(o="?"+o),e+i+(n=n.replace(/[?#]/g,(function(a){return encodeURIComponent(a)})))+(o=o.replace("#","%23"))+r},Bt.prototype.resolve=function(t){return this.resolveObject(si(t,!1,!0)).format()},Bt.prototype.resolveObject=function(t){if(Ft.isString(t)){var e=new Bt;e.parse(t,!1,!0),t=e}for(var n=new Bt,r=Object.keys(this),i=0;i<r.length;i++){var s=r[i];n[s]=this[s]}if(n.hash=t.hash,t.href==="")return n.href=n.format(),n;if(t.slashes&&!t.protocol){for(var o=Object.keys(t),a=0;a<o.length;a++){var l=o[a];l!=="protocol"&&(n[l]=t[l])}return gr[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(t.protocol&&t.protocol!==n.protocol){if(!gr[t.protocol]){for(var c=Object.keys(t),f=0;f<c.length;f++){var p=c[f];n[p]=t[p]}return n.href=n.format(),n}if(n.protocol=t.protocol,t.host||wa[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 y=n.pathname||"",T=n.search||"";n.path=y+T}return n.slashes=n.slashes||t.slashes,n.href=n.format(),n}var P=n.pathname&&n.pathname.charAt(0)==="/",I=t.host||t.pathname&&t.pathname.charAt(0)==="/",_=I||P||n.host&&t.pathname,E=_,B=n.pathname&&n.pathname.split("/")||[],D=(g=t.pathname&&t.pathname.split("/")||[],n.protocol&&!gr[n.protocol]);if(D&&(n.hostname="",n.port=null,n.host&&(B[0]===""?B[0]=n.host:B.unshift(n.host)),n.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(g[0]===""?g[0]=t.host:g.unshift(t.host)),t.host=null),_=_&&(g[0]===""||B[0]==="")),I)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,B=g;else if(g.length)B||(B=[]),B.pop(),B=B.concat(g),n.search=t.search,n.query=t.query;else if(!Ft.isNullOrUndefined(t.search))return D&&(n.hostname=n.host=B.shift(),(Y=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=Y.shift(),n.host=n.hostname=Y.shift())),n.search=t.search,n.query=t.query,Ft.isNull(n.pathname)&&Ft.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n;if(!B.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var $=B.slice(-1)[0],te=(n.host||t.host||B.length>1)&&($==="."||$==="..")||$==="",Q=0,ce=B.length;ce>=0;ce--)($=B[ce])==="."?B.splice(ce,1):$===".."?(B.splice(ce,1),Q++):Q&&(B.splice(ce,1),Q--);if(!_&&!E)for(;Q--;Q)B.unshift("..");!_||B[0]===""||B[0]&&B[0].charAt(0)==="/"||B.unshift(""),te&&B.join("/").substr(-1)!=="/"&&B.push("");var Y,J=B[0]===""||B[0]&&B[0].charAt(0)==="/";return D&&(n.hostname=n.host=J?"":B.length?B.shift():"",(Y=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=Y.shift(),n.host=n.hostname=Y.shift())),(_=_||n.host&&B.length)&&!J&&B.unshift(""),B.length?n.pathname=B.join("/"):(n.pathname=null,n.path=null),Ft.isNull(n.pathname)&&Ft.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},Bt.prototype.parseHost=function(){var t=this.host,e=GE.exec(t);e&&((e=e[0])!==":"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};Oe.Url;Oe.format;Oe.resolve;Oe.resolveObject;Pa={},ah=!1;lh=QE(),eS=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;Oe.URL=typeof URL<"u"?URL:null;Oe.pathToFileURL=gS;Oe.fileURLToPath=dS;Oe.Url;Oe.format;Oe.resolve;Oe.resolveObject;Oe.URL;tS=92,nS=47,rS=97,iS=122,Ba=eS==="win32",oS=/\//g,sS=/%/g,aS=/\\/g,lS=/\n/g,uS=/\r/g,cS=/\t/g;mS=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;Oe.URL=typeof URL<"u"?URL:null;Oe.pathToFileURL=kS;Oe.fileURLToPath=BS;Oe.Url;Oe.format;Oe.resolve;Oe.resolveObject;Oe.parse;Oe.URL;yS=92,hS=47,TS=97,vS=122,Ea=mS==="win32",_S=/\//g,bS=/%/g,wS=/\\/g,xS=/\n/g,PS=/\r/g,IS=/\t/g});var Kh={};pn(Kh,{Agent:()=>$S,ClientRequest:()=>ZS,IncomingMessage:()=>LS,METHODS:()=>WS,STATUS_CODES:()=>KS,default:()=>cn,get:()=>FS,globalAgent:()=>zS,request:()=>qS});function Nh(){if(fh)return xt;fh=!0,xt.fetch=r(Yn.fetch)&&r(Yn.ReadableStream),xt.writableStream=r(Yn.WritableStream),xt.abortController=r(Yn.AbortController);var t;function e(){if(t!==void 0)return t;if(Yn.XMLHttpRequest){t=new Yn.XMLHttpRequest;try{t.open("GET",Yn.XDomainRequest?"/":"https://example.com")}catch{t=null}}else t=null;return t}function n(i){var s=e();if(!s)return!1;try{return s.responseType=i,s.responseType===i}catch{}return!1}xt.arraybuffer=xt.fetch||n("arraybuffer"),xt.msstream=!xt.fetch&&n("ms-stream"),xt.mozchunkedarraybuffer=!xt.fetch&&n("moz-chunked-arraybuffer"),xt.overrideMimeType=xt.fetch||(e()?r(e().overrideMimeType):!1);function r(i){return typeof i=="function"}return t=null,xt}function Dh(){return ph||(ph=!0,Sa=yt.EventEmitter),Sa}function AS(){if(gh)return ka;gh=!0;function t(T,P){var I=Object.keys(T);if(Object.getOwnPropertySymbols){var _=Object.getOwnPropertySymbols(T);P&&(_=_.filter(function(E){return Object.getOwnPropertyDescriptor(T,E).enumerable})),I.push.apply(I,_)}return I}function e(T){for(var P=1;P<arguments.length;P++){var I=arguments[P]!=null?arguments[P]:{};P%2?t(Object(I),!0).forEach(function(_){n(T,_,I[_])}):Object.getOwnPropertyDescriptors?Object.defineProperties(T,Object.getOwnPropertyDescriptors(I)):t(Object(I)).forEach(function(_){Object.defineProperty(T,_,Object.getOwnPropertyDescriptor(I,_))})}return T}function n(T,P,I){return P=o(P),P in T?Object.defineProperty(T,P,{value:I,enumerable:!0,configurable:!0,writable:!0}):T[P]=I,T}function r(T,P){if(!(T instanceof P))throw new TypeError("Cannot call a class as a function")}function i(T,P){for(var I=0;I<P.length;I++){var _=P[I];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(T,o(_.key),_)}}function s(T,P,I){return P&&i(T.prototype,P),Object.defineProperty(T,"prototype",{writable:!1}),T}function o(T){var P=a(T,"string");return typeof P=="symbol"?P:String(P)}function a(T,P){if(typeof T!="object"||T===null)return T;var I=T[Symbol.toPrimitive];if(I!==void 0){var _=I.call(T,P||"default");if(typeof _!="object")return _;throw new TypeError("@@toPrimitive must return a primitive value.")}return(P==="string"?String:Number)(T)}var l=$t(),c=l.Buffer,f=L,p=f.inspect,g=p&&p.custom||"inspect";function y(T,P,I){c.prototype.copy.call(T,P,I)}return ka=(function(){function T(){r(this,T),this.head=null,this.tail=null,this.length=0}return s(T,[{key:"push",value:function(I){var _={data:I,next:null};this.length>0?this.tail.next=_:this.head=_,this.tail=_,++this.length}},{key:"unshift",value:function(I){var _={data:I,next:this.head};this.length===0&&(this.tail=_),this.head=_,++this.length}},{key:"shift",value:function(){if(this.length!==0){var I=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,I}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(I){if(this.length===0)return"";for(var _=this.head,E=""+_.data;_=_.next;)E+=I+_.data;return E}},{key:"concat",value:function(I){if(this.length===0)return c.alloc(0);for(var _=c.allocUnsafe(I>>>0),E=this.head,B=0;E;)y(E.data,_,B),B+=E.data.length,E=E.next;return _}},{key:"consume",value:function(I,_){var E;return I<this.head.data.length?(E=this.head.data.slice(0,I),this.head.data=this.head.data.slice(I)):I===this.head.data.length?E=this.shift():E=_?this._getString(I):this._getBuffer(I),E}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(I){var _=this.head,E=1,B=_.data;for(I-=B.length;_=_.next;){var D=_.data,$=I>D.length?D.length:I;if($===D.length?B+=D:B+=D.slice(0,I),I-=$,I===0){$===D.length?(++E,_.next?this.head=_.next:this.head=this.tail=null):(this.head=_,_.data=D.slice($));break}++E}return this.length-=E,B}},{key:"_getBuffer",value:function(I){var _=c.allocUnsafe(I),E=this.head,B=1;for(E.data.copy(_),I-=E.data.length;E=E.next;){var D=E.data,$=I>D.length?D.length:I;if(D.copy(_,_.length-I,0,$),I-=$,I===0){$===D.length?(++B,E.next?this.head=E.next:this.head=this.tail=null):(this.head=E,E.data=D.slice($));break}++B}return this.length-=B,_}},{key:g,value:function(I,_){return p(this,e(e({},_),{},{depth:0,customInspect:!1}))}}]),T})(),ka}function Hh(){if(mh)return Aa;mh=!0;var t=Mt;function e(a,l){var c=this,f=this._readableState&&this._readableState.destroyed,p=this._writableState&&this._writableState.destroyed;return f||p?(l?l(a):a&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(s,this,a)):t.nextTick(s,this,a)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(a||null,function(g){!l&&g?c._writableState?c._writableState.errorEmitted?t.nextTick(r,c):(c._writableState.errorEmitted=!0,t.nextTick(n,c,g)):t.nextTick(n,c,g):l?(t.nextTick(r,c),l(g)):t.nextTick(r,c)}),this)}function n(a,l){s(a,l),r(a)}function r(a){a._writableState&&!a._writableState.emitClose||a._readableState&&!a._readableState.emitClose||a.emit("close")}function i(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function s(a,l){a.emit("error",l)}function o(a,l){var c=a._readableState,f=a._writableState;c&&c.autoDestroy||f&&f.autoDestroy?a.destroy(l):a.emit("error",l)}return Aa={destroy:e,undestroy:i,errorOrDestroy:o},Aa}function hr(){if(yh)return Ca;yh=!0;let t={};function e(o,a,l){l||(l=Error);function c(p,g,y){return typeof a=="string"?a:a(p,g,y)}class f extends l{constructor(g,y,T){super(c(g,y,T))}}f.prototype.name=l.name,f.prototype.code=o,t[o]=f}function n(o,a){if(Array.isArray(o)){let l=o.length;return o=o.map(c=>String(c)),l>2?`one of ${a} ${o.slice(0,l-1).join(", ")}, or `+o[l-1]:l===2?`one of ${a} ${o[0]} or ${o[1]}`:`of ${a} ${o[0]}`}else return`of ${a} ${String(o)}`}function r(o,a,l){return o.substr(0,a.length)===a}function i(o,a,l){return(l===void 0||l>o.length)&&(l=o.length),o.substring(l-a.length,l)===a}function s(o,a,l){return typeof l!="number"&&(l=0),l+a.length>o.length?!1:o.indexOf(a,l)!==-1}return e("ERR_INVALID_OPT_VALUE",function(o,a){return'The value "'+a+'" is invalid for option "'+o+'"'},TypeError),e("ERR_INVALID_ARG_TYPE",function(o,a,l){let c;typeof a=="string"&&r(a,"not ")?(c="must not be",a=a.replace(/^not /,"")):c="must be";let f;if(i(o," argument"))f=`The ${o} ${c} ${n(a,"type")}`;else{let p=s(o,".")?"property":"argument";f=`The "${o}" ${p} ${c} ${n(a,"type")}`}return f+=`. Received type ${typeof l}`,f},TypeError),e("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),e("ERR_METHOD_NOT_IMPLEMENTED",function(o){return"The "+o+" method is not implemented"}),e("ERR_STREAM_PREMATURE_CLOSE","Premature close"),e("ERR_STREAM_DESTROYED",function(o){return"Cannot call "+o+" 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(o){return"Unknown encoding: "+o},TypeError),e("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),Ca.codes=t,Ca}function Uh(){if(hh)return Oa;hh=!0;var t=hr().codes.ERR_INVALID_OPT_VALUE;function e(r,i,s){return r.highWaterMark!=null?r.highWaterMark:i?r[s]:null}function n(r,i,s,o){var a=e(i,o,s);if(a!=null){if(!(isFinite(a)&&Math.floor(a)===a)||a<0){var l=o?s:"highWaterMark";throw new t(l,a)}return Math.floor(a)}return r.objectMode?16:16*1024}return Oa={getHighWaterMark:n},Oa}function jh(){if(Th)return Ra;Th=!0;var t=Mt;Ra=Y;function e(R){var C=this;this.next=null,this.entry=null,this.finish=function(){ge(C,R)}}var n;Y.WritableState=Q;var r={deprecate:zy()},i=Dh(),s=$t().Buffer,o=(typeof vh<"u"?vh:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function a(R){return s.from(R)}function l(R){return s.isBuffer(R)||R instanceof o}var c=Hh(),f=Uh(),p=f.getHighWaterMark,g=hr().codes,y=g.ERR_INVALID_ARG_TYPE,T=g.ERR_METHOD_NOT_IMPLEMENTED,P=g.ERR_MULTIPLE_CALLBACK,I=g.ERR_STREAM_CANNOT_PIPE,_=g.ERR_STREAM_DESTROYED,E=g.ERR_STREAM_NULL_VALUES,B=g.ERR_STREAM_WRITE_AFTER_END,D=g.ERR_UNKNOWN_ENCODING,$=c.errorOrDestroy;Wt()(Y,i);function te(){}function Q(R,C,j){n=n||yr(),R=R||{},typeof j!="boolean"&&(j=C instanceof n),this.objectMode=!!R.objectMode,j&&(this.objectMode=this.objectMode||!!R.writableObjectMode),this.highWaterMark=p(this,R,"writableHighWaterMark",j),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var V=R.decodeStrings===!1;this.decodeStrings=!V,this.defaultEncoding=R.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(ne){Me(C,ne)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=R.emitClose!==!1,this.autoDestroy=!!R.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}Q.prototype.getBuffer=function(){for(var C=this.bufferedRequest,j=[];C;)j.push(C),C=C.next;return j},(function(){try{Object.defineProperty(Q.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var ce;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(ce=Function.prototype[Symbol.hasInstance],Object.defineProperty(Y,Symbol.hasInstance,{value:function(C){return ce.call(this,C)?!0:this!==Y?!1:C&&C._writableState instanceof Q}})):ce=function(C){return C instanceof this};function Y(R){n=n||yr();var C=this instanceof n;if(!C&&!ce.call(Y,this))return new Y(R);this._writableState=new Q(R,this,C),this.writable=!0,R&&(typeof R.write=="function"&&(this._write=R.write),typeof R.writev=="function"&&(this._writev=R.writev),typeof R.destroy=="function"&&(this._destroy=R.destroy),typeof R.final=="function"&&(this._final=R.final)),i.call(this)}Y.prototype.pipe=function(){$(this,new I)};function J(R,C){var j=new B;$(R,j),t.nextTick(C,j)}function Be(R,C,j,V){var ne;return j===null?ne=new E:typeof j!="string"&&!C.objectMode&&(ne=new y("chunk",["string","Buffer"],j)),ne?($(R,ne),t.nextTick(V,ne),!1):!0}Y.prototype.write=function(R,C,j){var V=this._writableState,ne=!1,b=!V.objectMode&&l(R);return b&&!s.isBuffer(R)&&(R=a(R)),typeof C=="function"&&(j=C,C=null),b?C="buffer":C||(C=V.defaultEncoding),typeof j!="function"&&(j=te),V.ending?J(this,j):(b||Be(this,V,R,j))&&(V.pendingcb++,ne=Qe(this,V,b,R,C,j)),ne},Y.prototype.cork=function(){this._writableState.corked++},Y.prototype.uncork=function(){var R=this._writableState;R.corked&&(R.corked--,!R.writing&&!R.corked&&!R.bufferProcessing&&R.bufferedRequest&&se(this,R))},Y.prototype.setDefaultEncoding=function(C){if(typeof C=="string"&&(C=C.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((C+"").toLowerCase())>-1))throw new D(C);return this._writableState.defaultEncoding=C,this},Object.defineProperty(Y.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function We(R,C,j){return!R.objectMode&&R.decodeStrings!==!1&&typeof C=="string"&&(C=s.from(C,j)),C}Object.defineProperty(Y.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Qe(R,C,j,V,ne,b){if(!j){var x=We(C,V,ne);V!==x&&(j=!0,ne="buffer",V=x)}var F=C.objectMode?1:V.length;C.length+=F;var X=C.length<C.highWaterMark;if(X||(C.needDrain=!0),C.writing||C.corked){var ke=C.lastBufferedRequest;C.lastBufferedRequest={chunk:V,encoding:ne,isBuf:j,callback:b,next:null},ke?ke.next=C.lastBufferedRequest:C.bufferedRequest=C.lastBufferedRequest,C.bufferedRequestCount+=1}else qe(R,C,!1,F,V,ne,b);return X}function qe(R,C,j,V,ne,b,x){C.writelen=V,C.writecb=x,C.writing=!0,C.sync=!0,C.destroyed?C.onwrite(new _("write")):j?R._writev(ne,C.onwrite):R._write(ne,b,C.onwrite),C.sync=!1}function Ge(R,C,j,V,ne){--C.pendingcb,j?(t.nextTick(ne,V),t.nextTick(W,R,C),R._writableState.errorEmitted=!0,$(R,V)):(ne(V),R._writableState.errorEmitted=!0,$(R,V),W(R,C))}function pt(R){R.writing=!1,R.writecb=null,R.length-=R.writelen,R.writelen=0}function Me(R,C){var j=R._writableState,V=j.sync,ne=j.writecb;if(typeof ne!="function")throw new P;if(pt(j),C)Ge(R,j,V,C,ne);else{var b=de(j)||R.destroyed;!b&&!j.corked&&!j.bufferProcessing&&j.bufferedRequest&&se(R,j),V?t.nextTick(ve,R,j,b,ne):ve(R,j,b,ne)}}function ve(R,C,j,V){j||we(R,C),C.pendingcb--,V(),W(R,C)}function we(R,C){C.length===0&&C.needDrain&&(C.needDrain=!1,R.emit("drain"))}function se(R,C){C.bufferProcessing=!0;var j=C.bufferedRequest;if(R._writev&&j&&j.next){var V=C.bufferedRequestCount,ne=new Array(V),b=C.corkedRequestsFree;b.entry=j;for(var x=0,F=!0;j;)ne[x]=j,j.isBuf||(F=!1),j=j.next,x+=1;ne.allBuffers=F,qe(R,C,!0,C.length,ne,"",b.finish),C.pendingcb++,C.lastBufferedRequest=null,b.next?(C.corkedRequestsFree=b.next,b.next=null):C.corkedRequestsFree=new e(C),C.bufferedRequestCount=0}else{for(;j;){var X=j.chunk,ke=j.encoding,me=j.callback,U=C.objectMode?1:X.length;if(qe(R,C,!1,U,X,ke,me),j=j.next,C.bufferedRequestCount--,C.writing)break}j===null&&(C.lastBufferedRequest=null)}C.bufferedRequest=j,C.bufferProcessing=!1}Y.prototype._write=function(R,C,j){j(new T("_write()"))},Y.prototype._writev=null,Y.prototype.end=function(R,C,j){var V=this._writableState;return typeof R=="function"?(j=R,R=null,C=null):typeof C=="function"&&(j=C,C=null),R!=null&&this.write(R,C),V.corked&&(V.corked=1,this.uncork()),V.ending||le(this,V,j),this},Object.defineProperty(Y.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function de(R){return R.ending&&R.length===0&&R.bufferedRequest===null&&!R.finished&&!R.writing}function N(R,C){R._final(function(j){C.pendingcb--,j&&$(R,j),C.prefinished=!0,R.emit("prefinish"),W(R,C)})}function Z(R,C){!C.prefinished&&!C.finalCalled&&(typeof R._final=="function"&&!C.destroyed?(C.pendingcb++,C.finalCalled=!0,t.nextTick(N,R,C)):(C.prefinished=!0,R.emit("prefinish")))}function W(R,C){var j=de(C);if(j&&(Z(R,C),C.pendingcb===0&&(C.finished=!0,R.emit("finish"),C.autoDestroy))){var V=R._readableState;(!V||V.autoDestroy&&V.endEmitted)&&R.destroy()}return j}function le(R,C,j){C.ending=!0,W(R,C),j&&(C.finished?t.nextTick(j):R.once("finish",j)),C.ended=!0,R.writable=!1}function ge(R,C,j){var V=R.entry;for(R.entry=null;V;){var ne=V.callback;C.pendingcb--,ne(j),V=V.next}C.corkedRequestsFree.next=R}return Object.defineProperty(Y.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(C){this._writableState&&(this._writableState.destroyed=C)}}),Y.prototype.destroy=c.destroy,Y.prototype._undestroy=c.undestroy,Y.prototype._destroy=function(R,C){C(R)},Ra}function yr(){if(_h)return Ma;_h=!0;var t=Mt,e=Object.keys||function(f){var p=[];for(var g in f)p.push(g);return p};Ma=a;var n=$h(),r=jh();Wt()(a,n);for(var i=e(r.prototype),s=0;s<i.length;s++){var o=i[s];a.prototype[o]||(a.prototype[o]=r.prototype[o])}function a(f){if(!(this instanceof a))return new a(f);n.call(this,f),r.call(this,f),this.allowHalfOpen=!0,f&&(f.readable===!1&&(this.readable=!1),f.writable===!1&&(this.writable=!1),f.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",l)))}Object.defineProperty(a.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(a.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(a.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function l(){this._writableState.ended||t.nextTick(c,this)}function c(f){f.end()}return Object.defineProperty(a.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(p){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=p,this._writableState.destroyed=p)}}),Ma}function za(){if(bh)return Na;bh=!0;var t=hr().codes.ERR_STREAM_PREMATURE_CLOSE;function e(s){var o=!1;return function(){if(!o){o=!0;for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];s.apply(this,l)}}}function n(){}function r(s){return s.setHeader&&typeof s.abort=="function"}function i(s,o,a){if(typeof o=="function")return i(s,null,o);o||(o={}),a=e(a||n);var l=o.readable||o.readable!==!1&&s.readable,c=o.writable||o.writable!==!1&&s.writable,f=function(){s.writable||g()},p=s._writableState&&s._writableState.finished,g=function(){c=!1,p=!0,l||a.call(s)},y=s._readableState&&s._readableState.endEmitted,T=function(){l=!1,y=!0,c||a.call(s)},P=function(B){a.call(s,B)},I=function(){var B;if(l&&!y)return(!s._readableState||!s._readableState.ended)&&(B=new t),a.call(s,B);if(c&&!p)return(!s._writableState||!s._writableState.ended)&&(B=new t),a.call(s,B)},_=function(){s.req.on("finish",g)};return r(s)?(s.on("complete",g),s.on("abort",I),s.req?_():s.on("request",_)):c&&!s._writableState&&(s.on("end",f),s.on("close",f)),s.on("end",T),s.on("finish",g),o.error!==!1&&s.on("error",P),s.on("close",I),function(){s.removeListener("complete",g),s.removeListener("abort",I),s.removeListener("request",_),s.req&&s.req.removeListener("finish",g),s.removeListener("end",f),s.removeListener("close",f),s.removeListener("finish",g),s.removeListener("end",T),s.removeListener("error",P),s.removeListener("close",I)}}return Na=i,Na}function CS(){if(wh)return Da;wh=!0;var t=Mt,e;function n(D,$,te){return $=r($),$ in D?Object.defineProperty(D,$,{value:te,enumerable:!0,configurable:!0,writable:!0}):D[$]=te,D}function r(D){var $=i(D,"string");return typeof $=="symbol"?$:String($)}function i(D,$){if(typeof D!="object"||D===null)return D;var te=D[Symbol.toPrimitive];if(te!==void 0){var Q=te.call(D,$||"default");if(typeof Q!="object")return Q;throw new TypeError("@@toPrimitive must return a primitive value.")}return($==="string"?String:Number)(D)}var s=za(),o=Symbol("lastResolve"),a=Symbol("lastReject"),l=Symbol("error"),c=Symbol("ended"),f=Symbol("lastPromise"),p=Symbol("handlePromise"),g=Symbol("stream");function y(D,$){return{value:D,done:$}}function T(D){var $=D[o];if($!==null){var te=D[g].read();te!==null&&(D[f]=null,D[o]=null,D[a]=null,$(y(te,!1)))}}function P(D){t.nextTick(T,D)}function I(D,$){return function(te,Q){D.then(function(){if($[c]){te(y(void 0,!0));return}$[p](te,Q)},Q)}}var _=Object.getPrototypeOf(function(){}),E=Object.setPrototypeOf((e={get stream(){return this[g]},next:function(){var $=this,te=this[l];if(te!==null)return Promise.reject(te);if(this[c])return Promise.resolve(y(void 0,!0));if(this[g].destroyed)return new Promise(function(J,Be){t.nextTick(function(){$[l]?Be($[l]):J(y(void 0,!0))})});var Q=this[f],ce;if(Q)ce=new Promise(I(Q,this));else{var Y=this[g].read();if(Y!==null)return Promise.resolve(y(Y,!1));ce=new Promise(this[p])}return this[f]=ce,ce}},n(e,Symbol.asyncIterator,function(){return this}),n(e,"return",function(){var $=this;return new Promise(function(te,Q){$[g].destroy(null,function(ce){if(ce){Q(ce);return}te(y(void 0,!0))})})}),e),_),B=function($){var te,Q=Object.create(E,(te={},n(te,g,{value:$,writable:!0}),n(te,o,{value:null,writable:!0}),n(te,a,{value:null,writable:!0}),n(te,l,{value:null,writable:!0}),n(te,c,{value:$._readableState.endEmitted,writable:!0}),n(te,p,{value:function(Y,J){var Be=Q[g].read();Be?(Q[f]=null,Q[o]=null,Q[a]=null,Y(y(Be,!1))):(Q[o]=Y,Q[a]=J)},writable:!0}),te));return Q[f]=null,s($,function(ce){if(ce&&ce.code!=="ERR_STREAM_PREMATURE_CLOSE"){var Y=Q[a];Y!==null&&(Q[f]=null,Q[o]=null,Q[a]=null,Y(ce)),Q[l]=ce;return}var J=Q[o];J!==null&&(Q[f]=null,Q[o]=null,Q[a]=null,J(y(void 0,!0))),Q[c]=!0}),$.on("readable",P.bind(null,Q)),Q};return Da=B,Da}function OS(){return xh||(xh=!0,Ha=function(){throw new Error("Readable.from is not available in the browser")}),Ha}function $h(){if(Ph)return Ua;Ph=!0;var t=Mt;Ua=J;var e;J.ReadableState=Y,yt.EventEmitter;var n=function(x,F){return x.listeners(F).length},r=Dh(),i=$t().Buffer,s=(typeof Ih<"u"?Ih:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function o(b){return i.from(b)}function a(b){return i.isBuffer(b)||b instanceof s}var l=L,c;l&&l.debuglog?c=l.debuglog("stream"):c=function(){};var f=AS(),p=Hh(),g=Uh(),y=g.getHighWaterMark,T=hr().codes,P=T.ERR_INVALID_ARG_TYPE,I=T.ERR_STREAM_PUSH_AFTER_EOF,_=T.ERR_METHOD_NOT_IMPLEMENTED,E=T.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,B,D,$;Wt()(J,r);var te=p.errorOrDestroy,Q=["error","close","destroy","pause","resume"];function ce(b,x,F){if(typeof b.prependListener=="function")return b.prependListener(x,F);!b._events||!b._events[x]?b.on(x,F):Array.isArray(b._events[x])?b._events[x].unshift(F):b._events[x]=[F,b._events[x]]}function Y(b,x,F){e=e||yr(),b=b||{},typeof F!="boolean"&&(F=x instanceof e),this.objectMode=!!b.objectMode,F&&(this.objectMode=this.objectMode||!!b.readableObjectMode),this.highWaterMark=y(this,b,"readableHighWaterMark",F),this.buffer=new f,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=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&&(B||(B=ii.StringDecoder),this.decoder=new B(b.encoding),this.encoding=b.encoding)}function J(b){if(e=e||yr(),!(this instanceof J))return new J(b);var x=this instanceof e;this._readableState=new Y(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(J.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(x){this._readableState&&(this._readableState.destroyed=x)}}),J.prototype.destroy=p.destroy,J.prototype._undestroy=p.undestroy,J.prototype._destroy=function(b,x){x(b)},J.prototype.push=function(b,x){var F=this._readableState,X;return F.objectMode?X=!0:typeof b=="string"&&(x=x||F.defaultEncoding,x!==F.encoding&&(b=i.from(b,x),x=""),X=!0),Be(this,b,x,!1,X)},J.prototype.unshift=function(b){return Be(this,b,null,!0,!1)};function Be(b,x,F,X,ke){c("readableAddChunk",x);var me=b._readableState;if(x===null)me.reading=!1,Me(b,me);else{var U;if(ke||(U=Qe(me,x)),U)te(b,U);else if(me.objectMode||x&&x.length>0)if(typeof x!="string"&&!me.objectMode&&Object.getPrototypeOf(x)!==i.prototype&&(x=o(x)),X)me.endEmitted?te(b,new E):We(b,me,x,!0);else if(me.ended)te(b,new I);else{if(me.destroyed)return!1;me.reading=!1,me.decoder&&!F?(x=me.decoder.write(x),me.objectMode||x.length!==0?We(b,me,x,!1):se(b,me)):We(b,me,x,!1)}else X||(me.reading=!1,se(b,me))}return!me.ended&&(me.length<me.highWaterMark||me.length===0)}function We(b,x,F,X){x.flowing&&x.length===0&&!x.sync?(x.awaitDrain=0,b.emit("data",F)):(x.length+=x.objectMode?1:F.length,X?x.buffer.unshift(F):x.buffer.push(F),x.needReadable&&ve(b)),se(b,x)}function Qe(b,x){var F;return!a(x)&&typeof x!="string"&&x!==void 0&&!b.objectMode&&(F=new P("chunk",["string","Buffer","Uint8Array"],x)),F}J.prototype.isPaused=function(){return this._readableState.flowing===!1},J.prototype.setEncoding=function(b){B||(B=ii.StringDecoder);var x=new B(b);this._readableState.decoder=x,this._readableState.encoding=this._readableState.decoder.encoding;for(var F=this._readableState.buffer.head,X="";F!==null;)X+=x.write(F.data),F=F.next;return this._readableState.buffer.clear(),X!==""&&this._readableState.buffer.push(X),this._readableState.length=X.length,this};var qe=1073741824;function Ge(b){return b>=qe?b=qe:(b--,b|=b>>>1,b|=b>>>2,b|=b>>>4,b|=b>>>8,b|=b>>>16,b++),b}function pt(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=Ge(b)),b<=x.length?b:x.ended?x.length:(x.needReadable=!0,0))}J.prototype.read=function(b){c("read",b),b=parseInt(b,10);var x=this._readableState,F=b;if(b!==0&&(x.emittedReadable=!1),b===0&&x.needReadable&&((x.highWaterMark!==0?x.length>=x.highWaterMark:x.length>0)||x.ended))return c("read: emitReadable",x.length,x.ended),x.length===0&&x.ended?j(this):ve(this),null;if(b=pt(b,x),b===0&&x.ended)return x.length===0&&j(this),null;var X=x.needReadable;c("need readable",X),(x.length===0||x.length-b<x.highWaterMark)&&(X=!0,c("length less than watermark",X)),x.ended||x.reading?(X=!1,c("reading or ended",X)):X&&(c("do read"),x.reading=!0,x.sync=!0,x.length===0&&(x.needReadable=!0),this._read(x.highWaterMark),x.sync=!1,x.reading||(b=pt(F,x)));var ke;return b>0?ke=C(b,x):ke=null,ke===null?(x.needReadable=x.length<=x.highWaterMark,b=0):(x.length-=b,x.awaitDrain=0),x.length===0&&(x.ended||(x.needReadable=!0),F!==b&&x.ended&&j(this)),ke!==null&&this.emit("data",ke),ke};function Me(b,x){if(c("onEofChunk"),!x.ended){if(x.decoder){var F=x.decoder.end();F&&F.length&&(x.buffer.push(F),x.length+=x.objectMode?1:F.length)}x.ended=!0,x.sync?ve(b):(x.needReadable=!1,x.emittedReadable||(x.emittedReadable=!0,we(b)))}}function ve(b){var x=b._readableState;c("emitReadable",x.needReadable,x.emittedReadable),x.needReadable=!1,x.emittedReadable||(c("emitReadable",x.flowing),x.emittedReadable=!0,t.nextTick(we,b))}function we(b){var x=b._readableState;c("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,R(b)}function se(b,x){x.readingMore||(x.readingMore=!0,t.nextTick(de,b,x))}function de(b,x){for(;!x.reading&&!x.ended&&(x.length<x.highWaterMark||x.flowing&&x.length===0);){var F=x.length;if(c("maybeReadMore read 0"),b.read(0),F===x.length)break}x.readingMore=!1}J.prototype._read=function(b){te(this,new _("_read()"))},J.prototype.pipe=function(b,x){var F=this,X=this._readableState;switch(X.pipesCount){case 0:X.pipes=b;break;case 1:X.pipes=[X.pipes,b];break;default:X.pipes.push(b);break}X.pipesCount+=1,c("pipe count=%d opts=%j",X.pipesCount,x);var ke=(!x||x.end!==!1)&&b!==t.stdout&&b!==t.stderr,me=ke?At:u;X.endEmitted?t.nextTick(me):F.once("end",me),b.on("unpipe",U);function U(d,v){c("onunpipe"),d===F&&v&&v.hasUnpiped===!1&&(v.hasUnpiped=!0,vr())}function At(){c("onend"),b.end()}var jt=N(F);b.on("drain",jt);var _t=!1;function vr(){c("cleanup"),b.removeListener("close",_r),b.removeListener("finish",h),b.removeListener("drain",jt),b.removeListener("error",Pt),b.removeListener("unpipe",U),F.removeListener("end",At),F.removeListener("end",u),F.removeListener("data",gi),_t=!0,X.awaitDrain&&(!b._writableState||b._writableState.needDrain)&&jt()}F.on("data",gi);function gi(d){c("ondata");var v=b.write(d);c("dest.write",v),v===!1&&((X.pipesCount===1&&X.pipes===b||X.pipesCount>1&&ne(X.pipes,b)!==-1)&&!_t&&(c("false write response, pause",X.awaitDrain),X.awaitDrain++),F.pause())}function Pt(d){c("onerror",d),u(),b.removeListener("error",Pt),n(b,"error")===0&&te(b,d)}ce(b,"error",Pt);function _r(){b.removeListener("finish",h),u()}b.once("close",_r);function h(){c("onfinish"),b.removeListener("close",_r),u()}b.once("finish",h);function u(){c("unpipe"),F.unpipe(b)}return b.emit("pipe",F),X.flowing||(c("pipe resume"),F.resume()),b};function N(b){return function(){var F=b._readableState;c("pipeOnDrain",F.awaitDrain),F.awaitDrain&&F.awaitDrain--,F.awaitDrain===0&&n(b,"data")&&(F.flowing=!0,R(b))}}J.prototype.unpipe=function(b){var x=this._readableState,F={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,F),this);if(!b){var X=x.pipes,ke=x.pipesCount;x.pipes=null,x.pipesCount=0,x.flowing=!1;for(var me=0;me<ke;me++)X[me].emit("unpipe",this,{hasUnpiped:!1});return this}var U=ne(x.pipes,b);return U===-1?this:(x.pipes.splice(U,1),x.pipesCount-=1,x.pipesCount===1&&(x.pipes=x.pipes[0]),b.emit("unpipe",this,F),this)},J.prototype.on=function(b,x){var F=r.prototype.on.call(this,b,x),X=this._readableState;return b==="data"?(X.readableListening=this.listenerCount("readable")>0,X.flowing!==!1&&this.resume()):b==="readable"&&!X.endEmitted&&!X.readableListening&&(X.readableListening=X.needReadable=!0,X.flowing=!1,X.emittedReadable=!1,c("on readable",X.length,X.reading),X.length?ve(this):X.reading||t.nextTick(W,this)),F},J.prototype.addListener=J.prototype.on,J.prototype.removeListener=function(b,x){var F=r.prototype.removeListener.call(this,b,x);return b==="readable"&&t.nextTick(Z,this),F},J.prototype.removeAllListeners=function(b){var x=r.prototype.removeAllListeners.apply(this,arguments);return(b==="readable"||b===void 0)&&t.nextTick(Z,this),x};function Z(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 W(b){c("readable nexttick read 0"),b.read(0)}J.prototype.resume=function(){var b=this._readableState;return b.flowing||(c("resume"),b.flowing=!b.readableListening,le(this,b)),b.paused=!1,this};function le(b,x){x.resumeScheduled||(x.resumeScheduled=!0,t.nextTick(ge,b,x))}function ge(b,x){c("resume",x.reading),x.reading||b.read(0),x.resumeScheduled=!1,b.emit("resume"),R(b),x.flowing&&!x.reading&&b.read(0)}J.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function R(b){var x=b._readableState;for(c("flow",x.flowing);x.flowing&&b.read()!==null;);}J.prototype.wrap=function(b){var x=this,F=this._readableState,X=!1;b.on("end",function(){if(c("wrapped end"),F.decoder&&!F.ended){var U=F.decoder.end();U&&U.length&&x.push(U)}x.push(null)}),b.on("data",function(U){if(c("wrapped data"),F.decoder&&(U=F.decoder.write(U)),!(F.objectMode&&U==null)&&!(!F.objectMode&&(!U||!U.length))){var At=x.push(U);At||(X=!0,b.pause())}});for(var ke in b)this[ke]===void 0&&typeof b[ke]=="function"&&(this[ke]=(function(At){return function(){return b[At].apply(b,arguments)}})(ke));for(var me=0;me<Q.length;me++)b.on(Q[me],this.emit.bind(this,Q[me]));return this._read=function(U){c("wrapped _read",U),X&&(X=!1,b.resume())},this},typeof Symbol=="function"&&(J.prototype[Symbol.asyncIterator]=function(){return D===void 0&&(D=CS()),D(this)}),Object.defineProperty(J.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(J.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(J.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(x){this._readableState&&(this._readableState.flowing=x)}}),J._fromList=C,Object.defineProperty(J.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function C(b,x){if(x.length===0)return null;var F;return x.objectMode?F=x.buffer.shift():!b||b>=x.length?(x.decoder?F=x.buffer.join(""):x.buffer.length===1?F=x.buffer.first():F=x.buffer.concat(x.length),x.buffer.clear()):F=x.buffer.consume(b,x.decoder),F}function j(b){var x=b._readableState;c("endReadable",x.endEmitted),x.endEmitted||(x.ended=!0,t.nextTick(V,x,b))}function V(b,x){if(c("endReadableNT",b.endEmitted,b.length),!b.endEmitted&&b.length===0&&(b.endEmitted=!0,x.readable=!1,x.emit("end"),b.autoDestroy)){var F=x._writableState;(!F||F.autoDestroy&&F.finished)&&x.destroy()}}typeof Symbol=="function"&&(J.from=function(b,x){return $===void 0&&($=OS()),$(J,b,x)});function ne(b,x){for(var F=0,X=b.length;F<X;F++)if(b[F]===x)return F;return-1}return Ua}function Zh(){if(Bh)return ja;Bh=!0,ja=a;var t=hr().codes,e=t.ERR_METHOD_NOT_IMPLEMENTED,n=t.ERR_MULTIPLE_CALLBACK,r=t.ERR_TRANSFORM_ALREADY_TRANSFORMING,i=t.ERR_TRANSFORM_WITH_LENGTH_0,s=yr();Wt()(a,s);function o(f,p){var g=this._transformState;g.transforming=!1;var y=g.writecb;if(y===null)return this.emit("error",new n);g.writechunk=null,g.writecb=null,p!=null&&this.push(p),y(f);var T=this._readableState;T.reading=!1,(T.needReadable||T.length<T.highWaterMark)&&this._read(T.highWaterMark)}function a(f){if(!(this instanceof a))return new a(f);s.call(this,f),this._transformState={afterTransform:o.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,f&&(typeof f.transform=="function"&&(this._transform=f.transform),typeof f.flush=="function"&&(this._flush=f.flush)),this.on("prefinish",l)}function l(){var f=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(p,g){c(f,p,g)}):c(this,null,null)}a.prototype.push=function(f,p){return this._transformState.needTransform=!1,s.prototype.push.call(this,f,p)},a.prototype._transform=function(f,p,g){g(new e("_transform()"))},a.prototype._write=function(f,p,g){var y=this._transformState;if(y.writecb=g,y.writechunk=f,y.writeencoding=p,!y.transforming){var T=this._readableState;(y.needTransform||T.needReadable||T.length<T.highWaterMark)&&this._read(T.highWaterMark)}},a.prototype._read=function(f){var p=this._transformState;p.writechunk!==null&&!p.transforming?(p.transforming=!0,this._transform(p.writechunk,p.writeencoding,p.afterTransform)):p.needTransform=!0},a.prototype._destroy=function(f,p){s.prototype._destroy.call(this,f,function(g){p(g)})};function c(f,p,g){if(p)return f.emit("error",p);if(g!=null&&f.push(g),f._writableState.length)throw new i;if(f._transformState.transforming)throw new r;return f.push(null)}return ja}function RS(){if(Eh)return $a;Eh=!0,$a=e;var t=Zh();Wt()(e,t);function e(n){if(!(this instanceof e))return new e(n);t.call(this,n)}return e.prototype._transform=function(n,r,i){i(null,n)},$a}function MS(){if(Sh)return Za;Sh=!0;var t;function e(g){var y=!1;return function(){y||(y=!0,g.apply(void 0,arguments))}}var n=hr().codes,r=n.ERR_MISSING_ARGS,i=n.ERR_STREAM_DESTROYED;function s(g){if(g)throw g}function o(g){return g.setHeader&&typeof g.abort=="function"}function a(g,y,T,P){P=e(P);var I=!1;g.on("close",function(){I=!0}),t===void 0&&(t=za()),t(g,{readable:y,writable:T},function(E){if(E)return P(E);I=!0,P()});var _=!1;return function(E){if(!I&&!_){if(_=!0,o(g))return g.abort();if(typeof g.destroy=="function")return g.destroy();P(E||new i("pipe"))}}}function l(g){g()}function c(g,y){return g.pipe(y)}function f(g){return!g.length||typeof g[g.length-1]!="function"?s:g.pop()}function p(){for(var g=arguments.length,y=new Array(g),T=0;T<g;T++)y[T]=arguments[T];var P=f(y);if(Array.isArray(y[0])&&(y=y[0]),y.length<2)throw new r("streams");var I,_=y.map(function(E,B){var D=B<y.length-1,$=B>0;return a(E,D,$,function(te){I||(I=te),te&&_.forEach(l),!D&&(_.forEach(l),P(I))})});return y.reduce(c)}return Za=p,Za}function Lh(){return kh||(kh=!0,Tt=Tt=$h(),Tt.Stream=Tt,Tt.Readable=Tt,Tt.Writable=jh(),Tt.Duplex=yr(),Tt.Transform=Zh(),Tt.PassThrough=RS(),Tt.finished=za(),Tt.pipeline=MS()),Tt}function Wh(){if(Ah)return wo;Ah=!0;var t=$t().Buffer,e=Mt,n=Nh(),r=Wt(),i=Lh(),s=wo.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},o=wo.IncomingMessage=function(a,l,c,f){var p=this||xo;if(i.Readable.call(p),p._mode=c,p.headers={},p.rawHeaders=[],p.trailers={},p.rawTrailers=[],p.on("end",function(){e.nextTick(function(){p.emit("close")})}),c==="fetch"){let _=function(){y.read().then(function(E){if(!p._destroyed){if(f(E.done),E.done){p.push(null);return}p.push(t.from(E.value)),_()}}).catch(function(E){f(!0),p._destroyed||p.emit("error",E)})};if(p._fetchResponse=l,p.url=l.url,p.statusCode=l.status,p.statusMessage=l.statusText,l.headers.forEach(function(E,B){p.headers[B.toLowerCase()]=E,p.rawHeaders.push(B,E)}),n.writableStream){var g=new WritableStream({write:function(E){return f(!1),new Promise(function(B,D){p._destroyed?D():p.push(t.from(E))?B():p._resumeFetch=B})},close:function(){f(!0),p._destroyed||p.push(null)},abort:function(E){f(!0),p._destroyed||p.emit("error",E)}});try{l.body.pipeTo(g).catch(function(E){f(!0),p._destroyed||p.emit("error",E)});return}catch{}}var y=l.body.getReader();_()}else{p._xhr=a,p._pos=0,p.url=a.responseURL,p.statusCode=a.status,p.statusMessage=a.statusText;var T=a.getAllResponseHeaders().split(/\r?\n/);if(T.forEach(function(_){var E=_.match(/^([^:]+):\s*(.*)/);if(E){var B=E[1].toLowerCase();B==="set-cookie"?(p.headers[B]===void 0&&(p.headers[B]=[]),p.headers[B].push(E[2])):p.headers[B]!==void 0?p.headers[B]+=", "+E[2]:p.headers[B]=E[2],p.rawHeaders.push(E[1],E[2])}}),p._charset="x-user-defined",!n.overrideMimeType){var P=p.rawHeaders["mime-type"];if(P){var I=P.match(/;\s*charset=([^;])(;|$)/);I&&(p._charset=I[1].toLowerCase())}p._charset||(p._charset="utf-8")}}};return r(o,i.Readable),o.prototype._read=function(){var a=this||xo,l=a._resumeFetch;l&&(a._resumeFetch=null,l())},o.prototype._onXHRProgress=function(a){var l=this||xo,c=l._xhr,f=null;switch(l._mode){case"text":if(f=c.responseText,f.length>l._pos){var p=f.substr(l._pos);if(l._charset==="x-user-defined"){for(var g=t.alloc(p.length),y=0;y<p.length;y++)g[y]=p.charCodeAt(y)&255;l.push(g)}else l.push(p,l._charset);l._pos=f.length}break;case"arraybuffer":if(c.readyState!==s.DONE||!c.response)break;f=c.response,l.push(t.from(new Uint8Array(f)));break;case"moz-chunked-arraybuffer":if(f=c.response,c.readyState!==s.LOADING||!f)break;l.push(t.from(new Uint8Array(f)));break;case"ms-stream":if(f=c.response,c.readyState!==s.LOADING)break;var T=new xo.MSStreamReader;T.onprogress=function(){T.result.byteLength>l._pos&&(l.push(t.from(new Uint8Array(T.result.slice(l._pos)))),l._pos=T.result.byteLength)},T.onload=function(){a(!0),l.push(null)},T.readAsArrayBuffer(f);break}l._xhr.readyState===s.DONE&&l._mode!=="ms-stream"&&(a(!0),l.push(null))},wo}function NS(){if(Ch)return La;Ch=!0;var t=$t().Buffer,e=Mt,n=Nh(),r=Wt(),i=Wh(),s=Lh(),o=i.IncomingMessage,a=i.readyStates;function l(g,y){return n.fetch&&y?"fetch":n.mozchunkedarraybuffer?"moz-chunked-arraybuffer":n.msstream?"ms-stream":n.arraybuffer&&g?"arraybuffer":"text"}var c=La=function(g){var y=this||it;s.Writable.call(y),y._opts=g,y._body=[],y._headers={},g.auth&&y.setHeader("Authorization","Basic "+t.from(g.auth).toString("base64")),Object.keys(g.headers).forEach(function(I){y.setHeader(I,g.headers[I])});var T,P=!0;if(g.mode==="disable-fetch"||"requestTimeout"in g&&!n.abortController)P=!1,T=!0;else if(g.mode==="prefer-streaming")T=!1;else if(g.mode==="allow-wrong-content-type")T=!n.overrideMimeType;else if(!g.mode||g.mode==="default"||g.mode==="prefer-fast")T=!0;else throw new Error("Invalid value for opts.mode");y._mode=l(T,P),y._fetchTimer=null,y._socketTimeout=null,y._socketTimer=null,y.on("finish",function(){y._onFinish()})};r(c,s.Writable),c.prototype.setHeader=function(g,y){var T=this||it,P=g.toLowerCase();p.indexOf(P)===-1&&(T._headers[P]={name:g,value:y})},c.prototype.getHeader=function(g){var y=(this||it)._headers[g.toLowerCase()];return y?y.value:null},c.prototype.removeHeader=function(g){var y=this||it;delete y._headers[g.toLowerCase()]},c.prototype._onFinish=function(){var g=this||it;if(!g._destroyed){var y=g._opts;"timeout"in y&&y.timeout!==0&&g.setTimeout(y.timeout);var T=g._headers,P=null;y.method!=="GET"&&y.method!=="HEAD"&&(P=new Blob(g._body,{type:(T["content-type"]||{}).value||""}));var I=[];if(Object.keys(T).forEach(function(D){var $=T[D].name,te=T[D].value;Array.isArray(te)?te.forEach(function(Q){I.push([$,Q])}):I.push([$,te])}),g._mode==="fetch"){var _=null;if(n.abortController){var E=new AbortController;_=E.signal,g._fetchAbortController=E,"requestTimeout"in y&&y.requestTimeout!==0&&(g._fetchTimer=it.setTimeout(function(){g.emit("requestTimeout"),g._fetchAbortController&&g._fetchAbortController.abort()},y.requestTimeout))}it.fetch(g._opts.url,{method:g._opts.method,headers:I,body:P||void 0,mode:"cors",credentials:y.withCredentials?"include":"same-origin",signal:_}).then(function(D){g._fetchResponse=D,g._resetTimers(!1),g._connect()},function(D){g._resetTimers(!0),g._destroyed||g.emit("error",D)})}else{var B=g._xhr=new it.XMLHttpRequest;try{B.open(g._opts.method,g._opts.url,!0)}catch(D){e.nextTick(function(){g.emit("error",D)});return}"responseType"in B&&(B.responseType=g._mode),"withCredentials"in B&&(B.withCredentials=!!y.withCredentials),g._mode==="text"&&"overrideMimeType"in B&&B.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in y&&(B.timeout=y.requestTimeout,B.ontimeout=function(){g.emit("requestTimeout")}),I.forEach(function(D){B.setRequestHeader(D[0],D[1])}),g._response=null,B.onreadystatechange=function(){switch(B.readyState){case a.LOADING:case a.DONE:g._onXHRProgress();break}},g._mode==="moz-chunked-arraybuffer"&&(B.onprogress=function(){g._onXHRProgress()}),B.onerror=function(){g._destroyed||(g._resetTimers(!0),g.emit("error",new Error("XHR error")))};try{B.send(P)}catch(D){e.nextTick(function(){g.emit("error",D)});return}}}};function f(g){try{var y=g.status;return y!==null&&y!==0}catch{return!1}}c.prototype._onXHRProgress=function(){var g=this||it;g._resetTimers(!1),!(!f(g._xhr)||g._destroyed)&&(g._response||g._connect(),g._response._onXHRProgress(g._resetTimers.bind(g)))},c.prototype._connect=function(){var g=this||it;g._destroyed||(g._response=new o(g._xhr,g._fetchResponse,g._mode,g._resetTimers.bind(g)),g._response.on("error",function(y){g.emit("error",y)}),g.emit("response",g._response))},c.prototype._write=function(g,y,T){var P=this||it;P._body.push(g),T()},c.prototype._resetTimers=function(g){var y=this||it;it.clearTimeout(y._socketTimer),y._socketTimer=null,g?(it.clearTimeout(y._fetchTimer),y._fetchTimer=null):y._socketTimeout&&(y._socketTimer=it.setTimeout(function(){y.emit("timeout")},y._socketTimeout))},c.prototype.abort=c.prototype.destroy=function(g){var y=this||it;y._destroyed=!0,y._resetTimers(!0),y._response&&(y._response._destroyed=!0),y._xhr?y._xhr.abort():y._fetchAbortController&&y._fetchAbortController.abort(),g&&y.emit("error",g)},c.prototype.end=function(g,y,T){var P=this||it;typeof g=="function"&&(T=g,g=void 0),s.Writable.prototype.end.call(P,g,y,T)},c.prototype.setTimeout=function(g,y){var T=this||it;y&&T.once("timeout",y),T._socketTimeout=g,T._resetTimers(!1)},c.prototype.flushHeaders=function(){},c.prototype.setNoDelay=function(){},c.prototype.setSocketKeepAlive=function(){};var p=["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 La}function DS(){if(Oh)return Wa;Oh=!0,Wa=e;var t=Object.prototype.hasOwnProperty;function e(){for(var n={},r=0;r<arguments.length;r++){var i=arguments[r];for(var s in i)t.call(i,s)&&(n[s]=i[s])}return n}return Wa}function HS(){return Rh||(Rh=!0,Ka={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"}),Ka}function jS(){if(Mh)return Fa;Mh=!0;var t=NS(),e=Wh(),n=DS(),r=HS(),i=Oe,s=Fa;return s.request=function(o,a){typeof o=="string"?o=i.parse(o):o=n(o);var l=US.location.protocol.search(/^https?:$/)===-1?"http:":"",c=o.protocol||l,f=o.hostname||o.host,p=o.port,g=o.path||"/";f&&f.indexOf(":")!==-1&&(f="["+f+"]"),o.url=(f?c+"//"+f:"")+(p?":"+p:"")+g,o.method=(o.method||"GET").toUpperCase(),o.headers=o.headers||{};var y=new t(o);return a&&y.on("response",a),y},s.get=function(a,l){var c=s.request(a,l);return c.end(),c},s.ClientRequest=t,s.IncomingMessage=e.IncomingMessage,s.Agent=function(){},s.Agent.defaultMaxSockets=4,s.globalAgent=new s.Agent,s.STATUS_CODES=r,s.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"],Fa}var xt,fh,Yn,Sa,ph,ka,gh,Aa,mh,Ca,yh,Oa,hh,Ra,Th,vh,Ma,_h,Na,bh,Da,wh,Ha,xh,Ua,Ph,Ih,ja,Bh,$a,Eh,Za,Sh,Tt,kh,wo,Ah,xo,La,Ch,it,Wa,Oh,Ka,Rh,Fa,Mh,US,cn,$S,ZS,LS,WS,KS,FS,zS,qS,Fh=ot(()=>{S();A();k();Ys();sy();Xs();vi();Ly();_o();ga();qy();Jy();dh();va();xt={},fh=!1,Yn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Sa={},ph=!1;ka={},gh=!1;Aa={},mh=!1;Ca={},yh=!1;Oa={},hh=!1;Ra={},Th=!1,vh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ma={},_h=!1;Na={},bh=!1;Da={},wh=!1;Ha={},xh=!1;Ua={},Ph=!1,Ih=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;ja={},Bh=!1;$a={},Eh=!1;Za={},Sh=!1;Tt={},kh=!1;wo={},Ah=!1,xo=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;La={},Ch=!1,it=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Wa={},Oh=!1;Ka={},Rh=!1;Fa={},Mh=!1,US=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;cn=jS(),$S=cn.Agent,ZS=cn.ClientRequest,LS=cn.IncomingMessage,WS=cn.METHODS,KS=cn.STATUS_CODES,FS=cn.get,zS=cn.globalAgent,qS=cn.request});S();A();k();var qm={};pn(qm,{defaults:()=>qI,markdown:()=>FI,markdownBloc:()=>zI});S();A();k();S();A();k();S();A();k();var ds=Object.defineProperty,ov=Object.defineProperties,sv=Object.getOwnPropertyDescriptors,Oi=Object.getOwnPropertySymbols,qc=Object.prototype.hasOwnProperty,Gc=Object.prototype.propertyIsEnumerable,dc=(t,e,n)=>e in t?ds(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,w=(t,e)=>{for(var n in e||(e={}))qc.call(e,n)&&dc(t,n,e[n]);if(Oi)for(var n of Oi(e))Gc.call(e,n)&&dc(t,n,e[n]);return t},M=(t,e)=>ov(t,sv(e)),m=(t,e)=>ds(t,"name",{value:e,configurable:!0}),Vc=(t,e)=>{var n={};for(var r in t)qc.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Oi)for(var r of Oi(t))e.indexOf(r)<0&&Gc.call(t,r)&&(n[r]=t[r]);return n},Rt=(t,e)=>{for(var n in e)ds(t,n,{get:e[n],enumerable:!0})},re={};Rt(re,{DIRTY:()=>Ls,ERR:()=>Zs,OK:()=>Hi,any:()=>Nn,array:()=>On,bigint:()=>Gi,boolean:()=>Kn,branded:()=>$s,catch:()=>Us,coerce:()=>Cg,custom:()=>zi,date:()=>Vi,default:()=>Hs,discriminatedUnion:()=>Fr,downstream:()=>Rs,enum:()=>Yi,function:()=>As,instanceof:()=>bs,intersection:()=>zr,is:()=>Ee,lazy:()=>Ss,literal:()=>Kr,map:()=>Es,nan:()=>Ps,nativeEnum:()=>Is,never:()=>Wr,null:()=>Jr,nullable:()=>Ns,number:()=>Wn,object:()=>sr,optional:()=>Ms,pipeline:()=>js,preprocess:()=>Cs,promise:()=>ks,readonly:()=>Ds,record:()=>qr,ref:()=>Ji,set:()=>Xi,strictObject:()=>Bs,string:()=>en,symbol:()=>xs,transforms:()=>Jc,tuple:()=>Yr,undefined:()=>qi,union:()=>Rn,unknown:()=>hn,upstream:()=>Os,void:()=>ws,zuiKey:()=>Ae});var Jc={};Rt(Jc,{errors:()=>Og,fromJSONSchema:()=>em,fromJSONSchemaLegacy:()=>CP,fromObject:()=>qP,json:()=>LI,toJSONSchema:()=>qs,toJSONSchemaLegacy:()=>lI,toTypescriptSchema:()=>Vs,toTypescriptType:()=>Gs});var tn={};Rt(tn,{DIRTY:()=>Ls,ERR:()=>Zs,OK:()=>Hi,any:()=>Nn,array:()=>On,bigint:()=>Gi,boolean:()=>Kn,branded:()=>$s,catch:()=>Us,coerce:()=>Cg,custom:()=>zi,date:()=>Vi,default:()=>Hs,discriminatedUnion:()=>Fr,downstream:()=>Rs,enum:()=>Yi,function:()=>As,instanceof:()=>bs,intersection:()=>zr,is:()=>Ee,lazy:()=>Ss,literal:()=>Kr,map:()=>Es,nan:()=>Ps,nativeEnum:()=>Is,never:()=>Wr,null:()=>Jr,nullable:()=>Ns,number:()=>Wn,object:()=>sr,optional:()=>Ms,pipeline:()=>js,preprocess:()=>Cs,promise:()=>ks,readonly:()=>Ds,record:()=>qr,ref:()=>Ji,set:()=>Xi,strictObject:()=>Bs,string:()=>en,symbol:()=>xs,tuple:()=>Yr,undefined:()=>qi,union:()=>Rn,unknown:()=>hn,upstream:()=>Os,void:()=>ws,zuiKey:()=>Ae});var Ae="x-zui",Ye={};Rt(Ye,{CustomSet:()=>ux});var Lt={};Rt(Lt,{isEqual:()=>mp,unique:()=>ax});var av=typeof global=="object"&&global&&global.Object===Object&&global,Yc=av,lv=typeof self=="object"&&self&&self.Object===Object&&self,uv=Yc||lv||Function("return this")(),nn=uv,cv=nn.Symbol,yn=cv,Xc=Object.prototype,dv=Xc.hasOwnProperty,fv=Xc.toString,wr=yn?yn.toStringTag:void 0;function Qc(t){var e=dv.call(t,wr),n=t[wr];try{t[wr]=void 0;var r=!0}catch{}var i=fv.call(t);return r&&(e?t[wr]=n:delete t[wr]),i}m(Qc,"getRawTag");var pv=Qc,gv=Object.prototype,mv=gv.toString;function ed(t){return mv.call(t)}m(ed,"objectToString");var yv=ed,hv="[object Null]",Tv="[object Undefined]",fc=yn?yn.toStringTag:void 0;function td(t){return t==null?t===void 0?Tv:hv:fc&&fc in Object(t)?pv(t):yv(t)}m(td,"baseGetTag");var Dn=td;function nd(t){return t!=null&&typeof t=="object"}m(nd,"isObjectLike");var Mn=nd,vv="[object Symbol]";function rd(t){return typeof t=="symbol"||Mn(t)&&Dn(t)==vv}m(rd,"isSymbol");var fs=rd;function id(t,e){for(var n=-1,r=t==null?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}m(id,"arrayMap");var od=id,_v=Array.isArray,Qt=_v,bv=1/0,pc=yn?yn.prototype:void 0,gc=pc?pc.toString:void 0;function ps(t){if(typeof t=="string")return t;if(Qt(t))return od(t,ps)+"";if(fs(t))return gc?gc.call(t):"";var e=t+"";return e=="0"&&1/t==-bv?"-0":e}m(ps,"baseToString");var wv=ps;function sd(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}m(sd,"isObject");var or=sd;function ad(t){return t}m(ad,"identity");var xv=ad,Pv="[object AsyncFunction]",Iv="[object Function]",Bv="[object GeneratorFunction]",Ev="[object Proxy]";function ld(t){if(!or(t))return!1;var e=Dn(t);return e==Iv||e==Bv||e==Pv||e==Ev}m(ld,"isFunction");var ud=ld,Sv=nn["__core-js_shared__"],$o=Sv,mc=(function(){var t=/[^.]+$/.exec($o&&$o.keys&&$o.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function cd(t){return!!mc&&mc in t}m(cd,"isMasked");var kv=cd,Av=Function.prototype,Cv=Av.toString;function dd(t){if(t!=null){try{return Cv.call(t)}catch{}try{return t+""}catch{}}return""}m(dd,"toSource");var Hn=dd,Ov=/[\\^$.*+?()[\]{}|]/g,Rv=/^\[object .+?Constructor\]$/,Mv=Function.prototype,Nv=Object.prototype,Dv=Mv.toString,Hv=Nv.hasOwnProperty,Uv=RegExp("^"+Dv.call(Hv).replace(Ov,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function fd(t){if(!or(t)||kv(t))return!1;var e=ud(t)?Uv:Rv;return e.test(Hn(t))}m(fd,"baseIsNative");var jv=fd;function pd(t,e){return t?.[e]}m(pd,"getValue");var $v=pd;function gd(t,e){var n=$v(t,e);return jv(n)?n:void 0}m(gd,"getNative");var Un=gd,Zv=Un(nn,"WeakMap"),Xo=Zv,Lv=(function(){try{var t=Un(Object,"defineProperty");return t({},"",{}),t}catch{}})(),yc=Lv,Wv=9007199254740991,Kv=/^(?:0|[1-9]\d*)$/;function md(t,e){var n=typeof t;return e=e??Wv,!!e&&(n=="number"||n!="symbol"&&Kv.test(t))&&t>-1&&t%1==0&&t<e}m(md,"isIndex");var gs=md;function yd(t,e,n){e=="__proto__"&&yc?yc(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}m(yd,"baseAssignValue");var Fv=yd;function hd(t,e){return t===e||t!==t&&e!==e}m(hd,"eq");var ms=hd,zv=Object.prototype,qv=zv.hasOwnProperty;function Td(t,e,n){var r=t[e];(!(qv.call(t,e)&&ms(r,n))||n===void 0&&!(e in t))&&Fv(t,e,n)}m(Td,"assignValue");var Gv=Td,Vv=9007199254740991;function vd(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Vv}m(vd,"isLength");var ys=vd;function _d(t){return t!=null&&ys(t.length)&&!ud(t)}m(_d,"isArrayLike");var bd=_d,Jv=Object.prototype;function wd(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||Jv;return t===n}m(wd,"isPrototype");var xd=wd;function Pd(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}m(Pd,"baseTimes");var Yv=Pd,Xv="[object Arguments]";function Id(t){return Mn(t)&&Dn(t)==Xv}m(Id,"baseIsArguments");var hc=Id,Bd=Object.prototype,Qv=Bd.hasOwnProperty,e_=Bd.propertyIsEnumerable,t_=hc((function(){return arguments})())?hc:function(t){return Mn(t)&&Qv.call(t,"callee")&&!e_.call(t,"callee")},Ed=t_;function Sd(){return!1}m(Sd,"stubFalse");var n_=Sd,kd=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Tc=kd&&typeof module=="object"&&module&&!module.nodeType&&module,r_=Tc&&Tc.exports===kd,vc=r_?nn.Buffer:void 0,i_=vc?vc.isBuffer:void 0,o_=i_||n_,Qo=o_,s_="[object Arguments]",a_="[object Array]",l_="[object Boolean]",u_="[object Date]",c_="[object Error]",d_="[object Function]",f_="[object Map]",p_="[object Number]",g_="[object Object]",m_="[object RegExp]",y_="[object Set]",h_="[object String]",T_="[object WeakMap]",v_="[object ArrayBuffer]",__="[object DataView]",b_="[object Float32Array]",w_="[object Float64Array]",x_="[object Int8Array]",P_="[object Int16Array]",I_="[object Int32Array]",B_="[object Uint8Array]",E_="[object Uint8ClampedArray]",S_="[object Uint16Array]",k_="[object Uint32Array]",Ne={};Ne[b_]=Ne[w_]=Ne[x_]=Ne[P_]=Ne[I_]=Ne[B_]=Ne[E_]=Ne[S_]=Ne[k_]=!0;Ne[s_]=Ne[a_]=Ne[v_]=Ne[l_]=Ne[__]=Ne[u_]=Ne[c_]=Ne[d_]=Ne[f_]=Ne[p_]=Ne[g_]=Ne[m_]=Ne[y_]=Ne[h_]=Ne[T_]=!1;function Ad(t){return Mn(t)&&ys(t.length)&&!!Ne[Dn(t)]}m(Ad,"baseIsTypedArray");var A_=Ad;function Cd(t){return function(e){return t(e)}}m(Cd,"baseUnary");var C_=Cd,Od=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Hr=Od&&typeof module=="object"&&module&&!module.nodeType&&module,O_=Hr&&Hr.exports===Od,Zo=O_&&Yc.process,R_=(function(){try{var t=Hr&&Hr.require&&Hr.require("util").types;return t||Zo&&Zo.binding&&Zo.binding("util")}catch{}})(),_c=R_,bc=_c&&_c.isTypedArray,M_=bc?C_(bc):A_,Rd=M_,N_=Object.prototype,D_=N_.hasOwnProperty;function Md(t,e){var n=Qt(t),r=!n&&Ed(t),i=!n&&!r&&Qo(t),s=!n&&!r&&!i&&Rd(t),o=n||r||i||s,a=o?Yv(t.length,String):[],l=a.length;for(var c in t)(e||D_.call(t,c))&&!(o&&(c=="length"||i&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||gs(c,l)))&&a.push(c);return a}m(Md,"arrayLikeKeys");var Nd=Md;function Dd(t,e){return function(n){return t(e(n))}}m(Dd,"overArg");var Hd=Dd,H_=Hd(Object.keys,Object),U_=H_,j_=Object.prototype,$_=j_.hasOwnProperty;function Ud(t){if(!xd(t))return U_(t);var e=[];for(var n in Object(t))$_.call(t,n)&&n!="constructor"&&e.push(n);return e}m(Ud,"baseKeys");var Z_=Ud;function jd(t){return bd(t)?Nd(t):Z_(t)}m(jd,"keys");var $d=jd;function Zd(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}m(Zd,"nativeKeysIn");var L_=Zd,W_=Object.prototype,K_=W_.hasOwnProperty;function Ld(t){if(!or(t))return L_(t);var e=xd(t),n=[];for(var r in t)r=="constructor"&&(e||!K_.call(t,r))||n.push(r);return n}m(Ld,"baseKeysIn");var F_=Ld;function Wd(t){return bd(t)?Nd(t,!0):F_(t)}m(Wd,"keysIn");var z_=Wd,q_=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,G_=/^\w*$/;function Kd(t,e){if(Qt(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||fs(t)?!0:G_.test(t)||!q_.test(t)||e!=null&&t in Object(e)}m(Kd,"isKey");var hs=Kd,V_=Un(Object,"create"),$r=V_;function Fd(){this.__data__=$r?$r(null):{},this.size=0}m(Fd,"hashClear");var J_=Fd;function zd(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}m(zd,"hashDelete");var Y_=zd,X_="__lodash_hash_undefined__",Q_=Object.prototype,eb=Q_.hasOwnProperty;function qd(t){var e=this.__data__;if($r){var n=e[t];return n===X_?void 0:n}return eb.call(e,t)?e[t]:void 0}m(qd,"hashGet");var tb=qd,nb=Object.prototype,rb=nb.hasOwnProperty;function Gd(t){var e=this.__data__;return $r?e[t]!==void 0:rb.call(e,t)}m(Gd,"hashHas");var ib=Gd,ob="__lodash_hash_undefined__";function Vd(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=$r&&e===void 0?ob:e,this}m(Vd,"hashSet");var sb=Vd;function jn(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}m(jn,"Hash");jn.prototype.clear=J_;jn.prototype.delete=Y_;jn.prototype.get=tb;jn.prototype.has=ib;jn.prototype.set=sb;var wc=jn;function Jd(){this.__data__=[],this.size=0}m(Jd,"listCacheClear");var ab=Jd;function Yd(t,e){for(var n=t.length;n--;)if(ms(t[n][0],e))return n;return-1}m(Yd,"assocIndexOf");var ji=Yd,lb=Array.prototype,ub=lb.splice;function Xd(t){var e=this.__data__,n=ji(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():ub.call(e,n,1),--this.size,!0}m(Xd,"listCacheDelete");var cb=Xd;function Qd(t){var e=this.__data__,n=ji(e,t);return n<0?void 0:e[n][1]}m(Qd,"listCacheGet");var db=Qd;function ef(t){return ji(this.__data__,t)>-1}m(ef,"listCacheHas");var fb=ef;function tf(t,e){var n=this.__data__,r=ji(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}m(tf,"listCacheSet");var pb=tf;function $n(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])}}m($n,"ListCache");$n.prototype.clear=ab;$n.prototype.delete=cb;$n.prototype.get=db;$n.prototype.has=fb;$n.prototype.set=pb;var $i=$n,gb=Un(nn,"Map"),Zr=gb;function nf(){this.size=0,this.__data__={hash:new wc,map:new(Zr||$i),string:new wc}}m(nf,"mapCacheClear");var mb=nf;function rf(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}m(rf,"isKeyable");var yb=rf;function of(t,e){var n=t.__data__;return yb(e)?n[typeof e=="string"?"string":"hash"]:n.map}m(of,"getMapData");var Zi=of;function sf(t){var e=Zi(this,t).delete(t);return this.size-=e?1:0,e}m(sf,"mapCacheDelete");var hb=sf;function af(t){return Zi(this,t).get(t)}m(af,"mapCacheGet");var Tb=af;function lf(t){return Zi(this,t).has(t)}m(lf,"mapCacheHas");var vb=lf;function uf(t,e){var n=Zi(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}m(uf,"mapCacheSet");var _b=uf;function Zn(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])}}m(Zn,"MapCache");Zn.prototype.clear=mb;Zn.prototype.delete=hb;Zn.prototype.get=Tb;Zn.prototype.has=vb;Zn.prototype.set=_b;var Li=Zn,bb="Expected a function";function Wi(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(bb);var n=m(function(){var r=arguments,i=e?e.apply(this,r):r[0],s=n.cache;if(s.has(i))return s.get(i);var o=t.apply(this,r);return n.cache=s.set(i,o)||s,o},"memoized");return n.cache=new(Wi.Cache||Li),n}m(Wi,"memoize");Wi.Cache=Li;var wb=Wi,xb=500;function cf(t){var e=wb(t,function(r){return n.size===xb&&n.clear(),r}),n=e.cache;return e}m(cf,"memoizeCapped");var Pb=cf,Ib=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Bb=/\\(\\)?/g,Eb=Pb(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Ib,function(n,r,i,s){e.push(i?s.replace(Bb,"$1"):r||n)}),e}),Sb=Eb;function df(t){return t==null?"":wv(t)}m(df,"toString");var kb=df;function ff(t,e){return Qt(t)?t:hs(t,e)?[t]:Sb(kb(t))}m(ff,"castPath");var Ki=ff,Ab=1/0;function pf(t){if(typeof t=="string"||fs(t))return t;var e=t+"";return e=="0"&&1/t==-Ab?"-0":e}m(pf,"toKey");var Vr=pf;function gf(t,e){e=Ki(e,t);for(var n=0,r=e.length;t!=null&&n<r;)t=t[Vr(e[n++])];return n&&n==r?t:void 0}m(gf,"baseGet");var Ts=gf;function mf(t,e,n){var r=t==null?void 0:Ts(t,e);return r===void 0?n:r}m(mf,"get");var Cb=mf;function yf(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}m(yf,"arrayPush");var hf=yf,Ob=Hd(Object.getPrototypeOf,Object),Tf=Ob,Rb="[object Object]",Mb=Function.prototype,Nb=Object.prototype,vf=Mb.toString,Db=Nb.hasOwnProperty,Hb=vf.call(Object);function _f(t){if(!Mn(t)||Dn(t)!=Rb)return!1;var e=Tf(t);if(e===null)return!0;var n=Db.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&vf.call(n)==Hb}m(_f,"isPlainObject");var Ub=_f;function bf(){this.__data__=new $i,this.size=0}m(bf,"stackClear");var jb=bf;function wf(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}m(wf,"stackDelete");var $b=wf;function xf(t){return this.__data__.get(t)}m(xf,"stackGet");var Zb=xf;function Pf(t){return this.__data__.has(t)}m(Pf,"stackHas");var Lb=Pf,Wb=200;function If(t,e){var n=this.__data__;if(n instanceof $i){var r=n.__data__;if(!Zr||r.length<Wb-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Li(r)}return n.set(t,e),this.size=n.size,this}m(If,"stackSet");var Kb=If;function Ln(t){var e=this.__data__=new $i(t);this.size=e.size}m(Ln,"Stack");Ln.prototype.clear=jb;Ln.prototype.delete=$b;Ln.prototype.get=Zb;Ln.prototype.has=Lb;Ln.prototype.set=Kb;var wi=Ln;function Bf(t,e){for(var n=-1,r=t==null?0:t.length,i=0,s=[];++n<r;){var o=t[n];e(o,n,t)&&(s[i++]=o)}return s}m(Bf,"arrayFilter");var Fb=Bf;function Ef(){return[]}m(Ef,"stubArray");var Sf=Ef,zb=Object.prototype,qb=zb.propertyIsEnumerable,xc=Object.getOwnPropertySymbols,Gb=xc?function(t){return t==null?[]:(t=Object(t),Fb(xc(t),function(e){return qb.call(t,e)}))}:Sf,kf=Gb,Vb=Object.getOwnPropertySymbols,Jb=Vb?function(t){for(var e=[];t;)hf(e,kf(t)),t=Tf(t);return e}:Sf,Yb=Jb;function Af(t,e,n){var r=e(t);return Qt(t)?r:hf(r,n(t))}m(Af,"baseGetAllKeys");var Cf=Af;function Of(t){return Cf(t,$d,kf)}m(Of,"getAllKeys");var Pc=Of;function Rf(t){return Cf(t,z_,Yb)}m(Rf,"getAllKeysIn");var Xb=Rf,Qb=Un(nn,"DataView"),es=Qb,ew=Un(nn,"Promise"),ts=ew,tw=Un(nn,"Set"),ns=tw,Ic="[object Map]",nw="[object Object]",Bc="[object Promise]",Ec="[object Set]",Sc="[object WeakMap]",kc="[object DataView]",rw=Hn(es),iw=Hn(Zr),ow=Hn(ts),sw=Hn(ns),aw=Hn(Xo),En=Dn;(es&&En(new es(new ArrayBuffer(1)))!=kc||Zr&&En(new Zr)!=Ic||ts&&En(ts.resolve())!=Bc||ns&&En(new ns)!=Ec||Xo&&En(new Xo)!=Sc)&&(En=m(function(t){var e=Dn(t),n=e==nw?t.constructor:void 0,r=n?Hn(n):"";if(r)switch(r){case rw:return kc;case iw:return Ic;case ow:return Bc;case sw:return Ec;case aw:return Sc}return e},"getTag"));var Ac=En,lw=nn.Uint8Array,Cc=lw,uw="__lodash_hash_undefined__";function Mf(t){return this.__data__.set(t,uw),this}m(Mf,"setCacheAdd");var cw=Mf;function Nf(t){return this.__data__.has(t)}m(Nf,"setCacheHas");var dw=Nf;function Lr(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new Li;++e<n;)this.add(t[e])}m(Lr,"SetCache");Lr.prototype.add=Lr.prototype.push=cw;Lr.prototype.has=dw;var fw=Lr;function Df(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}m(Df,"arraySome");var pw=Df;function Hf(t,e){return t.has(e)}m(Hf,"cacheHas");var gw=Hf,mw=1,yw=2;function Uf(t,e,n,r,i,s){var o=n&mw,a=t.length,l=e.length;if(a!=l&&!(o&&l>a))return!1;var c=s.get(t),f=s.get(e);if(c&&f)return c==e&&f==t;var p=-1,g=!0,y=n&yw?new fw:void 0;for(s.set(t,e),s.set(e,t);++p<a;){var T=t[p],P=e[p];if(r)var I=o?r(P,T,p,e,t,s):r(T,P,p,t,e,s);if(I!==void 0){if(I)continue;g=!1;break}if(y){if(!pw(e,function(_,E){if(!gw(y,E)&&(T===_||i(T,_,n,r,s)))return y.push(E)})){g=!1;break}}else if(!(T===P||i(T,P,n,r,s))){g=!1;break}}return s.delete(t),s.delete(e),g}m(Uf,"equalArrays");var jf=Uf;function $f(t){var e=-1,n=Array(t.size);return t.forEach(function(r,i){n[++e]=[i,r]}),n}m($f,"mapToArray");var hw=$f;function Zf(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}m(Zf,"setToArray");var Tw=Zf,vw=1,_w=2,bw="[object Boolean]",ww="[object Date]",xw="[object Error]",Pw="[object Map]",Iw="[object Number]",Bw="[object RegExp]",Ew="[object Set]",Sw="[object String]",kw="[object Symbol]",Aw="[object ArrayBuffer]",Cw="[object DataView]",Oc=yn?yn.prototype:void 0,Lo=Oc?Oc.valueOf:void 0;function Lf(t,e,n,r,i,s,o){switch(n){case Cw:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Aw:return!(t.byteLength!=e.byteLength||!s(new Cc(t),new Cc(e)));case bw:case ww:case Iw:return ms(+t,+e);case xw:return t.name==e.name&&t.message==e.message;case Bw:case Sw:return t==e+"";case Pw:var a=hw;case Ew:var l=r&vw;if(a||(a=Tw),t.size!=e.size&&!l)return!1;var c=o.get(t);if(c)return c==e;r|=_w,o.set(t,e);var f=jf(a(t),a(e),r,i,s,o);return o.delete(t),f;case kw:if(Lo)return Lo.call(t)==Lo.call(e)}return!1}m(Lf,"equalByTag");var Ow=Lf,Rw=1,Mw=Object.prototype,Nw=Mw.hasOwnProperty;function Wf(t,e,n,r,i,s){var o=n&Rw,a=Pc(t),l=a.length,c=Pc(e),f=c.length;if(l!=f&&!o)return!1;for(var p=l;p--;){var g=a[p];if(!(o?g in e:Nw.call(e,g)))return!1}var y=s.get(t),T=s.get(e);if(y&&T)return y==e&&T==t;var P=!0;s.set(t,e),s.set(e,t);for(var I=o;++p<l;){g=a[p];var _=t[g],E=e[g];if(r)var B=o?r(E,_,g,e,t,s):r(_,E,g,t,e,s);if(!(B===void 0?_===E||i(_,E,n,r,s):B)){P=!1;break}I||(I=g=="constructor")}if(P&&!I){var D=t.constructor,$=e.constructor;D!=$&&"constructor"in t&&"constructor"in e&&!(typeof D=="function"&&D instanceof D&&typeof $=="function"&&$ instanceof $)&&(P=!1)}return s.delete(t),s.delete(e),P}m(Wf,"equalObjects");var Dw=Wf,Hw=1,Rc="[object Arguments]",Mc="[object Array]",_i="[object Object]",Uw=Object.prototype,Nc=Uw.hasOwnProperty;function Kf(t,e,n,r,i,s){var o=Qt(t),a=Qt(e),l=o?Mc:Ac(t),c=a?Mc:Ac(e);l=l==Rc?_i:l,c=c==Rc?_i:c;var f=l==_i,p=c==_i,g=l==c;if(g&&Qo(t)){if(!Qo(e))return!1;o=!0,f=!1}if(g&&!f)return s||(s=new wi),o||Rd(t)?jf(t,e,n,r,i,s):Ow(t,e,l,n,r,i,s);if(!(n&Hw)){var y=f&&Nc.call(t,"__wrapped__"),T=p&&Nc.call(e,"__wrapped__");if(y||T){var P=y?t.value():t,I=T?e.value():e;return s||(s=new wi),i(P,I,n,r,s)}}return g?(s||(s=new wi),Dw(t,e,n,r,i,s)):!1}m(Kf,"baseIsEqualDeep");var jw=Kf;function vs(t,e,n,r,i){return t===e?!0:t==null||e==null||!Mn(t)&&!Mn(e)?t!==t&&e!==e:jw(t,e,n,r,vs,i)}m(vs,"baseIsEqual");var Fi=vs,$w=1,Zw=2;function Ff(t,e,n,r){var i=n.length,s=i,o=!r;if(t==null)return!s;for(t=Object(t);i--;){var a=n[i];if(o&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++i<s;){a=n[i];var l=a[0],c=t[l],f=a[1];if(o&&a[2]){if(c===void 0&&!(l in t))return!1}else{var p=new wi;if(r)var g=r(c,f,l,t,e,p);if(!(g===void 0?Fi(f,c,$w|Zw,r,p):g))return!1}}return!0}m(Ff,"baseIsMatch");var Lw=Ff;function zf(t){return t===t&&!or(t)}m(zf,"isStrictComparable");var qf=zf;function Gf(t){for(var e=$d(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,qf(i)]}return e}m(Gf,"getMatchData");var Ww=Gf;function Vf(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}m(Vf,"matchesStrictComparable");var Jf=Vf;function Yf(t){var e=Ww(t);return e.length==1&&e[0][2]?Jf(e[0][0],e[0][1]):function(n){return n===t||Lw(n,t,e)}}m(Yf,"baseMatches");var Kw=Yf;function Xf(t,e){return t!=null&&e in Object(t)}m(Xf,"baseHasIn");var Fw=Xf;function Qf(t,e,n){e=Ki(e,t);for(var r=-1,i=e.length,s=!1;++r<i;){var o=Vr(e[r]);if(!(s=t!=null&&n(t,o)))break;t=t[o]}return s||++r!=i?s:(i=t==null?0:t.length,!!i&&ys(i)&&gs(o,i)&&(Qt(t)||Ed(t)))}m(Qf,"hasPath");var zw=Qf;function ep(t,e){return t!=null&&zw(t,e,Fw)}m(ep,"hasIn");var qw=ep,Gw=1,Vw=2;function tp(t,e){return hs(t)&&qf(e)?Jf(Vr(t),e):function(n){var r=Cb(n,t);return r===void 0&&r===e?qw(n,t):Fi(e,r,Gw|Vw)}}m(tp,"baseMatchesProperty");var Jw=tp;function np(t){return function(e){return e?.[t]}}m(np,"baseProperty");var Yw=np;function rp(t){return function(e){return Ts(e,t)}}m(rp,"basePropertyDeep");var Xw=rp;function ip(t){return hs(t)?Yw(Vr(t)):Xw(t)}m(ip,"property");var Qw=ip;function op(t){return typeof t=="function"?t:t==null?xv:typeof t=="object"?Qt(t)?Jw(t[0],t[1]):Kw(t):Qw(t)}m(op,"baseIteratee");var sp=op;function ap(t,e){return Fi(t,e)}m(ap,"isEqual");var mn=ap;function lp(t,e,n){n=typeof n=="function"?n:void 0;var r=n?n(t,e):void 0;return r===void 0?Fi(t,e,void 0,n):!!r}m(lp,"isEqualWith");var ex=lp;function up(t){return t===void 0}m(up,"isUndefined");var Dc=up,tx="Expected a function";function cp(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)}}m(cp,"negate");var nx=cp;function dp(t,e,n,r){if(!or(t))return t;e=Ki(e,t);for(var i=-1,s=e.length,o=s-1,a=t;a!=null&&++i<s;){var l=Vr(e[i]),c=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return t;if(i!=o){var f=a[l];c=r?r(f,l,a):void 0,c===void 0&&(c=or(f)?f:gs(e[i+1])?[]:{})}Gv(a,l,c),a=a[l]}return t}m(dp,"baseSet");var rx=dp;function fp(t,e,n){for(var r=-1,i=e.length,s={};++r<i;){var o=e[r],a=Ts(t,o);n(a,o)&&rx(s,Ki(o,t),a)}return s}m(fp,"basePickBy");var ix=fp;function pp(t,e){if(t==null)return{};var n=od(Xb(t),function(r){return[r]});return e=sp(e),ix(t,n,function(r,i){return e(r,i[0])})}m(pp,"pickBy");var ox=pp;function gp(t,e){return ox(t,nx(sp(e)))}m(gp,"omitBy");var Hc=gp,mp=m((t,e)=>yp(t,e,new WeakSet),"isEqual"),Uc=m(t=>Ub(t),"_isPlainObject"),yp=m((t,e,n)=>ex(t,e,sx(n)),"_isEqualWithVisitedTracking"),sx=m(t=>(e,n)=>{if(Uc(e)&&!t.has(e)&&Uc(n)&&!t.has(n)){let r=Hc(e,Dc),i=Hc(n,Dc);return t.add(r).add(i).add(e).add(n),yp(r,i,t)}},"_customizerWithVisitedTracking"),ax=m(t=>Array.from(new Set(t)),"unique"),lx={compare:mp},hp=class{constructor(e=[],n={}){this._options=w(w({},lx),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))}};m(hp,"CustomSet");var ux=hp,ae={};Rt(ae,{errToObj:()=>cx,toString:()=>dx});var cx=m(t=>typeof t=="string"?{message:t}:t||{},"errToObj"),dx=m(t=>typeof t=="string"?t:t?.message,"toString"),Ot={};Rt(Ot,{assertNever:()=>Tp});function Tp(t){throw new Error("assertNever called")}m(Tp,"assertNever");var Ct={};Rt(Ct,{compareFunctions:()=>px,joinValues:()=>vp,jsonStringifyReplacer:()=>fx});function vp(t,e=" | "){return t.map(n=>typeof n=="string"?`'${n}'`:n).join(e)}m(vp,"joinValues");var fx=m((t,e)=>typeof e=="bigint"?e.toString():e,"jsonStringifyReplacer"),px=m((t,e)=>t.toString()===e.toString(),"compareFunctions"),_p={};Rt(_p,{extractPrecisionAndOffset:()=>wp,generateDatetimeRegex:()=>bp});var bp=m(t=>{let e=t.precision?rs+t.precision+mx:t.precision===0?"":Ip,n=t.offset?Pp:gx;return new RegExp(`^${xp}${e}${n}$`)},"generateDatetimeRegex"),wp=m(t=>({precision:yx(t),offset:t.endsWith(`${Pp}$`)}),"extractPrecisionAndOffset"),xp="\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}",Pp="(([+-]\\d{2}(:?\\d{2})?)|Z)",gx="Z",Ip="(\\.\\d+)?",rs="\\.\\d{",mx="}",yx=m(t=>{let e=t.slice(1+xp.length);return e.startsWith(Ip)?null:e.startsWith(rs)?parseInt(e.slice(rs.length)):0},"_extractPrecision"),Ri=m((t,e)=>{let n;switch(t.code){case"invalid_type":t.received==="undefined"?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case"invalid_literal":n=`Invalid literal value, expected ${JSON.stringify(t.expected,Ct.jsonStringifyReplacer)}`;break;case"unrecognized_keys":n=`Unrecognized key(s) in object: ${Ct.joinValues(t.keys,", ")}`;break;case"invalid_union":n="Invalid input";break;case"invalid_union_discriminator":n=`Invalid discriminator value. Expected ${Ct.joinValues(t.options)}`;break;case"invalid_enum_value":n=`Invalid enum value. Expected ${Ct.joinValues(t.options)}, received '${t.received}'`;break;case"invalid_arguments":n="Invalid function arguments";break;case"invalid_return_type":n="Invalid function return type";break;case"invalid_date":n="Invalid date";break;case"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}"`:Ot.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case"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"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"custom":n="Invalid input";break;case"invalid_intersection_types":n="Intersection results could not be merged";break;case"not_multiple_of":n=`Number must be a multiple of ${t.multipleOf}`;break;case"not_finite":n="Number must be finite";break;case"unresolved_reference":n="Unresolved reference";break;default:n=e.defaultError,Ot.assertNever(t)}return{message:n}},"errorMap"),Mi=class Bp extends Error{constructor(e){super(),this.__type__="ZuiError",this.issues=[],this.addIssue=m(r=>{this.issues=[...this.issues,r]},"addIssue"),this.addIssues=m((r=[])=>{this.issues=[...this.issues,...r]},"addIssues");let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let n=e||function(s){return s.message},r={_errors:[]},i=m(s=>{for(let o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let a=r,l=0;for(;l<o.path.length;){let c=o.path[l];l===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(o))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}},"processError");return i(this),r}static assert(e){if(!(e instanceof Bp))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ct.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}};m(Mi,"ZodError");Mi.create=m(t=>new Mi(t),"create");var Xt=Mi,hx=Ri;function Ni(){return hx}m(Ni,"getErrorMap");var De={};function Ep(t){Object.assign(De,t)}m(Ep,"setBuilders");var is=m(t=>{var e;let{data:n,path:r,errorMaps:i,issueData:s}=t,o=[...r,...s.path||[]],a=M(w({},s),{path:o}),l="",c=i.filter(f=>!!f).slice().reverse();for(let f of c)l=f(a,{data:n,defaultError:l}).message;return M(w({},s),{path:o,message:(e=s.message)!=null?e:l})},"makeIssue");function ee(t,e){let n=is({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ni(),Ri].filter(r=>!!r)});t.common.issues.push(n)}m(ee,"addIssueToContext");var Sp=class kp{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 i of n){if(i.status==="aborted")return{status:"aborted"};i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let i of n)r.push({key:await i.key,value:await i.value});return kp.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let i of n){let{key:s,value:o}=i;if(s.status==="aborted")return{status:"aborted"};if(o.status==="aborted")return{status:"aborted"};s.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(r[s.value]=o.value)}return{status:e.value,value:r}}};m(Sp,"ParseStatus");var bt=Sp,Di=m(t=>typeof Promise<"u"&&t instanceof Promise,"isAsync"),Cn=m(t=>{switch(typeof t){case"undefined":return"undefined";case"string":return"string";case"number":return isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":typeof Promise<"u"&&t instanceof Promise||t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":"object";default:return"unknown"}},"getParsedType"),Ap=class{constructor(e,n,r,i){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=i}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}};m(Ap,"ParseInputLazyPath");var Zt=Ap,Cp=class extends Error{constructor(e){super(`Cannot access property ${e} before initialization. You're probably importing ZUI incorrectly. If not, reach out to the maintainers.`)}};m(Cp,"_CircularDependencyError");var Wo=Cp,Op=class{constructor(e){this.__type__="ZuiType",this.spa=this.safeParseAsync,this._handleResult=m((n,r)=>{if(r.status==="valid")return{success:!0,data:r.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let i=new Xt(n.common.issues);return this._error=i,this._error}}},"_handleResult"),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.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this.downstream=this.downstream.bind(this)}get description(){return this._metadataRoot._def.description}get typeName(){return this._def.typeName}dereference(e){return this}getReferences(){return[]}clone(){let e=this.constructor;return new e(w({},this._def))}_getType(e){return Cn(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Cn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new bt,ctx:{common:e.parent.common,data:e.data,parsedType:Cn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(Di(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 i={common:{issues:[],async:(r=n?.async)!=null?r:!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Cn(e)},s=this._parseSync({data:e,path:i.path,parent:i});return this._handleResult(i,s)}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Cn(e)},i=this._parse({data:e,path:r.path,parent:r}),s=await(Di(i)?i:Promise.resolve(i));return this._handleResult(r,s)}refine(e,n){let r=m(i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n,"getIssueProperties");return De.downstream(this,i=>{let s=e(i),o=[],a=m(()=>o.push(w({code:"custom"},r(i))),"setError");return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?{status:"valid",value:i}:(a(),{status:"dirty",value:i,issues:o})):s?{status:"valid",value:i}:(a(),{status:"dirty",value:i,issues:o})})}superRefine(e){return De.downstream(this,(n,r)=>{let i=[],s=e(n,{addIssue:o=>i.push(o),path:r.path});return typeof Promise<"u"&&s instanceof Promise?s.then(()=>i.some(o=>o.fatal)?{status:"aborted",issues:i}:i.length?{status:"dirty",value:n,issues:i}:{status:"valid",value:n}):i.some(o=>o.fatal)?{status:"aborted",issues:i}:i.length?{status:"dirty",value:n,issues:i}:{status:"valid",value:n}})}downstream(e,n){return De.downstream(this,e,n)}optional(){return De.optional(this,this._def)}nullable(){return De.nullable(this,this._def)}nullish(){return this.nullable().optional()}array(){return De.array(this,this._def)}promise(){return De.promise(this,this._def)}mandatory(){return this}or(e){return De.union([this,e])}and(e){return De.intersection(this,e)}transform(e){return De.downstream(this,(n,r)=>{let i=[],s=e(n,{addIssue:o=>i.push(o),path:r.path});return s instanceof Promise?s.then(o=>i.some(a=>a.fatal)?{status:"aborted",issues:i}:i.length?{status:"dirty",value:o,issues:i}:{status:"valid",value:o}):i.some(o=>o.fatal)?{status:"aborted",issues:i}:i.length?{status:"dirty",value:s,issues:i}:{status:"valid",value:s}},{failFast:!0})}default(e){let n=typeof e=="function"?e:()=>e;return De.default(this,n)}brand(){return De.branded(this)}catch(e){return De.catch(this,e)}describe(e){let n=this.clone();return n._metadataRoot._def.description=e,n}pipe(e){return De.pipeline(this,e)}readonly(){return De.readonly(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}metadata(e){var n,r,i;let s=this.clone(),o=s._metadataRoot;(i=(n=o._def)[r=Ae])!=null||(n[r]={});for(let[a,l]of Object.entries(e))o._def[Ae]=M(w({},o._def[Ae]),{[a]:l});return s}getMetadata(){return w({},this._metadataRoot._def[Ae])}setMetadata(e){this._metadataRoot._def[Ae]=w({},e)}get ui(){return w({},this._metadataRoot._def[Ae])}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(e){throw new Wo("toJSONSchema")}toTypescriptType(e){throw new Wo("toTypescriptType")}toTypescriptSchema(){throw new Wo("toTypescriptSchema")}naked(){return this}};m(Op,"ZodBaseTypeImpl");var pe=Op,Rp=class Mp extends pe{constructor(){super(...arguments),this._any=!0}_parse(e){return{status:"valid",value:e.data}}isEqual(e){return e instanceof Mp}};m(Rp,"ZodAnyImpl");var Tx=Rp,Np=class Sn extends pe{dereference(e){return new Sn(M(w({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new Sn(M(w({},this._def),{type:this._def.type.clone()}))}isEqual(e){var n,r,i,s,o,a;return e instanceof Sn?mn((n=this._def.exactLength)==null?void 0:n.value,(r=e._def.exactLength)==null?void 0:r.value)&&mn((i=this._def.maxLength)==null?void 0:i.value,(s=e._def.maxLength)==null?void 0:s.value)&&mn((o=this._def.minLength)==null?void 0:o.value,(a=e._def.minLength)==null?void 0:a.value)&&this._def.type.isEqual(e._def.type):!1}_parse(e){let{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!=="array")return ee(n,{code:"invalid_type",expected:"array",received:n.parsedType}),{status:"aborted"};if(i.exactLength!==null){let o=n.data.length>i.exactLength.value,a=n.data.length<i.exactLength.value;(o||a)&&(ee(n,{code:o?"too_big":"too_small",minimum:a?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(ee(n,{code:"too_small",minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(ee(n,{code:"too_big",maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>i.type._parseAsync(new Zt(n,o,n.path,a)))).then(o=>bt.mergeArray(r,o));let s=[...n.data].map((o,a)=>i.type._parseSync(new Zt(n,o,n.path,a)));return bt.mergeArray(r,s)}get element(){return this._def.type}min(e,n){return new Sn(M(w({},this._def),{minLength:{value:e,message:ae.toString(n)}}))}max(e,n){return new Sn(M(w({},this._def),{maxLength:{value:e,message:ae.toString(n)}}))}length(e,n){return new Sn(M(w({},this._def),{exactLength:{value:e,message:ae.toString(n)}}))}nonempty(e){return this.min(1,e)}};m(Np,"ZodArrayImpl");var vx=Np,Dp=class xi extends pe{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)!=="bigint"){let s=this._getOrReturnCtx(e);return ee(s,{code:"invalid_type",expected:"bigint",received:s.parsedType}),{status:"aborted"}}let r,i=new bt;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),ee(r,{code:"too_small",type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),ee(r,{code:"too_big",type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),ee(r,{code:"not_multiple_of",multipleOf:s.value,message:s.message}),i.dirty()):Ot.assertNever(s);return{status:i.value,value:e.data}}isEqual(e){if(!(e instanceof xi)||this._def.coerce!==e._def.coerce)return!1;let n=new Ye.CustomSet(this._def.checks),r=new Ye.CustomSet(e._def.checks);return n.isEqual(r)}gte(e,n){return this.setLimit("min",e,!0,ae.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ae.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ae.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ae.toString(n))}setLimit(e,n,r,i){return new xi(M(w({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ae.toString(i)}]}))}_addCheck(e){return new xi(M(w({},this._def),{checks:[...this._def.checks,e]}))}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ae.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ae.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ae.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ae.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ae.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}};m(Dp,"ZodBigIntImpl");var _x=Dp,Hp=class Up extends pe{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!=="boolean"){let r=this._getOrReturnCtx(e);return ee(r,{code:"invalid_type",expected:"boolean",received:r.parsedType}),{status:"aborted"}}return{status:"valid",value:e.data}}isEqual(e){return e instanceof Up?this._def.coerce===e._def.coerce:!1}};m(Hp,"ZodBooleanImpl");var bx=Hp,jp=class Ir extends pe{dereference(e){return new Ir(M(w({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new Ir(M(w({},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 Ir?this._def.type.isEqual(e._def.type):!1}naked(){return this._def.type.naked()}mandatory(){return new Ir(M(w({},this._def),{type:this._def.type.mandatory()}))}};m(jp,"ZodBrandedImpl");var wx=jp,$p=class Br extends pe{_parse(e){let{ctx:n}=this._processInputParams(e),r=M(w({},n),{common:M(w({},n.common),{issues:[]})}),i=this._def.innerType._parse({data:r.data,path:r.path,parent:w({},r)});return Di(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Xt(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Xt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}isEqual(e){return e instanceof Br?this._def.innerType.isEqual(e._def.innerType)&&Ct.compareFunctions(this._def.catchValue,e._def.catchValue):!1}dereference(e){return new Br(M(w({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Br(M(w({},this._def),{innerType:this._def.innerType.clone()}))}naked(){return this._def.innerType.naked()}mandatory(){return new Br(M(w({},this._def),{innerType:this._def.innerType.mandatory()}))}};m($p,"ZodCatchImpl");var xx=$p,Zp=class os extends pe{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!=="date"){let s=this._getOrReturnCtx(e);return ee(s,{code:"invalid_type",expected:"date",received:s.parsedType}),{status:"aborted"}}if(isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return ee(s,{code:"invalid_date"}),{status:"aborted"}}let r=new bt,i;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(i=this._getOrReturnCtx(e,i),ee(i,{code:"too_small",message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(i=this._getOrReturnCtx(e,i),ee(i,{code:"too_big",message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):Ot.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new os(M(w({},this._def),{checks:[...this._def.checks,e]}))}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:ae.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:ae.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 os))return!1;let n=new Ye.CustomSet(this._def.checks),r=new Ye.CustomSet(e._def.checks);return n.isEqual(r)&&this._def.coerce===e._def.coerce}};m(Zp,"ZodDateImpl");var Px=Zp,Lp=class Er extends pe{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType==="undefined"&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}dereference(e){return new Er(M(w({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Er(M(w({},this._def),{innerType:this._def.innerType.clone()}))}isEqual(e){return e instanceof Er?this._def.innerType.isEqual(e._def.innerType)&&mn(this._def.defaultValue(),e._def.defaultValue()):!1}unwrap(){return this._def.innerType}naked(){return this._def.innerType.naked()}mandatory(){return new Er(M(w({},this._def),{innerType:this._def.innerType.mandatory()}))}};m(Lp,"ZodDefaultImpl");var Ix=Lp,Yt=m(t=>{let e=t;return e?e.typeName==="ZodLazy"?Yt(e.schema):e.typeName==="ZodEffects"?Yt(e.innerType()):e.typeName==="ZodLiteral"?[e.value]:e.typeName==="ZodEnum"?e.options:e.typeName==="ZodNativeEnum"?Object.values(e.enum):e.typeName==="ZodDefault"?Yt(e._def.innerType):e.typeName==="ZodUndefined"?[void 0]:e.typeName==="ZodNull"?[null]:e.typeName==="ZodOptional"?[void 0,...Yt(e.unwrap())]:e.typeName==="ZodNullable"?[null,...Yt(e.unwrap())]:e.typeName==="ZodBranded"||e.typeName==="ZodReadonly"?Yt(e.unwrap()):e.typeName==="ZodCatch"?Yt(e._def.innerType):[]:[]},"getDiscriminator"),Wp=class Sr extends pe{constructor(e){let n=Sr._getOptionsMap(e.discriminator,e.options);super(M(w({},e),{optionsMap:n}))}dereference(e){let n=this.options.map(r=>r.dereference(e));return new Sr(M(w({},this._def),{options:n}))}getReferences(){return Lt.unique(this.options.flatMap(e=>e.getReferences()))}clone(){let e=this.options.map(n=>n.clone());return new Sr(M(w({},this._def),{options:e}))}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!=="object")return ee(n,{code:"invalid_type",expected:"object",received:n.parsedType}),{status:"aborted"};let r=this.discriminator,i=n.data[r],s=this.optionsMap.get(i);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(ee(n,{code:"invalid_union_discriminator",options:Array.from(this.optionsMap.keys()),path:[r]}),{status:"aborted"})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static _getOptionsMap(e,n){let r=new Map;for(let i of n){let s=Yt(i.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of s){if(r.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);r.set(o,i)}}return r}isEqual(e){if(!(e instanceof Sr)||this._def.discriminator!==e._def.discriminator)return!1;let n=m((s,o)=>s.isEqual(o),"compare"),r=new Ye.CustomSet(this._def.options,{compare:n}),i=new Ye.CustomSet(e._def.options,{compare:n});return r.isEqual(i)}};m(Wp,"ZodDiscriminatedUnionImpl");var Bx=Wp,Kp=class Fp extends pe{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return ee(n,{expected:Ct.joinValues(r),received:n.parsedType,code:"invalid_type"}),{status:"aborted"}}if(this._def.values.indexOf(e.data)===-1){let n=this._getOrReturnCtx(e),r=this._def.values;return ee(n,{received:n.data,code:"invalid_enum_value",options:r}),{status:"aborted"}}return{status:"valid",value: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(){return this.enum}get Enum(){return this.enum}extract(e,n=this._def){return De.enum(e,w(w({},this._def),n))}exclude(e,n=this._def){return De.enum(this.options.filter(r=>!e.includes(r)),w(w({},this._def),n))}isEqual(e){if(!(e instanceof Fp))return!1;let n=new Ye.CustomSet(this._def.values),r=new Ye.CustomSet(e._def.values);return n.isEqual(r)}};m(Kp,"ZodEnumImpl");var Ex=Kp,zp=class tr extends pe{constructor(){super(...arguments),this.validate=this.implement}dereference(e){let n=this._def.args.dereference(e),r=this._def.returns.dereference(e);return new tr(M(w({},this._def),{args:n,returns:r}))}getReferences(){return Lt.unique([...this._def.args.getReferences(),...this._def.returns.getReferences()])}clone(){return new tr(M(w({},this._def),{args:this._def.args.clone(),returns:this._def.returns.clone()}))}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!=="function")return ee(n,{code:"invalid_type",expected:"function",received:n.parsedType}),{status:"aborted"};function r(c,f){return is({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Ni(),Ri].filter(p=>!!p),issueData:{code:"invalid_arguments",argumentsError:f}})}m(r,"makeArgsIssue");function i(c,f){return is({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Ni(),Ri].filter(p=>!!p),issueData:{code:"invalid_return_type",returnTypeError:f}})}m(i,"makeReturnsIssue");let s={errorMap:n.common.contextualErrorMap},o=n.data,a=this,l=this._def.returns;return Ee.zuiPromise(l)?{status:"valid",async value(...c){let f=new Xt([]),p=await a._def.args.parseAsync(c,s).catch(T=>{throw f.addIssue(r(c,T)),f}),g=await Reflect.apply(o,this,p);return await l._def.type.parseAsync(g,s).catch(T=>{throw Ee.zuiError(T)?(f.addIssue(i(g,T)),f):T})}}:{status:"valid",value(...c){let f=a._def.args.safeParse(c,s);if(!f.success)throw new Xt([r(c,f.error)]);let p=Reflect.apply(o,this,f.data),g=a._def.returns.safeParse(p,s);if(!g.success)throw new Xt([i(p,g.error)]);return g.data}}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new tr(M(w({},this._def),{args:De.tuple(e).rest(De.unknown())}))}returns(e){return new tr(M(w({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}isEqual(e){return e instanceof tr&&this._def.args.isEqual(e._def.args)&&this._def.returns.isEqual(e._def.returns)}};m(zp,"ZodFunctionImpl");var Sx=zp,qp=class Pi extends pe{dereference(e){return new Pi(M(w({},this._def),{left:this._def.left.dereference(e),right:this._def.right.dereference(e)}))}getReferences(){return Lt.unique([...this._def.left.getReferences(),...this._def.right.getReferences()])}clone(){return new Pi(M(w({},this._def),{left:this._def.left.clone(),right:this._def.right.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),i=m((s,o)=>{if(s.status==="aborted"||o.status==="aborted")return{status:"aborted"};let a=this._mergeValues(s.value,o.value);return a.valid?((s.status==="dirty"||o.status==="dirty")&&n.dirty(),{status:n.value,value:a.data}):(ee(r,{code:"invalid_intersection_types"}),{status:"aborted"})},"handleParsed");return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,o])=>i(s,o)):i(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 Pi))return!1;let n=m((s,o)=>s.isEqual(o),"compare"),r=new Ye.CustomSet([this._def.left,this._def.right],{compare:n}),i=new Ye.CustomSet([e._def.left,e._def.right],{compare:n});return r.isEqual(i)}_mergeValues(e,n){let r=Cn(e),i=Cn(n);if(e===n)return{valid:!0,data:e};if(r==="object"&&i==="object"){let s=Object.keys(n),o=Object.keys(e).filter(l=>s.indexOf(l)!==-1),a=w(w({},e),n);for(let l of o){let c=this._mergeValues(e[l],n[l]);if(!c.valid)return{valid:!1};a[l]=c.data}return{valid:!0,data:a}}else if(r==="array"&&i==="array"){if(e.length!==n.length)return{valid:!1};let s=[];for(let o=0;o<e.length;o++){let a=e[o],l=n[o],c=this._mergeValues(a,l);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return r==="date"&&i==="date"&&+e==+n?{valid:!0,data:e}:{valid:!1}}};m(qp,"ZodIntersectionImpl");var kx=qp,Gp=class kr extends pe{get schema(){return this._def.getter()}dereference(e){return new kr(M(w({},this._def),{getter:()=>this._def.getter().dereference(e)}))}getReferences(){return this._def.getter().getReferences()}clone(){return new kr(M(w({},this._def),{getter:()=>this._def.getter().clone()}))}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}isEqual(e){return e instanceof kr?this._def.getter().isEqual(e._def.getter()):!1}naked(){return this._def.getter().naked()}mandatory(){return new kr(M(w({},this._def),{getter:()=>this._def.getter().mandatory()}))}};m(Gp,"ZodLazyImpl");var Ax=Gp,Vp=class Jp extends pe{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return ee(n,{received:n.data,code:"invalid_literal",expected:this._def.value}),{status:"aborted"}}return{status:"valid",value:e.data}}get value(){return this._def.value}isEqual(e){return e instanceof Jp?mn(this._def.value,e._def.value):!1}};m(Vp,"ZodLiteralImpl");var Cx=Vp,Yp=class Ii extends pe{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 Ii(M(w({},this._def),{keyType:n,valueType:r}))}getReferences(){return Lt.unique([...this._def.keyType.getReferences(),...this._def.valueType.getReferences()])}clone(){return new Ii(M(w({},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!=="map")return ee(r,{code:"invalid_type",expected:"map",received:r.parsedType}),{status:"aborted"};let i=this._def.keyType,s=this._def.valueType,o=[...r.data.entries()].map(([a,l],c)=>({key:i._parse(new Zt(r,a,r.path,[c,"key"])),value:s._parse(new Zt(r,l,r.path,[c,"value"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let l of o){let c=await l.key,f=await l.value;if(c.status==="aborted"||f.status==="aborted")return{status:"aborted"};(c.status==="dirty"||f.status==="dirty")&&n.dirty(),a.set(c.value,f.value)}return{status:n.value,value:a}})}else{let a=new Map;for(let l of o){let c=l.key,f=l.value;if(c.status==="aborted"||f.status==="aborted")return{status:"aborted"};(c.status==="dirty"||f.status==="dirty")&&n.dirty(),a.set(c.value,f.value)}return{status:n.value,value:a}}}isEqual(e){return!(!(e instanceof Ii)||!this._def.keyType.isEqual(e._def.keyType)||!this._def.valueType.isEqual(e._def.valueType))}};m(Yp,"ZodMapImpl");var Ox=Yp,Xp=class Qp extends pe{_parse(e){if(this._getType(e)!=="nan"){let r=this._getOrReturnCtx(e);return ee(r,{code:"invalid_type",expected:"nan",received:r.parsedType}),{status:"aborted"}}return{status:"valid",value:e.data}}isEqual(e){return e instanceof Qp}};m(Xp,"ZodNaNImpl");var Rx=Xp,eg=class tg extends pe{constructor(){super(...arguments),this._getValidEnumValues=m(e=>{let n=Object.keys(e).filter(i=>typeof e[e[i]]!="number"),r={};for(let i of n)r[i]=e[i];return Object.values(r)},"_getValidEnumValues")}_parse(e){let n=this._getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!=="string"&&r.parsedType!=="number"){let i=Object.values(n);return ee(r,{expected:Ct.joinValues(i),received:r.parsedType,code:"invalid_type"}),{status:"aborted"}}if(n.indexOf(e.data)===-1){let i=Object.values(n);return ee(r,{received:r.data,code:"invalid_enum_value",options:i}),{status:"aborted"}}return{status:"valid",value:e.data}}get enum(){return this._def.values}isEqual(e){return e instanceof tg?mn(this._def.values,e._def.values):!1}};m(eg,"ZodNativeEnumImpl");var Mx=eg,ng=class rg extends pe{_parse(e){let n=this._getOrReturnCtx(e);return ee(n,{code:"invalid_type",expected:"never",received:n.parsedType}),{status:"aborted"}}isEqual(e){return e instanceof rg}};m(ng,"ZodNeverImpl");var Nx=ng,ig=class og extends pe{_parse(e){if(this._getType(e)!=="null"){let r=this._getOrReturnCtx(e);return ee(r,{code:"invalid_type",expected:"null",received:r.parsedType}),{status:"aborted"}}return{status:"valid",value:e.data}}isEqual(e){return e instanceof og}};m(ig,"ZodNullImpl");var Dx=ig,sg=class Ar extends pe{dereference(e){return new Ar(M(w({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Ar(M(w({},this._def),{innerType:this._def.innerType.clone()}))}_parse(e){return this._getType(e)==="null"?{status:"valid",value:null}:this._def.innerType._parse(e)}unwrap(){return this._def.innerType}isEqual(e){return e instanceof Ar?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return new Ar(M(w({},this._def),{innerType:this._def.innerType.mandatory()}))}};m(sg,"ZodNullableImpl");var Hx=sg,ag=class Bi extends pe{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)!=="number"){let s=this._getOrReturnCtx(e);return ee(s,{code:"invalid_type",expected:"number",received:s.parsedType}),{status:"aborted"}}let r,i=new bt;for(let s of this._def.checks)s.kind==="int"?Number.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),ee(r,{code:"invalid_type",expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),ee(r,{code:"too_small",minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),ee(r,{code:"too_big",maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?this._floatSafeRemainder(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),ee(r,{code:"not_multiple_of",multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),ee(r,{code:"not_finite",message:s.message}),i.dirty()):Ot.assertNever(s);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,ae.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ae.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ae.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ae.toString(n))}setLimit(e,n,r,i){return new Bi(M(w({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ae.toString(i)}]}))}_addCheck(e){return new Bi(M(w({},this._def),{checks:[...this._def.checks,e]}))}int(e){return this._addCheck({kind:"int",message:ae.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ae.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ae.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ae.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ae.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ae.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:ae.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ae.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ae.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"&&Number.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 Ye.CustomSet(this._def.checks),r=new Ye.CustomSet(e._def.checks);return n.isEqual(r)}_floatSafeRemainder(e,n){let r=(e.toString().split(".")[1]||"").length,i=(n.toString().split(".")[1]||"").length,s=r>i?r:i,o=parseInt(e.toFixed(s).replace(".","")),a=parseInt(n.toFixed(s).replace(".",""));return o%a/Math.pow(10,s)}};m(ag,"ZodNumberImpl");var Ux=ag,lg=class gt extends pe{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=Object.keys(e);return this._cached={shape:e,keys:n}}dereference(e){let n=this._def.shape(),r={};for(let i in n)r[i]=n[i].dereference(e);return new gt(M(w({},this._def),{shape:()=>r}))}getReferences(){let e=this._def.shape(),n=[];for(let r in e)n.push(...e[r].getReferences());return Lt.unique(n)}clone(){let e={},n=this._def.shape();for(let[i,s]of Object.entries(n))e[i]=s.clone();return new gt(M(w({},this._def),{shape:()=>e}))}_parse(e){if(this._getType(e)!=="object"){let f=this._getOrReturnCtx(e);return ee(f,{code:"invalid_type",expected:"object",received:f.parsedType}),{status:"aborted"}}let{status:r,ctx:i}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),a=[];if(this._def.unknownKeys!=="strip")for(let f in i.data)o.includes(f)||a.push(f);let l=[];for(let f of o){let p=s[f],g=i.data[f];l.push({key:{status:"valid",value:f},value:p._parse(new Zt(i,g,i.path,f)),alwaysSet:f in i.data})}let c=this._def.unknownKeys;if(c==="passthrough")for(let f of a)l.push({key:{status:"valid",value:f},value:{status:"valid",value:i.data[f]}});else if(c==="strict")a.length>0&&(ee(i,{code:"unrecognized_keys",keys:a}),r.dirty());else if(c!=="strip")for(let f of a){let p=i.data[f];l.push({key:{status:"valid",value:f},value:c._parse(new Zt(i,p,i.path,f)),alwaysSet:f in i.data})}return i.common.async?Promise.resolve().then(async()=>{let f=[];for(let p of l){let g=await p.key;f.push({key:g,value:await p.value,alwaysSet:p.alwaysSet})}return f}).then(f=>bt.mergeObjectSync(r,f)):bt.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return ae.errToObj,new gt(w(M(w({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:(n,r)=>{var i,s,o,a;let l=(o=(s=(i=this._def).errorMap)==null?void 0:s.call(i,n,r).message)!=null?o:r.defaultError;return n.code==="unrecognized_keys"?{message:(a=ae.errToObj(e).message)!=null?a:l}:{message:l}}}:{}))}strip(){return new gt(M(w({},this._def),{unknownKeys:"strip"}))}passthrough(){return new gt(M(w({},this._def),{unknownKeys:"passthrough"}))}additionalProperties(){if(typeof this._def.unknownKeys=="object")return this._def.unknownKeys;if(this._def.unknownKeys==="passthrough")return De.any();if(this._def.unknownKeys==="strict")return De.never()}extend(e){return new gt(M(w({},this._def),{shape:()=>w(w({},this._def.shape()),e)}))}merge(e){return new gt({unknownKeys:e._def.unknownKeys,shape:()=>w(w({},this._def.shape()),e._def.shape()),typeName:"ZodObject"})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new gt(M(w({},this._def),{unknownKeys:e}))}pick(e){let n={};return Object.keys(e).forEach(i=>{e[i]&&this.shape[i]&&(n[i]=this.shape[i])}),new gt(M(w({},this._def),{shape:()=>n}))}omit(e){let n={};return Object.entries(this.shape).forEach(([i,s])=>{e[i]||(n[i]=s)}),new gt(M(w({},this._def),{shape:()=>n}))}partial(e){let n={};return Object.keys(this.shape).forEach(i=>{let s=this.shape[i];e&&!e[i]?n[i]=s:n[i]=s?.optional()}),new gt(M(w({},this._def),{shape:()=>n}))}required(e){let n={};return Object.entries(this.shape).forEach(([r,i])=>{if(e&&!e[r])n[r]=i;else{let o=i;for(;Ee.zuiOptional(o);)o=o._def.innerType;n[r]=o}}),new gt(M(w({},this._def),{shape:()=>n}))}keyof(){let e=Object.keys(this.shape);return De.enum(e)}isEqual(e){if(!(e instanceof gt)||!this._unknownKeysEqual(e))return!1;let n=this._def.shape(),r=e._def.shape(),i=m((a,l)=>a[0]===l[0]&&a[1].isEqual(l[1]),"compare"),s=new Ye.CustomSet(Object.entries(n),{compare:i}),o=new Ye.CustomSet(Object.entries(r),{compare:i});return s.isEqual(o)}_unknownKeysEqual(e){let n=this.additionalProperties(),r=e.additionalProperties();return n===void 0||r===void 0?n===r:n.isEqual(r)}};m(lg,"ZodObjectImpl");var ug=lg,cg=class Ei extends pe{dereference(e){return new Ei(M(w({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Ei(M(w({},this._def),{innerType:this._def.innerType.clone()}))}_parse(e){return this._getType(e)==="undefined"?{status:"valid",value:void 0}:this._def.innerType._parse(e)}unwrap(){return this._def.innerType}isEqual(e){return e instanceof Ei?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return this._def.innerType.mandatory()}};m(cg,"ZodOptionalImpl");var jx=cg,dg=class Si extends pe{dereference(e){return new Si(M(w({},this._def),{in:this._def.in.dereference(e),out:this._def.out.dereference(e)}))}getReferences(){return Lt.unique([...this._def.in.getReferences(),...this._def.out.getReferences()])}clone(){return new Si(M(w({},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 m(async()=>{let s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?{status:"aborted"}:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})},"handleAsync")();{let i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?{status:"aborted"}:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}isEqual(e){return!(!(e instanceof Si)||!this._def.in.isEqual(e._def.in)||!this._def.out.isEqual(e._def.out))}};m(dg,"ZodPipelineImpl");var $x=dg,fg=class ki extends pe{unwrap(){return this._def.type}dereference(e){return new ki(M(w({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new ki(M(w({},this._def),{type:this._def.type.clone()}))}_parse(e){let{ctx:n}=this._processInputParams(e);return n.parsedType!=="promise"&&n.common.async===!1?(ee(n,{code:"invalid_type",expected:"promise",received:n.parsedType}),{status:"aborted"}):{status:"valid",value:(n.parsedType==="promise"?n.data:Promise.resolve(n.data)).then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap}))}}isEqual(e){return e instanceof ki?this._def.type.isEqual(e._def.type):!1}naked(){return this._def.type.naked()}};m(fg,"ZodPromiseImpl");var Zx=fg,pg=class Cr extends pe{constructor(){super(...arguments),this._freeze=m(e=>e.status!=="valid"?e:M(w({},e),{value:Object.freeze(e.value)}),"_freeze")}dereference(e){return new Cr(M(w({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Cr(M(w({},this._def),{innerType:this._def.innerType.clone()}))}_parse(e){let n=this._def.innerType._parse(e);return Di(n)?n.then(this._freeze):this._freeze(n)}unwrap(){return this._def.innerType}isEqual(e){return e instanceof Cr?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return new Cr(M(w({},this._def),{innerType:this._def.innerType.mandatory()}))}};m(pg,"ZodReadonlyImpl");var Lx=pg,gg=class Ai extends pe{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 Ai(M(w({},this._def),{keyType:n,valueType:r}))}getReferences(){return Lt.unique([...this._def.keyType.getReferences(),...this._def.valueType.getReferences()])}clone(){return new Ai(M(w({},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!=="object")return ee(r,{code:"invalid_type",expected:"object",received:r.parsedType}),{status:"aborted"};let i=[],s=this._def.keyType,o=this._def.valueType;for(let a in r.data)i.push({key:s._parse(new Zt(r,a,r.path,a)),value:o._parse(new Zt(r,r.data[a],r.path,a))});return r.common.async?bt.mergeObjectAsync(n,i):bt.mergeObjectSync(n,i)}get element(){return this._def.valueType}isEqual(e){return!(!(e instanceof Ai)||!this._def.keyType.isEqual(e._def.keyType)||!this._def.valueType.isEqual(e._def.valueType))}};m(gg,"ZodRecordImpl");var jc=gg,mg=class yg extends pe{dereference(e){let n=e[this._def.uri];return n||this}getReferences(){return[this._def.uri]}_parse(e){let n=this._getOrReturnCtx(e);return ee(n,{code:"unresolved_reference"}),{status:"aborted"}}isOptional(){return!1}isNullable(){return!1}isEqual(e){return e instanceof yg?this._def.uri===e._def.uri:!1}};m(mg,"ZodRefImpl");var Wx=mg,hg=class nr extends pe{dereference(e){return new nr(M(w({},this._def),{valueType:this._def.valueType.dereference(e)}))}getReferences(){return this._def.valueType.getReferences()}clone(){return new nr(M(w({},this._def),{valueType:this._def.valueType.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!=="set")return ee(r,{code:"invalid_type",expected:"set",received:r.parsedType}),{status:"aborted"};let i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(ee(r,{code:"too_small",minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(ee(r,{code:"too_big",maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());let s=this._def.valueType;function o(l){let c=new Set;for(let f of l){if(f.status==="aborted")return{status:"aborted"};f.status==="dirty"&&n.dirty(),c.add(f.value)}return{status:n.value,value:c}}m(o,"finalizeSet");let a=[...r.data.values()].map((l,c)=>s._parse(new Zt(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(e,n){return new nr(M(w({},this._def),{minSize:{value:e,message:ae.toString(n)}}))}max(e,n){return new nr(M(w({},this._def),{maxSize:{value:e,message:ae.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,i,s;if(!(e instanceof nr))return!1;let o=(n=this._def.minSize)==null?void 0:n.value,a=(r=e._def.minSize)==null?void 0:r.value;if(o!==a)return!1;let l=(i=this._def.maxSize)==null?void 0:i.value,c=(s=e._def.maxSize)==null?void 0:s.value;return l!==c?!1:this._def.valueType.isEqual(e._def.valueType)}};m(hg,"ZodSetImpl");var Kx=hg,Fx=/^c[^\s-]{8,}$/i,zx=/^[a-z][a-z0-9]*$/,qx=/^[0-9A-HJKMNP-TV-Z]{26}$/,Gx=/^[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,Vx=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Jx="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ko,Yx=/^(((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}))$/,Xx=/^(([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 Tg(t,e){return!!((e==="v4"||!e)&&Yx.test(t)||(e==="v6"||!e)&&Xx.test(t))}m(Tg,"isValidIP");var vg=class rr extends pe{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!=="string"){let s=this._getOrReturnCtx(e);return ee(s,{code:"invalid_type",expected:"string",received:s.parsedType}),{status:"aborted"}}let r=new bt,i;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),ee(i,{code:"too_small",minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(i=this._getOrReturnCtx(e,i),ee(i,{code:"too_big",maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){let o=e.data.length>s.value,a=e.data.length<s.value;(o||a)&&(i=this._getOrReturnCtx(e,i),o?ee(i,{code:"too_big",maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&ee(i,{code:"too_small",minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")Vx.test(e.data)||(i=this._getOrReturnCtx(e,i),ee(i,{validation:"email",code:"invalid_string",message:s.message}),r.dirty());else if(s.kind==="emoji")Ko||(Ko=new RegExp(Jx,"u")),Ko.test(e.data)||(i=this._getOrReturnCtx(e,i),ee(i,{validation:"emoji",code:"invalid_string",message:s.message}),r.dirty());else if(s.kind==="uuid")Gx.test(e.data)||(i=this._getOrReturnCtx(e,i),ee(i,{validation:"uuid",code:"invalid_string",message:s.message}),r.dirty());else if(s.kind==="cuid")Fx.test(e.data)||(i=this._getOrReturnCtx(e,i),ee(i,{validation:"cuid",code:"invalid_string",message:s.message}),r.dirty());else if(s.kind==="cuid2")zx.test(e.data)||(i=this._getOrReturnCtx(e,i),ee(i,{validation:"cuid2",code:"invalid_string",message:s.message}),r.dirty());else if(s.kind==="ulid")qx.test(e.data)||(i=this._getOrReturnCtx(e,i),ee(i,{validation:"ulid",code:"invalid_string",message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),ee(i,{validation:"url",code:"invalid_string",message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),ee(i,{validation:"regex",code:"invalid_string",message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(e,i),ee(i,{code:"invalid_string",validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(i=this._getOrReturnCtx(e,i),ee(i,{code:"invalid_string",validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(i=this._getOrReturnCtx(e,i),ee(i,{code:"invalid_string",validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?_p.generateDatetimeRegex(s).test(e.data)||(i=this._getOrReturnCtx(e,i),ee(i,{code:"invalid_string",validation:"datetime",message:s.message}),r.dirty()):s.kind==="ip"?Tg(e.data,s.version)||(i=this._getOrReturnCtx(e,i),ee(i,{validation:"ip",code:"invalid_string",message:s.message}),r.dirty()):Ot.assertNever(s);return{status:r.value,value:e.data}}_addCheck(e){return new rr(M(w({},this._def),{checks:[...this._def.checks,e]}))}email(e){return this._addCheck(w({kind:"email"},ae.errToObj(e)))}url(e){return this._addCheck(w({kind:"url"},ae.errToObj(e)))}emoji(e){return this._addCheck(w({kind:"emoji"},ae.errToObj(e)))}uuid(e){return this._addCheck(w({kind:"uuid"},ae.errToObj(e)))}cuid(e){return this._addCheck(w({kind:"cuid"},ae.errToObj(e)))}cuid2(e){return this._addCheck(w({kind:"cuid2"},ae.errToObj(e)))}ulid(e){return this._addCheck(w({kind:"ulid"},ae.errToObj(e)))}ip(e){return this._addCheck(w({kind:"ip"},ae.errToObj(e)))}datetime(e){var n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck(w({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(n=e?.offset)!=null?n:!1},ae.errToObj(e?.message)))}regex(e,n){return this._addCheck(w({kind:"regex",regex:e},ae.errToObj(n)))}includes(e,n){return this._addCheck(w({kind:"includes",value:e,position:n?.position},ae.errToObj(n?.message)))}startsWith(e,n){return this._addCheck(w({kind:"startsWith",value:e},ae.errToObj(n)))}endsWith(e,n){return this._addCheck(w({kind:"endsWith",value:e},ae.errToObj(n)))}min(e,n){return this._addCheck(w({kind:"min",value:e},ae.errToObj(n)))}max(e,n){return this._addCheck(w({kind:"max",value:e},ae.errToObj(n)))}length(e,n){return this._addCheck(w({kind:"length",value:e},ae.errToObj(n)))}nonempty(e){return this.min(1,ae.errToObj(e))}trim(){return new rr(M(w({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}secret(){return this._def[Ae]=M(w({},this._def[Ae]),{secret:!0}),this}toLowerCase(){return new rr(M(w({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new rr(M(w({},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 rr))return!1;let n=new Ye.CustomSet(this._def.checks),r=new Ye.CustomSet(e._def.checks);return n.isEqual(r)}};m(vg,"ZodStringImpl");var Qx=vg,_g=class bg extends pe{_parse(e){if(this._getType(e)!=="symbol"){let r=this._getOrReturnCtx(e);return ee(r,{code:"invalid_type",expected:"symbol",received:r.parsedType}),{status:"aborted"}}return{status:"valid",value:e.data}}isEqual(e){return e instanceof bg}};m(_g,"ZodSymbolImpl");var eP=_g,wg=class Or extends pe{innerType(){return this._def.schema}sourceType(){return Ee.zuiEffects(this._def.schema)?this._def.schema.sourceType():this._def.schema}dereference(e){return new Or(M(w({},this._def),{schema:this._def.schema.dereference(e)}))}getReferences(){return this._def.schema.getReferences()}clone(){return new Or(M(w({},this._def),{schema:this._def.schema.clone()}))}_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.effect;if(r.type==="upstream"){let i=r.effect(n.data,{path:n.path});if(n.common.async)return Promise.resolve(i).then(async s=>{if(s??(s={status:"valid",value:n.data}),this._processResult(n,s),s.status==="aborted")return{status:"aborted"};let o=await this._def.schema._parseAsync({data:s.value,path:n.path,parent:n});return o.status==="aborted"?{status:"aborted"}:o.status==="dirty"?{status:"dirty",value:o.value}:s.status==="dirty"?{status:"dirty",value:o.value}:o});{if(i instanceof Promise)throw new Error("Asynchronous upstream transform encountered during synchronous parse operation. Use .parseAsync instead.");if(i??(i={status:"valid",value:n.data}),this._processResult(n,i),i.status==="aborted")return{status:"aborted"};let s=this._def.schema._parseSync({data:i.value,path:n.path,parent:n});return s.status==="aborted"?{status:"aborted"}:s.status==="dirty"?{status:"dirty",value:s.value}:i.status==="dirty"?{status:"dirty",value:s.value}:s}}if(r.type==="downstream")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(i.status==="aborted"||i.status==="dirty"&&r.failFast)return i;let s=r.effect(i.value,{path:n.path});if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return s??(s={status:"valid",value:i.value}),this._processResult(n,s),s.status==="aborted"?{status:"aborted"}:s.status==="dirty"?{status:"dirty",value:s.value}:i.status==="dirty"?{status:"dirty",value:s.value}:s}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>i.status==="aborted"||i.status==="dirty"&&r.failFast?i:Promise.resolve(r.effect(i.value,{path:n.path})).then(s=>(s??(s={status:"valid",value:i.value}),this._processResult(n,s),s.status==="aborted"?{status:"aborted"}:s.status==="dirty"?{status:"dirty",value:s.value}:i.status==="dirty"?{status:"dirty",value:s.value}:s)));Ot.assertNever(r)}_processResult(e,n){if(n.status!=="valid")for(let r of n.issues)ee(e,r)}isEqual(e){return!(e instanceof Or)||!this._def.schema.isEqual(e._def.schema)?!1:this._def.effect.type==="upstream"?e._def.effect.type!=="upstream"?!1:Ct.compareFunctions(this._def.effect.effect,e._def.effect.effect):this._def.effect.type==="downstream"?e._def.effect.type!=="downstream"||this._def.effect.failFast!==e._def.effect.failFast?!1:Ct.compareFunctions(this._def.effect.effect,e._def.effect.effect):(this._def.effect,!1)}naked(){return this._def.schema.naked()}mandatory(){return new Or(M(w({},this._def),{schema:this._def.schema.mandatory()}))}};m(wg,"ZodEffectsImpl");var _s=wg,xg=class Rr extends pe{dereference(e){let n=this._def.items.map(i=>i.dereference(e)),r=this._def.rest?this._def.rest.dereference(e):null;return new Rr(M(w({},this._def),{items:n,rest:r}))}getReferences(){return Lt.unique([...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 Rr(M(w({},this._def),{items:e,rest:n}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!=="array")return ee(r,{code:"invalid_type",expected:"array",received:r.parsedType}),{status:"aborted"};if(r.data.length<this._def.items.length)return ee(r,{code:"too_small",minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),{status:"aborted"};!this._def.rest&&r.data.length>this._def.items.length&&(ee(r,{code:"too_big",maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let s=[...r.data].map((o,a)=>{let l=this._def.items[a]||this._def.rest;return l?l._parse(new Zt(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(s).then(o=>bt.mergeArray(n,o)):bt.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new Rr(M(w({},this._def),{rest:e}))}isEqual(e){if(!(e instanceof Rr)||!this._restEquals(e))return!1;let n=m((s,o)=>s.isEqual(o),"compare"),r=new Ye.CustomSet(this._def.items,{compare:n}),i=new Ye.CustomSet(e._def.items,{compare:n});return r.isEqual(i)}_restEquals(e){return this._def.rest===null?e._def.rest===null:e._def.rest!==null&&this._def.rest.isEqual(e._def.rest)}};m(xg,"ZodTupleImpl");var tP=xg,Pg=class Ig extends pe{_parse(e){if(this._getType(e)!=="undefined"){let r=this._getOrReturnCtx(e);return ee(r,{code:"invalid_type",expected:"undefined",received:r.parsedType}),{status:"aborted"}}return{status:"valid",value:e.data}}isEqual(e){return e instanceof Ig}mandatory(){return De.never(w({},this._def))}};m(Pg,"ZodUndefinedImpl");var nP=Pg,Bg=class Mr extends pe{dereference(e){let n=this._def.options.map(r=>r.dereference(e));return new Mr(M(w({},this._def),{options:n}))}getReferences(){return Lt.unique(this._def.options.reduce((e,n)=>[...e,...n.getReferences()],[]))}clone(){let e=this._def.options.map(n=>n.clone());return new Mr(M(w({},this._def),{options:e}))}_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function i(s){for(let a of s)if(a.result.status==="valid")return a.result;for(let a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;let o=s.map(a=>new Xt(a.ctx.common.issues));return ee(n,{code:"invalid_union",unionErrors:o}),{status:"aborted"}}if(m(i,"handleResults"),n.common.async)return Promise.all(r.map(async s=>{let o=M(w({},n),{common:M(w({},n.common),{issues:[]}),parent:null});return{result:await s._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(i);{let s,o=[];for(let l of r){let c=M(w({},n),{common:M(w({},n.common),{issues:[]}),parent:null}),f=l._parseSync({data:n.data,path:n.path,parent:c});if(f.status==="valid")return f;f.status==="dirty"&&!s&&(s={result:f,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;let a=o.map(l=>new Xt(l));return ee(n,{code:"invalid_union",unionErrors:a}),{status:"aborted"}}}get options(){return this._def.options}isEqual(e){if(!(e instanceof Mr))return!1;let n=m((s,o)=>s.isEqual(o),"compare"),r=new Ye.CustomSet([...this._def.options],{compare:n}),i=new Ye.CustomSet([...e._def.options],{compare:n});return r.isEqual(i)}mandatory(){let e=this._def.options.filter(s=>!Ee.zuiUndefined(s)).map(s=>s.mandatory()),[n,r,...i]=e;return n?r?new Mr(M(w({},this._def),{options:[n,r,...i]})):n:De.never(w({},this._def))}};m(Bg,"ZodUnionImpl");var rP=Bg,Eg=class Sg extends pe{constructor(){super(...arguments),this._unknown=!0}_parse(e){return{status:"valid",value:e.data}}isEqual(e){return e instanceof Sg}};m(Eg,"ZodUnknownImpl");var iP=Eg,kg=class Ag extends pe{_parse(e){if(this._getType(e)!=="undefined"){let r=this._getOrReturnCtx(e);return ee(r,{code:"invalid_type",expected:"void",received:r.parsedType}),{status:"aborted"}}return{status:"valid",value:e.data}}isEqual(e){return e instanceof Ag}};m(kg,"ZodVoidImpl");var oP=kg,sP=m(t=>t instanceof Error,"_isError"),aP=m(t=>typeof t=="object"&&t!==null,"_isObject"),Ee={zuiError:t=>t instanceof Xt||sP(t)&&"__type__"in t&&t.__type__==="ZuiError",zuiType:t=>t instanceof pe||aP(t)&&"__type__"in t&&t.__type__==="ZuiType",zuiAny:t=>t.typeName==="ZodAny",zuiArray:t=>t.typeName==="ZodArray",zuiBigInt:t=>t.typeName==="ZodBigInt",zuiBoolean:t=>t.typeName==="ZodBoolean",zuiBranded:t=>t.typeName==="ZodBranded",zuiCatch:t=>t.typeName==="ZodCatch",zuiDate:t=>t.typeName==="ZodDate",zuiDefault:t=>t.typeName==="ZodDefault",zuiDiscriminatedUnion:t=>t.typeName==="ZodDiscriminatedUnion",zuiEnum:t=>t.typeName==="ZodEnum",zuiFunction:t=>t.typeName==="ZodFunction",zuiIntersection:t=>t.typeName==="ZodIntersection",zuiLazy:t=>t.typeName==="ZodLazy",zuiLiteral:t=>t.typeName==="ZodLiteral",zuiMap:t=>t.typeName==="ZodMap",zuiNaN:t=>t.typeName==="ZodNaN",zuiNativeEnum:t=>t.typeName==="ZodNativeEnum",zuiNever:t=>t.typeName==="ZodNever",zuiNull:t=>t.typeName==="ZodNull",zuiNullable:t=>t.typeName==="ZodNullable",zuiNumber:t=>t.typeName==="ZodNumber",zuiObject:t=>t.typeName==="ZodObject",zuiOptional:t=>t.typeName==="ZodOptional",zuiPipeline:t=>t.typeName==="ZodPipeline",zuiPromise:t=>t.typeName==="ZodPromise",zuiReadonly:t=>t.typeName==="ZodReadonly",zuiRecord:t=>t.typeName==="ZodRecord",zuiRef:t=>t.typeName==="ZodRef",zuiSet:t=>t.typeName==="ZodSet",zuiString:t=>t.typeName==="ZodString",zuiSymbol:t=>t.typeName==="ZodSymbol",zuiEffects:t=>t.typeName==="ZodEffects",zuiTuple:t=>t.typeName==="ZodTuple",zuiUndefined:t=>t.typeName==="ZodUndefined",zuiUnion:t=>t.typeName==="ZodUnion",zuiUnknown:t=>t.typeName==="ZodUnknown",zuiVoid:t=>t.typeName==="ZodVoid"},ye=m(t=>{if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:i,supportsExtensions:s,[Ae]:o}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);let a=o?Object.fromEntries(Object.entries(o).filter(([c])=>c!=="secret"||s?.includes("secret"))):void 0;return e?{errorMap:e,description:i,[Ae]:a}:{errorMap:m((c,f)=>c.code!=="invalid_type"?{message:f.defaultError}:typeof f.data>"u"?{message:r??f.defaultError}:{message:n??f.defaultError},"customMap"),description:i,[Ae]:a}},"_processCreateParams"),zi=m((t,e={},n)=>t?Nn().downstream(r=>{var i,s;if(!t(r)){let o=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e;return((s=(i=o.fatal)!=null?i:n)!=null?s:!0)?Zs(w({code:"custom"},o)):Ls(r,w({code:"custom"},o))}}):Nn(),"customType"),bs=m((t,e={message:`Input not instance of ${t.name}`})=>zi(n=>n instanceof t,e),"instanceOfType"),Nn=m(t=>new Tx(w({typeName:"ZodAny"},ye(t))),"anyType"),hn=m(t=>new iP(w({typeName:"ZodUnknown"},ye(t))),"unknownType"),Wr=m(t=>new Nx(w({typeName:"ZodNever"},ye(t))),"neverType"),ws=m(t=>new oP(w({typeName:"ZodVoid"},ye(t))),"voidType"),Jr=m(t=>new Dx(w({typeName:"ZodNull"},ye(t))),"nullType"),qi=m(t=>new nP(w({typeName:"ZodUndefined"},ye(t))),"undefinedType"),xs=m(t=>new eP(w({typeName:"ZodSymbol"},ye(t))),"symbolType"),Ps=m(t=>new Rx(w({typeName:"ZodNaN"},ye(t))),"nanType"),en=m(t=>{var e;return new Qx(w({checks:[],typeName:"ZodString",coerce:(e=t?.coerce)!=null?e:!1},ye(M(w({},t),{supportsExtensions:["secret"]}))))},"stringType"),Wn=m(t=>new Ux(w({checks:[],typeName:"ZodNumber",coerce:t?.coerce||!1},ye(t))),"numberType"),Kn=m(t=>new bx(w({typeName:"ZodBoolean",coerce:t?.coerce||!1},ye(t))),"booleanType"),Gi=m(t=>{var e;return new _x(w({checks:[],typeName:"ZodBigInt",coerce:(e=t?.coerce)!=null?e:!1},ye(t)))},"bigIntType"),Vi=m(t=>new Px(w({checks:[],coerce:t?.coerce||!1,typeName:"ZodDate"},ye(t))),"dateType"),Ji=m(t=>new Wx({typeName:"ZodRef",uri:t}),"refType"),Kr=m((t,e)=>new Cx(w({value:t,typeName:"ZodLiteral"},ye(e))),"literalType"),Yi=m((t,e)=>new Ex(w({values:t,typeName:"ZodEnum"},ye(e))),"enumType"),Is=m((t,e)=>new Mx(w({values:t,typeName:"ZodNativeEnum"},ye(e))),"nativeEnumType"),On=m((t,e)=>new vx(w({type:t,minLength:null,maxLength:null,exactLength:null,typeName:"ZodArray"},ye(e))),"arrayType"),sr=m((t,e)=>new ug(w({shape:()=>t,unknownKeys:"strip",typeName:"ZodObject"},ye(e))),"objectType"),Bs=m((t,e)=>new ug(w({shape:()=>t,unknownKeys:"strict",typeName:"ZodObject"},ye(e))),"strictObjectType"),Rn=m((t,e)=>new rP(w({options:t,typeName:"ZodUnion"},ye(e))),"unionType"),Fr=m((t,e,n)=>new Bx(w({typeName:"ZodDiscriminatedUnion",discriminator:t,options:e},ye(n))),"discriminatedUnionType"),zr=m((t,e,n)=>new kx(w({left:t,right:e,typeName:"ZodIntersection"},ye(n))),"intersectionType"),Yr=m((t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new tP(w({items:t,typeName:"ZodTuple",rest:null},ye(e)))},"tupleType"),qr=m((t,e,n)=>e instanceof pe?new jc(w({keyType:t,valueType:e,typeName:"ZodRecord"},ye(n))):new jc(w({keyType:en(),valueType:t,typeName:"ZodRecord"},ye(e))),"recordType"),Es=m((t,e,n)=>new Ox(w({valueType:e,keyType:t,typeName:"ZodMap"},ye(n))),"mapType"),Xi=m((t,e)=>new Kx(w({valueType:t,minSize:null,maxSize:null,typeName:"ZodSet"},ye(e))),"setType"),Ss=m((t,e)=>new Ax(w({getter:t,typeName:"ZodLazy"},ye(e))),"lazyType"),ks=m((t,e)=>new Zx(w({type:t,typeName:"ZodPromise"},ye(e))),"promiseType"),As=m((t,e,n)=>new Sx(w({args:t||Yr([]).rest(hn()),returns:e||hn(),typeName:"ZodFunction"},ye(n))),"functionType"),Cs=m((t,e,n)=>new _s(w({schema:e,effect:{type:"upstream",effect:(r,i)=>{let s=t(r,i);return s instanceof Promise?s.then(o=>Hi(o)):Hi(s)}},typeName:"ZodEffects"},ye(n))),"preprocessType"),Os=m((t,e,n)=>new _s(w({schema:e,effect:{type:"upstream",effect:t},typeName:"ZodEffects"},ye(n))),"upstreamType"),Rs=m((t,e,n)=>new _s(w({schema:t,effect:{type:"downstream",effect:e,failFast:n?.failFast},typeName:"ZodEffects"},ye(n))),"downstreamType"),Ms=m((t,e)=>new jx(w({innerType:t,typeName:"ZodOptional"},ye(e))),"optionalType"),Ns=m((t,e)=>new Hx(w({innerType:t,typeName:"ZodNullable"},ye(e))),"nullableType"),Ds=m((t,e)=>new Lx(w({innerType:t,typeName:"ZodReadonly"},ye(e))),"readonlyType"),Hs=m((t,e,n)=>new Ix(w({innerType:t,typeName:"ZodDefault",defaultValue:typeof e=="function"?e:()=>e},ye(n))),"defaultType"),Us=m((t,e,n)=>new xx(w({innerType:t,typeName:"ZodCatch",catchValue:typeof e=="function"?e:()=>e},ye(n))),"catchType"),js=m((t,e)=>new $x({in:t,out:e,typeName:"ZodPipeline"}),"pipelineType"),$s=m(t=>new wx(w({typeName:"ZodBranded",type:t},ye({supportsExtensions:["secret"]}))),"brandedType");Ep({any:Nn,array:On,bigint:Gi,boolean:Kn,branded:$s,catch:Us,custom:zi,date:Vi,default:Hs,discriminatedUnion:Fr,enum:Yi,function:As,instanceof:bs,intersection:zr,lazy:Ss,literal:Kr,map:Es,nan:Ps,nativeEnum:Is,never:Wr,null:Jr,nullable:Ns,number:Wn,object:sr,optional:Ms,pipeline:js,preprocess:Cs,upstream:Os,downstream:Rs,promise:ks,record:qr,ref:Ji,readonly:Ds,set:Xi,strictObject:Bs,string:en,symbol:xs,tuple:Yr,undefined:qi,union:Rn,unknown:hn,void:ws});var Cg={string(t){return en(M(w({},t),{coerce:!0}))},number(t){return Wn(M(w({},t),{coerce:!0}))},boolean(t){return Kn(M(w({},t),{coerce:!0}))},bigint(t){return Gi(M(w({},t),{coerce:!0}))},date(t){return Vi(M(w({},t),{coerce:!0}))}},Hi=m(t=>({status:"valid",value:t}),"OK"),Zs=m((t,...e)=>({status:"aborted",issues:[t,...e]}),"ERR"),Ls=m((t,e,...n)=>({status:"dirty",value:t,issues:[e,...n]}),"DIRTY"),Og={};Rt(Og,{JSONSchemaToZuiError:()=>Qi,ObjectToZuiError:()=>ss,UnrepresentableGenericError:()=>as,UnsupportedJSONSchemaToZuiError:()=>kn,UnsupportedZuiCheckToJSONSchemaError:()=>$g,UnsupportedZuiToJSONSchemaError:()=>dt,UnsupportedZuiToTypescriptSchemaError:()=>An,UnsupportedZuiToTypescriptTypeError:()=>zg,UntitledDeclarationError:()=>Gg,ZuiToJSONSchemaError:()=>eo,ZuiToTypescriptSchemaError:()=>Lg,ZuiToTypescriptTypeError:()=>to,ZuiTransformError:()=>ar});var Rg=class extends Error{constructor(e,n,r){let i=r?`${r} : ${n}`:n;super(i),this.transform=e,this.path=r}};m(Rg,"ZuiTransformError");var ar=Rg,Mg=class extends ar{constructor(e,n){super("json-schema-to-zui",e,n)}};m(Mg,"JSONSchemaToZuiError");var Qi=Mg,Ng=class extends Qi{constructor(e,n){super(`JSON Schema ${JSON.stringify(e)} cannot be transformed to ZUI type.`,n)}};m(Ng,"UnsupportedJSONSchemaToZuiError");var kn=Ng,Dg=class extends ar{constructor(e,n){super("object-to-zui",e,n)}};m(Dg,"ObjectToZuiError");var ss=Dg,Hg=class extends ar{constructor(e,n){super("zui-to-json-schema",e,n)}};m(Hg,"ZuiToJSONSchemaError");var eo=Hg,Ug=class extends eo{constructor(e,n,{suggestedAlternative:r}={}){let i=r?`Zod type ${e} cannot be transformed to JSON Schema. Suggested alternative: ${r}`:`Zod type ${e} cannot be transformed to JSON Schema.`;super(i,n)}};m(Ug,"UnsupportedZuiToJSONSchemaError");var dt=Ug,jg=class extends eo{constructor(e,n,r){super(`Zod check .${n}() of type ${e} cannot be transformed to JSON Schema.`,r)}};m(jg,"UnsupportedZuiCheckToJSONSchemaError");var $g=jg,Zg=class extends ar{constructor(e,n){super("zui-to-typescript-schema",e,n)}};m(Zg,"ZuiToTypescriptSchemaError");var Lg=Zg,Wg=class extends Lg{constructor(e,n){super(`Zod type ${e} cannot be transformed to TypeScript schema.`,n)}};m(Wg,"UnsupportedZuiToTypescriptSchemaError");var An=Wg,Kg=class extends ar{constructor(e,n){super("zui-to-typescript-type",e,n)}};m(Kg,"ZuiToTypescriptTypeError");var to=Kg,Fg=class extends to{constructor(e,n){super(`Zod type ${e} cannot be transformed to TypeScript type.`,n)}};m(Fg,"UnsupportedZuiToTypescriptTypeError");var zg=Fg,qg=class extends to{constructor(){super("Schema must have a title to be transformed to a TypeScript type with a declaration.")}};m(qg,"UntitledDeclarationError");var Gg=qg,Vg=class extends to{constructor(){super('ZodRef can only be transformed to a TypeScript type with a "type" declaration.')}};m(Vg,"UnrepresentableGenericError");var as=Vg,lP=m(t=>{let e;try{e=new Function("z",`return ${t}`)(tn)}catch(n){return{sucess:!1,error:`Failed to evaluate schema: ${(n instanceof Error?n:new Error(String(n))).message}`}}return Ee.zuiType(e)?{sucess:!0,value:e}:{sucess:!1,error:`String "${t}" does not evaluate to a Zod schema`}},"evalZuiString"),fe={ZodString:"ZodString",ZodNumber:"ZodNumber",ZodNaN:"ZodNaN",ZodBigInt:"ZodBigInt",ZodBoolean:"ZodBoolean",ZodDate:"ZodDate",ZodSymbol:"ZodSymbol",ZodUndefined:"ZodUndefined",ZodNull:"ZodNull",ZodAny:"ZodAny",ZodUnknown:"ZodUnknown",ZodNever:"ZodNever",ZodVoid:"ZodVoid",ZodArray:"ZodArray",ZodObject:"ZodObject",ZodUnion:"ZodUnion",ZodDiscriminatedUnion:"ZodDiscriminatedUnion",ZodIntersection:"ZodIntersection",ZodTuple:"ZodTuple",ZodRecord:"ZodRecord",ZodRef:"ZodRef",ZodMap:"ZodMap",ZodSet:"ZodSet",ZodFunction:"ZodFunction",ZodLazy:"ZodLazy",ZodLiteral:"ZodLiteral",ZodEnum:"ZodEnum",ZodEffects:"ZodEffects",ZodNativeEnum:"ZodNativeEnum",ZodOptional:"ZodOptional",ZodNullable:"ZodNullable",ZodDefault:"ZodDefault",ZodCatch:"ZodCatch",ZodPromise:"ZodPromise",ZodBranded:"ZodBranded",ZodPipeline:"ZodPipeline",ZodReadonly:"ZodReadonly"},uP=m(t=>[t.slice(0,t.length/2),t.slice(t.length/2)],"half"),cP=m((t,...e)=>Object.keys(t).reduce((n,r)=>(e.includes(r)||(n[r]=t[r]),n),{}),"omit");function at(t,e,n){var r;let i=t[e],s="";if(i!==void 0){let o=n({value:i,json:JSON.stringify(i)});if(o){let a=o[0],l=o.length===3?o[1]:"",c=o.length===3?o[2]:o[1];s+=a,((r=t.errorMessage)==null?void 0:r[e])!==void 0&&(s+=l+JSON.stringify(t.errorMessage[e])),s+=c}}return s}m(at,"withMessage");var Nr=Symbol("Original index"),dP=m(t=>{let e=[];for(let n=0;n<t.length;n++){let r=t[n];if(typeof r=="boolean")e.push(r?{[Nr]:n}:{[Nr]:n,not:{}});else{if(Nr in r)return t;e.push(M(w({},r),{[Nr]:n}))}}return e},"ensureOriginalIndex");function Gr(t,e){if(t.allOf.length===0)return"z.never()";if(t.allOf.length===1){let n=t.allOf[0];return nt(n,M(w({},e),{path:[...e.path,"allOf",n[Nr]]}))}else{let[n,r]=uP(dP(t.allOf));return`z.intersection(${Gr({allOf:n},e)}, ${Gr({allOf:r},e)})`}}m(Gr,"parseAllOf");var Jg=m((t,e)=>t.anyOf.length?t.anyOf.length===1?nt(t.anyOf[0],M(w({},e),{path:[...e.path,"anyOf",0]})):`z.union([${t.anyOf.map((n,r)=>nt(n,M(w({},e),{path:[...e.path,"anyOf",r]}))).join(", ")}])`:"z.any()","parseAnyOf"),fP=m((t,e)=>{if(Array.isArray(t.items))return`z.tuple([${t.items.map((r,i)=>nt(r,M(w({},e),{path:[...e.path,"items",i]})))}])`;let n=t.items?`z.array(${nt(t.items,M(w({},e),{path:[...e.path,"items"]}))})`:"z.array(z.any())";return n+=at(t,"minItems",({json:r})=>[`.min(${r}`,", ",")"]),n+=at(t,"maxItems",({json:r})=>[`.max(${r}`,", ",")"]),n},"parseArray"),pP=m(t=>{var e;return(e=t[Ae])!=null&&e.coerce?"z.coerce.boolean()":"z.boolean()"},"parseBoolean"),gP=m(t=>`z.literal(${JSON.stringify(t.const)})`,"parseConst"),mP=m(t=>"z.any()","parseDefault"),Ws=m((t,e)=>t.oneOf.length?t.oneOf.length===1?nt(t.oneOf[0],M(w({},e),{path:[...e.path,"oneOf",0]})):`z.any().superRefine((x, ctx) => {
|
|
14
14
|
const schemas = [${t.oneOf.map((n,r)=>nt(n,M(w({},e),{path:[...e.path,"oneOf",r]}))).join(", ")}];
|
|
15
15
|
const errors = schemas.reduce(
|
|
16
16
|
(errors: z.ZodError[], schema) =>
|
|
@@ -27,14 +27,14 @@ var Mo=Object.defineProperty;var VT=Object.getOwnPropertyDescriptor;var JT=Objec
|
|
|
27
27
|
message: "Invalid input: Should pass single schema",
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
-
})`:"z.any()","parseOneOf"),
|
|
30
|
+
})`:"z.any()","parseOneOf"),yP=m((t,e)=>{var n,r;if(t.oneOf.length<=1||!((n=t.discriminator)!=null&&n.propertyName))return Ws(t,e);let i=t.oneOf.map((s,o)=>nt(s,M(w({},e),{path:[...e.path,"oneOf",o]})));return`z.discriminatedUnion("${(r=t.discriminator)==null?void 0:r.propertyName}", [${i.join(", ")}])`},"parseDiscriminator"),hP=m(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"),TP=m((t,e)=>{let n=nt(t.if,M(w({},e),{path:[...e.path,"if"]})),r=nt(t.then,M(w({},e),{path:[...e.path,"then"]})),i=nt(t.else,M(w({},e),{path:[...e.path,"else"]}));return`z.union([${r}, ${i}]).superRefine((value,ctx) => {
|
|
31
31
|
const result = ${n}.safeParse(value).success
|
|
32
32
|
? ${r}.safeParse(value)
|
|
33
33
|
: ${i}.safeParse(value);
|
|
34
34
|
if (!result.success) {
|
|
35
35
|
result.error.errors.forEach((error) => ctx.addIssue(error))
|
|
36
36
|
}
|
|
37
|
-
})`},"parseIfThenElse"),
|
|
37
|
+
})`},"parseIfThenElse"),vP=m((t,e)=>`z.union([${t.type.map(n=>nt(M(w({},t),{type:n}),e)).join(", ")}])`,"parseMultipleType"),_P=m((t,e)=>`z.any().refine((value) => !${nt(t.not,M(w({},e),{path:[...e.path,"not"]}))}.safeParse(value).success, "Invalid input: Should NOT be valid against schema")`,"parseNot"),bP=m(t=>"z.null()","parseNull"),wP=m((t,e)=>`${nt(cP(t,"nullable"),e,!0)}.nullable()`,"parseNullable"),xP=m(t=>{var e;let n="z.number()";return(e=t[Ae])!=null&&e.coerce&&(n="z.coerce.number()"),t.type==="integer"?n+=at(t,"type",()=>[".int(",")"]):n+=at(t,"format",({value:r})=>{if(r==="int64")return[".int(",")"]}),n+=at(t,"multipleOf",({value:r,json:i})=>r===1?n.startsWith("z.number().int(")?void 0:[".int(",")"]:[`.multipleOf(${i}`,", ",")"]),typeof t.minimum=="number"?t.exclusiveMinimum===!0?n+=at(t,"minimum",({json:r})=>[`.gt(${r}`,", ",")"]):n+=at(t,"minimum",({json:r})=>[`.gte(${r}`,", ",")"]):typeof t.exclusiveMinimum=="number"&&(n+=at(t,"exclusiveMinimum",({json:r})=>[`.gt(${r}`,", ",")"])),typeof t.maximum=="number"?t.exclusiveMaximum===!0?n+=at(t,"maximum",({json:r})=>[`.lt(${r}`,", ",")"]):n+=at(t,"maximum",({json:r})=>[`.lte(${r}`,", ",")"]):typeof t.exclusiveMaximum=="number"&&(n+=at(t,"exclusiveMaximum",({json:r})=>[`.lt(${r}`,", ",")"])),n},"parseNumber");function Yg(t,e){let n;t.properties&&(Object.keys(t.properties).length?(n="z.object({ ",n+=Object.keys(t.properties).map(o=>{let a=t.properties[o],l=`${JSON.stringify(o)}: ${nt(a,M(w({},e),{path:[...e.path,"properties",o]}))}`,c=typeof a=="object"&&a.default!==void 0||typeof t.default=="object"&&t.default!==null&&o in t.default,f=Array.isArray(t.required)?t.required.includes(o):typeof a=="object"&&a.required===!0;return!c&&!f?`${l}.optional()`:l}).join(", "),n+=" })"):n="z.object({})");let r=t.additionalProperties!==void 0?nt(t.additionalProperties,M(w({},e),{path:[...e.path,"additionalProperties"]})):void 0,i;if(t.patternProperties){let o=Object.fromEntries(Object.entries(t.patternProperties).map(([a,l])=>[a,nt(l,M(w({},e),{path:[...e.path,"patternProperties",a]}))],{}));i="",n?r?i+=`.catchall(z.union([${[...Object.values(o),r].join(", ")}]))`:Object.keys(o).length>1?i+=`.catchall(z.union([${Object.values(o).join(", ")}]))`:i+=`.catchall(${Object.values(o)})`:r?i+=`z.record(z.union([${[...Object.values(o),r].join(", ")}]))`:Object.keys(o).length>1?i+=`z.record(z.union([${Object.values(o).join(", ")}]))`:i+=`z.record(${Object.values(o)})`,i+=`.superRefine((value, ctx) => {
|
|
38
38
|
`,i+=`for (const key in value) {
|
|
39
39
|
`,r&&(t.properties?i+=`let evaluated = [${Object.keys(t.properties).map(a=>JSON.stringify(a)).join(", ")}].includes(key)
|
|
40
40
|
`:i+=`let evaluated = false
|
|
@@ -66,22 +66,22 @@ var Mo=Object.defineProperty;var VT=Object.getOwnPropertyDescriptor;var JT=Objec
|
|
|
66
66
|
`,i+=`}
|
|
67
67
|
`,i+=`}
|
|
68
68
|
`),i+=`}
|
|
69
|
-
`,i+="})"}let s=n?i?n+i:r?r==="z.never()"?n+".strict()":n+`.catchall(${r})`:n:i||(r?`z.record(${r})`:"z.record(z.any())");return Ve.an.anyOf(t)&&(s+=`.and(${Gg(M(w({},t),{anyOf:t.anyOf.map(o=>typeof o=="object"&&!o.type&&(o.properties||o.additionalProperties||o.patternProperties)?M(w({},o),{type:"object"}):o)}),e)})`),Ve.a.oneOf(t)&&(s+=`.and(${Zs(M(w({},t),{oneOf:t.oneOf.map(o=>typeof o=="object"&&!o.type&&(o.properties||o.additionalProperties||o.patternProperties)?M(w({},o),{type:"object"}):o)}),e)})`),Ve.an.allOf(t)&&(s+=`.and(${Gr(M(w({},t),{allOf:t.allOf.map(o=>typeof o=="object"&&!o.type&&(o.properties||o.additionalProperties||o.patternProperties)?M(w({},o),{type:"object"}):o)}),e)})`),s}m(Vg,"parseObject");var wP=m(t=>`z.ref('${t.$ref}')`,"parseRef"),xP=m(t=>{var e;let n="z.string()";if((e=t[Ae])!=null&&e.coerce){if(t.format==="date-time")return"z.coerce.date()";n="z.coerce.string()"}return n+=at(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+=at(t,"pattern",({json:r})=>[`.regex(new RegExp(${r})`,", ",")"]),n+=at(t,"minLength",({json:r})=>[`.min(${r}`,", ",")"]),n+=at(t,"maxLength",({json:r})=>[`.max(${r}`,", ",")"]),n},"parseString"),nt=m((t,e={seen:new Map,path:[]},n)=>{if(typeof t!="object")return t?"z.any()":"z.never()";if(e.parserOverride){let s=e.parserOverride(t,e);if(typeof s=="string")return s}let r=e.seen.get(t);if(r){if(r.r!==void 0)return r.r;if(e.depth===void 0||r.n>=e.depth)return"z.any()";r.n+=1}else r={r:void 0,n:0},e.seen.set(t,r);let i=BP(t,e);return n||(i=PP(t,i),e.withoutDefaults||(i=IP(t,i))),r.r=i,i},"parseSchema"),PP=m((t,e)=>(t.description&&(e+=`.describe(${JSON.stringify(t.description)})`),e),"addMeta"),IP=m((t,e)=>(t.default!==void 0&&(e+=`.default(${JSON.stringify(t.default)})`),e),"addDefaults"),BP=m((t,e)=>Ve.a.nullable(t)?_P(t,e):Ve.an.object(t)?Vg(t,e):Ve.an.array(t)?cP(t,e):Ve.an.anyOf(t)?Gg(t,e):Ve.an.allOf(t)?Gr(t,e):Ve.a.discriminator(t)?gP(t,e):Ve.a.oneOf(t)?Zs(t,e):Ve.a.not(t)?TP(t,e):Ve.an.enum(t)?mP(t):Ve.a.const(t)?fP(t):Ve.a.multipleType(t)?hP(t,e):Ve.a.primitive(t,"string")?xP(t):Ve.a.primitive(t,"number")||Ve.a.primitive(t,"integer")?bP(t):Ve.a.primitive(t,"boolean")?dP(t):Ve.a.primitive(t,"null")?vP(t):Ve.a.conditional(t)?yP(t,e):Ve.a.ref(t)?wP(t):pP(t),"selectParser"),Ve={an:{object:t=>t.type==="object",array:t=>t.type==="array",anyOf:t=>t.anyOf!==void 0,allOf:t=>t.allOf!==void 0,enum:t=>t.enum!==void 0},a:{nullable:t=>t.nullable===!0,multipleType:t=>Array.isArray(t.type),not:t=>t.not!==void 0,const:t=>t.const!==void 0,primitive:(t,e)=>t.type===e,conditional:t=>!!("if"in t&&t.if&&"then"in t&&"else"in t&&t.then&&t.else),discriminator:t=>{var e;return t.oneOf!==void 0&&((e=t.discriminator)==null?void 0:e.propertyName)!==void 0},oneOf:t=>t.oneOf!==void 0,ref:t=>t.$ref!==void 0}},SP=m(t=>nt(t,{seen:new Map,path:[]}),"jsonSchemaToZodStr"),EP=m(t=>{let e=SP(t);e=e.replaceAll("errors: z.ZodError[]","errors");let n=sP(e);if(!n.sucess)throw new Qi(n.error);return n.value},"jsonSchemaToZod"),Dr=m((t,e)=>{var n,r;if(e[Ae]&&t._def&&(t.naked()._def[Ae]=e[Ae]),((n=t._def)==null?void 0:n.typeName)==="ZodObject"&&e.type==="object"&&e.properties&&Object.entries(e.properties).forEach(([i,s])=>{let o=typeof t._def.shape=="function"?t._def.shape():t._def.shape;o[i]&&Dr(o[i],s)}),((r=t._def)==null?void 0:r.typeName)==="ZodRecord"&&e.type==="object"&&e.additionalProperties&&Dr(t._def.valueType,e.additionalProperties),e.type==="array"&&e.items){let i=e.items;if(typeof i=="object"&&!Array.isArray(i)){let s=t._def.type;s&&Dr(s,i)}else Array.isArray(i)&&i.forEach((s,o)=>{let a=t._def;a.typeName===fe.ZodTuple&&Dr(a.items[o],s)})}},"applyZuiPropsRecursively"),kP=m(t=>{let e=EP(t);return Dr(e,t),e},"fromJSONSchemaLegacy"),Jg=class Ci{constructor(e=[],n=""){this.type="propertyPath",this._sections=e,this._wrapper=n}withIndexType(e,n){return new Ci([...this._sections,{type:e,value:n}],this._wrapper)}withWrapper(e){return new Ci([new Ci([...this._sections],e)])}toString(){let e=this._wrapper?`${this._wrapper}<`:"",n=this._wrapper?">":"",r=this._sections.length===0||this._sections[0].type!=="propertyPath"?"#":"";return`${e}${r}${this._sections.map(i=>{var s;return i.type==="propertyPath"?i.toString():i.type==="key"?`.${i.value}`:i.type==="any"?"[*]":`[${(s=i.value)!=null?s:i.type}]`}).join("")}${n}`}};m(Jg,"PropertyPath");var Xr=Jg,AP=m(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)==="ZodOptional"},"isOptionalSchema"),CP=m(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)==="ZodNullable"},"isNullableSchema"),Yg=m(t=>{var e,n;return t.not===!0&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)==="ZodUndefined"},"isUndefinedSchema"),OP=m(t=>{var e,n;return!t.not&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)==="ZodUnknown"},"isUnknownSchema"),RP=m(t=>{var e,n;return t.anyOf!==void 0&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)==="ZodDiscriminatedUnion"},"isDiscriminatedUnionSchema"),MP=m(t=>{var e,n;return t.oneOf!==void 0&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)==="ZodDiscriminatedUnion"},"isExclusiveDiscriminatedUnionSchema"),NP=m((t,e,n)=>DP(t)?UP(t,e,n):HP(t)?jP(t,e,n):$P(t,e,n),"arrayJSONSchemaToZuiArray"),DP=m(t=>Array.isArray(t.items),"_isTuple"),HP=m(t=>t.items!==void 0&&t.uniqueItems,"_isSet"),UP=m(({items:t,additionalItems:e},n,r)=>{let i=t.map((o,a)=>n(o,r.withIndexType("number",a))),s=Yr(i);return e!==void 0&&(s=s.rest(n(e,r.withIndexType("number")))),s},"_handleTuple"),jP=m(({items:t,minItems:e,maxItems:n},r,i)=>{let s=Xi(r(t,i.withIndexType("number")));return e&&(s=s.min(e)),n&&(s=s.max(n)),s},"_handleSet"),$P=m(({minItems:t,maxItems:e,items:n},r,i)=>{let s=On(r(n,i.withIndexType("number")));return t&&t===e?s.length(t):(t&&(s=s.min(t)),e&&(s=s.max(e)),s)},"_handleArray"),ZP=m(({type:t,minimum:e,exclusiveMinimum:n,maximum:r,exclusiveMaximum:i,multipleOf:s,format:o})=>{let a=Wn();return t==="integer"&&(a=a.int()),o==="finite"&&(a=a.finite()),n!==void 0?a=a.gt(n):e!==void 0&&(a=a.gte(e)),i!==void 0?a=a.lt(i):r!==void 0&&(a=a.lte(r)),s!==void 0&&(a=a.multipleOf(s)),a},"numberJSONSchemaToZuiNumber"),Ur={};Rt(Ur,{escapeSpecialChars:()=>LP});var LP=m(t=>t.replaceAll(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeSpecialChars");function Ls(t,e,n,r){r?.errorMessages&&n&&(t.errorMessage=M(w({},t.errorMessage),{[e]:n}))}m(Ls,"addErrorMessage");function Ee(t,e,n,r,i){t[e]=n,Ls(t,e,r,i)}m(Ee,"setResponseValueAndErrors");var Je={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 Ws(t,e){let n=w({type:"string"},t.coerce?{[Ae]:{coerce:t.coerce||void 0}}:{});function r(i){return e.patternStrategy==="escape"?Ur.escapeSpecialChars(i):i}if(m(r,"processPattern"),t.checks)for(let i of t.checks)switch(i.kind){case"min":Ee(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,i.value):i.value,i.message,e);break;case"max":Ee(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,i.value):i.value,i.message,e);break;case"email":switch(e.emailStrategy){case"format:email":In(n,"email",i.message,e);break;case"format:idn-email":In(n,"idn-email",i.message,e);break;case"pattern:zod":Jt(n,Je.email,i.message,e);break}break;case"url":In(n,"uri",i.message,e);break;case"uuid":In(n,"uuid",i.message,e);break;case"regex":Jt(n,i.regex.source,i.message,e);break;case"cuid":Jt(n,Je.cuid,i.message,e);break;case"cuid2":Jt(n,Je.cuid2,i.message,e);break;case"startsWith":Jt(n,"^"+r(i.value),i.message,e);break;case"endsWith":Jt(n,r(i.value)+"$",i.message,e);break;case"datetime":In(n,"date-time",i.message,e);break;case"length":Ee(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,i.value):i.value,i.message,e),Ee(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,i.value):i.value,i.message,e);break;case"includes":{Jt(n,r(i.value),i.message,e);break}case"ip":{i.version!=="v6"&&In(n,"ipv4",i.message,e),i.version!=="v4"&&In(n,"ipv6",i.message,e);break}case"emoji":Jt(n,Je.emoji,i.message,e);break;case"ulid":{Jt(n,Je.ulid,i.message,e);break}case"toLowerCase":case"toUpperCase":case"trim":break;default:}return n}m(Ws,"parseStringDef");var In=m((t,e,n,r)=>{var i;t.format||(i=t.anyOf)!=null&&i.some(s=>s.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push(w({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(w({format:e},n&&r.errorMessages&&{errorMessage:{format:n}}))):Ee(t,"format",e,n,r)},"addFormat"),Jt=m((t,e,n,r)=>{var i;t.pattern||(i=t.allOf)!=null&&i.some(s=>s.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push(w({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(w({pattern:e},n&&r.errorMessages&&{errorMessage:{pattern:n}}))):Ee(t,"pattern",e,n,r)},"addPattern"),WP=m(({format:t,pattern:e,minLength:n,maxLength:r})=>{let i=en();if(n&&r&&n===r?i=i.length(n):(n&&(i=i.min(n)),r&&(i=i.max(r))),t==="cuid"||e===Je.cuid)i=i.cuid();else if(t==="cuid2"||e===Je.cuid2)i=i.cuid2();else if(t==="emoji"||e===Je.emoji)i=i.emoji();else if(t==="ulid"||e===Je.ulid)i=i.ulid();else if(t==="date-time"){let{precision:s,offset:o}=e?_p(e):{};i=i.datetime({precision:s,offset:o})}else t==="email"||e===Je.email?i=i.email():t==="ipv4"||e===Je.ipv4?i=i.ip():t==="ipv6"||e===Je.ipv6?i=i.ip("v6"):t==="uri"?i=i.url():t==="uuid"||e===Je.uuid?i=i.uuid():e&&(i=i.regex(new RegExp(e)));return i},"stringJSONSchemaToZuiString"),xr=m((t,e,n)=>{let r=[];e.enum!==void 0&&r.push(...e.enum),e.const!==void 0&&r.push(e.const);let i,s=r.filter(a=>typeof a===t),[o]=s;if(o)if(s.length===1)i=Kr(o);else{let a=s.map(l=>Kr(l));i=Rn(a)}else if(t==="string"&&e.type==="string"&&(i=WP(e)),t==="number"&&(e.type==="number"||e.type==="integer")&&(i=ZP(e)),t==="boolean"&&(i=Kn()),t==="null"&&(i=Jr()),!i)throw new Qi(`Unknown primitive type: "${t}"`,n?.toString());return e.description&&(i=i.describe(e.description)),i},"toZuiPrimitive"),Bn=Nn();function Xg(t){return ze(t,new Xr)}m(Xg,"fromJSONSchema");function ze(t,e){var n,r,i,s,o,a;if(t===void 0)return Bn;if(t===!0)return Nn();if(t===!1)return Wr();if(t.default!==void 0)return ze(M(w({},t),{default:void 0}),e).default(t.default);if(t.readOnly)return ze(M(w({},t),{readOnly:void 0}),e).readonly();if(t.description!==void 0)return ze(M(w({},t),{description:void 0}),e).describe(t.description);if(t.patternProperties!==void 0)throw new kn({patternProperties:t.patternProperties},e.toString());if(t.propertyNames!==void 0)throw new kn({propertyNames:t.propertyNames},e.toString());if(t.if!==void 0)throw new kn({if:t.if},e.toString());if(t.then!==void 0)throw new kn({then:t.then},e.toString());if(t.else!==void 0)throw new kn({else:t.else},e.toString());if(t.$ref!==void 0)return Ji(t.$ref);if(t.not!==void 0){if(Yg(t))return qi();if(t.not===!0)return Wr();throw new kn({not:t.not},e.toString())}if(Array.isArray(t.type)){if(t.type.length===0)return Bn;if(t.type.length===1)return ze(M(w({},t),{type:t.type[0]}),e);let l=t,{type:c}=l,f=qc(l,["type"]),p=t.type.map((g,y)=>ze(M(w({},f),{type:g}),e.withIndexType("number",y)));return Rn(p)}if(t.type==="string")return t.enum&&t.enum.length>0?Yi(t.enum):xr("string",t,e);if(t.type==="integer"){let l=xr("number",t,e);return l.typeName==="ZodNumber"?l.int():l}if(t.type==="number")return xr("number",t,e);if(t.type==="boolean")return xr("boolean",t,e);if(t.type==="null")return xr("null",t,e);if(t.type==="array")return NP(t,ze,e);if(t.type==="object"){if(t.additionalProperties!==void 0&&t.properties!==void 0){let l=ze(t.additionalProperties,e.withIndexType("string"));return ze(M(w({},t),{additionalProperties:void 0}),e).catchall(l)}if(t.properties!==void 0){let l={};for(let[c,f]of Object.entries(t.properties)){let p=ze(f,e.withIndexType("key",c)),g=(n=t.required)!=null?n:[];l[c]=g.includes(c)||p.isOptional()?p:p.optional()}return sr(l)}if(t.additionalProperties!==void 0){let l=ze(t.additionalProperties,e.withIndexType("string"));return qr(l)}return qr(Bn)}if(t.anyOf!==void 0){if(t.anyOf.length===0)return Bn;if(t.anyOf.length===1)return ze(t.anyOf[0],e);if(AP(t))return ze(t.anyOf[0],e).optional();if(CP(t))return ze(t.anyOf[0],e).nullable();if(RP(t)&&((i=(r=t["x-zui"])==null?void 0:r.def)!=null&&i.discriminator)){let{discriminator:c}=t["x-zui"].def,f=t.anyOf.map((p,g)=>ze(p,e.withIndexType("number",g)));return Fr(c,f)}let l=t.anyOf.map((c,f)=>ze(c,e.withIndexType("number",f)));return Rn(l)}if(t.oneOf!==void 0){if(t.oneOf.length===0)return Bn;if(t.oneOf.length===1)return ze(t.oneOf[0],e);if(MP(t)){let c=((s=t.discriminator)==null?void 0:s.propertyName)||((a=(o=t["x-zui"])==null?void 0:o.def)==null?void 0:a.discriminator);if(c){let f=t.oneOf.map((p,g)=>ze(p,e.withIndexType("number",g)));return Fr(c,f)}}let l=t.oneOf.map((c,f)=>ze(c,e.withIndexType("number",f)));return Rn(l)}if(t.allOf!==void 0){if(t.allOf.length===0)return Bn;if(t.allOf.length===1)return ze(t.allOf[0],e);let c=t.allOf.map((f,p)=>ze(f,e.withIndexType("number",p)));return c.slice(2).reduce((f,p)=>zr(f,p),zr(c[0],c[1]))}return t.type,OP(t)?hn():Bn}m(ze,"_fromJSONSchema");var KP=/^\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))?$/,FP=m((t,e,n=!0)=>ss(t,new Xr,e,n),"fromObject"),ss=m((t,e,n,r=!0)=>{if(typeof t!="object")throw new is("Input must be an object",e.toString());let i=m(a=>{let l=a;return n?.nullable&&(l=l.nullable()),n?.optional&&(l=l.optional()),n?.passtrough&&Se.zuiObject(l)&&(l=l.passthrough()),l},"applyOptions"),s=Object.entries(t).reduce((a,[l,c])=>{let f=e.withIndexType("key",l);if(c===null)a[l]=i(Jr());else switch(typeof c){case"string":a[l]=KP.test(c)?i(en().datetime()):i(en());break;case"number":a[l]=i(Wn());break;case"boolean":a[l]=i(Kn());break;case"object":if(Array.isArray(c)){let[p]=c;if(p==null)a[l]=i(On(hn()));else if(typeof p=="object")a[l]=i(On(ss(p,f.withIndexType("number"),n,!1)));else if(typeof p=="string"||typeof p=="number"||typeof p=="boolean"){let g=zP(p);a[l]=i(On(g))}}else a[l]=i(ss(c,f,n,!1));break;default:throw new is(`Unsupported type for key ${l}`,f.toString())}return a},{}),o=Object.keys(s).length>0;return n?.passtrough||!r&&!o?sr(s).passthrough():sr(s)},"_fromObject"),zP=m(t=>typeof t=="string"?en():typeof t=="number"?Wn():typeof t=="boolean"?Kn():hn(),"_getInnerType");function Qg(){return{}}m(Qg,"parseAnyDef");function em(t,e){var n,r;let i={type:"array"};return((r=(n=t.type)==null?void 0:n._def)==null?void 0:r.typeName)!==fe.ZodAny&&(i.items=Pe(t.type._def,M(w({},e),{currentPath:[...e.currentPath,"items"]}))),t.minLength&&Ee(i,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Ee(i,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Ee(i,"minItems",t.exactLength.value,t.exactLength.message,e),Ee(i,"maxItems",t.exactLength.value,t.exactLength.message,e)),i}m(em,"parseArrayDef");function tm(t,e){let n=w({type:"integer",format:"int64"},t.coerce?{[Ae]:{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?Ee(n,"minimum",r.value,r.message,e):Ee(n,"exclusiveMinimum",r.value,r.message,e):(r.inclusive||(n.exclusiveMinimum=!0),Ee(n,"minimum",r.value,r.message,e));break;case"max":e.target==="jsonSchema7"?r.inclusive?Ee(n,"maximum",r.value,r.message,e):Ee(n,"exclusiveMaximum",r.value,r.message,e):(r.inclusive||(n.exclusiveMaximum=!0),Ee(n,"maximum",r.value,r.message,e));break;case"multipleOf":Ee(n,"multipleOf",r.value,r.message,e);break}return n}m(tm,"parseBigintDef");function nm(t){return w({type:"boolean"},t.coerce?{[Ae]:{coerce:t.coerce||void 0}}:{})}m(nm,"parseBooleanDef");function rm(t,e){return Pe(t.type._def,e)}m(rm,"parseBrandedDef");var qP=m((t,e)=>Pe(t.innerType._def,e),"parseCatchDef");function im(t,e){return e.dateStrategy==="integer"?GP(t,e):w({type:"string",format:"date-time"},t.coerce?{[Ae]:{coerce:t.coerce||void 0}}:{})}m(im,"parseDateDef");var GP=m((t,e)=>{let n=w({type:"integer",format:"unix-time"},t.coerce?{[Ae]:{coerce:t.coerce||void 0}}:{});for(let r of t.checks)switch(r.kind){case"min":e.target==="jsonSchema7"&&Ee(n,"minimum",r.value,r.message,e);break;case"max":e.target==="jsonSchema7"&&Ee(n,"maximum",r.value,r.message,e);break}return n},"integerDateParser");function om(t,e){return M(w({},Pe(t.innerType._def,e)),{default:t.defaultValue()})}m(om,"parseDefaultDef");function sm(t,e){return e.effectStrategy==="input"?Pe(t.schema._def,e):{}}m(sm,"parseEffectsDef");function am(t){return{type:"string",enum:t.values}}m(am,"parseEnumDef");var VP=m(t=>"type"in t&&t.type==="string"?!1:"allOf"in t,"isJsonSchema7AllOfType");function lm(t,e){let n=[Pe(t.left._def,M(w({},e),{currentPath:[...e.currentPath,"allOf","0"]})),Pe(t.right._def,M(w({},e),{currentPath:[...e.currentPath,"allOf","1"]}))].filter(s=>!!s),r=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,i=[];return n.forEach(s=>{if(VP(s))i.push(...s.allOf),s.unevaluatedProperties===void 0&&(r=void 0);else{let o=s;if("additionalProperties"in s&&s.additionalProperties===!1){let a=s,{additionalProperties:l}=a;o=qc(a,["additionalProperties"])}else r=void 0;i.push(o)}}),i.length?w({allOf:i},r):void 0}m(lm,"parseIntersectionDef");function um(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}}m(um,"parseLiteralDef");function Ks(t,e){var n,r,i,s,o;if(e.target==="openApi3"&&((n=t.keyType)==null?void 0:n._def.typeName)===fe.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((l,c)=>{var f;return M(w({},l),{[c]:(f=Pe(t.valueType._def,M(w({},e),{currentPath:[...e.currentPath,"properties",c]})))!=null?f:{}})},{}),additionalProperties:!1};let a={type:"object",additionalProperties:(r=Pe(t.valueType._def,M(w({},e),{currentPath:[...e.currentPath,"additionalProperties"]})))!=null?r:{}};if(e.target==="openApi3")return a;if(((i=t.keyType)==null?void 0:i._def.typeName)===fe.ZodString&&((s=t.keyType._def.checks)!=null&&s.length)){let l=Object.entries(Ws(t.keyType._def,e)).reduce((c,[f,p])=>f==="type"?c:M(w({},c),{[f]:p}),{});return M(w({},a),{propertyNames:l})}else if(((o=t.keyType)==null?void 0:o._def.typeName)===fe.ZodEnum)return M(w({},a),{propertyNames:{enum:t.keyType._def.values}});return a}m(Ks,"parseRecordDef");function cm(t,e){if(e.mapStrategy==="record")return Ks(t,e);let n=Pe(t.keyType._def,M(w({},e),{currentPath:[...e.currentPath,"items","items","0"]}))||{},r=Pe(t.valueType._def,M(w({},e),{currentPath:[...e.currentPath,"items","items","1"]}))||{};return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}m(cm,"parseMapDef");function dm(t){let e=t.values,r=Object.keys(t.values).filter(s=>typeof e[e[s]]!="number").map(s=>e[s]),i=Array.from(new Set(r.map(s=>typeof s)));return{type:i.length===1?i[0]==="string"?"string":"number":["string","number"],enum:r.filter(s=>typeof s=="string"||typeof s=="number")}}m(dm,"parseNativeEnumDef");function fm(){return{not:{}}}m(fm,"parseNeverDef");function pm(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}m(pm,"parseNullDef");var Ui={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function gm(t,e){if(e.target==="openApi3")return Uc(t,e);let n=t.options instanceof Map?Array.from(t.options.values()):t.options;if(n.every(r=>r._def.typeName in Ui&&(!r._def.checks||!r._def.checks.length))){let r=n.reduce((i,s)=>{let o=Ui[s._def.typeName];return o&&!i.includes(o)?[...i,o]:i},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){let r=n.reduce((i,s)=>{let o=typeof s._def.value;switch(o){case"string":case"number":case"boolean":return[...i,o];case"bigint":return[...i,"integer"];case"object":if(s._def.value===null)return[...i,"null"];case"symbol":case"undefined":case"function":default:return i}},[]);if(r.length===n.length){let i=r.filter((s,o,a)=>a.indexOf(s)===o);return{type:i.length>1?i:i[0],enum:n.reduce((s,o)=>s.includes(o._def.value)?s:[...s,o._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,i)=>[...r,...i._def.values.filter(s=>!r.includes(s))],[])};return Uc(t,e)}m(gm,"parseUnionDef");var Uc=m((t,e)=>{let n=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((i,s)=>Pe(i._def,M(w({},e),{currentPath:[...e.currentPath,e.unionStrategy,`${s}`]}))).filter(i=>!!i&&(!e.strictUnions||typeof i=="object"&&Object.keys(i).length>0)),r=e.discriminator&&t.typeName==="ZodDiscriminatedUnion"&&typeof t.discriminator=="string"?{discriminator:{propertyName:t.discriminator}}:{};if(n.length)return e.unionStrategy==="anyOf"?w({anyOf:n},r):w({oneOf:n},r)},"asUnionOf");function mm(t,e){let n=t.innerType;if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(n._def.typeName)&&(!n._def.checks||!n._def.checks.length)){if(e.target==="openApi3"){let s={type:Ui[n._def.typeName],nullable:!0};return as(n._def,e,s)}let i={type:[Ui[n._def.typeName],"null"]};return as(n._def,e,i)}if(e.target==="openApi3"){let i=Pe(n._def,M(w({},e),{currentPath:[...e.currentPath]}));return i&&M(w({},i),{nullable:!0})}let r=Pe(n._def,M(w({},e),{currentPath:[...e.currentPath,"anyOf","0"]}));return r&&{anyOf:[r,{type:"null"}]}}m(mm,"parseNullableDef");function ym(t,e){let n=w({type:"number"},t.coerce?{[Ae]:{coerce:t.coerce||void 0}}:{});if(!t.checks)return n;for(let r of t.checks)switch(r.kind){case"int":n.type="integer",Ls(n,"type",r.message,e);break;case"min":e.target==="jsonSchema7"?r.inclusive?Ee(n,"minimum",r.value,r.message,e):Ee(n,"exclusiveMinimum",r.value,r.message,e):(r.inclusive||(n.exclusiveMinimum=!0),Ee(n,"minimum",r.value,r.message,e));break;case"max":e.target==="jsonSchema7"?r.inclusive?Ee(n,"maximum",r.value,r.message,e):Ee(n,"exclusiveMaximum",r.value,r.message,e):(r.inclusive||(n.exclusiveMaximum=!0),Ee(n,"maximum",r.value,r.message,e));break;case"multipleOf":Ee(n,"multipleOf",r.value,r.message,e);break}return n}m(ym,"parseNumberDef");var{zuiKey:VA}=tn,JP=m((t,e)=>{var n;return Se.zuiType(t.unknownKeys)?t.unknownKeys.typeName==="ZodNever"?!1:(n=Pe(t.unknownKeys._def,M(w({},e),{currentPath:[...e.currentPath,"additionalProperties"]})))!=null?n:!0:t.unknownKeys==="passthrough"},"getAdditionalProperties");function hm(t,e){let n=M(w({type:"object"},Object.entries(t.shape()).reduce((r,[i,s])=>{if(s===void 0||s._def===void 0)return r;let o=Pe(s._def,M(w({},e),{currentPath:[...e.currentPath,"properties",i],propertyPath:[...e.currentPath,"properties",i]}));return o===void 0?r:{properties:M(w({},r.properties),{[i]:o}),required:s.isOptional()?r.required:[...r.required,i]}},{properties:{},required:[]})),{additionalProperties:JP(t,e)});return n.required.length||delete n.required,n}m(hm,"parseObjectDef");var YP=m((t,e)=>{var n;if(e.currentPath.toString()===((n=e.propertyPath)==null?void 0:n.toString()))return Pe(t.innerType._def,e);let r=Pe(t.innerType._def,M(w({},e),{currentPath:[...e.currentPath,"anyOf","1"]}));return r?{anyOf:[{not:{}},r]}:{}},"parseOptionalDef"),XP=m((t,e)=>{if(e.pipeStrategy==="input")return Pe(t.in._def,e);if(e.pipeStrategy==="output")return Pe(t.out._def,e);let n=Pe(t.in._def,M(w({},e),{currentPath:[...e.currentPath,"allOf","0"]})),r=Pe(t.out._def,M(w({},e),{currentPath:[...e.currentPath,"allOf",n?"1":"0"]}));return{allOf:[n,r].filter(i=>i!==void 0)}},"parsePipelineDef");function Tm(t,e){return Pe(t.type._def,e)}m(Tm,"parsePromiseDef");var QP=m((t,e)=>Pe(t.innerType._def,e),"parseReadonlyDef");function vm(t){return{$ref:t.uri}}m(vm,"parseRefDef");function _m(t,e){let r={type:"array",uniqueItems:!0,items:Pe(t.valueType._def,M(w({},e),{currentPath:[...e.currentPath,"items"]}))};return t.minSize&&Ee(r,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&Ee(r,"maxItems",t.maxSize.value,t.maxSize.message,e),r}m(_m,"parseSetDef");function bm(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((n,r)=>Pe(n._def,M(w({},e),{currentPath:[...e.currentPath,"items",`${r}`]}))).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:Pe(t.rest._def,M(w({},e),{currentPath:[...e.currentPath,"additionalItems"]}))}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((n,r)=>Pe(n._def,M(w({},e),{currentPath:[...e.currentPath,"items",`${r}`]}))).reduce((n,r)=>r===void 0?n:[...n,r],[])}}m(bm,"parseTupleDef");function wm(){return{not:{}}}m(wm,"parseUndefinedDef");function xm(){return{}}m(xm,"parseUnknownDef");function Pe(t,e,n=!1){let r=e.seen.get(t);if(r&&!n){let o=eI(r,e);if(o!==void 0)return o}let i={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,i);let s=nI(t,t.typeName,e);return s&&as(t,e,s),i.jsonSchema=s,s}m(Pe,"parseDef");var eI=m((t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:tI(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"),tI=m((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"),nI=m((t,e,n)=>{switch(e){case fe.ZodString:return Ws(t,n);case fe.ZodNumber:return ym(t,n);case fe.ZodObject:return hm(t,n);case fe.ZodBigInt:return tm(t,n);case fe.ZodBoolean:return nm(t);case fe.ZodDate:return im(t,n);case fe.ZodUndefined:return wm();case fe.ZodNull:return pm(n);case fe.ZodArray:return em(t,n);case fe.ZodUnion:case fe.ZodDiscriminatedUnion:return gm(t,n);case fe.ZodIntersection:return lm(t,n);case fe.ZodTuple:return bm(t,n);case fe.ZodRecord:return Ks(t,n);case fe.ZodRef:return vm(t);case fe.ZodLiteral:return um(t,n);case fe.ZodEnum:return am(t);case fe.ZodNativeEnum:return dm(t);case fe.ZodNullable:return mm(t,n);case fe.ZodOptional:return YP(t,n);case fe.ZodMap:return cm(t,n);case fe.ZodSet:return _m(t,n);case fe.ZodLazy:return Pe(t.getter()._def,n);case fe.ZodPromise:return Tm(t,n);case fe.ZodNaN:case fe.ZodNever:return fm();case fe.ZodEffects:return sm(t,n);case fe.ZodAny:return Qg();case fe.ZodUnknown:return xm();case fe.ZodDefault:return om(t,n);case fe.ZodBranded:return rm(t,n);case fe.ZodReadonly:return QP(t,n);case fe.ZodCatch:return qP(t,n);case fe.ZodPipeline:return XP(t,n);case fe.ZodFunction:case fe.ZodVoid:case fe.ZodSymbol:return;default:return(r=>{})(e)}},"selectParser"),as=m((t,e,n)=>(t.description&&(n.description=t.description,e.markdownDescription&&(n.markdownDescription=t.description)),Object.assign(n,{[Ae]:w(w({},t[Ae]),n[Ae])}),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"},rI=m(t=>typeof t=="string"?M(w({},jc),{name:t}):w(w({},jc),t),"getDefaultOptions"),iI=m(t=>{let e=rI(t),n=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return M(w({},e),{currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([r,i])=>[i._def,{def:i._def,path:[...e.basePath,e.definitionPath,r],jsonSchema:void 0}]))})},"getRefs"),oI=m((t,e)=>{var n;let r=iI(e),i=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[c,f])=>{var p;return M(w({},l),{[c]:(p=Pe(f._def,M(w({},r),{currentPath:[...r.basePath,r.definitionPath,c]}),!0))!=null?p:{}})},{}):void 0,s=typeof e=="string"?e:e?.name,o=(n=Pe(t._def,s===void 0?r:M(w({},r),{currentPath:[...r.basePath,r.definitionPath,s]}),!1))!=null?n:{},a=s===void 0?i?M(w({},o),{[r.definitionPath]:i}):o:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,s].join("/"),[r.definitionPath]:M(w({},i),{[s]:o})};return r.target==="jsonSchema7"?a.$schema="http://json-schema.org/draft-07/schema#":r.target==="jsonSchema2019-09"&&(a.$schema="https://json-schema.org/draft/2019-09/schema#"),a},"zodToJsonSchema"),sI=m((t,e={target:"openApi3"})=>{let n=oI(t,e);return e.$schemaUrl===!1?delete n.$schema:typeof e.$schemaUrl=="string"&&(n.$schema=e.$schemaUrl),n},"toJSONSchemaLegacy"),{zuiKey:Wo}=tn,aI=m((t,e)=>{let n={type:"array",description:t.description,items:e(t._def.type),"x-zui":t._def["x-zui"]};return t._def[Wo]&&(n[Wo]=t._def[Wo]),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"),{zuiKey:Ko}=tn,lI=m(t=>{let e={type:"number",description:t.description,"x-zui":t._def["x-zui"]};t._def[Ko]&&(e[Ko]=t._def[Ko]);for(let n of t._def.checks)switch(n.kind){case"min":{let r=n.inclusive?"minimum":"exclusiveMinimum",i=n.inclusive?"exclusiveMinimum":"minimum";e[r]=n.value,delete e[i];break}case"max":{let r=n.inclusive?"maximum":"exclusiveMaximum",i=n.inclusive?"exclusiveMaximum":"maximum";e[r]=n.value,delete e[i];break}case"int":e.type="integer";break;case"finite":{e.format="finite";break}case"multipleOf":e.multipleOf=n.value;break;default:}return e},"zodNumberToJsonNumber"),{zuiKey:Fo}=tn,uI=m((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[Fo]&&(n[Fo]=t._def[Fo]),t._def.minSize&&(n.minItems=t._def.minSize.value),t._def.maxSize&&(n.maxItems=t._def.maxSize.value),n},"zodSetToJsonSet"),{zuiKey:Pr}=tn,cI=m((t,e)=>{let n={type:"string",description:t.description,"x-zui":t._def["x-zui"]};t._def[Pr]&&(n[Pr]=t._def[Pr]);for(let r of t._def.checks)switch(r.kind){case"cuid":n.format="cuid",n.pattern=Je.cuid;break;case"cuid2":n.format="cuid2",n.pattern=Je.cuid2;break;case"ulid":n.format="ulid",n.pattern=Je.ulid;break;case"uuid":n.format="uuid",n.pattern=Je.uuid;break;case"emoji":n.format="emoji",n.pattern=Je.emoji;break;case"email":n.format="email",n.pattern=Je.email;break;case"ip":n.format=r.version==="v6"?"ipv6":"ipv4",n.pattern=r.version==="v6"?Je.ipv6:Je.ipv4;break;case"datetime":n.format="date-time",(r.precision!==null||r.offset)&&(n.pattern=vp(r).source,n[Pr]=M(w({},n[Pr]),{precision:r.precision,offset:r.offset}));break;case"url":n.format="uri";break;case"endsWith":n.pattern=`${Ur.escapeSpecialChars(r.value)}$`;break;case"startsWith":n.pattern=`^${Ur.escapeSpecialChars(r.value)}`;break;case"includes":let i=r.position&&r.position>=1?`^(?:.{${r.position}}).*`:"";n.pattern=`${i}${Ur.escapeSpecialChars(r.value)}`;break;case"regex":n.pattern=r.regex.source;break;case"length":n.minLength=n.maxLength=Math.max(0,r.value);break;case"min":n.minLength=Math.max(0,r.value);break;case"max":n.maxLength=Math.max(0,r.value);break;default:throw new Ug("ZodString",r.kind,e.toString())}return n},"zodStringToJsonString"),{zuiKey:zo}=tn,dI=m((t,e,n)=>{let r={type:"array",description:t.description,items:t._def.items.map((i,s)=>e(i,n.withIndexType("number",s)))};return t._def[zo]&&(r[zo]=t._def[zo]),t._def.rest&&(r.additionalItems=e(t._def.rest,n.withIndexType("number"))),r},"zodTupleToJsonTuple"),fI={unionStrategy:"anyOf",discriminatedUnionStrategy:"oneOf",discriminator:!0};function Fs(t,e={}){return tt(t,e,new Xr)}m(Fs,"toJSONSchema");function tt(t,e={},n){let r=w(w({},fI),e),i=t;switch(i.typeName){case"ZodString":return cI(i,n);case"ZodNumber":return lI(i);case"ZodNaN":throw new dt("ZodNaN",n.toString());case"ZodBigInt":throw new dt("ZodBigInt",n.toString(),{suggestedAlternative:"serialize bigint to string"});case"ZodBoolean":return{type:"boolean",description:i.description,"x-zui":i._def["x-zui"]};case"ZodDate":throw new dt("ZodDate",n.toString(),{suggestedAlternative:"use z.string().datetime() instead"});case"ZodUndefined":return qo(i);case"ZodNull":return Go(i);case"ZodAny":return{description:i.description,"x-zui":i._def["x-zui"]};case"ZodUnknown":return{description:i.description,"x-zui":M(w({},i._def["x-zui"]),{def:{typeName:"ZodUnknown"}})};case"ZodNever":return{not:!0,description:i.description,"x-zui":i._def["x-zui"]};case"ZodVoid":throw new dt("ZodVoid",n.toString());case"ZodArray":return aI(i,p=>tt(p,r,n.withIndexType("number")));case"ZodObject":let s=Object.entries(i.shape),o=s.filter(([p,g])=>!g.isOptional()),a=o.length?o.map(([p])=>p):void 0,l=s.map(([p,g])=>[p,g.mandatory()]).map(([p,g])=>[p,tt(g,r,n.withIndexType("key",p))]);return{type:"object",description:i.description,properties:Object.fromEntries(l),required:a,additionalProperties:pI(i._def,r,n),"x-zui":i._def["x-zui"]};case"ZodUnion":return r.unionStrategy==="oneOf"?{description:i.description,oneOf:i.options.map((p,g)=>tt(p,r,n.withIndexType("number",g))),"x-zui":i._def["x-zui"]}:{description:i.description,anyOf:i.options.map((p,g)=>tt(p,r,n.withIndexType("number",g))),"x-zui":i._def["x-zui"]};case"ZodDiscriminatedUnion":if(r.discriminatedUnionStrategy==="oneOf"){let p=r.discriminator?{propertyName:i.discriminator}:void 0;return{description:i.description,oneOf:i.options.map((g,y)=>tt(g,r,n.withIndexType("number",y))),discriminator:p,"x-zui":M(w({},i._def["x-zui"]),{def:{typeName:"ZodDiscriminatedUnion",discriminator:i.discriminator}})}}return{description:i.description,anyOf:i.options.map((p,g)=>tt(p,r,n.withIndexType("number",g))),"x-zui":M(w({},i._def["x-zui"]),{def:{typeName:"ZodDiscriminatedUnion",discriminator:i.discriminator}})};case"ZodIntersection":let c=tt(i._def.left,r,n.withIndexType("number",0)),f=tt(i._def.right,r,n.withIndexType("number",1));return"additionalProperties"in c&&delete c.additionalProperties,"additionalProperties"in f&&delete f.additionalProperties,{description:i.description,allOf:[c,f],"x-zui":i._def["x-zui"]};case"ZodTuple":return dI(i,(p,g)=>tt(p,r,g),n);case"ZodRecord":{let p=i._def.keyType,g=Se.zuiString(p)?n.withIndexType("string"):Se.zuiNumber(p)?n.withIndexType("number"):n.withIndexType("any");return{type:"object",description:i.description,additionalProperties:tt(i._def.valueType,r,g),"x-zui":i._def["x-zui"]}}case"ZodMap":throw new dt("ZodMap",n.toString());case"ZodSet":return uI(i,p=>tt(p,r,n.withIndexType("number")));case"ZodFunction":throw new dt("ZodFunction",n.toString());case"ZodLazy":throw new dt("ZodLazy",n.toString());case"ZodLiteral":if(typeof i.value=="string")return{type:"string",description:i.description,const:i.value,"x-zui":i._def["x-zui"]};if(typeof i.value=="number")return{type:"number",description:i.description,const:i.value,"x-zui":i._def["x-zui"]};if(typeof i.value=="boolean")return{type:"boolean",description:i.description,const:i.value,"x-zui":i._def["x-zui"]};if(i.value===null)return Go(i._def);if(i.value===void 0)return qo(i._def);{i.value;let p=typeof i.value;throw new eo(`Unsupported literal type: "${p}"`,n.toString())}case"ZodEnum":return{type:"string",description:i.description,enum:i._def.values,"x-zui":i._def["x-zui"]};case"ZodEffects":throw new dt("ZodEffects",n.toString());case"ZodNativeEnum":throw new dt("ZodNativeEnum",n.toString());case"ZodOptional":return{description:i.description,anyOf:[tt(i._def.innerType,r,n),qo()],"x-zui":M(w({},i._def["x-zui"]),{def:{typeName:"ZodOptional"}})};case"ZodNullable":return{anyOf:[tt(i._def.innerType,r,n),Go()],"x-zui":M(w({},i._def["x-zui"]),{def:{typeName:"ZodNullable"}})};case"ZodDefault":return M(w({},tt(i._def.innerType,r,n)),{default:i._def.defaultValue()});case"ZodCatch":throw new dt("ZodCatch",n.toString());case"ZodPromise":throw new dt("ZodPromise",n.toString());case"ZodBranded":throw new dt("ZodBranded",n.toString());case"ZodPipeline":throw new dt("ZodPipeline",n.toString());case"ZodSymbol":throw new dt("ZodSymbol",n.toString());case"ZodReadonly":return M(w({},tt(i._def.innerType,r,n)),{readOnly:!0});case"ZodRef":return{$ref:i._def.uri,description:i.description,"x-zui":i._def["x-zui"]};default:Ot.assertNever(i)}}m(tt,"_toJSONSchema");var qo=m(t=>({not:!0,description:t?.description,"x-zui":M(w({},t?.["x-zui"]),{def:{typeName:"ZodUndefined"}})}),"undefinedSchema"),Go=m(t=>({type:"null",description:t?.description,"x-zui":t?.["x-zui"]}),"nullSchema"),pI=m((t,e,n)=>t.unknownKeys==="passthrough"?!0:t.unknownKeys==="strict"||!Se.zuiType(t.unknownKeys)||t.unknownKeys.typeName==="ZodNever"?!1:tt(t.unknownKeys,e,n.withIndexType("string")),"additionalPropertiesSchema");function Pm(t){return typeof t=="symbol"?"symbol":typeof t=="bigint"?`${t.toString()}n`:ie(t)}m(Pm,"primitiveToTypscriptLiteralType");function ie(t){return typeof t>"u"?"undefined":typeof t=="symbol"?t.description?`Symbol(${ie(t.description)})`:"Symbol()":typeof t=="bigint"?`BigInt(${t.toString()})`:typeof t=="string"?Sm(t):JSON.stringify(t)}m(ie,"primitiveToTypescriptValue");function ir(t){return typeof t>"u"?"undefined":JSON.stringify(t)}m(ir,"unknownToTypescriptValue");var Im=m((t,e)=>{let n=Object.entries(t),r=e?" as const":"";return`{ ${n.map(([i,s])=>`${ls(i)}: ${ir(s)}`).join(", ")} }${r}`},"recordOfUnknownToTypescriptRecord"),ls=m(t=>/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t)?t:ie(t),"toPropertyKey"),gI=m(t=>t.charAt(0).toUpperCase()+t.slice(1),"capitalize"),Bm=m(t=>{let e=/[^a-zA-Z0-9_]/g;return t.split(e).map(gI).filter(r=>!!r).join("")},"toTypeArgumentName"),$c=m(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"),et=m(t=>{t=t?.replace(/(\n(\s*)?){3,}/g,`
|
|
69
|
+
`,i+="})"}let s=n?i?n+i:r?r==="z.never()"?n+".strict()":n+`.catchall(${r})`:n:i||(r?`z.record(${r})`:"z.record(z.any())");return Ve.an.anyOf(t)&&(s+=`.and(${Jg(M(w({},t),{anyOf:t.anyOf.map(o=>typeof o=="object"&&!o.type&&(o.properties||o.additionalProperties||o.patternProperties)?M(w({},o),{type:"object"}):o)}),e)})`),Ve.a.oneOf(t)&&(s+=`.and(${Ws(M(w({},t),{oneOf:t.oneOf.map(o=>typeof o=="object"&&!o.type&&(o.properties||o.additionalProperties||o.patternProperties)?M(w({},o),{type:"object"}):o)}),e)})`),Ve.an.allOf(t)&&(s+=`.and(${Gr(M(w({},t),{allOf:t.allOf.map(o=>typeof o=="object"&&!o.type&&(o.properties||o.additionalProperties||o.patternProperties)?M(w({},o),{type:"object"}):o)}),e)})`),s}m(Yg,"parseObject");var PP=m(t=>`z.ref('${t.$ref}')`,"parseRef"),IP=m(t=>{var e;let n="z.string()";if((e=t[Ae])!=null&&e.coerce){if(t.format==="date-time")return"z.coerce.date()";n="z.coerce.string()"}return n+=at(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+=at(t,"pattern",({json:r})=>[`.regex(new RegExp(${r})`,", ",")"]),n+=at(t,"minLength",({json:r})=>[`.min(${r}`,", ",")"]),n+=at(t,"maxLength",({json:r})=>[`.max(${r}`,", ",")"]),n},"parseString"),nt=m((t,e={seen:new Map,path:[]},n)=>{if(typeof t!="object")return t?"z.any()":"z.never()";if(e.parserOverride){let s=e.parserOverride(t,e);if(typeof s=="string")return s}let r=e.seen.get(t);if(r){if(r.r!==void 0)return r.r;if(e.depth===void 0||r.n>=e.depth)return"z.any()";r.n+=1}else r={r:void 0,n:0},e.seen.set(t,r);let i=SP(t,e);return n||(i=BP(t,i),e.withoutDefaults||(i=EP(t,i))),r.r=i,i},"parseSchema"),BP=m((t,e)=>(t.description&&(e+=`.describe(${JSON.stringify(t.description)})`),e),"addMeta"),EP=m((t,e)=>(t.default!==void 0&&(e+=`.default(${JSON.stringify(t.default)})`),e),"addDefaults"),SP=m((t,e)=>Ve.a.nullable(t)?wP(t,e):Ve.an.object(t)?Yg(t,e):Ve.an.array(t)?fP(t,e):Ve.an.anyOf(t)?Jg(t,e):Ve.an.allOf(t)?Gr(t,e):Ve.a.discriminator(t)?yP(t,e):Ve.a.oneOf(t)?Ws(t,e):Ve.a.not(t)?_P(t,e):Ve.an.enum(t)?hP(t):Ve.a.const(t)?gP(t):Ve.a.multipleType(t)?vP(t,e):Ve.a.primitive(t,"string")?IP(t):Ve.a.primitive(t,"number")||Ve.a.primitive(t,"integer")?xP(t):Ve.a.primitive(t,"boolean")?pP(t):Ve.a.primitive(t,"null")?bP(t):Ve.a.conditional(t)?TP(t,e):Ve.a.ref(t)?PP(t):mP(t),"selectParser"),Ve={an:{object:t=>t.type==="object",array:t=>t.type==="array",anyOf:t=>t.anyOf!==void 0,allOf:t=>t.allOf!==void 0,enum:t=>t.enum!==void 0},a:{nullable:t=>t.nullable===!0,multipleType:t=>Array.isArray(t.type),not:t=>t.not!==void 0,const:t=>t.const!==void 0,primitive:(t,e)=>t.type===e,conditional:t=>!!("if"in t&&t.if&&"then"in t&&"else"in t&&t.then&&t.else),discriminator:t=>{var e;return t.oneOf!==void 0&&((e=t.discriminator)==null?void 0:e.propertyName)!==void 0},oneOf:t=>t.oneOf!==void 0,ref:t=>t.$ref!==void 0}},kP=m(t=>nt(t,{seen:new Map,path:[]}),"jsonSchemaToZodStr"),AP=m(t=>{let e=kP(t);e=e.replaceAll("errors: z.ZodError[]","errors");let n=lP(e);if(!n.sucess)throw new Qi(n.error);return n.value},"jsonSchemaToZod"),Dr=m((t,e)=>{var n,r;if(e[Ae]&&t._def&&(t.naked()._def[Ae]=e[Ae]),((n=t._def)==null?void 0:n.typeName)==="ZodObject"&&e.type==="object"&&e.properties&&Object.entries(e.properties).forEach(([i,s])=>{let o=typeof t._def.shape=="function"?t._def.shape():t._def.shape;o[i]&&Dr(o[i],s)}),((r=t._def)==null?void 0:r.typeName)==="ZodRecord"&&e.type==="object"&&e.additionalProperties&&Dr(t._def.valueType,e.additionalProperties),e.type==="array"&&e.items){let i=e.items;if(typeof i=="object"&&!Array.isArray(i)){let s=t._def.type;s&&Dr(s,i)}else Array.isArray(i)&&i.forEach((s,o)=>{let a=t._def;a.typeName===fe.ZodTuple&&Dr(a.items[o],s)})}},"applyZuiPropsRecursively"),CP=m(t=>{let e=AP(t);return Dr(e,t),e},"fromJSONSchemaLegacy"),Xg=class Ci{constructor(e=[],n=""){this.type="propertyPath",this._sections=e,this._wrapper=n}withIndexType(e,n){return new Ci([...this._sections,{type:e,value:n}],this._wrapper)}withWrapper(e){return new Ci([new Ci([...this._sections],e)])}toString(){let e=this._wrapper?`${this._wrapper}<`:"",n=this._wrapper?">":"",r=this._sections.length===0||this._sections[0].type!=="propertyPath"?"#":"";return`${e}${r}${this._sections.map(i=>{var s;return i.type==="propertyPath"?i.toString():i.type==="key"?`.${i.value}`:i.type==="any"?"[*]":`[${(s=i.value)!=null?s:i.type}]`}).join("")}${n}`}};m(Xg,"PropertyPath");var Xr=Xg,OP=m(t=>{var e,n;return t.anyOf!==void 0&&t.anyOf.length===2&&t.anyOf.some(r=>typeof r!="boolean"&&Qg(r))&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)==="ZodOptional"},"isOptionalSchema"),RP=m(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)==="ZodNullable"},"isNullableSchema"),Qg=m(t=>{var e,n;return t.not===!0&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)==="ZodUndefined"},"isUndefinedSchema"),MP=m(t=>{var e,n;return!t.not&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)==="ZodUnknown"},"isUnknownSchema"),NP=m(t=>{var e,n;return t.anyOf!==void 0&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)==="ZodDiscriminatedUnion"},"isDiscriminatedUnionSchema"),DP=m(t=>{var e,n;return t.oneOf!==void 0&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)==="ZodDiscriminatedUnion"},"isExclusiveDiscriminatedUnionSchema"),HP=m((t,e,n)=>UP(t)?$P(t,e,n):jP(t)?ZP(t,e,n):LP(t,e,n),"arrayJSONSchemaToZuiArray"),UP=m(t=>Array.isArray(t.items),"_isTuple"),jP=m(t=>t.items!==void 0&&t.uniqueItems,"_isSet"),$P=m(({items:t,additionalItems:e},n,r)=>{let i=t.map((o,a)=>n(o,r.withIndexType("number",a))),s=Yr(i);return e!==void 0&&(s=s.rest(n(e,r.withIndexType("number")))),s},"_handleTuple"),ZP=m(({items:t,minItems:e,maxItems:n},r,i)=>{let s=Xi(r(t,i.withIndexType("number")));return e&&(s=s.min(e)),n&&(s=s.max(n)),s},"_handleSet"),LP=m(({minItems:t,maxItems:e,items:n},r,i)=>{let s=On(r(n,i.withIndexType("number")));return t&&t===e?s.length(t):(t&&(s=s.min(t)),e&&(s=s.max(e)),s)},"_handleArray"),WP=m(({type:t,minimum:e,exclusiveMinimum:n,maximum:r,exclusiveMaximum:i,multipleOf:s,format:o})=>{let a=Wn();return t==="integer"&&(a=a.int()),o==="finite"&&(a=a.finite()),n!==void 0?a=a.gt(n):e!==void 0&&(a=a.gte(e)),i!==void 0?a=a.lt(i):r!==void 0&&(a=a.lte(r)),s!==void 0&&(a=a.multipleOf(s)),a},"numberJSONSchemaToZuiNumber"),Ur={};Rt(Ur,{escapeSpecialChars:()=>KP});var KP=m(t=>t.replaceAll(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeSpecialChars");function Ks(t,e,n,r){r?.errorMessages&&n&&(t.errorMessage=M(w({},t.errorMessage),{[e]:n}))}m(Ks,"addErrorMessage");function Se(t,e,n,r,i){t[e]=n,Ks(t,e,r,i)}m(Se,"setResponseValueAndErrors");var Je={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 Fs(t,e){let n=w({type:"string"},t.coerce?{[Ae]:{coerce:t.coerce||void 0}}:{});function r(i){return e.patternStrategy==="escape"?Ur.escapeSpecialChars(i):i}if(m(r,"processPattern"),t.checks)for(let i of t.checks)switch(i.kind){case"min":Se(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,i.value):i.value,i.message,e);break;case"max":Se(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,i.value):i.value,i.message,e);break;case"email":switch(e.emailStrategy){case"format:email":In(n,"email",i.message,e);break;case"format:idn-email":In(n,"idn-email",i.message,e);break;case"pattern:zod":Jt(n,Je.email,i.message,e);break}break;case"url":In(n,"uri",i.message,e);break;case"uuid":In(n,"uuid",i.message,e);break;case"regex":Jt(n,i.regex.source,i.message,e);break;case"cuid":Jt(n,Je.cuid,i.message,e);break;case"cuid2":Jt(n,Je.cuid2,i.message,e);break;case"startsWith":Jt(n,"^"+r(i.value),i.message,e);break;case"endsWith":Jt(n,r(i.value)+"$",i.message,e);break;case"datetime":In(n,"date-time",i.message,e);break;case"length":Se(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,i.value):i.value,i.message,e),Se(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,i.value):i.value,i.message,e);break;case"includes":{Jt(n,r(i.value),i.message,e);break}case"ip":{i.version!=="v6"&&In(n,"ipv4",i.message,e),i.version!=="v4"&&In(n,"ipv6",i.message,e);break}case"emoji":Jt(n,Je.emoji,i.message,e);break;case"ulid":{Jt(n,Je.ulid,i.message,e);break}case"toLowerCase":case"toUpperCase":case"trim":break;default:}return n}m(Fs,"parseStringDef");var In=m((t,e,n,r)=>{var i;t.format||(i=t.anyOf)!=null&&i.some(s=>s.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push(w({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(w({format:e},n&&r.errorMessages&&{errorMessage:{format:n}}))):Se(t,"format",e,n,r)},"addFormat"),Jt=m((t,e,n,r)=>{var i;t.pattern||(i=t.allOf)!=null&&i.some(s=>s.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push(w({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(w({pattern:e},n&&r.errorMessages&&{errorMessage:{pattern:n}}))):Se(t,"pattern",e,n,r)},"addPattern"),FP=m(({format:t,pattern:e,minLength:n,maxLength:r})=>{let i=en();if(n&&r&&n===r?i=i.length(n):(n&&(i=i.min(n)),r&&(i=i.max(r))),t==="cuid"||e===Je.cuid)i=i.cuid();else if(t==="cuid2"||e===Je.cuid2)i=i.cuid2();else if(t==="emoji"||e===Je.emoji)i=i.emoji();else if(t==="ulid"||e===Je.ulid)i=i.ulid();else if(t==="date-time"){let{precision:s,offset:o}=e?wp(e):{};i=i.datetime({precision:s,offset:o})}else t==="email"||e===Je.email?i=i.email():t==="ipv4"||e===Je.ipv4?i=i.ip():t==="ipv6"||e===Je.ipv6?i=i.ip("v6"):t==="uri"?i=i.url():t==="uuid"||e===Je.uuid?i=i.uuid():e&&(i=i.regex(new RegExp(e)));return i},"stringJSONSchemaToZuiString"),xr=m((t,e,n)=>{let r=[];e.enum!==void 0&&r.push(...e.enum),e.const!==void 0&&r.push(e.const);let i,s=r.filter(a=>typeof a===t),[o]=s;if(o)if(s.length===1)i=Kr(o);else{let a=s.map(l=>Kr(l));i=Rn(a)}else if(t==="string"&&e.type==="string"&&(i=FP(e)),t==="number"&&(e.type==="number"||e.type==="integer")&&(i=WP(e)),t==="boolean"&&(i=Kn()),t==="null"&&(i=Jr()),!i)throw new Qi(`Unknown primitive type: "${t}"`,n?.toString());return e.description&&(i=i.describe(e.description)),i},"toZuiPrimitive"),Bn=Nn();function em(t){return ze(t,new Xr)}m(em,"fromJSONSchema");function ze(t,e){var n,r,i,s,o,a;if(t===void 0)return Bn;if(t===!0)return Nn();if(t===!1)return Wr();if(t.default!==void 0)return ze(M(w({},t),{default:void 0}),e).default(t.default);if(t.readOnly)return ze(M(w({},t),{readOnly:void 0}),e).readonly();if(t.description!==void 0)return ze(M(w({},t),{description:void 0}),e).describe(t.description);if(t.patternProperties!==void 0)throw new kn({patternProperties:t.patternProperties},e.toString());if(t.propertyNames!==void 0)throw new kn({propertyNames:t.propertyNames},e.toString());if(t.if!==void 0)throw new kn({if:t.if},e.toString());if(t.then!==void 0)throw new kn({then:t.then},e.toString());if(t.else!==void 0)throw new kn({else:t.else},e.toString());if(t.$ref!==void 0)return Ji(t.$ref);if(t.not!==void 0){if(Qg(t))return qi();if(t.not===!0)return Wr();throw new kn({not:t.not},e.toString())}if(Array.isArray(t.type)){if(t.type.length===0)return Bn;if(t.type.length===1)return ze(M(w({},t),{type:t.type[0]}),e);let l=t,{type:c}=l,f=Vc(l,["type"]),p=t.type.map((g,y)=>ze(M(w({},f),{type:g}),e.withIndexType("number",y)));return Rn(p)}if(t.type==="string")return t.enum&&t.enum.length>0?Yi(t.enum):xr("string",t,e);if(t.type==="integer"){let l=xr("number",t,e);return l.typeName==="ZodNumber"?l.int():l}if(t.type==="number")return xr("number",t,e);if(t.type==="boolean")return xr("boolean",t,e);if(t.type==="null")return xr("null",t,e);if(t.type==="array")return HP(t,ze,e);if(t.type==="object"){if(t.additionalProperties!==void 0&&t.properties!==void 0){let l=ze(t.additionalProperties,e.withIndexType("string"));return ze(M(w({},t),{additionalProperties:void 0}),e).catchall(l)}if(t.properties!==void 0){let l={};for(let[c,f]of Object.entries(t.properties)){let p=ze(f,e.withIndexType("key",c)),g=(n=t.required)!=null?n:[];l[c]=g.includes(c)||p.isOptional()?p:p.optional()}return sr(l)}if(t.additionalProperties!==void 0){let l=ze(t.additionalProperties,e.withIndexType("string"));return qr(l)}return qr(Bn)}if(t.anyOf!==void 0){if(t.anyOf.length===0)return Bn;if(t.anyOf.length===1)return ze(t.anyOf[0],e);if(OP(t))return ze(t.anyOf[0],e).optional();if(RP(t))return ze(t.anyOf[0],e).nullable();if(NP(t)&&((i=(r=t["x-zui"])==null?void 0:r.def)!=null&&i.discriminator)){let{discriminator:c}=t["x-zui"].def,f=t.anyOf.map((p,g)=>ze(p,e.withIndexType("number",g)));return Fr(c,f)}let l=t.anyOf.map((c,f)=>ze(c,e.withIndexType("number",f)));return Rn(l)}if(t.oneOf!==void 0){if(t.oneOf.length===0)return Bn;if(t.oneOf.length===1)return ze(t.oneOf[0],e);if(DP(t)){let c=((s=t.discriminator)==null?void 0:s.propertyName)||((a=(o=t["x-zui"])==null?void 0:o.def)==null?void 0:a.discriminator);if(c){let f=t.oneOf.map((p,g)=>ze(p,e.withIndexType("number",g)));return Fr(c,f)}}let l=t.oneOf.map((c,f)=>ze(c,e.withIndexType("number",f)));return Rn(l)}if(t.allOf!==void 0){if(t.allOf.length===0)return Bn;if(t.allOf.length===1)return ze(t.allOf[0],e);let c=t.allOf.map((f,p)=>ze(f,e.withIndexType("number",p)));return c.slice(2).reduce((f,p)=>zr(f,p),zr(c[0],c[1]))}return t.type,MP(t)?hn():Bn}m(ze,"_fromJSONSchema");var zP=/^\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))?$/,qP=m((t,e,n=!0)=>ls(t,new Xr,e,n),"fromObject"),ls=m((t,e,n,r=!0)=>{if(typeof t!="object")throw new ss("Input must be an object",e.toString());let i=m(a=>{let l=a;return n?.nullable&&(l=l.nullable()),n?.optional&&(l=l.optional()),n?.passtrough&&Ee.zuiObject(l)&&(l=l.passthrough()),l},"applyOptions"),s=Object.entries(t).reduce((a,[l,c])=>{let f=e.withIndexType("key",l);if(c===null)a[l]=i(Jr());else switch(typeof c){case"string":a[l]=zP.test(c)?i(en().datetime()):i(en());break;case"number":a[l]=i(Wn());break;case"boolean":a[l]=i(Kn());break;case"object":if(Array.isArray(c)){let[p]=c;if(p==null)a[l]=i(On(hn()));else if(typeof p=="object")a[l]=i(On(ls(p,f.withIndexType("number"),n,!1)));else if(typeof p=="string"||typeof p=="number"||typeof p=="boolean"){let g=GP(p);a[l]=i(On(g))}}else a[l]=i(ls(c,f,n,!1));break;default:throw new ss(`Unsupported type for key ${l}`,f.toString())}return a},{}),o=Object.keys(s).length>0;return n?.passtrough||!r&&!o?sr(s).passthrough():sr(s)},"_fromObject"),GP=m(t=>typeof t=="string"?en():typeof t=="number"?Wn():typeof t=="boolean"?Kn():hn(),"_getInnerType");function tm(){return{}}m(tm,"parseAnyDef");function nm(t,e){var n,r;let i={type:"array"};return((r=(n=t.type)==null?void 0:n._def)==null?void 0:r.typeName)!==fe.ZodAny&&(i.items=Pe(t.type._def,M(w({},e),{currentPath:[...e.currentPath,"items"]}))),t.minLength&&Se(i,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Se(i,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Se(i,"minItems",t.exactLength.value,t.exactLength.message,e),Se(i,"maxItems",t.exactLength.value,t.exactLength.message,e)),i}m(nm,"parseArrayDef");function rm(t,e){let n=w({type:"integer",format:"int64"},t.coerce?{[Ae]:{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?Se(n,"minimum",r.value,r.message,e):Se(n,"exclusiveMinimum",r.value,r.message,e):(r.inclusive||(n.exclusiveMinimum=!0),Se(n,"minimum",r.value,r.message,e));break;case"max":e.target==="jsonSchema7"?r.inclusive?Se(n,"maximum",r.value,r.message,e):Se(n,"exclusiveMaximum",r.value,r.message,e):(r.inclusive||(n.exclusiveMaximum=!0),Se(n,"maximum",r.value,r.message,e));break;case"multipleOf":Se(n,"multipleOf",r.value,r.message,e);break}return n}m(rm,"parseBigintDef");function im(t){return w({type:"boolean"},t.coerce?{[Ae]:{coerce:t.coerce||void 0}}:{})}m(im,"parseBooleanDef");function om(t,e){return Pe(t.type._def,e)}m(om,"parseBrandedDef");var VP=m((t,e)=>Pe(t.innerType._def,e),"parseCatchDef");function sm(t,e){return e.dateStrategy==="integer"?JP(t,e):w({type:"string",format:"date-time"},t.coerce?{[Ae]:{coerce:t.coerce||void 0}}:{})}m(sm,"parseDateDef");var JP=m((t,e)=>{let n=w({type:"integer",format:"unix-time"},t.coerce?{[Ae]:{coerce:t.coerce||void 0}}:{});for(let r of t.checks)switch(r.kind){case"min":e.target==="jsonSchema7"&&Se(n,"minimum",r.value,r.message,e);break;case"max":e.target==="jsonSchema7"&&Se(n,"maximum",r.value,r.message,e);break}return n},"integerDateParser");function am(t,e){return M(w({},Pe(t.innerType._def,e)),{default:t.defaultValue()})}m(am,"parseDefaultDef");function lm(t,e){return e.effectStrategy==="input"?Pe(t.schema._def,e):{}}m(lm,"parseEffectsDef");function um(t){return{type:"string",enum:t.values}}m(um,"parseEnumDef");var YP=m(t=>"type"in t&&t.type==="string"?!1:"allOf"in t,"isJsonSchema7AllOfType");function cm(t,e){let n=[Pe(t.left._def,M(w({},e),{currentPath:[...e.currentPath,"allOf","0"]})),Pe(t.right._def,M(w({},e),{currentPath:[...e.currentPath,"allOf","1"]}))].filter(s=>!!s),r=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,i=[];return n.forEach(s=>{if(YP(s))i.push(...s.allOf),s.unevaluatedProperties===void 0&&(r=void 0);else{let o=s;if("additionalProperties"in s&&s.additionalProperties===!1){let a=s,{additionalProperties:l}=a;o=Vc(a,["additionalProperties"])}else r=void 0;i.push(o)}}),i.length?w({allOf:i},r):void 0}m(cm,"parseIntersectionDef");function dm(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}}m(dm,"parseLiteralDef");function zs(t,e){var n,r,i,s,o;if(e.target==="openApi3"&&((n=t.keyType)==null?void 0:n._def.typeName)===fe.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((l,c)=>{var f;return M(w({},l),{[c]:(f=Pe(t.valueType._def,M(w({},e),{currentPath:[...e.currentPath,"properties",c]})))!=null?f:{}})},{}),additionalProperties:!1};let a={type:"object",additionalProperties:(r=Pe(t.valueType._def,M(w({},e),{currentPath:[...e.currentPath,"additionalProperties"]})))!=null?r:{}};if(e.target==="openApi3")return a;if(((i=t.keyType)==null?void 0:i._def.typeName)===fe.ZodString&&((s=t.keyType._def.checks)!=null&&s.length)){let l=Object.entries(Fs(t.keyType._def,e)).reduce((c,[f,p])=>f==="type"?c:M(w({},c),{[f]:p}),{});return M(w({},a),{propertyNames:l})}else if(((o=t.keyType)==null?void 0:o._def.typeName)===fe.ZodEnum)return M(w({},a),{propertyNames:{enum:t.keyType._def.values}});return a}m(zs,"parseRecordDef");function fm(t,e){if(e.mapStrategy==="record")return zs(t,e);let n=Pe(t.keyType._def,M(w({},e),{currentPath:[...e.currentPath,"items","items","0"]}))||{},r=Pe(t.valueType._def,M(w({},e),{currentPath:[...e.currentPath,"items","items","1"]}))||{};return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}m(fm,"parseMapDef");function pm(t){let e=t.values,r=Object.keys(t.values).filter(s=>typeof e[e[s]]!="number").map(s=>e[s]),i=Array.from(new Set(r.map(s=>typeof s)));return{type:i.length===1?i[0]==="string"?"string":"number":["string","number"],enum:r.filter(s=>typeof s=="string"||typeof s=="number")}}m(pm,"parseNativeEnumDef");function gm(){return{not:{}}}m(gm,"parseNeverDef");function mm(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}m(mm,"parseNullDef");var Ui={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function ym(t,e){if(e.target==="openApi3")return $c(t,e);let n=t.options instanceof Map?Array.from(t.options.values()):t.options;if(n.every(r=>r._def.typeName in Ui&&(!r._def.checks||!r._def.checks.length))){let r=n.reduce((i,s)=>{let o=Ui[s._def.typeName];return o&&!i.includes(o)?[...i,o]:i},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){let r=n.reduce((i,s)=>{let o=typeof s._def.value;switch(o){case"string":case"number":case"boolean":return[...i,o];case"bigint":return[...i,"integer"];case"object":if(s._def.value===null)return[...i,"null"];case"symbol":case"undefined":case"function":default:return i}},[]);if(r.length===n.length){let i=r.filter((s,o,a)=>a.indexOf(s)===o);return{type:i.length>1?i:i[0],enum:n.reduce((s,o)=>s.includes(o._def.value)?s:[...s,o._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,i)=>[...r,...i._def.values.filter(s=>!r.includes(s))],[])};return $c(t,e)}m(ym,"parseUnionDef");var $c=m((t,e)=>{let n=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((i,s)=>Pe(i._def,M(w({},e),{currentPath:[...e.currentPath,e.unionStrategy,`${s}`]}))).filter(i=>!!i&&(!e.strictUnions||typeof i=="object"&&Object.keys(i).length>0)),r=e.discriminator&&t.typeName==="ZodDiscriminatedUnion"&&typeof t.discriminator=="string"?{discriminator:{propertyName:t.discriminator}}:{};if(n.length)return e.unionStrategy==="anyOf"?w({anyOf:n},r):w({oneOf:n},r)},"asUnionOf");function hm(t,e){let n=t.innerType;if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(n._def.typeName)&&(!n._def.checks||!n._def.checks.length)){if(e.target==="openApi3"){let s={type:Ui[n._def.typeName],nullable:!0};return us(n._def,e,s)}let i={type:[Ui[n._def.typeName],"null"]};return us(n._def,e,i)}if(e.target==="openApi3"){let i=Pe(n._def,M(w({},e),{currentPath:[...e.currentPath]}));return i&&M(w({},i),{nullable:!0})}let r=Pe(n._def,M(w({},e),{currentPath:[...e.currentPath,"anyOf","0"]}));return r&&{anyOf:[r,{type:"null"}]}}m(hm,"parseNullableDef");function Tm(t,e){let n=w({type:"number"},t.coerce?{[Ae]:{coerce:t.coerce||void 0}}:{});if(!t.checks)return n;for(let r of t.checks)switch(r.kind){case"int":n.type="integer",Ks(n,"type",r.message,e);break;case"min":e.target==="jsonSchema7"?r.inclusive?Se(n,"minimum",r.value,r.message,e):Se(n,"exclusiveMinimum",r.value,r.message,e):(r.inclusive||(n.exclusiveMinimum=!0),Se(n,"minimum",r.value,r.message,e));break;case"max":e.target==="jsonSchema7"?r.inclusive?Se(n,"maximum",r.value,r.message,e):Se(n,"exclusiveMaximum",r.value,r.message,e):(r.inclusive||(n.exclusiveMaximum=!0),Se(n,"maximum",r.value,r.message,e));break;case"multipleOf":Se(n,"multipleOf",r.value,r.message,e);break}return n}m(Tm,"parseNumberDef");var{zuiKey:YA}=tn,XP=m((t,e)=>{var n;return Ee.zuiType(t.unknownKeys)?t.unknownKeys.typeName==="ZodNever"?!1:(n=Pe(t.unknownKeys._def,M(w({},e),{currentPath:[...e.currentPath,"additionalProperties"]})))!=null?n:!0:t.unknownKeys==="passthrough"},"getAdditionalProperties");function vm(t,e){let n=M(w({type:"object"},Object.entries(t.shape()).reduce((r,[i,s])=>{if(s===void 0||s._def===void 0)return r;let o=Pe(s._def,M(w({},e),{currentPath:[...e.currentPath,"properties",i],propertyPath:[...e.currentPath,"properties",i]}));return o===void 0?r:{properties:M(w({},r.properties),{[i]:o}),required:s.isOptional()?r.required:[...r.required,i]}},{properties:{},required:[]})),{additionalProperties:XP(t,e)});return n.required.length||delete n.required,n}m(vm,"parseObjectDef");var QP=m((t,e)=>{var n;if(e.currentPath.toString()===((n=e.propertyPath)==null?void 0:n.toString()))return Pe(t.innerType._def,e);let r=Pe(t.innerType._def,M(w({},e),{currentPath:[...e.currentPath,"anyOf","1"]}));return r?{anyOf:[{not:{}},r]}:{}},"parseOptionalDef"),eI=m((t,e)=>{if(e.pipeStrategy==="input")return Pe(t.in._def,e);if(e.pipeStrategy==="output")return Pe(t.out._def,e);let n=Pe(t.in._def,M(w({},e),{currentPath:[...e.currentPath,"allOf","0"]})),r=Pe(t.out._def,M(w({},e),{currentPath:[...e.currentPath,"allOf",n?"1":"0"]}));return{allOf:[n,r].filter(i=>i!==void 0)}},"parsePipelineDef");function _m(t,e){return Pe(t.type._def,e)}m(_m,"parsePromiseDef");var tI=m((t,e)=>Pe(t.innerType._def,e),"parseReadonlyDef");function bm(t){return{$ref:t.uri}}m(bm,"parseRefDef");function wm(t,e){let r={type:"array",uniqueItems:!0,items:Pe(t.valueType._def,M(w({},e),{currentPath:[...e.currentPath,"items"]}))};return t.minSize&&Se(r,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&Se(r,"maxItems",t.maxSize.value,t.maxSize.message,e),r}m(wm,"parseSetDef");function xm(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((n,r)=>Pe(n._def,M(w({},e),{currentPath:[...e.currentPath,"items",`${r}`]}))).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:Pe(t.rest._def,M(w({},e),{currentPath:[...e.currentPath,"additionalItems"]}))}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((n,r)=>Pe(n._def,M(w({},e),{currentPath:[...e.currentPath,"items",`${r}`]}))).reduce((n,r)=>r===void 0?n:[...n,r],[])}}m(xm,"parseTupleDef");function Pm(){return{not:{}}}m(Pm,"parseUndefinedDef");function Im(){return{}}m(Im,"parseUnknownDef");function Pe(t,e,n=!1){let r=e.seen.get(t);if(r&&!n){let o=nI(r,e);if(o!==void 0)return o}let i={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,i);let s=iI(t,t.typeName,e);return s&&us(t,e,s),i.jsonSchema=s,s}m(Pe,"parseDef");var nI=m((t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:rI(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"),rI=m((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"),iI=m((t,e,n)=>{switch(e){case fe.ZodString:return Fs(t,n);case fe.ZodNumber:return Tm(t,n);case fe.ZodObject:return vm(t,n);case fe.ZodBigInt:return rm(t,n);case fe.ZodBoolean:return im(t);case fe.ZodDate:return sm(t,n);case fe.ZodUndefined:return Pm();case fe.ZodNull:return mm(n);case fe.ZodArray:return nm(t,n);case fe.ZodUnion:case fe.ZodDiscriminatedUnion:return ym(t,n);case fe.ZodIntersection:return cm(t,n);case fe.ZodTuple:return xm(t,n);case fe.ZodRecord:return zs(t,n);case fe.ZodRef:return bm(t);case fe.ZodLiteral:return dm(t,n);case fe.ZodEnum:return um(t);case fe.ZodNativeEnum:return pm(t);case fe.ZodNullable:return hm(t,n);case fe.ZodOptional:return QP(t,n);case fe.ZodMap:return fm(t,n);case fe.ZodSet:return wm(t,n);case fe.ZodLazy:return Pe(t.getter()._def,n);case fe.ZodPromise:return _m(t,n);case fe.ZodNaN:case fe.ZodNever:return gm();case fe.ZodEffects:return lm(t,n);case fe.ZodAny:return tm();case fe.ZodUnknown:return Im();case fe.ZodDefault:return am(t,n);case fe.ZodBranded:return om(t,n);case fe.ZodReadonly:return tI(t,n);case fe.ZodCatch:return VP(t,n);case fe.ZodPipeline:return eI(t,n);case fe.ZodFunction:case fe.ZodVoid:case fe.ZodSymbol:return;default:return(r=>{})(e)}},"selectParser"),us=m((t,e,n)=>(t.description&&(n.description=t.description,e.markdownDescription&&(n.markdownDescription=t.description)),Object.assign(n,{[Ae]:w(w({},t[Ae]),n[Ae])}),n),"addMeta"),Zc={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"},oI=m(t=>typeof t=="string"?M(w({},Zc),{name:t}):w(w({},Zc),t),"getDefaultOptions"),sI=m(t=>{let e=oI(t),n=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return M(w({},e),{currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([r,i])=>[i._def,{def:i._def,path:[...e.basePath,e.definitionPath,r],jsonSchema:void 0}]))})},"getRefs"),aI=m((t,e)=>{var n;let r=sI(e),i=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[c,f])=>{var p;return M(w({},l),{[c]:(p=Pe(f._def,M(w({},r),{currentPath:[...r.basePath,r.definitionPath,c]}),!0))!=null?p:{}})},{}):void 0,s=typeof e=="string"?e:e?.name,o=(n=Pe(t._def,s===void 0?r:M(w({},r),{currentPath:[...r.basePath,r.definitionPath,s]}),!1))!=null?n:{},a=s===void 0?i?M(w({},o),{[r.definitionPath]:i}):o:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,s].join("/"),[r.definitionPath]:M(w({},i),{[s]:o})};return r.target==="jsonSchema7"?a.$schema="http://json-schema.org/draft-07/schema#":r.target==="jsonSchema2019-09"&&(a.$schema="https://json-schema.org/draft/2019-09/schema#"),a},"zodToJsonSchema"),lI=m((t,e={target:"openApi3"})=>{let n=aI(t,e);return e.$schemaUrl===!1?delete n.$schema:typeof e.$schemaUrl=="string"&&(n.$schema=e.$schemaUrl),n},"toJSONSchemaLegacy"),{zuiKey:Fo}=tn,uI=m((t,e)=>{let n={type:"array",description:t.description,items:e(t._def.type),"x-zui":t._def["x-zui"]};return t._def[Fo]&&(n[Fo]=t._def[Fo]),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"),{zuiKey:zo}=tn,cI=m(t=>{let e={type:"number",description:t.description,"x-zui":t._def["x-zui"]};t._def[zo]&&(e[zo]=t._def[zo]);for(let n of t._def.checks)switch(n.kind){case"min":{let r=n.inclusive?"minimum":"exclusiveMinimum",i=n.inclusive?"exclusiveMinimum":"minimum";e[r]=n.value,delete e[i];break}case"max":{let r=n.inclusive?"maximum":"exclusiveMaximum",i=n.inclusive?"exclusiveMaximum":"maximum";e[r]=n.value,delete e[i];break}case"int":e.type="integer";break;case"finite":{e.format="finite";break}case"multipleOf":e.multipleOf=n.value;break;default:}return e},"zodNumberToJsonNumber"),{zuiKey:qo}=tn,dI=m((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[qo]&&(n[qo]=t._def[qo]),t._def.minSize&&(n.minItems=t._def.minSize.value),t._def.maxSize&&(n.maxItems=t._def.maxSize.value),n},"zodSetToJsonSet"),{zuiKey:Pr}=tn,fI=m((t,e)=>{let n={type:"string",description:t.description,"x-zui":t._def["x-zui"]};t._def[Pr]&&(n[Pr]=t._def[Pr]);for(let r of t._def.checks)switch(r.kind){case"cuid":n.format="cuid",n.pattern=Je.cuid;break;case"cuid2":n.format="cuid2",n.pattern=Je.cuid2;break;case"ulid":n.format="ulid",n.pattern=Je.ulid;break;case"uuid":n.format="uuid",n.pattern=Je.uuid;break;case"emoji":n.format="emoji",n.pattern=Je.emoji;break;case"email":n.format="email",n.pattern=Je.email;break;case"ip":n.format=r.version==="v6"?"ipv6":"ipv4",n.pattern=r.version==="v6"?Je.ipv6:Je.ipv4;break;case"datetime":n.format="date-time",(r.precision!==null||r.offset)&&(n.pattern=bp(r).source,n[Pr]=M(w({},n[Pr]),{precision:r.precision,offset:r.offset}));break;case"url":n.format="uri";break;case"endsWith":n.pattern=`${Ur.escapeSpecialChars(r.value)}$`;break;case"startsWith":n.pattern=`^${Ur.escapeSpecialChars(r.value)}`;break;case"includes":let i=r.position&&r.position>=1?`^(?:.{${r.position}}).*`:"";n.pattern=`${i}${Ur.escapeSpecialChars(r.value)}`;break;case"regex":n.pattern=r.regex.source;break;case"length":n.minLength=n.maxLength=Math.max(0,r.value);break;case"min":n.minLength=Math.max(0,r.value);break;case"max":n.maxLength=Math.max(0,r.value);break;default:throw new $g("ZodString",r.kind,e.toString())}return n},"zodStringToJsonString"),{zuiKey:Go}=tn,pI=m((t,e,n)=>{let r={type:"array",description:t.description,items:t._def.items.map((i,s)=>e(i,n.withIndexType("number",s)))};return t._def[Go]&&(r[Go]=t._def[Go]),t._def.rest&&(r.additionalItems=e(t._def.rest,n.withIndexType("number"))),r},"zodTupleToJsonTuple"),gI={unionStrategy:"anyOf",discriminatedUnionStrategy:"oneOf",discriminator:!0};function qs(t,e={}){return tt(t,e,new Xr)}m(qs,"toJSONSchema");function tt(t,e={},n){let r=w(w({},gI),e),i=t;switch(i.typeName){case"ZodString":return fI(i,n);case"ZodNumber":return cI(i);case"ZodNaN":throw new dt("ZodNaN",n.toString());case"ZodBigInt":throw new dt("ZodBigInt",n.toString(),{suggestedAlternative:"serialize bigint to string"});case"ZodBoolean":return{type:"boolean",description:i.description,"x-zui":i._def["x-zui"]};case"ZodDate":throw new dt("ZodDate",n.toString(),{suggestedAlternative:"use z.string().datetime() instead"});case"ZodUndefined":return Vo(i);case"ZodNull":return Jo(i);case"ZodAny":return{description:i.description,"x-zui":i._def["x-zui"]};case"ZodUnknown":return{description:i.description,"x-zui":M(w({},i._def["x-zui"]),{def:{typeName:"ZodUnknown"}})};case"ZodNever":return{not:!0,description:i.description,"x-zui":i._def["x-zui"]};case"ZodVoid":throw new dt("ZodVoid",n.toString());case"ZodArray":return uI(i,p=>tt(p,r,n.withIndexType("number")));case"ZodObject":let s=Object.entries(i.shape),o=s.filter(([p,g])=>!g.isOptional()),a=o.length?o.map(([p])=>p):void 0,l=s.map(([p,g])=>[p,g.mandatory()]).map(([p,g])=>[p,tt(g,r,n.withIndexType("key",p))]);return{type:"object",description:i.description,properties:Object.fromEntries(l),required:a,additionalProperties:mI(i._def,r,n),"x-zui":i._def["x-zui"]};case"ZodUnion":return r.unionStrategy==="oneOf"?{description:i.description,oneOf:i.options.map((p,g)=>tt(p,r,n.withIndexType("number",g))),"x-zui":i._def["x-zui"]}:{description:i.description,anyOf:i.options.map((p,g)=>tt(p,r,n.withIndexType("number",g))),"x-zui":i._def["x-zui"]};case"ZodDiscriminatedUnion":if(r.discriminatedUnionStrategy==="oneOf"){let p=r.discriminator?{propertyName:i.discriminator}:void 0;return{description:i.description,oneOf:i.options.map((g,y)=>tt(g,r,n.withIndexType("number",y))),discriminator:p,"x-zui":M(w({},i._def["x-zui"]),{def:{typeName:"ZodDiscriminatedUnion",discriminator:i.discriminator}})}}return{description:i.description,anyOf:i.options.map((p,g)=>tt(p,r,n.withIndexType("number",g))),"x-zui":M(w({},i._def["x-zui"]),{def:{typeName:"ZodDiscriminatedUnion",discriminator:i.discriminator}})};case"ZodIntersection":let c=tt(i._def.left,r,n.withIndexType("number",0)),f=tt(i._def.right,r,n.withIndexType("number",1));return"additionalProperties"in c&&delete c.additionalProperties,"additionalProperties"in f&&delete f.additionalProperties,{description:i.description,allOf:[c,f],"x-zui":i._def["x-zui"]};case"ZodTuple":return pI(i,(p,g)=>tt(p,r,g),n);case"ZodRecord":{let p=i._def.keyType,g=Ee.zuiString(p)?n.withIndexType("string"):Ee.zuiNumber(p)?n.withIndexType("number"):n.withIndexType("any");return{type:"object",description:i.description,additionalProperties:tt(i._def.valueType,r,g),"x-zui":i._def["x-zui"]}}case"ZodMap":throw new dt("ZodMap",n.toString());case"ZodSet":return dI(i,p=>tt(p,r,n.withIndexType("number")));case"ZodFunction":throw new dt("ZodFunction",n.toString());case"ZodLazy":throw new dt("ZodLazy",n.toString());case"ZodLiteral":if(typeof i.value=="string")return{type:"string",description:i.description,const:i.value,"x-zui":i._def["x-zui"]};if(typeof i.value=="number")return{type:"number",description:i.description,const:i.value,"x-zui":i._def["x-zui"]};if(typeof i.value=="boolean")return{type:"boolean",description:i.description,const:i.value,"x-zui":i._def["x-zui"]};if(i.value===null)return Jo(i._def);if(i.value===void 0)return Vo(i._def);{i.value;let p=typeof i.value;throw new eo(`Unsupported literal type: "${p}"`,n.toString())}case"ZodEnum":return{type:"string",description:i.description,enum:i._def.values,"x-zui":i._def["x-zui"]};case"ZodEffects":throw new dt("ZodEffects",n.toString());case"ZodNativeEnum":throw new dt("ZodNativeEnum",n.toString());case"ZodOptional":return{description:i.description,anyOf:[tt(i._def.innerType,r,n),Vo()],"x-zui":M(w({},i._def["x-zui"]),{def:{typeName:"ZodOptional"}})};case"ZodNullable":return{anyOf:[tt(i._def.innerType,r,n),Jo()],"x-zui":M(w({},i._def["x-zui"]),{def:{typeName:"ZodNullable"}})};case"ZodDefault":return M(w({},tt(i._def.innerType,r,n)),{default:i._def.defaultValue()});case"ZodCatch":throw new dt("ZodCatch",n.toString());case"ZodPromise":throw new dt("ZodPromise",n.toString());case"ZodBranded":throw new dt("ZodBranded",n.toString());case"ZodPipeline":throw new dt("ZodPipeline",n.toString());case"ZodSymbol":throw new dt("ZodSymbol",n.toString());case"ZodReadonly":return M(w({},tt(i._def.innerType,r,n)),{readOnly:!0});case"ZodRef":return{$ref:i._def.uri,description:i.description,"x-zui":i._def["x-zui"]};default:Ot.assertNever(i)}}m(tt,"_toJSONSchema");var Vo=m(t=>({not:!0,description:t?.description,"x-zui":M(w({},t?.["x-zui"]),{def:{typeName:"ZodUndefined"}})}),"undefinedSchema"),Jo=m(t=>({type:"null",description:t?.description,"x-zui":t?.["x-zui"]}),"nullSchema"),mI=m((t,e,n)=>t.unknownKeys==="passthrough"?!0:t.unknownKeys==="strict"||!Ee.zuiType(t.unknownKeys)||t.unknownKeys.typeName==="ZodNever"?!1:tt(t.unknownKeys,e,n.withIndexType("string")),"additionalPropertiesSchema");function Bm(t){return typeof t=="symbol"?"symbol":typeof t=="bigint"?`${t.toString()}n`:ie(t)}m(Bm,"primitiveToTypscriptLiteralType");function ie(t){return typeof t>"u"?"undefined":typeof t=="symbol"?t.description?`Symbol(${ie(t.description)})`:"Symbol()":typeof t=="bigint"?`BigInt(${t.toString()})`:typeof t=="string"?km(t):JSON.stringify(t)}m(ie,"primitiveToTypescriptValue");function ir(t){return typeof t>"u"?"undefined":JSON.stringify(t)}m(ir,"unknownToTypescriptValue");var Em=m((t,e)=>{let n=Object.entries(t),r=e?" as const":"";return`{ ${n.map(([i,s])=>`${cs(i)}: ${ir(s)}`).join(", ")} }${r}`},"recordOfUnknownToTypescriptRecord"),cs=m(t=>/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t)?t:ie(t),"toPropertyKey"),yI=m(t=>t.charAt(0).toUpperCase()+t.slice(1),"capitalize"),Sm=m(t=>{let e=/[^a-zA-Z0-9_]/g;return t.split(e).map(yI).filter(r=>!!r).join("")},"toTypeArgumentName"),Lc=m(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"),et=m(t=>{t=t?.replace(/(\n(\s*)?){3,}/g,`
|
|
70
70
|
|
|
71
71
|
`);let e=m(i=>i.startsWith("* ")?` ${i}`:` * ${i}`,"ensureLineStartsWithAsterisk"),n=m(i=>i.replace(/\*\//g,"*\\/"),"escapeCommentEnd"),r=(t??"").split(`
|
|
72
|
-
`).map(i=>i.trim());return
|
|
72
|
+
`).map(i=>i.trim());return Lc(r),r.length&&(r[0]=r[0].replace(/^\/\*\*?/,""),r[r.length-1]=r[r.length-1].replace(/\*\/$/,"")),Lc(r),r.length===0?"":r.length===1?`/** ${n(r[0])} */`:`/**
|
|
73
73
|
${r.map(e).map(n).join(`
|
|
74
74
|
`)}
|
|
75
|
-
*/`},"getMultilineComment");function
|
|
76
|
-
`:"",p=t.value.describe(""),y=
|
|
75
|
+
*/`},"getMultilineComment");function km(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}'`}m(km,"escapeString");var Am=["string","number","boolean","unknown","void","any","null","undefined","never","bigint","symbol","object"],hI=5,TI=m(t=>Am.includes(t),"isPrimitive"),vI=m(t=>Am.map(e=>`${e}[]`).includes(t),"isArrayOfPrimitives"),Yo=m(t=>t.replace(/ +/g," ").trim(),"stripSpaces"),Cm=class{constructor(e,n){this.key=e,this.value=n}};m(Cm,"KeyValue");var bi=Cm,Om=class{constructor(e){this.schema=e}};m(Om,"FnParameters");var Wc=Om,Rm=class{constructor(e){this.schema=e}};m(Rm,"FnReturn");var Kc=Rm,Mm=class{constructor(e){this.props=e}};m(Mm,"Declaration");var jr=Mm;function Gs(t,e={}){return Nm(t,new Xr,e)}m(Gs,"toTypescriptType");function Nm(t,e,n={}){let r=wI(t,n),i=xe(r,e,n);return n.formatter&&(i=n.formatter(i)),i}m(Nm,"_toTypescriptType");var Fc=m(t=>t.endsWith("?")?t:`${t}?`,"_optionalKey");function xe(t,e,n){var r,i,s;let o=M(w({},n),{declaration:!1,parent:t});if(t===null)return"";if(t instanceof jr)return _I(t,e,o);if(t instanceof bi){let l;if(Ee.zuiOptional(t.value)?l=t.value:Ee.zuiDefault(t.value)&&n.treatDefaultAsOptional&&(l=t.value._def.innerType.optional()),l){let T=l._def.innerType;return Ee.zuiType(T)&&!T.description&&l.description&&(T=T?.describe(l.description)),xe(new bi(Fc(t.key),T),e,o)}let c=et(t.value._def.description||t.value.description),f=c?.trim().length>0?`
|
|
76
|
+
`:"",p=t.value.describe(""),y=Ee.zuiAny(t.value)?Fc(t.key):t.key;return`${f}${c}${f}${y}: ${xe(p,e,o)}${f}`}if(t instanceof Wc){if(Ee.zuiTuple(t.schema)){let p="";for(let g=0;g<t.schema.items.length;g++){let y=(s=(i=(r=t.schema.items[g])==null?void 0:r.ui)==null?void 0:i.title)!=null?s:`arg${g}`,T=t.schema.items[g];p+=`${xe(new bi(cs(y),T),e.withIndexType("number",g),o)}${g<t.schema.items.length-1?", ":""} `}return p}let l=Ee.zuiLiteral(t.schema.naked()),c=xe(t.schema,e,o).trim();return c.startsWith("{")&&c.endsWith("}")||c.startsWith("[")&&c.endsWith("]")||c.startsWith("(")&&c.endsWith(")")||c.startsWith("Array<")&&c.endsWith(">")||c.startsWith("Record<")&&c.endsWith(">")||vI(c)||l?`args: ${c}`:c}if(t instanceof Kc)return Ee.zuiOptional(t.schema)?`${xe(t.schema.unwrap(),e,o)} | undefined`:xe(t.schema,e,o);let a=t;switch(a.typeName){case"ZodString":return`${et(a.description)} string`.trim();case"ZodNumber":case"ZodNaN":case"ZodBigInt":return`${et(a.description)} number`.trim();case"ZodBoolean":return`${et(a.description)} boolean`.trim();case"ZodDate":return`${et(a.description)} Date`.trim();case"ZodUndefined":return`${et(a.description)} undefined`.trim();case"ZodNull":return`${et(a.description)} null`.trim();case"ZodAny":return`${et(a.description)} any`.trim();case"ZodUnknown":return`${et(a.description)} unknown`.trim();case"ZodNever":return`${et(a.description)} never`.trim();case"ZodVoid":return`${et(a.description)} void`.trim();case"ZodArray":let l=xe(a._def.type,e.withIndexType("number"),o);return TI(l)?`${l}[]`:`Array<${l}>`;case"ZodObject":return`{ ${Object.entries(a._def.shape()).map(([B,D])=>Ee.zuiType(D)?xe(new bi(cs(B),D),e.withIndexType("key",B),o):`${B}: unknown`).join("; ")} }`;case"ZodUnion":let f=a._def.options.map((B,D)=>xe(B,e.withIndexType("number",D),o));return`${et(a.description)}
|
|
77
77
|
${f.join(" | ")}`;case"ZodDiscriminatedUnion":let p=a._def.options.map((B,D)=>xe(B,e.withIndexType("number",D),o));return`${et(a.description)}
|
|
78
|
-
${p.join(" | ")}`;case"ZodIntersection":return`${xe(a._def.left,e.withIndexType("number",0),o)} & ${xe(a._def.right,e.withIndexType("number",1),o)}`;case"ZodTuple":return a._def.items.length===0?"[]":`[${a._def.items.map((B,D)=>xe(B,e.withIndexType("number",D),o)).join(", ")}]`;case"ZodRecord":{let B=xe(a._def.keyType,e.withWrapper("KeyOf"),o),D=
|
|
78
|
+
${p.join(" | ")}`;case"ZodIntersection":return`${xe(a._def.left,e.withIndexType("number",0),o)} & ${xe(a._def.right,e.withIndexType("number",1),o)}`;case"ZodTuple":return a._def.items.length===0?"[]":`[${a._def.items.map((B,D)=>xe(B,e.withIndexType("number",D),o)).join(", ")}]`;case"ZodRecord":{let B=xe(a._def.keyType,e.withWrapper("KeyOf"),o),D=Ee.zuiString(a._def.keyType)?e.withIndexType("string"):Ee.zuiNumber(a._def.keyType)?e.withIndexType("number"):e.withIndexType("any"),$=xe(a._def.valueType,D,o);return`${et(a.description)} { [key: ${B}]: ${$} }`}case"ZodMap":{let B=Ee.zuiString(a._def.keyType)?e.withIndexType("string"):Ee.zuiNumber(a._def.keyType)?e.withIndexType("number"):e.withIndexType("any");return`Map<${xe(a._def.keyType,e.withWrapper("KeyOf"),o)}, ${xe(a._def.valueType,B,o)}>`}case"ZodSet":return`Set<${xe(a._def.valueType,e.withIndexType("number"),o)}>`;case"ZodFunction":let y=xe(new Wc(a._def.args),e.withWrapper("Parameters"),o),T=xe(new Kc(a._def.returns),e.withWrapper("ReturnType"),o),P=n?.parent instanceof jr&&n?.parent.props.type==="type";return n?.declaration&&!P?`${et(a.description)}
|
|
79
79
|
(${y}): ${T}`:`${et(a.description)}
|
|
80
|
-
(${y}) => ${T}`;case"ZodLazy":return xe(a._def.getter(),e,o);case"ZodLiteral":let I=
|
|
81
|
-
${I}`.trim();case"ZodEnum":return a._def.values.map(ie).join(" | ");case"ZodEffects":return xe(a._def.schema,e,o);case"ZodNativeEnum":throw new
|
|
82
|
-
`).length>=
|
|
83
|
-
declare function ${i}${a};${c}`);if(t.props.type==="variable")return
|
|
84
|
-
`).trim();case"ZodUnion":return`z.union([${n._def.options.map((Y,J)=>Ze(Y,e.withIndexType("number",J))).join(", ")}])${Ie(n._def)}`.trim();case"ZodDiscriminatedUnion":let a=n._def.options.map((Y,J)=>Ze(Y,e.withIndexType("number",J)));return`z.discriminatedUnion(${ie(n._def.discriminator)}, [${a.join(", ")}])${Ie(n._def)}`.trim();case"ZodIntersection":let c=Ze(n._def.left,e.withIndexType("number",0)),f=Ze(n._def.right,e.withIndexType("number",1));return`z.intersection(${c}, ${f})${Ie(n._def)}`.trim();case"ZodTuple":return`z.tuple([${n._def.items.map((Y,J)=>Ze(Y,e.withIndexType("number",J))).join(", ")}])${Ie(n._def)}`.trim();case"ZodRecord":let g=Ze(n._def.keyType,e.withWrapper("KeyOf")),y=Se.zuiString(n._def.keyType)?e.withIndexType("string"):Se.zuiNumber(n._def.keyType)?e.withIndexType("number"):e.withIndexType("any"),T=Ze(n._def.valueType,y);return`z.record(${g}, ${T})${Ie(n._def)}`.trim();case"ZodMap":let P=Ze(n._def.keyType,e.withWrapper("KeyOf")),I=Se.zuiString(n._def.keyType)?e.withIndexType("string"):Se.zuiNumber(n._def.keyType)?e.withIndexType("number"):e.withIndexType("any"),_=Ze(n._def.valueType,I);return`z.map(${P}, ${_})${Ie(n._def)}`.trim();case"ZodSet":return`z.set(${Ze(n._def.valueType,e.withIndexType("number"))})${EI(n._def)}${Ie(n._def)}`.trim();case"ZodFunction":let S=n._def.args.items.map((Y,J)=>Ze(Y,e.withWrapper("Parameters").withIndexType("number",J))),B=S.length?`.args(${S.join(", ")})`:"",D=Ze(n._def.returns,e.withWrapper("ReturnType"));return`z.function()${B}.returns(${D})${Ie(n._def)}`.trim();case"ZodLazy":return`z.lazy(() => ${Ze(n._def.getter(),e)})${Ie(n._def)}`.trim();case"ZodLiteral":return`z.literal(${ie(n._def.value)})${Ie(n._def)}`.trim();case"ZodEnum":return`z.enum([${n._def.values.map(ie).join(", ")}])${Ie(n._def)}`.trim();case"ZodEffects":throw new An("ZodEffects",e.toString());case"ZodNativeEnum":throw new An("ZodNativeEnum",e.toString());case"ZodOptional":return`z.optional(${Ze(n._def.innerType,e)})${Ie(n._def,n._def.innerType)}`.trim();case"ZodNullable":return`z.nullable(${Ze(n._def.innerType,e)})${Ie(n._def,n._def.innerType)}`.trim();case"ZodDefault":let Q=ir(n._def.defaultValue());return`z.default(${Ze(n._def.innerType,e)}, ${Q})${Ie(n._def,n._def.innerType)}`.trim();case"ZodCatch":throw new An("ZodCatch",e.toString());case"ZodPromise":return`z.promise(${Ze(n._def.type,e)})${Ie(n._def,n._def.type)}`.trim();case"ZodBranded":throw new An("ZodBranded",e.toString());case"ZodPipeline":throw new An("ZodPipeline",e.toString());case"ZodSymbol":throw new An("ZodSymbol",e.toString());case"ZodReadonly":return`z.readonly(${Ze(n._def.innerType,e)})${Ie(n._def,n._def.innerType)}`.trim();case"ZodRef":return`z.ref(${ie(n._def.uri)})${Ie(n._def)}`.trim();default:Ot.assertNever(n)}}m(Ze,"sUnwrapZod");var Ie=m((t,e)=>{let n=e?._def;return`${OI(t,n)}${CI(t,n)}`},"_addMetadata"),CI=m((t,e)=>!t.description||e&&e.description===t.description?"":`.describe(${ie(t.description)})`,"_maybeDescribe"),OI=m((t,e)=>`${RI(t,e)}${MI(t,e)}${NI(t,e)}${DI(t,e)}${HI(t,e)}${UI(t,e)}${jI(t,e)}`,"_addZuiExtensions"),RI=m((t,e)=>{var n,r;let i=(n=t[mt])==null?void 0:n.title;return!i||e&&((r=e[mt])==null?void 0:r.title)===i?"":`.title(${ie(i)})`},"_maybeTitle"),MI=m((t,e)=>{var n,r;let i=(n=t[mt])==null?void 0:n.displayAs;return!i||e&&mn((r=e[mt])==null?void 0:r.displayAs,i)?"":`.displayAs(${Im({id:i[0],params:i[1]})})`},"_maybeDisplayAs"),NI=m((t,e)=>{var n,r;let i=(n=t[mt])==null?void 0:n.disabled;return!i||e&&((r=e[mt])==null?void 0:r.disabled)===i?"":`.disabled(${i})`},"_maybeDisabled"),DI=m((t,e)=>{var n,r;let i=(n=t[mt])==null?void 0:n.hidden;return!i||e&&((r=e[mt])==null?void 0:r.hidden)===i?"":`.hidden(${i})`},"_maybeHidden"),HI=m((t,e)=>{var n,r;let i=(n=t[mt])==null?void 0:n.placeholder;return!i||e&&((r=e[mt])==null?void 0:r.placeholder)===i?"":`.placeholder(${ie(i)})`},"_maybePlaceholder"),UI=m((t,e)=>{var n,r;let i=(n=t[mt])==null?void 0:n.secret;return!i||e&&((r=e[mt])==null?void 0:r.secret)===i?"":".secret()"},"_maybeSecret"),jI=m((t,e)=>{var n,r;let i=["title","tooltip","displayAs","disabled","hidden","placeholder","secret","coerce"],s=Object.entries((n=t[mt])!=null?n:{}).filter(([o])=>!i.includes(o));if(s.length===0)return"";if(e){let o=Object.entries((r=e[mt])!=null?r:{}).filter(([a])=>!i.includes(a));if(mn(Object.fromEntries(s),Object.fromEntries(o)))return""}return`.metadata(${Im(Object.fromEntries(s))})`},"_maybeSetMetadata"),$I={};pe.prototype.toJSONSchema=function(t={}){return Fs(this,t)};pe.prototype.toTypescriptType=function(t={}){return zs(this,t)};pe.prototype.toTypescriptSchema=function(){return qs(this)};var rt=re.string().min(1),Dm=re.object({text:rt}),Hm=re.object({markdown:rt}),Um=re.object({imageUrl:rt,title:rt.optional()}),jm=re.object({audioUrl:rt,title:rt.optional()}),$m=re.object({videoUrl:rt,title:rt.optional()}),Zm=re.object({fileUrl:rt,title:rt.optional()}),Lm=re.object({latitude:re.number(),longitude:re.number(),address:re.string().optional(),title:re.string().optional()}),Wm=re.object({title:rt,subtitle:rt.optional(),imageUrl:rt.optional(),actions:re.array(re.object({action:re.enum(["postback","url","say"]),label:rt,value:rt}))}),Nm=re.object({text:rt,options:re.array(re.object({label:rt,value:rt}))}),ZI=re.object({items:re.array(Wm)}),Km=re.union([re.object({type:re.literal("text"),payload:Dm}),re.object({type:re.literal("image"),payload:Um}),re.object({type:re.literal("audio"),payload:jm}),re.object({type:re.literal("video"),payload:$m}),re.object({type:re.literal("file"),payload:Zm}),re.object({type:re.literal("location"),payload:Lm})]),LI=re.object({items:re.array(Km)}),WI={schema:Hm},KI={schema:re.object({items:re.array(re.union([...Km.options,re.object({type:re.literal("markdown"),payload:Hm})]))})},FI={text:{schema:Dm},image:{schema:Um},audio:{schema:jm},video:{schema:$m},file:{schema:Zm},location:{schema:Lm},carousel:{schema:ZI},card:{schema:Wm},dropdown:{schema:Nm},choice:{schema:Nm},bloc:{schema:LI}};E();A();k();var gC={HIDDEN_IN_STUDIO:{bpActionHiddenInStudio:"true"},AWAIT_RETURN:{bpActionAwaitReturn:"true"}},mC="x-bp-integration-identifier";E();A();k();import{isNode as zE}from"browser-or-node";E();A();k();var Gs=console;function Nt(t){if(!t.body)throw new Error("Missing body");return JSON.parse(t.body)}async function Po(t,e=8072,n=JE){if(!zE)throw new Error("This function can only be called in Node.js");let i=(Wh(),QT(Lh)).createServer(async(s,o)=>{try{let a=await qE(s);if(a.path==="/health"){o.writeHead(200).end("ok");return}let l=await t(a);o.writeHead(l?.status??200,l?.headers??{}).end(l?.body??"{}")}catch(a){let l=a instanceof Error?a.message:String(a);Gs.error("Error while handling request",{error:l??"Internal error occured"}),o.writeHead(500).end(JSON.stringify({error:l??"Internal error occured"}))}});return i.listen(e,()=>n(e)),i}async function qE(t){let e=await VE(t),n={};for(let i=0;i<t.rawHeaders.length;i+=2){let s=t.rawHeaders[i].toLowerCase(),o=t.rawHeaders[i+1];n[s]=o}let r=new URL(t.url??"",t.headers.host?`http://${t.headers.host}`:"http://botpress.cloud");return{body:e,path:r.pathname,query:GE(r.search,"?"),headers:n,method:t.method?.toUpperCase()??"GET"}}function GE(t,e){return t.indexOf(e)===0?t.slice(e.length):t}async function VE(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",i=>r+=i.toString()),t.on("error",i=>n(i)),t.on("end",()=>e(r))})}function JE(t){Gs.info(`Listening on port ${t}`)}import{isApiError as zj,RuntimeError as qj}from"@botpress/client";E();A();k();E();A();k();var Kh={};pn(Kh,{DefinitionError:()=>vt,isDefinitionError:()=>YE});E();A();k();var vt=class extends Error{__IS_SDK_ERROR__=!0;type="definition_error"},YE=t=>t instanceof vt||typeof t=="object"&&t!==null&&"__IS_SDK_ERROR__"in t&&t.__IS_SDK_ERROR__===!0&&"type"in t&&t.type==="definition_error";E();A();k();E();A();k();var $e={};pn($e,{mapKeys:()=>ek,mapValues:()=>QE,mergeRecords:()=>nk,pairs:()=>Io,stripUndefinedProps:()=>tk,values:()=>XE});E();A();k();var Io=t=>Object.entries(t),XE=t=>Object.values(t),QE=(t,e)=>Object.fromEntries(Io(t).map(([n,r])=>[n,e(r,n)])),ek=(t,e)=>Object.fromEntries(Io(t).map(([n,r])=>[e(n),r])),tk=t=>Object.fromEntries(Io(t).filter(([,e])=>e!==void 0)),nk=(t,e,n)=>{let r=[...Object.keys(t),...Object.keys(e)],i=[...new Set(r)],s={};for(let o of i){let a=t[o],l=e[o];a&&l?s[o]=n(a,l):a?s[o]=a:l&&(s[o]=l)}return s};var ue={};pn(ue,{safePush:()=>rk,unique:()=>ik});E();A();k();var rk=(t,...e)=>t?[...t,...e]:[...e],ik=t=>Array.from(new Set(t));E();A();k();var ut={};pn(ut,{setName:()=>ok});E();A();k();var ok=(t,e)=>(Object.defineProperty(t,"name",{value:e}),t);var Fh=t=>{let{name:e,version:n}=t,r={actions:{},events:{},channels:{}},i={name:e,version:n,entities:$e.mapValues(t.entities,o=>({name:o.name})),actions:{},events:{},channels:{}},s=$e.mapValues(t.entities,o=>o.schema);for(let[o,a]of Object.entries(t.definition.actions??{})){let l=a.input.schema.dereference(s),c=a.output.schema.dereference(s),f=t.actions?.[o]?.name??o;r.actions[f]={...a,...t.actions?.[o]??{},input:{schema:l},output:{schema:c}},i.actions[o]={name:f}}for(let[o,a]of Object.entries(t.definition.events??{})){let l=a.schema.dereference(s),c=t.events?.[o]?.name??o;r.events[c]={...a,...t.events?.[o]??{},schema:l},i.events[o]={name:c}}for(let[o,a]of Object.entries(t.definition.channels??{})){let l={};for(let[f,p]of Object.entries(a.messages)){let g=p.schema.dereference(s);l[f]={...p,schema:g}}let c=t.channels?.[o]?.name??o;r.channels[c]={...a,...t.channels?.[o]??{},message:{...a.message??{},tags:{...a.message?.tags??{},...t.channels?.[o]?.message?.tags??{}}},conversation:{...a.conversation??{},tags:{...a.conversation?.tags??{},...t.channels?.[o]?.conversation?.tags??{}}},messages:l},i.channels[o]={name:c}}return{resolved:r,statement:i}};E();A();k();var zh="6.11.2";var bn=zh;E();A();k();var Bo=Symbol("schemaName"),qh=t=>t?$e.mapValues(t,(n,r)=>({...n,[Bo]:r})):{},Gh=t=>Bo in t&&t[Bo]!==void 0,Vh=t=>t[Bo];E();A();k();var Fa=class{constructor(e){this.props=e;this.name=e.name,this.version=e.version,this.icon=e.icon,this.readme=e.readme,this.title=e.title,this.identifier=e.identifier,this.description=e.description,this.configuration=e.configuration,this.configurations=e.configurations,this.events=e.events,this.actions=e.actions,this.channels=e.channels,this.states=e.states,this.user=e.user,this.secrets=e.secrets,this.entities=e.entities,this.interfaces=e.interfaces,this.__advanced=e.__advanced,this.attributes=e.attributes}name;version;title;description;icon;readme;configuration;configurations;events;actions;channels;states;user;secrets;identifier;entities;interfaces;__advanced;attributes;get metadata(){return{sdkVersion:bn}}extend(e,n){let{entities:r,actions:i,events:s,channels:o}=this._callBuilder(e,n),a=this;a.interfaces??={};let l=Object.values(r).map(g=>g.name),c=l.length===0?e.name:`${e.name}<${l.join(",")}>`,{resolved:f,statement:p}=Fh({...e,entities:r,actions:$e.stripUndefinedProps(i),events:$e.stripUndefinedProps(s),channels:$e.stripUndefinedProps(o)});return a.actions=$e.mergeRecords(a.actions??{},f.actions,this._mergeActions),a.channels=$e.mergeRecords(a.channels??{},f.channels,this._mergeChannels),a.events=$e.mergeRecords(a.events??{},f.events,this._mergeEvents),a.interfaces[c]={id:e.id,...p},this}_callBuilder(e,n){let i={entities:qh(this.entities)},s=n(i),o=$e.pairs(s.entities).find(([l,c])=>!Gh(c));if(o)throw new vt(`Cannot extend interface "${e.name}" with entity "${o[0]}"; the provided schema is not part of the integration's entities.`);return{entities:$e.mapValues(s.entities,l=>({name:Vh(l),schema:l.schema})),actions:s.actions??{},events:s.events??{},channels:s.channels??{}}}_mergeActions=(e,n)=>({...e,...n,input:{schema:this._mergeObjectSchemas(e.input.schema,n.input.schema)},output:{schema:this._mergeObjectSchemas(e.output.schema,n.output.schema)}});_mergeEvents=(e,n)=>({...e,...n,schema:this._mergeObjectSchemas(e.schema,n.schema)});_mergeChannels=(e,n)=>{let r=$e.mergeRecords(e.messages,n.messages,this._mergeMessage),i;(e.conversation||n.conversation)&&(i={tags:{...e.conversation?.tags,...n.conversation?.tags}});let s;return(e.message||n.message)&&(s={tags:{...e.message?.tags,...n.message?.tags}}),{...e,...n,messages:r,conversation:i,message:s}};_mergeMessage=(e,n)=>({schema:this._mergeObjectSchemas(e.schema,n.schema)});_mergeObjectSchemas=(e,n)=>{let r=e._def,i=n._def;if(r.typeName==="ZodObject"&&i.typeName==="ZodObject"){let s=r.shape(),o=i.shape();return re.object({...s,...o})}if(r.typeName==="ZodRecord"&&i.typeName==="ZodRecord")return re.record(re.intersection(r.valueType,i.valueType));throw new Error("Cannot merge object schemas with record schemas")}};E();A();k();E();A();k();import{isApiError as Dk,Client as Hk,RuntimeError as jT,InvalidPayloadError as Uk}from"@botpress/client";E();A();k();import*as Jh from"@botpress/client";var So={retries:3,retryCondition:t=>Jh.axiosRetry.isNetworkOrIdempotentRequestError(t)||[429,502].includes(t.response?.status??0),retryDelay:(t,e)=>(ak(e.response?.headers??{})??t)*1e3},ak=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 lk(String(r))}},lk=t=>{let e=uk(t)?ck(t):t.length>0?parseInt(t,10):void 0;return e===void 0||isNaN(e)?void 0:e},uk=t=>t.includes(" "),ck=t=>{let e=dk(t);if(!e)return;let n=new Date;return Math.max(0,Math.floor((e.getTime()-n.getTime())/1e3))},dk=t=>{let e=new Date(t);return isNaN(e.getTime())?void 0:e};E();A();k();E();A();k();var ai=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));initializeIncomingMessage=(e=>this._client.initializeIncomingMessage(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)};E();A();k();var Eo=class{_cost=0;get cost(){return this._cost}setCost(e){this._cost=e}toJSON(){return{cost:this.cost}}};E();A();k();E();A();k();var Dt="#",ko="x-bot-id",Yh="x-bot-user-id",Xh="x-integration-id",Qh="x-integration-alias",eT="x-webhook-id",tT="x-bp-configuration-type",Ao="x-bp-configuration",Co="x-bp-operation",nT="x-bp-type";E();A();k();var St=t=>{throw t instanceof Error?t:new Error(t)};var i0=re.enum(["webhook_received","message_created","action_triggered","register","unregister","ping","create_user","create_conversation"]),rT=t=>({botId:t[ko]||St("Missing bot header"),botUserId:t[Yh]||St("Missing bot user header"),integrationId:t[Xh]||St("Missing integration header"),integrationAlias:t[Qh]||St("Missing integration alias header"),webhookId:t[eT]||St("Missing webhook header"),operation:t[Co]||St("Missing operation header"),configurationType:t[tT]??null,configuration:JSON.parse(z.from(t[Ao]||St("Missing configuration header"),"base64").toString("utf-8"))});E();A();k();E();A();k();E();A();k();E();A();k();var qa={},iT=!1;function pl(){return iT||(iT=!0,qa=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 i=42;e[n]=i;for(n in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==n||!Object.prototype.propertyIsEnumerable.call(e,n))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,n);if(o.value!==i||o.enumerable!==!0)return!1}return!0}),qa}var Ga={},oT=!1;function fk(){return oT||(oT=!0,Ga=Error),Ga}var Va={},sT=!1;function pk(){return sT||(sT=!0,Va=EvalError),Va}var Ja={},aT=!1;function gk(){return aT||(aT=!0,Ja=RangeError),Ja}var Ya={},lT=!1;function mk(){return lT||(lT=!0,Ya=ReferenceError),Ya}var Xa={},uT=!1;function IT(){return uT||(uT=!0,Xa=SyntaxError),Xa}var Qa={},cT=!1;function Oo(){return cT||(cT=!0,Qa=TypeError),Qa}var el={},dT=!1;function yk(){return dT||(dT=!0,el=URIError),el}var tl={},fT=!1;function hk(){if(fT)return tl;fT=!0;var t=typeof Symbol<"u"&&Symbol,e=pl();return tl=function(){return typeof t!="function"||typeof Symbol!="function"||typeof t("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},tl}var nl={},pT=!1;function Tk(){if(pT)return nl;pT=!0;var t={__proto__:null,foo:{}},e=Object;return nl=function(){return{__proto__:t}.foo===t.foo&&!(t instanceof e)},nl}var rl={},gT=!1;function vk(){if(gT)return rl;gT=!0;var t="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,n=Math.max,r="[object Function]",i=function(l,c){for(var f=[],p=0;p<l.length;p+=1)f[p]=l[p];for(var g=0;g<c.length;g+=1)f[g+l.length]=c[g];return f},s=function(l,c){for(var f=[],p=c,g=0;p<l.length;p+=1,g+=1)f[g]=l[p];return f},o=function(a,l){for(var c="",f=0;f<a.length;f+=1)c+=a[f],f+1<a.length&&(c+=l);return c};return rl=function(l){var c=this;if(typeof c!="function"||e.apply(c)!==r)throw new TypeError(t+c);for(var f=s(arguments,1),p,g=function(){if(this instanceof p){var _=c.apply(this,i(f,arguments));return Object(_)===_?_:this}return c.apply(l,i(f,arguments))},y=n(0,c.length-f.length),T=[],P=0;P<y;P++)T[P]="$"+P;if(p=Function("binder","return function ("+o(T,",")+"){ return binder.apply(this,arguments); }")(g),c.prototype){var I=function(){};I.prototype=c.prototype,p.prototype=new I,I.prototype=null}return p},rl}var il={},mT=!1;function gl(){if(mT)return il;mT=!0;var t=vk();return il=Function.prototype.bind||t,il}var ol={},yT=!1;function _k(){if(yT)return ol;yT=!0;var t=Function.prototype.call,e=Object.prototype.hasOwnProperty,n=gl();return ol=n.call(t,e),ol}var sl={},hT=!1;function ui(){if(hT)return sl;hT=!0;var t,e=fk(),n=pk(),r=gk(),i=mk(),s=IT(),o=Oo(),a=yk(),l=Function,c=function(Me){try{return l('"use strict"; return ('+Me+").constructor;")()}catch{}},f=Object.getOwnPropertyDescriptor;if(f)try{f({},"")}catch{f=null}var p=function(){throw new o},g=f?(function(){try{return arguments.callee,p}catch{try{return f(arguments,"callee").get}catch{return p}}})():p,y=hk()(),T=Tk()(),P=Object.getPrototypeOf||(T?function(Me){return Me.__proto__}:null),I={},_=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%":y&&P?P([][Symbol.iterator]()):t,"%AsyncFromSyncIteratorPrototype%":t,"%AsyncFunction%":I,"%AsyncGenerator%":I,"%AsyncGeneratorFunction%":I,"%AsyncIteratorPrototype%":I,"%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%":I,"%Int8Array%":typeof Int8Array>"u"?t:Int8Array,"%Int16Array%":typeof Int16Array>"u"?t:Int16Array,"%Int32Array%":typeof Int32Array>"u"?t:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":y&&P?P(P([][Symbol.iterator]())):t,"%JSON%":typeof JSON=="object"?JSON:t,"%Map%":typeof Map>"u"?t:Map,"%MapIteratorPrototype%":typeof Map>"u"||!y||!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%":i,"%Reflect%":typeof Reflect>"u"?t:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?t:Set,"%SetIteratorPrototype%":typeof Set>"u"||!y||!P?t:P(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?t:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":y&&P?P(""[Symbol.iterator]()):t,"%Symbol%":y?Symbol:t,"%SyntaxError%":s,"%ThrowTypeError%":g,"%TypedArray%":_,"%TypeError%":o,"%Uint8Array%":typeof Uint8Array>"u"?t:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?t:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?t:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?t:Uint32Array,"%URIError%":a,"%WeakMap%":typeof WeakMap>"u"?t:WeakMap,"%WeakRef%":typeof WeakRef>"u"?t:WeakRef,"%WeakSet%":typeof WeakSet>"u"?t:WeakSet};if(P)try{null.error}catch(Me){var B=P(P(Me));S["%Error.prototype%"]=B}var D=function Me(ve){var we;if(ve==="%AsyncFunction%")we=c("async function () {}");else if(ve==="%GeneratorFunction%")we=c("function* () {}");else if(ve==="%AsyncGeneratorFunction%")we=c("async function* () {}");else if(ve==="%AsyncGenerator%"){var se=Me("%AsyncGeneratorFunction%");se&&(we=se.prototype)}else if(ve==="%AsyncIteratorPrototype%"){var de=Me("%AsyncGenerator%");de&&P&&(we=P(de.prototype))}return S[ve]=we,we},$={__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"]},te=gl(),Q=_k(),ce=te.call(Function.call,Array.prototype.concat),Y=te.call(Function.apply,Array.prototype.splice),J=te.call(Function.call,String.prototype.replace),Be=te.call(Function.call,String.prototype.slice),We=te.call(Function.call,RegExp.prototype.exec),Qe=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,qe=/\\(\\)?/g,Ge=function(ve){var we=Be(ve,0,1),se=Be(ve,-1);if(we==="%"&&se!=="%")throw new s("invalid intrinsic syntax, expected closing `%`");if(se==="%"&&we!=="%")throw new s("invalid intrinsic syntax, expected opening `%`");var de=[];return J(ve,Qe,function(N,Z,W,le){de[de.length]=W?J(le,qe,"$1"):Z||N}),de},pt=function(ve,we){var se=ve,de;if(Q($,se)&&(de=$[se],se="%"+de[0]+"%"),Q(S,se)){var N=S[se];if(N===I&&(N=D(se)),typeof N>"u"&&!we)throw new o("intrinsic "+ve+" exists, but is not available. Please file an issue!");return{alias:de,name:se,value:N}}throw new s("intrinsic "+ve+" does not exist!")};return sl=function(ve,we){if(typeof ve!="string"||ve.length===0)throw new o("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof we!="boolean")throw new o('"allowMissing" argument must be a boolean');if(We(/^%?[^%]*%?$/,ve)===null)throw new s("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var se=Ge(ve),de=se.length>0?se[0]:"",N=pt("%"+de+"%",we),Z=N.name,W=N.value,le=!1,ge=N.alias;ge&&(de=ge[0],Y(se,ce([0,1],ge)));for(var R=1,C=!0;R<se.length;R+=1){var j=se[R],V=Be(j,0,1),ne=Be(j,-1);if((V==='"'||V==="'"||V==="`"||ne==='"'||ne==="'"||ne==="`")&&V!==ne)throw new s("property names with quotes must have matching quotes");if((j==="constructor"||!C)&&(le=!0),de+="."+j,Z="%"+de+"%",Q(S,Z))W=S[Z];else if(W!=null){if(!(j in W)){if(!we)throw new o("base intrinsic for "+ve+" exists, but the property is not available.");return}if(f&&R+1>=se.length){var b=f(W,j);C=!!b,C&&"get"in b&&!("originalValue"in b.get)?W=b.get:W=W[j]}else C=Q(W,j),W=W[j];C&&!le&&(S[Z]=W)}}return W},sl}var al={},TT=!1;function ml(){if(TT)return al;TT=!0;var t=ui(),e=t("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return al=e,al}var ll={},vT=!1;function Ro(){if(vT)return ll;vT=!0;var t=ui(),e=t("%Object.getOwnPropertyDescriptor%",!0);if(e)try{e([],"length")}catch{e=null}return ll=e,ll}var ul={},_T=!1;function bk(){if(_T)return ul;_T=!0;var t=ml(),e=IT(),n=Oo(),r=Ro();return ul=function(s,o,a){if(!s||typeof s!="object"&&typeof s!="function")throw new n("`obj` must be an object or a function`");if(typeof o!="string"&&typeof o!="symbol")throw new n("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new n("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new n("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new n("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new n("`loose`, if provided, must be a boolean");var l=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,f=arguments.length>5?arguments[5]:null,p=arguments.length>6?arguments[6]:!1,g=!!r&&r(s,o);if(t)t(s,o,{configurable:f===null&&g?g.configurable:!f,enumerable:l===null&&g?g.enumerable:!l,value:a,writable:c===null&&g?g.writable:!c});else if(p||!l&&!c&&!f)s[o]=a;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},ul}var cl={},bT=!1;function wk(){if(bT)return cl;bT=!0;var t=ml(),e=function(){return!!t};return e.hasArrayLengthDefineBug=function(){if(!t)return null;try{return t([],"length",{value:1}).length!==1}catch{return!0}},cl=e,cl}var dl={},wT=!1;function xk(){if(wT)return dl;wT=!0;var t=ui(),e=bk(),n=wk()(),r=Ro(),i=Oo(),s=t("%Math.floor%");return dl=function(a,l){if(typeof a!="function")throw new i("`fn` is not a function");if(typeof l!="number"||l<0||l>4294967295||s(l)!==l)throw new i("`length` must be a positive 32-bit integer");var c=arguments.length>2&&!!arguments[2],f=!0,p=!0;if("length"in a&&r){var g=r(a,"length");g&&!g.configurable&&(f=!1),g&&!g.writable&&(p=!1)}return(f||p||!c)&&(n?e(a,"length",l,!0,!0):e(a,"length",l)),a},dl}var li={},xT=!1;function yl(){if(xT)return li;xT=!0;var t=gl(),e=ui(),n=xk(),r=Oo(),i=e("%Function.prototype.apply%"),s=e("%Function.prototype.call%"),o=e("%Reflect.apply%",!0)||t.call(s,i),a=ml(),l=e("%Math.max%");li=function(p){if(typeof p!="function")throw new r("a function is required");var g=o(t,s,arguments);return n(g,1+l(0,p.length-(arguments.length-1)),!0)};var c=function(){return o(t,i,arguments)};return a?a(li,"apply",{value:c}):li.apply=c,li}var fl={},PT=!1;function hl(){if(PT)return fl;PT=!0;var t=ui(),e=yl(),n=e(t("String.prototype.indexOf"));return fl=function(i,s){var o=t(i,!!s);return typeof o=="function"&&n(i,".prototype.")>-1?e(o):o},fl}Vs();fa();var Tl={},BT=!1;function El(){if(BT)return Tl;BT=!0;var t=pl();return Tl=function(){return t()&&!!Symbol.toStringTag},Tl}var vl={},ST=!1;function Pk(){if(ST)return vl;ST=!0;var t=El()(),e=hl(),n=e("Object.prototype.toString"),r=function(a){return t&&a&&typeof a=="object"&&Symbol.toStringTag in a?!1:n(a)==="[object Arguments]"},i=function(a){return r(a)?!0:a!==null&&typeof a=="object"&&typeof a.length=="number"&&a.length>=0&&n(a)!=="[object Array]"&&n(a.callee)==="[object Function]"},s=(function(){return r(arguments)})();return r.isLegacyArguments=i,vl=s?r:i,vl}var _l={},ET=!1;function Ik(){if(ET)return _l;ET=!0;var t=Object.prototype.toString,e=Function.prototype.toString,n=/^\s*(?:function)?\*/,r=El()(),i=Object.getPrototypeOf,s=function(){if(!r)return!1;try{return Function("return function*() {}")()}catch{}},o;return _l=function(l){if(typeof l!="function")return!1;if(n.test(e.call(l)))return!0;if(!r){var c=t.call(l);return c==="[object GeneratorFunction]"}if(!i)return!1;if(typeof o>"u"){var f=s();o=f?i(f):!1}return i(l)===o},_l}var bl={},kT=!1;function Bk(){if(kT)return bl;kT=!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 i=/^\s*class\b/,s=function(B){try{var D=t.call(B);return i.test(D)}catch{return!1}},o=function(B){try{return s(B)?!1:(t.call(B),!0)}catch{return!1}},a=Object.prototype.toString,l="[object Object]",c="[object Function]",f="[object GeneratorFunction]",p="[object HTMLAllCollection]",g="[object HTML document.all class]",y="[object HTMLCollection]",T=typeof Symbol=="function"&&!!Symbol.toStringTag,P=!(0 in[,]),I=function(){return!1};if(typeof document=="object"){var _=document.all;a.call(_)===a.call(document.all)&&(I=function(B){if((P||!B)&&(typeof B>"u"||typeof B=="object"))try{var D=a.call(B);return(D===p||D===g||D===y||D===l)&&B("")==null}catch{}return!1})}return bl=e?function(B){if(I(B))return!0;if(!B||typeof B!="function"&&typeof B!="object")return!1;try{e(B,null,n)}catch(D){if(D!==r)return!1}return!s(B)&&o(B)}:function(B){if(I(B))return!0;if(!B||typeof B!="function"&&typeof B!="object")return!1;if(T)return o(B);if(s(B))return!1;var D=a.call(B);return D!==c&&D!==f&&!/^\[object HTML/.test(D)?!1:o(B)},bl}var wl={},AT=!1;function Sk(){if(AT)return wl;AT=!0;var t=Bk(),e=Object.prototype.toString,n=Object.prototype.hasOwnProperty,r=function(l,c,f){for(var p=0,g=l.length;p<g;p++)n.call(l,p)&&(f==null?c(l[p],p,l):c.call(f,l[p],p,l))},i=function(l,c,f){for(var p=0,g=l.length;p<g;p++)f==null?c(l.charAt(p),p,l):c.call(f,l.charAt(p),p,l)},s=function(l,c,f){for(var p in l)n.call(l,p)&&(f==null?c(l[p],p,l):c.call(f,l[p],p,l))},o=function(l,c,f){if(!t(c))throw new TypeError("iterator must be a function");var p;arguments.length>=3&&(p=f),e.call(l)==="[object Array]"?r(l,c,p):typeof l=="string"?i(l,c,p):s(l,c,p)};return wl=o,wl}var xl={},CT=!1;function Ek(){return CT||(CT=!0,xl=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),xl}var Pl={},OT=!1,kk=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function Ak(){if(OT)return Pl;OT=!0;var t=Ek(),e=typeof globalThis>"u"?kk:globalThis;return Pl=function(){for(var r=[],i=0;i<t.length;i++)typeof e[t[i]]=="function"&&(r[r.length]=t[i]);return r},Pl}var Il={},RT=!1,Ck=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function UT(){if(RT)return Il;RT=!0;var t=Sk(),e=Ak(),n=yl(),r=hl(),i=Ro(),s=r("Object.prototype.toString"),o=El()(),a=typeof globalThis>"u"?Ck:globalThis,l=e(),c=r("String.prototype.slice"),f=Object.getPrototypeOf,p=r("Array.prototype.indexOf",!0)||function(I,_){for(var S=0;S<I.length;S+=1)if(I[S]===_)return S;return-1},g={__proto__:null};o&&i&&f?t(l,function(P){var I=new a[P];if(Symbol.toStringTag in I){var _=f(I),S=i(_,Symbol.toStringTag);if(!S){var B=f(_);S=i(B,Symbol.toStringTag)}g["$"+P]=n(S.get)}}):t(l,function(P){var I=new a[P],_=I.slice||I.set;_&&(g["$"+P]=n(_))});var y=function(I){var _=!1;return t(g,function(S,B){if(!_)try{"$"+S(I)===B&&(_=c(B,1))}catch{}}),_},T=function(I){var _=!1;return t(g,function(S,B){if(!_)try{S(I),_=c(B,1)}catch{}}),_};return Il=function(I){if(!I||typeof I!="object")return!1;if(!o){var _=c(s(I),8,-1);return p(l,_)>-1?_:_!=="Object"?!1:T(I)}return i?y(I):null},Il}var Bl={},MT=!1;function Ok(){if(MT)return Bl;MT=!0;var t=UT();return Bl=function(n){return!!t(n)},Bl}var he={},NT=!1;function Rk(){if(NT)return he;NT=!0;var t=Pk(),e=Ik(),n=UT(),r=Ok();function i(U){return U.call.bind(U)}var s=typeof BigInt<"u",o=typeof Symbol<"u",a=i(Object.prototype.toString),l=i(Number.prototype.valueOf),c=i(String.prototype.valueOf),f=i(Boolean.prototype.valueOf);if(s)var p=i(BigInt.prototype.valueOf);if(o)var g=i(Symbol.prototype.valueOf);function y(U,At){if(typeof U!="object")return!1;try{return At(U),!0}catch{return!1}}he.isArgumentsObject=t,he.isGeneratorFunction=e,he.isTypedArray=r;function T(U){return typeof Promise<"u"&&U instanceof Promise||U!==null&&typeof U=="object"&&typeof U.then=="function"&&typeof U.catch=="function"}he.isPromise=T;function P(U){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(U):r(U)||N(U)}he.isArrayBufferView=P;function I(U){return n(U)==="Uint8Array"}he.isUint8Array=I;function _(U){return n(U)==="Uint8ClampedArray"}he.isUint8ClampedArray=_;function S(U){return n(U)==="Uint16Array"}he.isUint16Array=S;function B(U){return n(U)==="Uint32Array"}he.isUint32Array=B;function D(U){return n(U)==="Int8Array"}he.isInt8Array=D;function $(U){return n(U)==="Int16Array"}he.isInt16Array=$;function te(U){return n(U)==="Int32Array"}he.isInt32Array=te;function Q(U){return n(U)==="Float32Array"}he.isFloat32Array=Q;function ce(U){return n(U)==="Float64Array"}he.isFloat64Array=ce;function Y(U){return n(U)==="BigInt64Array"}he.isBigInt64Array=Y;function J(U){return n(U)==="BigUint64Array"}he.isBigUint64Array=J;function Be(U){return a(U)==="[object Map]"}Be.working=typeof Map<"u"&&Be(new Map);function We(U){return typeof Map>"u"?!1:Be.working?Be(U):U instanceof Map}he.isMap=We;function Qe(U){return a(U)==="[object Set]"}Qe.working=typeof Set<"u"&&Qe(new Set);function qe(U){return typeof Set>"u"?!1:Qe.working?Qe(U):U instanceof Set}he.isSet=qe;function Ge(U){return a(U)==="[object WeakMap]"}Ge.working=typeof WeakMap<"u"&&Ge(new WeakMap);function pt(U){return typeof WeakMap>"u"?!1:Ge.working?Ge(U):U instanceof WeakMap}he.isWeakMap=pt;function Me(U){return a(U)==="[object WeakSet]"}Me.working=typeof WeakSet<"u"&&Me(new WeakSet);function ve(U){return Me(U)}he.isWeakSet=ve;function we(U){return a(U)==="[object ArrayBuffer]"}we.working=typeof ArrayBuffer<"u"&&we(new ArrayBuffer);function se(U){return typeof ArrayBuffer>"u"?!1:we.working?we(U):U instanceof ArrayBuffer}he.isArrayBuffer=se;function de(U){return a(U)==="[object DataView]"}de.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&de(new DataView(new ArrayBuffer(1),0,1));function N(U){return typeof DataView>"u"?!1:de.working?de(U):U instanceof DataView}he.isDataView=N;var Z=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function W(U){return a(U)==="[object SharedArrayBuffer]"}function le(U){return typeof Z>"u"?!1:(typeof W.working>"u"&&(W.working=W(new Z)),W.working?W(U):U instanceof Z)}he.isSharedArrayBuffer=le;function ge(U){return a(U)==="[object AsyncFunction]"}he.isAsyncFunction=ge;function R(U){return a(U)==="[object Map Iterator]"}he.isMapIterator=R;function C(U){return a(U)==="[object Set Iterator]"}he.isSetIterator=C;function j(U){return a(U)==="[object Generator]"}he.isGeneratorObject=j;function V(U){return a(U)==="[object WebAssembly.Module]"}he.isWebAssemblyCompiledModule=V;function ne(U){return y(U,l)}he.isNumberObject=ne;function b(U){return y(U,c)}he.isStringObject=b;function x(U){return y(U,f)}he.isBooleanObject=x;function F(U){return s&&y(U,p)}he.isBigIntObject=F;function X(U){return o&&y(U,g)}he.isSymbolObject=X;function ke(U){return ne(U)||b(U)||x(U)||F(U)||X(U)}he.isBoxedPrimitive=ke;function me(U){return typeof Uint8Array<"u"&&(se(U)||le(U))}return he.isAnyArrayBuffer=me,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(U){Object.defineProperty(he,U,{enumerable:!1,value:function(){throw new Error(U+" is not supported in userland")}})}),he}var Sl={},DT=!1;function Mk(){return DT||(DT=!0,Sl=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"}),Sl}var Te={},HT=!1,ci=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function Nk(){if(HT)return Te;HT=!0;var t=Mt,e=Object.getOwnPropertyDescriptors||function(Z){for(var W=Object.keys(Z),le={},ge=0;ge<W.length;ge++)le[W[ge]]=Object.getOwnPropertyDescriptor(Z,W[ge]);return le},n=/%[sdj%]/g;Te.format=function(N){if(!$(N)){for(var Z=[],W=0;W<arguments.length;W++)Z.push(o(arguments[W]));return Z.join(" ")}for(var W=1,le=arguments,ge=le.length,R=String(N).replace(n,function(j){if(j==="%%")return"%";if(W>=ge)return j;switch(j){case"%s":return String(le[W++]);case"%d":return Number(le[W++]);case"%j":try{return JSON.stringify(le[W++])}catch{return"[Circular]"}default:return j}}),C=le[W];W<ge;C=le[++W])S(C)||!Y(C)?R+=" "+C:R+=" "+o(C);return R},Te.deprecate=function(N,Z){if(typeof t<"u"&&t.noDeprecation===!0)return N;if(typeof t>"u")return function(){return Te.deprecate(N,Z).apply(this||ci,arguments)};var W=!1;function le(){if(!W){if(t.throwDeprecation)throw new Error(Z);t.traceDeprecation?console.trace(Z):console.error(Z),W=!0}return N.apply(this||ci,arguments)}return le};var r={},i=/^$/;if(t.env.NODE_DEBUG){var s=t.env.NODE_DEBUG;s=s.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),i=new RegExp("^"+s+"$","i")}Te.debuglog=function(N){if(N=N.toUpperCase(),!r[N])if(i.test(N)){var Z=t.pid;r[N]=function(){var W=Te.format.apply(Te,arguments);console.error("%s %d: %s",N,Z,W)}}else r[N]=function(){};return r[N]};function o(N,Z){var W={seen:[],stylize:l};return arguments.length>=3&&(W.depth=arguments[2]),arguments.length>=4&&(W.colors=arguments[3]),_(Z)?W.showHidden=Z:Z&&Te._extend(W,Z),Q(W.showHidden)&&(W.showHidden=!1),Q(W.depth)&&(W.depth=2),Q(W.colors)&&(W.colors=!1),Q(W.customInspect)&&(W.customInspect=!0),W.colors&&(W.stylize=a),f(W,N,W.depth)}Te.inspect=o,o.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]},o.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function a(N,Z){var W=o.styles[Z];return W?"\x1B["+o.colors[W][0]+"m"+N+"\x1B["+o.colors[W][1]+"m":N}function l(N,Z){return N}function c(N){var Z={};return N.forEach(function(W,le){Z[W]=!0}),Z}function f(N,Z,W){if(N.customInspect&&Z&&We(Z.inspect)&&Z.inspect!==Te.inspect&&!(Z.constructor&&Z.constructor.prototype===Z)){var le=Z.inspect(W,N);return $(le)||(le=f(N,le,W)),le}var ge=p(N,Z);if(ge)return ge;var R=Object.keys(Z),C=c(R);if(N.showHidden&&(R=Object.getOwnPropertyNames(Z)),Be(Z)&&(R.indexOf("message")>=0||R.indexOf("description")>=0))return g(Z);if(R.length===0){if(We(Z)){var j=Z.name?": "+Z.name:"";return N.stylize("[Function"+j+"]","special")}if(ce(Z))return N.stylize(RegExp.prototype.toString.call(Z),"regexp");if(J(Z))return N.stylize(Date.prototype.toString.call(Z),"date");if(Be(Z))return g(Z)}var V="",ne=!1,b=["{","}"];if(I(Z)&&(ne=!0,b=["[","]"]),We(Z)){var x=Z.name?": "+Z.name:"";V=" [Function"+x+"]"}if(ce(Z)&&(V=" "+RegExp.prototype.toString.call(Z)),J(Z)&&(V=" "+Date.prototype.toUTCString.call(Z)),Be(Z)&&(V=" "+g(Z)),R.length===0&&(!ne||Z.length==0))return b[0]+V+b[1];if(W<0)return ce(Z)?N.stylize(RegExp.prototype.toString.call(Z),"regexp"):N.stylize("[Object]","special");N.seen.push(Z);var F;return ne?F=y(N,Z,W,C,R):F=R.map(function(X){return T(N,Z,W,C,X,ne)}),N.seen.pop(),P(F,V,b)}function p(N,Z){if(Q(Z))return N.stylize("undefined","undefined");if($(Z)){var W="'"+JSON.stringify(Z).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return N.stylize(W,"string")}if(D(Z))return N.stylize(""+Z,"number");if(_(Z))return N.stylize(""+Z,"boolean");if(S(Z))return N.stylize("null","null")}function g(N){return"["+Error.prototype.toString.call(N)+"]"}function y(N,Z,W,le,ge){for(var R=[],C=0,j=Z.length;C<j;++C)ve(Z,String(C))?R.push(T(N,Z,W,le,String(C),!0)):R.push("");return ge.forEach(function(V){V.match(/^\d+$/)||R.push(T(N,Z,W,le,V,!0))}),R}function T(N,Z,W,le,ge,R){var C,j,V;if(V=Object.getOwnPropertyDescriptor(Z,ge)||{value:Z[ge]},V.get?V.set?j=N.stylize("[Getter/Setter]","special"):j=N.stylize("[Getter]","special"):V.set&&(j=N.stylize("[Setter]","special")),ve(le,ge)||(C="["+ge+"]"),j||(N.seen.indexOf(V.value)<0?(S(W)?j=f(N,V.value,null):j=f(N,V.value,W-1),j.indexOf(`
|
|
80
|
+
(${y}) => ${T}`;case"ZodLazy":return xe(a._def.getter(),e,o);case"ZodLiteral":let I=Bm(a._def.value);return`${et(a.description)}
|
|
81
|
+
${I}`.trim();case"ZodEnum":return a._def.values.map(ie).join(" | ");case"ZodEffects":return xe(a._def.schema,e,o);case"ZodNativeEnum":throw new zg("ZodNativeEnum",e.toString());case"ZodOptional":return`${xe(a._def.innerType,e,o)} | undefined`;case"ZodNullable":return`${xe(a._def.innerType,e,o)} | null`;case"ZodDefault":let E=n.treatDefaultAsOptional?a._def.innerType.optional():a._def.innerType;return xe(E,e,o);case"ZodCatch":return xe(a._def.innerType,e,o);case"ZodPromise":return`Promise<${xe(a._def.type,e,o)}>`;case"ZodBranded":return xe(a._def.type,e,o);case"ZodPipeline":return xe(a._def.in,e,o);case"ZodSymbol":return`${et(a.description)} symbol`.trim();case"ZodReadonly":return`Readonly<${xe(a._def.innerType,e,o)}>`;case"ZodRef":return Sm(a._def.uri);default:Ot.assertNever(a)}}m(xe,"sUnwrapZod");var _I=m((t,e,n)=>{if(t.props.type==="none")return xe(t.props.schema,e,n);let{schema:r,identifier:i}=t.props,s=et(r.description),o=r.describe(""),a=xe(o,e,M(w({},n),{declaration:!0})),c=a.split(`
|
|
82
|
+
`).length>=hI&&n.includeClosingTags?`// end of ${i}`:"";if(t.props.type!=="type"&&r.typeName==="ZodFunction")return Yo(`${s}
|
|
83
|
+
declare function ${i}${a};${c}`);if(t.props.type==="variable")return Yo(`${s}declare const ${i}: ${a};${c}`);let f=t.props.args.length>0?`<${t.props.args.map(Sm).join(", ")}>`:"";return Yo(`${s}type ${t.props.identifier}${f} = ${a};${c}`)},"unwrapDeclaration"),bI=m(t=>t.declaration?t.declaration===!0?"variable":t.declaration:"none","getDeclarationType"),wI=m((t,e)=>{let n=bI(e),r=t.getReferences();if(n==="none"){if(r.length>0)throw new as;return new jr({type:"none",schema:t})}let i="title"in t.ui?t.ui.title:null;if(!i)throw new Gg;if(n==="variable"){if(r.length>0)throw new as;return new jr({type:"variable",identifier:i,schema:t})}return new jr({type:"type",identifier:i,schema:t,args:r})},"getDeclarationProps"),xI=m(t=>{let e=[];if(t.exactLength){let{value:n,message:r}=t.exactLength;e.push(`.length(${ie(n)}, ${ie(r)})`)}if(t.minLength){let{value:n,message:r}=t.minLength;e.push(`.min(${ie(n)}, ${ie(r)})`)}if(t.maxLength){let{value:n,message:r}=t.maxLength;e.push(`.max(${ie(n)}, ${ie(r)})`)}return e.join("")},"generateArrayChecks"),PI=m(t=>{let e=t.checks;return e.length===0?"":e.map(II).join("")},"generateBigIntChecks"),II=m(t=>{switch(t.kind){case"min":return`.min(${ie(t.value)}, ${ie(t.message)})`;case"max":return`.max(${ie(t.value)}, ${ie(t.message)})`;case"multipleOf":return`.multipleOf(${ie(t.value)}, ${ie(t.message)})`;default:return""}},"_generateBigIntCheck"),BI=m(t=>{let e=t.checks;return e.length===0?"":e.map(EI).join("")},"generateDateChecks"),EI=m(t=>{switch(t.kind){case"min":return`.min(${zc(t.value)}, ${ie(t.message)})`;case"max":return`.max(${zc(t.value)}, ${ie(t.message)})`;default:return""}},"_generateDateCheck"),zc=m(t=>`new Date(${t})`,"dateTs"),SI=m(t=>{let e=t.checks;return e.length===0?"":e.map(kI).join("")},"generateNumberChecks"),kI=m(t=>{switch(t.kind){case"min":return`.min(${ie(t.value)}, ${ie(t.message)})`;case"max":return`.max(${ie(t.value)}, ${ie(t.message)})`;case"int":return`.int(${ie(t.message)})`;case"multipleOf":return`.multipleOf(${ie(t.value)}, ${ie(t.message)})`;case"finite":return`.finite(${ie(t.message)})`;default:return""}},"_generateNumberCheck"),AI=m(t=>{let e=[];if(t.minSize){let{value:n,message:r}=t.minSize;e.push(`.min(${ie(n)}, ${ie(r)})`)}if(t.maxSize){let{value:n,message:r}=t.maxSize;e.push(`.max(${ie(n)}, ${ie(r)})`)}return e.join("")},"generateSetChecks"),CI=m(t=>{let e=t.checks;return e.length===0?"":e.map(OI).join("")},"generateStringChecks"),OI=m(t=>{switch(t.kind){case"min":return`.min(${ie(t.value)}, ${ie(t.message)})`;case"max":return`.max(${ie(t.value)}, ${ie(t.message)})`;case"length":return`.length(${ie(t.value)}, ${ie(t.message)})`;case"email":return`.email(${ie(t.message)})`;case"url":return`.url(${ie(t.message)})`;case"emoji":return`.emoji(${ie(t.message)})`;case"uuid":return`.uuid(${ie(t.message)})`;case"cuid":return`.cuid(${ie(t.message)})`;case"cuid2":return`.cuid2(${ie(t.message)})`;case"ulid":return`.ulid(${ie(t.message)})`;case"includes":let e=ir({message:t.message,position:t.position});return`.includes(${ie(t.value)}, ${e})`;case"startsWith":return`.startsWith(${ie(t.value)}, ${ie(t.message)})`;case"endsWith":return`.endsWith(${ie(t.value)}, ${ie(t.message)})`;case"regex":return`.regex(${String(t.regex)}, ${ie(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(${ir({message:t.message,precision:r,offset:t.offset})})`;case"ip":return`.ip(${ir({message:t.message,version:t.version})})`;default:return""}},"_generateStringCheck"),{zuiKey:mt}=tn;function Vs(t){return Dm(t,new Xr)}m(Vs,"toTypescriptSchema");function Dm(t,e){return Ze(t,e)}m(Dm,"_toTypescriptSchema");function Ze(t,e){let n=t;switch(n.typeName){case"ZodString":return`z.string()${CI(n._def)}${Ie(n._def)}`.trim();case"ZodNumber":return`z.number()${SI(n._def)}${Ie(n._def)}`.trim();case"ZodNaN":return`z.nan()${Ie(n._def)}`.trim();case"ZodBigInt":return`z.bigint()${PI(n._def)}${Ie(n._def)}`.trim();case"ZodBoolean":return`z.boolean()${Ie(n._def)}`.trim();case"ZodDate":return`z.date()${BI(n._def)}${Ie(n._def)}`.trim();case"ZodUndefined":return`z.undefined()${Ie(n._def)}`.trim();case"ZodNull":return`z.null()${Ie(n._def)}`.trim();case"ZodAny":return`z.any()${Ie(n._def)}`.trim();case"ZodUnknown":return`z.unknown()${Ie(n._def)}`.trim();case"ZodNever":return`z.never()${Ie(n._def)}`.trim();case"ZodVoid":return`z.void()${Ie(n._def)}`.trim();case"ZodArray":return`z.array(${Ze(n._def.type,e.withIndexType("number"))})${xI(n._def)}${Ie(n._def,n._def.type)}`;case"ZodObject":let r={};for(let[Y,J]of Object.entries(n.shape))r[Y]=Ze(J,e.withIndexType("key",Y));let i=n.additionalProperties(),s=i?`.catchall(${Ze(i,e.withIndexType("string"))})`:"";return["z.object({",...Object.entries(r).map(([Y,J])=>` ${Y}: ${J},`),`})${s}${Ie(n._def)}`].join(`
|
|
84
|
+
`).trim();case"ZodUnion":return`z.union([${n._def.options.map((Y,J)=>Ze(Y,e.withIndexType("number",J))).join(", ")}])${Ie(n._def)}`.trim();case"ZodDiscriminatedUnion":let a=n._def.options.map((Y,J)=>Ze(Y,e.withIndexType("number",J)));return`z.discriminatedUnion(${ie(n._def.discriminator)}, [${a.join(", ")}])${Ie(n._def)}`.trim();case"ZodIntersection":let c=Ze(n._def.left,e.withIndexType("number",0)),f=Ze(n._def.right,e.withIndexType("number",1));return`z.intersection(${c}, ${f})${Ie(n._def)}`.trim();case"ZodTuple":return`z.tuple([${n._def.items.map((Y,J)=>Ze(Y,e.withIndexType("number",J))).join(", ")}])${Ie(n._def)}`.trim();case"ZodRecord":let g=Ze(n._def.keyType,e.withWrapper("KeyOf")),y=Ee.zuiString(n._def.keyType)?e.withIndexType("string"):Ee.zuiNumber(n._def.keyType)?e.withIndexType("number"):e.withIndexType("any"),T=Ze(n._def.valueType,y);return`z.record(${g}, ${T})${Ie(n._def)}`.trim();case"ZodMap":let P=Ze(n._def.keyType,e.withWrapper("KeyOf")),I=Ee.zuiString(n._def.keyType)?e.withIndexType("string"):Ee.zuiNumber(n._def.keyType)?e.withIndexType("number"):e.withIndexType("any"),_=Ze(n._def.valueType,I);return`z.map(${P}, ${_})${Ie(n._def)}`.trim();case"ZodSet":return`z.set(${Ze(n._def.valueType,e.withIndexType("number"))})${AI(n._def)}${Ie(n._def)}`.trim();case"ZodFunction":let E=n._def.args.items.map((Y,J)=>Ze(Y,e.withWrapper("Parameters").withIndexType("number",J))),B=E.length?`.args(${E.join(", ")})`:"",D=Ze(n._def.returns,e.withWrapper("ReturnType"));return`z.function()${B}.returns(${D})${Ie(n._def)}`.trim();case"ZodLazy":return`z.lazy(() => ${Ze(n._def.getter(),e)})${Ie(n._def)}`.trim();case"ZodLiteral":return`z.literal(${ie(n._def.value)})${Ie(n._def)}`.trim();case"ZodEnum":return`z.enum([${n._def.values.map(ie).join(", ")}])${Ie(n._def)}`.trim();case"ZodEffects":throw new An("ZodEffects",e.toString());case"ZodNativeEnum":throw new An("ZodNativeEnum",e.toString());case"ZodOptional":return`z.optional(${Ze(n._def.innerType,e)})${Ie(n._def,n._def.innerType)}`.trim();case"ZodNullable":return`z.nullable(${Ze(n._def.innerType,e)})${Ie(n._def,n._def.innerType)}`.trim();case"ZodDefault":let Q=ir(n._def.defaultValue());return`z.default(${Ze(n._def.innerType,e)}, ${Q})${Ie(n._def,n._def.innerType)}`.trim();case"ZodCatch":throw new An("ZodCatch",e.toString());case"ZodPromise":return`z.promise(${Ze(n._def.type,e)})${Ie(n._def,n._def.type)}`.trim();case"ZodBranded":throw new An("ZodBranded",e.toString());case"ZodPipeline":throw new An("ZodPipeline",e.toString());case"ZodSymbol":throw new An("ZodSymbol",e.toString());case"ZodReadonly":return`z.readonly(${Ze(n._def.innerType,e)})${Ie(n._def,n._def.innerType)}`.trim();case"ZodRef":return`z.ref(${ie(n._def.uri)})${Ie(n._def)}`.trim();default:Ot.assertNever(n)}}m(Ze,"sUnwrapZod");var Ie=m((t,e)=>{let n=e?._def;return`${MI(t,n)}${RI(t,n)}`},"_addMetadata"),RI=m((t,e)=>!t.description||e&&e.description===t.description?"":`.describe(${ie(t.description)})`,"_maybeDescribe"),MI=m((t,e)=>`${NI(t,e)}${DI(t,e)}${HI(t,e)}${UI(t,e)}${jI(t,e)}${$I(t,e)}${ZI(t,e)}`,"_addZuiExtensions"),NI=m((t,e)=>{var n,r;let i=(n=t[mt])==null?void 0:n.title;return!i||e&&((r=e[mt])==null?void 0:r.title)===i?"":`.title(${ie(i)})`},"_maybeTitle"),DI=m((t,e)=>{var n,r;let i=(n=t[mt])==null?void 0:n.displayAs;return!i||e&&mn((r=e[mt])==null?void 0:r.displayAs,i)?"":`.displayAs(${Em({id:i[0],params:i[1]})})`},"_maybeDisplayAs"),HI=m((t,e)=>{var n,r;let i=(n=t[mt])==null?void 0:n.disabled;return!i||e&&((r=e[mt])==null?void 0:r.disabled)===i?"":`.disabled(${i})`},"_maybeDisabled"),UI=m((t,e)=>{var n,r;let i=(n=t[mt])==null?void 0:n.hidden;return!i||e&&((r=e[mt])==null?void 0:r.hidden)===i?"":`.hidden(${i})`},"_maybeHidden"),jI=m((t,e)=>{var n,r;let i=(n=t[mt])==null?void 0:n.placeholder;return!i||e&&((r=e[mt])==null?void 0:r.placeholder)===i?"":`.placeholder(${ie(i)})`},"_maybePlaceholder"),$I=m((t,e)=>{var n,r;let i=(n=t[mt])==null?void 0:n.secret;return!i||e&&((r=e[mt])==null?void 0:r.secret)===i?"":".secret()"},"_maybeSecret"),ZI=m((t,e)=>{var n,r;let i=["title","tooltip","displayAs","disabled","hidden","placeholder","secret","coerce"],s=Object.entries((n=t[mt])!=null?n:{}).filter(([o])=>!i.includes(o));if(s.length===0)return"";if(e){let o=Object.entries((r=e[mt])!=null?r:{}).filter(([a])=>!i.includes(a));if(mn(Object.fromEntries(s),Object.fromEntries(o)))return""}return`.metadata(${Em(Object.fromEntries(s))})`},"_maybeSetMetadata"),LI={};pe.prototype.toJSONSchema=function(t={}){return qs(this,t)};pe.prototype.toTypescriptType=function(t={}){return Gs(this,t)};pe.prototype.toTypescriptSchema=function(){return Vs(this)};var rt=re.string().min(1),Um=re.object({text:rt}),jm=re.object({markdown:rt}),$m=re.object({imageUrl:rt,title:rt.optional()}),Zm=re.object({audioUrl:rt,title:rt.optional()}),Lm=re.object({videoUrl:rt,title:rt.optional()}),Wm=re.object({fileUrl:rt,title:rt.optional()}),Km=re.object({latitude:re.number(),longitude:re.number(),address:re.string().optional(),title:re.string().optional()}),Fm=re.object({title:rt,subtitle:rt.optional(),imageUrl:rt.optional(),actions:re.array(re.object({action:re.enum(["postback","url","say"]),label:rt,value:rt}))}),Hm=re.object({text:rt,options:re.array(re.object({label:rt,value:rt}))}),WI=re.object({items:re.array(Fm)}),zm=re.union([re.object({type:re.literal("text"),payload:Um}),re.object({type:re.literal("image"),payload:$m}),re.object({type:re.literal("audio"),payload:Zm}),re.object({type:re.literal("video"),payload:Lm}),re.object({type:re.literal("file"),payload:Wm}),re.object({type:re.literal("location"),payload:Km})]),KI=re.object({items:re.array(zm)}),FI={schema:jm},zI={schema:re.object({items:re.array(re.union([...zm.options,re.object({type:re.literal("markdown"),payload:jm})]))})},qI={text:{schema:Um},image:{schema:$m},audio:{schema:Zm},video:{schema:Lm},file:{schema:Wm},location:{schema:Km},carousel:{schema:WI},card:{schema:Fm},dropdown:{schema:Hm},choice:{schema:Hm},bloc:{schema:KI}};S();A();k();var yC={HIDDEN_IN_STUDIO:{bpActionHiddenInStudio:"true"},AWAIT_RETURN:{bpActionAwaitReturn:"true"}},hC="x-bp-integration-identifier";S();A();k();import{isNode as GS}from"browser-or-node";S();A();k();var Js=console;function Nt(t){if(!t.body)throw new Error("Missing body");return JSON.parse(t.body)}async function Po(t,e=8072,n=XS){if(!GS)throw new Error("This function can only be called in Node.js");let i=(Fh(),tv(Kh)).createServer(async(s,o)=>{try{let a=await VS(s);if(a.path==="/health"){o.writeHead(200).end("ok");return}let l=await t(a);o.writeHead(l?.status??200,l?.headers??{}).end(l?.body??"{}")}catch(a){let l=a instanceof Error?a.message:String(a);Js.error("Error while handling request",{error:l??"Internal error occured"}),o.writeHead(500).end(JSON.stringify({error:l??"Internal error occured"}))}});return i.listen(e,()=>n(e)),i}async function VS(t){let e=await YS(t),n={};for(let i=0;i<t.rawHeaders.length;i+=2){let s=t.rawHeaders[i].toLowerCase(),o=t.rawHeaders[i+1];n[s]=o}let r=new URL(t.url??"",t.headers.host?`http://${t.headers.host}`:"http://botpress.cloud");return{body:e,path:r.pathname,query:JS(r.search,"?"),headers:n,method:t.method?.toUpperCase()??"GET"}}function JS(t,e){return t.indexOf(e)===0?t.slice(e.length):t}async function YS(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",i=>r+=i.toString()),t.on("error",i=>n(i)),t.on("end",()=>e(r))})}function XS(t){Js.info(`Listening on port ${t}`)}import{isApiError as e$,RuntimeError as t$}from"@botpress/client";S();A();k();S();A();k();var zh={};pn(zh,{DefinitionError:()=>vt,isDefinitionError:()=>QS});S();A();k();var vt=class extends Error{__IS_SDK_ERROR__=!0;type="definition_error"},QS=t=>t instanceof vt||typeof t=="object"&&t!==null&&"__IS_SDK_ERROR__"in t&&t.__IS_SDK_ERROR__===!0&&"type"in t&&t.type==="definition_error";S();A();k();S();A();k();var $e={};pn($e,{mapKeys:()=>nk,mapValues:()=>tk,mergeRecords:()=>ik,pairs:()=>Io,stripUndefinedProps:()=>rk,values:()=>ek});S();A();k();var Io=t=>Object.entries(t),ek=t=>Object.values(t),tk=(t,e)=>Object.fromEntries(Io(t).map(([n,r])=>[n,e(r,n)])),nk=(t,e)=>Object.fromEntries(Io(t).map(([n,r])=>[e(n),r])),rk=t=>Object.fromEntries(Io(t).filter(([,e])=>e!==void 0)),ik=(t,e,n)=>{let r=[...Object.keys(t),...Object.keys(e)],i=[...new Set(r)],s={};for(let o of i){let a=t[o],l=e[o];a&&l?s[o]=n(a,l):a?s[o]=a:l&&(s[o]=l)}return s};var ue={};pn(ue,{safePush:()=>ok,unique:()=>sk});S();A();k();var ok=(t,...e)=>t?[...t,...e]:[...e],sk=t=>Array.from(new Set(t));S();A();k();var ut={};pn(ut,{setName:()=>ak});S();A();k();var ak=(t,e)=>(Object.defineProperty(t,"name",{value:e}),t);var qh=t=>{let{name:e,version:n}=t,r={actions:{},events:{},channels:{}},i={name:e,version:n,entities:$e.mapValues(t.entities,o=>({name:o.name})),actions:{},events:{},channels:{}},s=$e.mapValues(t.entities,o=>o.schema);for(let[o,a]of Object.entries(t.definition.actions??{})){let l=a.input.schema.dereference(s),c=a.output.schema.dereference(s),f=t.actions?.[o]?.name??o;r.actions[f]={...a,...t.actions?.[o]??{},input:{schema:l},output:{schema:c}},i.actions[o]={name:f}}for(let[o,a]of Object.entries(t.definition.events??{})){let l=a.schema.dereference(s),c=t.events?.[o]?.name??o;r.events[c]={...a,...t.events?.[o]??{},schema:l},i.events[o]={name:c}}for(let[o,a]of Object.entries(t.definition.channels??{})){let l={};for(let[f,p]of Object.entries(a.messages)){let g=p.schema.dereference(s);l[f]={...p,schema:g}}let c=t.channels?.[o]?.name??o;r.channels[c]={...a,...t.channels?.[o]??{},message:{...a.message??{},tags:{...a.message?.tags??{},...t.channels?.[o]?.message?.tags??{}}},conversation:{...a.conversation??{},tags:{...a.conversation?.tags??{},...t.channels?.[o]?.conversation?.tags??{}}},messages:l},i.channels[o]={name:c}}return{resolved:r,statement:i}};S();A();k();var Gh="6.12.0";var bn=Gh;S();A();k();var Bo=Symbol("schemaName"),Vh=t=>t?$e.mapValues(t,(n,r)=>({...n,[Bo]:r})):{},Jh=t=>Bo in t&&t[Bo]!==void 0,Yh=t=>t[Bo];S();A();k();var qa=class{constructor(e){this.props=e;this.name=e.name,this.version=e.version,this.icon=e.icon,this.readme=e.readme,this.title=e.title,this.identifier=e.identifier,this.description=e.description,this.configuration=e.configuration,this.configurations=e.configurations,this.events=e.events,this.actions=e.actions,this.channels=e.channels,this.states=e.states,this.user=e.user,this.secrets=e.secrets,this.entities=e.entities,this.interfaces=e.interfaces,this.__advanced=e.__advanced,this.attributes=e.attributes}name;version;title;description;icon;readme;configuration;configurations;events;actions;channels;states;user;secrets;identifier;entities;interfaces;__advanced;attributes;get metadata(){return{sdkVersion:bn}}extend(e,n){let{entities:r,actions:i,events:s,channels:o}=this._callBuilder(e,n),a=this;a.interfaces??={};let l=Object.values(r).map(g=>g.name),c=l.length===0?e.name:`${e.name}<${l.join(",")}>`,{resolved:f,statement:p}=qh({...e,entities:r,actions:$e.stripUndefinedProps(i),events:$e.stripUndefinedProps(s),channels:$e.stripUndefinedProps(o)});return a.actions=$e.mergeRecords(a.actions??{},f.actions,this._mergeActions),a.channels=$e.mergeRecords(a.channels??{},f.channels,this._mergeChannels),a.events=$e.mergeRecords(a.events??{},f.events,this._mergeEvents),a.interfaces[c]={id:e.id,...p},this}_callBuilder(e,n){let i={entities:Vh(this.entities)},s=n(i),o=$e.pairs(s.entities).find(([l,c])=>!Jh(c));if(o)throw new vt(`Cannot extend interface "${e.name}" with entity "${o[0]}"; the provided schema is not part of the integration's entities.`);return{entities:$e.mapValues(s.entities,l=>({name:Yh(l),schema:l.schema})),actions:s.actions??{},events:s.events??{},channels:s.channels??{}}}_mergeActions=(e,n)=>({...e,...n,input:{schema:this._mergeObjectSchemas(e.input.schema,n.input.schema)},output:{schema:this._mergeObjectSchemas(e.output.schema,n.output.schema)}});_mergeEvents=(e,n)=>({...e,...n,schema:this._mergeObjectSchemas(e.schema,n.schema)});_mergeChannels=(e,n)=>{let r=$e.mergeRecords(e.messages,n.messages,this._mergeMessage),i;(e.conversation||n.conversation)&&(i={tags:{...e.conversation?.tags,...n.conversation?.tags}});let s;return(e.message||n.message)&&(s={tags:{...e.message?.tags,...n.message?.tags}}),{...e,...n,messages:r,conversation:i,message:s}};_mergeMessage=(e,n)=>({schema:this._mergeObjectSchemas(e.schema,n.schema)});_mergeObjectSchemas=(e,n)=>{let r=e._def,i=n._def;if(r.typeName==="ZodObject"&&i.typeName==="ZodObject"){let s=r.shape(),o=i.shape();return re.object({...s,...o})}if(r.typeName==="ZodRecord"&&i.typeName==="ZodRecord")return re.record(re.intersection(r.valueType,i.valueType));throw new Error("Cannot merge object schemas with record schemas")}};S();A();k();S();A();k();import{isApiError as Uk,Client as jk,RuntimeError as ZT,InvalidPayloadError as $k}from"@botpress/client";S();A();k();import*as Xh from"@botpress/client";var Eo={retries:3,retryCondition:t=>Xh.axiosRetry.isNetworkOrIdempotentRequestError(t)||[429,502].includes(t.response?.status??0),retryDelay:(t,e)=>(uk(e.response?.headers??{})??t)*1e3},uk=t=>{let e=["RateLimit-Reset","X-RateLimit-Reset","Retry-After","ratelimit-reset","x-ratelimit-reset","retry-after"];for(let n of e){let r=t[n];if(r!==void 0)return ck(String(r))}},ck=t=>{let e=dk(t)?fk(t):t.length>0?parseInt(t,10):void 0;return e===void 0||isNaN(e)?void 0:e},dk=t=>t.includes(" "),fk=t=>{let e=pk(t);if(!e)return;let n=new Date;return Math.max(0,Math.floor((e.getTime()-n.getTime())/1e3))},pk=t=>{let e=new Date(t);return isNaN(e.getTime())?void 0:e};S();A();k();S();A();k();var ai=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));initializeIncomingMessage=(e=>this._client.initializeIncomingMessage(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)};S();A();k();var So=class{_cost=0;get cost(){return this._cost}setCost(e){this._cost=e}toJSON(){return{cost:this.cost}}};S();A();k();S();A();k();var Dt="#",ko="x-bot-id",Qh="x-bot-user-id",eT="x-integration-id",tT="x-integration-alias",nT="x-webhook-id",rT="x-bp-configuration-type",Ao="x-bp-configuration",Co="x-bp-operation",iT="x-bp-type";S();A();k();var Et=t=>{throw t instanceof Error?t:new Error(t)};var s0=re.enum(["webhook_received","message_created","action_triggered","register","unregister","ping","create_user","create_conversation"]),oT=t=>({botId:t[ko]||Et("Missing bot header"),botUserId:t[Qh]||Et("Missing bot user header"),integrationId:t[eT]||Et("Missing integration header"),integrationAlias:t[tT]||Et("Missing integration alias header"),webhookId:t[nT]||Et("Missing webhook header"),operation:t[Co]||Et("Missing operation header"),configurationType:t[rT]??null,configuration:JSON.parse(z.from(t[Ao]||Et("Missing configuration header"),"base64").toString("utf-8"))});S();A();k();S();A();k();S();A();k();S();A();k();var Va={},sT=!1;function ml(){return sT||(sT=!0,Va=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 i=42;e[n]=i;for(n in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==n||!Object.prototype.propertyIsEnumerable.call(e,n))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,n);if(o.value!==i||o.enumerable!==!0)return!1}return!0}),Va}var Ja={},aT=!1;function gk(){return aT||(aT=!0,Ja=Error),Ja}var Ya={},lT=!1;function mk(){return lT||(lT=!0,Ya=EvalError),Ya}var Xa={},uT=!1;function yk(){return uT||(uT=!0,Xa=RangeError),Xa}var Qa={},cT=!1;function hk(){return cT||(cT=!0,Qa=ReferenceError),Qa}var el={},dT=!1;function ET(){return dT||(dT=!0,el=SyntaxError),el}var tl={},fT=!1;function Oo(){return fT||(fT=!0,tl=TypeError),tl}var nl={},pT=!1;function Tk(){return pT||(pT=!0,nl=URIError),nl}var rl={},gT=!1;function vk(){if(gT)return rl;gT=!0;var t=typeof Symbol<"u"&&Symbol,e=ml();return rl=function(){return typeof t!="function"||typeof Symbol!="function"||typeof t("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},rl}var il={},mT=!1;function _k(){if(mT)return il;mT=!0;var t={__proto__:null,foo:{}},e=Object;return il=function(){return{__proto__:t}.foo===t.foo&&!(t instanceof e)},il}var ol={},yT=!1;function bk(){if(yT)return ol;yT=!0;var t="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,n=Math.max,r="[object Function]",i=function(l,c){for(var f=[],p=0;p<l.length;p+=1)f[p]=l[p];for(var g=0;g<c.length;g+=1)f[g+l.length]=c[g];return f},s=function(l,c){for(var f=[],p=c,g=0;p<l.length;p+=1,g+=1)f[g]=l[p];return f},o=function(a,l){for(var c="",f=0;f<a.length;f+=1)c+=a[f],f+1<a.length&&(c+=l);return c};return ol=function(l){var c=this;if(typeof c!="function"||e.apply(c)!==r)throw new TypeError(t+c);for(var f=s(arguments,1),p,g=function(){if(this instanceof p){var _=c.apply(this,i(f,arguments));return Object(_)===_?_:this}return c.apply(l,i(f,arguments))},y=n(0,c.length-f.length),T=[],P=0;P<y;P++)T[P]="$"+P;if(p=Function("binder","return function ("+o(T,",")+"){ return binder.apply(this,arguments); }")(g),c.prototype){var I=function(){};I.prototype=c.prototype,p.prototype=new I,I.prototype=null}return p},ol}var sl={},hT=!1;function yl(){if(hT)return sl;hT=!0;var t=bk();return sl=Function.prototype.bind||t,sl}var al={},TT=!1;function wk(){if(TT)return al;TT=!0;var t=Function.prototype.call,e=Object.prototype.hasOwnProperty,n=yl();return al=n.call(t,e),al}var ll={},vT=!1;function ui(){if(vT)return ll;vT=!0;var t,e=gk(),n=mk(),r=yk(),i=hk(),s=ET(),o=Oo(),a=Tk(),l=Function,c=function(Me){try{return l('"use strict"; return ('+Me+").constructor;")()}catch{}},f=Object.getOwnPropertyDescriptor;if(f)try{f({},"")}catch{f=null}var p=function(){throw new o},g=f?(function(){try{return arguments.callee,p}catch{try{return f(arguments,"callee").get}catch{return p}}})():p,y=vk()(),T=_k()(),P=Object.getPrototypeOf||(T?function(Me){return Me.__proto__}:null),I={},_=typeof Uint8Array>"u"||!P?t:P(Uint8Array),E={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?t:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?t:ArrayBuffer,"%ArrayIteratorPrototype%":y&&P?P([][Symbol.iterator]()):t,"%AsyncFromSyncIteratorPrototype%":t,"%AsyncFunction%":I,"%AsyncGenerator%":I,"%AsyncGeneratorFunction%":I,"%AsyncIteratorPrototype%":I,"%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%":I,"%Int8Array%":typeof Int8Array>"u"?t:Int8Array,"%Int16Array%":typeof Int16Array>"u"?t:Int16Array,"%Int32Array%":typeof Int32Array>"u"?t:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":y&&P?P(P([][Symbol.iterator]())):t,"%JSON%":typeof JSON=="object"?JSON:t,"%Map%":typeof Map>"u"?t:Map,"%MapIteratorPrototype%":typeof Map>"u"||!y||!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%":i,"%Reflect%":typeof Reflect>"u"?t:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?t:Set,"%SetIteratorPrototype%":typeof Set>"u"||!y||!P?t:P(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?t:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":y&&P?P(""[Symbol.iterator]()):t,"%Symbol%":y?Symbol:t,"%SyntaxError%":s,"%ThrowTypeError%":g,"%TypedArray%":_,"%TypeError%":o,"%Uint8Array%":typeof Uint8Array>"u"?t:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?t:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?t:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?t:Uint32Array,"%URIError%":a,"%WeakMap%":typeof WeakMap>"u"?t:WeakMap,"%WeakRef%":typeof WeakRef>"u"?t:WeakRef,"%WeakSet%":typeof WeakSet>"u"?t:WeakSet};if(P)try{null.error}catch(Me){var B=P(P(Me));E["%Error.prototype%"]=B}var D=function Me(ve){var we;if(ve==="%AsyncFunction%")we=c("async function () {}");else if(ve==="%GeneratorFunction%")we=c("function* () {}");else if(ve==="%AsyncGeneratorFunction%")we=c("async function* () {}");else if(ve==="%AsyncGenerator%"){var se=Me("%AsyncGeneratorFunction%");se&&(we=se.prototype)}else if(ve==="%AsyncIteratorPrototype%"){var de=Me("%AsyncGenerator%");de&&P&&(we=P(de.prototype))}return E[ve]=we,we},$={__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"]},te=yl(),Q=wk(),ce=te.call(Function.call,Array.prototype.concat),Y=te.call(Function.apply,Array.prototype.splice),J=te.call(Function.call,String.prototype.replace),Be=te.call(Function.call,String.prototype.slice),We=te.call(Function.call,RegExp.prototype.exec),Qe=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,qe=/\\(\\)?/g,Ge=function(ve){var we=Be(ve,0,1),se=Be(ve,-1);if(we==="%"&&se!=="%")throw new s("invalid intrinsic syntax, expected closing `%`");if(se==="%"&&we!=="%")throw new s("invalid intrinsic syntax, expected opening `%`");var de=[];return J(ve,Qe,function(N,Z,W,le){de[de.length]=W?J(le,qe,"$1"):Z||N}),de},pt=function(ve,we){var se=ve,de;if(Q($,se)&&(de=$[se],se="%"+de[0]+"%"),Q(E,se)){var N=E[se];if(N===I&&(N=D(se)),typeof N>"u"&&!we)throw new o("intrinsic "+ve+" exists, but is not available. Please file an issue!");return{alias:de,name:se,value:N}}throw new s("intrinsic "+ve+" does not exist!")};return ll=function(ve,we){if(typeof ve!="string"||ve.length===0)throw new o("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof we!="boolean")throw new o('"allowMissing" argument must be a boolean');if(We(/^%?[^%]*%?$/,ve)===null)throw new s("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var se=Ge(ve),de=se.length>0?se[0]:"",N=pt("%"+de+"%",we),Z=N.name,W=N.value,le=!1,ge=N.alias;ge&&(de=ge[0],Y(se,ce([0,1],ge)));for(var R=1,C=!0;R<se.length;R+=1){var j=se[R],V=Be(j,0,1),ne=Be(j,-1);if((V==='"'||V==="'"||V==="`"||ne==='"'||ne==="'"||ne==="`")&&V!==ne)throw new s("property names with quotes must have matching quotes");if((j==="constructor"||!C)&&(le=!0),de+="."+j,Z="%"+de+"%",Q(E,Z))W=E[Z];else if(W!=null){if(!(j in W)){if(!we)throw new o("base intrinsic for "+ve+" exists, but the property is not available.");return}if(f&&R+1>=se.length){var b=f(W,j);C=!!b,C&&"get"in b&&!("originalValue"in b.get)?W=b.get:W=W[j]}else C=Q(W,j),W=W[j];C&&!le&&(E[Z]=W)}}return W},ll}var ul={},_T=!1;function hl(){if(_T)return ul;_T=!0;var t=ui(),e=t("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return ul=e,ul}var cl={},bT=!1;function Ro(){if(bT)return cl;bT=!0;var t=ui(),e=t("%Object.getOwnPropertyDescriptor%",!0);if(e)try{e([],"length")}catch{e=null}return cl=e,cl}var dl={},wT=!1;function xk(){if(wT)return dl;wT=!0;var t=hl(),e=ET(),n=Oo(),r=Ro();return dl=function(s,o,a){if(!s||typeof s!="object"&&typeof s!="function")throw new n("`obj` must be an object or a function`");if(typeof o!="string"&&typeof o!="symbol")throw new n("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new n("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new n("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new n("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new n("`loose`, if provided, must be a boolean");var l=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,f=arguments.length>5?arguments[5]:null,p=arguments.length>6?arguments[6]:!1,g=!!r&&r(s,o);if(t)t(s,o,{configurable:f===null&&g?g.configurable:!f,enumerable:l===null&&g?g.enumerable:!l,value:a,writable:c===null&&g?g.writable:!c});else if(p||!l&&!c&&!f)s[o]=a;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},dl}var fl={},xT=!1;function Pk(){if(xT)return fl;xT=!0;var t=hl(),e=function(){return!!t};return e.hasArrayLengthDefineBug=function(){if(!t)return null;try{return t([],"length",{value:1}).length!==1}catch{return!0}},fl=e,fl}var pl={},PT=!1;function Ik(){if(PT)return pl;PT=!0;var t=ui(),e=xk(),n=Pk()(),r=Ro(),i=Oo(),s=t("%Math.floor%");return pl=function(a,l){if(typeof a!="function")throw new i("`fn` is not a function");if(typeof l!="number"||l<0||l>4294967295||s(l)!==l)throw new i("`length` must be a positive 32-bit integer");var c=arguments.length>2&&!!arguments[2],f=!0,p=!0;if("length"in a&&r){var g=r(a,"length");g&&!g.configurable&&(f=!1),g&&!g.writable&&(p=!1)}return(f||p||!c)&&(n?e(a,"length",l,!0,!0):e(a,"length",l)),a},pl}var li={},IT=!1;function Tl(){if(IT)return li;IT=!0;var t=yl(),e=ui(),n=Ik(),r=Oo(),i=e("%Function.prototype.apply%"),s=e("%Function.prototype.call%"),o=e("%Reflect.apply%",!0)||t.call(s,i),a=hl(),l=e("%Math.max%");li=function(p){if(typeof p!="function")throw new r("a function is required");var g=o(t,s,arguments);return n(g,1+l(0,p.length-(arguments.length-1)),!0)};var c=function(){return o(t,i,arguments)};return a?a(li,"apply",{value:c}):li.apply=c,li}var gl={},BT=!1;function vl(){if(BT)return gl;BT=!0;var t=ui(),e=Tl(),n=e(t("String.prototype.indexOf"));return gl=function(i,s){var o=t(i,!!s);return typeof o=="function"&&n(i,".prototype.")>-1?e(o):o},gl}Ys();ga();var _l={},ST=!1;function Al(){if(ST)return _l;ST=!0;var t=ml();return _l=function(){return t()&&!!Symbol.toStringTag},_l}var bl={},kT=!1;function Bk(){if(kT)return bl;kT=!0;var t=Al()(),e=vl(),n=e("Object.prototype.toString"),r=function(a){return t&&a&&typeof a=="object"&&Symbol.toStringTag in a?!1:n(a)==="[object Arguments]"},i=function(a){return r(a)?!0:a!==null&&typeof a=="object"&&typeof a.length=="number"&&a.length>=0&&n(a)!=="[object Array]"&&n(a.callee)==="[object Function]"},s=(function(){return r(arguments)})();return r.isLegacyArguments=i,bl=s?r:i,bl}var wl={},AT=!1;function Ek(){if(AT)return wl;AT=!0;var t=Object.prototype.toString,e=Function.prototype.toString,n=/^\s*(?:function)?\*/,r=Al()(),i=Object.getPrototypeOf,s=function(){if(!r)return!1;try{return Function("return function*() {}")()}catch{}},o;return wl=function(l){if(typeof l!="function")return!1;if(n.test(e.call(l)))return!0;if(!r){var c=t.call(l);return c==="[object GeneratorFunction]"}if(!i)return!1;if(typeof o>"u"){var f=s();o=f?i(f):!1}return i(l)===o},wl}var xl={},CT=!1;function Sk(){if(CT)return xl;CT=!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(E){E!==r&&(e=null)}else e=null;var i=/^\s*class\b/,s=function(B){try{var D=t.call(B);return i.test(D)}catch{return!1}},o=function(B){try{return s(B)?!1:(t.call(B),!0)}catch{return!1}},a=Object.prototype.toString,l="[object Object]",c="[object Function]",f="[object GeneratorFunction]",p="[object HTMLAllCollection]",g="[object HTML document.all class]",y="[object HTMLCollection]",T=typeof Symbol=="function"&&!!Symbol.toStringTag,P=!(0 in[,]),I=function(){return!1};if(typeof document=="object"){var _=document.all;a.call(_)===a.call(document.all)&&(I=function(B){if((P||!B)&&(typeof B>"u"||typeof B=="object"))try{var D=a.call(B);return(D===p||D===g||D===y||D===l)&&B("")==null}catch{}return!1})}return xl=e?function(B){if(I(B))return!0;if(!B||typeof B!="function"&&typeof B!="object")return!1;try{e(B,null,n)}catch(D){if(D!==r)return!1}return!s(B)&&o(B)}:function(B){if(I(B))return!0;if(!B||typeof B!="function"&&typeof B!="object")return!1;if(T)return o(B);if(s(B))return!1;var D=a.call(B);return D!==c&&D!==f&&!/^\[object HTML/.test(D)?!1:o(B)},xl}var Pl={},OT=!1;function kk(){if(OT)return Pl;OT=!0;var t=Sk(),e=Object.prototype.toString,n=Object.prototype.hasOwnProperty,r=function(l,c,f){for(var p=0,g=l.length;p<g;p++)n.call(l,p)&&(f==null?c(l[p],p,l):c.call(f,l[p],p,l))},i=function(l,c,f){for(var p=0,g=l.length;p<g;p++)f==null?c(l.charAt(p),p,l):c.call(f,l.charAt(p),p,l)},s=function(l,c,f){for(var p in l)n.call(l,p)&&(f==null?c(l[p],p,l):c.call(f,l[p],p,l))},o=function(l,c,f){if(!t(c))throw new TypeError("iterator must be a function");var p;arguments.length>=3&&(p=f),e.call(l)==="[object Array]"?r(l,c,p):typeof l=="string"?i(l,c,p):s(l,c,p)};return Pl=o,Pl}var Il={},RT=!1;function Ak(){return RT||(RT=!0,Il=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),Il}var Bl={},MT=!1,Ck=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function Ok(){if(MT)return Bl;MT=!0;var t=Ak(),e=typeof globalThis>"u"?Ck:globalThis;return Bl=function(){for(var r=[],i=0;i<t.length;i++)typeof e[t[i]]=="function"&&(r[r.length]=t[i]);return r},Bl}var El={},NT=!1,Rk=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function $T(){if(NT)return El;NT=!0;var t=kk(),e=Ok(),n=Tl(),r=vl(),i=Ro(),s=r("Object.prototype.toString"),o=Al()(),a=typeof globalThis>"u"?Rk:globalThis,l=e(),c=r("String.prototype.slice"),f=Object.getPrototypeOf,p=r("Array.prototype.indexOf",!0)||function(I,_){for(var E=0;E<I.length;E+=1)if(I[E]===_)return E;return-1},g={__proto__:null};o&&i&&f?t(l,function(P){var I=new a[P];if(Symbol.toStringTag in I){var _=f(I),E=i(_,Symbol.toStringTag);if(!E){var B=f(_);E=i(B,Symbol.toStringTag)}g["$"+P]=n(E.get)}}):t(l,function(P){var I=new a[P],_=I.slice||I.set;_&&(g["$"+P]=n(_))});var y=function(I){var _=!1;return t(g,function(E,B){if(!_)try{"$"+E(I)===B&&(_=c(B,1))}catch{}}),_},T=function(I){var _=!1;return t(g,function(E,B){if(!_)try{E(I),_=c(B,1)}catch{}}),_};return El=function(I){if(!I||typeof I!="object")return!1;if(!o){var _=c(s(I),8,-1);return p(l,_)>-1?_:_!=="Object"?!1:T(I)}return i?y(I):null},El}var Sl={},DT=!1;function Mk(){if(DT)return Sl;DT=!0;var t=$T();return Sl=function(n){return!!t(n)},Sl}var he={},HT=!1;function Nk(){if(HT)return he;HT=!0;var t=Bk(),e=Ek(),n=$T(),r=Mk();function i(U){return U.call.bind(U)}var s=typeof BigInt<"u",o=typeof Symbol<"u",a=i(Object.prototype.toString),l=i(Number.prototype.valueOf),c=i(String.prototype.valueOf),f=i(Boolean.prototype.valueOf);if(s)var p=i(BigInt.prototype.valueOf);if(o)var g=i(Symbol.prototype.valueOf);function y(U,At){if(typeof U!="object")return!1;try{return At(U),!0}catch{return!1}}he.isArgumentsObject=t,he.isGeneratorFunction=e,he.isTypedArray=r;function T(U){return typeof Promise<"u"&&U instanceof Promise||U!==null&&typeof U=="object"&&typeof U.then=="function"&&typeof U.catch=="function"}he.isPromise=T;function P(U){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(U):r(U)||N(U)}he.isArrayBufferView=P;function I(U){return n(U)==="Uint8Array"}he.isUint8Array=I;function _(U){return n(U)==="Uint8ClampedArray"}he.isUint8ClampedArray=_;function E(U){return n(U)==="Uint16Array"}he.isUint16Array=E;function B(U){return n(U)==="Uint32Array"}he.isUint32Array=B;function D(U){return n(U)==="Int8Array"}he.isInt8Array=D;function $(U){return n(U)==="Int16Array"}he.isInt16Array=$;function te(U){return n(U)==="Int32Array"}he.isInt32Array=te;function Q(U){return n(U)==="Float32Array"}he.isFloat32Array=Q;function ce(U){return n(U)==="Float64Array"}he.isFloat64Array=ce;function Y(U){return n(U)==="BigInt64Array"}he.isBigInt64Array=Y;function J(U){return n(U)==="BigUint64Array"}he.isBigUint64Array=J;function Be(U){return a(U)==="[object Map]"}Be.working=typeof Map<"u"&&Be(new Map);function We(U){return typeof Map>"u"?!1:Be.working?Be(U):U instanceof Map}he.isMap=We;function Qe(U){return a(U)==="[object Set]"}Qe.working=typeof Set<"u"&&Qe(new Set);function qe(U){return typeof Set>"u"?!1:Qe.working?Qe(U):U instanceof Set}he.isSet=qe;function Ge(U){return a(U)==="[object WeakMap]"}Ge.working=typeof WeakMap<"u"&&Ge(new WeakMap);function pt(U){return typeof WeakMap>"u"?!1:Ge.working?Ge(U):U instanceof WeakMap}he.isWeakMap=pt;function Me(U){return a(U)==="[object WeakSet]"}Me.working=typeof WeakSet<"u"&&Me(new WeakSet);function ve(U){return Me(U)}he.isWeakSet=ve;function we(U){return a(U)==="[object ArrayBuffer]"}we.working=typeof ArrayBuffer<"u"&&we(new ArrayBuffer);function se(U){return typeof ArrayBuffer>"u"?!1:we.working?we(U):U instanceof ArrayBuffer}he.isArrayBuffer=se;function de(U){return a(U)==="[object DataView]"}de.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&de(new DataView(new ArrayBuffer(1),0,1));function N(U){return typeof DataView>"u"?!1:de.working?de(U):U instanceof DataView}he.isDataView=N;var Z=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function W(U){return a(U)==="[object SharedArrayBuffer]"}function le(U){return typeof Z>"u"?!1:(typeof W.working>"u"&&(W.working=W(new Z)),W.working?W(U):U instanceof Z)}he.isSharedArrayBuffer=le;function ge(U){return a(U)==="[object AsyncFunction]"}he.isAsyncFunction=ge;function R(U){return a(U)==="[object Map Iterator]"}he.isMapIterator=R;function C(U){return a(U)==="[object Set Iterator]"}he.isSetIterator=C;function j(U){return a(U)==="[object Generator]"}he.isGeneratorObject=j;function V(U){return a(U)==="[object WebAssembly.Module]"}he.isWebAssemblyCompiledModule=V;function ne(U){return y(U,l)}he.isNumberObject=ne;function b(U){return y(U,c)}he.isStringObject=b;function x(U){return y(U,f)}he.isBooleanObject=x;function F(U){return s&&y(U,p)}he.isBigIntObject=F;function X(U){return o&&y(U,g)}he.isSymbolObject=X;function ke(U){return ne(U)||b(U)||x(U)||F(U)||X(U)}he.isBoxedPrimitive=ke;function me(U){return typeof Uint8Array<"u"&&(se(U)||le(U))}return he.isAnyArrayBuffer=me,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(U){Object.defineProperty(he,U,{enumerable:!1,value:function(){throw new Error(U+" is not supported in userland")}})}),he}var kl={},UT=!1;function Dk(){return UT||(UT=!0,kl=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"}),kl}var Te={},jT=!1,ci=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function Hk(){if(jT)return Te;jT=!0;var t=Mt,e=Object.getOwnPropertyDescriptors||function(Z){for(var W=Object.keys(Z),le={},ge=0;ge<W.length;ge++)le[W[ge]]=Object.getOwnPropertyDescriptor(Z,W[ge]);return le},n=/%[sdj%]/g;Te.format=function(N){if(!$(N)){for(var Z=[],W=0;W<arguments.length;W++)Z.push(o(arguments[W]));return Z.join(" ")}for(var W=1,le=arguments,ge=le.length,R=String(N).replace(n,function(j){if(j==="%%")return"%";if(W>=ge)return j;switch(j){case"%s":return String(le[W++]);case"%d":return Number(le[W++]);case"%j":try{return JSON.stringify(le[W++])}catch{return"[Circular]"}default:return j}}),C=le[W];W<ge;C=le[++W])E(C)||!Y(C)?R+=" "+C:R+=" "+o(C);return R},Te.deprecate=function(N,Z){if(typeof t<"u"&&t.noDeprecation===!0)return N;if(typeof t>"u")return function(){return Te.deprecate(N,Z).apply(this||ci,arguments)};var W=!1;function le(){if(!W){if(t.throwDeprecation)throw new Error(Z);t.traceDeprecation?console.trace(Z):console.error(Z),W=!0}return N.apply(this||ci,arguments)}return le};var r={},i=/^$/;if(t.env.NODE_DEBUG){var s=t.env.NODE_DEBUG;s=s.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),i=new RegExp("^"+s+"$","i")}Te.debuglog=function(N){if(N=N.toUpperCase(),!r[N])if(i.test(N)){var Z=t.pid;r[N]=function(){var W=Te.format.apply(Te,arguments);console.error("%s %d: %s",N,Z,W)}}else r[N]=function(){};return r[N]};function o(N,Z){var W={seen:[],stylize:l};return arguments.length>=3&&(W.depth=arguments[2]),arguments.length>=4&&(W.colors=arguments[3]),_(Z)?W.showHidden=Z:Z&&Te._extend(W,Z),Q(W.showHidden)&&(W.showHidden=!1),Q(W.depth)&&(W.depth=2),Q(W.colors)&&(W.colors=!1),Q(W.customInspect)&&(W.customInspect=!0),W.colors&&(W.stylize=a),f(W,N,W.depth)}Te.inspect=o,o.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]},o.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function a(N,Z){var W=o.styles[Z];return W?"\x1B["+o.colors[W][0]+"m"+N+"\x1B["+o.colors[W][1]+"m":N}function l(N,Z){return N}function c(N){var Z={};return N.forEach(function(W,le){Z[W]=!0}),Z}function f(N,Z,W){if(N.customInspect&&Z&&We(Z.inspect)&&Z.inspect!==Te.inspect&&!(Z.constructor&&Z.constructor.prototype===Z)){var le=Z.inspect(W,N);return $(le)||(le=f(N,le,W)),le}var ge=p(N,Z);if(ge)return ge;var R=Object.keys(Z),C=c(R);if(N.showHidden&&(R=Object.getOwnPropertyNames(Z)),Be(Z)&&(R.indexOf("message")>=0||R.indexOf("description")>=0))return g(Z);if(R.length===0){if(We(Z)){var j=Z.name?": "+Z.name:"";return N.stylize("[Function"+j+"]","special")}if(ce(Z))return N.stylize(RegExp.prototype.toString.call(Z),"regexp");if(J(Z))return N.stylize(Date.prototype.toString.call(Z),"date");if(Be(Z))return g(Z)}var V="",ne=!1,b=["{","}"];if(I(Z)&&(ne=!0,b=["[","]"]),We(Z)){var x=Z.name?": "+Z.name:"";V=" [Function"+x+"]"}if(ce(Z)&&(V=" "+RegExp.prototype.toString.call(Z)),J(Z)&&(V=" "+Date.prototype.toUTCString.call(Z)),Be(Z)&&(V=" "+g(Z)),R.length===0&&(!ne||Z.length==0))return b[0]+V+b[1];if(W<0)return ce(Z)?N.stylize(RegExp.prototype.toString.call(Z),"regexp"):N.stylize("[Object]","special");N.seen.push(Z);var F;return ne?F=y(N,Z,W,C,R):F=R.map(function(X){return T(N,Z,W,C,X,ne)}),N.seen.pop(),P(F,V,b)}function p(N,Z){if(Q(Z))return N.stylize("undefined","undefined");if($(Z)){var W="'"+JSON.stringify(Z).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return N.stylize(W,"string")}if(D(Z))return N.stylize(""+Z,"number");if(_(Z))return N.stylize(""+Z,"boolean");if(E(Z))return N.stylize("null","null")}function g(N){return"["+Error.prototype.toString.call(N)+"]"}function y(N,Z,W,le,ge){for(var R=[],C=0,j=Z.length;C<j;++C)ve(Z,String(C))?R.push(T(N,Z,W,le,String(C),!0)):R.push("");return ge.forEach(function(V){V.match(/^\d+$/)||R.push(T(N,Z,W,le,V,!0))}),R}function T(N,Z,W,le,ge,R){var C,j,V;if(V=Object.getOwnPropertyDescriptor(Z,ge)||{value:Z[ge]},V.get?V.set?j=N.stylize("[Getter/Setter]","special"):j=N.stylize("[Getter]","special"):V.set&&(j=N.stylize("[Setter]","special")),ve(le,ge)||(C="["+ge+"]"),j||(N.seen.indexOf(V.value)<0?(E(W)?j=f(N,V.value,null):j=f(N,V.value,W-1),j.indexOf(`
|
|
85
85
|
`)>-1&&(R?j=j.split(`
|
|
86
86
|
`).map(function(ne){return" "+ne}).join(`
|
|
87
87
|
`).slice(2):j=`
|
|
@@ -90,10 +90,10 @@ declare function ${i}${a};${c}`);if(t.props.type==="variable")return Vo(`${s}dec
|
|
|
90
90
|
`))):j=N.stylize("[Circular]","special")),Q(C)){if(R&&ge.match(/^\d+$/))return j;C=JSON.stringify(""+ge),C.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(C=C.slice(1,-1),C=N.stylize(C,"name")):(C=C.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),C=N.stylize(C,"string"))}return C+": "+j}function P(N,Z,W){var le=N.reduce(function(ge,R){return R.indexOf(`
|
|
91
91
|
`)>=0,ge+R.replace(/\u001b\[\d\d?m/g,"").length+1},0);return le>60?W[0]+(Z===""?"":Z+`
|
|
92
92
|
`)+" "+N.join(`,
|
|
93
|
-
`)+" "+W[1]:W[0]+Z+" "+N.join(", ")+" "+W[1]}Te.types=Rk();function I(N){return Array.isArray(N)}Te.isArray=I;function _(N){return typeof N=="boolean"}Te.isBoolean=_;function S(N){return N===null}Te.isNull=S;function B(N){return N==null}Te.isNullOrUndefined=B;function D(N){return typeof N=="number"}Te.isNumber=D;function $(N){return typeof N=="string"}Te.isString=$;function te(N){return typeof N=="symbol"}Te.isSymbol=te;function Q(N){return N===void 0}Te.isUndefined=Q;function ce(N){return Y(N)&&qe(N)==="[object RegExp]"}Te.isRegExp=ce,Te.types.isRegExp=ce;function Y(N){return typeof N=="object"&&N!==null}Te.isObject=Y;function J(N){return Y(N)&&qe(N)==="[object Date]"}Te.isDate=J,Te.types.isDate=J;function Be(N){return Y(N)&&(qe(N)==="[object Error]"||N instanceof Error)}Te.isError=Be,Te.types.isNativeError=Be;function We(N){return typeof N=="function"}Te.isFunction=We;function Qe(N){return N===null||typeof N=="boolean"||typeof N=="number"||typeof N=="string"||typeof N=="symbol"||typeof N>"u"}Te.isPrimitive=Qe,Te.isBuffer=Mk();function qe(N){return Object.prototype.toString.call(N)}function Ge(N){return N<10?"0"+N.toString(10):N.toString(10)}var pt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Me(){var N=new Date,Z=[Ge(N.getHours()),Ge(N.getMinutes()),Ge(N.getSeconds())].join(":");return[N.getDate(),pt[N.getMonth()],Z].join(" ")}Te.log=function(){console.log("%s - %s",Me(),Te.format.apply(Te,arguments))},Te.inherits=Wt(),Te._extend=function(N,Z){if(!Z||!Y(Z))return N;for(var W=Object.keys(Z),le=W.length;le--;)N[W[le]]=Z[W[le]];return N};function ve(N,Z){return Object.prototype.hasOwnProperty.call(N,Z)}var we=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;Te.promisify=function(Z){if(typeof Z!="function")throw new TypeError('The "original" argument must be of type Function');if(we&&Z[we]){if(W=Z[we],typeof W!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(W,we,{value:W,enumerable:!1,writable:!1,configurable:!0}),W}function W(){for(var le,ge,R=new Promise(function(V,ne){le=V,ge=ne}),C=[],j=0;j<arguments.length;j++)C.push(arguments[j]);C.push(function(V,ne){V?ge(V):le(ne)});try{Z.apply(this||ci,C)}catch(V){ge(V)}return R}return Object.setPrototypeOf(W,Object.getPrototypeOf(Z)),we&&Object.defineProperty(W,we,{value:W,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(W,e(Z))},Te.promisify.custom=we;function se(N,Z){if(!N){var W=new Error("Promise was rejected with a falsy value");W.reason=N,N=W}return Z(N)}function de(N){if(typeof N!="function")throw new TypeError('The "original" argument must be of type Function');function Z(){for(var W=[],le=0;le<arguments.length;le++)W.push(arguments[le]);var ge=W.pop();if(typeof ge!="function")throw new TypeError("The last argument must be of type Function");var R=this||ci,C=function(){return ge.apply(R,arguments)};N.apply(this||ci,W).then(function(j){t.nextTick(C.bind(null,null,j))},function(j){t.nextTick(se.bind(null,j,C))})}return Object.setPrototypeOf(Z,Object.getPrototypeOf(N)),Object.defineProperties(Z,e(N)),Z}return Te.callbackify=de,Te}var oe=Nk();oe.format;oe.deprecate;oe.debuglog;oe.inspect;oe.types;oe.isArray;oe.isBoolean;oe.isNull;oe.isNullOrUndefined;oe.isNumber;oe.isString;oe.isSymbol;oe.isUndefined;oe.isRegExp;oe.isObject;oe.isDate;oe.isError;oe.isFunction;oe.isPrimitive;oe.isBuffer;oe.log;oe.inherits;oe._extend;oe.promisify;oe.callbackify;var y0=oe._extend,h0=oe.callbackify,T0=oe.debuglog,v0=oe.deprecate,_0=oe.format,b0=oe.inherits,w0=oe.inspect,x0=oe.isArray,P0=oe.isBoolean,I0=oe.isBuffer,B0=oe.isDate,S0=oe.isError,E0=oe.isFunction,k0=oe.isNull,A0=oe.isNullOrUndefined,C0=oe.isNumber,O0=oe.isObject,R0=oe.isPrimitive,M0=oe.isRegExp,N0=oe.isString,D0=oe.isSymbol,H0=oe.isUndefined,U0=oe.log,j0=oe.promisify,$0=oe.types,Z0=oe.TextEncoder=globalThis.TextEncoder,L0=oe.TextDecoder=globalThis.TextDecoder;var Tr=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)}issue(e){console.info(JSON.stringify({...e,...this.getIssueContext()}))}getIssueContext(){return{}}_log(e,n){this._getConsoleMethod(e)(this._serializeMessage(e,n))}_serializeMessage(e,n){let r=oe.format(...n);return G.env.BP_LOG_FORMAT==="json"?this.getJsonMessage(e,r):r}getJsonMessage(e,n){return JSON.stringify({msg:n,level: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 di=class t extends Tr{constructor(e){super({visibleToBotOwners:!1,hiddenToIntegrationOwners:!1,...e})}with(e){return new t({...this.defaultOptions,...e})}withUserId(e){return this.with({userId:e})}withConversationId(e){return this.with({conversationId:e})}withVisibleToBotOwners(e){return this.with({visibleToBotOwners:e})}withHiddenToIntegrationOwners(e){return this.with({hiddenToIntegrationOwners:e})}forBot(){return this.with({hiddenToIntegrationOwners:!1,visibleToBotOwners:!0})}forBotOnly(){return this.with({hiddenToIntegrationOwners:!0,visibleToBotOwners:!0})}getJsonMessage(e,n){return JSON.stringify({msg:n,level:e,botId:this.defaultOptions.botId,integrationId:this.defaultOptions.integrationId,integrationAlias:this.defaultOptions.integrationAlias,visible_to_bot_owner:this.defaultOptions.visibleToBotOwners,hidden_to_integration_owner:this.defaultOptions.hiddenToIntegrationOwners,options:this.defaultOptions})}getIssueContext(){let{botId:e,integrationId:n,integrationAlias:r}=this.defaultOptions;return{...e&&{botId:e},...n&&{integrationId:n},...r&&{integrationAlias:r}}}};E();A();k();var jk=t=>["traceparent","tracestate","sentry-trace"].reduce((e,n)=>(t[n]&&(e[n]=t[n]),e),{}),$k=(t,e,n)=>{let[,r]=(e.headers.traceparent||"").split("-"),i=new Hk({botId:t.botId,integrationId:t.integrationId,integrationAlias:t.integrationAlias,retry:So,headers:n.managesOwnTracePropagation?{}:jk(e.headers)}),s=new ai(i),o=new di({traceId:r,botId:t.botId,integrationId:t.integrationId,integrationAlias:t.integrationAlias});return{ctx:t,req:e,client:s,logger:o,instance:n}},Zk=async t=>{let{ctx:e}=t;switch(e.operation){case"webhook_received":return await Wk(t);case"register":return await Kk(t);case"unregister":return await Fk(t);case"message_created":return await Gk(t);case"action_triggered":return await Vk(t);case"ping":return await Lk(t);case"create_user":return await zk(t);case"create_conversation":return await qk(t);default:throw new Uk(`Unknown operation ${e.operation}`)}},$T=t=>async e=>{let n=rT(e.headers),r=$k(n,e,t),{logger:i}=r;try{let s;return s=await Jk(r),s?{...s,status:s.status??200}:(s=await Zk(r),s?{...s,status:s.status??200}:{status:200})}catch(s){if(Dk(s)){let a=s.type==="Runtime"?s:new jT(s.message,s);return i.forBot().error(a.message),{status:a.code,body:JSON.stringify(a.toJSON())}}console.error(s);let o=new jT("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 i.forBot().error(o.message),{status:o.code,body:JSON.stringify(o.toJSON())}}},Lk=async t=>{},Wk=async({client:t,ctx:e,req:n,logger:r,instance:i})=>{let{req:s}=Nt(n);return i.webhook({client:t,ctx:e,req:s,logger:r})},Kk=async({client:t,ctx:e,req:n,logger:r,instance:i})=>{if(!i.register)return;let{webhookUrl:s}=Nt(n);await i.register({client:t,ctx:e,webhookUrl:s,logger:r})},Fk=async({client:t,ctx:e,req:n,logger:r,instance:i})=>{if(!i.unregister)return;let{webhookUrl:s}=Nt(n);await i.unregister({ctx:e,webhookUrl:s,client:t,logger:r})},zk=async({client:t,ctx:e,req:n,logger:r,instance:i})=>{if(!i.createUser)return;let{tags:s}=Nt(n);return await i.createUser({ctx:e,client:t,tags:s,logger:r})},qk=async({client:t,ctx:e,req:n,logger:r,instance:i})=>{if(!i.createConversation)return;let{channel:s,tags:o}=Nt(n);return await i.createConversation({ctx:e,client:t,channel:s,tags:o,logger:r})},Gk=async({ctx:t,req:e,client:n,logger:r,instance:i})=>{let{conversation:s,user:o,type:a,payload:l,message:c}=Nt(e),f=i.channels[s.channel];if(!f)throw new Error(`Channel ${s.channel} not found`);let p=f.messages[a];if(!p)throw new Error(`Message of type ${a} not found in channel ${s.channel}`);await p({ctx:t,conversation:s,message:c,user:o,type:a,client:n,payload:l,ack:async({tags:y})=>{await n.updateMessage({id:c.id,tags:y})},logger:r})},Vk=async({req:t,ctx:e,client:n,logger:r,instance:i})=>{let{input:s,type:o}=Nt(t);if(!o)throw new Error("Missing action type");let a=i.actions[o];if(!a)throw new Error(`Action ${o} not found`);let l=new Eo,f={output:await a({ctx:e,input:s,client:n,type:o,logger:r,metadata:l}),meta:l.toJSON()};return{body:JSON.stringify(f)}},Jk=async({instance:t,client:e,ctx:n,logger:r,req:i})=>{let s=t.unknownOperationHandler;if(s)return await s({client:e,ctx:n,logger:r,req:i})};var kl=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,this.managesOwnTracePropagation=e.__advanced?.managesOwnTracePropagation}actions;channels;register;unregister;createUser;createConversation;webhook;unknownOperationHandler;managesOwnTracePropagation;handler=$T(this);start=e=>Po(this.handler,e)};E();A();k();E();A();k();E();A();k();E();A();k();var Al=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.secrets=e.secrets,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;secrets;workflows;attributes;__advanced;withPlugins;get metadata(){return{sdkVersion:bn}}addIntegration(e,n){let r=this;r.integrations||(r.integrations={});let i=n?.alias??e.name;if(r.integrations[i])throw new vt(`Another integration with alias "${i}" is already installed in the bot`);let s=n&&"configurationType"in n?n.configurationType:void 0,o=n&&"configuration"in n?n.configuration??{}:{},a=s?e.definition.configurations?.[s]?.schema:e.definition.configuration?.schema,l=a?a.safeParse(o):null,c=l?.success?{...o,...l.data}:o;return r.integrations[i]={...e,alias:i,enabled:n?.enabled,configurationType:s,configuration:c,disabledChannels:n?.disabledChannels},this}addPlugin(e,n){let r=this;r.plugins||(r.plugins={});let i=n.alias??e.name;if(r.plugins[i])throw new vt(`Another plugin with alias "${i}" is already installed in the bot`);let s=Object.fromEntries(Object.entries(n.dependencies??{}).filter(([p,g])=>"integrationInterfaceAlias"in g).map(([p,g])=>{let y=this.integrations?.[g.integrationAlias];if(!y){let P=Object.keys(this.integrations??{}).join(", ")||"(none)";throw new vt(`Interface with alias "${p}" of plugin with alias "${i}" references integration with alias "${g.integrationAlias}" which is not installed. Please make sure to add the integration via addIntegration() before calling addPlugin().
|
|
93
|
+
`)+" "+W[1]:W[0]+Z+" "+N.join(", ")+" "+W[1]}Te.types=Nk();function I(N){return Array.isArray(N)}Te.isArray=I;function _(N){return typeof N=="boolean"}Te.isBoolean=_;function E(N){return N===null}Te.isNull=E;function B(N){return N==null}Te.isNullOrUndefined=B;function D(N){return typeof N=="number"}Te.isNumber=D;function $(N){return typeof N=="string"}Te.isString=$;function te(N){return typeof N=="symbol"}Te.isSymbol=te;function Q(N){return N===void 0}Te.isUndefined=Q;function ce(N){return Y(N)&&qe(N)==="[object RegExp]"}Te.isRegExp=ce,Te.types.isRegExp=ce;function Y(N){return typeof N=="object"&&N!==null}Te.isObject=Y;function J(N){return Y(N)&&qe(N)==="[object Date]"}Te.isDate=J,Te.types.isDate=J;function Be(N){return Y(N)&&(qe(N)==="[object Error]"||N instanceof Error)}Te.isError=Be,Te.types.isNativeError=Be;function We(N){return typeof N=="function"}Te.isFunction=We;function Qe(N){return N===null||typeof N=="boolean"||typeof N=="number"||typeof N=="string"||typeof N=="symbol"||typeof N>"u"}Te.isPrimitive=Qe,Te.isBuffer=Dk();function qe(N){return Object.prototype.toString.call(N)}function Ge(N){return N<10?"0"+N.toString(10):N.toString(10)}var pt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Me(){var N=new Date,Z=[Ge(N.getHours()),Ge(N.getMinutes()),Ge(N.getSeconds())].join(":");return[N.getDate(),pt[N.getMonth()],Z].join(" ")}Te.log=function(){console.log("%s - %s",Me(),Te.format.apply(Te,arguments))},Te.inherits=Wt(),Te._extend=function(N,Z){if(!Z||!Y(Z))return N;for(var W=Object.keys(Z),le=W.length;le--;)N[W[le]]=Z[W[le]];return N};function ve(N,Z){return Object.prototype.hasOwnProperty.call(N,Z)}var we=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;Te.promisify=function(Z){if(typeof Z!="function")throw new TypeError('The "original" argument must be of type Function');if(we&&Z[we]){if(W=Z[we],typeof W!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(W,we,{value:W,enumerable:!1,writable:!1,configurable:!0}),W}function W(){for(var le,ge,R=new Promise(function(V,ne){le=V,ge=ne}),C=[],j=0;j<arguments.length;j++)C.push(arguments[j]);C.push(function(V,ne){V?ge(V):le(ne)});try{Z.apply(this||ci,C)}catch(V){ge(V)}return R}return Object.setPrototypeOf(W,Object.getPrototypeOf(Z)),we&&Object.defineProperty(W,we,{value:W,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(W,e(Z))},Te.promisify.custom=we;function se(N,Z){if(!N){var W=new Error("Promise was rejected with a falsy value");W.reason=N,N=W}return Z(N)}function de(N){if(typeof N!="function")throw new TypeError('The "original" argument must be of type Function');function Z(){for(var W=[],le=0;le<arguments.length;le++)W.push(arguments[le]);var ge=W.pop();if(typeof ge!="function")throw new TypeError("The last argument must be of type Function");var R=this||ci,C=function(){return ge.apply(R,arguments)};N.apply(this||ci,W).then(function(j){t.nextTick(C.bind(null,null,j))},function(j){t.nextTick(se.bind(null,j,C))})}return Object.setPrototypeOf(Z,Object.getPrototypeOf(N)),Object.defineProperties(Z,e(N)),Z}return Te.callbackify=de,Te}var oe=Hk();oe.format;oe.deprecate;oe.debuglog;oe.inspect;oe.types;oe.isArray;oe.isBoolean;oe.isNull;oe.isNullOrUndefined;oe.isNumber;oe.isString;oe.isSymbol;oe.isUndefined;oe.isRegExp;oe.isObject;oe.isDate;oe.isError;oe.isFunction;oe.isPrimitive;oe.isBuffer;oe.log;oe.inherits;oe._extend;oe.promisify;oe.callbackify;var T0=oe._extend,v0=oe.callbackify,_0=oe.debuglog,b0=oe.deprecate,w0=oe.format,x0=oe.inherits,P0=oe.inspect,I0=oe.isArray,B0=oe.isBoolean,E0=oe.isBuffer,S0=oe.isDate,k0=oe.isError,A0=oe.isFunction,C0=oe.isNull,O0=oe.isNullOrUndefined,R0=oe.isNumber,M0=oe.isObject,N0=oe.isPrimitive,D0=oe.isRegExp,H0=oe.isString,U0=oe.isSymbol,j0=oe.isUndefined,$0=oe.log,Z0=oe.promisify,L0=oe.types,W0=oe.TextEncoder=globalThis.TextEncoder,K0=oe.TextDecoder=globalThis.TextDecoder;var Tr=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)}issue(e){console.info(JSON.stringify({...e,...this.getIssueContext()}))}getIssueContext(){return{}}_log(e,n){this._getConsoleMethod(e)(this._serializeMessage(e,n))}_serializeMessage(e,n){let r=oe.format(...n);return G.env.BP_LOG_FORMAT==="json"?this.getJsonMessage(e,r):r}getJsonMessage(e,n){return JSON.stringify({msg:n,level: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 di=class t extends Tr{constructor(e){super({visibleToBotOwners:!1,hiddenToIntegrationOwners:!1,...e})}with(e){return new t({...this.defaultOptions,...e})}withUserId(e){return this.with({userId:e})}withConversationId(e){return this.with({conversationId:e})}withVisibleToBotOwners(e){return this.with({visibleToBotOwners:e})}withHiddenToIntegrationOwners(e){return this.with({hiddenToIntegrationOwners:e})}forBot(){return this.with({hiddenToIntegrationOwners:!1,visibleToBotOwners:!0})}forBotOnly(){return this.with({hiddenToIntegrationOwners:!0,visibleToBotOwners:!0})}getJsonMessage(e,n){return JSON.stringify({msg:n,level:e,botId:this.defaultOptions.botId,integrationId:this.defaultOptions.integrationId,integrationAlias:this.defaultOptions.integrationAlias,visible_to_bot_owner:this.defaultOptions.visibleToBotOwners,hidden_to_integration_owner:this.defaultOptions.hiddenToIntegrationOwners,options:this.defaultOptions})}getIssueContext(){let{botId:e,integrationId:n,integrationAlias:r}=this.defaultOptions;return{...e&&{botId:e},...n&&{integrationId:n},...r&&{integrationAlias:r}}}};S();A();k();var Zk=t=>["traceparent","tracestate","sentry-trace"].reduce((e,n)=>(t[n]&&(e[n]=t[n]),e),{}),Lk=(t,e,n)=>{let[,r]=(e.headers.traceparent||"").split("-"),i=new jk({botId:t.botId,integrationId:t.integrationId,integrationAlias:t.integrationAlias,retry:Eo,headers:n.managesOwnTracePropagation?{}:Zk(e.headers)}),s=new ai(i),o=new di({traceId:r,botId:t.botId,integrationId:t.integrationId,integrationAlias:t.integrationAlias});return{ctx:t,req:e,client:s,logger:o,instance:n}},Wk=async t=>{let{ctx:e}=t;switch(e.operation){case"webhook_received":return await Fk(t);case"register":return await zk(t);case"unregister":return await qk(t);case"message_created":return await Jk(t);case"action_triggered":return await Yk(t);case"ping":return await Kk(t);case"create_user":return await Gk(t);case"create_conversation":return await Vk(t);default:throw new $k(`Unknown operation ${e.operation}`)}},LT=t=>async e=>{let n=oT(e.headers),r=Lk(n,e,t),{logger:i}=r;try{let s;return s=await Xk(r),s?{...s,status:s.status??200}:(s=await Wk(r),s?{...s,status:s.status??200}:{status:200})}catch(s){if(Uk(s)){let a=s.type==="Runtime"?s:new ZT(s.message,s);return i.forBot().error(a.message),{status:a.code,body:JSON.stringify(a.toJSON())}}console.error(s);let o=new ZT("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 i.forBot().error(o.message),{status:o.code,body:JSON.stringify(o.toJSON())}}},Kk=async t=>{},Fk=async({client:t,ctx:e,req:n,logger:r,instance:i})=>{let{req:s}=Nt(n);return i.webhook({client:t,ctx:e,req:s,logger:r})},zk=async({client:t,ctx:e,req:n,logger:r,instance:i})=>{if(!i.register)return;let{webhookUrl:s}=Nt(n);await i.register({client:t,ctx:e,webhookUrl:s,logger:r})},qk=async({client:t,ctx:e,req:n,logger:r,instance:i})=>{if(!i.unregister)return;let{webhookUrl:s}=Nt(n);await i.unregister({ctx:e,webhookUrl:s,client:t,logger:r})},Gk=async({client:t,ctx:e,req:n,logger:r,instance:i})=>{if(!i.createUser)return;let{tags:s}=Nt(n);return await i.createUser({ctx:e,client:t,tags:s,logger:r})},Vk=async({client:t,ctx:e,req:n,logger:r,instance:i})=>{if(!i.createConversation)return;let{channel:s,tags:o}=Nt(n);return await i.createConversation({ctx:e,client:t,channel:s,tags:o,logger:r})},Jk=async({ctx:t,req:e,client:n,logger:r,instance:i})=>{let{conversation:s,user:o,type:a,payload:l,message:c}=Nt(e),f=i.channels[s.channel];if(!f)throw new Error(`Channel ${s.channel} not found`);let p=f.messages[a];if(!p)throw new Error(`Message of type ${a} not found in channel ${s.channel}`);await p({ctx:t,conversation:s,message:c,user:o,type:a,client:n,payload:l,ack:async({tags:y})=>{await n.updateMessage({id:c.id,tags:y})},logger:r})},Yk=async({req:t,ctx:e,client:n,logger:r,instance:i})=>{let{input:s,type:o}=Nt(t);if(!o)throw new Error("Missing action type");let a=i.actions[o];if(!a)throw new Error(`Action ${o} not found`);let l=new So,f={output:await a({ctx:e,input:s,client:n,type:o,logger:r,metadata:l}),meta:l.toJSON()};return{body:JSON.stringify(f)}},Xk=async({instance:t,client:e,ctx:n,logger:r,req:i})=>{let s=t.unknownOperationHandler;if(s)return await s({client:e,ctx:n,logger:r,req:i})};var Cl=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,this.managesOwnTracePropagation=e.__advanced?.managesOwnTracePropagation}actions;channels;register;unregister;createUser;createConversation;webhook;unknownOperationHandler;managesOwnTracePropagation;handler=LT(this);start=e=>Po(this.handler,e)};S();A();k();S();A();k();S();A();k();S();A();k();S();A();k();function Mo(t){if(t)return Object.fromEntries(Object.entries(t).map(([e,{recurrence:n,...r}])=>[e,r]))}function No(t,e){let r={...Object.fromEntries(Object.entries(t??{}).map(([i,s])=>s.recurrence?[i,{type:i,payload:s.recurrence.payload,schedule:{cron:s.recurrence.cron}}]:null).filter(i=>i!==null)),...e};return Object.keys(r).length?r:void 0}var Ol=class{constructor(e){this.props=e;let n=Mo(e.events),r=No(e.events,e.recurringEvents);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=n,this.recurringEvents=r,this.actions=e.actions,this.tables=e.tables,this.secrets=e.secrets,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:n,recurringEvents:r,actions:e.actions,tables:e.tables,workflows:e.workflows}}integrations;plugins;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;secrets;workflows;attributes;__advanced;withPlugins;get metadata(){return{sdkVersion:bn}}addIntegration(e,n){let r=this;r.integrations||(r.integrations={});let i=n?.alias??e.name;if(r.integrations[i])throw new vt(`Another integration with alias "${i}" is already installed in the bot`);let s=n&&"configurationType"in n?n.configurationType:void 0,o=n&&"configuration"in n?n.configuration??{}:{},a=s?e.definition.configurations?.[s]?.schema:e.definition.configuration?.schema,l=a?a.safeParse(o):null,c=l?.success?{...o,...l.data}:o;return r.integrations[i]={...e,alias:i,enabled:n?.enabled,configurationType:s,configuration:c,disabledChannels:n?.disabledChannels},this}addPlugin(e,n){let r=this;r.plugins||(r.plugins={});let i=n.alias??e.name;if(r.plugins[i])throw new vt(`Another plugin with alias "${i}" is already installed in the bot`);let s=Object.fromEntries(Object.entries(n.dependencies??{}).filter(([p,g])=>"integrationInterfaceAlias"in g).map(([p,g])=>{let y=this.integrations?.[g.integrationAlias];if(!y){let P=Object.keys(this.integrations??{}).join(", ")||"(none)";throw new vt(`Interface with alias "${p}" of plugin with alias "${i}" references integration with alias "${g.integrationAlias}" which is not installed. Please make sure to add the integration via addIntegration() before calling addPlugin().
|
|
94
94
|
Available integration aliases: ${P}`)}let T=y.definition.interfaces?.[g.integrationInterfaceAlias];if(!T){let P=Object.keys(y.definition.interfaces??{}).join(", ")||"(none)";throw new vt(`Interface with alias "${g.integrationInterfaceAlias}" does not exist in integration "${y.name}" referenced by interface with alias "${p}" of plugin with alias "${i}".
|
|
95
95
|
Available interface aliases: ${P}`)}return[p,{...T,id:y.id,name:y.name,version:y.version,...g}]})),o=Object.fromEntries(Object.entries(n.dependencies??{}).filter(([p,g])=>!("integrationInterfaceAlias"in g)).map(([p,g])=>{let y=this.integrations?.[g.integrationAlias];if(!y){let T=Object.keys(this.integrations??{}).join(", ")||"(none)";throw new Error(`Integration with alias "${p}" of plugin with alias "${i}" references integration with alias "${g.integrationAlias}" which is not installed. Please make sure to add the integration via addIntegration() before calling addPlugin().
|
|
96
|
-
Available integration aliases: ${T}`)}return[p,{...y,...g}]})),a=n.configuration??{},l=e.definition.configuration?.schema,c=l?l.safeParse(a):null,f=c?.success?{...a,...c.data}:a;return r.plugins[i]={...e,alias:i,configuration:f,interfaces:s,integrations:o},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,i)),r.withPlugins.events=this._mergeEvents(r.withPlugins.events,this._prefixKeysWithPluginAlias(e.definition.events,i)),r.withPlugins.actions=this._mergeActions(r.withPlugins.actions,this._prefixKeysWithPluginAlias(e.definition.actions,i)),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)=>$e.mapKeys(e??{},r=>`${n}${Dt}${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,i]of n){let s=Object.entries(i.interfaces??{});for(let[o,a]of s){let l=this.integrations?.[a.integrationAlias];if(!l)throw new vt(`Interface with alias "${o}" of plugin with alias "${r}" references integration "${a.name}" which is not installed`);let c=Object.entries(a.entities??{});for(let[f,{name:p}]of c){let g=l.definition.entities?.[p]?.schema;if(!g)throw new Error(`Interface entity "${p}" does not exist in integration "${l.name}"`);e[`interface:${o}/entities/${f}`]=g}}}return e}_dereferenceZuiSchema(e,n){return e.dereference(n)}_dereferenceDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,i])=>[r,this._dereferenceDefinitionSchema(i,n)]))}_dereferenceDefinitionSchema(e,n){return e&&{...e,schema:this._dereferenceZuiSchema(e.schema,n)}}_dereferenceActionDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,i])=>[r,{...i,input:{schema:this._dereferenceZuiSchema(i.input.schema,n)},output:{schema:this._dereferenceZuiSchema(i.output.schema,n)}}]))}};E();A();k();E();A();k();import{isApiError as nA,Client as rA,RuntimeError as WT}from"@botpress/client";E();A();k();var fi=class t extends Tr{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})}};E();A();k();E();A();k();var dn=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));getMessage=(e=>this._run("getMessage",e));updateMessage=(e=>this._run("updateMessage",e));listMessages=(e=>this._run("listMessages",e));deleteMessage=(e=>this._run("deleteMessage",e));getUser=(e=>this._run("getUser",e));listUsers=(e=>this._run("listUsers",e));updateUser=(e=>this._run("updateUser",e));deleteUser=(e=>this._run("deleteUser",e));getState=(e=>this._run("getState",e));setState=(e=>this._run("setState",e));getOrSetState=(e=>this._run("getOrSetState",e));patchState=(e=>this._run("patchState",e));callAction=(e=>this._run("callAction",e));uploadFile=(e=>this._run("uploadFile",e));upsertFile=(e=>this._run("upsertFile",e));deleteFile=(e=>this._run("deleteFile",e));listFiles=(e=>this._run("listFiles",e));getFile=(e=>this._run("getFile",e));updateFileMetadata=(e=>this._run("updateFileMetadata",e));searchFiles=(e=>this._run("searchFiles",e));trackAnalytics=(e=>this._run("trackAnalytics",e));getTableRow=(e=>this._run("getTableRow",e));createTableRows=(e=>this._run("createTableRows",e));findTableRows=(e=>this._run("findTableRows",e));deleteTableRows=(e=>this._run("deleteTableRows",e));updateTableRows=(e=>this._run("updateTableRows",e));upsertTableRows=(e=>this._run("upsertTableRows",e));createWorkflow=(e=>this._run("createWorkflow",e));getOrCreateWorkflow=(e=>this._run("getOrCreateWorkflow",e));getWorkflow=(e=>this._run("getWorkflow",e));updateWorkflow=(e=>this._run("updateWorkflow",e));deleteWorkflow=(e=>this._run("deleteWorkflow",e));listWorkflows=(e=>this._run("listWorkflows",e));createConversation=e=>this._client.createConversation(e);getOrCreateConversation=e=>this._client.getOrCreateConversation(e);createUser=e=>this._client.createUser(e);getOrCreateUser=e=>this._client.getOrCreateUser(e);_run=async(e,n)=>{let r=this._hooks.before[e];r&&(n=await r(n));let i=await this._client[e](n),s=this._hooks.after[e];return s&&(i=await s(i,n)),i}};E();A();k();var Yk=re.enum(["event_received","register","unregister","ping","action_triggered"]),ZT=t=>({botId:t[ko]||St("Missing bot id header"),operation:Yk.parse(t[Co]),type:t[nT]||St("Missing type header"),configuration:JSON.parse(z.from(t[Ao]||St("Missing configuration header"),"base64").toString("utf-8"))});E();A();k();var ct={status:200};E();A();k();E();A();k();var Cl=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 Xk=["child_workflow_deleted","child_workflow_finished","workflow_timedout","workflow_started","workflow_continued"],LT=async(t,e)=>{if(t.ctx.type!=="workflow_update"||!Xk.includes(e.payload.type))throw new Error("Unexpected event type");let n={...t,logger:Qk(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),ct;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 eA(n,e);default:e.payload.type}return ct},Qk=(t,e)=>t.logger.with({eventId:e.id,workflowId:e.payload.workflow.id,conversationId:e.payload.conversation?.id,userId:e.payload.user?.id}),eA=async(t,e)=>{let n=Cl(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}"`),ct;let{updatedWorkflow:i}=await tA(t,e);return i.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. `),ct},tA=async(t,e)=>{let n=Cl(e.payload.type),r=t.self.workflowHandlers[n]?.[e.payload.workflow.name],i=structuredClone(e.payload.workflow);for(let s of r??[])i=await s({...t,event:e,conversation:e.payload.conversation,user:e.payload.user,workflow:i});return{updatedWorkflow:i}};E();A();k();var KT=t=>async e=>{let n=ZT(e.headers),r=new fi,i=new rA({botId:n.botId,retry:So}),s=new dn(i,{before:{createMessage:async a=>{let l=t.hookHandlers.before_outgoing_message[a.type]??[];for(let c of l){let f=new dn(i);a=(await c({client:f,ctx:n,logger:r.with({conversationId:a.conversationId,userId:a.userId}),data:a}))?.data??a}return a},callAction:async a=>{let l=t.hookHandlers.before_outgoing_call_action[a.type]??[];for(let c of l){let f=new dn(i);a=(await c({client:f,ctx:n,logger:r,data:a}))?.data??a}return a}},after:{createMessage:async a=>{let l=t.hookHandlers.after_outgoing_message[a.message.type]??[];for(let c of l){let f=new dn(i);a=(await c({client:f,ctx:n,logger:r.with({messageId:a.message.id,conversationId:a.message.conversationId,userId:a.message.userId}),data:a}))?.data??a}return a},callAction:async(a,l)=>{let{type:c}=l,f=t.hookHandlers.after_outgoing_call_action[c]??[];for(let p of f){let g=new dn(i);a=(await p({client:g,ctx:n,logger:r,data:{type:c,...a}}))?.data??a}return a}}}),o={req:e,ctx:n,logger:r,client:s,self:t};try{switch(n.operation){case"action_triggered":return await lA(o);case"event_received":return await aA(o);case"register":return await oA(o);case"unregister":return await sA(o);case"ping":return await iA(o);default:throw new Error(`Unknown operation ${n.operation}`)}}catch(a){let l=a instanceof Error?a:new Error(String(a));if(nA(l)){let f=l.type==="Runtime"?l:new WT(l.message,l);return r.error(f.message),{status:f.code,body:JSON.stringify(f.toJSON())}}let c=new WT("An unexpected error occurred in the bot.",l);return r.error(c.message,l),{status:c.code,body:JSON.stringify(c.toJSON())}}},iA=async t=>ct,oA=async t=>(await t.self.registerHandler?.({client:t.client,ctx:t.ctx,logger:t.logger}),ct),sA=async t=>ct,aA=async t=>{let{ctx:e,logger:n,req:r,client:i,self:s}=t,o={client:i,ctx:e,logger:n},a=Nt(r);if(o.logger=o.logger.with({eventId:a.event.id,messageId:a.event.messageId,conversationId:a.event.conversationId,userId:a.event.userId}),e.type==="workflow_update")return await LT(t,a.event);if(e.type==="message_created"){let y=a.event,T=y.payload.message,P=y.payload.user,I=y.payload.conversation;o.logger=o.logger.with({messageId:T.id,conversationId:T.conversationId,userId:T.userId});let _=s.hookHandlers.before_incoming_message[T.type]??[];for(let $ of _){let te=await $({...o,user:P,conversation:I,data:T});if(T=te?.data??T,te?.stop)return ct}let S={...o,user:P,conversation:I,message:T,event:y},B=s.messageHandlers[T.type]??[];for(let $ of B)await $(S);let D=s.hookHandlers.after_incoming_message[T.type]??[];for(let $ of D){let te=await $({...o,user:P,conversation:I,data:T});if(T=te?.data??T,te?.stop)return ct}return ct}if(e.type==="state_expired"){let T=a.event.payload.state,P={...o,state:T},I=s.stateExpiredHandlers[T.name]??[];for(let _ of I)await _(P);return ct}let l=a.event,c=s.hookHandlers.before_incoming_event[l.type]??[];for(let y of c){let T=await y({...o,data:l});if(l=T?.data??l,T?.stop)return ct}let f={...o,event:l},p=s.eventHandlers[l.type]??[];for(let y of p)await y(f);let g=s.hookHandlers.after_incoming_event[l.type]??[];for(let y of g){let T=await y({...o,data:l});if(l=T?.data??l,T?.stop)return ct}return ct},lA=async({ctx:t,logger:e,req:n,client:r,self:i})=>{let{input:s,type:o}=Nt(n);if(!o)throw new Error("Missing action type");let a=i.hookHandlers.before_incoming_call_action[o]??[];for(let g of a){let y=await g({ctx:t,logger:e,client:r,data:{type:o,input:s}});s=y?.data?.input??s,o=y?.data?.type??o}let l=i.actionHandlers[o];if(!l)throw new Error(`Action ${o} not found`);let c=await l({ctx:t,logger:e,input:s,client:r,type:o}),f=i.hookHandlers.after_incoming_call_action[o]??[];for(let g of f){let y=await g({ctx:t,logger:e,client:r,data:{type:o,output:c}});o=y?.data?.type??o,c=y?.data?.output??c}return{status:200,body:JSON.stringify({output:c})}};E();A();k();E();A();k();E();A();k();var qt=(t,{alias:e})=>{if(!("tags"in t)||!e)return t;let n=`${e}${Dt}`,r=Object.fromEntries(Object.entries(t.tags??{}).flatMap(([i,s])=>i.startsWith(n)?[[i.slice(n.length),s]]:[]));return{...t,tags:r}},ft=(t,{alias:e})=>{if(!("tags"in t)||!e)return t;let n=`${e}${Dt}`,r=Object.fromEntries(Object.entries(t.tags??{}).map(([i,s])=>[i.startsWith(n)?i:`${n}${i}`,s]));return{...t,tags:r}};E();A();k();var Ol=class{constructor(e){this._list=e}_nextToken;_elementsBuffer=[];_isExhausted=!1;[Symbol.asyncIterator](){return this}async next(){return this._bufferIsEmpty&&!this._isExhausted&&await this._fetchNextPageIntoBuffer(),this._bufferIsEmpty?{done:!0,value:void 0}:{done:!1,value:this._elementsBuffer.shift()}}async take(e){let n=[];for(let r=0;r<e;++r){let i=await this.next();if(i.done)break;n.push(i.value)}return n}async takePage(e){for(let r=0;r<e;++r)this._isExhausted||await this._fetchNextPageIntoBuffer();let n=[...this._elementsBuffer];return this._elementsBuffer.length=0,n}async takeAll(){return this.take(Number.POSITIVE_INFINITY)}get isExhausted(){return this._isExhausted}async _fetchNextPageIntoBuffer(){let{items:e,meta:n}=await this._list({nextToken:this._nextToken});this._elementsBuffer.push(...e),this._nextToken=n.nextToken,n.nextToken||(this._isExhausted=!0)}get _bufferIsEmpty(){return this._elementsBuffer.length===0}},Et=t=>new Ol(t);var fn=t=>new Proxy({},{get:(e,n)=>({listInstances:r=>Et(({nextToken:i})=>t.client.listWorkflows({...r,name:n,nextToken:i}).then(({meta:s,workflows:o})=>({meta:s,items:o.map(a=>kt({...t,workflow:a}))}))),startNewInstance:async r=>{let{workflow:i}=await t.client.createWorkflow({name:n,status:"pending",...ft(r,{alias:void 0})});return{workflow:kt({...t,workflow:i})}}})}),kt=t=>{let e=!1;return{...qt(t.workflow,{alias:void 0}),async update(n){let{workflow:r}=await t.client.updateWorkflow({id:t.workflow.id,...ft(n,{alias:void 0})});return await t.onWorkflowUpdate?.(r),{workflow:kt({...t,workflow:r})}},async acknowledgeStartOfProcessing(){if(!t.event||t.workflow.status!=="pending"||e)return{workflow:kt(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:kt({...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:kt({...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:kt({...t,workflow:r})}},async cancel(){let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,status:"cancelled"});return await t.onWorkflowUpdate?.(n),{workflow:kt({...t,workflow:n})}}}};E();A();k();var Rl=class{constructor(e){this.props=e;this._registerHandler=e.register,this._actionHandlers=e.actions,this._plugins=e.plugins}_registerHandler;_actionHandlers;_messageHandlers={};_eventHandlers={};_stateExpiredHandlers={};_hookHandlers={before_incoming_event:{},before_incoming_message:{},before_outgoing_message:{},before_outgoing_call_action:{},before_incoming_call_action:{},after_incoming_event:{},after_incoming_message:{},after_outgoing_message:{},after_outgoing_call_action:{},after_incoming_call_action:{}};_workflowHandlers={started:{},continued:{},timed_out:{}};_plugins={};_registerOrder=0;get registerHandler(){return this._registerHandler}get actionHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._actionHandlers[n];if(r)return ut.setName(i=>r({...i,workflows:fn(i)}),r.name);for(let[i,s]of Object.entries(this._plugins)){let[o,a]=n.split(Dt);if(!(o!==i||!a))return s.actionHandlers[a]}}})}get messageHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(a=>a.messageHandlers[n]??[]),i=n==="*"?[]:this._messageHandlers[n]??[],s=this._messageHandlers["*"]??[],o=[...i,...s].sort((a,l)=>a.order-l.order).map(({handler:a})=>ut.setName(l=>a({...l,workflows:fn(l)}),a.name));return ue.unique([...r,...o])}})}get eventHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(a=>a.eventHandlers[n]??[]),i=n==="*"?[]:this._eventHandlers[n]??[],s=this._eventHandlers["*"]??[],o=[...i,...s].sort((a,l)=>a.order-l.order).map(({handler:a})=>ut.setName(l=>a({...l,workflows:fn(l)}),a.name));return ue.unique([...r,...o])}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(a=>a.stateExpiredHandlers[n]??[]),i=n==="*"?[]:this._stateExpiredHandlers[n]??[],s=this._stateExpiredHandlers["*"]??[],o=[...i,...s].sort((a,l)=>a.order-l.order).map(({handler:a})=>ut.setName(l=>a({...l,workflows:fn(l)}),a.name));return ue.unique([...r,...o])}})}get hookHandlers(){return new Proxy({},{get:(e,n)=>{if(this._hookHandlers[n])return new Proxy({},{get:(i,s)=>{let o=Object.values(this._plugins).flatMap(p=>p.hookHandlers[n]?.[s]??[]),a=this._hookHandlers[n]??{},l=s==="*"?[]:a[s]??[],c=a["*"]??[],f=[...l,...c].sort((p,g)=>p.order-g.order).map(({handler:p})=>ut.setName(g=>p({...g,workflows:fn(g)}),p.name));return ue.unique([...o,...f])}})}})}get workflowHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._workflowHandlers[n];if(r)return new Proxy({},{get:(i,s)=>{let o=r[s]?.sort((l,c)=>l.order-c.order).map(({handler:l})=>ut.setName(async c=>{let f=c.workflow;return await l({...c,workflow:kt({...c,onWorkflowUpdate(p){f=p}}),workflows:fn(c)}),f},l.name))??[],a=Object.values(this._plugins).flatMap(l=>l.workflowHandlers[n]?.[s]??[]);return ue.unique([...o,...a])}})}})}on={message:(e,n)=>{this._messageHandlers[e]=ue.safePush(this._messageHandlers[e],{handler:n,order:this._registerOrder++})},event:(e,n)=>{this._eventHandlers[e]=ue.safePush(this._eventHandlers[e],{handler:n,order:this._registerOrder++})},stateExpired:(e,n)=>{this._stateExpiredHandlers[e]=ue.safePush(this._stateExpiredHandlers[e],{handler:n,order:this._registerOrder++})},beforeIncomingEvent:(e,n)=>{this._hookHandlers.before_incoming_event[e]=ue.safePush(this._hookHandlers.before_incoming_event[e],{handler:n,order:this._registerOrder++})},beforeIncomingMessage:(e,n)=>{this._hookHandlers.before_incoming_message[e]=ue.safePush(this._hookHandlers.before_incoming_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingMessage:(e,n)=>{this._hookHandlers.before_outgoing_message[e]=ue.safePush(this._hookHandlers.before_outgoing_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingCallAction:(e,n)=>{this._hookHandlers.before_outgoing_call_action[e]=ue.safePush(this._hookHandlers.before_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},beforeIncomingCallAction:(e,n)=>{this._hookHandlers.before_incoming_call_action[e]=ue.safePush(this._hookHandlers.before_incoming_call_action[e],{handler:n,order:this._registerOrder++})},afterIncomingEvent:(e,n)=>{this._hookHandlers.after_incoming_event[e]=ue.safePush(this._hookHandlers.after_incoming_event[e],{handler:n,order:this._registerOrder++})},afterIncomingMessage:(e,n)=>{this._hookHandlers.after_incoming_message[e]=ue.safePush(this._hookHandlers.after_incoming_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingMessage:(e,n)=>{this._hookHandlers.after_outgoing_message[e]=ue.safePush(this._hookHandlers.after_outgoing_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingCallAction:(e,n)=>{this._hookHandlers.after_outgoing_call_action[e]=ue.safePush(this._hookHandlers.after_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},afterIncomingCallAction:(e,n)=>{this._hookHandlers.after_incoming_call_action[e]=ue.safePush(this._hookHandlers.after_incoming_call_action[e],{handler:n,order:this._registerOrder++})},workflowStart:(e,n)=>{this._workflowHandlers.started[e]=ue.safePush(this._workflowHandlers.started[e],{handler:n,order:this._registerOrder++})},workflowContinue:(e,n)=>{this._workflowHandlers.continued[e]=ue.safePush(this._workflowHandlers.continued[e],{handler:n,order:this._registerOrder++})},workflowTimeout:(e,n)=>{this._workflowHandlers.timed_out[e]=ue.safePush(this._workflowHandlers.timed_out[e],{handler:n,order:this._registerOrder++})}};handler=KT(this);start=e=>Po(this.handler,e)};E();A();k();E();A();k();E();A();k();E();A();k();E();A();k();var Ml=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?{}:$e.mapValues(e.events,o=>({...o,schema:o.schema(n)})),i=e.actions===void 0?{}:$e.mapValues(e.actions,o=>({...o,input:{...o.input,schema:o.input.schema(n)},output:{...o.output,schema:o.output.schema(n)}})),s=e.channels===void 0?{}:$e.mapValues(e.channels,o=>({...o,messages:$e.mapValues(o.messages,a=>({...a,schema:a.schema(n)}))}));this.events=r,this.actions=i,this.channels=s}name;version;title;description;icon;readme;attributes;entities;events;actions;channels;__advanced;get metadata(){return{sdkVersion:bn}}_getEntityReference=e=>{let n={};for(let[r,i]of Object.entries(e)){let s=i.schema._def["x-zui"]?.title,o=i.schema._def.description,a=re.ref(r);s&&a.title(s),o&&a.describe(o),n[r]=a}return n}};E();A();k();E();A();k();E();A();k();E();A();k();var Nl=class{constructor(e){this.props=e;let n=Object.fromEntries(Object.entries(e.interfaces??{}).map(([i,s])=>[i,Object.fromEntries(Object.entries(s.definition.entities??{}).map(([o])=>[o,re.ref(`interface:${i}/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;let r=new Set;for(let i of[...Object.keys(e.integrations??{}),...Object.keys(e.interfaces??{})]){if(r.has(i))throw new vt(`Duplicate interface or integration alias detected in plugin definition: '${i}'. Please use unique aliases for each interface and integration.`);r.add(i)}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(([i,s])=>[i,{...s,schema:typeof s.schema=="object"?s.schema:s.schema({entities:n})}])),this.events=Object.fromEntries(Object.entries(e.events??{}).map(([i,s])=>[i,{...s,schema:typeof s.schema=="object"?s.schema:s.schema({entities:n})}])),this.actions=Object.fromEntries(Object.entries(e.actions??{}).map(([i,s])=>[i,{...s,input:{...s.input,schema:typeof s.input.schema=="object"?s.input.schema:s.input.schema({entities:n})},output:{...s.output,schema:typeof s.output.schema=="object"?s.output.schema:s.output.schema({entities:n})}}])),this.tables=Object.fromEntries(Object.entries(e.tables??{}).map(([i,s])=>[i,{...s,schema:typeof s.schema=="object"?s.schema:s.schema({entities:n})}]))}name;version;title;description;icon;readme;attributes;integrations;interfaces;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;workflows;__advanced;get metadata(){return{sdkVersion:bn}}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(([i,s])=>[`interface:${n}/entities/${i}`,e?s.schema.and(re.record(re.string(),re.unknown())):s.schema])))}_dereferenceZuiSchema(e,n){return e.dereference(n)}_dereferenceDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,i])=>[r,{...i,schema:this._dereferenceZuiSchema(i.schema,n)}]))}_dereferenceActionDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,i])=>[r,{...i,input:{schema:this._dereferenceZuiSchema(i.input.schema,n)},output:{schema:this._dereferenceZuiSchema(i.output.schema,n)}}]))}};E();A();k();E();A();k();E();A();k();var FT=(t,e)=>new Proxy({},{get:(n,r)=>new Proxy({},{get:(i,s)=>o=>{let a=(e.integrations[r]??e.interfaces[r])?.integrationAlias,l=e.interfaces[r]?.actions?.[s]?.name??s;return t.callAction({type:`${a}:${l}`,input:o}).then(c=>c.output)}})});E();A();k();E();A();k();E();A();k();E();A();k();var Dl=t=>({async getById({id:e}){let n=await t.client.getMessage({id:e});return Ht({...t,message:n.message})},list(e){return Et(({nextToken:n})=>t.client.listMessages({...ft(e??{},{alias:t.plugin?.alias}),nextToken:n}).then(({meta:r,messages:i})=>({meta:r,items:i.map(s=>Ht({...t,message:s}))})))}}),Ht=t=>({...qt(t.message,{alias:t.plugin?.alias}),async delete(){await t.client.deleteMessage({id:t.message.id})},async update(e){let{message:n}=await t.client.updateMessage({...ft(e,{alias:t.plugin?.alias}),id:t.message.id});return Ht({...t,message:n})}});E();A();k();E();A();k();var Hl=t=>({list(e){return Et(({nextToken:n})=>t.client.listUsers({...ft(e??{},{alias:t.pluginAlias}),nextToken:n}).then(({meta:r,users:i})=>({meta:r,items:i.map(s=>Ut({...t,conversationId:e?.conversationId,user:s}))})))},async getById({id:e}){let n=await t.client.getUser({id:e});return Ut({...t,user:n.user,conversationId:void 0})}}),Ut=t=>{let e={...qt(t.user,{alias:t.pluginAlias}),async update(n){let{user:r}=await t.client.updateUser({...ft(n,{alias:t.pluginAlias}),id:t.user.id});return Ut({...t,user:r})}};return t.conversationId?{...e,async removeFromConversation(){return await t.client.removeParticipant({id:t.conversationId,userId:t.user.id}),Ut({...t,conversationId:void 0})}}:{...e,async addToConversation({conversationId:n}){let{participant:r}=await t.client.addParticipant({id:n,userId:t.user.id});return Ut({...t,user:r,conversationId:n})}}};E();A();k();var Ul=t=>new Proxy({},{get:(e,n)=>new Proxy({},{get:(r,i)=>({list(s){let o=t.plugin?.interfaces[n]?.integrationAlias??t.plugin?.integrations[n]?.integrationAlias,a=t.plugin?.interfaces[n]?.channels?.[i]?.name??i;return Et(({nextToken:l})=>t.client.listConversations({...ft(s??{},{alias:t.plugin?.alias}),channel:a==="*"?void 0:a,integrationName:o==="*"?void 0:o,nextToken:l}).then(({meta:c,conversations:f})=>({meta:c,items:f.map(p=>Qn({...t,conversation:p}))})))},async getById({id:s}){let o=await t.client.getConversation({id:s});return Qn({...t,conversation:o.conversation})}})})}),Qn=t=>{let e=t.client;return{...qt(t.conversation,{alias:t.plugin?.alias}),async delete(){await e.deleteConversation({id:t.conversation.id})},async update(n){let{conversation:r}=await e.updateConversation({...ft(n,{alias:t.plugin?.alias}),id:t.conversation.id});return Qn({...t,conversation:r})},async getMessage({id:n}){let r=await e.getMessage({id:n});return Ht({...t,message:r.message})},async getOrCreateMessage(n){let{message:r}=await e.getOrCreateMessage({...ft(n,{alias:t.plugin?.alias}),conversationId:t.conversation.id});return Ht({...t,message:r})},async createMessage(n){let{message:r}=await e.createMessage({...ft(n,{alias:t.plugin?.alias}),conversationId:t.conversation.id});return Ht({...t,message:r})},listMessages(n){return Et(({nextToken:r})=>e.listMessages({...ft(n??{},{alias:t.plugin?.alias}),conversationId:t.conversation.id,nextToken:r}).then(({meta:i,messages:s})=>({meta:i,items:s.map(o=>Ht({...t,message:o}))})))},listParticipants(){return Et(({nextToken:n})=>e.listParticipants({id:t.conversation.id,nextToken:n}).then(({meta:r,participants:i})=>({meta:r,items:i.map(s=>Ut({...t,user:s,conversationId:t.conversation.id}))})))}}};E();A();k();E();A();k();E();A();k();var jl=class t{constructor(e){this._props=e}async emit(e){let{conversationId:n,userId:r,messageId:i}=this._props,{event:s}=await this._props.client.createEvent({type:this._props.eventName,payload:e,conversationId:n,userId:r,messageId:i});return s}async schedule(e,n){let{conversationId:r,userId:i,messageId:s}=this._props,{event:o}=await this._props.client.createEvent({type:this._props.eventName,payload:e,conversationId:r,userId:i,messageId:s,schedule:n});return o}withConversationId(e){return new t({...this._props,conversationId:e})}withUserId(e){return new t({...this._props,userId:e})}withMessageId(e){return new t({...this._props,messageId:e})}async getById(e){return(await this._props.client.getEvent({id:e.id})).event}list(e){return Et(({nextToken:n})=>this._props.client.listEvents({...e,type:this._props.eventName,conversationId:this._props.conversationId,userId:this._props.userId,messageId:this._props.messageId,nextToken:n}).then(({meta:r,events:i})=>({meta:r,items:i})))}},zT=(t,e)=>new Proxy({},{get:(n,r)=>{let i=e.alias!==void 0?`${e.alias}${Dt}${r}`:r;return new jl({client:t,eventName:i})}});E();A();k();E();A();k();E();A();k();E();A();k();E();A();k();var $l=class{constructor(e,n,r){this._client=e;this._stateType=n;this._stateName=r}async get(e){return await this._client.getState({type:this._stateType,name:this._stateName,id:e}).then(n=>n.state.payload)}async set(e,n,r){await this._client.setState({type:this._stateType,name:this._stateName,id:e,payload:n,expiry:r?.expiryMs})}async getOrSet(e,n,r){return await this._client.getOrSetState({type:this._stateType,name:this._stateName,id:e,payload:n,expiry:r?.expiryMs}).then(i=>i.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})}},qT=(t,e)=>new Proxy({},{get:(n,r)=>new Proxy({},{get:(i,s)=>{let o=e.alias!==void 0?`${e.alias}${Dt}${s}`:s;return new $l(t,r,o)}})});E();A();k();var uA=t=>"user"in t&&"conversation"in t,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,integrations:i,alias:s}=this._runtime,o=FT(e,this._runtime),a=qT(e,this._runtime),l=fn({client:e,pluginAlias:this._runtime.alias}),c=zT(e,this._runtime),f=Hl({client:e,pluginAlias:this._runtime.alias}),p=Ul({client:e,plugin:this._runtime}),g=Dl({client:e,plugin:this._runtime});return{configuration:n,interfaces:r,integrations:i,actions:o,states:a,alias:s,workflows:l,events:c,users:f,conversations:p,messages:g}}get actionHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._actionHandlers[n];if(r)return ut.setName(i=>r({...i,...this._getTools(i.client)}),r.name)}})}get messageHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=n==="*"?[]:this._messageHandlers[n]??[],i=this._messageHandlers["*"]??[];return ue.unique([...r,...i]).sort((o,a)=>o.order-a.order).map(({handler:o})=>ut.setName(a=>o({...a,user:Ut({...a,conversationId:a.conversation.id,pluginAlias:this._runtime.alias}),message:Ht({...a,plugin:this._runtime,message:a.message}),conversation:Qn({...a,plugin:this._runtime,conversation:a.conversation}),...this._getTools(a.client)}),o.name))}})}get eventHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=n==="*"?[]:this._eventHandlers[n]??[],i=Object.entries(this._eventHandlers).filter(([a])=>this._eventResolvesTo(a,n)).flatMap(([,a])=>a??[]),s=this._eventHandlers["*"]??[];return ue.unique([...r,...i,...s]).sort((a,l)=>a.order-l.order).map(({handler:a})=>ut.setName(l=>a({...l,...this._getTools(l.client)}),a.name))}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=n==="*"?[]:this._stateExpiredHandlers[n]??[],i=this._stateExpiredHandlers["*"]??[];return ue.unique([...r,...i]).sort((o,a)=>o.order-a.order).map(({handler:o})=>ut.setName(a=>o({...a,...this._getTools(a.client)}),o.name))}})}get hookHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._hookHandlers[n];if(r)return new Proxy({},{get:(i,s)=>{s=this._stripAliasPrefix(s);let o=s==="*"?[]:r[s]??[],a=Object.entries(r).filter(([f])=>this._eventResolvesTo(f,s)).flatMap(([,f])=>f??[]),l=r["*"]??[];return ue.unique([...o,...a,...l]).sort((f,p)=>f.order-p.order).map(({handler:f})=>ut.setName(p=>{let g=qt(p.data,{alias:this._runtime.alias}),y=this._getTools(p.client),T={};if(uA(p)){let P=Ut({client:p.client,user:p.user,conversationId:p.conversation.id,pluginAlias:this._runtime.alias}),I=Qn({client:p.client,plugin:this._runtime,conversation:p.conversation});T={user:P,conversation:I}}return f({...p,data:g,...T,...y})},f.name))}})}})}get workflowHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._workflowHandlers[n];if(r)return new Proxy({},{get:(i,s)=>(r[s]?.sort((a,l)=>a.order-l.order)??[]).map(({handler:a})=>ut.setName(async l=>{let c=l.workflow;return await a({...l,workflow:kt({...l,workflow:c,onWorkflowUpdate(f){c=f},pluginAlias:this._runtime.alias}),...this._getTools(l.client)}),c},a.name))})}})}on={message:(e,n)=>{this._messageHandlers[e]=ue.safePush(this._messageHandlers[e],{handler:n,order:this._registerOrder++})},event:(e,n)=>{this._eventHandlers[e]=ue.safePush(this._eventHandlers[e],{handler:n,order:this._registerOrder++})},stateExpired:(e,n)=>{this._stateExpiredHandlers[e]=ue.safePush(this._stateExpiredHandlers[e],{handler:n,order:this._registerOrder++})},beforeIncomingEvent:(e,n)=>{this._hookHandlers.before_incoming_event[e]=ue.safePush(this._hookHandlers.before_incoming_event[e],{handler:n,order:this._registerOrder++})},beforeIncomingMessage:(e,n)=>{this._hookHandlers.before_incoming_message[e]=ue.safePush(this._hookHandlers.before_incoming_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingMessage:(e,n)=>{this._hookHandlers.before_outgoing_message[e]=ue.safePush(this._hookHandlers.before_outgoing_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingCallAction:(e,n)=>{this._hookHandlers.before_outgoing_call_action[e]=ue.safePush(this._hookHandlers.before_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},beforeIncomingCallAction:(e,n)=>{this._hookHandlers.before_incoming_call_action[e]=ue.safePush(this._hookHandlers.before_incoming_call_action[e],{handler:n,order:this._registerOrder++})},afterIncomingEvent:(e,n)=>{this._hookHandlers.after_incoming_event[e]=ue.safePush(this._hookHandlers.after_incoming_event[e],{handler:n,order:this._registerOrder++})},afterIncomingMessage:(e,n)=>{this._hookHandlers.after_incoming_message[e]=ue.safePush(this._hookHandlers.after_incoming_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingMessage:(e,n)=>{this._hookHandlers.after_outgoing_message[e]=ue.safePush(this._hookHandlers.after_outgoing_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingCallAction:(e,n)=>{this._hookHandlers.after_outgoing_call_action[e]=ue.safePush(this._hookHandlers.after_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},afterIncomingCallAction:(e,n)=>{this._hookHandlers.after_incoming_call_action[e]=ue.safePush(this._hookHandlers.after_incoming_call_action[e],{handler:n,order:this._registerOrder++})},workflowStart:(e,n)=>{this._workflowHandlers.started[e]=ue.safePush(this._workflowHandlers.started[e],{handler:n,order:this._registerOrder++})},workflowContinue:(e,n)=>{this._workflowHandlers.continued[e]=ue.safePush(this._workflowHandlers.continued[e],{handler:n,order:this._registerOrder++})},workflowTimeout:(e,n)=>{this._workflowHandlers.timed_out[e]=ue.safePush(this._workflowHandlers.timed_out[e],{handler:n,order:this._registerOrder++})}};_eventResolvesTo=(e,n)=>{let[i,s]=e.split(":");if(!i||!s)return!1;let o=this._runtime.interfaces[i];if(o&&n===`${o.integrationAlias}:${o?.events?.[s]?.name}`)return!0;let a=this._runtime.integrations[i];return!!(a&&n===`${a.integrationAlias}:${s}`)};_stripAliasPrefix=e=>{let{alias:n}=this._runtime;if(!n)return e;let r=`${n}#`;return e.startsWith(r)?e.slice(r.length):e}};E();A();k();E();A();k();E();A();k();E();A();k();E();A();k();var GT={};pn(GT,{allWithinMajorOf:()=>cA,allWithinMinorOf:()=>dA});E();A();k();import*as pi from"semver";function cA(t){let e=pi.major(t.version);return{...t,version:`>=${e}.0.0 <${e+1}.0.0`}}function dA(t){let e=pi.major(t.version),n=pi.minor(t.version);return{...t,version:`>=${e}.${n}.0 <${e}.${n+1}.0`}}E();A();k();export{Rl as Bot,Al as BotDefinition,fi as BotLogger,dn as BotSpecificClient,kl as Integration,Fa as IntegrationDefinition,di as IntegrationLogger,ai as IntegrationSpecificClient,Ml as InterfaceDefinition,mC as OAUTH_IDENTIFIER_HEADER,Zl as Plugin,Nl as PluginDefinition,qj as RuntimeError,gC as WELL_KNOWN_ATTRIBUTES,Kh as errors,zj as isApiError,Fm as messages,Nt as parseBody,Po as serve,GT as version,re as z};
|
|
96
|
+
Available integration aliases: ${T}`)}return[p,{...y,...g}]})),a=n.configuration??{},l=e.definition.configuration?.schema,c=l?l.safeParse(a):null,f=c?.success?{...a,...c.data}:a;return r.plugins[i]={...e,alias:i,configuration:f,interfaces:s,integrations:o},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,i)),r.withPlugins.events=this._mergeEvents(r.withPlugins.events,this._prefixKeysWithPluginAlias(e.definition.events,i)),r.withPlugins.actions=this._mergeActions(r.withPlugins.actions,this._prefixKeysWithPluginAlias(e.definition.actions,i)),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)=>$e.mapKeys(e??{},r=>`${n}${Dt}${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,i]of n){let s=Object.entries(i.interfaces??{});for(let[o,a]of s){let l=this.integrations?.[a.integrationAlias];if(!l)throw new vt(`Interface with alias "${o}" of plugin with alias "${r}" references integration "${a.name}" which is not installed`);let c=Object.entries(a.entities??{});for(let[f,{name:p}]of c){let g=l.definition.entities?.[p]?.schema;if(!g)throw new Error(`Interface entity "${p}" does not exist in integration "${l.name}"`);e[`interface:${o}/entities/${f}`]=g}}}return e}_dereferenceZuiSchema(e,n){return e.dereference(n)}_dereferenceDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,i])=>[r,this._dereferenceDefinitionSchema(i,n)]))}_dereferenceDefinitionSchema(e,n){return e&&{...e,schema:this._dereferenceZuiSchema(e.schema,n)}}_dereferenceActionDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,i])=>[r,{...i,input:{schema:this._dereferenceZuiSchema(i.input.schema,n)},output:{schema:this._dereferenceZuiSchema(i.output.schema,n)}}]))}};S();A();k();S();A();k();import{isApiError as iA,Client as oA,RuntimeError as FT}from"@botpress/client";S();A();k();var fi=class t extends Tr{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})}};S();A();k();S();A();k();var dn=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));getMessage=(e=>this._run("getMessage",e));updateMessage=(e=>this._run("updateMessage",e));listMessages=(e=>this._run("listMessages",e));deleteMessage=(e=>this._run("deleteMessage",e));getUser=(e=>this._run("getUser",e));listUsers=(e=>this._run("listUsers",e));updateUser=(e=>this._run("updateUser",e));deleteUser=(e=>this._run("deleteUser",e));getState=(e=>this._run("getState",e));setState=(e=>this._run("setState",e));getOrSetState=(e=>this._run("getOrSetState",e));patchState=(e=>this._run("patchState",e));callAction=(e=>this._run("callAction",e));uploadFile=(e=>this._run("uploadFile",e));upsertFile=(e=>this._run("upsertFile",e));deleteFile=(e=>this._run("deleteFile",e));listFiles=(e=>this._run("listFiles",e));getFile=(e=>this._run("getFile",e));updateFileMetadata=(e=>this._run("updateFileMetadata",e));searchFiles=(e=>this._run("searchFiles",e));trackAnalytics=(e=>this._run("trackAnalytics",e));getTableRow=(e=>this._run("getTableRow",e));createTableRows=(e=>this._run("createTableRows",e));findTableRows=(e=>this._run("findTableRows",e));deleteTableRows=(e=>this._run("deleteTableRows",e));updateTableRows=(e=>this._run("updateTableRows",e));upsertTableRows=(e=>this._run("upsertTableRows",e));createWorkflow=(e=>this._run("createWorkflow",e));getOrCreateWorkflow=(e=>this._run("getOrCreateWorkflow",e));getWorkflow=(e=>this._run("getWorkflow",e));updateWorkflow=(e=>this._run("updateWorkflow",e));deleteWorkflow=(e=>this._run("deleteWorkflow",e));listWorkflows=(e=>this._run("listWorkflows",e));createConversation=e=>this._client.createConversation(e);getOrCreateConversation=e=>this._client.getOrCreateConversation(e);createUser=e=>this._client.createUser(e);getOrCreateUser=e=>this._client.getOrCreateUser(e);_run=async(e,n)=>{let r=this._hooks.before[e];r&&(n=await r(n));let i=await this._client[e](n),s=this._hooks.after[e];return s&&(i=await s(i,n)),i}};S();A();k();var Qk=re.enum(["event_received","register","unregister","ping","action_triggered"]),WT=t=>({botId:t[ko]||Et("Missing bot id header"),operation:Qk.parse(t[Co]),type:t[iT]||Et("Missing type header"),configuration:JSON.parse(z.from(t[Ao]||Et("Missing configuration header"),"base64").toString("utf-8"))});S();A();k();var ct={status:200};S();A();k();S();A();k();var Rl=t=>{switch(t){case"workflow_continued":return"continued";case"workflow_started":return"started";case"workflow_timedout":return"timed_out";default:throw new Error(`Unsupported workflow update type: ${t}`)}};var eA=["child_workflow_deleted","child_workflow_finished","workflow_timedout","workflow_started","workflow_continued"],KT=async(t,e)=>{if(t.ctx.type!=="workflow_update"||!eA.includes(e.payload.type))throw new Error("Unexpected event type");let n={...t,logger:tA(t,e)};if(!e.payload.workflow.name)return n.logger.warn("Received workflow update event without a workflow name. Assuming this workflow was not defined by the bot.",e.payload.workflow),ct;switch(e.payload.type){case"child_workflow_deleted":case"child_workflow_finished":n.logger.info(`Received child workflow event "${e.payload.type}", but child workflows are not yet supported`);break;case"workflow_timedout":case"workflow_started":case"workflow_continued":return await nA(n,e);default:e.payload.type}return ct},tA=(t,e)=>t.logger.with({eventId:e.id,workflowId:e.payload.workflow.id,conversationId:e.payload.conversation?.id,userId:e.payload.user?.id}),nA=async(t,e)=>{let n=Rl(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}"`),ct;let{updatedWorkflow:i}=await rA(t,e);return i.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. `),ct},rA=async(t,e)=>{let n=Rl(e.payload.type),r=t.self.workflowHandlers[n]?.[e.payload.workflow.name],i=structuredClone(e.payload.workflow);for(let s of r??[])i=await s({...t,event:e,conversation:e.payload.conversation,user:e.payload.user,workflow:i});return{updatedWorkflow:i}};S();A();k();var zT=t=>async e=>{let n=WT(e.headers),r=new fi,i=new oA({botId:n.botId,retry:Eo}),s=new dn(i,{before:{createMessage:async a=>{let l=t.hookHandlers.before_outgoing_message[a.type]??[];for(let c of l){let f=new dn(i);a=(await c({client:f,ctx:n,logger:r.with({conversationId:a.conversationId,userId:a.userId}),data:a}))?.data??a}return a},callAction:async a=>{let l=t.hookHandlers.before_outgoing_call_action[a.type]??[];for(let c of l){let f=new dn(i);a=(await c({client:f,ctx:n,logger:r,data:a}))?.data??a}return a}},after:{createMessage:async a=>{let l=t.hookHandlers.after_outgoing_message[a.message.type]??[];for(let c of l){let f=new dn(i);a=(await c({client:f,ctx:n,logger:r.with({messageId:a.message.id,conversationId:a.message.conversationId,userId:a.message.userId}),data:a}))?.data??a}return a},callAction:async(a,l)=>{let{type:c}=l,f=t.hookHandlers.after_outgoing_call_action[c]??[];for(let p of f){let g=new dn(i);a=(await p({client:g,ctx:n,logger:r,data:{type:c,...a}}))?.data??a}return a}}}),o={req:e,ctx:n,logger:r,client:s,self:t};try{switch(n.operation){case"action_triggered":return await cA(o);case"event_received":return await uA(o);case"register":return await aA(o);case"unregister":return await lA(o);case"ping":return await sA(o);default:throw new Error(`Unknown operation ${n.operation}`)}}catch(a){let l=a instanceof Error?a:new Error(String(a));if(iA(l)){let f=l.type==="Runtime"?l:new FT(l.message,l);return r.error(f.message),{status:f.code,body:JSON.stringify(f.toJSON())}}let c=new FT("An unexpected error occurred in the bot.",l);return r.error(c.message,l),{status:c.code,body:JSON.stringify(c.toJSON())}}},sA=async t=>ct,aA=async t=>(await t.self.registerHandler?.({client:t.client,ctx:t.ctx,logger:t.logger}),ct),lA=async t=>ct,uA=async t=>{let{ctx:e,logger:n,req:r,client:i,self:s}=t,o={client:i,ctx:e,logger:n},a=Nt(r);if(o.logger=o.logger.with({eventId:a.event.id,messageId:a.event.messageId,conversationId:a.event.conversationId,userId:a.event.userId}),e.type==="workflow_update")return await KT(t,a.event);if(e.type==="message_created"){let y=a.event,T=y.payload.message,P=y.payload.user,I=y.payload.conversation;o.logger=o.logger.with({messageId:T.id,conversationId:T.conversationId,userId:T.userId});let _=s.hookHandlers.before_incoming_message[T.type]??[];for(let $ of _){let te=await $({...o,user:P,conversation:I,data:T});if(T=te?.data??T,te?.stop)return ct}let E={...o,user:P,conversation:I,message:T,event:y},B=s.messageHandlers[T.type]??[];for(let $ of B)await $(E);let D=s.hookHandlers.after_incoming_message[T.type]??[];for(let $ of D){let te=await $({...o,user:P,conversation:I,data:T});if(T=te?.data??T,te?.stop)return ct}return ct}if(e.type==="state_expired"){let T=a.event.payload.state,P={...o,state:T},I=s.stateExpiredHandlers[T.name]??[];for(let _ of I)await _(P);return ct}let l=a.event,c=s.hookHandlers.before_incoming_event[l.type]??[];for(let y of c){let T=await y({...o,data:l});if(l=T?.data??l,T?.stop)return ct}let f={...o,event:l},p=s.eventHandlers[l.type]??[];for(let y of p)await y(f);let g=s.hookHandlers.after_incoming_event[l.type]??[];for(let y of g){let T=await y({...o,data:l});if(l=T?.data??l,T?.stop)return ct}return ct},cA=async({ctx:t,logger:e,req:n,client:r,self:i})=>{let{input:s,type:o}=Nt(n);if(!o)throw new Error("Missing action type");let a=i.hookHandlers.before_incoming_call_action[o]??[];for(let g of a){let y=await g({ctx:t,logger:e,client:r,data:{type:o,input:s}});s=y?.data?.input??s,o=y?.data?.type??o}let l=i.actionHandlers[o];if(!l)throw new Error(`Action ${o} not found`);let c=await l({ctx:t,logger:e,input:s,client:r,type:o}),f=i.hookHandlers.after_incoming_call_action[o]??[];for(let g of f){let y=await g({ctx:t,logger:e,client:r,data:{type:o,output:c}});o=y?.data?.type??o,c=y?.data?.output??c}return{status:200,body:JSON.stringify({output:c})}};S();A();k();S();A();k();S();A();k();var qt=(t,{alias:e})=>{if(!("tags"in t)||!e)return t;let n=`${e}${Dt}`,r=Object.fromEntries(Object.entries(t.tags??{}).flatMap(([i,s])=>i.startsWith(n)?[[i.slice(n.length),s]]:[]));return{...t,tags:r}},ft=(t,{alias:e})=>{if(!("tags"in t)||!e)return t;let n=`${e}${Dt}`,r=Object.fromEntries(Object.entries(t.tags??{}).map(([i,s])=>[i.startsWith(n)?i:`${n}${i}`,s]));return{...t,tags:r}};S();A();k();var Ml=class{constructor(e){this._list=e}_nextToken;_elementsBuffer=[];_isExhausted=!1;[Symbol.asyncIterator](){return this}async next(){return this._bufferIsEmpty&&!this._isExhausted&&await this._fetchNextPageIntoBuffer(),this._bufferIsEmpty?{done:!0,value:void 0}:{done:!1,value:this._elementsBuffer.shift()}}async take(e){let n=[];for(let r=0;r<e;++r){let i=await this.next();if(i.done)break;n.push(i.value)}return n}async takePage(e){for(let r=0;r<e;++r)this._isExhausted||await this._fetchNextPageIntoBuffer();let n=[...this._elementsBuffer];return this._elementsBuffer.length=0,n}async takeAll(){return this.take(Number.POSITIVE_INFINITY)}get isExhausted(){return this._isExhausted}async _fetchNextPageIntoBuffer(){let{items:e,meta:n}=await this._list({nextToken:this._nextToken});this._elementsBuffer.push(...e),this._nextToken=n.nextToken,n.nextToken||(this._isExhausted=!0)}get _bufferIsEmpty(){return this._elementsBuffer.length===0}},St=t=>new Ml(t);var fn=t=>new Proxy({},{get:(e,n)=>({listInstances:r=>St(({nextToken:i})=>t.client.listWorkflows({...r,name:n,nextToken:i}).then(({meta:s,workflows:o})=>({meta:s,items:o.map(a=>kt({...t,workflow:a}))}))),startNewInstance:async r=>{let{workflow:i}=await t.client.createWorkflow({name:n,status:"pending",...ft(r,{alias:void 0})});return{workflow:kt({...t,workflow:i})}}})}),kt=t=>{let e=!1;return{...qt(t.workflow,{alias:void 0}),async update(n){let{workflow:r}=await t.client.updateWorkflow({id:t.workflow.id,...ft(n,{alias:void 0})});return await t.onWorkflowUpdate?.(r),{workflow:kt({...t,workflow:r})}},async acknowledgeStartOfProcessing(){if(!t.event||t.workflow.status!=="pending"||e)return{workflow:kt(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:kt({...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:kt({...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:kt({...t,workflow:r})}},async cancel(){let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,status:"cancelled"});return await t.onWorkflowUpdate?.(n),{workflow:kt({...t,workflow:n})}}}};S();A();k();var Nl=class{constructor(e){this.props=e;this._registerHandler=e.register,this._actionHandlers=e.actions,this._plugins=e.plugins}_registerHandler;_actionHandlers;_messageHandlers={};_eventHandlers={};_stateExpiredHandlers={};_hookHandlers={before_incoming_event:{},before_incoming_message:{},before_outgoing_message:{},before_outgoing_call_action:{},before_incoming_call_action:{},after_incoming_event:{},after_incoming_message:{},after_outgoing_message:{},after_outgoing_call_action:{},after_incoming_call_action:{}};_workflowHandlers={started:{},continued:{},timed_out:{}};_plugins={};_registerOrder=0;get registerHandler(){return this._registerHandler}get actionHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._actionHandlers[n];if(r)return ut.setName(i=>r({...i,workflows:fn(i)}),r.name);for(let[i,s]of Object.entries(this._plugins)){let[o,a]=n.split(Dt);if(!(o!==i||!a))return s.actionHandlers[a]}}})}get messageHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(a=>a.messageHandlers[n]??[]),i=n==="*"?[]:this._messageHandlers[n]??[],s=this._messageHandlers["*"]??[],o=[...i,...s].sort((a,l)=>a.order-l.order).map(({handler:a})=>ut.setName(l=>a({...l,workflows:fn(l)}),a.name));return ue.unique([...r,...o])}})}get eventHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(a=>a.eventHandlers[n]??[]),i=n==="*"?[]:this._eventHandlers[n]??[],s=this._eventHandlers["*"]??[],o=[...i,...s].sort((a,l)=>a.order-l.order).map(({handler:a})=>ut.setName(l=>a({...l,workflows:fn(l)}),a.name));return ue.unique([...r,...o])}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(a=>a.stateExpiredHandlers[n]??[]),i=n==="*"?[]:this._stateExpiredHandlers[n]??[],s=this._stateExpiredHandlers["*"]??[],o=[...i,...s].sort((a,l)=>a.order-l.order).map(({handler:a})=>ut.setName(l=>a({...l,workflows:fn(l)}),a.name));return ue.unique([...r,...o])}})}get hookHandlers(){return new Proxy({},{get:(e,n)=>{if(this._hookHandlers[n])return new Proxy({},{get:(i,s)=>{let o=Object.values(this._plugins).flatMap(p=>p.hookHandlers[n]?.[s]??[]),a=this._hookHandlers[n]??{},l=s==="*"?[]:a[s]??[],c=a["*"]??[],f=[...l,...c].sort((p,g)=>p.order-g.order).map(({handler:p})=>ut.setName(g=>p({...g,workflows:fn(g)}),p.name));return ue.unique([...o,...f])}})}})}get workflowHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._workflowHandlers[n];if(r)return new Proxy({},{get:(i,s)=>{let o=r[s]?.sort((l,c)=>l.order-c.order).map(({handler:l})=>ut.setName(async c=>{let f=c.workflow;return await l({...c,workflow:kt({...c,onWorkflowUpdate(p){f=p}}),workflows:fn(c)}),f},l.name))??[],a=Object.values(this._plugins).flatMap(l=>l.workflowHandlers[n]?.[s]??[]);return ue.unique([...o,...a])}})}})}on={message:(e,n)=>{this._messageHandlers[e]=ue.safePush(this._messageHandlers[e],{handler:n,order:this._registerOrder++})},event:(e,n)=>{this._eventHandlers[e]=ue.safePush(this._eventHandlers[e],{handler:n,order:this._registerOrder++})},stateExpired:(e,n)=>{this._stateExpiredHandlers[e]=ue.safePush(this._stateExpiredHandlers[e],{handler:n,order:this._registerOrder++})},beforeIncomingEvent:(e,n)=>{this._hookHandlers.before_incoming_event[e]=ue.safePush(this._hookHandlers.before_incoming_event[e],{handler:n,order:this._registerOrder++})},beforeIncomingMessage:(e,n)=>{this._hookHandlers.before_incoming_message[e]=ue.safePush(this._hookHandlers.before_incoming_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingMessage:(e,n)=>{this._hookHandlers.before_outgoing_message[e]=ue.safePush(this._hookHandlers.before_outgoing_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingCallAction:(e,n)=>{this._hookHandlers.before_outgoing_call_action[e]=ue.safePush(this._hookHandlers.before_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},beforeIncomingCallAction:(e,n)=>{this._hookHandlers.before_incoming_call_action[e]=ue.safePush(this._hookHandlers.before_incoming_call_action[e],{handler:n,order:this._registerOrder++})},afterIncomingEvent:(e,n)=>{this._hookHandlers.after_incoming_event[e]=ue.safePush(this._hookHandlers.after_incoming_event[e],{handler:n,order:this._registerOrder++})},afterIncomingMessage:(e,n)=>{this._hookHandlers.after_incoming_message[e]=ue.safePush(this._hookHandlers.after_incoming_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingMessage:(e,n)=>{this._hookHandlers.after_outgoing_message[e]=ue.safePush(this._hookHandlers.after_outgoing_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingCallAction:(e,n)=>{this._hookHandlers.after_outgoing_call_action[e]=ue.safePush(this._hookHandlers.after_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},afterIncomingCallAction:(e,n)=>{this._hookHandlers.after_incoming_call_action[e]=ue.safePush(this._hookHandlers.after_incoming_call_action[e],{handler:n,order:this._registerOrder++})},workflowStart:(e,n)=>{this._workflowHandlers.started[e]=ue.safePush(this._workflowHandlers.started[e],{handler:n,order:this._registerOrder++})},workflowContinue:(e,n)=>{this._workflowHandlers.continued[e]=ue.safePush(this._workflowHandlers.continued[e],{handler:n,order:this._registerOrder++})},workflowTimeout:(e,n)=>{this._workflowHandlers.timed_out[e]=ue.safePush(this._workflowHandlers.timed_out[e],{handler:n,order:this._registerOrder++})}};handler=zT(this);start=e=>Po(this.handler,e)};S();A();k();S();A();k();S();A();k();S();A();k();S();A();k();var Dl=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?{}:$e.mapValues(e.events,o=>({...o,schema:o.schema(n)})),i=e.actions===void 0?{}:$e.mapValues(e.actions,o=>({...o,input:{...o.input,schema:o.input.schema(n)},output:{...o.output,schema:o.output.schema(n)}})),s=e.channels===void 0?{}:$e.mapValues(e.channels,o=>({...o,messages:$e.mapValues(o.messages,a=>({...a,schema:a.schema(n)}))}));this.events=r,this.actions=i,this.channels=s}name;version;title;description;icon;readme;attributes;entities;events;actions;channels;__advanced;get metadata(){return{sdkVersion:bn}}_getEntityReference=e=>{let n={};for(let[r,i]of Object.entries(e)){let s=i.schema._def["x-zui"]?.title,o=i.schema._def.description,a=re.ref(r);s&&a.title(s),o&&a.describe(o),n[r]=a}return n}};S();A();k();S();A();k();S();A();k();S();A();k();var Hl=class{constructor(e){this.props=e;let n=Object.fromEntries(Object.entries(e.interfaces??{}).map(([s,o])=>[s,Object.fromEntries(Object.entries(o.definition.entities??{}).map(([a])=>[a,re.ref(`interface:${s}/entities/${a}`)]))]));this.name=e.name,this.version=e.version,this.icon=e.icon,this.readme=e.readme,this.title=e.title,this.description=e.description,this.integrations=e.integrations,this.interfaces=e.interfaces,this.user=e.user,this.conversation=e.conversation,this.message=e.message,this.workflows=e.workflows,this.attributes=e.attributes,this.__advanced=e.__advanced;let r=new Set;for(let s of[...Object.keys(e.integrations??{}),...Object.keys(e.interfaces??{})]){if(r.has(s))throw new vt(`Duplicate interface or integration alias detected in plugin definition: '${s}'. Please use unique aliases for each interface and integration.`);r.add(s)}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(([s,o])=>[s,{...o,schema:typeof o.schema=="object"?o.schema:o.schema({entities:n})}]));let i=Object.fromEntries(Object.entries(e.events??{}).map(([s,o])=>[s,{...o,schema:typeof o.schema=="object"?o.schema:o.schema({entities:n})}]));this.events=Mo(i),this.recurringEvents=No(i,e.recurringEvents),this.actions=Object.fromEntries(Object.entries(e.actions??{}).map(([s,o])=>[s,{...o,input:{...o.input,schema:typeof o.input.schema=="object"?o.input.schema:o.input.schema({entities:n})},output:{...o.output,schema:typeof o.output.schema=="object"?o.output.schema:o.output.schema({entities:n})}}])),this.tables=Object.fromEntries(Object.entries(e.tables??{}).map(([s,o])=>[s,{...o,schema:typeof o.schema=="object"?o.schema:o.schema({entities:n})}]))}name;version;title;description;icon;readme;attributes;integrations;interfaces;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;workflows;__advanced;get metadata(){return{sdkVersion:bn}}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(([i,s])=>[`interface:${n}/entities/${i}`,e?s.schema.and(re.record(re.string(),re.unknown())):s.schema])))}_dereferenceZuiSchema(e,n){return e.dereference(n)}_dereferenceDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,i])=>[r,{...i,schema:this._dereferenceZuiSchema(i.schema,n)}]))}_dereferenceActionDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,i])=>[r,{...i,input:{schema:this._dereferenceZuiSchema(i.input.schema,n)},output:{schema:this._dereferenceZuiSchema(i.output.schema,n)}}]))}};S();A();k();S();A();k();S();A();k();var qT=(t,e)=>new Proxy({},{get:(n,r)=>new Proxy({},{get:(i,s)=>o=>{let a=(e.integrations[r]??e.interfaces[r])?.integrationAlias,l=e.interfaces[r]?.actions?.[s]?.name??s;return t.callAction({type:`${a}:${l}`,input:o}).then(c=>c.output)}})});S();A();k();S();A();k();S();A();k();S();A();k();var Ul=t=>({async getById({id:e}){let n=await t.client.getMessage({id:e});return Ht({...t,message:n.message})},list(e){return St(({nextToken:n})=>t.client.listMessages({...ft(e??{},{alias:t.plugin?.alias}),nextToken:n}).then(({meta:r,messages:i})=>({meta:r,items:i.map(s=>Ht({...t,message:s}))})))}}),Ht=t=>({...qt(t.message,{alias:t.plugin?.alias}),async delete(){await t.client.deleteMessage({id:t.message.id})},async update(e){let{message:n}=await t.client.updateMessage({...ft(e,{alias:t.plugin?.alias}),id:t.message.id});return Ht({...t,message:n})}});S();A();k();S();A();k();var jl=t=>({list(e){return St(({nextToken:n})=>t.client.listUsers({...ft(e??{},{alias:t.pluginAlias}),nextToken:n}).then(({meta:r,users:i})=>({meta:r,items:i.map(s=>Ut({...t,conversationId:e?.conversationId,user:s}))})))},async getById({id:e}){let n=await t.client.getUser({id:e});return Ut({...t,user:n.user,conversationId:void 0})}}),Ut=t=>{let e={...qt(t.user,{alias:t.pluginAlias}),async update(n){let{user:r}=await t.client.updateUser({...ft(n,{alias:t.pluginAlias}),id:t.user.id});return Ut({...t,user:r})}};return t.conversationId?{...e,async removeFromConversation(){return await t.client.removeParticipant({id:t.conversationId,userId:t.user.id}),Ut({...t,conversationId:void 0})}}:{...e,async addToConversation({conversationId:n}){let{participant:r}=await t.client.addParticipant({id:n,userId:t.user.id});return Ut({...t,user:r,conversationId:n})}}};S();A();k();var $l=t=>new Proxy({},{get:(e,n)=>new Proxy({},{get:(r,i)=>({list(s){let o=t.plugin?.interfaces[n]?.integrationAlias??t.plugin?.integrations[n]?.integrationAlias,a=t.plugin?.interfaces[n]?.channels?.[i]?.name??i;return St(({nextToken:l})=>t.client.listConversations({...ft(s??{},{alias:t.plugin?.alias}),channel:a==="*"?void 0:a,integrationName:o==="*"?void 0:o,nextToken:l}).then(({meta:c,conversations:f})=>({meta:c,items:f.map(p=>Qn({...t,conversation:p}))})))},async getById({id:s}){let o=await t.client.getConversation({id:s});return Qn({...t,conversation:o.conversation})}})})}),Qn=t=>{let e=t.client;return{...qt(t.conversation,{alias:t.plugin?.alias}),async delete(){await e.deleteConversation({id:t.conversation.id})},async update(n){let{conversation:r}=await e.updateConversation({...ft(n,{alias:t.plugin?.alias}),id:t.conversation.id});return Qn({...t,conversation:r})},async getMessage({id:n}){let r=await e.getMessage({id:n});return Ht({...t,message:r.message})},async getOrCreateMessage(n){let{message:r}=await e.getOrCreateMessage({...ft(n,{alias:t.plugin?.alias}),conversationId:t.conversation.id});return Ht({...t,message:r})},async createMessage(n){let{message:r}=await e.createMessage({...ft(n,{alias:t.plugin?.alias}),conversationId:t.conversation.id});return Ht({...t,message:r})},listMessages(n){return St(({nextToken:r})=>e.listMessages({...ft(n??{},{alias:t.plugin?.alias}),conversationId:t.conversation.id,nextToken:r}).then(({meta:i,messages:s})=>({meta:i,items:s.map(o=>Ht({...t,message:o}))})))},listParticipants(){return St(({nextToken:n})=>e.listParticipants({id:t.conversation.id,nextToken:n}).then(({meta:r,participants:i})=>({meta:r,items:i.map(s=>Ut({...t,user:s,conversationId:t.conversation.id}))})))}}};S();A();k();S();A();k();S();A();k();var Zl=class t{constructor(e){this._props=e}async emit(e){let{conversationId:n,userId:r,messageId:i}=this._props,{event:s}=await this._props.client.createEvent({type:this._props.eventName,payload:e,conversationId:n,userId:r,messageId:i});return s}async schedule(e,n){let{conversationId:r,userId:i,messageId:s}=this._props,{event:o}=await this._props.client.createEvent({type:this._props.eventName,payload:e,conversationId:r,userId:i,messageId:s,schedule:n});return o}withConversationId(e){return new t({...this._props,conversationId:e})}withUserId(e){return new t({...this._props,userId:e})}withMessageId(e){return new t({...this._props,messageId:e})}async getById(e){return(await this._props.client.getEvent({id:e.id})).event}list(e){return St(({nextToken:n})=>this._props.client.listEvents({...e,type:this._props.eventName,conversationId:this._props.conversationId,userId:this._props.userId,messageId:this._props.messageId,nextToken:n}).then(({meta:r,events:i})=>({meta:r,items:i})))}},GT=(t,e)=>new Proxy({},{get:(n,r)=>{let i=e.alias!==void 0?`${e.alias}${Dt}${r}`:r;return new Zl({client:t,eventName:i})}});S();A();k();S();A();k();S();A();k();S();A();k();S();A();k();var Ll=class{constructor(e,n,r){this._client=e;this._stateType=n;this._stateName=r}async get(e){return await this._client.getState({type:this._stateType,name:this._stateName,id:e}).then(n=>n.state.payload)}async set(e,n,r){await this._client.setState({type:this._stateType,name:this._stateName,id:e,payload:n,expiry:r?.expiryMs})}async getOrSet(e,n,r){return await this._client.getOrSetState({type:this._stateType,name:this._stateName,id:e,payload:n,expiry:r?.expiryMs}).then(i=>i.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})}},VT=(t,e)=>new Proxy({},{get:(n,r)=>new Proxy({},{get:(i,s)=>{let o=e.alias!==void 0?`${e.alias}${Dt}${s}`:s;return new Ll(t,r,o)}})});S();A();k();var dA=t=>"user"in t&&"conversation"in t,Wl=class{constructor(e){this.props=e;this._actionHandlers=e.actions}_runtimeProps;_actionHandlers;_messageHandlers={};_eventHandlers={};_stateExpiredHandlers={};_hookHandlers={before_incoming_event:{},before_incoming_message:{},before_outgoing_message:{},before_outgoing_call_action:{},before_incoming_call_action:{},after_incoming_event:{},after_incoming_message:{},after_outgoing_message:{},after_outgoing_call_action:{},after_incoming_call_action:{}};_workflowHandlers={started:{},continued:{},timed_out:{}};_registerOrder=0;initialize(e){return this._runtimeProps=e,this}get _runtime(){if(!this._runtimeProps)throw new Error("Plugin not correctly initialized. This is likely because you access your plugin config outside of an handler.");return this._runtimeProps}_getTools(e){let{configuration:n,interfaces:r,integrations:i,alias:s}=this._runtime,o=qT(e,this._runtime),a=VT(e,this._runtime),l=fn({client:e,pluginAlias:this._runtime.alias}),c=GT(e,this._runtime),f=jl({client:e,pluginAlias:this._runtime.alias}),p=$l({client:e,plugin:this._runtime}),g=Ul({client:e,plugin:this._runtime});return{configuration:n,interfaces:r,integrations:i,actions:o,states:a,alias:s,workflows:l,events:c,users:f,conversations:p,messages:g}}get actionHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._actionHandlers[n];if(r)return ut.setName(i=>r({...i,...this._getTools(i.client)}),r.name)}})}get messageHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=n==="*"?[]:this._messageHandlers[n]??[],i=this._messageHandlers["*"]??[];return ue.unique([...r,...i]).sort((o,a)=>o.order-a.order).map(({handler:o})=>ut.setName(a=>o({...a,user:Ut({...a,conversationId:a.conversation.id,pluginAlias:this._runtime.alias}),message:Ht({...a,plugin:this._runtime,message:a.message}),conversation:Qn({...a,plugin:this._runtime,conversation:a.conversation}),...this._getTools(a.client)}),o.name))}})}get eventHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=n==="*"?[]:this._eventHandlers[n]??[],i=Object.entries(this._eventHandlers).filter(([a])=>this._eventResolvesTo(a,n)).flatMap(([,a])=>a??[]),s=this._eventHandlers["*"]??[];return ue.unique([...r,...i,...s]).sort((a,l)=>a.order-l.order).map(({handler:a})=>ut.setName(l=>a({...l,...this._getTools(l.client)}),a.name))}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=n==="*"?[]:this._stateExpiredHandlers[n]??[],i=this._stateExpiredHandlers["*"]??[];return ue.unique([...r,...i]).sort((o,a)=>o.order-a.order).map(({handler:o})=>ut.setName(a=>o({...a,...this._getTools(a.client)}),o.name))}})}get hookHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._hookHandlers[n];if(r)return new Proxy({},{get:(i,s)=>{s=this._stripAliasPrefix(s);let o=s==="*"?[]:r[s]??[],a=Object.entries(r).filter(([f])=>this._eventResolvesTo(f,s)).flatMap(([,f])=>f??[]),l=r["*"]??[];return ue.unique([...o,...a,...l]).sort((f,p)=>f.order-p.order).map(({handler:f})=>ut.setName(p=>{let g=qt(p.data,{alias:this._runtime.alias}),y=this._getTools(p.client),T={};if(dA(p)){let P=Ut({client:p.client,user:p.user,conversationId:p.conversation.id,pluginAlias:this._runtime.alias}),I=Qn({client:p.client,plugin:this._runtime,conversation:p.conversation});T={user:P,conversation:I}}return f({...p,data:g,...T,...y})},f.name))}})}})}get workflowHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._workflowHandlers[n];if(r)return new Proxy({},{get:(i,s)=>(r[s]?.sort((a,l)=>a.order-l.order)??[]).map(({handler:a})=>ut.setName(async l=>{let c=l.workflow;return await a({...l,workflow:kt({...l,workflow:c,onWorkflowUpdate(f){c=f},pluginAlias:this._runtime.alias}),...this._getTools(l.client)}),c},a.name))})}})}on={message:(e,n)=>{this._messageHandlers[e]=ue.safePush(this._messageHandlers[e],{handler:n,order:this._registerOrder++})},event:(e,n)=>{this._eventHandlers[e]=ue.safePush(this._eventHandlers[e],{handler:n,order:this._registerOrder++})},stateExpired:(e,n)=>{this._stateExpiredHandlers[e]=ue.safePush(this._stateExpiredHandlers[e],{handler:n,order:this._registerOrder++})},beforeIncomingEvent:(e,n)=>{this._hookHandlers.before_incoming_event[e]=ue.safePush(this._hookHandlers.before_incoming_event[e],{handler:n,order:this._registerOrder++})},beforeIncomingMessage:(e,n)=>{this._hookHandlers.before_incoming_message[e]=ue.safePush(this._hookHandlers.before_incoming_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingMessage:(e,n)=>{this._hookHandlers.before_outgoing_message[e]=ue.safePush(this._hookHandlers.before_outgoing_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingCallAction:(e,n)=>{this._hookHandlers.before_outgoing_call_action[e]=ue.safePush(this._hookHandlers.before_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},beforeIncomingCallAction:(e,n)=>{this._hookHandlers.before_incoming_call_action[e]=ue.safePush(this._hookHandlers.before_incoming_call_action[e],{handler:n,order:this._registerOrder++})},afterIncomingEvent:(e,n)=>{this._hookHandlers.after_incoming_event[e]=ue.safePush(this._hookHandlers.after_incoming_event[e],{handler:n,order:this._registerOrder++})},afterIncomingMessage:(e,n)=>{this._hookHandlers.after_incoming_message[e]=ue.safePush(this._hookHandlers.after_incoming_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingMessage:(e,n)=>{this._hookHandlers.after_outgoing_message[e]=ue.safePush(this._hookHandlers.after_outgoing_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingCallAction:(e,n)=>{this._hookHandlers.after_outgoing_call_action[e]=ue.safePush(this._hookHandlers.after_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},afterIncomingCallAction:(e,n)=>{this._hookHandlers.after_incoming_call_action[e]=ue.safePush(this._hookHandlers.after_incoming_call_action[e],{handler:n,order:this._registerOrder++})},workflowStart:(e,n)=>{this._workflowHandlers.started[e]=ue.safePush(this._workflowHandlers.started[e],{handler:n,order:this._registerOrder++})},workflowContinue:(e,n)=>{this._workflowHandlers.continued[e]=ue.safePush(this._workflowHandlers.continued[e],{handler:n,order:this._registerOrder++})},workflowTimeout:(e,n)=>{this._workflowHandlers.timed_out[e]=ue.safePush(this._workflowHandlers.timed_out[e],{handler:n,order:this._registerOrder++})}};_eventResolvesTo=(e,n)=>{let[i,s]=e.split(":");if(!i||!s)return!1;let o=this._runtime.interfaces[i];if(o&&n===`${o.integrationAlias}:${o?.events?.[s]?.name}`)return!0;let a=this._runtime.integrations[i];return!!(a&&n===`${a.integrationAlias}:${s}`)};_stripAliasPrefix=e=>{let{alias:n}=this._runtime;if(!n)return e;let r=`${n}#`;return e.startsWith(r)?e.slice(r.length):e}};S();A();k();S();A();k();S();A();k();S();A();k();S();A();k();var JT={};pn(JT,{allWithinMajorOf:()=>fA,allWithinMinorOf:()=>pA});S();A();k();import*as pi from"semver";function fA(t){let e=pi.major(t.version);return{...t,version:`>=${e}.0.0 <${e+1}.0.0`}}function pA(t){let e=pi.major(t.version),n=pi.minor(t.version);return{...t,version:`>=${e}.${n}.0 <${e}.${n+1}.0`}}S();A();k();export{Nl as Bot,Ol as BotDefinition,fi as BotLogger,dn as BotSpecificClient,Cl as Integration,qa as IntegrationDefinition,di as IntegrationLogger,ai as IntegrationSpecificClient,Dl as InterfaceDefinition,hC as OAUTH_IDENTIFIER_HEADER,Wl as Plugin,Hl as PluginDefinition,t$ as RuntimeError,yC as WELL_KNOWN_ATTRIBUTES,zh as errors,e$ as isApiError,qm as messages,Nt as parseBody,Po as serve,JT as version,re as z};
|
|
97
97
|
/*! Bundled license information:
|
|
98
98
|
|
|
99
99
|
lodash-es/lodash.js:
|