@botpress/sdk 6.1.0 → 6.2.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 +6 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs +43 -43
- package/dist/index.mjs.map +3 -3
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var Co=Object.defineProperty;var FT=Object.getOwnPropertyDescriptor;var zT=Object.getOwnPropertyNames;var qT=Object.prototype.hasOwnProperty;var it=(t,e)=>()=>(t&&(e=t(t=0)),e);var bn=(t,e)=>{for(var n in e)Co(t,n,{get:e[n],enumerable:!0})},GT=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of zT(e))!qT.call(t,o)&&o!==n&&Co(t,o,{get:()=>e[o],enumerable:!(r=FT(e,o))||r.enumerable});return t};var VT=t=>GT(Co({},"__esModule",{value:!0}),t);var S=it(()=>{});var G={};bn(G,{_debugEnd:()=>Su,_debugProcess:()=>Eu,_events:()=>Wu,_eventsCount:()=>Fu,_exiting:()=>lu,_fatalExceptions:()=>xu,_getActiveHandles:()=>fu,_getActiveRequests:()=>du,_kill:()=>gu,_linkedBinding:()=>su,_maxListeners:()=>Ku,_preload_modules:()=>$u,_rawDebug:()=>iu,_startProfilerIdleNotifier:()=>ku,_stopProfilerIdleNotifier:()=>Au,_tickCallback:()=>Iu,abort:()=>Mu,addListener:()=>zu,allowedNodeEnvironmentFlags:()=>_u,arch:()=>Wl,argv:()=>ql,argv0:()=>ju,assert:()=>bu,binding:()=>Xl,browser:()=>ru,chdir:()=>tu,config:()=>uu,cpuUsage:()=>pi,cwd:()=>eu,debugPort:()=>Uu,default:()=>tc,dlopen:()=>cu,domain:()=>au,emit:()=>Yu,emitWarning:()=>Yl,env:()=>zl,execArgv:()=>Gl,execPath:()=>Hu,exit:()=>Tu,features:()=>wu,hasUncaughtExceptionCaptureCallback:()=>Bu,hrtime:()=>fi,kill:()=>hu,listeners:()=>ec,memoryUsage:()=>yu,moduleLoadList:()=>ou,nextTick:()=>Zl,off:()=>Gu,on:()=>Gt,once:()=>qu,openStdin:()=>vu,pid:()=>Nu,platform:()=>Fl,ppid:()=>Du,prependListener:()=>Xu,prependOnceListener:()=>Qu,reallyExit:()=>pu,release:()=>nu,removeAllListeners:()=>Ju,removeListener:()=>Vu,resourceUsage:()=>mu,setSourceMapsEnabled:()=>Zu,setUncaughtExceptionCaptureCallback:()=>Pu,stderr:()=>Ou,stdin:()=>Ru,stdout:()=>Cu,title:()=>Kl,umask:()=>Ql,uptime:()=>Lu,version:()=>Vl,versions:()=>Jl});function Mo(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function JT(){!Jn||!wn||(Jn=!1,wn.length?qt=wn.concat(qt):di=-1,qt.length&&$l())}function $l(){if(!Jn){var t=setTimeout(JT,0);Jn=!0;for(var e=qt.length;e;){for(wn=qt,qt=[];++di<e;)wn&&wn[di].run();di=-1,e=qt.length}wn=null,Jn=!1,clearTimeout(t)}}function Zl(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];qt.push(new Ll(t,e)),qt.length===1&&!Jn&&setTimeout($l,0)}function Ll(t,e){this.fun=t,this.array=e}function st(){}function su(t){Mo("_linkedBinding")}function cu(t){Mo("dlopen")}function du(){return[]}function fu(){return[]}function bu(t,e){if(!t)throw new Error(e||"assertion error")}function Bu(){return!1}function Lu(){return fn.now()/1e3}function fi(t){var e=Math.floor((Date.now()-fn.now())*.001),n=fn.now()*.001,r=Math.floor(n)+e,o=Math.floor(n%1*1e9);return t&&(r=r-t[0],o=o-t[1],o<0&&(r--,o+=Ro)),[r,o]}function Gt(){return tc}function ec(t){return[]}var qt,Jn,wn,di,Kl,Wl,Fl,zl,ql,Gl,Vl,Jl,Yl,Xl,Ql,eu,tu,nu,ru,iu,ou,au,lu,uu,pu,gu,pi,mu,yu,hu,Tu,vu,_u,wu,xu,Pu,Iu,Eu,Su,ku,Au,Cu,Ou,Ru,Mu,Nu,Du,Hu,Uu,ju,$u,Zu,fn,Oo,Ro,Ku,Wu,Fu,zu,qu,Gu,Vu,Ju,Yu,Xu,Qu,tc,nc=it(()=>{S();A();k();qt=[],Jn=!1,di=-1;Ll.prototype.run=function(){this.fun.apply(null,this.array)};Kl="browser",Wl="x64",Fl="browser",zl={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},ql=["/usr/bin/node"],Gl=[],Vl="v16.8.0",Jl={},Yl=function(t,e){console.warn((e?e+": ":"")+t)},Xl=function(t){Mo("binding")},Ql=function(t){return 0},eu=function(){return"/"},tu=function(t){},nu={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};ru=!0,iu=st,ou=[];au={},lu=!1,uu={};pu=st,gu=st,pi=function(){return{}},mu=pi,yu=pi,hu=st,Tu=st,vu=st,_u={};wu={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},xu=st,Pu=st;Iu=st,Eu=st,Su=st,ku=st,Au=st,Cu=void 0,Ou=void 0,Ru=void 0,Mu=st,Nu=2,Du=1,Hu="/bin/usr/node",Uu=9229,ju="node",$u=[],Zu=st,fn={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};fn.now===void 0&&(Oo=Date.now(),fn.timing&&fn.timing.navigationStart&&(Oo=fn.timing.navigationStart),fn.now=()=>Date.now()-Oo);Ro=1e9;fi.bigint=function(t){var e=fi(t);return typeof BigInt>"u"?e[0]*Ro+e[1]:BigInt(e[0]*Ro)+BigInt(e[1])};Ku=10,Wu={},Fu=0;zu=Gt,qu=Gt,Gu=Gt,Vu=Gt,Ju=Gt,Yu=st,Xu=Gt,Qu=Gt;tc={version:Vl,versions:Jl,arch:Wl,platform:Fl,browser:ru,release:nu,_rawDebug:iu,moduleLoadList:ou,binding:Xl,_linkedBinding:su,_events:Wu,_eventsCount:Fu,_maxListeners:Ku,on:Gt,addListener:zu,once:qu,off:Gu,removeListener:Vu,removeAllListeners:Ju,emit:Yu,prependListener:Xu,prependOnceListener:Qu,listeners:ec,domain:au,_exiting:lu,config:uu,dlopen:cu,uptime:Lu,_getActiveRequests:du,_getActiveHandles:fu,reallyExit:pu,_kill:gu,cpuUsage:pi,resourceUsage:mu,memoryUsage:yu,kill:hu,exit:Tu,openStdin:vu,allowedNodeEnvironmentFlags:_u,assert:bu,features:wu,_fatalExceptions:xu,setUncaughtExceptionCaptureCallback:Pu,hasUncaughtExceptionCaptureCallback:Bu,emitWarning:Yl,nextTick:Zl,_tickCallback:Iu,_debugProcess:Eu,_debugEnd:Su,_startProfilerIdleNotifier:ku,_stopProfilerIdleNotifier:Au,stdout:Cu,stdin:Ru,stderr:Ou,abort:Mu,umask:Ql,chdir:tu,cwd:eu,env:zl,title:Kl,argv:ql,execArgv:Gl,pid:Nu,ppid:Du,execPath:Hu,debugPort:Uu,hrtime:fi,argv0:ju,_preload_modules:$u,setSourceMapsEnabled:Zu}});var k=it(()=>{nc()});function YT(){if(rc)return _r;rc=!0,_r.byteLength=a,_r.toByteArray=c,_r.fromByteArray=p;for(var t=[],e=[],n=typeof Uint8Array<"u"?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,s=r.length;o<s;++o)t[o]=r[o],e[r.charCodeAt(o)]=o;e[45]=62,e[95]=63;function i(h){var _=h.length;if(_%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var P=h.indexOf("=");P===-1&&(P=_);var B=P===_?0:4-P%4;return[P,B]}function a(h){var _=i(h),P=_[0],B=_[1];return(P+B)*3/4-B}function l(h,_,P){return(_+P)*3/4-P}function c(h){var _,P=i(h),B=P[0],T=P[1],E=new n(l(h,B,T)),I=0,D=T>0?B-4:B,$;for($=0;$<D;$+=4)_=e[h.charCodeAt($)]<<18|e[h.charCodeAt($+1)]<<12|e[h.charCodeAt($+2)]<<6|e[h.charCodeAt($+3)],E[I++]=_>>16&255,E[I++]=_>>8&255,E[I++]=_&255;return T===2&&(_=e[h.charCodeAt($)]<<2|e[h.charCodeAt($+1)]>>4,E[I++]=_&255),T===1&&(_=e[h.charCodeAt($)]<<10|e[h.charCodeAt($+1)]<<4|e[h.charCodeAt($+2)]>>2,E[I++]=_>>8&255,E[I++]=_&255),E}function f(h){return t[h>>18&63]+t[h>>12&63]+t[h>>6&63]+t[h&63]}function g(h,_,P){for(var B,T=[],E=_;E<P;E+=3)B=(h[E]<<16&16711680)+(h[E+1]<<8&65280)+(h[E+2]&255),T.push(f(B));return T.join("")}function p(h){for(var _,P=h.length,B=P%3,T=[],E=16383,I=0,D=P-B;I<D;I+=E)T.push(g(h,I,I+E>D?D:I+E));return B===1?(_=h[P-1],T.push(t[_>>2]+t[_<<4&63]+"==")):B===2&&(_=(h[P-2]<<8)+h[P-1],T.push(t[_>>10]+t[_>>4&63]+t[_<<2&63]+"=")),T.join("")}return _r}function XT(){if(ic)return gi;ic=!0;return gi.read=function(t,e,n,r,o){var s,i,a=o*8-r-1,l=(1<<a)-1,c=l>>1,f=-7,g=n?o-1:0,p=n?-1:1,h=t[e+g];for(g+=p,s=h&(1<<-f)-1,h>>=-f,f+=a;f>0;s=s*256+t[e+g],g+=p,f-=8);for(i=s&(1<<-f)-1,s>>=-f,f+=r;f>0;i=i*256+t[e+g],g+=p,f-=8);if(s===0)s=1-c;else{if(s===l)return i?NaN:(h?-1:1)*(1/0);i=i+Math.pow(2,r),s=s-c}return(h?-1:1)*i*Math.pow(2,s-r)},gi.write=function(t,e,n,r,o,s){var i,a,l,c=s*8-o-1,f=(1<<c)-1,g=f>>1,p=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:s-1,_=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,i=f):(i=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-i))<1&&(i--,l*=2),i+g>=1?e+=p/l:e+=p*Math.pow(2,1-g),e*l>=2&&(i++,l/=2),i+g>=f?(a=0,i=f):i+g>=1?(a=(e*l-1)*Math.pow(2,o),i=i+g):(a=e*Math.pow(2,g-1)*Math.pow(2,o),i=0));o>=8;t[n+h]=a&255,h+=_,a/=256,o-=8);for(i=i<<o|a,c+=o;c>0;t[n+h]=i&255,h+=_,i/=256,c-=8);t[n+h-_]|=P*128},gi}function Ut(){if(oc)return xn;oc=!0;let t=YT(),e=XT(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;xn.Buffer=i,xn.SlowBuffer=T,xn.INSPECT_MAX_BYTES=50;let r=2147483647;xn.kMaxLength=r,i.TYPED_ARRAY_SUPPORT=o(),!i.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function o(){try{let y=new Uint8Array(1),u={foo:function(){return 42}};return Object.setPrototypeOf(u,Uint8Array.prototype),Object.setPrototypeOf(y,u),y.foo()===42}catch{return!1}}Object.defineProperty(i.prototype,"parent",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.buffer}}),Object.defineProperty(i.prototype,"offset",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.byteOffset}});function s(y){if(y>r)throw new RangeError('The value "'+y+'" is invalid for option "size"');let u=new Uint8Array(y);return Object.setPrototypeOf(u,i.prototype),u}function i(y,u,d){if(typeof y=="number"){if(typeof u=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return f(y)}return a(y,u,d)}i.poolSize=8192;function a(y,u,d){if(typeof y=="string")return g(y,u);if(ArrayBuffer.isView(y))return h(y);if(y==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof y);if(vt(y,ArrayBuffer)||y&&vt(y.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(vt(y,SharedArrayBuffer)||y&&vt(y.buffer,SharedArrayBuffer)))return _(y,u,d);if(typeof y=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let v=y.valueOf&&y.valueOf();if(v!=null&&v!==y)return i.from(v,u,d);let O=P(y);if(O)return O;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof y[Symbol.toPrimitive]=="function")return i.from(y[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 y)}i.from=function(y,u,d){return a(y,u,d)},Object.setPrototypeOf(i.prototype,Uint8Array.prototype),Object.setPrototypeOf(i,Uint8Array);function l(y){if(typeof y!="number")throw new TypeError('"size" argument must be of type number');if(y<0)throw new RangeError('The value "'+y+'" is invalid for option "size"')}function c(y,u,d){return l(y),y<=0?s(y):u!==void 0?typeof d=="string"?s(y).fill(u,d):s(y).fill(u):s(y)}i.alloc=function(y,u,d){return c(y,u,d)};function f(y){return l(y),s(y<0?0:B(y)|0)}i.allocUnsafe=function(y){return f(y)},i.allocUnsafeSlow=function(y){return f(y)};function g(y,u){if((typeof u!="string"||u==="")&&(u="utf8"),!i.isEncoding(u))throw new TypeError("Unknown encoding: "+u);let d=E(y,u)|0,v=s(d),O=v.write(y,u);return O!==d&&(v=v.slice(0,O)),v}function p(y){let u=y.length<0?0:B(y.length)|0,d=s(u);for(let v=0;v<u;v+=1)d[v]=y[v]&255;return d}function h(y){if(vt(y,Uint8Array)){let u=new Uint8Array(y);return _(u.buffer,u.byteOffset,u.byteLength)}return p(y)}function _(y,u,d){if(u<0||y.byteLength<u)throw new RangeError('"offset" is outside of buffer bounds');if(y.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(y):d===void 0?v=new Uint8Array(y,u):v=new Uint8Array(y,u,d),Object.setPrototypeOf(v,i.prototype),v}function P(y){if(i.isBuffer(y)){let u=B(y.length)|0,d=s(u);return d.length===0||y.copy(d,0,0,u),d}if(y.length!==void 0)return typeof y.length!="number"||Tr(y.length)?s(0):p(y);if(y.type==="Buffer"&&Array.isArray(y.data))return p(y.data)}function B(y){if(y>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return y|0}function T(y){return+y!=y&&(y=0),i.alloc(+y)}i.isBuffer=function(u){return u!=null&&u._isBuffer===!0&&u!==i.prototype},i.compare=function(u,d){if(vt(u,Uint8Array)&&(u=i.from(u,u.offset,u.byteLength)),vt(d,Uint8Array)&&(d=i.from(d,d.offset,d.byteLength)),!i.isBuffer(u)||!i.isBuffer(d))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(u===d)return 0;let v=u.length,O=d.length;for(let H=0,W=Math.min(v,O);H<W;++H)if(u[H]!==d[H]){v=u[H],O=d[H];break}return v<O?-1:O<v?1:0},i.isEncoding=function(u){switch(String(u).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},i.concat=function(u,d){if(!Array.isArray(u))throw new TypeError('"list" argument must be an Array of Buffers');if(u.length===0)return i.alloc(0);let v;if(d===void 0)for(d=0,v=0;v<u.length;++v)d+=u[v].length;let O=i.allocUnsafe(d),H=0;for(v=0;v<u.length;++v){let W=u[v];if(vt(W,Uint8Array))H+W.length>O.length?(i.isBuffer(W)||(W=i.from(W)),W.copy(O,H)):Uint8Array.prototype.set.call(O,W,H);else if(i.isBuffer(W))W.copy(O,H);else throw new TypeError('"list" argument must be an Array of Buffers');H+=W.length}return O};function E(y,u){if(i.isBuffer(y))return y.length;if(ArrayBuffer.isView(y)||vt(y,ArrayBuffer))return y.byteLength;if(typeof y!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof y);let d=y.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 Se(y).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d*2;case"hex":return d>>>1;case"base64":return kt(y).length;default:if(O)return v?-1:Se(y).length;u=(""+u).toLowerCase(),O=!0}}i.byteLength=E;function I(y,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(y||(y="utf8");;)switch(y){case"hex":return ve(this,u,d);case"utf8":case"utf-8":return Xe(this,u,d);case"ascii":return pt(this,u,d);case"latin1":case"binary":return Re(this,u,d);case"base64":return Le(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: "+y);y=(y+"").toLowerCase(),v=!0}}i.prototype._isBuffer=!0;function D(y,u,d){let v=y[u];y[u]=y[d],y[d]=v}i.prototype.swap16=function(){let u=this.length;if(u%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let d=0;d<u;d+=2)D(this,d,d+1);return this},i.prototype.swap32=function(){let u=this.length;if(u%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let d=0;d<u;d+=4)D(this,d,d+3),D(this,d+1,d+2);return this},i.prototype.swap64=function(){let u=this.length;if(u%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let d=0;d<u;d+=8)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},i.prototype.toString=function(){let u=this.length;return u===0?"":arguments.length===0?Xe(this,0,u):I.apply(this,arguments)},i.prototype.toLocaleString=i.prototype.toString,i.prototype.equals=function(u){if(!i.isBuffer(u))throw new TypeError("Argument must be a Buffer");return this===u?!0:i.compare(this,u)===0},i.prototype.inspect=function(){let u="",d=xn.INSPECT_MAX_BYTES;return u=this.toString("hex",0,d).replace(/(.{2})/g,"$1 ").trim(),this.length>d&&(u+=" ... "),"<Buffer "+u+">"},n&&(i.prototype[n]=i.prototype.inspect),i.prototype.compare=function(u,d,v,O,H){if(vt(u,Uint8Array)&&(u=i.from(u,u.offset,u.byteLength)),!i.isBuffer(u))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof u);if(d===void 0&&(d=0),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 W=H-O,_e=v-d,Ke=Math.min(W,_e),De=this.slice(O,H),We=u.slice(d,v);for(let Oe=0;Oe<Ke;++Oe)if(De[Oe]!==We[Oe]){W=De[Oe],_e=We[Oe];break}return W<_e?-1:_e<W?1:0};function $(y,u,d,v,O){if(y.length===0)return-1;if(typeof d=="string"?(v=d,d=0):d>2147483647?d=2147483647:d<-2147483648&&(d=-2147483648),d=+d,Tr(d)&&(d=O?0:y.length-1),d<0&&(d=y.length+d),d>=y.length){if(O)return-1;d=y.length-1}else if(d<0)if(O)d=0;else return-1;if(typeof u=="string"&&(u=i.from(u,v)),i.isBuffer(u))return u.length===0?-1:ee(y,u,d,v,O);if(typeof u=="number")return u=u&255,typeof Uint8Array.prototype.indexOf=="function"?O?Uint8Array.prototype.indexOf.call(y,u,d):Uint8Array.prototype.lastIndexOf.call(y,u,d):ee(y,[u],d,v,O);throw new TypeError("val must be string, number or Buffer")}function ee(y,u,d,v,O){let H=1,W=y.length,_e=u.length;if(v!==void 0&&(v=String(v).toLowerCase(),v==="ucs2"||v==="ucs-2"||v==="utf16le"||v==="utf-16le")){if(y.length<2||u.length<2)return-1;H=2,W/=2,_e/=2,d/=2}function Ke(We,Oe){return H===1?We[Oe]:We.readUInt16BE(Oe*H)}let De;if(O){let We=-1;for(De=d;De<W;De++)if(Ke(y,De)===Ke(u,We===-1?0:De-We)){if(We===-1&&(We=De),De-We+1===_e)return We*H}else We!==-1&&(De-=De-We),We=-1}else for(d+_e>W&&(d=W-_e),De=d;De>=0;De--){let We=!0;for(let Oe=0;Oe<_e;Oe++)if(Ke(y,De+Oe)!==Ke(u,Oe)){We=!1;break}if(We)return De}return-1}i.prototype.includes=function(u,d,v){return this.indexOf(u,d,v)!==-1},i.prototype.indexOf=function(u,d,v){return $(this,u,d,v,!0)},i.prototype.lastIndexOf=function(u,d,v){return $(this,u,d,v,!1)};function Y(y,u,d,v){d=Number(d)||0;let O=y.length-d;v?(v=Number(v),v>O&&(v=O)):v=O;let H=u.length;v>H/2&&(v=H/2);let W;for(W=0;W<v;++W){let _e=parseInt(u.substr(W*2,2),16);if(Tr(_e))return W;y[d+W]=_e}return W}function ce(y,u,d,v){return Ht(Se(u,y.length-d),y,d,v)}function re(y,u,d,v){return Ht(me(u),y,d,v)}function Q(y,u,d,v){return Ht(kt(u),y,d,v)}function Ie(y,u,d,v){return Ht(U(u,y.length-d),y,d,v)}i.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 W=!1;for(;;)switch(O){case"hex":return Y(this,u,d,v);case"utf8":case"utf-8":return ce(this,u,d,v);case"ascii":case"latin1":case"binary":return re(this,u,d,v);case"base64":return Q(this,u,d,v);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ie(this,u,d,v);default:if(W)throw new TypeError("Unknown encoding: "+O);O=(""+O).toLowerCase(),W=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Le(y,u,d){return u===0&&d===y.length?t.fromByteArray(y):t.fromByteArray(y.slice(u,d))}function Xe(y,u,d){d=Math.min(y.length,d);let v=[],O=u;for(;O<d;){let H=y[O],W=null,_e=H>239?4:H>223?3:H>191?2:1;if(O+_e<=d){let Ke,De,We,Oe;switch(_e){case 1:H<128&&(W=H);break;case 2:Ke=y[O+1],(Ke&192)===128&&(Oe=(H&31)<<6|Ke&63,Oe>127&&(W=Oe));break;case 3:Ke=y[O+1],De=y[O+2],(Ke&192)===128&&(De&192)===128&&(Oe=(H&15)<<12|(Ke&63)<<6|De&63,Oe>2047&&(Oe<55296||Oe>57343)&&(W=Oe));break;case 4:Ke=y[O+1],De=y[O+2],We=y[O+3],(Ke&192)===128&&(De&192)===128&&(We&192)===128&&(Oe=(H&15)<<18|(Ke&63)<<12|(De&63)<<6|We&63,Oe>65535&&Oe<1114112&&(W=Oe))}}W===null?(W=65533,_e=1):W>65535&&(W-=65536,v.push(W>>>10&1023|55296),W=56320|W&1023),v.push(W),O+=_e}return ze(v)}let Fe=4096;function ze(y){let u=y.length;if(u<=Fe)return String.fromCharCode.apply(String,y);let d="",v=0;for(;v<u;)d+=String.fromCharCode.apply(String,y.slice(v,v+=Fe));return d}function pt(y,u,d){let v="";d=Math.min(y.length,d);for(let O=u;O<d;++O)v+=String.fromCharCode(y[O]&127);return v}function Re(y,u,d){let v="";d=Math.min(y.length,d);for(let O=u;O<d;++O)v+=String.fromCharCode(y[O]);return v}function ve(y,u,d){let v=y.length;(!u||u<0)&&(u=0),(!d||d<0||d>v)&&(d=v);let O="";for(let H=u;H<d;++H)O+=ci[y[H]];return O}function we(y,u,d){let v=y.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}i.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,i.prototype),O};function se(y,u,d){if(y%1!==0||y<0)throw new RangeError("offset is not uint");if(y+u>d)throw new RangeError("Trying to access beyond buffer length")}i.prototype.readUintLE=i.prototype.readUIntLE=function(u,d,v){u=u>>>0,d=d>>>0,v||se(u,d,this.length);let O=this[u],H=1,W=0;for(;++W<d&&(H*=256);)O+=this[u+W]*H;return O},i.prototype.readUintBE=i.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},i.prototype.readUint8=i.prototype.readUInt8=function(u,d){return u=u>>>0,d||se(u,1,this.length),this[u]},i.prototype.readUint16LE=i.prototype.readUInt16LE=function(u,d){return u=u>>>0,d||se(u,2,this.length),this[u]|this[u+1]<<8},i.prototype.readUint16BE=i.prototype.readUInt16BE=function(u,d){return u=u>>>0,d||se(u,2,this.length),this[u]<<8|this[u+1]},i.prototype.readUint32LE=i.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},i.prototype.readUint32BE=i.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])},i.prototype.readBigUInt64LE=xt(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))}),i.prototype.readBigUInt64BE=xt(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)}),i.prototype.readIntLE=function(u,d,v){u=u>>>0,d=d>>>0,v||se(u,d,this.length);let O=this[u],H=1,W=0;for(;++W<d&&(H*=256);)O+=this[u+W]*H;return H*=128,O>=H&&(O-=Math.pow(2,8*d)),O},i.prototype.readIntBE=function(u,d,v){u=u>>>0,d=d>>>0,v||se(u,d,this.length);let O=d,H=1,W=this[u+--O];for(;O>0&&(H*=256);)W+=this[u+--O]*H;return H*=128,W>=H&&(W-=Math.pow(2,8*d)),W},i.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]},i.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},i.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},i.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},i.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]},i.prototype.readBigInt64LE=xt(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)}),i.prototype.readBigInt64BE=xt(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)}),i.prototype.readFloatLE=function(u,d){return u=u>>>0,d||se(u,4,this.length),e.read(this,u,!0,23,4)},i.prototype.readFloatBE=function(u,d){return u=u>>>0,d||se(u,4,this.length),e.read(this,u,!1,23,4)},i.prototype.readDoubleLE=function(u,d){return u=u>>>0,d||se(u,8,this.length),e.read(this,u,!0,52,8)},i.prototype.readDoubleBE=function(u,d){return u=u>>>0,d||se(u,8,this.length),e.read(this,u,!1,52,8)};function de(y,u,d,v,O,H){if(!i.isBuffer(y))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>y.length)throw new RangeError("Index out of range")}i.prototype.writeUintLE=i.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,W=0;for(this[d]=u&255;++W<v&&(H*=256);)this[d+W]=u/H&255;return d+v},i.prototype.writeUintBE=i.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,W=1;for(this[d+H]=u&255;--H>=0&&(W*=256);)this[d+H]=u/W&255;return d+v},i.prototype.writeUint8=i.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},i.prototype.writeUint16LE=i.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},i.prototype.writeUint16BE=i.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},i.prototype.writeUint32LE=i.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},i.prototype.writeUint32BE=i.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(y,u,d,v,O){te(u,v,O,y,d,7);let H=Number(u&BigInt(4294967295));y[d++]=H,H=H>>8,y[d++]=H,H=H>>8,y[d++]=H,H=H>>8,y[d++]=H;let W=Number(u>>BigInt(32)&BigInt(4294967295));return y[d++]=W,W=W>>8,y[d++]=W,W=W>>8,y[d++]=W,W=W>>8,y[d++]=W,d}function Z(y,u,d,v,O){te(u,v,O,y,d,7);let H=Number(u&BigInt(4294967295));y[d+7]=H,H=H>>8,y[d+6]=H,H=H>>8,y[d+5]=H,H=H>>8,y[d+4]=H;let W=Number(u>>BigInt(32)&BigInt(4294967295));return y[d+3]=W,W=W>>8,y[d+2]=W,W=W>>8,y[d+1]=W,W=W>>8,y[d]=W,d+8}i.prototype.writeBigUInt64LE=xt(function(u,d=0){return N(this,u,d,BigInt(0),BigInt("0xffffffffffffffff"))}),i.prototype.writeBigUInt64BE=xt(function(u,d=0){return Z(this,u,d,BigInt(0),BigInt("0xffffffffffffffff"))}),i.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,W=1,_e=0;for(this[d]=u&255;++H<v&&(W*=256);)u<0&&_e===0&&this[d+H-1]!==0&&(_e=1),this[d+H]=(u/W>>0)-_e&255;return d+v},i.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,W=1,_e=0;for(this[d+H]=u&255;--H>=0&&(W*=256);)u<0&&_e===0&&this[d+H+1]!==0&&(_e=1),this[d+H]=(u/W>>0)-_e&255;return d+v},i.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},i.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},i.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},i.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},i.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},i.prototype.writeBigInt64LE=xt(function(u,d=0){return N(this,u,d,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),i.prototype.writeBigInt64BE=xt(function(u,d=0){return Z(this,u,d,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function K(y,u,d,v,O,H){if(d+v>y.length)throw new RangeError("Index out of range");if(d<0)throw new RangeError("Index out of range")}function le(y,u,d,v,O){return u=+u,d=d>>>0,O||K(y,u,d,4),e.write(y,u,d,v,23,4),d+4}i.prototype.writeFloatLE=function(u,d,v){return le(this,u,d,!0,v)},i.prototype.writeFloatBE=function(u,d,v){return le(this,u,d,!1,v)};function ge(y,u,d,v,O){return u=+u,d=d>>>0,O||K(y,u,d,8),e.write(y,u,d,v,52,8),d+8}i.prototype.writeDoubleLE=function(u,d,v){return ge(this,u,d,!0,v)},i.prototype.writeDoubleBE=function(u,d,v){return ge(this,u,d,!1,v)},i.prototype.copy=function(u,d,v,O){if(!i.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},i.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"&&!i.isEncoding(O))throw new TypeError("Unknown encoding: "+O);if(u.length===1){let W=u.charCodeAt(0);(O==="utf8"&&W<128||O==="latin1")&&(u=W)}}else typeof u=="number"?u=u&255:typeof u=="boolean"&&(u=Number(u));if(d<0||this.length<d||this.length<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 W=i.isBuffer(u)?u:i.from(u,O),_e=W.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]=W[H%_e]}return this};let R={};function C(y,u,d){R[y]=class extends d{constructor(){super(),Object.defineProperty(this,"message",{value:u.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${y}]`,this.stack,delete this.name}get code(){return y}set code(O){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:O,writable:!0})}toString(){return`${this.name} [${y}]: ${this.message}`}}}C("ERR_BUFFER_OUT_OF_BOUNDS",function(y){return y?`${y} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),C("ERR_INVALID_ARG_TYPE",function(y,u){return`The "${y}" argument must be of type number. Received type ${typeof u}`},TypeError),C("ERR_OUT_OF_RANGE",function(y,u,d){let v=`The value of "${y}" 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(y){let u="",d=y.length,v=y[0]==="-"?1:0;for(;d>=v+4;d-=3)u=`_${y.slice(d-3,d)}${u}`;return`${y.slice(0,d)}${u}`}function V(y,u,d){b(u,"offset"),(y[u]===void 0||y[u+d]===void 0)&&x(u,y.length-(d+1))}function te(y,u,d,v,O,H){if(y>d||y<u){let W=typeof u=="bigint"?"n":"",_e;throw u===0||u===BigInt(0)?_e=`>= 0${W} and < 2${W} ** ${(H+1)*8}${W}`:_e=`>= -(2${W} ** ${(H+1)*8-1}${W}) and < 2 ** ${(H+1)*8-1}${W}`,new R.ERR_OUT_OF_RANGE("value",_e,y)}V(v,O,H)}function b(y,u){if(typeof y!="number")throw new R.ERR_INVALID_ARG_TYPE(u,"number",y)}function x(y,u,d){throw Math.floor(y)!==y?(b(y,d),new R.ERR_OUT_OF_RANGE("offset","an integer",y)):u<0?new R.ERR_BUFFER_OUT_OF_BOUNDS:new R.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${u}`,y)}let F=/[^+/0-9A-Za-z-_]/g;function J(y){if(y=y.split("=")[0],y=y.trim().replace(F,""),y.length<2)return"";for(;y.length%4!==0;)y=y+"=";return y}function Se(y,u){u=u||1/0;let d,v=y.length,O=null,H=[];for(let W=0;W<v;++W){if(d=y.charCodeAt(W),d>55295&&d<57344){if(!O){if(d>56319){(u-=3)>-1&&H.push(239,191,189);continue}else if(W+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(y){let u=[];for(let d=0;d<y.length;++d)u.push(y.charCodeAt(d)&255);return u}function U(y,u){let d,v,O,H=[];for(let W=0;W<y.length&&!((u-=2)<0);++W)d=y.charCodeAt(W),v=d>>8,O=d%256,H.push(O),H.push(v);return H}function kt(y){return t.toByteArray(J(y))}function Ht(y,u,d,v){let O;for(O=0;O<v&&!(O+d>=u.length||O>=y.length);++O)u[O+d]=y[O];return O}function vt(y,u){return y instanceof u||y!=null&&y.constructor!=null&&y.constructor.name!=null&&y.constructor.name===u.name}function Tr(y){return y!==y}let ci=(function(){let y="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]=y[d]+y[O]}return u})();function xt(y){return typeof BigInt>"u"?vr:y}function vr(){throw new Error("BigInt not supported")}return xn}var _r,rc,gi,ic,xn,oc,mi=it(()=>{S();A();k();_r={},rc=!1;gi={},ic=!1;xn={},oc=!1});var Pn,z,vA,_A,sc=it(()=>{S();A();k();mi();Pn=Ut();Pn.Buffer;Pn.SlowBuffer;Pn.INSPECT_MAX_BYTES;Pn.kMaxLength;z=Pn.Buffer,vA=Pn.INSPECT_MAX_BYTES,_A=Pn.kMaxLength});var A=it(()=>{sc()});function Zt(){return Km||(Km=!0,typeof Object.create=="function"?Qi=function(e,n){n&&(e.super_=n,e.prototype=Object.create(n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Qi=function(e,n){if(n){e.super_=n;var r=function(){};r.prototype=n.prototype,e.prototype=new r,e.prototype.constructor=e}}),Qi}var Qi,Km,qs=it(()=>{S();A();k();Qi={},Km=!1});function Ae(){Ae.init.call(this)}function eo(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function Qm(t){return t._maxListeners===void 0?Ae.defaultMaxListeners:t._maxListeners}function qm(t,e,n,r){var o,s,i,a;if(eo(n),(s=t._events)===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,n.listener?n.listener:n),s=t._events),i=s[e]),i===void 0)i=s[e]=n,++t._eventsCount;else if(typeof i=="function"?i=s[e]=r?[n,i]:[i,n]:r?i.unshift(n):i.push(n),(o=Qm(t))>0&&i.length>o&&!i.warned){i.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+i.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=i.length,a=l,console&&console.warn&&console.warn(a)}return t}function KB(){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 Gm(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},o=KB.bind(r);return o.listener=n,r.wrapFn=o,o}function Vm(t,e,n){var r=t._events;if(r===void 0)return[];var o=r[e];return o===void 0?[]:typeof o=="function"?n?[o.listener||o]:[o]:n?(function(s){for(var i=new Array(s.length),a=0;a<i.length;++a)i[a]=s[a].listener||s[a];return i})(o):ey(o,o.length)}function Jm(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 ey(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}var Ym,Xm,sr,Wm,Fm,zm,yt,Gs=it(()=>{S();A();k();sr=typeof Reflect=="object"?Reflect:null,Wm=sr&&typeof sr.apply=="function"?sr.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};Xm=sr&&typeof sr.ownKeys=="function"?sr.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};Fm=Number.isNaN||function(t){return t!=t};Ym=Ae,Ae.EventEmitter=Ae,Ae.prototype._events=void 0,Ae.prototype._eventsCount=0,Ae.prototype._maxListeners=void 0;zm=10;Object.defineProperty(Ae,"defaultMaxListeners",{enumerable:!0,get:function(){return zm},set:function(t){if(typeof t!="number"||t<0||Fm(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");zm=t}}),Ae.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},Ae.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||Fm(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},Ae.prototype.getMaxListeners=function(){return Qm(this)},Ae.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var r=t==="error",o=this._events;if(o!==void 0)r=r&&o.error===void 0;else if(!r)return!1;if(r){var s;if(e.length>0&&(s=e[0]),s instanceof Error)throw s;var i=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw i.context=s,i}var a=o[t];if(a===void 0)return!1;if(typeof a=="function")Wm(a,this,e);else{var l=a.length,c=ey(a,l);for(n=0;n<l;++n)Wm(c[n],this,e)}return!0},Ae.prototype.addListener=function(t,e){return qm(this,t,e,!1)},Ae.prototype.on=Ae.prototype.addListener,Ae.prototype.prependListener=function(t,e){return qm(this,t,e,!0)},Ae.prototype.once=function(t,e){return eo(e),this.on(t,Gm(this,t,e)),this},Ae.prototype.prependOnceListener=function(t,e){return eo(e),this.prependListener(t,Gm(this,t,e)),this},Ae.prototype.removeListener=function(t,e){var n,r,o,s,i;if(eo(e),(r=this._events)===void 0)return this;if((n=r[t])===void 0)return this;if(n===e||n.listener===e)--this._eventsCount==0?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if(typeof n!="function"){for(o=-1,s=n.length-1;s>=0;s--)if(n[s]===e||n[s].listener===e){i=n[s].listener,o=s;break}if(o<0)return this;o===0?n.shift():(function(a,l){for(;l+1<a.length;l++)a[l]=a[l+1];a.pop()})(n,o),n.length===1&&(r[t]=n[0]),r.removeListener!==void 0&&this.emit("removeListener",t,i||e)}return this},Ae.prototype.off=Ae.prototype.removeListener,Ae.prototype.removeAllListeners=function(t){var e,n,r;if((n=this._events)===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[t]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete n[t]),this;if(arguments.length===0){var o,s=Object.keys(n);for(r=0;r<s.length;++r)(o=s[r])!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(typeof(e=n[t])=="function")this.removeListener(t,e);else if(e!==void 0)for(r=e.length-1;r>=0;r--)this.removeListener(t,e[r]);return this},Ae.prototype.listeners=function(t){return Vm(this,t,!0)},Ae.prototype.rawListeners=function(t){return Vm(this,t,!1)},Ae.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Jm.call(t,e)},Ae.prototype.listenerCount=Jm,Ae.prototype.eventNames=function(){return this._eventsCount>0?Xm(this._events):[]};yt=Ym;yt.EventEmitter;yt.defaultMaxListeners;yt.init;yt.listenerCount;yt.EventEmitter;yt.defaultMaxListeners;yt.init;yt.listenerCount});var ty=it(()=>{S();A();k();Gs();yt.once=function(t,e){return new Promise((n,r)=>{function o(...i){s!==void 0&&t.removeListener("error",s),n(i)}let s;e!=="error"&&(s=i=>{t.removeListener(name,o),r(i)},t.once("error",s)),t.once(e,o)})};yt.on=function(t,e){let n=[],r=[],o=null,s=!1,i={async next(){let c=n.shift();if(c)return createIterResult(c,!1);if(o){let f=Promise.reject(o);return o=null,f}return s?createIterResult(void 0,!0):new Promise((f,g)=>r.push({resolve:f,reject:g}))},async return(){t.removeListener(e,a),t.removeListener("error",l),s=!0;for(let c of r)c.resolve(createIterResult(void 0,!0));return createIterResult(void 0,!0)},throw(c){o=c,t.removeListener(e,a),t.removeListener("error",l)},[Symbol.asyncIterator](){return this}};return t.on(e,a),t.on("error",l),i;function a(...c){let f=r.shift();f?f.resolve(createIterResult(c,!1)):n.push(c)}function l(c){s=!0;let f=r.shift();f?f.reject(c):o=c,i.return()}}});function Qs(){throw new Error("setTimeout has not been defined")}function ea(){throw new Error("clearTimeout has not been defined")}function my(t){if(rn===setTimeout)return setTimeout(t,0);if((rn===Qs||!rn)&&setTimeout)return rn=setTimeout,setTimeout(t,0);try{return rn(t,0)}catch{try{return rn.call(null,t,0)}catch{return rn.call(this||lr,t,0)}}}function WB(){ar&&Kn&&(ar=!1,Kn.length?sn=Kn.concat(sn):so=-1,sn.length&&yy())}function yy(){if(!ar){var t=my(WB);ar=!0;for(var e=sn.length;e;){for(Kn=sn,sn=[];++so<e;)Kn&&Kn[so].run();so=-1,e=sn.length}Kn=null,ar=!1,(function(n){if(on===clearTimeout)return clearTimeout(n);if((on===ea||!on)&&clearTimeout)return on=clearTimeout,clearTimeout(n);try{on(n)}catch{try{return on.call(null,n)}catch{return on.call(this||lr,n)}}})(t)}}function ny(t,e){(this||lr).fun=t,(this||lr).array=e}function nn(){}function Fn(t){return t.call.bind(t)}function Xr(t,e){if(typeof t!="object")return!1;try{return e(t),!0}catch{return!1}}function iy(t){return ht&&bt?Pt(t)!==void 0:wy(t)||xy(t)||Py(t)||By(t)||Iy(t)||Ey(t)||Sy(t)||ky(t)||Ay(t)||Cy(t)||Oy(t)}function wy(t){return ht&&bt?Pt(t)==="Uint8Array":Ze(t)==="[object Uint8Array]"||eI(t)&&t.buffer!==void 0}function xy(t){return ht&&bt?Pt(t)==="Uint8ClampedArray":Ze(t)==="[object Uint8ClampedArray]"}function Py(t){return ht&&bt?Pt(t)==="Uint16Array":Ze(t)==="[object Uint16Array]"}function By(t){return ht&&bt?Pt(t)==="Uint32Array":Ze(t)==="[object Uint32Array]"}function Iy(t){return ht&&bt?Pt(t)==="Int8Array":Ze(t)==="[object Int8Array]"}function Ey(t){return ht&&bt?Pt(t)==="Int16Array":Ze(t)==="[object Int16Array]"}function Sy(t){return ht&&bt?Pt(t)==="Int32Array":Ze(t)==="[object Int32Array]"}function ky(t){return ht&&bt?Pt(t)==="Float32Array":Ze(t)==="[object Float32Array]"}function Ay(t){return ht&&bt?Pt(t)==="Float64Array":Ze(t)==="[object Float64Array]"}function Cy(t){return ht&&bt?Pt(t)==="BigInt64Array":Ze(t)==="[object BigInt64Array]"}function Oy(t){return ht&&bt?Pt(t)==="BigUint64Array":Ze(t)==="[object BigUint64Array]"}function to(t){return Ze(t)==="[object Map]"}function no(t){return Ze(t)==="[object Set]"}function ro(t){return Ze(t)==="[object WeakMap]"}function Vs(t){return Ze(t)==="[object WeakSet]"}function lo(t){return Ze(t)==="[object ArrayBuffer]"}function oy(t){return typeof ArrayBuffer<"u"&&(lo.working?lo(t):t instanceof ArrayBuffer)}function uo(t){return Ze(t)==="[object DataView]"}function sy(t){return typeof DataView<"u"&&(uo.working?uo(t):t instanceof DataView)}function co(t){return Ze(t)==="[object SharedArrayBuffer]"}function ay(t){return typeof SharedArrayBuffer<"u"&&(co.working?co(t):t instanceof SharedArrayBuffer)}function ly(t){return Xr(t,oI)}function uy(t){return Xr(t,sI)}function cy(t){return Xr(t,aI)}function dy(t){return by&&Xr(t,lI)}function fy(t){return na&&Xr(t,uI)}function hn(t,e){var n={seen:[],stylize:fI};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),ra(e)?n.showHidden=e:e&&L._extend(n,e),Wn(n.showHidden)&&(n.showHidden=!1),Wn(n.depth)&&(n.depth=2),Wn(n.colors)&&(n.colors=!1),Wn(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=dI),fo(n,t,n.depth)}function dI(t,e){var n=hn.styles[e];return n?"\x1B["+hn.colors[n][0]+"m"+t+"\x1B["+hn.colors[n][1]+"m":t}function fI(t,e){return t}function fo(t,e,n){if(t.customInspect&&e&&ao(e.inspect)&&e.inspect!==L.inspect&&(!e.constructor||e.constructor.prototype!==e)){var r=e.inspect(n,t);return po(r)||(r=fo(t,r,n)),r}var o=(function(p,h){if(Wn(h))return p.stylize("undefined","undefined");if(po(h)){var _="'"+JSON.stringify(h).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return p.stylize(_,"string")}if(Ny(h))return p.stylize(""+h,"number");if(ra(h))return p.stylize(""+h,"boolean");if(yo(h))return p.stylize("null","null")})(t,e);if(o)return o;var s=Object.keys(e),i=(function(p){var h={};return p.forEach((function(_,P){h[_]=!0})),h})(s);if(t.showHidden&&(s=Object.getOwnPropertyNames(e)),Yr(e)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return Js(e);if(s.length===0){if(ao(e)){var a=e.name?": "+e.name:"";return t.stylize("[Function"+a+"]","special")}if(Jr(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(go(e))return t.stylize(Date.prototype.toString.call(e),"date");if(Yr(e))return Js(e)}var l,c="",f=!1,g=["{","}"];return My(e)&&(f=!0,g=["[","]"]),ao(e)&&(c=" [Function"+(e.name?": "+e.name:"")+"]"),Jr(e)&&(c=" "+RegExp.prototype.toString.call(e)),go(e)&&(c=" "+Date.prototype.toUTCString.call(e)),Yr(e)&&(c=" "+Js(e)),s.length!==0||f&&e.length!=0?n<0?Jr(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),l=f?(function(p,h,_,P,B){for(var T=[],E=0,I=h.length;E<I;++E)Dy(h,String(E))?T.push(Ys(p,h,_,P,String(E),!0)):T.push("");return B.forEach((function(D){D.match(/^\d+$/)||T.push(Ys(p,h,_,P,D,!0))})),T})(t,e,n,i,s):s.map((function(p){return Ys(t,e,n,i,p,f)})),t.seen.pop(),(function(p,h,_){var P=0;return p.reduce((function(B,T){return P++,T.indexOf(`
|
|
1
|
+
var As=Object.defineProperty;var FT=Object.getOwnPropertyDescriptor;var zT=Object.getOwnPropertyNames;var qT=Object.prototype.hasOwnProperty;var it=(t,e)=>()=>(t&&(e=t(t=0)),e);var bn=(t,e)=>{for(var n in e)As(t,n,{get:e[n],enumerable:!0})},GT=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of zT(e))!qT.call(t,s)&&s!==n&&As(t,s,{get:()=>e[s],enumerable:!(r=FT(e,s))||r.enumerable});return t};var VT=t=>GT(As({},"__esModule",{value:!0}),t);var S=it(()=>{});var G={};bn(G,{_debugEnd:()=>Su,_debugProcess:()=>Eu,_events:()=>Wu,_eventsCount:()=>Fu,_exiting:()=>lu,_fatalExceptions:()=>xu,_getActiveHandles:()=>fu,_getActiveRequests:()=>du,_kill:()=>gu,_linkedBinding:()=>ou,_maxListeners:()=>Ku,_preload_modules:()=>$u,_rawDebug:()=>iu,_startProfilerIdleNotifier:()=>ku,_stopProfilerIdleNotifier:()=>Au,_tickCallback:()=>Iu,abort:()=>Mu,addListener:()=>zu,allowedNodeEnvironmentFlags:()=>_u,arch:()=>Wl,argv:()=>ql,argv0:()=>ju,assert:()=>bu,binding:()=>Xl,browser:()=>ru,chdir:()=>tu,config:()=>uu,cpuUsage:()=>pi,cwd:()=>eu,debugPort:()=>Uu,default:()=>tc,dlopen:()=>cu,domain:()=>au,emit:()=>Yu,emitWarning:()=>Yl,env:()=>zl,execArgv:()=>Gl,execPath:()=>Hu,exit:()=>Tu,features:()=>wu,hasUncaughtExceptionCaptureCallback:()=>Bu,hrtime:()=>fi,kill:()=>hu,listeners:()=>ec,memoryUsage:()=>yu,moduleLoadList:()=>su,nextTick:()=>Zl,off:()=>Gu,on:()=>Gt,once:()=>qu,openStdin:()=>vu,pid:()=>Nu,platform:()=>Fl,ppid:()=>Du,prependListener:()=>Xu,prependOnceListener:()=>Qu,reallyExit:()=>pu,release:()=>nu,removeAllListeners:()=>Ju,removeListener:()=>Vu,resourceUsage:()=>mu,setSourceMapsEnabled:()=>Zu,setUncaughtExceptionCaptureCallback:()=>Pu,stderr:()=>Ou,stdin:()=>Ru,stdout:()=>Cu,title:()=>Kl,umask:()=>Ql,uptime:()=>Lu,version:()=>Vl,versions:()=>Jl});function Rs(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function JT(){!Jn||!wn||(Jn=!1,wn.length?qt=wn.concat(qt):di=-1,qt.length&&$l())}function $l(){if(!Jn){var t=setTimeout(JT,0);Jn=!0;for(var e=qt.length;e;){for(wn=qt,qt=[];++di<e;)wn&&wn[di].run();di=-1,e=qt.length}wn=null,Jn=!1,clearTimeout(t)}}function Zl(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];qt.push(new Ll(t,e)),qt.length===1&&!Jn&&setTimeout($l,0)}function Ll(t,e){this.fun=t,this.array=e}function ot(){}function ou(t){Rs("_linkedBinding")}function cu(t){Rs("dlopen")}function du(){return[]}function fu(){return[]}function bu(t,e){if(!t)throw new Error(e||"assertion error")}function Bu(){return!1}function Lu(){return fn.now()/1e3}function fi(t){var e=Math.floor((Date.now()-fn.now())*.001),n=fn.now()*.001,r=Math.floor(n)+e,s=Math.floor(n%1*1e9);return t&&(r=r-t[0],s=s-t[1],s<0&&(r--,s+=Os)),[r,s]}function Gt(){return tc}function ec(t){return[]}var qt,Jn,wn,di,Kl,Wl,Fl,zl,ql,Gl,Vl,Jl,Yl,Xl,Ql,eu,tu,nu,ru,iu,su,au,lu,uu,pu,gu,pi,mu,yu,hu,Tu,vu,_u,wu,xu,Pu,Iu,Eu,Su,ku,Au,Cu,Ou,Ru,Mu,Nu,Du,Hu,Uu,ju,$u,Zu,fn,Cs,Os,Ku,Wu,Fu,zu,qu,Gu,Vu,Ju,Yu,Xu,Qu,tc,nc=it(()=>{S();A();k();qt=[],Jn=!1,di=-1;Ll.prototype.run=function(){this.fun.apply(null,this.array)};Kl="browser",Wl="x64",Fl="browser",zl={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},ql=["/usr/bin/node"],Gl=[],Vl="v16.8.0",Jl={},Yl=function(t,e){console.warn((e?e+": ":"")+t)},Xl=function(t){Rs("binding")},Ql=function(t){return 0},eu=function(){return"/"},tu=function(t){},nu={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};ru=!0,iu=ot,su=[];au={},lu=!1,uu={};pu=ot,gu=ot,pi=function(){return{}},mu=pi,yu=pi,hu=ot,Tu=ot,vu=ot,_u={};wu={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},xu=ot,Pu=ot;Iu=ot,Eu=ot,Su=ot,ku=ot,Au=ot,Cu=void 0,Ou=void 0,Ru=void 0,Mu=ot,Nu=2,Du=1,Hu="/bin/usr/node",Uu=9229,ju="node",$u=[],Zu=ot,fn={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};fn.now===void 0&&(Cs=Date.now(),fn.timing&&fn.timing.navigationStart&&(Cs=fn.timing.navigationStart),fn.now=()=>Date.now()-Cs);Os=1e9;fi.bigint=function(t){var e=fi(t);return typeof BigInt>"u"?e[0]*Os+e[1]:BigInt(e[0]*Os)+BigInt(e[1])};Ku=10,Wu={},Fu=0;zu=Gt,qu=Gt,Gu=Gt,Vu=Gt,Ju=Gt,Yu=ot,Xu=Gt,Qu=Gt;tc={version:Vl,versions:Jl,arch:Wl,platform:Fl,browser:ru,release:nu,_rawDebug:iu,moduleLoadList:su,binding:Xl,_linkedBinding:ou,_events:Wu,_eventsCount:Fu,_maxListeners:Ku,on:Gt,addListener:zu,once:qu,off:Gu,removeListener:Vu,removeAllListeners:Ju,emit:Yu,prependListener:Xu,prependOnceListener:Qu,listeners:ec,domain:au,_exiting:lu,config:uu,dlopen:cu,uptime:Lu,_getActiveRequests:du,_getActiveHandles:fu,reallyExit:pu,_kill:gu,cpuUsage:pi,resourceUsage:mu,memoryUsage:yu,kill:hu,exit:Tu,openStdin:vu,allowedNodeEnvironmentFlags:_u,assert:bu,features:wu,_fatalExceptions:xu,setUncaughtExceptionCaptureCallback:Pu,hasUncaughtExceptionCaptureCallback:Bu,emitWarning:Yl,nextTick:Zl,_tickCallback:Iu,_debugProcess:Eu,_debugEnd:Su,_startProfilerIdleNotifier:ku,_stopProfilerIdleNotifier:Au,stdout:Cu,stdin:Ru,stderr:Ou,abort:Mu,umask:Ql,chdir:tu,cwd:eu,env:zl,title:Kl,argv:ql,execArgv:Gl,pid:Nu,ppid:Du,execPath:Hu,debugPort:Uu,hrtime:fi,argv0:ju,_preload_modules:$u,setSourceMapsEnabled:Zu}});var k=it(()=>{nc()});function YT(){if(rc)return _r;rc=!0,_r.byteLength=a,_r.toByteArray=c,_r.fromByteArray=p;for(var t=[],e=[],n=typeof Uint8Array<"u"?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,o=r.length;s<o;++s)t[s]=r[s],e[r.charCodeAt(s)]=s;e[45]=62,e[95]=63;function i(h){var _=h.length;if(_%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var P=h.indexOf("=");P===-1&&(P=_);var B=P===_?0:4-P%4;return[P,B]}function a(h){var _=i(h),P=_[0],B=_[1];return(P+B)*3/4-B}function l(h,_,P){return(_+P)*3/4-P}function c(h){var _,P=i(h),B=P[0],T=P[1],E=new n(l(h,B,T)),I=0,D=T>0?B-4:B,$;for($=0;$<D;$+=4)_=e[h.charCodeAt($)]<<18|e[h.charCodeAt($+1)]<<12|e[h.charCodeAt($+2)]<<6|e[h.charCodeAt($+3)],E[I++]=_>>16&255,E[I++]=_>>8&255,E[I++]=_&255;return T===2&&(_=e[h.charCodeAt($)]<<2|e[h.charCodeAt($+1)]>>4,E[I++]=_&255),T===1&&(_=e[h.charCodeAt($)]<<10|e[h.charCodeAt($+1)]<<4|e[h.charCodeAt($+2)]>>2,E[I++]=_>>8&255,E[I++]=_&255),E}function f(h){return t[h>>18&63]+t[h>>12&63]+t[h>>6&63]+t[h&63]}function g(h,_,P){for(var B,T=[],E=_;E<P;E+=3)B=(h[E]<<16&16711680)+(h[E+1]<<8&65280)+(h[E+2]&255),T.push(f(B));return T.join("")}function p(h){for(var _,P=h.length,B=P%3,T=[],E=16383,I=0,D=P-B;I<D;I+=E)T.push(g(h,I,I+E>D?D:I+E));return B===1?(_=h[P-1],T.push(t[_>>2]+t[_<<4&63]+"==")):B===2&&(_=(h[P-2]<<8)+h[P-1],T.push(t[_>>10]+t[_>>4&63]+t[_<<2&63]+"=")),T.join("")}return _r}function XT(){if(ic)return gi;ic=!0;return gi.read=function(t,e,n,r,s){var o,i,a=s*8-r-1,l=(1<<a)-1,c=l>>1,f=-7,g=n?s-1:0,p=n?-1:1,h=t[e+g];for(g+=p,o=h&(1<<-f)-1,h>>=-f,f+=a;f>0;o=o*256+t[e+g],g+=p,f-=8);for(i=o&(1<<-f)-1,o>>=-f,f+=r;f>0;i=i*256+t[e+g],g+=p,f-=8);if(o===0)o=1-c;else{if(o===l)return i?NaN:(h?-1:1)*(1/0);i=i+Math.pow(2,r),o=o-c}return(h?-1:1)*i*Math.pow(2,o-r)},gi.write=function(t,e,n,r,s,o){var i,a,l,c=o*8-s-1,f=(1<<c)-1,g=f>>1,p=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:o-1,_=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,i=f):(i=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-i))<1&&(i--,l*=2),i+g>=1?e+=p/l:e+=p*Math.pow(2,1-g),e*l>=2&&(i++,l/=2),i+g>=f?(a=0,i=f):i+g>=1?(a=(e*l-1)*Math.pow(2,s),i=i+g):(a=e*Math.pow(2,g-1)*Math.pow(2,s),i=0));s>=8;t[n+h]=a&255,h+=_,a/=256,s-=8);for(i=i<<s|a,c+=s;c>0;t[n+h]=i&255,h+=_,i/=256,c-=8);t[n+h-_]|=P*128},gi}function Ut(){if(sc)return xn;sc=!0;let t=YT(),e=XT(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;xn.Buffer=i,xn.SlowBuffer=T,xn.INSPECT_MAX_BYTES=50;let r=2147483647;xn.kMaxLength=r,i.TYPED_ARRAY_SUPPORT=s(),!i.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function s(){try{let y=new Uint8Array(1),u={foo:function(){return 42}};return Object.setPrototypeOf(u,Uint8Array.prototype),Object.setPrototypeOf(y,u),y.foo()===42}catch{return!1}}Object.defineProperty(i.prototype,"parent",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.buffer}}),Object.defineProperty(i.prototype,"offset",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.byteOffset}});function o(y){if(y>r)throw new RangeError('The value "'+y+'" is invalid for option "size"');let u=new Uint8Array(y);return Object.setPrototypeOf(u,i.prototype),u}function i(y,u,d){if(typeof y=="number"){if(typeof u=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return f(y)}return a(y,u,d)}i.poolSize=8192;function a(y,u,d){if(typeof y=="string")return g(y,u);if(ArrayBuffer.isView(y))return h(y);if(y==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof y);if(vt(y,ArrayBuffer)||y&&vt(y.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(vt(y,SharedArrayBuffer)||y&&vt(y.buffer,SharedArrayBuffer)))return _(y,u,d);if(typeof y=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let v=y.valueOf&&y.valueOf();if(v!=null&&v!==y)return i.from(v,u,d);let O=P(y);if(O)return O;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof y[Symbol.toPrimitive]=="function")return i.from(y[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 y)}i.from=function(y,u,d){return a(y,u,d)},Object.setPrototypeOf(i.prototype,Uint8Array.prototype),Object.setPrototypeOf(i,Uint8Array);function l(y){if(typeof y!="number")throw new TypeError('"size" argument must be of type number');if(y<0)throw new RangeError('The value "'+y+'" is invalid for option "size"')}function c(y,u,d){return l(y),y<=0?o(y):u!==void 0?typeof d=="string"?o(y).fill(u,d):o(y).fill(u):o(y)}i.alloc=function(y,u,d){return c(y,u,d)};function f(y){return l(y),o(y<0?0:B(y)|0)}i.allocUnsafe=function(y){return f(y)},i.allocUnsafeSlow=function(y){return f(y)};function g(y,u){if((typeof u!="string"||u==="")&&(u="utf8"),!i.isEncoding(u))throw new TypeError("Unknown encoding: "+u);let d=E(y,u)|0,v=o(d),O=v.write(y,u);return O!==d&&(v=v.slice(0,O)),v}function p(y){let u=y.length<0?0:B(y.length)|0,d=o(u);for(let v=0;v<u;v+=1)d[v]=y[v]&255;return d}function h(y){if(vt(y,Uint8Array)){let u=new Uint8Array(y);return _(u.buffer,u.byteOffset,u.byteLength)}return p(y)}function _(y,u,d){if(u<0||y.byteLength<u)throw new RangeError('"offset" is outside of buffer bounds');if(y.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(y):d===void 0?v=new Uint8Array(y,u):v=new Uint8Array(y,u,d),Object.setPrototypeOf(v,i.prototype),v}function P(y){if(i.isBuffer(y)){let u=B(y.length)|0,d=o(u);return d.length===0||y.copy(d,0,0,u),d}if(y.length!==void 0)return typeof y.length!="number"||Tr(y.length)?o(0):p(y);if(y.type==="Buffer"&&Array.isArray(y.data))return p(y.data)}function B(y){if(y>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return y|0}function T(y){return+y!=y&&(y=0),i.alloc(+y)}i.isBuffer=function(u){return u!=null&&u._isBuffer===!0&&u!==i.prototype},i.compare=function(u,d){if(vt(u,Uint8Array)&&(u=i.from(u,u.offset,u.byteLength)),vt(d,Uint8Array)&&(d=i.from(d,d.offset,d.byteLength)),!i.isBuffer(u)||!i.isBuffer(d))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(u===d)return 0;let v=u.length,O=d.length;for(let H=0,W=Math.min(v,O);H<W;++H)if(u[H]!==d[H]){v=u[H],O=d[H];break}return v<O?-1:O<v?1:0},i.isEncoding=function(u){switch(String(u).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},i.concat=function(u,d){if(!Array.isArray(u))throw new TypeError('"list" argument must be an Array of Buffers');if(u.length===0)return i.alloc(0);let v;if(d===void 0)for(d=0,v=0;v<u.length;++v)d+=u[v].length;let O=i.allocUnsafe(d),H=0;for(v=0;v<u.length;++v){let W=u[v];if(vt(W,Uint8Array))H+W.length>O.length?(i.isBuffer(W)||(W=i.from(W)),W.copy(O,H)):Uint8Array.prototype.set.call(O,W,H);else if(i.isBuffer(W))W.copy(O,H);else throw new TypeError('"list" argument must be an Array of Buffers');H+=W.length}return O};function E(y,u){if(i.isBuffer(y))return y.length;if(ArrayBuffer.isView(y)||vt(y,ArrayBuffer))return y.byteLength;if(typeof y!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof y);let d=y.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 Se(y).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d*2;case"hex":return d>>>1;case"base64":return kt(y).length;default:if(O)return v?-1:Se(y).length;u=(""+u).toLowerCase(),O=!0}}i.byteLength=E;function I(y,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(y||(y="utf8");;)switch(y){case"hex":return ve(this,u,d);case"utf8":case"utf-8":return Xe(this,u,d);case"ascii":return pt(this,u,d);case"latin1":case"binary":return Re(this,u,d);case"base64":return Le(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: "+y);y=(y+"").toLowerCase(),v=!0}}i.prototype._isBuffer=!0;function D(y,u,d){let v=y[u];y[u]=y[d],y[d]=v}i.prototype.swap16=function(){let u=this.length;if(u%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let d=0;d<u;d+=2)D(this,d,d+1);return this},i.prototype.swap32=function(){let u=this.length;if(u%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let d=0;d<u;d+=4)D(this,d,d+3),D(this,d+1,d+2);return this},i.prototype.swap64=function(){let u=this.length;if(u%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let d=0;d<u;d+=8)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},i.prototype.toString=function(){let u=this.length;return u===0?"":arguments.length===0?Xe(this,0,u):I.apply(this,arguments)},i.prototype.toLocaleString=i.prototype.toString,i.prototype.equals=function(u){if(!i.isBuffer(u))throw new TypeError("Argument must be a Buffer");return this===u?!0:i.compare(this,u)===0},i.prototype.inspect=function(){let u="",d=xn.INSPECT_MAX_BYTES;return u=this.toString("hex",0,d).replace(/(.{2})/g,"$1 ").trim(),this.length>d&&(u+=" ... "),"<Buffer "+u+">"},n&&(i.prototype[n]=i.prototype.inspect),i.prototype.compare=function(u,d,v,O,H){if(vt(u,Uint8Array)&&(u=i.from(u,u.offset,u.byteLength)),!i.isBuffer(u))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof u);if(d===void 0&&(d=0),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 W=H-O,_e=v-d,Ke=Math.min(W,_e),De=this.slice(O,H),We=u.slice(d,v);for(let Oe=0;Oe<Ke;++Oe)if(De[Oe]!==We[Oe]){W=De[Oe],_e=We[Oe];break}return W<_e?-1:_e<W?1:0};function $(y,u,d,v,O){if(y.length===0)return-1;if(typeof d=="string"?(v=d,d=0):d>2147483647?d=2147483647:d<-2147483648&&(d=-2147483648),d=+d,Tr(d)&&(d=O?0:y.length-1),d<0&&(d=y.length+d),d>=y.length){if(O)return-1;d=y.length-1}else if(d<0)if(O)d=0;else return-1;if(typeof u=="string"&&(u=i.from(u,v)),i.isBuffer(u))return u.length===0?-1:ee(y,u,d,v,O);if(typeof u=="number")return u=u&255,typeof Uint8Array.prototype.indexOf=="function"?O?Uint8Array.prototype.indexOf.call(y,u,d):Uint8Array.prototype.lastIndexOf.call(y,u,d):ee(y,[u],d,v,O);throw new TypeError("val must be string, number or Buffer")}function ee(y,u,d,v,O){let H=1,W=y.length,_e=u.length;if(v!==void 0&&(v=String(v).toLowerCase(),v==="ucs2"||v==="ucs-2"||v==="utf16le"||v==="utf-16le")){if(y.length<2||u.length<2)return-1;H=2,W/=2,_e/=2,d/=2}function Ke(We,Oe){return H===1?We[Oe]:We.readUInt16BE(Oe*H)}let De;if(O){let We=-1;for(De=d;De<W;De++)if(Ke(y,De)===Ke(u,We===-1?0:De-We)){if(We===-1&&(We=De),De-We+1===_e)return We*H}else We!==-1&&(De-=De-We),We=-1}else for(d+_e>W&&(d=W-_e),De=d;De>=0;De--){let We=!0;for(let Oe=0;Oe<_e;Oe++)if(Ke(y,De+Oe)!==Ke(u,Oe)){We=!1;break}if(We)return De}return-1}i.prototype.includes=function(u,d,v){return this.indexOf(u,d,v)!==-1},i.prototype.indexOf=function(u,d,v){return $(this,u,d,v,!0)},i.prototype.lastIndexOf=function(u,d,v){return $(this,u,d,v,!1)};function Y(y,u,d,v){d=Number(d)||0;let O=y.length-d;v?(v=Number(v),v>O&&(v=O)):v=O;let H=u.length;v>H/2&&(v=H/2);let W;for(W=0;W<v;++W){let _e=parseInt(u.substr(W*2,2),16);if(Tr(_e))return W;y[d+W]=_e}return W}function ce(y,u,d,v){return Ht(Se(u,y.length-d),y,d,v)}function re(y,u,d,v){return Ht(me(u),y,d,v)}function Q(y,u,d,v){return Ht(kt(u),y,d,v)}function Ie(y,u,d,v){return Ht(U(u,y.length-d),y,d,v)}i.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 W=!1;for(;;)switch(O){case"hex":return Y(this,u,d,v);case"utf8":case"utf-8":return ce(this,u,d,v);case"ascii":case"latin1":case"binary":return re(this,u,d,v);case"base64":return Q(this,u,d,v);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ie(this,u,d,v);default:if(W)throw new TypeError("Unknown encoding: "+O);O=(""+O).toLowerCase(),W=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Le(y,u,d){return u===0&&d===y.length?t.fromByteArray(y):t.fromByteArray(y.slice(u,d))}function Xe(y,u,d){d=Math.min(y.length,d);let v=[],O=u;for(;O<d;){let H=y[O],W=null,_e=H>239?4:H>223?3:H>191?2:1;if(O+_e<=d){let Ke,De,We,Oe;switch(_e){case 1:H<128&&(W=H);break;case 2:Ke=y[O+1],(Ke&192)===128&&(Oe=(H&31)<<6|Ke&63,Oe>127&&(W=Oe));break;case 3:Ke=y[O+1],De=y[O+2],(Ke&192)===128&&(De&192)===128&&(Oe=(H&15)<<12|(Ke&63)<<6|De&63,Oe>2047&&(Oe<55296||Oe>57343)&&(W=Oe));break;case 4:Ke=y[O+1],De=y[O+2],We=y[O+3],(Ke&192)===128&&(De&192)===128&&(We&192)===128&&(Oe=(H&15)<<18|(Ke&63)<<12|(De&63)<<6|We&63,Oe>65535&&Oe<1114112&&(W=Oe))}}W===null?(W=65533,_e=1):W>65535&&(W-=65536,v.push(W>>>10&1023|55296),W=56320|W&1023),v.push(W),O+=_e}return ze(v)}let Fe=4096;function ze(y){let u=y.length;if(u<=Fe)return String.fromCharCode.apply(String,y);let d="",v=0;for(;v<u;)d+=String.fromCharCode.apply(String,y.slice(v,v+=Fe));return d}function pt(y,u,d){let v="";d=Math.min(y.length,d);for(let O=u;O<d;++O)v+=String.fromCharCode(y[O]&127);return v}function Re(y,u,d){let v="";d=Math.min(y.length,d);for(let O=u;O<d;++O)v+=String.fromCharCode(y[O]);return v}function ve(y,u,d){let v=y.length;(!u||u<0)&&(u=0),(!d||d<0||d>v)&&(d=v);let O="";for(let H=u;H<d;++H)O+=ci[y[H]];return O}function we(y,u,d){let v=y.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}i.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,i.prototype),O};function oe(y,u,d){if(y%1!==0||y<0)throw new RangeError("offset is not uint");if(y+u>d)throw new RangeError("Trying to access beyond buffer length")}i.prototype.readUintLE=i.prototype.readUIntLE=function(u,d,v){u=u>>>0,d=d>>>0,v||oe(u,d,this.length);let O=this[u],H=1,W=0;for(;++W<d&&(H*=256);)O+=this[u+W]*H;return O},i.prototype.readUintBE=i.prototype.readUIntBE=function(u,d,v){u=u>>>0,d=d>>>0,v||oe(u,d,this.length);let O=this[u+--d],H=1;for(;d>0&&(H*=256);)O+=this[u+--d]*H;return O},i.prototype.readUint8=i.prototype.readUInt8=function(u,d){return u=u>>>0,d||oe(u,1,this.length),this[u]},i.prototype.readUint16LE=i.prototype.readUInt16LE=function(u,d){return u=u>>>0,d||oe(u,2,this.length),this[u]|this[u+1]<<8},i.prototype.readUint16BE=i.prototype.readUInt16BE=function(u,d){return u=u>>>0,d||oe(u,2,this.length),this[u]<<8|this[u+1]},i.prototype.readUint32LE=i.prototype.readUInt32LE=function(u,d){return u=u>>>0,d||oe(u,4,this.length),(this[u]|this[u+1]<<8|this[u+2]<<16)+this[u+3]*16777216},i.prototype.readUint32BE=i.prototype.readUInt32BE=function(u,d){return u=u>>>0,d||oe(u,4,this.length),this[u]*16777216+(this[u+1]<<16|this[u+2]<<8|this[u+3])},i.prototype.readBigUInt64LE=xt(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))}),i.prototype.readBigUInt64BE=xt(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)}),i.prototype.readIntLE=function(u,d,v){u=u>>>0,d=d>>>0,v||oe(u,d,this.length);let O=this[u],H=1,W=0;for(;++W<d&&(H*=256);)O+=this[u+W]*H;return H*=128,O>=H&&(O-=Math.pow(2,8*d)),O},i.prototype.readIntBE=function(u,d,v){u=u>>>0,d=d>>>0,v||oe(u,d,this.length);let O=d,H=1,W=this[u+--O];for(;O>0&&(H*=256);)W+=this[u+--O]*H;return H*=128,W>=H&&(W-=Math.pow(2,8*d)),W},i.prototype.readInt8=function(u,d){return u=u>>>0,d||oe(u,1,this.length),this[u]&128?(255-this[u]+1)*-1:this[u]},i.prototype.readInt16LE=function(u,d){u=u>>>0,d||oe(u,2,this.length);let v=this[u]|this[u+1]<<8;return v&32768?v|4294901760:v},i.prototype.readInt16BE=function(u,d){u=u>>>0,d||oe(u,2,this.length);let v=this[u+1]|this[u]<<8;return v&32768?v|4294901760:v},i.prototype.readInt32LE=function(u,d){return u=u>>>0,d||oe(u,4,this.length),this[u]|this[u+1]<<8|this[u+2]<<16|this[u+3]<<24},i.prototype.readInt32BE=function(u,d){return u=u>>>0,d||oe(u,4,this.length),this[u]<<24|this[u+1]<<16|this[u+2]<<8|this[u+3]},i.prototype.readBigInt64LE=xt(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)}),i.prototype.readBigInt64BE=xt(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)}),i.prototype.readFloatLE=function(u,d){return u=u>>>0,d||oe(u,4,this.length),e.read(this,u,!0,23,4)},i.prototype.readFloatBE=function(u,d){return u=u>>>0,d||oe(u,4,this.length),e.read(this,u,!1,23,4)},i.prototype.readDoubleLE=function(u,d){return u=u>>>0,d||oe(u,8,this.length),e.read(this,u,!0,52,8)},i.prototype.readDoubleBE=function(u,d){return u=u>>>0,d||oe(u,8,this.length),e.read(this,u,!1,52,8)};function de(y,u,d,v,O,H){if(!i.isBuffer(y))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>y.length)throw new RangeError("Index out of range")}i.prototype.writeUintLE=i.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,W=0;for(this[d]=u&255;++W<v&&(H*=256);)this[d+W]=u/H&255;return d+v},i.prototype.writeUintBE=i.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,W=1;for(this[d+H]=u&255;--H>=0&&(W*=256);)this[d+H]=u/W&255;return d+v},i.prototype.writeUint8=i.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},i.prototype.writeUint16LE=i.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},i.prototype.writeUint16BE=i.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},i.prototype.writeUint32LE=i.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},i.prototype.writeUint32BE=i.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(y,u,d,v,O){te(u,v,O,y,d,7);let H=Number(u&BigInt(4294967295));y[d++]=H,H=H>>8,y[d++]=H,H=H>>8,y[d++]=H,H=H>>8,y[d++]=H;let W=Number(u>>BigInt(32)&BigInt(4294967295));return y[d++]=W,W=W>>8,y[d++]=W,W=W>>8,y[d++]=W,W=W>>8,y[d++]=W,d}function Z(y,u,d,v,O){te(u,v,O,y,d,7);let H=Number(u&BigInt(4294967295));y[d+7]=H,H=H>>8,y[d+6]=H,H=H>>8,y[d+5]=H,H=H>>8,y[d+4]=H;let W=Number(u>>BigInt(32)&BigInt(4294967295));return y[d+3]=W,W=W>>8,y[d+2]=W,W=W>>8,y[d+1]=W,W=W>>8,y[d]=W,d+8}i.prototype.writeBigUInt64LE=xt(function(u,d=0){return N(this,u,d,BigInt(0),BigInt("0xffffffffffffffff"))}),i.prototype.writeBigUInt64BE=xt(function(u,d=0){return Z(this,u,d,BigInt(0),BigInt("0xffffffffffffffff"))}),i.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,W=1,_e=0;for(this[d]=u&255;++H<v&&(W*=256);)u<0&&_e===0&&this[d+H-1]!==0&&(_e=1),this[d+H]=(u/W>>0)-_e&255;return d+v},i.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,W=1,_e=0;for(this[d+H]=u&255;--H>=0&&(W*=256);)u<0&&_e===0&&this[d+H+1]!==0&&(_e=1),this[d+H]=(u/W>>0)-_e&255;return d+v},i.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},i.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},i.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},i.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},i.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},i.prototype.writeBigInt64LE=xt(function(u,d=0){return N(this,u,d,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),i.prototype.writeBigInt64BE=xt(function(u,d=0){return Z(this,u,d,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function K(y,u,d,v,O,H){if(d+v>y.length)throw new RangeError("Index out of range");if(d<0)throw new RangeError("Index out of range")}function le(y,u,d,v,O){return u=+u,d=d>>>0,O||K(y,u,d,4),e.write(y,u,d,v,23,4),d+4}i.prototype.writeFloatLE=function(u,d,v){return le(this,u,d,!0,v)},i.prototype.writeFloatBE=function(u,d,v){return le(this,u,d,!1,v)};function ge(y,u,d,v,O){return u=+u,d=d>>>0,O||K(y,u,d,8),e.write(y,u,d,v,52,8),d+8}i.prototype.writeDoubleLE=function(u,d,v){return ge(this,u,d,!0,v)},i.prototype.writeDoubleBE=function(u,d,v){return ge(this,u,d,!1,v)},i.prototype.copy=function(u,d,v,O){if(!i.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},i.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"&&!i.isEncoding(O))throw new TypeError("Unknown encoding: "+O);if(u.length===1){let W=u.charCodeAt(0);(O==="utf8"&&W<128||O==="latin1")&&(u=W)}}else typeof u=="number"?u=u&255:typeof u=="boolean"&&(u=Number(u));if(d<0||this.length<d||this.length<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 W=i.isBuffer(u)?u:i.from(u,O),_e=W.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]=W[H%_e]}return this};let R={};function C(y,u,d){R[y]=class extends d{constructor(){super(),Object.defineProperty(this,"message",{value:u.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${y}]`,this.stack,delete this.name}get code(){return y}set code(O){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:O,writable:!0})}toString(){return`${this.name} [${y}]: ${this.message}`}}}C("ERR_BUFFER_OUT_OF_BOUNDS",function(y){return y?`${y} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),C("ERR_INVALID_ARG_TYPE",function(y,u){return`The "${y}" argument must be of type number. Received type ${typeof u}`},TypeError),C("ERR_OUT_OF_RANGE",function(y,u,d){let v=`The value of "${y}" 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(y){let u="",d=y.length,v=y[0]==="-"?1:0;for(;d>=v+4;d-=3)u=`_${y.slice(d-3,d)}${u}`;return`${y.slice(0,d)}${u}`}function V(y,u,d){b(u,"offset"),(y[u]===void 0||y[u+d]===void 0)&&x(u,y.length-(d+1))}function te(y,u,d,v,O,H){if(y>d||y<u){let W=typeof u=="bigint"?"n":"",_e;throw u===0||u===BigInt(0)?_e=`>= 0${W} and < 2${W} ** ${(H+1)*8}${W}`:_e=`>= -(2${W} ** ${(H+1)*8-1}${W}) and < 2 ** ${(H+1)*8-1}${W}`,new R.ERR_OUT_OF_RANGE("value",_e,y)}V(v,O,H)}function b(y,u){if(typeof y!="number")throw new R.ERR_INVALID_ARG_TYPE(u,"number",y)}function x(y,u,d){throw Math.floor(y)!==y?(b(y,d),new R.ERR_OUT_OF_RANGE("offset","an integer",y)):u<0?new R.ERR_BUFFER_OUT_OF_BOUNDS:new R.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${u}`,y)}let F=/[^+/0-9A-Za-z-_]/g;function J(y){if(y=y.split("=")[0],y=y.trim().replace(F,""),y.length<2)return"";for(;y.length%4!==0;)y=y+"=";return y}function Se(y,u){u=u||1/0;let d,v=y.length,O=null,H=[];for(let W=0;W<v;++W){if(d=y.charCodeAt(W),d>55295&&d<57344){if(!O){if(d>56319){(u-=3)>-1&&H.push(239,191,189);continue}else if(W+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(y){let u=[];for(let d=0;d<y.length;++d)u.push(y.charCodeAt(d)&255);return u}function U(y,u){let d,v,O,H=[];for(let W=0;W<y.length&&!((u-=2)<0);++W)d=y.charCodeAt(W),v=d>>8,O=d%256,H.push(O),H.push(v);return H}function kt(y){return t.toByteArray(J(y))}function Ht(y,u,d,v){let O;for(O=0;O<v&&!(O+d>=u.length||O>=y.length);++O)u[O+d]=y[O];return O}function vt(y,u){return y instanceof u||y!=null&&y.constructor!=null&&y.constructor.name!=null&&y.constructor.name===u.name}function Tr(y){return y!==y}let ci=(function(){let y="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]=y[d]+y[O]}return u})();function xt(y){return typeof BigInt>"u"?vr:y}function vr(){throw new Error("BigInt not supported")}return xn}var _r,rc,gi,ic,xn,sc,mi=it(()=>{S();A();k();_r={},rc=!1;gi={},ic=!1;xn={},sc=!1});var Pn,z,vA,_A,oc=it(()=>{S();A();k();mi();Pn=Ut();Pn.Buffer;Pn.SlowBuffer;Pn.INSPECT_MAX_BYTES;Pn.kMaxLength;z=Pn.Buffer,vA=Pn.INSPECT_MAX_BYTES,_A=Pn.kMaxLength});var A=it(()=>{oc()});function Zt(){return Km||(Km=!0,typeof Object.create=="function"?Qi=function(e,n){n&&(e.super_=n,e.prototype=Object.create(n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Qi=function(e,n){if(n){e.super_=n;var r=function(){};r.prototype=n.prototype,e.prototype=new r,e.prototype.constructor=e}}),Qi}var Qi,Km,qo=it(()=>{S();A();k();Qi={},Km=!1});function Ae(){Ae.init.call(this)}function es(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function Qm(t){return t._maxListeners===void 0?Ae.defaultMaxListeners:t._maxListeners}function qm(t,e,n,r){var s,o,i,a;if(es(n),(o=t._events)===void 0?(o=t._events=Object.create(null),t._eventsCount=0):(o.newListener!==void 0&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),i=o[e]),i===void 0)i=o[e]=n,++t._eventsCount;else if(typeof i=="function"?i=o[e]=r?[n,i]:[i,n]:r?i.unshift(n):i.push(n),(s=Qm(t))>0&&i.length>s&&!i.warned){i.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+i.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=i.length,a=l,console&&console.warn&&console.warn(a)}return t}function KB(){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 Gm(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},s=KB.bind(r);return s.listener=n,r.wrapFn=s,s}function Vm(t,e,n){var r=t._events;if(r===void 0)return[];var s=r[e];return s===void 0?[]:typeof s=="function"?n?[s.listener||s]:[s]:n?(function(o){for(var i=new Array(o.length),a=0;a<i.length;++a)i[a]=o[a].listener||o[a];return i})(s):ey(s,s.length)}function Jm(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 ey(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}var Ym,Xm,or,Wm,Fm,zm,yt,Go=it(()=>{S();A();k();or=typeof Reflect=="object"?Reflect:null,Wm=or&&typeof or.apply=="function"?or.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};Xm=or&&typeof or.ownKeys=="function"?or.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};Fm=Number.isNaN||function(t){return t!=t};Ym=Ae,Ae.EventEmitter=Ae,Ae.prototype._events=void 0,Ae.prototype._eventsCount=0,Ae.prototype._maxListeners=void 0;zm=10;Object.defineProperty(Ae,"defaultMaxListeners",{enumerable:!0,get:function(){return zm},set:function(t){if(typeof t!="number"||t<0||Fm(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");zm=t}}),Ae.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},Ae.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||Fm(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},Ae.prototype.getMaxListeners=function(){return Qm(this)},Ae.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var r=t==="error",s=this._events;if(s!==void 0)r=r&&s.error===void 0;else if(!r)return!1;if(r){var o;if(e.length>0&&(o=e[0]),o instanceof Error)throw o;var i=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw i.context=o,i}var a=s[t];if(a===void 0)return!1;if(typeof a=="function")Wm(a,this,e);else{var l=a.length,c=ey(a,l);for(n=0;n<l;++n)Wm(c[n],this,e)}return!0},Ae.prototype.addListener=function(t,e){return qm(this,t,e,!1)},Ae.prototype.on=Ae.prototype.addListener,Ae.prototype.prependListener=function(t,e){return qm(this,t,e,!0)},Ae.prototype.once=function(t,e){return es(e),this.on(t,Gm(this,t,e)),this},Ae.prototype.prependOnceListener=function(t,e){return es(e),this.prependListener(t,Gm(this,t,e)),this},Ae.prototype.removeListener=function(t,e){var n,r,s,o,i;if(es(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(s=-1,o=n.length-1;o>=0;o--)if(n[o]===e||n[o].listener===e){i=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():(function(a,l){for(;l+1<a.length;l++)a[l]=a[l+1];a.pop()})(n,s),n.length===1&&(r[t]=n[0]),r.removeListener!==void 0&&this.emit("removeListener",t,i||e)}return this},Ae.prototype.off=Ae.prototype.removeListener,Ae.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 s,o=Object.keys(n);for(r=0;r<o.length;++r)(s=o[r])!=="removeListener"&&this.removeAllListeners(s);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},Ae.prototype.listeners=function(t){return Vm(this,t,!0)},Ae.prototype.rawListeners=function(t){return Vm(this,t,!1)},Ae.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Jm.call(t,e)},Ae.prototype.listenerCount=Jm,Ae.prototype.eventNames=function(){return this._eventsCount>0?Xm(this._events):[]};yt=Ym;yt.EventEmitter;yt.defaultMaxListeners;yt.init;yt.listenerCount;yt.EventEmitter;yt.defaultMaxListeners;yt.init;yt.listenerCount});var ty=it(()=>{S();A();k();Go();yt.once=function(t,e){return new Promise((n,r)=>{function s(...i){o!==void 0&&t.removeListener("error",o),n(i)}let o;e!=="error"&&(o=i=>{t.removeListener(name,s),r(i)},t.once("error",o)),t.once(e,s)})};yt.on=function(t,e){let n=[],r=[],s=null,o=!1,i={async next(){let c=n.shift();if(c)return createIterResult(c,!1);if(s){let f=Promise.reject(s);return s=null,f}return o?createIterResult(void 0,!0):new Promise((f,g)=>r.push({resolve:f,reject:g}))},async return(){t.removeListener(e,a),t.removeListener("error",l),o=!0;for(let c of r)c.resolve(createIterResult(void 0,!0));return createIterResult(void 0,!0)},throw(c){s=c,t.removeListener(e,a),t.removeListener("error",l)},[Symbol.asyncIterator](){return this}};return t.on(e,a),t.on("error",l),i;function a(...c){let f=r.shift();f?f.resolve(createIterResult(c,!1)):n.push(c)}function l(c){o=!0;let f=r.shift();f?f.reject(c):s=c,i.return()}}});function Qo(){throw new Error("setTimeout has not been defined")}function ea(){throw new Error("clearTimeout has not been defined")}function my(t){if(rn===setTimeout)return setTimeout(t,0);if((rn===Qo||!rn)&&setTimeout)return rn=setTimeout,setTimeout(t,0);try{return rn(t,0)}catch{try{return rn.call(null,t,0)}catch{return rn.call(this||lr,t,0)}}}function WB(){ar&&Kn&&(ar=!1,Kn.length?on=Kn.concat(on):os=-1,on.length&&yy())}function yy(){if(!ar){var t=my(WB);ar=!0;for(var e=on.length;e;){for(Kn=on,on=[];++os<e;)Kn&&Kn[os].run();os=-1,e=on.length}Kn=null,ar=!1,(function(n){if(sn===clearTimeout)return clearTimeout(n);if((sn===ea||!sn)&&clearTimeout)return sn=clearTimeout,clearTimeout(n);try{sn(n)}catch{try{return sn.call(null,n)}catch{return sn.call(this||lr,n)}}})(t)}}function ny(t,e){(this||lr).fun=t,(this||lr).array=e}function nn(){}function Fn(t){return t.call.bind(t)}function Xr(t,e){if(typeof t!="object")return!1;try{return e(t),!0}catch{return!1}}function iy(t){return ht&&bt?Pt(t)!==void 0:wy(t)||xy(t)||Py(t)||By(t)||Iy(t)||Ey(t)||Sy(t)||ky(t)||Ay(t)||Cy(t)||Oy(t)}function wy(t){return ht&&bt?Pt(t)==="Uint8Array":Ze(t)==="[object Uint8Array]"||eI(t)&&t.buffer!==void 0}function xy(t){return ht&&bt?Pt(t)==="Uint8ClampedArray":Ze(t)==="[object Uint8ClampedArray]"}function Py(t){return ht&&bt?Pt(t)==="Uint16Array":Ze(t)==="[object Uint16Array]"}function By(t){return ht&&bt?Pt(t)==="Uint32Array":Ze(t)==="[object Uint32Array]"}function Iy(t){return ht&&bt?Pt(t)==="Int8Array":Ze(t)==="[object Int8Array]"}function Ey(t){return ht&&bt?Pt(t)==="Int16Array":Ze(t)==="[object Int16Array]"}function Sy(t){return ht&&bt?Pt(t)==="Int32Array":Ze(t)==="[object Int32Array]"}function ky(t){return ht&&bt?Pt(t)==="Float32Array":Ze(t)==="[object Float32Array]"}function Ay(t){return ht&&bt?Pt(t)==="Float64Array":Ze(t)==="[object Float64Array]"}function Cy(t){return ht&&bt?Pt(t)==="BigInt64Array":Ze(t)==="[object BigInt64Array]"}function Oy(t){return ht&&bt?Pt(t)==="BigUint64Array":Ze(t)==="[object BigUint64Array]"}function ts(t){return Ze(t)==="[object Map]"}function ns(t){return Ze(t)==="[object Set]"}function rs(t){return Ze(t)==="[object WeakMap]"}function Vo(t){return Ze(t)==="[object WeakSet]"}function ls(t){return Ze(t)==="[object ArrayBuffer]"}function sy(t){return typeof ArrayBuffer<"u"&&(ls.working?ls(t):t instanceof ArrayBuffer)}function us(t){return Ze(t)==="[object DataView]"}function oy(t){return typeof DataView<"u"&&(us.working?us(t):t instanceof DataView)}function cs(t){return Ze(t)==="[object SharedArrayBuffer]"}function ay(t){return typeof SharedArrayBuffer<"u"&&(cs.working?cs(t):t instanceof SharedArrayBuffer)}function ly(t){return Xr(t,sI)}function uy(t){return Xr(t,oI)}function cy(t){return Xr(t,aI)}function dy(t){return by&&Xr(t,lI)}function fy(t){return na&&Xr(t,uI)}function hn(t,e){var n={seen:[],stylize:fI};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),ra(e)?n.showHidden=e:e&&L._extend(n,e),Wn(n.showHidden)&&(n.showHidden=!1),Wn(n.depth)&&(n.depth=2),Wn(n.colors)&&(n.colors=!1),Wn(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=dI),ds(n,t,n.depth)}function dI(t,e){var n=hn.styles[e];return n?"\x1B["+hn.colors[n][0]+"m"+t+"\x1B["+hn.colors[n][1]+"m":t}function fI(t,e){return t}function ds(t,e,n){if(t.customInspect&&e&&as(e.inspect)&&e.inspect!==L.inspect&&(!e.constructor||e.constructor.prototype!==e)){var r=e.inspect(n,t);return fs(r)||(r=ds(t,r,n)),r}var s=(function(p,h){if(Wn(h))return p.stylize("undefined","undefined");if(fs(h)){var _="'"+JSON.stringify(h).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return p.stylize(_,"string")}if(Ny(h))return p.stylize(""+h,"number");if(ra(h))return p.stylize(""+h,"boolean");if(ms(h))return p.stylize("null","null")})(t,e);if(s)return s;var o=Object.keys(e),i=(function(p){var h={};return p.forEach((function(_,P){h[_]=!0})),h})(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),Yr(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return Jo(e);if(o.length===0){if(as(e)){var a=e.name?": "+e.name:"";return t.stylize("[Function"+a+"]","special")}if(Jr(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(ps(e))return t.stylize(Date.prototype.toString.call(e),"date");if(Yr(e))return Jo(e)}var l,c="",f=!1,g=["{","}"];return My(e)&&(f=!0,g=["[","]"]),as(e)&&(c=" [Function"+(e.name?": "+e.name:"")+"]"),Jr(e)&&(c=" "+RegExp.prototype.toString.call(e)),ps(e)&&(c=" "+Date.prototype.toUTCString.call(e)),Yr(e)&&(c=" "+Jo(e)),o.length!==0||f&&e.length!=0?n<0?Jr(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),l=f?(function(p,h,_,P,B){for(var T=[],E=0,I=h.length;E<I;++E)Dy(h,String(E))?T.push(Yo(p,h,_,P,String(E),!0)):T.push("");return B.forEach((function(D){D.match(/^\d+$/)||T.push(Yo(p,h,_,P,D,!0))})),T})(t,e,n,i,o):o.map((function(p){return Yo(t,e,n,i,p,f)})),t.seen.pop(),(function(p,h,_){var P=0;return p.reduce((function(B,T){return P++,T.indexOf(`
|
|
2
2
|
`)>=0&&P++,B+T.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60?_[0]+(h===""?"":h+`
|
|
3
3
|
`)+" "+p.join(`,
|
|
4
|
-
`)+" "+_[1]:_[0]+h+" "+p.join(", ")+" "+_[1]})(l,c,g)):g[0]+c+g[1]}function
|
|
5
|
-
`)>-1&&(a=
|
|
4
|
+
`)+" "+_[1]:_[0]+h+" "+p.join(", ")+" "+_[1]})(l,c,g)):g[0]+c+g[1]}function Jo(t){return"["+Error.prototype.toString.call(t)+"]"}function Yo(t,e,n,r,s,o){var i,a,l;if((l=Object.getOwnPropertyDescriptor(e,s)||{value:e[s]}).get?a=l.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):l.set&&(a=t.stylize("[Setter]","special")),Dy(r,s)||(i="["+s+"]"),a||(t.seen.indexOf(l.value)<0?(a=ms(n)?ds(t,l.value,null):ds(t,l.value,n-1)).indexOf(`
|
|
5
|
+
`)>-1&&(a=o?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")),Wn(i)){if(s&&o.match(/^\d+$/))return a;(i=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(i=i.substr(1,i.length-2),i=t.stylize(i,"name")):(i=i.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),i=t.stylize(i,"string"))}return i+": "+a}function My(t){return Array.isArray(t)}function ra(t){return typeof t=="boolean"}function yo(t){return t===null}function Ny(t){return typeof t=="number"}function po(t){return typeof t=="string"}function Wn(t){return t===void 0}function Jr(t){return ur(t)&&ia(t)==="[object RegExp]"}function ur(t){return typeof t=="object"&&t!==null}function go(t){return ur(t)&&ia(t)==="[object Date]"}function Yr(t){return ur(t)&&(ia(t)==="[object Error]"||t instanceof Error)}function ao(t){return typeof t=="function"}function ia(t){return Object.prototype.toString.call(t)}function Xs(t){return t<10?"0"+t.toString(10):t.toString(10)}function gI(){var t=new Date,e=[Xs(t.getHours()),Xs(t.getMinutes()),Xs(t.getSeconds())].join(":");return[t.getDate(),pI[t.getMonth()],e].join(" ")}function Dy(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function mI(t,e){if(!t){var n=new Error("Promise was rejected with a falsy value");n.reason=t,t=n}return e(t)}var gy,rn,on,lr,Je,Kn,sn,ar,so,He,FB,ta,mo,hy,zB,qB,GB,VB,JB,Ty,vy,ry,YB,XB,QB,_y,be,eI,tI,nI,by,na,bt,ht,rI,Ze,oI,sI,aI,Vr,L,Lt,py,cI,io,Ry,oo,pI,Ln,AC,ho=it(()=>{S();A();k();lr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,Je=gy={};(function(){try{rn=typeof setTimeout=="function"?setTimeout:Qs}catch{rn=Qs}try{on=typeof clearTimeout=="function"?clearTimeout:ea}catch{on=ea}})();sn=[],ar=!1,so=-1;Je.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];sn.push(new ny(t,e)),sn.length!==1||ar||my(yy)},ny.prototype.run=function(){(this||lr).fun.apply(null,(this||lr).array)},Je.title="browser",Je.browser=!0,Je.env={},Je.argv=[],Je.version="",Je.versions={},Je.on=nn,Je.addListener=nn,Je.once=nn,Je.off=nn,Je.removeListener=nn,Je.removeAllListeners=nn,Je.emit=nn,Je.prependListener=nn,Je.prependOnceListener=nn,Je.listeners=function(t){return[]},Je.binding=function(t){throw new Error("process.binding is not supported")},Je.cwd=function(){return"/"},Je.chdir=function(t){throw new Error("process.chdir is not supported")},Je.umask=function(){return 0};He=gy;He.addListener;He.argv;He.binding;He.browser;He.chdir;He.cwd;He.emit;He.env;He.listeners;He.nextTick;He.off;He.on;He.once;He.prependListener;He.prependOnceListener;He.removeAllListeners;He.removeListener;He.title;He.umask;He.version;He.versions;FB=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",ta=Object.prototype.toString,mo=function(t){return!(FB&&t&&typeof t=="object"&&Symbol.toStringTag in t)&&ta.call(t)==="[object Arguments]"},hy=function(t){return!!mo(t)||t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&ta.call(t)!=="[object Array]"&&ta.call(t.callee)==="[object Function]"},zB=(function(){return mo(arguments)})();mo.isLegacyArguments=hy;qB=zB?mo:hy,GB=Object.prototype.toString,VB=Function.prototype.toString,JB=/^\s*(?:function)?\*/,Ty=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",vy=Object.getPrototypeOf,ry=(function(){if(!Ty)return!1;try{return Function("return function*() {}")()}catch{}})(),YB=ry?vy(ry):{},XB=function(t){return typeof t=="function"&&(!!JB.test(VB.call(t))||(Ty?vy(t)===YB:GB.call(t)==="[object GeneratorFunction]"))},QB=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}},_y=function(t){return t&&typeof t=="object"&&typeof t.copy=="function"&&typeof t.fill=="function"&&typeof t.readUInt8=="function"},be={},eI=_y,tI=qB,nI=XB;by=typeof BigInt<"u",na=typeof Symbol<"u",bt=na&&Symbol.toStringTag!==void 0,ht=typeof Uint8Array<"u",rI=typeof ArrayBuffer<"u";if(ht&&bt)var iI=Object.getPrototypeOf(Uint8Array.prototype),Pt=Fn(Object.getOwnPropertyDescriptor(iI,Symbol.toStringTag).get);Ze=Fn(Object.prototype.toString),oI=Fn(Number.prototype.valueOf),sI=Fn(String.prototype.valueOf),aI=Fn(Boolean.prototype.valueOf);if(by)var lI=Fn(BigInt.prototype.valueOf);if(na)var uI=Fn(Symbol.prototype.valueOf);be.isArgumentsObject=tI,be.isGeneratorFunction=nI,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 rI&&ArrayBuffer.isView?ArrayBuffer.isView(t):iy(t)||sy(t)},be.isTypedArray=iy,be.isUint8Array=wy,be.isUint8ClampedArray=xy,be.isUint16Array=Py,be.isUint32Array=By,be.isInt8Array=Iy,be.isInt16Array=Ey,be.isInt32Array=Sy,be.isFloat32Array=ky,be.isFloat64Array=Ay,be.isBigInt64Array=Cy,be.isBigUint64Array=Oy,to.working=typeof Map<"u"&&to(new Map),be.isMap=function(t){return typeof Map<"u"&&(to.working?to(t):t instanceof Map)},no.working=typeof Set<"u"&&no(new Set),be.isSet=function(t){return typeof Set<"u"&&(no.working?no(t):t instanceof Set)},ro.working=typeof WeakMap<"u"&&ro(new WeakMap),be.isWeakMap=function(t){return typeof WeakMap<"u"&&(ro.working?ro(t):t instanceof WeakMap)},Vs.working=typeof WeakSet<"u"&&Vs(new WeakSet),be.isWeakSet=function(t){return Vs(t)},lo.working=typeof ArrayBuffer<"u"&&lo(new ArrayBuffer),be.isArrayBuffer=oy,uo.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&uo(new DataView(new ArrayBuffer(1),0,1)),be.isDataView=sy,co.working=typeof SharedArrayBuffer<"u"&&co(new SharedArrayBuffer),be.isSharedArrayBuffer=ay,be.isAsyncFunction=function(t){return Ze(t)==="[object AsyncFunction]"},be.isMapIterator=function(t){return Ze(t)==="[object Map Iterator]"},be.isSetIterator=function(t){return Ze(t)==="[object Set Iterator]"},be.isGeneratorObject=function(t){return Ze(t)==="[object Generator]"},be.isWebAssemblyCompiledModule=function(t){return Ze(t)==="[object WebAssembly.Module]"},be.isNumberObject=ly,be.isStringObject=uy,be.isBooleanObject=cy,be.isBigIntObject=dy,be.isSymbolObject=fy,be.isBoxedPrimitive=function(t){return ly(t)||uy(t)||cy(t)||dy(t)||fy(t)},be.isAnyArrayBuffer=function(t){return ht&&(oy(t)||ay(t))},["isProxy","isExternal","isModuleNamespaceObject"].forEach((function(t){Object.defineProperty(be,t,{enumerable:!1,value:function(){throw new Error(t+" is not supported in userland")}})}));Vr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,L={},Lt=He,py=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},cI=/%[sdj%]/g;L.format=function(t){if(!po(t)){for(var e=[],n=0;n<arguments.length;n++)e.push(hn(arguments[n]));return e.join(" ")}n=1;for(var r=arguments,o=r.length,s=String(t).replace(cI,(function(a){if(a==="%%")return"%";if(n>=o)return a;switch(a){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch{return"[Circular]"}default:return a}})),i=r[n];n<o;i=r[++n])yo(i)||!ur(i)?s+=" "+i:s+=" "+hn(i);return s},L.deprecate=function(t,e){if(Lt!==void 0&&Lt.noDeprecation===!0)return t;if(Lt===void 0)return function(){return L.deprecate(t,e).apply(this||Vr,arguments)};var n=!1;return function(){if(!n){if(Lt.throwDeprecation)throw new Error(e);Lt.traceDeprecation?console.trace(e):console.error(e),n=!0}return t.apply(this||Vr,arguments)}};io={},Ry=/^$/;Lt.env.NODE_DEBUG&&(oo=Lt.env.NODE_DEBUG,oo=oo.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),Ry=new RegExp("^"+oo+"$","i"));L.debuglog=function(t){if(t=t.toUpperCase(),!io[t])if(Ry.test(t)){var e=Lt.pid;io[t]=function(){var n=L.format.apply(L,arguments);console.error("%s %d: %s",t,e,n)}}else io[t]=function(){};return io[t]},L.inspect=hn,hn.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},hn.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},L.types=be,L.isArray=My,L.isBoolean=ra,L.isNull=yo,L.isNullOrUndefined=function(t){return t==null},L.isNumber=Ny,L.isString=po,L.isSymbol=function(t){return typeof t=="symbol"},L.isUndefined=Wn,L.isRegExp=Jr,L.types.isRegExp=Jr,L.isObject=ur,L.isDate=go,L.types.isDate=go,L.isError=Yr,L.types.isNativeError=Yr,L.isFunction=ao,L.isPrimitive=function(t){return t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||typeof t=="symbol"||t===void 0},L.isBuffer=_y;pI=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];L.log=function(){console.log("%s - %s",gI(),L.format.apply(L,arguments))},L.inherits=QB,L._extend=function(t,e){if(!e||!ur(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t};Ln=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(Ln&&t[Ln]){var e;if(typeof(e=t[Ln])!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,Ln,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var n,r,o=new Promise((function(a,l){n=a,r=l})),s=[],i=0;i<arguments.length;i++)s.push(arguments[i]);s.push((function(a,l){a?r(a):n(l)}));try{t.apply(this||Vr,s)}catch(a){r(a)}return o}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Ln&&Object.defineProperty(e,Ln,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,py(t))},L.promisify.custom=Ln,L.callbackify=function(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');function e(){for(var n=[],r=0;r<arguments.length;r++)n.push(arguments[r]);var o=n.pop();if(typeof o!="function")throw new TypeError("The last argument must be of type Function");var s=this||Vr,i=function(){return o.apply(s,arguments)};t.apply(this||Vr,n).then((function(a){Lt.nextTick(i.bind(null,null,a))}),(function(a){Lt.nextTick(mI.bind(null,a,i))}))}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Object.defineProperties(e,py(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;AC=L.promisify;L.types});var DC,Hy=it(()=>{S();A();k();ho();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;L.TextEncoder=globalThis.TextEncoder;L.TextDecoder=globalThis.TextDecoder});function la(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function yI(){!cr||!zn||(cr=!1,zn.length?an=zn.concat(an):To=-1,an.length&&Uy())}function Uy(){if(!cr){var t=setTimeout(yI,0);cr=!0;for(var e=an.length;e;){for(zn=an,an=[];++To<e;)zn&&zn[To].run();To=-1,e=an.length}zn=null,cr=!1,clearTimeout(t)}}function hI(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 jy(t,e)),an.length===1&&!cr&&setTimeout(Uy,0)}function jy(t,e){this.fun=t,this.array=e}function lt(){}function MI(t){la("_linkedBinding")}function UI(t){la("dlopen")}function jI(){return[]}function $I(){return[]}function VI(t,e){if(!t)throw new Error(e||"assertion error")}function QI(){return!1}function yE(){return Tn.now()/1e3}function aa(t){var e=Math.floor((Date.now()-Tn.now())*.001),n=Tn.now()*.001,r=Math.floor(n)+e,o=Math.floor(n%1*1e9);return t&&(r=r-t[0],o=o-t[1],o<0&&(r--,o+=sa)),[r,o]}function vn(){return Rt}function SE(t){return[]}var an,cr,zn,To,TI,vI,_I,bI,wI,xI,PI,BI,II,EI,SI,kI,AI,CI,OI,RI,NI,DI,HI,ZI,LI,ua,KI,WI,FI,zI,qI,GI,JI,YI,XI,eE,tE,nE,rE,iE,oE,sE,aE,lE,uE,cE,dE,fE,pE,gE,mE,Tn,oa,sa,hE,TE,vE,_E,bE,wE,xE,PE,BE,IE,EE,Rt,ca=it(()=>{S();A();k();an=[],cr=!1,To=-1;jy.prototype.run=function(){this.fun.apply(null,this.array)};TI="browser",vI="x64",_I="browser",bI={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},wI=["/usr/bin/node"],xI=[],PI="v16.8.0",BI={},II=function(t,e){console.warn((e?e+": ":"")+t)},EI=function(t){la("binding")},SI=function(t){return 0},kI=function(){return"/"},AI=function(t){},CI={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};OI=lt,RI=[];NI={},DI=!1,HI={};ZI=lt,LI=lt,ua=function(){return{}},KI=ua,WI=ua,FI=lt,zI=lt,qI=lt,GI={};JI={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},YI=lt,XI=lt;eE=lt,tE=lt,nE=lt,rE=lt,iE=lt,oE=void 0,sE=void 0,aE=void 0,lE=lt,uE=2,cE=1,dE="/bin/usr/node",fE=9229,pE="node",gE=[],mE=lt,Tn={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};Tn.now===void 0&&(oa=Date.now(),Tn.timing&&Tn.timing.navigationStart&&(oa=Tn.timing.navigationStart),Tn.now=()=>Date.now()-oa);sa=1e9;aa.bigint=function(t){var e=aa(t);return typeof BigInt>"u"?e[0]*sa+e[1]:BigInt(e[0]*sa)+BigInt(e[1])};hE=10,TE={},vE=0;_E=vn,bE=vn,wE=vn,xE=vn,PE=vn,BE=lt,IE=vn,EE=vn;Rt={version:PI,versions:BI,arch:vI,platform:_I,release:CI,_rawDebug:OI,moduleLoadList:RI,binding:EI,_linkedBinding:MI,_events:TE,_eventsCount:vE,_maxListeners:hE,on:vn,addListener:_E,once:bE,off:wE,removeListener:xE,removeAllListeners:PE,emit:BE,prependListener:IE,prependOnceListener:EE,listeners:SE,domain:NI,_exiting:DI,config:HI,dlopen:UI,uptime:yE,_getActiveRequests:jI,_getActiveHandles:$I,reallyExit:ZI,_kill:LI,cpuUsage:ua,resourceUsage:KI,memoryUsage:WI,kill:FI,exit:zI,openStdin:qI,allowedNodeEnvironmentFlags:GI,assert:VI,features:JI,_fatalExceptions:YI,setUncaughtExceptionCaptureCallback:XI,hasUncaughtExceptionCaptureCallback:QI,emitWarning:II,nextTick:hI,_tickCallback:eE,_debugProcess:tE,_debugEnd:nE,_startProfilerIdleNotifier:rE,_stopProfilerIdleNotifier:iE,stdout:oE,stdin:aE,stderr:sE,abort:lE,umask:SI,chdir:AI,cwd:kI,env:bI,title:TI,argv:wI,execArgv:xI,pid:uE,ppid:cE,execPath:dE,debugPort:fE,hrtime:aa,argv0:pE,_preload_modules:gE,setSourceMapsEnabled:mE}});function Zy(){if($y)return da;$y=!0,da=t;function t(n,r){if(e("noDeprecation"))return n;var o=!1;function s(){if(!o){if(e("throwDeprecation"))throw new Error(r);e("traceDeprecation")?console.trace(r):console.warn(r),o=!0}return n.apply(this||fa,arguments)}return s}function e(n){try{if(!fa.localStorage)return!1}catch{return!1}var r=fa.localStorage[n];return r==null?!1:String(r).toLowerCase()==="true"}return da}var da,$y,fa,Ly=it(()=>{S();A();k();da={},$y=!1,fa=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global});function kE(){if(Ky)return Qr;Ky=!0;var t=Ut(),e=t.Buffer;function n(o,s){for(var i in o)s[i]=o[i]}e.from&&e.alloc&&e.allocUnsafe&&e.allocUnsafeSlow?Qr=t:(n(t,Qr),Qr.Buffer=r);function r(o,s,i){return e(o,s,i)}return r.prototype=Object.create(e.prototype),n(e,r),r.from=function(o,s,i){if(typeof o=="number")throw new TypeError("Argument must not be a number");return e(o,s,i)},r.alloc=function(o,s,i){if(typeof o!="number")throw new TypeError("Argument must be a number");var a=e(o);return s!==void 0?typeof i=="string"?a.fill(s,i):a.fill(s):a.fill(0),a},r.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return e(o)},r.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return t.SlowBuffer(o)},Qr}function AE(){if(Wy)return pa;Wy=!0;var t=kE().Buffer,e=t.isEncoding||function(T){switch(T=""+T,T&&T.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function n(T){if(!T)return"utf8";for(var E;;)switch(T){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return T;default:if(E)return;T=(""+T).toLowerCase(),E=!0}}function r(T){var E=n(T);if(typeof E!="string"&&(t.isEncoding===e||!e(T)))throw new Error("Unknown encoding: "+T);return E||T}pa.StringDecoder=o;function o(T){this.encoding=r(T);var E;switch(this.encoding){case"utf16le":this.text=g,this.end=p,E=4;break;case"utf8":this.fillLast=l,E=4;break;case"base64":this.text=h,this.end=_,E=3;break;default:this.write=P,this.end=B;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(E)}o.prototype.write=function(T){if(T.length===0)return"";var E,I;if(this.lastNeed){if(E=this.fillLast(T),E===void 0)return"";I=this.lastNeed,this.lastNeed=0}else I=0;return I<T.length?E?E+this.text(T,I):this.text(T,I):E||""},o.prototype.end=f,o.prototype.text=c,o.prototype.fillLast=function(T){if(this.lastNeed<=T.length)return T.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);T.copy(this.lastChar,this.lastTotal-this.lastNeed,0,T.length),this.lastNeed-=T.length};function s(T){return T<=127?0:T>>5===6?2:T>>4===14?3:T>>3===30?4:T>>6===2?-1:-2}function i(T,E,I){var D=E.length-1;if(D<I)return 0;var $=s(E[D]);return $>=0?($>0&&(T.lastNeed=$-1),$):--D<I||$===-2?0:($=s(E[D]),$>=0?($>0&&(T.lastNeed=$-2),$):--D<I||$===-2?0:($=s(E[D]),$>=0?($>0&&($===2?$=0:T.lastNeed=$-3),$):0))}function a(T,E,I){if((E[0]&192)!==128)return T.lastNeed=0,"\uFFFD";if(T.lastNeed>1&&E.length>1){if((E[1]&192)!==128)return T.lastNeed=1,"\uFFFD";if(T.lastNeed>2&&E.length>2&&(E[2]&192)!==128)return T.lastNeed=2,"\uFFFD"}}function l(T){var E=this.lastTotal-this.lastNeed,I=a(this,T);if(I!==void 0)return I;if(this.lastNeed<=T.length)return T.copy(this.lastChar,E,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);T.copy(this.lastChar,E,0,T.length),this.lastNeed-=T.length}function c(T,E){var I=i(this,T,E);if(!this.lastNeed)return T.toString("utf8",E);this.lastTotal=I;var D=T.length-(I-this.lastNeed);return T.copy(this.lastChar,0,D),T.toString("utf8",E,D)}function f(T){var E=T&&T.length?this.write(T):"";return this.lastNeed?E+"\uFFFD":E}function g(T,E){if((T.length-E)%2===0){var I=T.toString("utf16le",E);if(I){var D=I.charCodeAt(I.length-1);if(D>=55296&&D<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=T[T.length-2],this.lastChar[1]=T[T.length-1],I.slice(0,-1)}return I}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=T[T.length-1],T.toString("utf16le",E,T.length-1)}function p(T){var E=T&&T.length?this.write(T):"";if(this.lastNeed){var I=this.lastTotal-this.lastNeed;return E+this.lastChar.toString("utf16le",0,I)}return E}function h(T,E){var I=(T.length-E)%3;return I===0?T.toString("base64",E):(this.lastNeed=3-I,this.lastTotal=3,I===1?this.lastChar[0]=T[T.length-1]:(this.lastChar[0]=T[T.length-2],this.lastChar[1]=T[T.length-1]),T.toString("base64",E,T.length-I))}function _(T){var E=T&&T.length?this.write(T):"";return this.lastNeed?E+this.lastChar.toString("base64",0,3-this.lastNeed):E}function P(T){return T.toString(this.encoding)}function B(T){return T&&T.length?this.write(T):""}return pa}var Qr,Ky,pa,Wy,ei,JC,Fy=it(()=>{S();A();k();mi();Qr={},Ky=!1;pa={},Wy=!1;ei=AE();ei.StringDecoder;JC=ei.StringDecoder});function CE(){if(zy)return ga;zy=!0;var t=ga={},e,n;function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?e=setTimeout:e=r}catch{e=r}try{typeof clearTimeout=="function"?n=clearTimeout:n=o}catch{n=o}})();function s(P){if(e===setTimeout)return setTimeout(P,0);if((e===r||!e)&&setTimeout)return e=setTimeout,setTimeout(P,0);try{return e(P,0)}catch{try{return e.call(null,P,0)}catch{return e.call(this||dr,P,0)}}}function i(P){if(n===clearTimeout)return clearTimeout(P);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(P);try{return n(P)}catch{try{return n.call(null,P)}catch{return n.call(this||dr,P)}}}var a=[],l=!1,c,f=-1;function g(){!l||!c||(l=!1,c.length?a=c.concat(a):f=-1,a.length&&p())}function p(){if(!l){var P=s(g);l=!0;for(var B=a.length;B;){for(c=a,a=[];++f<B;)c&&c[f].run();f=-1,B=a.length}c=null,l=!1,i(P)}}t.nextTick=function(P){var B=new Array(arguments.length-1);if(arguments.length>1)for(var T=1;T<arguments.length;T++)B[T-1]=arguments[T];a.push(new h(P,B)),a.length===1&&!l&&s(p)};function h(P,B){(this||dr).fun=P,(this||dr).array=B}h.prototype.run=function(){(this||dr).fun.apply(null,(this||dr).array)},t.title="browser",t.browser=!0,t.env={},t.argv=[],t.version="",t.versions={};function _(){}return t.on=_,t.addListener=_,t.once=_,t.off=_,t.removeListener=_,t.removeAllListeners=_,t.emit=_,t.prependListener=_,t.prependOnceListener=_,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},ga}var ga,zy,dr,Ue,ma=it(()=>{S();A();k();ga={},zy=!1,dr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ue=CE();Ue.platform="browser";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});function OE(){if(qy)return ya;qy=!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,i){for(var a="",l=0,c=-1,f=0,g,p=0;p<=s.length;++p){if(p<s.length)g=s.charCodeAt(p);else{if(g===47)break;g=47}if(g===47){if(!(c===p-1||f===1))if(c!==p-1&&f===2){if(a.length<2||l!==2||a.charCodeAt(a.length-1)!==46||a.charCodeAt(a.length-2)!==46){if(a.length>2){var h=a.lastIndexOf("/");if(h!==a.length-1){h===-1?(a="",l=0):(a=a.slice(0,h),l=a.length-1-a.lastIndexOf("/")),c=p,f=0;continue}}else if(a.length===2||a.length===1){a="",l=0,c=p,f=0;continue}}i&&(a.length>0?a+="/..":a="..",l=2)}else a.length>0?a+="/"+s.slice(c+1,p):a=s.slice(c+1,p),l=p-c-1;c=p,f=0}else g===46&&f!==-1?++f:f=-1}return a}function r(s,i){var a=i.dir||i.root,l=i.base||(i.name||"")+(i.ext||"");return a?a===i.root?a+l:a+s+l:l}var o={resolve:function(){for(var i="",a=!1,l,c=arguments.length-1;c>=-1&&!a;c--){var f;c>=0?f=arguments[c]:(l===void 0&&(l=t.cwd()),f=l),e(f),f.length!==0&&(i=f+"/"+i,a=f.charCodeAt(0)===47)}return i=n(i,!a),a?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(i){if(e(i),i.length===0)return".";var a=i.charCodeAt(0)===47,l=i.charCodeAt(i.length-1)===47;return i=n(i,!a),i.length===0&&!a&&(i="."),i.length>0&&l&&(i+="/"),a?"/"+i:i},isAbsolute:function(i){return e(i),i.length>0&&i.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var i,a=0;a<arguments.length;++a){var l=arguments[a];e(l),l.length>0&&(i===void 0?i=l:i+="/"+l)}return i===void 0?".":o.normalize(i)},relative:function(i,a){if(e(i),e(a),i===a||(i=o.resolve(i),a=o.resolve(a),i===a))return"";for(var l=1;l<i.length&&i.charCodeAt(l)===47;++l);for(var c=i.length,f=c-l,g=1;g<a.length&&a.charCodeAt(g)===47;++g);for(var p=a.length,h=p-g,_=f<h?f:h,P=-1,B=0;B<=_;++B){if(B===_){if(h>_){if(a.charCodeAt(g+B)===47)return a.slice(g+B+1);if(B===0)return a.slice(g+B)}else f>_&&(i.charCodeAt(l+B)===47?P=B:B===0&&(P=0));break}var T=i.charCodeAt(l+B),E=a.charCodeAt(g+B);if(T!==E)break;T===47&&(P=B)}var I="";for(B=l+P+1;B<=c;++B)(B===c||i.charCodeAt(B)===47)&&(I.length===0?I+="..":I+="/..");return I.length>0?I+a.slice(g+P):(g+=P,a.charCodeAt(g)===47&&++g,a.slice(g))},_makeLong:function(i){return i},dirname:function(i){if(e(i),i.length===0)return".";for(var a=i.charCodeAt(0),l=a===47,c=-1,f=!0,g=i.length-1;g>=1;--g)if(a=i.charCodeAt(g),a===47){if(!f){c=g;break}}else f=!1;return c===-1?l?"/":".":l&&c===1?"//":i.slice(0,c)},basename:function(i,a){if(a!==void 0&&typeof a!="string")throw new TypeError('"ext" argument must be a string');e(i);var l=0,c=-1,f=!0,g;if(a!==void 0&&a.length>0&&a.length<=i.length){if(a.length===i.length&&a===i)return"";var p=a.length-1,h=-1;for(g=i.length-1;g>=0;--g){var _=i.charCodeAt(g);if(_===47){if(!f){l=g+1;break}}else h===-1&&(f=!1,h=g+1),p>=0&&(_===a.charCodeAt(p)?--p===-1&&(c=g):(p=-1,c=h))}return l===c?c=h:c===-1&&(c=i.length),i.slice(l,c)}else{for(g=i.length-1;g>=0;--g)if(i.charCodeAt(g)===47){if(!f){l=g+1;break}}else c===-1&&(f=!1,c=g+1);return c===-1?"":i.slice(l,c)}},extname:function(i){e(i);for(var a=-1,l=0,c=-1,f=!0,g=0,p=i.length-1;p>=0;--p){var h=i.charCodeAt(p);if(h===47){if(!f){l=p+1;break}continue}c===-1&&(f=!1,c=p+1),h===46?a===-1?a=p:g!==1&&(g=1):a!==-1&&(g=-1)}return a===-1||c===-1||g===0||g===1&&a===c-1&&a===l+1?"":i.slice(a,c)},format:function(i){if(i===null||typeof i!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof i);return r("/",i)},parse:function(i){e(i);var a={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return a;var l=i.charCodeAt(0),c=l===47,f;c?(a.root="/",f=1):f=0;for(var g=-1,p=0,h=-1,_=!0,P=i.length-1,B=0;P>=f;--P){if(l=i.charCodeAt(P),l===47){if(!_){p=P+1;break}continue}h===-1&&(_=!1,h=P+1),l===46?g===-1?g=P:B!==1&&(B=1):g!==-1&&(B=-1)}return g===-1||h===-1||B===0||B===1&&g===h-1&&g===p+1?h!==-1&&(p===0&&c?a.base=a.name=i.slice(1,h):a.base=a.name=i.slice(p,h)):(p===0&&c?(a.name=i.slice(1,g),a.base=i.slice(1,h)):(a.name=i.slice(p,g),a.base=i.slice(p,h)),a.ext=i.slice(g,h)),p>0?a.dir=i.slice(0,p-1):c&&(a.dir="/"),a},sep:"/",delimiter:":",win32:null,posix:null};return o.posix=o,ya=o,ya}function qn(t){throw new RangeError(DE[t])}function Vy(t,e){let n=t.split("@"),r="";n.length>1&&(r=n[0]+"@",t=n[1]);let o=(function(s,i){let a=[],l=s.length;for(;l--;)a[l]=i(s[l]);return a})((t=t.replace(NE,".")).split("."),e).join(".");return r+o}function ih(t){let e=[],n=0,r=t.length;for(;n<r;){let o=t.charCodeAt(n++);if(o>=55296&&o<=56319&&n<r){let s=t.charCodeAt(n++);(64512&s)==56320?e.push(((1023&o)<<10)+(1023&s)+65536):(e.push(o),n--)}else e.push(o)}return e}function UE(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 ni(t,e,n){if(t&&Kt.isObject(t)&&t instanceof Bt)return t;var r=new Bt;return r.parse(t,e,n),r}function GE(){if(nh)return _a;nh=!0;var t=He;function e(s){if(typeof s!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(s))}function n(s,i){for(var a="",l=0,c=-1,f=0,g,p=0;p<=s.length;++p){if(p<s.length)g=s.charCodeAt(p);else{if(g===47)break;g=47}if(g===47){if(!(c===p-1||f===1))if(c!==p-1&&f===2){if(a.length<2||l!==2||a.charCodeAt(a.length-1)!==46||a.charCodeAt(a.length-2)!==46){if(a.length>2){var h=a.lastIndexOf("/");if(h!==a.length-1){h===-1?(a="",l=0):(a=a.slice(0,h),l=a.length-1-a.lastIndexOf("/")),c=p,f=0;continue}}else if(a.length===2||a.length===1){a="",l=0,c=p,f=0;continue}}i&&(a.length>0?a+="/..":a="..",l=2)}else a.length>0?a+="/"+s.slice(c+1,p):a=s.slice(c+1,p),l=p-c-1;c=p,f=0}else g===46&&f!==-1?++f:f=-1}return a}function r(s,i){var a=i.dir||i.root,l=i.base||(i.name||"")+(i.ext||"");return a?a===i.root?a+l:a+s+l:l}var o={resolve:function(){for(var i="",a=!1,l,c=arguments.length-1;c>=-1&&!a;c--){var f;c>=0?f=arguments[c]:(l===void 0&&(l=t.cwd()),f=l),e(f),f.length!==0&&(i=f+"/"+i,a=f.charCodeAt(0)===47)}return i=n(i,!a),a?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(i){if(e(i),i.length===0)return".";var a=i.charCodeAt(0)===47,l=i.charCodeAt(i.length-1)===47;return i=n(i,!a),i.length===0&&!a&&(i="."),i.length>0&&l&&(i+="/"),a?"/"+i:i},isAbsolute:function(i){return e(i),i.length>0&&i.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var i,a=0;a<arguments.length;++a){var l=arguments[a];e(l),l.length>0&&(i===void 0?i=l:i+="/"+l)}return i===void 0?".":o.normalize(i)},relative:function(i,a){if(e(i),e(a),i===a||(i=o.resolve(i),a=o.resolve(a),i===a))return"";for(var l=1;l<i.length&&i.charCodeAt(l)===47;++l);for(var c=i.length,f=c-l,g=1;g<a.length&&a.charCodeAt(g)===47;++g);for(var p=a.length,h=p-g,_=f<h?f:h,P=-1,B=0;B<=_;++B){if(B===_){if(h>_){if(a.charCodeAt(g+B)===47)return a.slice(g+B+1);if(B===0)return a.slice(g+B)}else f>_&&(i.charCodeAt(l+B)===47?P=B:B===0&&(P=0));break}var T=i.charCodeAt(l+B),E=a.charCodeAt(g+B);if(T!==E)break;T===47&&(P=B)}var I="";for(B=l+P+1;B<=c;++B)(B===c||i.charCodeAt(B)===47)&&(I.length===0?I+="..":I+="/..");return I.length>0?I+a.slice(g+P):(g+=P,a.charCodeAt(g)===47&&++g,a.slice(g))},_makeLong:function(i){return i},dirname:function(i){if(e(i),i.length===0)return".";for(var a=i.charCodeAt(0),l=a===47,c=-1,f=!0,g=i.length-1;g>=1;--g)if(a=i.charCodeAt(g),a===47){if(!f){c=g;break}}else f=!1;return c===-1?l?"/":".":l&&c===1?"//":i.slice(0,c)},basename:function(i,a){if(a!==void 0&&typeof a!="string")throw new TypeError('"ext" argument must be a string');e(i);var l=0,c=-1,f=!0,g;if(a!==void 0&&a.length>0&&a.length<=i.length){if(a.length===i.length&&a===i)return"";var p=a.length-1,h=-1;for(g=i.length-1;g>=0;--g){var _=i.charCodeAt(g);if(_===47){if(!f){l=g+1;break}}else h===-1&&(f=!1,h=g+1),p>=0&&(_===a.charCodeAt(p)?--p===-1&&(c=g):(p=-1,c=h))}return l===c?c=h:c===-1&&(c=i.length),i.slice(l,c)}else{for(g=i.length-1;g>=0;--g)if(i.charCodeAt(g)===47){if(!f){l=g+1;break}}else c===-1&&(f=!1,c=g+1);return c===-1?"":i.slice(l,c)}},extname:function(i){e(i);for(var a=-1,l=0,c=-1,f=!0,g=0,p=i.length-1;p>=0;--p){var h=i.charCodeAt(p);if(h===47){if(!f){l=p+1;break}continue}c===-1&&(f=!1,c=p+1),h===46?a===-1?a=p:g!==1&&(g=1):a!==-1&&(g=-1)}return a===-1||c===-1||g===0||g===1&&a===c-1&&a===l+1?"":i.slice(a,c)},format:function(i){if(i===null||typeof i!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof i);return r("/",i)},parse:function(i){e(i);var a={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return a;var l=i.charCodeAt(0),c=l===47,f;c?(a.root="/",f=1):f=0;for(var g=-1,p=0,h=-1,_=!0,P=i.length-1,B=0;P>=f;--P){if(l=i.charCodeAt(P),l===47){if(!_){p=P+1;break}continue}h===-1&&(_=!1,h=P+1),l===46?g===-1?g=P:B!==1&&(B=1):g!==-1&&(B=-1)}return g===-1||h===-1||B===0||B===1&&g===h-1&&g===p+1?h!==-1&&(p===0&&c?a.base=a.name=i.slice(1,h):a.base=a.name=i.slice(p,h)):(p===0&&c?(a.name=i.slice(1,g),a.base=i.slice(1,h)):(a.name=i.slice(p,g),a.base=i.slice(p,h)),a.ext=i.slice(g,h)),p>0?a.dir=i.slice(0,p-1):c&&(a.dir="/"),a},sep:"/",delimiter:":",win32:null,posix:null};return o.posix=o,_a=o,_a}function sS(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 wa?aS(t):lS(t)}function aS(t){let e=t.hostname,n=t.pathname;for(let r=0;r<n.length;r++)if(n[r]==="%"){let o=n.codePointAt(r+2)||32;if(n[r+1]==="2"&&o===102||n[r+1]==="5"&&o===99)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(n=n.replace(eS,"\\"),n=decodeURIComponent(n),e!=="")return`\\\\${e}${n}`;{let r=n.codePointAt(1)|32,o=n[2];if(r<XE||r>QE||o!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return n.slice(1)}}function lS(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 uS(t){let e=rh.resolve(t),n=t.charCodeAt(t.length-1);(n===YE||wa&&n===JE)&&e[e.length-1]!==rh.sep&&(e+="/");let r=new URL("file://");return e.includes("%")&&(e=e.replace(tS,"%25")),!wa&&e.includes("\\")&&(e=e.replace(nS,"%5C")),e.includes(`
|
|
11
|
-
`)&&(e=e.replace(rS,"%0A")),e.includes("\r")&&(e=e.replace(iS,"%0D")),e.includes(" ")&&(e=e.replace(
|
|
12
|
-
`)&&(e=e.replace(TS,"%0A")),e.includes("\r")&&(e=e.replace(vS,"%0D")),e.includes(" ")&&(e=e.replace(_S,"%09")),r.pathname=e,r}var ya,qy,Gy,pr,RE,ME,NE,DE,Wt,ha,Jy,
|
|
13
|
-
`," "]),ba=["'"].concat(FE),Qy=["%","/","?",";","#"].concat(ba),eh=["/","?","#"],th=/^[+a-z0-9A-Z_-]{0,63}$/,zE=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,qE={javascript:!0,"javascript:":!0},Ta={javascript:!0,"javascript:":!0},fr={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},va=ln;Bt.prototype.parse=function(t,e,n){if(!Kt.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var r=t.indexOf("?"),o=r!==-1&&r<t.indexOf("#")?"?":"#",s=t.split(o);s[0]=s[0].replace(/\\/g,"/");var i=t=s.join(o);if(i=i.trim(),!n&&t.split("#").length===1){var a=WE.exec(i);if(a)return this.path=i,this.href=i,this.pathname=a[1],a[2]?(this.search=a[2],this.query=e?va.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var l=LE.exec(i);if(l){var c=(l=l[0]).toLowerCase();this.protocol=c,i=i.substr(l.length)}if(n||l||i.match(/^\/\/[^@\/]+@[^@\/]+/)){var f=i.substr(0,2)==="//";!f||l&&Ta[l]||(i=i.substr(2),this.slashes=!0)}if(!Ta[l]&&(f||l&&!fr[l])){for(var g,p,h=-1,_=0;_<eh.length;_++)(P=i.indexOf(eh[_]))!==-1&&(h===-1||P<h)&&(h=P);for((p=h===-1?i.lastIndexOf("@"):i.lastIndexOf("@",h))!==-1&&(g=i.slice(0,p),i=i.slice(p+1),this.auth=decodeURIComponent(g)),h=-1,_=0;_<Qy.length;_++){var P;(P=i.indexOf(Qy[_]))!==-1&&(h===-1||P<h)&&(h=P)}h===-1&&(h=i.length),this.host=i.slice(0,h),i=i.slice(h),this.parseHost(),this.hostname=this.hostname||"";var B=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!B)for(var T=this.hostname.split(/\./),E=(_=0,T.length);_<E;_++){var I=T[_];if(I&&!I.match(th)){for(var D="",$=0,ee=I.length;$<ee;$++)I.charCodeAt($)>127?D+="x":D+=I[$];if(!D.match(th)){var Y=T.slice(0,_),ce=T.slice(_+1),re=I.match(zE);re&&(Y.push(re[1]),ce.unshift(re[2])),ce.length&&(i="/"+ce.join(".")+i),this.hostname=Y.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),B||(this.hostname=ZE.toASCII(this.hostname));var Q=this.port?":"+this.port:"",Ie=this.hostname||"";this.host=Ie+Q,this.href+=this.host,B&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),i[0]!=="/"&&(i="/"+i))}if(!qE[c])for(_=0,E=ba.length;_<E;_++){var Le=ba[_];if(i.indexOf(Le)!==-1){var Xe=encodeURIComponent(Le);Xe===Le&&(Xe=escape(Le)),i=i.split(Le).join(Xe)}}var Fe=i.indexOf("#");Fe!==-1&&(this.hash=i.substr(Fe),i=i.slice(0,Fe));var ze=i.indexOf("?");if(ze!==-1?(this.search=i.substr(ze),this.query=i.substr(ze+1),e&&(this.query=va.parse(this.query)),i=i.slice(0,ze)):e&&(this.search="",this.query={}),i&&(this.pathname=i),fr[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){Q=this.pathname||"";var pt=this.search||"";this.path=Q+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||"",o=!1,s="";this.host?o=t+this.host:this.hostname&&(o=t+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&Kt.isObject(this.query)&&Object.keys(this.query).length&&(s=va.stringify(this.query));var i=this.search||s&&"?"+s||"";return e&&e.substr(-1)!==":"&&(e+=":"),this.slashes||(!e||fr[e])&&o!==!1?(o="//"+(o||""),n&&n.charAt(0)!=="/"&&(n="/"+n)):o||(o=""),r&&r.charAt(0)!=="#"&&(r="#"+r),i&&i.charAt(0)!=="?"&&(i="?"+i),e+o+(n=n.replace(/[?#]/g,(function(a){return encodeURIComponent(a)})))+(i=i.replace("#","%23"))+r},Bt.prototype.resolve=function(t){return this.resolveObject(ni(t,!1,!0)).format()},Bt.prototype.resolveObject=function(t){if(Kt.isString(t)){var e=new Bt;e.parse(t,!1,!0),t=e}for(var n=new Bt,r=Object.keys(this),o=0;o<r.length;o++){var s=r[o];n[s]=this[s]}if(n.hash=t.hash,t.href==="")return n.href=n.format(),n;if(t.slashes&&!t.protocol){for(var i=Object.keys(t),a=0;a<i.length;a++){var l=i[a];l!=="protocol"&&(n[l]=t[l])}return fr[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(t.protocol&&t.protocol!==n.protocol){if(!fr[t.protocol]){for(var c=Object.keys(t),f=0;f<c.length;f++){var g=c[f];n[g]=t[g]}return n.href=n.format(),n}if(n.protocol=t.protocol,t.host||Ta[t.protocol])n.pathname=t.pathname;else{for(var p=(t.pathname||"").split("/");p.length&&!(t.host=p.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),p[0]!==""&&p.unshift(""),p.length<2&&p.unshift(""),n.pathname=p.join("/")}if(n.search=t.search,n.query=t.query,n.host=t.host||"",n.auth=t.auth,n.hostname=t.hostname||t.host,n.port=t.port,n.pathname||n.search){var h=n.pathname||"",_=n.search||"";n.path=h+_}return n.slashes=n.slashes||t.slashes,n.href=n.format(),n}var P=n.pathname&&n.pathname.charAt(0)==="/",B=t.host||t.pathname&&t.pathname.charAt(0)==="/",T=B||P||n.host&&t.pathname,E=T,I=n.pathname&&n.pathname.split("/")||[],D=(p=t.pathname&&t.pathname.split("/")||[],n.protocol&&!fr[n.protocol]);if(D&&(n.hostname="",n.port=null,n.host&&(I[0]===""?I[0]=n.host:I.unshift(n.host)),n.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(p[0]===""?p[0]=t.host:p.unshift(t.host)),t.host=null),T=T&&(p[0]===""||I[0]==="")),B)n.host=t.host||t.host===""?t.host:n.host,n.hostname=t.hostname||t.hostname===""?t.hostname:n.hostname,n.search=t.search,n.query=t.query,I=p;else if(p.length)I||(I=[]),I.pop(),I=I.concat(p),n.search=t.search,n.query=t.query;else if(!Kt.isNullOrUndefined(t.search))return D&&(n.hostname=n.host=I.shift(),(re=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=re.shift(),n.host=n.hostname=re.shift())),n.search=t.search,n.query=t.query,Kt.isNull(n.pathname)&&Kt.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n;if(!I.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var $=I.slice(-1)[0],ee=(n.host||t.host||I.length>1)&&($==="."||$==="..")||$==="",Y=0,ce=I.length;ce>=0;ce--)($=I[ce])==="."?I.splice(ce,1):$===".."?(I.splice(ce,1),Y++):Y&&(I.splice(ce,1),Y--);if(!T&&!E)for(;Y--;Y)I.unshift("..");!T||I[0]===""||I[0]&&I[0].charAt(0)==="/"||I.unshift(""),ee&&I.join("/").substr(-1)!=="/"&&I.push("");var re,Q=I[0]===""||I[0]&&I[0].charAt(0)==="/";return D&&(n.hostname=n.host=Q?"":I.length?I.shift():"",(re=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=re.shift(),n.host=n.hostname=re.shift())),(T=T||n.host&&I.length)&&!Q&&I.unshift(""),I.length?n.pathname=I.join("/"):(n.pathname=null,n.path=null),Kt.isNull(n.pathname)&&Kt.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=KE.exec(t);e&&((e=e[0])!==":"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};Ce.Url;Ce.format;Ce.resolve;Ce.resolveObject;_a={},nh=!1;rh=GE(),VE=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;Ce.URL=typeof URL<"u"?URL:null;Ce.pathToFileURL=uS;Ce.fileURLToPath=sS;Ce.Url;Ce.format;Ce.resolve;Ce.resolveObject;Ce.URL;JE=92,YE=47,XE=97,QE=122,wa=VE==="win32",eS=/\//g,tS=/%/g,nS=/\\/g,rS=/\n/g,iS=/\r/g,oS=/\t/g;cS=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;Ce.URL=typeof URL<"u"?URL:null;Ce.pathToFileURL=PS;Ce.fileURLToPath=bS;Ce.Url;Ce.format;Ce.resolve;Ce.resolveObject;Ce.parse;Ce.URL;dS=92,fS=47,pS=97,gS=122,xa=cS==="win32",mS=/\//g,yS=/%/g,hS=/\\/g,TS=/\n/g,vS=/\r/g,_S=/\t/g});var jh={};bn(jh,{Agent:()=>NS,ClientRequest:()=>DS,IncomingMessage:()=>HS,METHODS:()=>US,STATUS_CODES:()=>jS,default:()=>un,get:()=>$S,globalAgent:()=>ZS,request:()=>LS});function Ah(){if(ah)return wt;ah=!0,wt.fetch=r(Gn.fetch)&&r(Gn.ReadableStream),wt.writableStream=r(Gn.WritableStream),wt.abortController=r(Gn.AbortController);var t;function e(){if(t!==void 0)return t;if(Gn.XMLHttpRequest){t=new Gn.XMLHttpRequest;try{t.open("GET",Gn.XDomainRequest?"/":"https://example.com")}catch{t=null}}else t=null;return t}function n(o){var s=e();if(!s)return!1;try{return s.responseType=o,s.responseType===o}catch{}return!1}wt.arraybuffer=wt.fetch||n("arraybuffer"),wt.msstream=!wt.fetch&&n("ms-stream"),wt.mozchunkedarraybuffer=!wt.fetch&&n("moz-chunked-arraybuffer"),wt.overrideMimeType=wt.fetch||(e()?r(e().overrideMimeType):!1);function r(o){return typeof o=="function"}return t=null,wt}function Ch(){return lh||(lh=!0,Pa=yt.EventEmitter),Pa}function BS(){if(uh)return Ba;uh=!0;function t(_,P){var B=Object.keys(_);if(Object.getOwnPropertySymbols){var T=Object.getOwnPropertySymbols(_);P&&(T=T.filter(function(E){return Object.getOwnPropertyDescriptor(_,E).enumerable})),B.push.apply(B,T)}return B}function e(_){for(var P=1;P<arguments.length;P++){var B=arguments[P]!=null?arguments[P]:{};P%2?t(Object(B),!0).forEach(function(T){n(_,T,B[T])}):Object.getOwnPropertyDescriptors?Object.defineProperties(_,Object.getOwnPropertyDescriptors(B)):t(Object(B)).forEach(function(T){Object.defineProperty(_,T,Object.getOwnPropertyDescriptor(B,T))})}return _}function n(_,P,B){return P=i(P),P in _?Object.defineProperty(_,P,{value:B,enumerable:!0,configurable:!0,writable:!0}):_[P]=B,_}function r(_,P){if(!(_ instanceof P))throw new TypeError("Cannot call a class as a function")}function o(_,P){for(var B=0;B<P.length;B++){var T=P[B];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(_,i(T.key),T)}}function s(_,P,B){return P&&o(_.prototype,P),Object.defineProperty(_,"prototype",{writable:!1}),_}function i(_){var P=a(_,"string");return typeof P=="symbol"?P:String(P)}function a(_,P){if(typeof _!="object"||_===null)return _;var B=_[Symbol.toPrimitive];if(B!==void 0){var T=B.call(_,P||"default");if(typeof T!="object")return T;throw new TypeError("@@toPrimitive must return a primitive value.")}return(P==="string"?String:Number)(_)}var l=Ut(),c=l.Buffer,f=L,g=f.inspect,p=g&&g.custom||"inspect";function h(_,P,B){c.prototype.copy.call(_,P,B)}return Ba=(function(){function _(){r(this,_),this.head=null,this.tail=null,this.length=0}return s(_,[{key:"push",value:function(B){var T={data:B,next:null};this.length>0?this.tail.next=T:this.head=T,this.tail=T,++this.length}},{key:"unshift",value:function(B){var T={data:B,next:this.head};this.length===0&&(this.tail=T),this.head=T,++this.length}},{key:"shift",value:function(){if(this.length!==0){var B=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,B}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(B){if(this.length===0)return"";for(var T=this.head,E=""+T.data;T=T.next;)E+=B+T.data;return E}},{key:"concat",value:function(B){if(this.length===0)return c.alloc(0);for(var T=c.allocUnsafe(B>>>0),E=this.head,I=0;E;)h(E.data,T,I),I+=E.data.length,E=E.next;return T}},{key:"consume",value:function(B,T){var E;return B<this.head.data.length?(E=this.head.data.slice(0,B),this.head.data=this.head.data.slice(B)):B===this.head.data.length?E=this.shift():E=T?this._getString(B):this._getBuffer(B),E}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(B){var T=this.head,E=1,I=T.data;for(B-=I.length;T=T.next;){var D=T.data,$=B>D.length?D.length:B;if($===D.length?I+=D:I+=D.slice(0,B),B-=$,B===0){$===D.length?(++E,T.next?this.head=T.next:this.head=this.tail=null):(this.head=T,T.data=D.slice($));break}++E}return this.length-=E,I}},{key:"_getBuffer",value:function(B){var T=c.allocUnsafe(B),E=this.head,I=1;for(E.data.copy(T),B-=E.data.length;E=E.next;){var D=E.data,$=B>D.length?D.length:B;if(D.copy(T,T.length-B,0,$),B-=$,B===0){$===D.length?(++I,E.next?this.head=E.next:this.head=this.tail=null):(this.head=E,E.data=D.slice($));break}++I}return this.length-=I,T}},{key:p,value:function(B,T){return g(this,e(e({},T),{},{depth:0,customInspect:!1}))}}]),_})(),Ba}function Oh(){if(ch)return Ia;ch=!0;var t=Rt;function e(a,l){var c=this,f=this._readableState&&this._readableState.destroyed,g=this._writableState&&this._writableState.destroyed;return f||g?(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(p){!l&&p?c._writableState?c._writableState.errorEmitted?t.nextTick(r,c):(c._writableState.errorEmitted=!0,t.nextTick(n,c,p)):t.nextTick(n,c,p):l?(t.nextTick(r,c),l(p)):t.nextTick(r,c)}),this)}function n(a,l){s(a,l),r(a)}function r(a){a._writableState&&!a._writableState.emitClose||a._readableState&&!a._readableState.emitClose||a.emit("close")}function o(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function s(a,l){a.emit("error",l)}function i(a,l){var c=a._readableState,f=a._writableState;c&&c.autoDestroy||f&&f.autoDestroy?a.destroy(l):a.emit("error",l)}return Ia={destroy:e,undestroy:o,errorOrDestroy:i},Ia}function mr(){if(dh)return Ea;dh=!0;let t={};function e(i,a,l){l||(l=Error);function c(g,p,h){return typeof a=="string"?a:a(g,p,h)}class f extends l{constructor(p,h,_){super(c(p,h,_))}}f.prototype.name=l.name,f.prototype.code=i,t[i]=f}function n(i,a){if(Array.isArray(i)){let l=i.length;return i=i.map(c=>String(c)),l>2?`one of ${a} ${i.slice(0,l-1).join(", ")}, or `+i[l-1]:l===2?`one of ${a} ${i[0]} or ${i[1]}`:`of ${a} ${i[0]}`}else return`of ${a} ${String(i)}`}function r(i,a,l){return i.substr(0,a.length)===a}function o(i,a,l){return(l===void 0||l>i.length)&&(l=i.length),i.substring(l-a.length,l)===a}function s(i,a,l){return typeof l!="number"&&(l=0),l+a.length>i.length?!1:i.indexOf(a,l)!==-1}return e("ERR_INVALID_OPT_VALUE",function(i,a){return'The value "'+a+'" is invalid for option "'+i+'"'},TypeError),e("ERR_INVALID_ARG_TYPE",function(i,a,l){let c;typeof a=="string"&&r(a,"not ")?(c="must not be",a=a.replace(/^not /,"")):c="must be";let f;if(o(i," argument"))f=`The ${i} ${c} ${n(a,"type")}`;else{let g=s(i,".")?"property":"argument";f=`The "${i}" ${g} ${c} ${n(a,"type")}`}return f+=`. Received type ${typeof l}`,f},TypeError),e("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),e("ERR_METHOD_NOT_IMPLEMENTED",function(i){return"The "+i+" method is not implemented"}),e("ERR_STREAM_PREMATURE_CLOSE","Premature close"),e("ERR_STREAM_DESTROYED",function(i){return"Cannot call "+i+" after a stream was destroyed"}),e("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),e("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),e("ERR_STREAM_WRITE_AFTER_END","write after end"),e("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),e("ERR_UNKNOWN_ENCODING",function(i){return"Unknown encoding: "+i},TypeError),e("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),Ea.codes=t,Ea}function Rh(){if(fh)return Sa;fh=!0;var t=mr().codes.ERR_INVALID_OPT_VALUE;function e(r,o,s){return r.highWaterMark!=null?r.highWaterMark:o?r[s]:null}function n(r,o,s,i){var a=e(o,i,s);if(a!=null){if(!(isFinite(a)&&Math.floor(a)===a)||a<0){var l=i?s:"highWaterMark";throw new t(l,a)}return Math.floor(a)}return r.objectMode?16:16*1024}return Sa={getHighWaterMark:n},Sa}function Mh(){if(ph)return ka;ph=!0;var t=Rt;ka=re;function e(R){var C=this;this.next=null,this.entry=null,this.finish=function(){ge(C,R)}}var n;re.WritableState=Y;var r={deprecate:Zy()},o=Ch(),s=Ut().Buffer,i=(typeof gh<"u"?gh: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 i}var c=Oh(),f=Rh(),g=f.getHighWaterMark,p=mr().codes,h=p.ERR_INVALID_ARG_TYPE,_=p.ERR_METHOD_NOT_IMPLEMENTED,P=p.ERR_MULTIPLE_CALLBACK,B=p.ERR_STREAM_CANNOT_PIPE,T=p.ERR_STREAM_DESTROYED,E=p.ERR_STREAM_NULL_VALUES,I=p.ERR_STREAM_WRITE_AFTER_END,D=p.ERR_UNKNOWN_ENCODING,$=c.errorOrDestroy;Zt()(re,o);function ee(){}function Y(R,C,j){n=n||gr(),R=R||{},typeof j!="boolean"&&(j=C instanceof n),this.objectMode=!!R.objectMode,j&&(this.objectMode=this.objectMode||!!R.writableObjectMode),this.highWaterMark=g(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(te){Re(C,te)},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)}Y.prototype.getBuffer=function(){for(var C=this.bufferedRequest,j=[];C;)j.push(C),C=C.next;return j},(function(){try{Object.defineProperty(Y.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(re,Symbol.hasInstance,{value:function(C){return ce.call(this,C)?!0:this!==re?!1:C&&C._writableState instanceof Y}})):ce=function(C){return C instanceof this};function re(R){n=n||gr();var C=this instanceof n;if(!C&&!ce.call(re,this))return new re(R);this._writableState=new Y(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)),o.call(this)}re.prototype.pipe=function(){$(this,new B)};function Q(R,C){var j=new I;$(R,j),t.nextTick(C,j)}function Ie(R,C,j,V){var te;return j===null?te=new E:typeof j!="string"&&!C.objectMode&&(te=new h("chunk",["string","Buffer"],j)),te?($(R,te),t.nextTick(V,te),!1):!0}re.prototype.write=function(R,C,j){var V=this._writableState,te=!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=ee),V.ending?Q(this,j):(b||Ie(this,V,R,j))&&(V.pendingcb++,te=Xe(this,V,b,R,C,j)),te},re.prototype.cork=function(){this._writableState.corked++},re.prototype.uncork=function(){var R=this._writableState;R.corked&&(R.corked--,!R.writing&&!R.corked&&!R.bufferProcessing&&R.bufferedRequest&&se(this,R))},re.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(re.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function Le(R,C,j){return!R.objectMode&&R.decodeStrings!==!1&&typeof C=="string"&&(C=s.from(C,j)),C}Object.defineProperty(re.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Xe(R,C,j,V,te,b){if(!j){var x=Le(C,V,te);V!==x&&(j=!0,te="buffer",V=x)}var F=C.objectMode?1:V.length;C.length+=F;var J=C.length<C.highWaterMark;if(J||(C.needDrain=!0),C.writing||C.corked){var Se=C.lastBufferedRequest;C.lastBufferedRequest={chunk:V,encoding:te,isBuf:j,callback:b,next:null},Se?Se.next=C.lastBufferedRequest:C.bufferedRequest=C.lastBufferedRequest,C.bufferedRequestCount+=1}else Fe(R,C,!1,F,V,te,b);return J}function Fe(R,C,j,V,te,b,x){C.writelen=V,C.writecb=x,C.writing=!0,C.sync=!0,C.destroyed?C.onwrite(new T("write")):j?R._writev(te,C.onwrite):R._write(te,b,C.onwrite),C.sync=!1}function ze(R,C,j,V,te){--C.pendingcb,j?(t.nextTick(te,V),t.nextTick(K,R,C),R._writableState.errorEmitted=!0,$(R,V)):(te(V),R._writableState.errorEmitted=!0,$(R,V),K(R,C))}function pt(R){R.writing=!1,R.writecb=null,R.length-=R.writelen,R.writelen=0}function Re(R,C){var j=R._writableState,V=j.sync,te=j.writecb;if(typeof te!="function")throw new P;if(pt(j),C)ze(R,j,V,C,te);else{var b=de(j)||R.destroyed;!b&&!j.corked&&!j.bufferProcessing&&j.bufferedRequest&&se(R,j),V?t.nextTick(ve,R,j,b,te):ve(R,j,b,te)}}function ve(R,C,j,V){j||we(R,C),C.pendingcb--,V(),K(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,te=new Array(V),b=C.corkedRequestsFree;b.entry=j;for(var x=0,F=!0;j;)te[x]=j,j.isBuf||(F=!1),j=j.next,x+=1;te.allBuffers=F,Fe(R,C,!0,C.length,te,"",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 J=j.chunk,Se=j.encoding,me=j.callback,U=C.objectMode?1:J.length;if(Fe(R,C,!1,U,J,Se,me),j=j.next,C.bufferedRequestCount--,C.writing)break}j===null&&(C.lastBufferedRequest=null)}C.bufferedRequest=j,C.bufferProcessing=!1}re.prototype._write=function(R,C,j){j(new _("_write()"))},re.prototype._writev=null,re.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(re.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"),K(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 K(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,K(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 te=V.callback;C.pendingcb--,te(j),V=V.next}C.corkedRequestsFree.next=R}return Object.defineProperty(re.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(C){this._writableState&&(this._writableState.destroyed=C)}}),re.prototype.destroy=c.destroy,re.prototype._undestroy=c.undestroy,re.prototype._destroy=function(R,C){C(R)},ka}function gr(){if(mh)return Aa;mh=!0;var t=Rt,e=Object.keys||function(f){var g=[];for(var p in f)g.push(p);return g};Aa=a;var n=Nh(),r=Mh();Zt()(a,n);for(var o=e(r.prototype),s=0;s<o.length;s++){var i=o[s];a.prototype[i]||(a.prototype[i]=r.prototype[i])}function a(f){if(!(this instanceof a))return new a(f);n.call(this,f),r.call(this,f),this.allowHalfOpen=!0,f&&(f.readable===!1&&(this.readable=!1),f.writable===!1&&(this.writable=!1),f.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",l)))}Object.defineProperty(a.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(a.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(a.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function l(){this._writableState.ended||t.nextTick(c,this)}function c(f){f.end()}return Object.defineProperty(a.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(g){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=g,this._writableState.destroyed=g)}}),Aa}function La(){if(yh)return Ca;yh=!0;var t=mr().codes.ERR_STREAM_PREMATURE_CLOSE;function e(s){var i=!1;return function(){if(!i){i=!0;for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];s.apply(this,l)}}}function n(){}function r(s){return s.setHeader&&typeof s.abort=="function"}function o(s,i,a){if(typeof i=="function")return o(s,null,i);i||(i={}),a=e(a||n);var l=i.readable||i.readable!==!1&&s.readable,c=i.writable||i.writable!==!1&&s.writable,f=function(){s.writable||p()},g=s._writableState&&s._writableState.finished,p=function(){c=!1,g=!0,l||a.call(s)},h=s._readableState&&s._readableState.endEmitted,_=function(){l=!1,h=!0,c||a.call(s)},P=function(I){a.call(s,I)},B=function(){var I;if(l&&!h)return(!s._readableState||!s._readableState.ended)&&(I=new t),a.call(s,I);if(c&&!g)return(!s._writableState||!s._writableState.ended)&&(I=new t),a.call(s,I)},T=function(){s.req.on("finish",p)};return r(s)?(s.on("complete",p),s.on("abort",B),s.req?T():s.on("request",T)):c&&!s._writableState&&(s.on("end",f),s.on("close",f)),s.on("end",_),s.on("finish",p),i.error!==!1&&s.on("error",P),s.on("close",B),function(){s.removeListener("complete",p),s.removeListener("abort",B),s.removeListener("request",T),s.req&&s.req.removeListener("finish",p),s.removeListener("end",f),s.removeListener("close",f),s.removeListener("finish",p),s.removeListener("end",_),s.removeListener("error",P),s.removeListener("close",B)}}return Ca=o,Ca}function IS(){if(hh)return Oa;hh=!0;var t=Rt,e;function n(D,$,ee){return $=r($),$ in D?Object.defineProperty(D,$,{value:ee,enumerable:!0,configurable:!0,writable:!0}):D[$]=ee,D}function r(D){var $=o(D,"string");return typeof $=="symbol"?$:String($)}function o(D,$){if(typeof D!="object"||D===null)return D;var ee=D[Symbol.toPrimitive];if(ee!==void 0){var Y=ee.call(D,$||"default");if(typeof Y!="object")return Y;throw new TypeError("@@toPrimitive must return a primitive value.")}return($==="string"?String:Number)(D)}var s=La(),i=Symbol("lastResolve"),a=Symbol("lastReject"),l=Symbol("error"),c=Symbol("ended"),f=Symbol("lastPromise"),g=Symbol("handlePromise"),p=Symbol("stream");function h(D,$){return{value:D,done:$}}function _(D){var $=D[i];if($!==null){var ee=D[p].read();ee!==null&&(D[f]=null,D[i]=null,D[a]=null,$(h(ee,!1)))}}function P(D){t.nextTick(_,D)}function B(D,$){return function(ee,Y){D.then(function(){if($[c]){ee(h(void 0,!0));return}$[g](ee,Y)},Y)}}var T=Object.getPrototypeOf(function(){}),E=Object.setPrototypeOf((e={get stream(){return this[p]},next:function(){var $=this,ee=this[l];if(ee!==null)return Promise.reject(ee);if(this[c])return Promise.resolve(h(void 0,!0));if(this[p].destroyed)return new Promise(function(Q,Ie){t.nextTick(function(){$[l]?Ie($[l]):Q(h(void 0,!0))})});var Y=this[f],ce;if(Y)ce=new Promise(B(Y,this));else{var re=this[p].read();if(re!==null)return Promise.resolve(h(re,!1));ce=new Promise(this[g])}return this[f]=ce,ce}},n(e,Symbol.asyncIterator,function(){return this}),n(e,"return",function(){var $=this;return new Promise(function(ee,Y){$[p].destroy(null,function(ce){if(ce){Y(ce);return}ee(h(void 0,!0))})})}),e),T),I=function($){var ee,Y=Object.create(E,(ee={},n(ee,p,{value:$,writable:!0}),n(ee,i,{value:null,writable:!0}),n(ee,a,{value:null,writable:!0}),n(ee,l,{value:null,writable:!0}),n(ee,c,{value:$._readableState.endEmitted,writable:!0}),n(ee,g,{value:function(re,Q){var Ie=Y[p].read();Ie?(Y[f]=null,Y[i]=null,Y[a]=null,re(h(Ie,!1))):(Y[i]=re,Y[a]=Q)},writable:!0}),ee));return Y[f]=null,s($,function(ce){if(ce&&ce.code!=="ERR_STREAM_PREMATURE_CLOSE"){var re=Y[a];re!==null&&(Y[f]=null,Y[i]=null,Y[a]=null,re(ce)),Y[l]=ce;return}var Q=Y[i];Q!==null&&(Y[f]=null,Y[i]=null,Y[a]=null,Q(h(void 0,!0))),Y[c]=!0}),$.on("readable",P.bind(null,Y)),Y};return Oa=I,Oa}function ES(){return Th||(Th=!0,Ra=function(){throw new Error("Readable.from is not available in the browser")}),Ra}function Nh(){if(vh)return Ma;vh=!0;var t=Rt;Ma=Q;var e;Q.ReadableState=re,yt.EventEmitter;var n=function(x,F){return x.listeners(F).length},r=Ch(),o=Ut().Buffer,s=(typeof _h<"u"?_h:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function i(b){return o.from(b)}function a(b){return o.isBuffer(b)||b instanceof s}var l=L,c;l&&l.debuglog?c=l.debuglog("stream"):c=function(){};var f=BS(),g=Oh(),p=Rh(),h=p.getHighWaterMark,_=mr().codes,P=_.ERR_INVALID_ARG_TYPE,B=_.ERR_STREAM_PUSH_AFTER_EOF,T=_.ERR_METHOD_NOT_IMPLEMENTED,E=_.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,I,D,$;Zt()(Q,r);var ee=g.errorOrDestroy,Y=["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 re(b,x,F){e=e||gr(),b=b||{},typeof F!="boolean"&&(F=x instanceof e),this.objectMode=!!b.objectMode,F&&(this.objectMode=this.objectMode||!!b.readableObjectMode),this.highWaterMark=h(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&&(I||(I=ei.StringDecoder),this.decoder=new I(b.encoding),this.encoding=b.encoding)}function Q(b){if(e=e||gr(),!(this instanceof Q))return new Q(b);var x=this instanceof e;this._readableState=new re(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(Q.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(x){this._readableState&&(this._readableState.destroyed=x)}}),Q.prototype.destroy=g.destroy,Q.prototype._undestroy=g.undestroy,Q.prototype._destroy=function(b,x){x(b)},Q.prototype.push=function(b,x){var F=this._readableState,J;return F.objectMode?J=!0:typeof b=="string"&&(x=x||F.defaultEncoding,x!==F.encoding&&(b=o.from(b,x),x=""),J=!0),Ie(this,b,x,!1,J)},Q.prototype.unshift=function(b){return Ie(this,b,null,!0,!1)};function Ie(b,x,F,J,Se){c("readableAddChunk",x);var me=b._readableState;if(x===null)me.reading=!1,Re(b,me);else{var U;if(Se||(U=Xe(me,x)),U)ee(b,U);else if(me.objectMode||x&&x.length>0)if(typeof x!="string"&&!me.objectMode&&Object.getPrototypeOf(x)!==o.prototype&&(x=i(x)),J)me.endEmitted?ee(b,new E):Le(b,me,x,!0);else if(me.ended)ee(b,new B);else{if(me.destroyed)return!1;me.reading=!1,me.decoder&&!F?(x=me.decoder.write(x),me.objectMode||x.length!==0?Le(b,me,x,!1):se(b,me)):Le(b,me,x,!1)}else J||(me.reading=!1,se(b,me))}return!me.ended&&(me.length<me.highWaterMark||me.length===0)}function Le(b,x,F,J){x.flowing&&x.length===0&&!x.sync?(x.awaitDrain=0,b.emit("data",F)):(x.length+=x.objectMode?1:F.length,J?x.buffer.unshift(F):x.buffer.push(F),x.needReadable&&ve(b)),se(b,x)}function Xe(b,x){var F;return!a(x)&&typeof x!="string"&&x!==void 0&&!b.objectMode&&(F=new P("chunk",["string","Buffer","Uint8Array"],x)),F}Q.prototype.isPaused=function(){return this._readableState.flowing===!1},Q.prototype.setEncoding=function(b){I||(I=ei.StringDecoder);var x=new I(b);this._readableState.decoder=x,this._readableState.encoding=this._readableState.decoder.encoding;for(var F=this._readableState.buffer.head,J="";F!==null;)J+=x.write(F.data),F=F.next;return this._readableState.buffer.clear(),J!==""&&this._readableState.buffer.push(J),this._readableState.length=J.length,this};var Fe=1073741824;function ze(b){return b>=Fe?b=Fe:(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=ze(b)),b<=x.length?b:x.ended?x.length:(x.needReadable=!0,0))}Q.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 J=x.needReadable;c("need readable",J),(x.length===0||x.length-b<x.highWaterMark)&&(J=!0,c("length less than watermark",J)),x.ended||x.reading?(J=!1,c("reading or ended",J)):J&&(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 Se;return b>0?Se=C(b,x):Se=null,Se===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)),Se!==null&&this.emit("data",Se),Se};function Re(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}Q.prototype._read=function(b){ee(this,new T("_read()"))},Q.prototype.pipe=function(b,x){var F=this,J=this._readableState;switch(J.pipesCount){case 0:J.pipes=b;break;case 1:J.pipes=[J.pipes,b];break;default:J.pipes.push(b);break}J.pipesCount+=1,c("pipe count=%d opts=%j",J.pipesCount,x);var Se=(!x||x.end!==!1)&&b!==t.stdout&&b!==t.stderr,me=Se?kt:u;J.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,Tr())}function kt(){c("onend"),b.end()}var Ht=N(F);b.on("drain",Ht);var vt=!1;function Tr(){c("cleanup"),b.removeListener("close",vr),b.removeListener("finish",y),b.removeListener("drain",Ht),b.removeListener("error",xt),b.removeListener("unpipe",U),F.removeListener("end",kt),F.removeListener("end",u),F.removeListener("data",ci),vt=!0,J.awaitDrain&&(!b._writableState||b._writableState.needDrain)&&Ht()}F.on("data",ci);function ci(d){c("ondata");var v=b.write(d);c("dest.write",v),v===!1&&((J.pipesCount===1&&J.pipes===b||J.pipesCount>1&&te(J.pipes,b)!==-1)&&!vt&&(c("false write response, pause",J.awaitDrain),J.awaitDrain++),F.pause())}function xt(d){c("onerror",d),u(),b.removeListener("error",xt),n(b,"error")===0&&ee(b,d)}ce(b,"error",xt);function vr(){b.removeListener("finish",y),u()}b.once("close",vr);function y(){c("onfinish"),b.removeListener("close",vr),u()}b.once("finish",y);function u(){c("unpipe"),F.unpipe(b)}return b.emit("pipe",F),J.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))}}Q.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 J=x.pipes,Se=x.pipesCount;x.pipes=null,x.pipesCount=0,x.flowing=!1;for(var me=0;me<Se;me++)J[me].emit("unpipe",this,{hasUnpiped:!1});return this}var U=te(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)},Q.prototype.on=function(b,x){var F=r.prototype.on.call(this,b,x),J=this._readableState;return b==="data"?(J.readableListening=this.listenerCount("readable")>0,J.flowing!==!1&&this.resume()):b==="readable"&&!J.endEmitted&&!J.readableListening&&(J.readableListening=J.needReadable=!0,J.flowing=!1,J.emittedReadable=!1,c("on readable",J.length,J.reading),J.length?ve(this):J.reading||t.nextTick(K,this)),F},Q.prototype.addListener=Q.prototype.on,Q.prototype.removeListener=function(b,x){var F=r.prototype.removeListener.call(this,b,x);return b==="readable"&&t.nextTick(Z,this),F},Q.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 K(b){c("readable nexttick read 0"),b.read(0)}Q.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)}Q.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;);}Q.prototype.wrap=function(b){var x=this,F=this._readableState,J=!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 kt=x.push(U);kt||(J=!0,b.pause())}});for(var Se in b)this[Se]===void 0&&typeof b[Se]=="function"&&(this[Se]=(function(kt){return function(){return b[kt].apply(b,arguments)}})(Se));for(var me=0;me<Y.length;me++)b.on(Y[me],this.emit.bind(this,Y[me]));return this._read=function(U){c("wrapped _read",U),J&&(J=!1,b.resume())},this},typeof Symbol=="function"&&(Q.prototype[Symbol.asyncIterator]=function(){return D===void 0&&(D=IS()),D(this)}),Object.defineProperty(Q.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(Q.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(Q.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(x){this._readableState&&(this._readableState.flowing=x)}}),Q._fromList=C,Object.defineProperty(Q.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"&&(Q.from=function(b,x){return $===void 0&&($=ES()),$(Q,b,x)});function te(b,x){for(var F=0,J=b.length;F<J;F++)if(b[F]===x)return F;return-1}return Ma}function Dh(){if(bh)return Na;bh=!0,Na=a;var t=mr().codes,e=t.ERR_METHOD_NOT_IMPLEMENTED,n=t.ERR_MULTIPLE_CALLBACK,r=t.ERR_TRANSFORM_ALREADY_TRANSFORMING,o=t.ERR_TRANSFORM_WITH_LENGTH_0,s=gr();Zt()(a,s);function i(f,g){var p=this._transformState;p.transforming=!1;var h=p.writecb;if(h===null)return this.emit("error",new n);p.writechunk=null,p.writecb=null,g!=null&&this.push(g),h(f);var _=this._readableState;_.reading=!1,(_.needReadable||_.length<_.highWaterMark)&&this._read(_.highWaterMark)}function a(f){if(!(this instanceof a))return new a(f);s.call(this,f),this._transformState={afterTransform:i.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,f&&(typeof f.transform=="function"&&(this._transform=f.transform),typeof f.flush=="function"&&(this._flush=f.flush)),this.on("prefinish",l)}function l(){var f=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(g,p){c(f,g,p)}):c(this,null,null)}a.prototype.push=function(f,g){return this._transformState.needTransform=!1,s.prototype.push.call(this,f,g)},a.prototype._transform=function(f,g,p){p(new e("_transform()"))},a.prototype._write=function(f,g,p){var h=this._transformState;if(h.writecb=p,h.writechunk=f,h.writeencoding=g,!h.transforming){var _=this._readableState;(h.needTransform||_.needReadable||_.length<_.highWaterMark)&&this._read(_.highWaterMark)}},a.prototype._read=function(f){var g=this._transformState;g.writechunk!==null&&!g.transforming?(g.transforming=!0,this._transform(g.writechunk,g.writeencoding,g.afterTransform)):g.needTransform=!0},a.prototype._destroy=function(f,g){s.prototype._destroy.call(this,f,function(p){g(p)})};function c(f,g,p){if(g)return f.emit("error",g);if(p!=null&&f.push(p),f._writableState.length)throw new o;if(f._transformState.transforming)throw new r;return f.push(null)}return Na}function SS(){if(wh)return Da;wh=!0,Da=e;var t=Dh();Zt()(e,t);function e(n){if(!(this instanceof e))return new e(n);t.call(this,n)}return e.prototype._transform=function(n,r,o){o(null,n)},Da}function kS(){if(xh)return Ha;xh=!0;var t;function e(p){var h=!1;return function(){h||(h=!0,p.apply(void 0,arguments))}}var n=mr().codes,r=n.ERR_MISSING_ARGS,o=n.ERR_STREAM_DESTROYED;function s(p){if(p)throw p}function i(p){return p.setHeader&&typeof p.abort=="function"}function a(p,h,_,P){P=e(P);var B=!1;p.on("close",function(){B=!0}),t===void 0&&(t=La()),t(p,{readable:h,writable:_},function(E){if(E)return P(E);B=!0,P()});var T=!1;return function(E){if(!B&&!T){if(T=!0,i(p))return p.abort();if(typeof p.destroy=="function")return p.destroy();P(E||new o("pipe"))}}}function l(p){p()}function c(p,h){return p.pipe(h)}function f(p){return!p.length||typeof p[p.length-1]!="function"?s:p.pop()}function g(){for(var p=arguments.length,h=new Array(p),_=0;_<p;_++)h[_]=arguments[_];var P=f(h);if(Array.isArray(h[0])&&(h=h[0]),h.length<2)throw new r("streams");var B,T=h.map(function(E,I){var D=I<h.length-1,$=I>0;return a(E,D,$,function(ee){B||(B=ee),ee&&T.forEach(l),!D&&(T.forEach(l),P(B))})});return h.reduce(c)}return Ha=g,Ha}function Hh(){return Ph||(Ph=!0,Tt=Tt=Nh(),Tt.Stream=Tt,Tt.Readable=Tt,Tt.Writable=Mh(),Tt.Duplex=gr(),Tt.Transform=Dh(),Tt.PassThrough=SS(),Tt.finished=La(),Tt.pipeline=kS()),Tt}function Uh(){if(Bh)return vo;Bh=!0;var t=Ut().Buffer,e=Rt,n=Ah(),r=Zt(),o=Hh(),s=vo.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},i=vo.IncomingMessage=function(a,l,c,f){var g=this||_o;if(o.Readable.call(g),g._mode=c,g.headers={},g.rawHeaders=[],g.trailers={},g.rawTrailers=[],g.on("end",function(){e.nextTick(function(){g.emit("close")})}),c==="fetch"){let T=function(){h.read().then(function(E){if(!g._destroyed){if(f(E.done),E.done){g.push(null);return}g.push(t.from(E.value)),T()}}).catch(function(E){f(!0),g._destroyed||g.emit("error",E)})};if(g._fetchResponse=l,g.url=l.url,g.statusCode=l.status,g.statusMessage=l.statusText,l.headers.forEach(function(E,I){g.headers[I.toLowerCase()]=E,g.rawHeaders.push(I,E)}),n.writableStream){var p=new WritableStream({write:function(E){return f(!1),new Promise(function(I,D){g._destroyed?D():g.push(t.from(E))?I():g._resumeFetch=I})},close:function(){f(!0),g._destroyed||g.push(null)},abort:function(E){f(!0),g._destroyed||g.emit("error",E)}});try{l.body.pipeTo(p).catch(function(E){f(!0),g._destroyed||g.emit("error",E)});return}catch{}}var h=l.body.getReader();T()}else{g._xhr=a,g._pos=0,g.url=a.responseURL,g.statusCode=a.status,g.statusMessage=a.statusText;var _=a.getAllResponseHeaders().split(/\r?\n/);if(_.forEach(function(T){var E=T.match(/^([^:]+):\s*(.*)/);if(E){var I=E[1].toLowerCase();I==="set-cookie"?(g.headers[I]===void 0&&(g.headers[I]=[]),g.headers[I].push(E[2])):g.headers[I]!==void 0?g.headers[I]+=", "+E[2]:g.headers[I]=E[2],g.rawHeaders.push(E[1],E[2])}}),g._charset="x-user-defined",!n.overrideMimeType){var P=g.rawHeaders["mime-type"];if(P){var B=P.match(/;\s*charset=([^;])(;|$)/);B&&(g._charset=B[1].toLowerCase())}g._charset||(g._charset="utf-8")}}};return r(i,o.Readable),i.prototype._read=function(){var a=this||_o,l=a._resumeFetch;l&&(a._resumeFetch=null,l())},i.prototype._onXHRProgress=function(a){var l=this||_o,c=l._xhr,f=null;switch(l._mode){case"text":if(f=c.responseText,f.length>l._pos){var g=f.substr(l._pos);if(l._charset==="x-user-defined"){for(var p=t.alloc(g.length),h=0;h<g.length;h++)p[h]=g.charCodeAt(h)&255;l.push(p)}else l.push(g,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 _=new _o.MSStreamReader;_.onprogress=function(){_.result.byteLength>l._pos&&(l.push(t.from(new Uint8Array(_.result.slice(l._pos)))),l._pos=_.result.byteLength)},_.onload=function(){a(!0),l.push(null)},_.readAsArrayBuffer(f);break}l._xhr.readyState===s.DONE&&l._mode!=="ms-stream"&&(a(!0),l.push(null))},vo}function AS(){if(Ih)return Ua;Ih=!0;var t=Ut().Buffer,e=Rt,n=Ah(),r=Zt(),o=Uh(),s=Hh(),i=o.IncomingMessage,a=o.readyStates;function l(p,h){return n.fetch&&h?"fetch":n.mozchunkedarraybuffer?"moz-chunked-arraybuffer":n.msstream?"ms-stream":n.arraybuffer&&p?"arraybuffer":"text"}var c=Ua=function(p){var h=this||rt;s.Writable.call(h),h._opts=p,h._body=[],h._headers={},p.auth&&h.setHeader("Authorization","Basic "+t.from(p.auth).toString("base64")),Object.keys(p.headers).forEach(function(B){h.setHeader(B,p.headers[B])});var _,P=!0;if(p.mode==="disable-fetch"||"requestTimeout"in p&&!n.abortController)P=!1,_=!0;else if(p.mode==="prefer-streaming")_=!1;else if(p.mode==="allow-wrong-content-type")_=!n.overrideMimeType;else if(!p.mode||p.mode==="default"||p.mode==="prefer-fast")_=!0;else throw new Error("Invalid value for opts.mode");h._mode=l(_,P),h._fetchTimer=null,h._socketTimeout=null,h._socketTimer=null,h.on("finish",function(){h._onFinish()})};r(c,s.Writable),c.prototype.setHeader=function(p,h){var _=this||rt,P=p.toLowerCase();g.indexOf(P)===-1&&(_._headers[P]={name:p,value:h})},c.prototype.getHeader=function(p){var h=(this||rt)._headers[p.toLowerCase()];return h?h.value:null},c.prototype.removeHeader=function(p){var h=this||rt;delete h._headers[p.toLowerCase()]},c.prototype._onFinish=function(){var p=this||rt;if(!p._destroyed){var h=p._opts;"timeout"in h&&h.timeout!==0&&p.setTimeout(h.timeout);var _=p._headers,P=null;h.method!=="GET"&&h.method!=="HEAD"&&(P=new Blob(p._body,{type:(_["content-type"]||{}).value||""}));var B=[];if(Object.keys(_).forEach(function(D){var $=_[D].name,ee=_[D].value;Array.isArray(ee)?ee.forEach(function(Y){B.push([$,Y])}):B.push([$,ee])}),p._mode==="fetch"){var T=null;if(n.abortController){var E=new AbortController;T=E.signal,p._fetchAbortController=E,"requestTimeout"in h&&h.requestTimeout!==0&&(p._fetchTimer=rt.setTimeout(function(){p.emit("requestTimeout"),p._fetchAbortController&&p._fetchAbortController.abort()},h.requestTimeout))}rt.fetch(p._opts.url,{method:p._opts.method,headers:B,body:P||void 0,mode:"cors",credentials:h.withCredentials?"include":"same-origin",signal:T}).then(function(D){p._fetchResponse=D,p._resetTimers(!1),p._connect()},function(D){p._resetTimers(!0),p._destroyed||p.emit("error",D)})}else{var I=p._xhr=new rt.XMLHttpRequest;try{I.open(p._opts.method,p._opts.url,!0)}catch(D){e.nextTick(function(){p.emit("error",D)});return}"responseType"in I&&(I.responseType=p._mode),"withCredentials"in I&&(I.withCredentials=!!h.withCredentials),p._mode==="text"&&"overrideMimeType"in I&&I.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in h&&(I.timeout=h.requestTimeout,I.ontimeout=function(){p.emit("requestTimeout")}),B.forEach(function(D){I.setRequestHeader(D[0],D[1])}),p._response=null,I.onreadystatechange=function(){switch(I.readyState){case a.LOADING:case a.DONE:p._onXHRProgress();break}},p._mode==="moz-chunked-arraybuffer"&&(I.onprogress=function(){p._onXHRProgress()}),I.onerror=function(){p._destroyed||(p._resetTimers(!0),p.emit("error",new Error("XHR error")))};try{I.send(P)}catch(D){e.nextTick(function(){p.emit("error",D)});return}}}};function f(p){try{var h=p.status;return h!==null&&h!==0}catch{return!1}}c.prototype._onXHRProgress=function(){var p=this||rt;p._resetTimers(!1),!(!f(p._xhr)||p._destroyed)&&(p._response||p._connect(),p._response._onXHRProgress(p._resetTimers.bind(p)))},c.prototype._connect=function(){var p=this||rt;p._destroyed||(p._response=new i(p._xhr,p._fetchResponse,p._mode,p._resetTimers.bind(p)),p._response.on("error",function(h){p.emit("error",h)}),p.emit("response",p._response))},c.prototype._write=function(p,h,_){var P=this||rt;P._body.push(p),_()},c.prototype._resetTimers=function(p){var h=this||rt;rt.clearTimeout(h._socketTimer),h._socketTimer=null,p?(rt.clearTimeout(h._fetchTimer),h._fetchTimer=null):h._socketTimeout&&(h._socketTimer=rt.setTimeout(function(){h.emit("timeout")},h._socketTimeout))},c.prototype.abort=c.prototype.destroy=function(p){var h=this||rt;h._destroyed=!0,h._resetTimers(!0),h._response&&(h._response._destroyed=!0),h._xhr?h._xhr.abort():h._fetchAbortController&&h._fetchAbortController.abort(),p&&h.emit("error",p)},c.prototype.end=function(p,h,_){var P=this||rt;typeof p=="function"&&(_=p,p=void 0),s.Writable.prototype.end.call(P,p,h,_)},c.prototype.setTimeout=function(p,h){var _=this||rt;h&&_.once("timeout",h),_._socketTimeout=p,_._resetTimers(!1)},c.prototype.flushHeaders=function(){},c.prototype.setNoDelay=function(){},c.prototype.setSocketKeepAlive=function(){};var g=["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 Ua}function CS(){if(Eh)return ja;Eh=!0,ja=e;var t=Object.prototype.hasOwnProperty;function e(){for(var n={},r=0;r<arguments.length;r++){var o=arguments[r];for(var s in o)t.call(o,s)&&(n[s]=o[s])}return n}return ja}function OS(){return Sh||(Sh=!0,$a={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"}),$a}function MS(){if(kh)return Za;kh=!0;var t=AS(),e=Uh(),n=CS(),r=OS(),o=Ce,s=Za;return s.request=function(i,a){typeof i=="string"?i=o.parse(i):i=n(i);var l=RS.location.protocol.search(/^https?:$/)===-1?"http:":"",c=i.protocol||l,f=i.hostname||i.host,g=i.port,p=i.path||"/";f&&f.indexOf(":")!==-1&&(f="["+f+"]"),i.url=(f?c+"//"+f:"")+(g?":"+g:"")+p,i.method=(i.method||"GET").toUpperCase(),i.headers=i.headers||{};var h=new t(i);return a&&h.on("response",a),h},s.get=function(a,l){var c=s.request(a,l);return c.end(),c},s.ClientRequest=t,s.IncomingMessage=e.IncomingMessage,s.Agent=function(){},s.Agent.defaultMaxSockets=4,s.globalAgent=new s.Agent,s.STATUS_CODES=r,s.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"],Za}var wt,ah,Gn,Pa,lh,Ba,uh,Ia,ch,Ea,dh,Sa,fh,ka,ph,gh,Aa,mh,Ca,yh,Oa,hh,Ra,Th,Ma,vh,_h,Na,bh,Da,wh,Ha,xh,Tt,Ph,vo,Bh,_o,Ua,Ih,rt,ja,Eh,$a,Sh,Za,kh,RS,un,NS,DS,HS,US,jS,$S,ZS,LS,$h=it(()=>{S();A();k();qs();ty();Gs();mi();Hy();ho();ca();Ly();Fy();sh();ma();wt={},ah=!1,Gn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Pa={},lh=!1;Ba={},uh=!1;Ia={},ch=!1;Ea={},dh=!1;Sa={},fh=!1;ka={},ph=!1,gh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Aa={},mh=!1;Ca={},yh=!1;Oa={},hh=!1;Ra={},Th=!1;Ma={},vh=!1,_h=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Na={},bh=!1;Da={},wh=!1;Ha={},xh=!1;Tt={},Ph=!1;vo={},Bh=!1,_o=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ua={},Ih=!1,rt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;ja={},Eh=!1;$a={},Sh=!1;Za={},kh=!1,RS=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;un=MS(),NS=un.Agent,DS=un.ClientRequest,HS=un.IncomingMessage,US=un.METHODS,jS=un.STATUS_CODES,$S=un.get,ZS=un.globalAgent,LS=un.request});S();A();k();var Lm={};bn(Lm,{defaults:()=>LB,markdown:()=>$B,markdownBloc:()=>ZB});S();A();k();S();A();k();S();A();k();var ss=Object.defineProperty,QT=Object.defineProperties,ev=Object.getOwnPropertyDescriptors,Ei=Object.getOwnPropertySymbols,Kc=Object.prototype.hasOwnProperty,Wc=Object.prototype.propertyIsEnumerable,ac=(t,e,n)=>e in t?ss(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,w=(t,e)=>{for(var n in e||(e={}))Kc.call(e,n)&&ac(t,n,e[n]);if(Ei)for(var n of Ei(e))Wc.call(e,n)&&ac(t,n,e[n]);return t},M=(t,e)=>QT(t,ev(e)),m=(t,e)=>ss(t,"name",{value:e,configurable:!0}),Fc=(t,e)=>{var n={};for(var r in t)Kc.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Ei)for(var r of Ei(t))e.indexOf(r)<0&&Wc.call(t,r)&&(n[r]=t[r]);return n},Ot=(t,e)=>{for(var n in e)ss(t,n,{get:e[n],enumerable:!0})},ne={};Ot(ne,{DIRTY:()=>js,ERR:()=>Us,OK:()=>Oi,any:()=>On,array:()=>An,bigint:()=>Ki,boolean:()=>Zn,branded:()=>Hs,catch:()=>Ns,coerce:()=>kg,custom:()=>Zi,date:()=>Wi,default:()=>Ms,discriminatedUnion:()=>qi,downstream:()=>As,enum:()=>zi,function:()=>Es,instanceof:()=>Ts,intersection:()=>Gi,is:()=>et,lazy:()=>Bs,literal:()=>Kr,map:()=>Ps,nan:()=>bs,nativeEnum:()=>ws,never:()=>Lr,null:()=>qr,nullable:()=>Os,number:()=>$n,object:()=>rr,optional:()=>Cs,pipeline:()=>Ds,preprocess:()=>Ss,promise:()=>Is,readonly:()=>Rs,record:()=>Wr,ref:()=>Fi,set:()=>Vi,strictObject:()=>xs,string:()=>Qt,symbol:()=>_s,transforms:()=>zc,tuple:()=>Gr,undefined:()=>Li,union:()=>ir,unknown:()=>yn,upstream:()=>ks,void:()=>vs,zuiKey:()=>ke});var zc={};Ot(zc,{errors:()=>Ag,fromJSONSchema:()=>Yg,fromJSONSchemaLegacy:()=>kP,fromObject:()=>rs,json:()=>HB,toJSONSchema:()=>ot,toJSONSchemaLegacy:()=>iB,toTypescriptSchema:()=>Fs,toTypescriptType:()=>Ws});var en={};Ot(en,{DIRTY:()=>js,ERR:()=>Us,OK:()=>Oi,any:()=>On,array:()=>An,bigint:()=>Ki,boolean:()=>Zn,branded:()=>Hs,catch:()=>Ns,coerce:()=>kg,custom:()=>Zi,date:()=>Wi,default:()=>Ms,discriminatedUnion:()=>qi,downstream:()=>As,enum:()=>zi,function:()=>Es,instanceof:()=>Ts,intersection:()=>Gi,is:()=>et,lazy:()=>Bs,literal:()=>Kr,map:()=>Ps,nan:()=>bs,nativeEnum:()=>ws,never:()=>Lr,null:()=>qr,nullable:()=>Os,number:()=>$n,object:()=>rr,optional:()=>Cs,pipeline:()=>Ds,preprocess:()=>Ss,promise:()=>Is,readonly:()=>Rs,record:()=>Wr,ref:()=>Fi,set:()=>Vi,strictObject:()=>xs,string:()=>Qt,symbol:()=>_s,tuple:()=>Gr,undefined:()=>Li,union:()=>ir,unknown:()=>yn,upstream:()=>ks,void:()=>vs,zuiKey:()=>ke});var ke="x-zui",Ve={};Ot(Ve,{CustomSet:()=>ax});var $t={};Ot($t,{isEqual:()=>pp,unique:()=>ox});var tv=typeof global=="object"&&global&&global.Object===Object&&global,qc=tv,nv=typeof self=="object"&&self&&self.Object===Object&&self,rv=qc||nv||Function("return this")(),tn=rv,iv=tn.Symbol,mn=iv,Gc=Object.prototype,ov=Gc.hasOwnProperty,sv=Gc.toString,br=mn?mn.toStringTag:void 0;function Vc(t){var e=ov.call(t,br),n=t[br];try{t[br]=void 0;var r=!0}catch{}var o=sv.call(t);return r&&(e?t[br]=n:delete t[br]),o}m(Vc,"getRawTag");var av=Vc,lv=Object.prototype,uv=lv.toString;function Jc(t){return uv.call(t)}m(Jc,"objectToString");var cv=Jc,dv="[object Null]",fv="[object Undefined]",lc=mn?mn.toStringTag:void 0;function Yc(t){return t==null?t===void 0?fv:dv:lc&&lc in Object(t)?av(t):cv(t)}m(Yc,"baseGetTag");var Rn=Yc;function Xc(t){return t!=null&&typeof t=="object"}m(Xc,"isObjectLike");var Cn=Xc,pv="[object Symbol]";function Qc(t){return typeof t=="symbol"||Cn(t)&&Rn(t)==pv}m(Qc,"isSymbol");var as=Qc;function ed(t,e){for(var n=-1,r=t==null?0:t.length,o=Array(r);++n<r;)o[n]=e(t[n],n,t);return o}m(ed,"arrayMap");var td=ed,gv=Array.isArray,Xt=gv,mv=1/0,uc=mn?mn.prototype:void 0,cc=uc?uc.toString:void 0;function ls(t){if(typeof t=="string")return t;if(Xt(t))return td(t,ls)+"";if(as(t))return cc?cc.call(t):"";var e=t+"";return e=="0"&&1/t==-mv?"-0":e}m(ls,"baseToString");var yv=ls;function nd(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}m(nd,"isObject");var nr=nd;function rd(t){return t}m(rd,"identity");var hv=rd,Tv="[object AsyncFunction]",vv="[object Function]",_v="[object GeneratorFunction]",bv="[object Proxy]";function id(t){if(!nr(t))return!1;var e=Rn(t);return e==vv||e==_v||e==Tv||e==bv}m(id,"isFunction");var od=id,wv=tn["__core-js_shared__"],No=wv,dc=(function(){var t=/[^.]+$/.exec(No&&No.keys&&No.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function sd(t){return!!dc&&dc in t}m(sd,"isMasked");var xv=sd,Pv=Function.prototype,Bv=Pv.toString;function ad(t){if(t!=null){try{return Bv.call(t)}catch{}try{return t+""}catch{}}return""}m(ad,"toSource");var Mn=ad,Iv=/[\\^$.*+?()[\]{}|]/g,Ev=/^\[object .+?Constructor\]$/,Sv=Function.prototype,kv=Object.prototype,Av=Sv.toString,Cv=kv.hasOwnProperty,Ov=RegExp("^"+Av.call(Cv).replace(Iv,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ld(t){if(!nr(t)||xv(t))return!1;var e=od(t)?Ov:Ev;return e.test(Mn(t))}m(ld,"baseIsNative");var Rv=ld;function ud(t,e){return t?.[e]}m(ud,"getValue");var Mv=ud;function cd(t,e){var n=Mv(t,e);return Rv(n)?n:void 0}m(cd,"getNative");var Nn=cd,Nv=Nn(tn,"WeakMap"),qo=Nv,Dv=(function(){try{var t=Nn(Object,"defineProperty");return t({},"",{}),t}catch{}})(),fc=Dv,Hv=9007199254740991,Uv=/^(?:0|[1-9]\d*)$/;function dd(t,e){var n=typeof t;return e=e??Hv,!!e&&(n=="number"||n!="symbol"&&Uv.test(t))&&t>-1&&t%1==0&&t<e}m(dd,"isIndex");var us=dd;function fd(t,e,n){e=="__proto__"&&fc?fc(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}m(fd,"baseAssignValue");var pd=fd;function gd(t,e){return t===e||t!==t&&e!==e}m(gd,"eq");var cs=gd,jv=Object.prototype,$v=jv.hasOwnProperty;function md(t,e,n){var r=t[e];(!($v.call(t,e)&&cs(r,n))||n===void 0&&!(e in t))&&pd(t,e,n)}m(md,"assignValue");var Zv=md,Lv=9007199254740991;function yd(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Lv}m(yd,"isLength");var ds=yd;function hd(t){return t!=null&&ds(t.length)&&!od(t)}m(hd,"isArrayLike");var Td=hd,Kv=Object.prototype;function vd(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||Kv;return t===n}m(vd,"isPrototype");var _d=vd;function bd(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}m(bd,"baseTimes");var Wv=bd,Fv="[object Arguments]";function wd(t){return Cn(t)&&Rn(t)==Fv}m(wd,"baseIsArguments");var pc=wd,xd=Object.prototype,zv=xd.hasOwnProperty,qv=xd.propertyIsEnumerable,Gv=pc((function(){return arguments})())?pc:function(t){return Cn(t)&&zv.call(t,"callee")&&!qv.call(t,"callee")},Pd=Gv;function Bd(){return!1}m(Bd,"stubFalse");var Vv=Bd,Id=typeof exports=="object"&&exports&&!exports.nodeType&&exports,gc=Id&&typeof module=="object"&&module&&!module.nodeType&&module,Jv=gc&&gc.exports===Id,mc=Jv?tn.Buffer:void 0,Yv=mc?mc.isBuffer:void 0,Xv=Yv||Vv,Go=Xv,Qv="[object Arguments]",e_="[object Array]",t_="[object Boolean]",n_="[object Date]",r_="[object Error]",i_="[object Function]",o_="[object Map]",s_="[object Number]",a_="[object Object]",l_="[object RegExp]",u_="[object Set]",c_="[object String]",d_="[object WeakMap]",f_="[object ArrayBuffer]",p_="[object DataView]",g_="[object Float32Array]",m_="[object Float64Array]",y_="[object Int8Array]",h_="[object Int16Array]",T_="[object Int32Array]",v_="[object Uint8Array]",__="[object Uint8ClampedArray]",b_="[object Uint16Array]",w_="[object Uint32Array]",Me={};Me[g_]=Me[m_]=Me[y_]=Me[h_]=Me[T_]=Me[v_]=Me[__]=Me[b_]=Me[w_]=!0;Me[Qv]=Me[e_]=Me[f_]=Me[t_]=Me[p_]=Me[n_]=Me[r_]=Me[i_]=Me[o_]=Me[s_]=Me[a_]=Me[l_]=Me[u_]=Me[c_]=Me[d_]=!1;function Ed(t){return Cn(t)&&ds(t.length)&&!!Me[Rn(t)]}m(Ed,"baseIsTypedArray");var x_=Ed;function Sd(t){return function(e){return t(e)}}m(Sd,"baseUnary");var P_=Sd,kd=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Dr=kd&&typeof module=="object"&&module&&!module.nodeType&&module,B_=Dr&&Dr.exports===kd,Do=B_&&qc.process,I_=(function(){try{var t=Dr&&Dr.require&&Dr.require("util").types;return t||Do&&Do.binding&&Do.binding("util")}catch{}})(),yc=I_,hc=yc&&yc.isTypedArray,E_=hc?P_(hc):x_,Ad=E_,S_=Object.prototype,k_=S_.hasOwnProperty;function Cd(t,e){var n=Xt(t),r=!n&&Pd(t),o=!n&&!r&&Go(t),s=!n&&!r&&!o&&Ad(t),i=n||r||o||s,a=i?Wv(t.length,String):[],l=a.length;for(var c in t)(e||k_.call(t,c))&&!(i&&(c=="length"||o&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||us(c,l)))&&a.push(c);return a}m(Cd,"arrayLikeKeys");var Od=Cd;function Rd(t,e){return function(n){return t(e(n))}}m(Rd,"overArg");var Md=Rd,A_=Md(Object.keys,Object),C_=A_,O_=Object.prototype,R_=O_.hasOwnProperty;function Nd(t){if(!_d(t))return C_(t);var e=[];for(var n in Object(t))R_.call(t,n)&&n!="constructor"&&e.push(n);return e}m(Nd,"baseKeys");var M_=Nd;function Dd(t){return Td(t)?Od(t):M_(t)}m(Dd,"keys");var fs=Dd;function Hd(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}m(Hd,"nativeKeysIn");var N_=Hd,D_=Object.prototype,H_=D_.hasOwnProperty;function Ud(t){if(!nr(t))return N_(t);var e=_d(t),n=[];for(var r in t)r=="constructor"&&(e||!H_.call(t,r))||n.push(r);return n}m(Ud,"baseKeysIn");var U_=Ud;function jd(t){return Td(t)?Od(t,!0):U_(t)}m(jd,"keysIn");var j_=jd,$_=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Z_=/^\w*$/;function $d(t,e){if(Xt(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||as(t)?!0:Z_.test(t)||!$_.test(t)||e!=null&&t in Object(e)}m($d,"isKey");var ps=$d,L_=Nn(Object,"create"),jr=L_;function Zd(){this.__data__=jr?jr(null):{},this.size=0}m(Zd,"hashClear");var K_=Zd;function Ld(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}m(Ld,"hashDelete");var W_=Ld,F_="__lodash_hash_undefined__",z_=Object.prototype,q_=z_.hasOwnProperty;function Kd(t){var e=this.__data__;if(jr){var n=e[t];return n===F_?void 0:n}return q_.call(e,t)?e[t]:void 0}m(Kd,"hashGet");var G_=Kd,V_=Object.prototype,J_=V_.hasOwnProperty;function Wd(t){var e=this.__data__;return jr?e[t]!==void 0:J_.call(e,t)}m(Wd,"hashHas");var Y_=Wd,X_="__lodash_hash_undefined__";function Fd(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=jr&&e===void 0?X_:e,this}m(Fd,"hashSet");var Q_=Fd;function Dn(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(Dn,"Hash");Dn.prototype.clear=K_;Dn.prototype.delete=W_;Dn.prototype.get=G_;Dn.prototype.has=Y_;Dn.prototype.set=Q_;var Tc=Dn;function zd(){this.__data__=[],this.size=0}m(zd,"listCacheClear");var eb=zd;function qd(t,e){for(var n=t.length;n--;)if(cs(t[n][0],e))return n;return-1}m(qd,"assocIndexOf");var Mi=qd,tb=Array.prototype,nb=tb.splice;function Gd(t){var e=this.__data__,n=Mi(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():nb.call(e,n,1),--this.size,!0}m(Gd,"listCacheDelete");var rb=Gd;function Vd(t){var e=this.__data__,n=Mi(e,t);return n<0?void 0:e[n][1]}m(Vd,"listCacheGet");var ib=Vd;function Jd(t){return Mi(this.__data__,t)>-1}m(Jd,"listCacheHas");var ob=Jd;function Yd(t,e){var n=this.__data__,r=Mi(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}m(Yd,"listCacheSet");var sb=Yd;function Hn(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}m(Hn,"ListCache");Hn.prototype.clear=eb;Hn.prototype.delete=rb;Hn.prototype.get=ib;Hn.prototype.has=ob;Hn.prototype.set=sb;var Ni=Hn,ab=Nn(tn,"Map"),$r=ab;function Xd(){this.size=0,this.__data__={hash:new Tc,map:new($r||Ni),string:new Tc}}m(Xd,"mapCacheClear");var lb=Xd;function Qd(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}m(Qd,"isKeyable");var ub=Qd;function ef(t,e){var n=t.__data__;return ub(e)?n[typeof e=="string"?"string":"hash"]:n.map}m(ef,"getMapData");var Di=ef;function tf(t){var e=Di(this,t).delete(t);return this.size-=e?1:0,e}m(tf,"mapCacheDelete");var cb=tf;function nf(t){return Di(this,t).get(t)}m(nf,"mapCacheGet");var db=nf;function rf(t){return Di(this,t).has(t)}m(rf,"mapCacheHas");var fb=rf;function of(t,e){var n=Di(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}m(of,"mapCacheSet");var pb=of;function Un(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}m(Un,"MapCache");Un.prototype.clear=lb;Un.prototype.delete=cb;Un.prototype.get=db;Un.prototype.has=fb;Un.prototype.set=pb;var Hi=Un,gb="Expected a function";function Ui(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(gb);var n=m(function(){var r=arguments,o=e?e.apply(this,r):r[0],s=n.cache;if(s.has(o))return s.get(o);var i=t.apply(this,r);return n.cache=s.set(o,i)||s,i},"memoized");return n.cache=new(Ui.Cache||Hi),n}m(Ui,"memoize");Ui.Cache=Hi;var mb=Ui,yb=500;function sf(t){var e=mb(t,function(r){return n.size===yb&&n.clear(),r}),n=e.cache;return e}m(sf,"memoizeCapped");var hb=sf,Tb=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,vb=/\\(\\)?/g,_b=hb(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Tb,function(n,r,o,s){e.push(o?s.replace(vb,"$1"):r||n)}),e}),bb=_b;function af(t){return t==null?"":yv(t)}m(af,"toString");var wb=af;function lf(t,e){return Xt(t)?t:ps(t,e)?[t]:bb(wb(t))}m(lf,"castPath");var ji=lf,xb=1/0;function uf(t){if(typeof t=="string"||as(t))return t;var e=t+"";return e=="0"&&1/t==-xb?"-0":e}m(uf,"toKey");var zr=uf;function cf(t,e){e=ji(e,t);for(var n=0,r=e.length;t!=null&&n<r;)t=t[zr(e[n++])];return n&&n==r?t:void 0}m(cf,"baseGet");var gs=cf;function df(t,e,n){var r=t==null?void 0:gs(t,e);return r===void 0?n:r}m(df,"get");var Pb=df;function ff(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}m(ff,"arrayPush");var pf=ff,Bb=Md(Object.getPrototypeOf,Object),gf=Bb,Ib="[object Object]",Eb=Function.prototype,Sb=Object.prototype,mf=Eb.toString,kb=Sb.hasOwnProperty,Ab=mf.call(Object);function yf(t){if(!Cn(t)||Rn(t)!=Ib)return!1;var e=gf(t);if(e===null)return!0;var n=kb.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&mf.call(n)==Ab}m(yf,"isPlainObject");var Cb=yf;function hf(){this.__data__=new Ni,this.size=0}m(hf,"stackClear");var Ob=hf;function Tf(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}m(Tf,"stackDelete");var Rb=Tf;function vf(t){return this.__data__.get(t)}m(vf,"stackGet");var Mb=vf;function _f(t){return this.__data__.has(t)}m(_f,"stackHas");var Nb=_f,Db=200;function bf(t,e){var n=this.__data__;if(n instanceof Ni){var r=n.__data__;if(!$r||r.length<Db-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Hi(r)}return n.set(t,e),this.size=n.size,this}m(bf,"stackSet");var Hb=bf;function jn(t){var e=this.__data__=new Ni(t);this.size=e.size}m(jn,"Stack");jn.prototype.clear=Ob;jn.prototype.delete=Rb;jn.prototype.get=Mb;jn.prototype.has=Nb;jn.prototype.set=Hb;var Ti=jn;function wf(t,e){for(var n=-1,r=t==null?0:t.length,o=0,s=[];++n<r;){var i=t[n];e(i,n,t)&&(s[o++]=i)}return s}m(wf,"arrayFilter");var Ub=wf;function xf(){return[]}m(xf,"stubArray");var Pf=xf,jb=Object.prototype,$b=jb.propertyIsEnumerable,vc=Object.getOwnPropertySymbols,Zb=vc?function(t){return t==null?[]:(t=Object(t),Ub(vc(t),function(e){return $b.call(t,e)}))}:Pf,Bf=Zb,Lb=Object.getOwnPropertySymbols,Kb=Lb?function(t){for(var e=[];t;)pf(e,Bf(t)),t=gf(t);return e}:Pf,Wb=Kb;function If(t,e,n){var r=e(t);return Xt(t)?r:pf(r,n(t))}m(If,"baseGetAllKeys");var Ef=If;function Sf(t){return Ef(t,fs,Bf)}m(Sf,"getAllKeys");var _c=Sf;function kf(t){return Ef(t,j_,Wb)}m(kf,"getAllKeysIn");var Fb=kf,zb=Nn(tn,"DataView"),Vo=zb,qb=Nn(tn,"Promise"),Jo=qb,Gb=Nn(tn,"Set"),Yo=Gb,bc="[object Map]",Vb="[object Object]",wc="[object Promise]",xc="[object Set]",Pc="[object WeakMap]",Bc="[object DataView]",Jb=Mn(Vo),Yb=Mn($r),Xb=Mn(Jo),Qb=Mn(Yo),ew=Mn(qo),In=Rn;(Vo&&In(new Vo(new ArrayBuffer(1)))!=Bc||$r&&In(new $r)!=bc||Jo&&In(Jo.resolve())!=wc||Yo&&In(new Yo)!=xc||qo&&In(new qo)!=Pc)&&(In=m(function(t){var e=Rn(t),n=e==Vb?t.constructor:void 0,r=n?Mn(n):"";if(r)switch(r){case Jb:return Bc;case Yb:return bc;case Xb:return wc;case Qb:return xc;case ew:return Pc}return e},"getTag"));var Ic=In,tw=tn.Uint8Array,Ec=tw,nw="__lodash_hash_undefined__";function Af(t){return this.__data__.set(t,nw),this}m(Af,"setCacheAdd");var rw=Af;function Cf(t){return this.__data__.has(t)}m(Cf,"setCacheHas");var iw=Cf;function Zr(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new Hi;++e<n;)this.add(t[e])}m(Zr,"SetCache");Zr.prototype.add=Zr.prototype.push=rw;Zr.prototype.has=iw;var ow=Zr;function Of(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(Of,"arraySome");var sw=Of;function Rf(t,e){return t.has(e)}m(Rf,"cacheHas");var aw=Rf,lw=1,uw=2;function Mf(t,e,n,r,o,s){var i=n&lw,a=t.length,l=e.length;if(a!=l&&!(i&&l>a))return!1;var c=s.get(t),f=s.get(e);if(c&&f)return c==e&&f==t;var g=-1,p=!0,h=n&uw?new ow:void 0;for(s.set(t,e),s.set(e,t);++g<a;){var _=t[g],P=e[g];if(r)var B=i?r(P,_,g,e,t,s):r(_,P,g,t,e,s);if(B!==void 0){if(B)continue;p=!1;break}if(h){if(!sw(e,function(T,E){if(!aw(h,E)&&(_===T||o(_,T,n,r,s)))return h.push(E)})){p=!1;break}}else if(!(_===P||o(_,P,n,r,s))){p=!1;break}}return s.delete(t),s.delete(e),p}m(Mf,"equalArrays");var Nf=Mf;function Df(t){var e=-1,n=Array(t.size);return t.forEach(function(r,o){n[++e]=[o,r]}),n}m(Df,"mapToArray");var cw=Df;function Hf(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}m(Hf,"setToArray");var dw=Hf,fw=1,pw=2,gw="[object Boolean]",mw="[object Date]",yw="[object Error]",hw="[object Map]",Tw="[object Number]",vw="[object RegExp]",_w="[object Set]",bw="[object String]",ww="[object Symbol]",xw="[object ArrayBuffer]",Pw="[object DataView]",Sc=mn?mn.prototype:void 0,Ho=Sc?Sc.valueOf:void 0;function Uf(t,e,n,r,o,s,i){switch(n){case Pw:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case xw:return!(t.byteLength!=e.byteLength||!s(new Ec(t),new Ec(e)));case gw:case mw:case Tw:return cs(+t,+e);case yw:return t.name==e.name&&t.message==e.message;case vw:case bw:return t==e+"";case hw:var a=cw;case _w:var l=r&fw;if(a||(a=dw),t.size!=e.size&&!l)return!1;var c=i.get(t);if(c)return c==e;r|=pw,i.set(t,e);var f=Nf(a(t),a(e),r,o,s,i);return i.delete(t),f;case ww:if(Ho)return Ho.call(t)==Ho.call(e)}return!1}m(Uf,"equalByTag");var Bw=Uf,Iw=1,Ew=Object.prototype,Sw=Ew.hasOwnProperty;function jf(t,e,n,r,o,s){var i=n&Iw,a=_c(t),l=a.length,c=_c(e),f=c.length;if(l!=f&&!i)return!1;for(var g=l;g--;){var p=a[g];if(!(i?p in e:Sw.call(e,p)))return!1}var h=s.get(t),_=s.get(e);if(h&&_)return h==e&&_==t;var P=!0;s.set(t,e),s.set(e,t);for(var B=i;++g<l;){p=a[g];var T=t[p],E=e[p];if(r)var I=i?r(E,T,p,e,t,s):r(T,E,p,t,e,s);if(!(I===void 0?T===E||o(T,E,n,r,s):I)){P=!1;break}B||(B=p=="constructor")}if(P&&!B){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(jf,"equalObjects");var kw=jf,Aw=1,kc="[object Arguments]",Ac="[object Array]",yi="[object Object]",Cw=Object.prototype,Cc=Cw.hasOwnProperty;function $f(t,e,n,r,o,s){var i=Xt(t),a=Xt(e),l=i?Ac:Ic(t),c=a?Ac:Ic(e);l=l==kc?yi:l,c=c==kc?yi:c;var f=l==yi,g=c==yi,p=l==c;if(p&&Go(t)){if(!Go(e))return!1;i=!0,f=!1}if(p&&!f)return s||(s=new Ti),i||Ad(t)?Nf(t,e,n,r,o,s):Bw(t,e,l,n,r,o,s);if(!(n&Aw)){var h=f&&Cc.call(t,"__wrapped__"),_=g&&Cc.call(e,"__wrapped__");if(h||_){var P=h?t.value():t,B=_?e.value():e;return s||(s=new Ti),o(P,B,n,r,s)}}return p?(s||(s=new Ti),kw(t,e,n,r,o,s)):!1}m($f,"baseIsEqualDeep");var Ow=$f;function ms(t,e,n,r,o){return t===e?!0:t==null||e==null||!Cn(t)&&!Cn(e)?t!==t&&e!==e:Ow(t,e,n,r,ms,o)}m(ms,"baseIsEqual");var $i=ms,Rw=1,Mw=2;function Zf(t,e,n,r){var o=n.length,s=o,i=!r;if(t==null)return!s;for(t=Object(t);o--;){var a=n[o];if(i&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++o<s;){a=n[o];var l=a[0],c=t[l],f=a[1];if(i&&a[2]){if(c===void 0&&!(l in t))return!1}else{var g=new Ti;if(r)var p=r(c,f,l,t,e,g);if(!(p===void 0?$i(f,c,Rw|Mw,r,g):p))return!1}}return!0}m(Zf,"baseIsMatch");var Nw=Zf;function Lf(t){return t===t&&!nr(t)}m(Lf,"isStrictComparable");var Kf=Lf;function Wf(t){for(var e=fs(t),n=e.length;n--;){var r=e[n],o=t[r];e[n]=[r,o,Kf(o)]}return e}m(Wf,"getMatchData");var Dw=Wf;function Ff(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}m(Ff,"matchesStrictComparable");var zf=Ff;function qf(t){var e=Dw(t);return e.length==1&&e[0][2]?zf(e[0][0],e[0][1]):function(n){return n===t||Nw(n,t,e)}}m(qf,"baseMatches");var Hw=qf;function Gf(t,e){return t!=null&&e in Object(t)}m(Gf,"baseHasIn");var Uw=Gf;function Vf(t,e,n){e=ji(e,t);for(var r=-1,o=e.length,s=!1;++r<o;){var i=zr(e[r]);if(!(s=t!=null&&n(t,i)))break;t=t[i]}return s||++r!=o?s:(o=t==null?0:t.length,!!o&&ds(o)&&us(i,o)&&(Xt(t)||Pd(t)))}m(Vf,"hasPath");var jw=Vf;function Jf(t,e){return t!=null&&jw(t,e,Uw)}m(Jf,"hasIn");var $w=Jf,Zw=1,Lw=2;function Yf(t,e){return ps(t)&&Kf(e)?zf(zr(t),e):function(n){var r=Pb(n,t);return r===void 0&&r===e?$w(n,t):$i(e,r,Zw|Lw)}}m(Yf,"baseMatchesProperty");var Kw=Yf;function Xf(t){return function(e){return e?.[t]}}m(Xf,"baseProperty");var Ww=Xf;function Qf(t){return function(e){return gs(e,t)}}m(Qf,"basePropertyDeep");var Fw=Qf;function ep(t){return ps(t)?Ww(zr(t)):Fw(t)}m(ep,"property");var zw=ep;function tp(t){return typeof t=="function"?t:t==null?hv:typeof t=="object"?Xt(t)?Kw(t[0],t[1]):Hw(t):zw(t)}m(tp,"baseIteratee");var ys=tp;function np(t){return function(e,n,r){for(var o=-1,s=Object(e),i=r(e),a=i.length;a--;){var l=i[t?a:++o];if(n(s[l],l,s)===!1)break}return e}}m(np,"createBaseFor");var qw=np,Gw=qw(),Vw=Gw;function rp(t,e){return t&&Vw(t,e,fs)}m(rp,"baseForOwn");var Jw=rp;function ip(t,e){return $i(t,e)}m(ip,"isEqual");var gn=ip;function op(t,e,n){n=typeof n=="function"?n:void 0;var r=n?n(t,e):void 0;return r===void 0?$i(t,e,void 0,n):!!r}m(op,"isEqualWith");var Yw=op;function sp(t){return t===void 0}m(sp,"isUndefined");var Oc=sp;function ap(t,e){var n={};return e=ys(e,3),Jw(t,function(r,o,s){pd(n,o,e(r,o,s))}),n}m(ap,"mapValues");var Xw=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(!nr(t))return t;e=ji(e,t);for(var o=-1,s=e.length,i=s-1,a=t;a!=null&&++o<s;){var l=zr(e[o]),c=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return t;if(o!=i){var f=a[l];c=r?r(f,l,a):void 0,c===void 0&&(c=nr(f)?f:us(e[o+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,o=e.length,s={};++r<o;){var i=e[r],a=gs(t,i);n(a,i)&&tx(s,ji(i,t),a)}return s}m(cp,"basePickBy");var nx=cp;function dp(t,e){if(t==null)return{};var n=td(Fb(t),function(r){return[r]});return e=ys(e),nx(t,n,function(r,o){return e(r,o[0])})}m(dp,"pickBy");var rx=dp;function fp(t,e){return rx(t,ex(ys(e)))}m(fp,"omitBy");var Rc=fp,pp=m((t,e)=>gp(t,e,new WeakSet),"isEqual"),Mc=m(t=>Cb(t),"_isPlainObject"),gp=m((t,e,n)=>Yw(t,e,ix(n)),"_isEqualWithVisitedTracking"),ix=m(t=>(e,n)=>{if(Mc(e)&&!t.has(e)&&Mc(n)&&!t.has(n)){let r=Rc(e,Oc),o=Rc(n,Oc);return t.add(r).add(o).add(e).add(n),gp(r,o,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={};Ot(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"),Ct={};Ot(Ct,{assertNever:()=>yp});function yp(t){throw new Error("assertNever called")}m(yp,"assertNever");var At={};Ot(At,{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={};Ot(Tp,{extractPrecisionAndOffset:()=>_p,generateDatetimeRegex:()=>vp});var vp=m(t=>{let e=t.precision?Xo+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+)?",Xo="\\.\\d{",px="}",gx=m(t=>{let e=t.slice(1+bp.length);return e.startsWith(xp)?null:e.startsWith(Xo)?parseInt(e.slice(Xo.length)):0},"_extractPrecision"),Si=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,At.jsonStringifyReplacer)}`;break;case"unrecognized_keys":n=`Unrecognized key(s) in object: ${At.joinValues(t.keys,", ")}`;break;case"invalid_union":n="Invalid input";break;case"invalid_union_discriminator":n=`Invalid discriminator value. Expected ${At.joinValues(t.options)}`;break;case"invalid_enum_value":n=`Invalid enum value. Expected ${At.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}"`:Ct.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,Ct.assertNever(t)}return{message:n}},"errorMap"),ki=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:[]},o=m(s=>{for(let i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let a=r,l=0;for(;l<i.path.length;){let c=i.path[l];l===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(i))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}},"processError");return o(this),r}static assert(e){if(!(e instanceof Pp))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,At.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}};m(ki,"ZodError");ki.create=m(t=>new ki(t),"create");var Yt=ki,mx=Si;function Ai(){return mx}m(Ai,"getErrorMap");var Ne={};function Bp(t){Object.assign(Ne,t)}m(Bp,"setBuilders");var Qo=m(t=>{var e;let{data:n,path:r,errorMaps:o,issueData:s}=t,i=[...r,...s.path||[]],a=M(w({},s),{path:i}),l="",c=o.filter(f=>!!f).slice().reverse();for(let f of c)l=f(a,{data:n,defaultError:l}).message;return M(w({},s),{path:i,message:(e=s.message)!=null?e:l})},"makeIssue");function X(t,e){let n=Qo({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ai(),Si].filter(r=>!!r)});t.common.issues.push(n)}m(X,"addIssueToContext");var Ip=class Ep{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let o of n){if(o.status==="aborted")return{status:"aborted"};o.status==="dirty"&&e.dirty(),r.push(o.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let o of n)r.push({key:await o.key,value:await o.value});return Ep.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let o of n){let{key:s,value:i}=o;if(s.status==="aborted")return{status:"aborted"};if(i.status==="aborted")return{status:"aborted"};s.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(r[s.value]=i.value)}return{status:e.value,value:r}}};m(Ip,"ParseStatus");var _t=Ip,Ci=m(t=>typeof Promise<"u"&&t instanceof Promise,"isAsync"),kn=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"),Sp=class{constructor(e,n,r,o){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};m(Sp,"ParseInputLazyPath");var jt=Sp,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 Uo=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 o=new Yt(n.common.issues);return this._error=o,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 kn(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:kn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new _t,ctx:{common:e.parent.common,data:e.data,parsedType:kn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(Ci(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){var r;let o={common:{issues:[],async:(r=n?.async)!=null?r:!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:kn(e)},s=this._parseSync({data:e,path:o.path,parent:o});return this._handleResult(o,s)}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:kn(e)},o=this._parse({data:e,path:r.path,parent:r}),s=await(Ci(o)?o:Promise.resolve(o));return this._handleResult(r,s)}refine(e,n){let r=m(o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n,"getIssueProperties");return Ne.downstream(this,o=>{let s=e(o),i=[],a=m(()=>i.push(w({code:"custom"},r(o))),"setError");return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?{status:"valid",value:o}:(a(),{status:"dirty",value:o,issues:i})):s?{status:"valid",value:o}:(a(),{status:"dirty",value:o,issues:i})})}superRefine(e){return Ne.downstream(this,(n,r)=>{let o=[],s=e(n,{addIssue:i=>o.push(i),path:r.path});return typeof Promise<"u"&&s instanceof Promise?s.then(()=>o.some(i=>i.fatal)?{status:"aborted",issues:o}:o.length?{status:"dirty",value:n,issues:o}:{status:"valid",value:n}):o.some(i=>i.fatal)?{status:"aborted",issues:o}:o.length?{status:"dirty",value:n,issues:o}:{status:"valid",value:n}})}downstream(e,n){return Ne.downstream(this,e,n)}optional(){return Ne.optional(this,this._def)}nullable(){return Ne.nullable(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ne.array(this,this._def)}promise(){return Ne.promise(this,this._def)}mandatory(){return this}or(e){return Ne.union([this,e])}and(e){return Ne.intersection(this,e)}transform(e){return Ne.downstream(this,(n,r)=>{let o=[],s=e(n,{addIssue:i=>o.push(i),path:r.path});return s instanceof Promise?s.then(i=>o.some(a=>a.fatal)?{status:"aborted",issues:o}:o.length?{status:"dirty",value:i,issues:o}:{status:"valid",value:i}):o.some(i=>i.fatal)?{status:"aborted",issues:o}:o.length?{status:"dirty",value:s,issues:o}:{status:"valid",value:s}},{failFast:!0})}default(e){let n=typeof e=="function"?e:()=>e;return Ne.default(this,n)}brand(){return Ne.branded(this)}catch(e){return Ne.catch(this,e)}describe(e){let n=this.clone();return n._metadataRoot._def.description=e,n}pipe(e){return Ne.pipeline(this,e)}readonly(){return Ne.readonly(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}metadata(e){var n,r,o;let s=this.clone(),i=s._metadataRoot;(o=(n=i._def)[r=ke])!=null||(n[r]={});for(let[a,l]of Object.entries(e))i._def[ke]=M(w({},i._def[ke]),{[a]:l});return s}getMetadata(){return w({},this._metadataRoot._def[ke])}setMetadata(e){this._metadataRoot._def[ke]=w({},e)}get ui(){return w({},this._metadataRoot._def[ke])}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(){throw new Uo("toJSONSchema")}toTypescriptType(e){throw new Uo("toTypescriptType")}toTypescriptSchema(){throw new Uo("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,o,s,i,a;return e instanceof En?gn((n=this._def.exactLength)==null?void 0:n.value,(r=e._def.exactLength)==null?void 0:r.value)&&gn((o=this._def.maxLength)==null?void 0:o.value,(s=e._def.maxLength)==null?void 0:s.value)&&gn((i=this._def.minLength)==null?void 0:i.value,(a=e._def.minLength)==null?void 0:a.value)&&this._def.type.isEqual(e._def.type):!1}_parse(e){let{ctx:n,status:r}=this._processInputParams(e),o=this._def;if(n.parsedType!=="array")return X(n,{code:"invalid_type",expected:"array",received:n.parsedType}),{status:"aborted"};if(o.exactLength!==null){let i=n.data.length>o.exactLength.value,a=n.data.length<o.exactLength.value;(i||a)&&(X(n,{code:i?"too_big":"too_small",minimum:a?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(X(n,{code:"too_small",minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(X(n,{code:"too_big",maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,a)=>o.type._parseAsync(new jt(n,i,n.path,a)))).then(i=>_t.mergeArray(r,i));let s=[...n.data].map((i,a)=>o.type._parseSync(new jt(n,i,n.path,a)));return _t.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 vi 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 X(s,{code:"invalid_type",expected:"bigint",received:s.parsedType}),{status:"aborted"}}let r,o=new _t;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),X(r,{code:"too_small",type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),X(r,{code:"too_big",type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),X(r,{code:"not_multiple_of",multipleOf:s.value,message:s.message}),o.dirty()):Ct.assertNever(s);return{status:o.value,value:e.data}}isEqual(e){if(!(e instanceof vi)||this._def.coerce!==e._def.coerce)return!1;let n=new Ve.CustomSet(this._def.checks),r=new Ve.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,o){return new vi(M(w({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ae.toString(o)}]}))}_addCheck(e){return new vi(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 X(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 Pr extends pe{dereference(e){return new Pr(M(w({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new Pr(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 Pr?this._def.type.isEqual(e._def.type):!1}naked(){return this._def.type.naked()}mandatory(){return new Pr(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:[]})}),o=this._def.innerType._parse({data:r.data,path:r.path,parent:w({},r)});return Ci(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Yt(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Yt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}isEqual(e){return e instanceof Br?this._def.innerType.isEqual(e._def.innerType)&&At.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 es extends pe{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!=="date"){let s=this._getOrReturnCtx(e);return X(s,{code:"invalid_type",expected:"date",received:s.parsedType}),{status:"aborted"}}if(isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return X(s,{code:"invalid_date"}),{status:"aborted"}}let r=new _t,o;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(o=this._getOrReturnCtx(e,o),X(o,{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&&(o=this._getOrReturnCtx(e,o),X(o,{code:"too_big",message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):Ct.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new es(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 es))return!1;let n=new Ve.CustomSet(this._def.checks),r=new Ve.CustomSet(e._def.checks);return n.isEqual(r)&&this._def.coerce===e._def.coerce}};m(jp,"ZodDateImpl");var wx=jp,$p=class Ir 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 Ir(M(w({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Ir(M(w({},this._def),{innerType:this._def.innerType.clone()}))}isEqual(e){return e instanceof Ir?this._def.innerType.isEqual(e._def.innerType)&&gn(this._def.defaultValue(),e._def.defaultValue()):!1}unwrap(){return this._def.innerType}naked(){return this._def.innerType.naked()}mandatory(){return new Ir(M(w({},this._def),{innerType:this._def.innerType.mandatory()}))}};m($p,"ZodDefaultImpl");var xx=$p,Jt=m(t=>{let e=t;return e?e.typeName==="ZodLazy"?Jt(e.schema):e.typeName==="ZodEffects"?Jt(e.innerType()):e.typeName==="ZodLiteral"?[e.value]:e.typeName==="ZodEnum"?e.options:e.typeName==="ZodNativeEnum"?Object.values(e.enum):e.typeName==="ZodDefault"?Jt(e._def.innerType):e.typeName==="ZodUndefined"?[void 0]:e.typeName==="ZodNull"?[null]:e.typeName==="ZodOptional"?[void 0,...Jt(e.unwrap())]:e.typeName==="ZodNullable"?[null,...Jt(e.unwrap())]:e.typeName==="ZodBranded"||e.typeName==="ZodReadonly"?Jt(e.unwrap()):e.typeName==="ZodCatch"?Jt(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 $t.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 X(n,{code:"invalid_type",expected:"object",received:n.parsedType}),{status:"aborted"};let r=this.discriminator,o=n.data[r],s=this.optionsMap.get(o);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(X(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 o of n){let s=Jt(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of s){if(r.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);r.set(i,o)}}return r}isEqual(e){if(!(e instanceof Er)||this._def.discriminator!==e._def.discriminator)return!1;let n=m((s,i)=>s.isEqual(i),"compare"),r=new Ve.CustomSet(this._def.options,{compare:n}),o=new Ve.CustomSet(e._def.options,{compare:n});return r.isEqual(o)}};m(Zp,"ZodDiscriminatedUnionImpl");var Px=Zp,Lp=class Kp extends pe{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return X(n,{expected:At.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 X(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 Ne.enum(e,w(w({},this._def),n))}exclude(e,n=this._def){return Ne.enum(this.options.filter(r=>!e.includes(r)),w(w({},this._def),n))}isEqual(e){if(!(e instanceof Kp))return!1;let n=new Ve.CustomSet(this._def.values),r=new Ve.CustomSet(e._def.values);return n.isEqual(r)}};m(Lp,"ZodEnumImpl");var Bx=Lp,Wp=class Xn 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 Xn(M(w({},this._def),{args:n,returns:r}))}getReferences(){return $t.unique([...this._def.args.getReferences(),...this._def.returns.getReferences()])}clone(){return new Xn(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 X(n,{code:"invalid_type",expected:"function",received:n.parsedType}),{status:"aborted"};function r(c,f){return Qo({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Ai(),Si].filter(g=>!!g),issueData:{code:"invalid_arguments",argumentsError:f}})}m(r,"makeArgsIssue");function o(c,f){return Qo({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Ai(),Si].filter(g=>!!g),issueData:{code:"invalid_return_type",returnTypeError:f}})}m(o,"makeReturnsIssue");let s={errorMap:n.common.contextualErrorMap},i=n.data,a=this,l=this._def.returns;return et.zuiPromise(l)?{status:"valid",async value(...c){let f=new Yt([]),g=await a._def.args.parseAsync(c,s).catch(_=>{throw f.addIssue(r(c,_)),f}),p=await Reflect.apply(i,this,g);return await l._def.type.parseAsync(p,s).catch(_=>{throw et.zuiError(_)?(f.addIssue(o(p,_)),f):_})}}:{status:"valid",value(...c){let f=a._def.args.safeParse(c,s);if(!f.success)throw new Yt([r(c,f.error)]);let g=Reflect.apply(i,this,f.data),p=a._def.returns.safeParse(g,s);if(!p.success)throw new Yt([o(g,p.error)]);return p.data}}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Xn(M(w({},this._def),{args:Ne.tuple(e).rest(Ne.unknown())}))}returns(e){return new Xn(M(w({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}isEqual(e){return e instanceof Xn&&this._def.args.isEqual(e._def.args)&&this._def.returns.isEqual(e._def.returns)}};m(Wp,"ZodFunctionImpl");var Ix=Wp,Fp=class _i extends pe{dereference(e){return new _i(M(w({},this._def),{left:this._def.left.dereference(e),right:this._def.right.dereference(e)}))}getReferences(){return $t.unique([...this._def.left.getReferences(),...this._def.right.getReferences()])}clone(){return new _i(M(w({},this._def),{left:this._def.left.clone(),right:this._def.right.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),o=m((s,i)=>{if(s.status==="aborted"||i.status==="aborted")return{status:"aborted"};let a=this._mergeValues(s.value,i.value);return a.valid?((s.status==="dirty"||i.status==="dirty")&&n.dirty(),{status:n.value,value:a.data}):(X(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,i])=>o(s,i)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}isEqual(e){if(!(e instanceof _i))return!1;let n=m((s,i)=>s.isEqual(i),"compare"),r=new Ve.CustomSet([this._def.left,this._def.right],{compare:n}),o=new Ve.CustomSet([e._def.left,e._def.right],{compare:n});return r.isEqual(o)}_mergeValues(e,n){let r=kn(e),o=kn(n);if(e===n)return{valid:!0,data:e};if(r==="object"&&o==="object"){let s=Object.keys(n),i=Object.keys(e).filter(l=>s.indexOf(l)!==-1),a=w(w({},e),n);for(let l of i){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"&&o==="array"){if(e.length!==n.length)return{valid:!1};let s=[];for(let i=0;i<e.length;i++){let a=e[i],l=n[i],c=this._mergeValues(a,l);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return r==="date"&&o==="date"&&+e==+n?{valid:!0,data:e}:{valid:!1}}};m(Fp,"ZodIntersectionImpl");var Ex=Fp,zp=class Sr extends pe{get schema(){return this._def.getter()}dereference(e){return new Sr(M(w({},this._def),{getter:()=>this._def.getter().dereference(e)}))}getReferences(){return this._def.getter().getReferences()}clone(){return new Sr(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 Sr?this._def.getter().isEqual(e._def.getter()):!1}naked(){return this._def.getter().naked()}mandatory(){return new Sr(M(w({},this._def),{getter:()=>this._def.getter().mandatory()}))}};m(zp,"ZodLazyImpl");var Sx=zp,qp=class Gp extends pe{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return X(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?gn(this._def.value,e._def.value):!1}};m(qp,"ZodLiteralImpl");var kx=qp,Vp=class bi 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 bi(M(w({},this._def),{keyType:n,valueType:r}))}getReferences(){return $t.unique([...this._def.keyType.getReferences(),...this._def.valueType.getReferences()])}clone(){return new bi(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 X(r,{code:"invalid_type",expected:"map",received:r.parsedType}),{status:"aborted"};let o=this._def.keyType,s=this._def.valueType,i=[...r.data.entries()].map(([a,l],c)=>({key:o._parse(new jt(r,a,r.path,[c,"key"])),value:s._parse(new jt(r,l,r.path,[c,"value"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let l of i){let c=await l.key,f=await l.value;if(c.status==="aborted"||f.status==="aborted")return{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 i){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 bi)||!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 X(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(o=>typeof e[e[o]]!="number"),r={};for(let o of n)r[o]=e[o];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 o=Object.values(n);return X(r,{expected:At.joinValues(o),received:r.parsedType,code:"invalid_type"}),{status:"aborted"}}if(n.indexOf(e.data)===-1){let o=Object.values(n);return X(r,{received:r.data,code:"invalid_enum_value",options:o}),{status:"aborted"}}return{status:"valid",value:e.data}}get enum(){return this._def.values}isEqual(e){return e instanceof Qp?gn(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 X(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 X(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 kr extends pe{dereference(e){return new kr(M(w({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new kr(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 kr?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return new kr(M(w({},this._def),{innerType:this._def.innerType.mandatory()}))}};m(ig,"ZodNullableImpl");var Nx=ig,og=class wi 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 X(s,{code:"invalid_type",expected:"number",received:s.parsedType}),{status:"aborted"}}let r,o=new _t;for(let s of this._def.checks)s.kind==="int"?Number.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),X(r,{code:"invalid_type",expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),X(r,{code:"too_small",minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),X(r,{code:"too_big",maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?this._floatSafeRemainder(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),X(r,{code:"not_multiple_of",multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),X(r,{code:"not_finite",message:s.message}),o.dirty()):Ct.assertNever(s);return{status:o.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,o){return new wi(M(w({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ae.toString(o)}]}))}_addCheck(e){return new wi(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 wi))return!1;let n=new Ve.CustomSet(this._def.checks),r=new Ve.CustomSet(e._def.checks);return n.isEqual(r)}_floatSafeRemainder(e,n){let r=(e.toString().split(".")[1]||"").length,o=(n.toString().split(".")[1]||"").length,s=r>o?r:o,i=parseInt(e.toFixed(s).replace(".","")),a=parseInt(n.toFixed(s).replace(".",""));return i%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 o in n)r[o]=n[o].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 $t.unique(n)}clone(){let e={},n=this._def.shape();for(let[o,s]of Object.entries(n))e[o]=s.clone();return new gt(M(w({},this._def),{shape:()=>e}))}_parse(e){if(this._getType(e)!=="object"){let f=this._getOrReturnCtx(e);return X(f,{code:"invalid_type",expected:"object",received:f.parsedType}),{status:"aborted"}}let{status:r,ctx:o}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),a=[];if(this._def.unknownKeys!=="strip")for(let f in o.data)i.includes(f)||a.push(f);let l=[];for(let f of i){let g=s[f],p=o.data[f];l.push({key:{status:"valid",value:f},value:g._parse(new jt(o,p,o.path,f)),alwaysSet:f in o.data})}let c=this._def.unknownKeys;if(c==="passthrough")for(let f of a)l.push({key:{status:"valid",value:f},value:{status:"valid",value:o.data[f]}});else if(c==="strict")a.length>0&&(X(o,{code:"unrecognized_keys",keys:a}),r.dirty());else if(c!=="strip")for(let f of a){let g=o.data[f];l.push({key:{status:"valid",value:f},value:c._parse(new jt(o,g,o.path,f)),alwaysSet:f in o.data})}return o.common.async?Promise.resolve().then(async()=>{let f=[];for(let g of l){let p=await g.key;f.push({key:p,value:await g.value,alwaysSet:g.alwaysSet})}return f}).then(f=>_t.mergeObjectSync(r,f)):_t.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 o,s,i,a;let l=(i=(s=(o=this._def).errorMap)==null?void 0:s.call(o,n,r).message)!=null?i:r.defaultError;return n.code==="unrecognized_keys"?{message:(a=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 Ne.any();if(this._def.unknownKeys==="strict")return Ne.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(o=>{e[o]&&this.shape[o]&&(n[o]=this.shape[o])}),new gt(M(w({},this._def),{shape:()=>n}))}omit(e){let n={};return Object.entries(this.shape).forEach(([o,s])=>{e[o]||(n[o]=s)}),new gt(M(w({},this._def),{shape:()=>n}))}partial(e){let n={};return Object.keys(this.shape).forEach(o=>{let s=this.shape[o];e&&!e[o]?n[o]=s:n[o]=s?.optional()}),new gt(M(w({},this._def),{shape:()=>n}))}required(e){let n={};return Object.entries(this.shape).forEach(([r,o])=>{if(e&&!e[r])n[r]=o;else{let i=o;for(;et.zuiOptional(i);)i=i._def.innerType;n[r]=i}}),new gt(M(w({},this._def),{shape:()=>n}))}keyof(){let e=Object.keys(this.shape);return Ne.enum(e)}isEqual(e){if(!(e instanceof gt)||!this._unknownKeysEqual(e))return!1;let n=this._def.shape(),r=e._def.shape(),o=m((a,l)=>a[0]===l[0]&&a[1].isEqual(l[1]),"compare"),s=new Ve.CustomSet(Object.entries(n),{compare:o}),i=new Ve.CustomSet(Object.entries(r),{compare:o});return s.isEqual(i)}_unknownKeysEqual(e){let n=this.additionalProperties(),r=e.additionalProperties();return n===void 0||r===void 0?n===r:n.isEqual(r)}};m(sg,"ZodObjectImpl");var ag=sg,lg=class xi extends pe{dereference(e){return new xi(M(w({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new xi(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 xi?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 Pi extends pe{dereference(e){return new Pi(M(w({},this._def),{in:this._def.in.dereference(e),out:this._def.out.dereference(e)}))}getReferences(){return $t.unique([...this._def.in.getReferences(),...this._def.out.getReferences()])}clone(){return new Pi(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 o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?{status:"aborted"}:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}isEqual(e){return!(!(e instanceof Pi)||!this._def.in.isEqual(e._def.in)||!this._def.out.isEqual(e._def.out))}};m(ug,"ZodPipelineImpl");var Ux=ug,cg=class Bi extends pe{unwrap(){return this._def.type}dereference(e){return new Bi(M(w({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new Bi(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?(X(n,{code:"invalid_type",expected:"promise",received:n.parsedType}),{status:"aborted"}):{status:"valid",value:(n.parsedType==="promise"?n.data:Promise.resolve(n.data)).then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap}))}}isEqual(e){return e instanceof Bi?this._def.type.isEqual(e._def.type):!1}naked(){return this._def.type.naked()}};m(cg,"ZodPromiseImpl");var jx=cg,dg=class Ar 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 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){let n=this._def.innerType._parse(e);return Ci(n)?n.then(this._freeze):this._freeze(n)}unwrap(){return this._def.innerType}isEqual(e){return e instanceof Ar?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return new Ar(M(w({},this._def),{innerType:this._def.innerType.mandatory()}))}};m(dg,"ZodReadonlyImpl");var $x=dg,fg=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 $t.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!=="object")return X(r,{code:"invalid_type",expected:"object",received:r.parsedType}),{status:"aborted"};let o=[],s=this._def.keyType,i=this._def.valueType;for(let a in r.data)o.push({key:s._parse(new jt(r,a,r.path,a)),value:i._parse(new jt(r,r.data[a],r.path,a))});return r.common.async?_t.mergeObjectAsync(n,o):_t.mergeObjectSync(n,o)}get element(){return this._def.valueType}isEqual(e){return!(!(e instanceof Ii)||!this._def.keyType.isEqual(e._def.keyType)||!this._def.valueType.isEqual(e._def.valueType))}};m(fg,"ZodRecordImpl");var Nc=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 X(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 Qn extends pe{dereference(e){return new Qn(M(w({},this._def),{valueType:this._def.valueType.dereference(e)}))}getReferences(){return this._def.valueType.getReferences()}clone(){return new Qn(M(w({},this._def),{valueType:this._def.valueType.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!=="set")return X(r,{code:"invalid_type",expected:"set",received:r.parsedType}),{status:"aborted"};let o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(X(r,{code:"too_small",minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(X(r,{code:"too_big",maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());let s=this._def.valueType;function i(l){let c=new Set;for(let f of l){if(f.status==="aborted")return{status:"aborted"};f.status==="dirty"&&n.dirty(),c.add(f.value)}return{status:n.value,value:c}}m(i,"finalizeSet");let a=[...r.data.values()].map((l,c)=>s._parse(new jt(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>i(l)):i(a)}min(e,n){return new Qn(M(w({},this._def),{minSize:{value:e,message:ae.toString(n)}}))}max(e,n){return new Qn(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,o,s;if(!(e instanceof Qn))return!1;let i=(n=this._def.minSize)==null?void 0:n.value,a=(r=e._def.minSize)==null?void 0:r.value;if(i!==a)return!1;let l=(o=this._def.maxSize)==null?void 0:o.value,c=(s=e._def.maxSize)==null?void 0:s.value;return l!==c?!1:this._def.valueType.isEqual(e._def.valueType)}};m(mg,"ZodSetImpl");var Lx=mg,Kx=/^c[^\s-]{8,}$/i,Wx=/^[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})+$",jo,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 er extends pe{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!=="string"){let s=this._getOrReturnCtx(e);return X(s,{code:"invalid_type",expected:"string",received:s.parsedType}),{status:"aborted"}}let r=new _t,o;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(o=this._getOrReturnCtx(e,o),X(o,{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&&(o=this._getOrReturnCtx(e,o),X(o,{code:"too_big",maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){let i=e.data.length>s.value,a=e.data.length<s.value;(i||a)&&(o=this._getOrReturnCtx(e,o),i?X(o,{code:"too_big",maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&X(o,{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)||(o=this._getOrReturnCtx(e,o),X(o,{validation:"email",code:"invalid_string",message:s.message}),r.dirty());else if(s.kind==="emoji")jo||(jo=new RegExp(Gx,"u")),jo.test(e.data)||(o=this._getOrReturnCtx(e,o),X(o,{validation:"emoji",code:"invalid_string",message:s.message}),r.dirty());else if(s.kind==="uuid")zx.test(e.data)||(o=this._getOrReturnCtx(e,o),X(o,{validation:"uuid",code:"invalid_string",message:s.message}),r.dirty());else if(s.kind==="cuid")Kx.test(e.data)||(o=this._getOrReturnCtx(e,o),X(o,{validation:"cuid",code:"invalid_string",message:s.message}),r.dirty());else if(s.kind==="cuid2")Wx.test(e.data)||(o=this._getOrReturnCtx(e,o),X(o,{validation:"cuid2",code:"invalid_string",message:s.message}),r.dirty());else if(s.kind==="ulid")Fx.test(e.data)||(o=this._getOrReturnCtx(e,o),X(o,{validation:"ulid",code:"invalid_string",message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),X(o,{validation:"url",code:"invalid_string",message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),X(o,{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)||(o=this._getOrReturnCtx(e,o),X(o,{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)||(o=this._getOrReturnCtx(e,o),X(o,{code:"invalid_string",validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(o=this._getOrReturnCtx(e,o),X(o,{code:"invalid_string",validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?Tp.generateDatetimeRegex(s).test(e.data)||(o=this._getOrReturnCtx(e,o),X(o,{code:"invalid_string",validation:"datetime",message:s.message}),r.dirty()):s.kind==="ip"?yg(e.data,s.version)||(o=this._getOrReturnCtx(e,o),X(o,{validation:"ip",code:"invalid_string",message:s.message}),r.dirty()):Ct.assertNever(s);return{status:r.value,value:e.data}}_addCheck(e){return new er(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 er(M(w({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}secret(){return this._def[ke]=M(w({},this._def[ke]),{secret:!0}),this}toLowerCase(){return new er(M(w({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new er(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 er))return!1;let n=new Ve.CustomSet(this._def.checks),r=new Ve.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 X(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 Cr extends pe{innerType(){return this._def.schema}sourceType(){return et.zuiEffects(this._def.schema)?this._def.schema.sourceType():this._def.schema}dereference(e){return new Cr(M(w({},this._def),{schema:this._def.schema.dereference(e)}))}getReferences(){return this._def.schema.getReferences()}clone(){return new Cr(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 o=r.effect(n.data,{path:n.path});if(n.common.async)return Promise.resolve(o).then(async s=>{if(s??(s={status:"valid",value:n.data}),this._processResult(n,s),s.status==="aborted")return{status:"aborted"};let i=await this._def.schema._parseAsync({data:s.value,path:n.path,parent:n});return i.status==="aborted"?{status:"aborted"}:i.status==="dirty"?{status:"dirty",value:i.value}:s.status==="dirty"?{status:"dirty",value:i.value}:i});{if(o instanceof Promise)throw new Error("Asynchronous upstream transform encountered during synchronous parse operation. Use .parseAsync instead.");if(o??(o={status:"valid",value:n.data}),this._processResult(n,o),o.status==="aborted")return{status:"aborted"};let s=this._def.schema._parseSync({data:o.value,path:n.path,parent:n});return s.status==="aborted"?{status:"aborted"}:s.status==="dirty"?{status:"dirty",value:s.value}:o.status==="dirty"?{status:"dirty",value:s.value}:s}}if(r.type==="downstream")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(o.status==="aborted"||o.status==="dirty"&&r.failFast)return o;let s=r.effect(o.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:o.value}),this._processResult(n,s),s.status==="aborted"?{status:"aborted"}:s.status==="dirty"?{status:"dirty",value:s.value}:o.status==="dirty"?{status:"dirty",value:s.value}:s}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"||o.status==="dirty"&&r.failFast?o:Promise.resolve(r.effect(o.value,{path:n.path})).then(s=>(s??(s={status:"valid",value:o.value}),this._processResult(n,s),s.status==="aborted"?{status:"aborted"}:s.status==="dirty"?{status:"dirty",value:s.value}:o.status==="dirty"?{status:"dirty",value:s.value}:s)));Ct.assertNever(r)}_processResult(e,n){if(n.status!=="valid")for(let r of n.issues)X(e,r)}isEqual(e){return!(e instanceof Cr)||!this._def.schema.isEqual(e._def.schema)?!1:this._def.effect.type==="upstream"?e._def.effect.type!=="upstream"?!1:At.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:At.compareFunctions(this._def.effect.effect,e._def.effect.effect):(this._def.effect,!1)}naked(){return this._def.schema.naked()}mandatory(){return new Cr(M(w({},this._def),{schema:this._def.schema.mandatory()}))}};m(_g,"ZodEffectsImpl");var hs=_g,bg=class Or extends pe{dereference(e){let n=this._def.items.map(o=>o.dereference(e)),r=this._def.rest?this._def.rest.dereference(e):null;return new Or(M(w({},this._def),{items:n,rest:r}))}getReferences(){return $t.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 Or(M(w({},this._def),{items:e,rest:n}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!=="array")return X(r,{code:"invalid_type",expected:"array",received:r.parsedType}),{status:"aborted"};if(r.data.length<this._def.items.length)return X(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&&(X(r,{code:"too_big",maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let s=[...r.data].map((i,a)=>{let l=this._def.items[a]||this._def.rest;return l?l._parse(new jt(r,i,r.path,a)):null}).filter(i=>!!i);return r.common.async?Promise.all(s).then(i=>_t.mergeArray(n,i)):_t.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new Or(M(w({},this._def),{rest:e}))}isEqual(e){if(!(e instanceof Or)||!this._restEquals(e))return!1;let n=m((s,i)=>s.isEqual(i),"compare"),r=new Ve.CustomSet(this._def.items,{compare:n}),o=new Ve.CustomSet(e._def.items,{compare:n});return r.isEqual(o)}_restEquals(e){return this._def.rest===null?e._def.rest===null:e._def.rest!==null&&this._def.rest.isEqual(e._def.rest)}};m(bg,"ZodTupleImpl");var Qx=bg,wg=class xg extends pe{_parse(e){if(this._getType(e)!=="undefined"){let r=this._getOrReturnCtx(e);return X(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 Ne.never(w({},this._def))}};m(wg,"ZodUndefinedImpl");var eP=wg,Pg=class Rr extends pe{dereference(e){let n=this._def.options.map(r=>r.dereference(e));return new Rr(M(w({},this._def),{options:n}))}getReferences(){return $t.unique(this._def.options.reduce((e,n)=>[...e,...n.getReferences()],[]))}clone(){let e=this._def.options.map(n=>n.clone());return new Rr(M(w({},this._def),{options:e}))}_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function o(s){for(let a of s)if(a.result.status==="valid")return a.result;for(let a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;let i=s.map(a=>new Yt(a.ctx.common.issues));return X(n,{code:"invalid_union",unionErrors:i}),{status:"aborted"}}if(m(o,"handleResults"),n.common.async)return Promise.all(r.map(async s=>{let i=M(w({},n),{common:M(w({},n.common),{issues:[]}),parent:null});return{result:await s._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(o);{let s,i=[];for(let l of r){let c=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&&i.push(c.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(l=>new Yt(l));return X(n,{code:"invalid_union",unionErrors:a}),{status:"aborted"}}}get options(){return this._def.options}isEqual(e){if(!(e instanceof Rr))return!1;let n=m((s,i)=>s.isEqual(i),"compare"),r=new Ve.CustomSet([...this._def.options],{compare:n}),o=new Ve.CustomSet([...e._def.options],{compare:n});return r.isEqual(o)}mandatory(){let e=this._def.options.filter(s=>!et.zuiUndefined(s)).map(s=>s.mandatory()),[n,r,...o]=e;return n?r?new Rr(M(w({},this._def),{options:[n,r,...o]})):n:Ne.never(w({},this._def))}};m(Pg,"ZodUnionImpl");var tP=Pg,Bg=class Ig extends pe{constructor(){super(...arguments),this._unknown=!0}_parse(e){return{status:"valid",value:e.data}}isEqual(e){return e instanceof Ig}};m(Bg,"ZodUnknownImpl");var nP=Bg,Eg=class Sg extends pe{_parse(e){if(this._getType(e)!=="undefined"){let r=this._getOrReturnCtx(e);return X(r,{code:"invalid_type",expected:"void",received:r.parsedType}),{status:"aborted"}}return{status:"valid",value:e.data}}isEqual(e){return e instanceof Sg}};m(Eg,"ZodVoidImpl");var rP=Eg,iP=m(t=>t instanceof Error,"_isError"),oP=m(t=>typeof t=="object"&&t!==null,"_isObject"),et={zuiError:t=>t instanceof Yt||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:o,supportsExtensions:s,[ke]:i}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);let a=i?Object.fromEntries(Object.entries(i).filter(([c])=>c!=="secret"||s?.includes("secret"))):void 0;return e?{errorMap:e,description:o,[ke]: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:o,[ke]:a}},"_processCreateParams"),Zi=m((t,e={},n)=>t?On().downstream(r=>{var o,s;if(!t(r)){let i=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e;return((s=(o=i.fatal)!=null?o:n)!=null?s:!0)?Us(w({code:"custom"},i)):js(r,w({code:"custom"},i))}}):On(),"customType"),Ts=m((t,e={message:`Input not instance of ${t.name}`})=>Zi(n=>n instanceof t,e),"instanceOfType"),On=m(t=>new yx(w({typeName:"ZodAny"},ye(t))),"anyType"),yn=m(t=>new nP(w({typeName:"ZodUnknown"},ye(t))),"unknownType"),Lr=m(t=>new Rx(w({typeName:"ZodNever"},ye(t))),"neverType"),vs=m(t=>new rP(w({typeName:"ZodVoid"},ye(t))),"voidType"),qr=m(t=>new Mx(w({typeName:"ZodNull"},ye(t))),"nullType"),Li=m(t=>new eP(w({typeName:"ZodUndefined"},ye(t))),"undefinedType"),_s=m(t=>new Xx(w({typeName:"ZodSymbol"},ye(t))),"symbolType"),bs=m(t=>new Cx(w({typeName:"ZodNaN"},ye(t))),"nanType"),Qt=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"),$n=m(t=>new Dx(w({checks:[],typeName:"ZodNumber",coerce:t?.coerce||!1},ye(t))),"numberType"),Zn=m(t=>new vx(w({typeName:"ZodBoolean",coerce:t?.coerce||!1},ye(t))),"booleanType"),Ki=m(t=>{var e;return new Tx(w({checks:[],typeName:"ZodBigInt",coerce:(e=t?.coerce)!=null?e:!1},ye(t)))},"bigIntType"),Wi=m(t=>new wx(w({checks:[],coerce:t?.coerce||!1,typeName:"ZodDate"},ye(t))),"dateType"),Fi=m(t=>new Zx({typeName:"ZodRef",uri:t}),"refType"),Kr=m((t,e)=>new kx(w({value:t,typeName:"ZodLiteral"},ye(e))),"literalType"),zi=m((t,e)=>new Bx(w({values:t,typeName:"ZodEnum"},ye(e))),"enumType"),ws=m((t,e)=>new Ox(w({values:t,typeName:"ZodNativeEnum"},ye(e))),"nativeEnumType"),An=m((t,e)=>new hx(w({type:t,minLength:null,maxLength:null,exactLength:null,typeName:"ZodArray"},ye(e))),"arrayType"),rr=m((t,e)=>new ag(w({shape:()=>t,unknownKeys:"strip",typeName:"ZodObject"},ye(e))),"objectType"),xs=m((t,e)=>new ag(w({shape:()=>t,unknownKeys:"strict",typeName:"ZodObject"},ye(e))),"strictObjectType"),ir=m((t,e)=>new tP(w({options:t,typeName:"ZodUnion"},ye(e))),"unionType"),qi=m((t,e,n)=>new Px(w({typeName:"ZodDiscriminatedUnion",discriminator:t,options:e},ye(n))),"discriminatedUnionType"),Gi=m((t,e,n)=>new Ex(w({left:t,right:e,typeName:"ZodIntersection"},ye(n))),"intersectionType"),Gr=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"),Wr=m((t,e,n)=>e instanceof pe?new Nc(w({keyType:t,valueType:e,typeName:"ZodRecord"},ye(n))):new Nc(w({keyType:Qt(),valueType:t,typeName:"ZodRecord"},ye(e))),"recordType"),Ps=m((t,e,n)=>new Ax(w({valueType:e,keyType:t,typeName:"ZodMap"},ye(n))),"mapType"),Vi=m((t,e)=>new Lx(w({valueType:t,minSize:null,maxSize:null,typeName:"ZodSet"},ye(e))),"setType"),Bs=m((t,e)=>new Sx(w({getter:t,typeName:"ZodLazy"},ye(e))),"lazyType"),Is=m((t,e)=>new jx(w({type:t,typeName:"ZodPromise"},ye(e))),"promiseType"),Es=m((t,e,n)=>new Ix(w({args:t||Gr([]).rest(yn()),returns:e||yn(),typeName:"ZodFunction"},ye(n))),"functionType"),Ss=m((t,e,n)=>new hs(w({schema:e,effect:{type:"upstream",effect:(r,o)=>{let s=t(r,o);return s instanceof Promise?s.then(i=>Oi(i)):Oi(s)}},typeName:"ZodEffects"},ye(n))),"preprocessType"),ks=m((t,e,n)=>new hs(w({schema:e,effect:{type:"upstream",effect:t},typeName:"ZodEffects"},ye(n))),"upstreamType"),As=m((t,e,n)=>new hs(w({schema:t,effect:{type:"downstream",effect:e,failFast:n?.failFast},typeName:"ZodEffects"},ye(n))),"downstreamType"),Cs=m((t,e)=>new Hx(w({innerType:t,typeName:"ZodOptional"},ye(e))),"optionalType"),Os=m((t,e)=>new Nx(w({innerType:t,typeName:"ZodNullable"},ye(e))),"nullableType"),Rs=m((t,e)=>new $x(w({innerType:t,typeName:"ZodReadonly"},ye(e))),"readonlyType"),Ms=m((t,e,n)=>new xx(w({innerType:t,typeName:"ZodDefault",defaultValue:typeof e=="function"?e:()=>e},ye(n))),"defaultType"),Ns=m((t,e,n)=>new bx(w({innerType:t,typeName:"ZodCatch",catchValue:typeof e=="function"?e:()=>e},ye(n))),"catchType"),Ds=m((t,e)=>new Ux({in:t,out:e,typeName:"ZodPipeline"}),"pipelineType"),Hs=m(t=>new _x(w({typeName:"ZodBranded",type:t},ye({supportsExtensions:["secret"]}))),"brandedType");Bp({any:On,array:An,bigint:Ki,boolean:Zn,branded:Hs,catch:Ns,custom:Zi,date:Wi,default:Ms,discriminatedUnion:qi,enum:zi,function:Es,instanceof:Ts,intersection:Gi,lazy:Bs,literal:Kr,map:Ps,nan:bs,nativeEnum:ws,never:Lr,null:qr,nullable:Os,number:$n,object:rr,optional:Cs,pipeline:Ds,preprocess:Ss,upstream:ks,downstream:As,promise:Is,record:Wr,ref:Fi,readonly:Rs,set:Vi,strictObject:xs,string:Qt,symbol:_s,tuple:Gr,undefined:Li,union:ir,unknown:yn,void:vs});var kg={string(t){return Qt(M(w({},t),{coerce:!0}))},number(t){return $n(M(w({},t),{coerce:!0}))},boolean(t){return Zn(M(w({},t),{coerce:!0}))},bigint(t){return Ki(M(w({},t),{coerce:!0}))},date(t){return Wi(M(w({},t),{coerce:!0}))}},Oi=m(t=>({status:"valid",value:t}),"OK"),Us=m((t,...e)=>({status:"aborted",issues:[t,...e]}),"ERR"),js=m((t,e,...n)=>({status:"dirty",value:t,issues:[e,...n]}),"DIRTY"),Ag={};Ot(Ag,{JSONSchemaToZuiError:()=>Ji,ObjectToZuiError:()=>ts,UnrepresentableGenericError:()=>ns,UnsupportedJSONSchemaToZuiError:()=>pn,UnsupportedZuiCheckToJSONSchemaError:()=>Hg,UnsupportedZuiToJSONSchemaError:()=>dt,UnsupportedZuiToTypescriptSchemaError:()=>Sn,UnsupportedZuiToTypescriptTypeError:()=>Wg,UntitledDeclarationError:()=>zg,ZuiToJSONSchemaError:()=>Yi,ZuiToTypescriptSchemaError:()=>$g,ZuiToTypescriptTypeError:()=>Xi,ZuiTransformError:()=>or});var Cg=class extends Error{constructor(e,n){super(n),this.transform=e}};m(Cg,"ZuiTransformError");var or=Cg,Og=class extends or{constructor(e){super("json-schema-to-zui",e)}};m(Og,"JSONSchemaToZuiError");var Ji=Og,Rg=class extends or{constructor(e){super("object-to-zui",e)}};m(Rg,"ObjectToZuiError");var ts=Rg,Mg=class extends or{constructor(e){super("zui-to-json-schema",e)}};m(Mg,"ZuiToJSONSchemaError");var Yi=Mg,Ng=class extends Yi{constructor(e,{suggestedAlternative:n}={}){super(`Zod type ${e} cannot be transformed to JSON Schema.`+(n?` Suggested alternative: ${n}`:""))}};m(Ng,"UnsupportedZuiToJSONSchemaError");var dt=Ng,Dg=class extends Yi{constructor({zodType:e,checkKind:n}){super(`Zod check .${n}() of type ${e} cannot be transformed to JSON Schema.`)}};m(Dg,"UnsupportedZuiCheckToJSONSchemaError");var Hg=Dg,Ug=class extends Ji{constructor(e){super(`JSON Schema ${JSON.stringify(e)} cannot be transformed to ZUI type.`)}};m(Ug,"UnsupportedJSONSchemaToZuiError");var pn=Ug,jg=class extends or{constructor(e){super("zui-to-typescript-schema",e)}};m(jg,"ZuiToTypescriptSchemaError");var $g=jg,Zg=class extends $g{constructor(e){super(`Zod type ${e} cannot be transformed to TypeScript schema.`)}};m(Zg,"UnsupportedZuiToTypescriptSchemaError");var Sn=Zg,Lg=class extends or{constructor(e){super("zui-to-typescript-type",e)}};m(Lg,"ZuiToTypescriptTypeError");var Xi=Lg,Kg=class extends Xi{constructor(e){super(`Zod type ${e} cannot be transformed to TypeScript type.`)}};m(Kg,"UnsupportedZuiToTypescriptTypeError");var Wg=Kg,Fg=class extends Xi{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 Xi{constructor(){super('ZodRef can only be transformed to a TypeScript type with a "type" declaration.')}};m(qg,"UnrepresentableGenericError");var ns=qg,sP=m(t=>{let e;try{e=new Function("z",`return ${t}`)(en)}catch(n){return{sucess:!1,error:`Failed to evaluate schema: ${(n instanceof Error?n:new Error(String(n))).message}`}}return et.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 o=t[e],s="";if(o!==void 0){let i=n({value:o,json:JSON.stringify(o)});if(i){let a=i[0],l=i.length===3?i[1]:"",c=i.length===3?i[2]:i[1];s+=a,((r=t.errorMessage)==null?void 0:r[e])!==void 0&&(s+=l+JSON.stringify(t.errorMessage[e])),s+=c}}return s}m(at,"withMessage");var Mr=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?{[Mr]:n}:{[Mr]:n,not:{}});else{if(Mr in r)return t;e.push(M(w({},r),{[Mr]:n}))}}return e},"ensureOriginalIndex");function Fr(t,e){if(t.allOf.length===0)return"z.never()";if(t.allOf.length===1){let n=t.allOf[0];return tt(n,M(w({},e),{path:[...e.path,"allOf",n[Mr]]}))}else{let[n,r]=aP(uP(t.allOf));return`z.intersection(${Fr({allOf:n},e)}, ${Fr({allOf:r},e)})`}}m(Fr,"parseAllOf");var Gg=m((t,e)=>t.anyOf.length?t.anyOf.length===1?tt(t.anyOf[0],M(w({},e),{path:[...e.path,"anyOf",0]})):`z.union([${t.anyOf.map((n,r)=>tt(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,o)=>tt(r,M(w({},e),{path:[...e.path,"items",o]})))}])`;let n=t.items?`z.array(${tt(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[ke])!=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"),$s=m((t,e)=>t.oneOf.length?t.oneOf.length===1?tt(t.oneOf[0],M(w({},e),{path:[...e.path,"oneOf",0]})):`z.any().superRefine((x, ctx) => {
|
|
10
|
+
`)):a=t.stylize("[Circular]","special")),Wn(i)){if(o&&s.match(/^\d+$/))return a;(i=JSON.stringify(""+s)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(i=i.substr(1,i.length-2),i=t.stylize(i,"name")):(i=i.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),i=t.stylize(i,"string"))}return i+": "+a}function My(t){return Array.isArray(t)}function ra(t){return typeof t=="boolean"}function ms(t){return t===null}function Ny(t){return typeof t=="number"}function fs(t){return typeof t=="string"}function Wn(t){return t===void 0}function Jr(t){return ur(t)&&ia(t)==="[object RegExp]"}function ur(t){return typeof t=="object"&&t!==null}function ps(t){return ur(t)&&ia(t)==="[object Date]"}function Yr(t){return ur(t)&&(ia(t)==="[object Error]"||t instanceof Error)}function as(t){return typeof t=="function"}function ia(t){return Object.prototype.toString.call(t)}function Xo(t){return t<10?"0"+t.toString(10):t.toString(10)}function gI(){var t=new Date,e=[Xo(t.getHours()),Xo(t.getMinutes()),Xo(t.getSeconds())].join(":");return[t.getDate(),pI[t.getMonth()],e].join(" ")}function Dy(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function mI(t,e){if(!t){var n=new Error("Promise was rejected with a falsy value");n.reason=t,t=n}return e(t)}var gy,rn,sn,lr,Je,Kn,on,ar,os,He,FB,ta,gs,hy,zB,qB,GB,VB,JB,Ty,vy,ry,YB,XB,QB,_y,be,eI,tI,nI,by,na,bt,ht,rI,Ze,sI,oI,aI,Vr,L,Lt,py,cI,is,Ry,ss,pI,Ln,AC,ys=it(()=>{S();A();k();lr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,Je=gy={};(function(){try{rn=typeof setTimeout=="function"?setTimeout:Qo}catch{rn=Qo}try{sn=typeof clearTimeout=="function"?clearTimeout:ea}catch{sn=ea}})();on=[],ar=!1,os=-1;Je.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];on.push(new ny(t,e)),on.length!==1||ar||my(yy)},ny.prototype.run=function(){(this||lr).fun.apply(null,(this||lr).array)},Je.title="browser",Je.browser=!0,Je.env={},Je.argv=[],Je.version="",Je.versions={},Je.on=nn,Je.addListener=nn,Je.once=nn,Je.off=nn,Je.removeListener=nn,Je.removeAllListeners=nn,Je.emit=nn,Je.prependListener=nn,Je.prependOnceListener=nn,Je.listeners=function(t){return[]},Je.binding=function(t){throw new Error("process.binding is not supported")},Je.cwd=function(){return"/"},Je.chdir=function(t){throw new Error("process.chdir is not supported")},Je.umask=function(){return 0};He=gy;He.addListener;He.argv;He.binding;He.browser;He.chdir;He.cwd;He.emit;He.env;He.listeners;He.nextTick;He.off;He.on;He.once;He.prependListener;He.prependOnceListener;He.removeAllListeners;He.removeListener;He.title;He.umask;He.version;He.versions;FB=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",ta=Object.prototype.toString,gs=function(t){return!(FB&&t&&typeof t=="object"&&Symbol.toStringTag in t)&&ta.call(t)==="[object Arguments]"},hy=function(t){return!!gs(t)||t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&ta.call(t)!=="[object Array]"&&ta.call(t.callee)==="[object Function]"},zB=(function(){return gs(arguments)})();gs.isLegacyArguments=hy;qB=zB?gs:hy,GB=Object.prototype.toString,VB=Function.prototype.toString,JB=/^\s*(?:function)?\*/,Ty=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",vy=Object.getPrototypeOf,ry=(function(){if(!Ty)return!1;try{return Function("return function*() {}")()}catch{}})(),YB=ry?vy(ry):{},XB=function(t){return typeof t=="function"&&(!!JB.test(VB.call(t))||(Ty?vy(t)===YB:GB.call(t)==="[object GeneratorFunction]"))},QB=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}},_y=function(t){return t&&typeof t=="object"&&typeof t.copy=="function"&&typeof t.fill=="function"&&typeof t.readUInt8=="function"},be={},eI=_y,tI=qB,nI=XB;by=typeof BigInt<"u",na=typeof Symbol<"u",bt=na&&Symbol.toStringTag!==void 0,ht=typeof Uint8Array<"u",rI=typeof ArrayBuffer<"u";if(ht&&bt)var iI=Object.getPrototypeOf(Uint8Array.prototype),Pt=Fn(Object.getOwnPropertyDescriptor(iI,Symbol.toStringTag).get);Ze=Fn(Object.prototype.toString),sI=Fn(Number.prototype.valueOf),oI=Fn(String.prototype.valueOf),aI=Fn(Boolean.prototype.valueOf);if(by)var lI=Fn(BigInt.prototype.valueOf);if(na)var uI=Fn(Symbol.prototype.valueOf);be.isArgumentsObject=tI,be.isGeneratorFunction=nI,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 rI&&ArrayBuffer.isView?ArrayBuffer.isView(t):iy(t)||oy(t)},be.isTypedArray=iy,be.isUint8Array=wy,be.isUint8ClampedArray=xy,be.isUint16Array=Py,be.isUint32Array=By,be.isInt8Array=Iy,be.isInt16Array=Ey,be.isInt32Array=Sy,be.isFloat32Array=ky,be.isFloat64Array=Ay,be.isBigInt64Array=Cy,be.isBigUint64Array=Oy,ts.working=typeof Map<"u"&&ts(new Map),be.isMap=function(t){return typeof Map<"u"&&(ts.working?ts(t):t instanceof Map)},ns.working=typeof Set<"u"&&ns(new Set),be.isSet=function(t){return typeof Set<"u"&&(ns.working?ns(t):t instanceof Set)},rs.working=typeof WeakMap<"u"&&rs(new WeakMap),be.isWeakMap=function(t){return typeof WeakMap<"u"&&(rs.working?rs(t):t instanceof WeakMap)},Vo.working=typeof WeakSet<"u"&&Vo(new WeakSet),be.isWeakSet=function(t){return Vo(t)},ls.working=typeof ArrayBuffer<"u"&&ls(new ArrayBuffer),be.isArrayBuffer=sy,us.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&us(new DataView(new ArrayBuffer(1),0,1)),be.isDataView=oy,cs.working=typeof SharedArrayBuffer<"u"&&cs(new SharedArrayBuffer),be.isSharedArrayBuffer=ay,be.isAsyncFunction=function(t){return Ze(t)==="[object AsyncFunction]"},be.isMapIterator=function(t){return Ze(t)==="[object Map Iterator]"},be.isSetIterator=function(t){return Ze(t)==="[object Set Iterator]"},be.isGeneratorObject=function(t){return Ze(t)==="[object Generator]"},be.isWebAssemblyCompiledModule=function(t){return Ze(t)==="[object WebAssembly.Module]"},be.isNumberObject=ly,be.isStringObject=uy,be.isBooleanObject=cy,be.isBigIntObject=dy,be.isSymbolObject=fy,be.isBoxedPrimitive=function(t){return ly(t)||uy(t)||cy(t)||dy(t)||fy(t)},be.isAnyArrayBuffer=function(t){return ht&&(sy(t)||ay(t))},["isProxy","isExternal","isModuleNamespaceObject"].forEach((function(t){Object.defineProperty(be,t,{enumerable:!1,value:function(){throw new Error(t+" is not supported in userland")}})}));Vr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,L={},Lt=He,py=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},cI=/%[sdj%]/g;L.format=function(t){if(!fs(t)){for(var e=[],n=0;n<arguments.length;n++)e.push(hn(arguments[n]));return e.join(" ")}n=1;for(var r=arguments,s=r.length,o=String(t).replace(cI,(function(a){if(a==="%%")return"%";if(n>=s)return a;switch(a){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch{return"[Circular]"}default:return a}})),i=r[n];n<s;i=r[++n])ms(i)||!ur(i)?o+=" "+i:o+=" "+hn(i);return o},L.deprecate=function(t,e){if(Lt!==void 0&&Lt.noDeprecation===!0)return t;if(Lt===void 0)return function(){return L.deprecate(t,e).apply(this||Vr,arguments)};var n=!1;return function(){if(!n){if(Lt.throwDeprecation)throw new Error(e);Lt.traceDeprecation?console.trace(e):console.error(e),n=!0}return t.apply(this||Vr,arguments)}};is={},Ry=/^$/;Lt.env.NODE_DEBUG&&(ss=Lt.env.NODE_DEBUG,ss=ss.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),Ry=new RegExp("^"+ss+"$","i"));L.debuglog=function(t){if(t=t.toUpperCase(),!is[t])if(Ry.test(t)){var e=Lt.pid;is[t]=function(){var n=L.format.apply(L,arguments);console.error("%s %d: %s",t,e,n)}}else is[t]=function(){};return is[t]},L.inspect=hn,hn.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},hn.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},L.types=be,L.isArray=My,L.isBoolean=ra,L.isNull=ms,L.isNullOrUndefined=function(t){return t==null},L.isNumber=Ny,L.isString=fs,L.isSymbol=function(t){return typeof t=="symbol"},L.isUndefined=Wn,L.isRegExp=Jr,L.types.isRegExp=Jr,L.isObject=ur,L.isDate=ps,L.types.isDate=ps,L.isError=Yr,L.types.isNativeError=Yr,L.isFunction=as,L.isPrimitive=function(t){return t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||typeof t=="symbol"||t===void 0},L.isBuffer=_y;pI=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];L.log=function(){console.log("%s - %s",gI(),L.format.apply(L,arguments))},L.inherits=QB,L._extend=function(t,e){if(!e||!ur(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t};Ln=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(Ln&&t[Ln]){var e;if(typeof(e=t[Ln])!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,Ln,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var n,r,s=new Promise((function(a,l){n=a,r=l})),o=[],i=0;i<arguments.length;i++)o.push(arguments[i]);o.push((function(a,l){a?r(a):n(l)}));try{t.apply(this||Vr,o)}catch(a){r(a)}return s}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Ln&&Object.defineProperty(e,Ln,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,py(t))},L.promisify.custom=Ln,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 s=n.pop();if(typeof s!="function")throw new TypeError("The last argument must be of type Function");var o=this||Vr,i=function(){return s.apply(o,arguments)};t.apply(this||Vr,n).then((function(a){Lt.nextTick(i.bind(null,null,a))}),(function(a){Lt.nextTick(mI.bind(null,a,i))}))}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Object.defineProperties(e,py(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;AC=L.promisify;L.types});var DC,Hy=it(()=>{S();A();k();ys();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;L.TextEncoder=globalThis.TextEncoder;L.TextDecoder=globalThis.TextDecoder});function la(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function yI(){!cr||!zn||(cr=!1,zn.length?an=zn.concat(an):hs=-1,an.length&&Uy())}function Uy(){if(!cr){var t=setTimeout(yI,0);cr=!0;for(var e=an.length;e;){for(zn=an,an=[];++hs<e;)zn&&zn[hs].run();hs=-1,e=an.length}zn=null,cr=!1,clearTimeout(t)}}function hI(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 jy(t,e)),an.length===1&&!cr&&setTimeout(Uy,0)}function jy(t,e){this.fun=t,this.array=e}function lt(){}function MI(t){la("_linkedBinding")}function UI(t){la("dlopen")}function jI(){return[]}function $I(){return[]}function VI(t,e){if(!t)throw new Error(e||"assertion error")}function QI(){return!1}function yE(){return Tn.now()/1e3}function aa(t){var e=Math.floor((Date.now()-Tn.now())*.001),n=Tn.now()*.001,r=Math.floor(n)+e,s=Math.floor(n%1*1e9);return t&&(r=r-t[0],s=s-t[1],s<0&&(r--,s+=oa)),[r,s]}function vn(){return Rt}function SE(t){return[]}var an,cr,zn,hs,TI,vI,_I,bI,wI,xI,PI,BI,II,EI,SI,kI,AI,CI,OI,RI,NI,DI,HI,ZI,LI,ua,KI,WI,FI,zI,qI,GI,JI,YI,XI,eE,tE,nE,rE,iE,sE,oE,aE,lE,uE,cE,dE,fE,pE,gE,mE,Tn,sa,oa,hE,TE,vE,_E,bE,wE,xE,PE,BE,IE,EE,Rt,ca=it(()=>{S();A();k();an=[],cr=!1,hs=-1;jy.prototype.run=function(){this.fun.apply(null,this.array)};TI="browser",vI="x64",_I="browser",bI={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},wI=["/usr/bin/node"],xI=[],PI="v16.8.0",BI={},II=function(t,e){console.warn((e?e+": ":"")+t)},EI=function(t){la("binding")},SI=function(t){return 0},kI=function(){return"/"},AI=function(t){},CI={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};OI=lt,RI=[];NI={},DI=!1,HI={};ZI=lt,LI=lt,ua=function(){return{}},KI=ua,WI=ua,FI=lt,zI=lt,qI=lt,GI={};JI={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},YI=lt,XI=lt;eE=lt,tE=lt,nE=lt,rE=lt,iE=lt,sE=void 0,oE=void 0,aE=void 0,lE=lt,uE=2,cE=1,dE="/bin/usr/node",fE=9229,pE="node",gE=[],mE=lt,Tn={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};Tn.now===void 0&&(sa=Date.now(),Tn.timing&&Tn.timing.navigationStart&&(sa=Tn.timing.navigationStart),Tn.now=()=>Date.now()-sa);oa=1e9;aa.bigint=function(t){var e=aa(t);return typeof BigInt>"u"?e[0]*oa+e[1]:BigInt(e[0]*oa)+BigInt(e[1])};hE=10,TE={},vE=0;_E=vn,bE=vn,wE=vn,xE=vn,PE=vn,BE=lt,IE=vn,EE=vn;Rt={version:PI,versions:BI,arch:vI,platform:_I,release:CI,_rawDebug:OI,moduleLoadList:RI,binding:EI,_linkedBinding:MI,_events:TE,_eventsCount:vE,_maxListeners:hE,on:vn,addListener:_E,once:bE,off:wE,removeListener:xE,removeAllListeners:PE,emit:BE,prependListener:IE,prependOnceListener:EE,listeners:SE,domain:NI,_exiting:DI,config:HI,dlopen:UI,uptime:yE,_getActiveRequests:jI,_getActiveHandles:$I,reallyExit:ZI,_kill:LI,cpuUsage:ua,resourceUsage:KI,memoryUsage:WI,kill:FI,exit:zI,openStdin:qI,allowedNodeEnvironmentFlags:GI,assert:VI,features:JI,_fatalExceptions:YI,setUncaughtExceptionCaptureCallback:XI,hasUncaughtExceptionCaptureCallback:QI,emitWarning:II,nextTick:hI,_tickCallback:eE,_debugProcess:tE,_debugEnd:nE,_startProfilerIdleNotifier:rE,_stopProfilerIdleNotifier:iE,stdout:sE,stdin:aE,stderr:oE,abort:lE,umask:SI,chdir:AI,cwd:kI,env:bI,title:TI,argv:wI,execArgv:xI,pid:uE,ppid:cE,execPath:dE,debugPort:fE,hrtime:aa,argv0:pE,_preload_modules:gE,setSourceMapsEnabled:mE}});function Zy(){if($y)return da;$y=!0,da=t;function t(n,r){if(e("noDeprecation"))return n;var s=!1;function o(){if(!s){if(e("throwDeprecation"))throw new Error(r);e("traceDeprecation")?console.trace(r):console.warn(r),s=!0}return n.apply(this||fa,arguments)}return o}function e(n){try{if(!fa.localStorage)return!1}catch{return!1}var r=fa.localStorage[n];return r==null?!1:String(r).toLowerCase()==="true"}return da}var da,$y,fa,Ly=it(()=>{S();A();k();da={},$y=!1,fa=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global});function kE(){if(Ky)return Qr;Ky=!0;var t=Ut(),e=t.Buffer;function n(s,o){for(var i in s)o[i]=s[i]}e.from&&e.alloc&&e.allocUnsafe&&e.allocUnsafeSlow?Qr=t:(n(t,Qr),Qr.Buffer=r);function r(s,o,i){return e(s,o,i)}return r.prototype=Object.create(e.prototype),n(e,r),r.from=function(s,o,i){if(typeof s=="number")throw new TypeError("Argument must not be a number");return e(s,o,i)},r.alloc=function(s,o,i){if(typeof s!="number")throw new TypeError("Argument must be a number");var a=e(s);return o!==void 0?typeof i=="string"?a.fill(o,i):a.fill(o):a.fill(0),a},r.allocUnsafe=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return e(s)},r.allocUnsafeSlow=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return t.SlowBuffer(s)},Qr}function AE(){if(Wy)return pa;Wy=!0;var t=kE().Buffer,e=t.isEncoding||function(T){switch(T=""+T,T&&T.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function n(T){if(!T)return"utf8";for(var E;;)switch(T){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return T;default:if(E)return;T=(""+T).toLowerCase(),E=!0}}function r(T){var E=n(T);if(typeof E!="string"&&(t.isEncoding===e||!e(T)))throw new Error("Unknown encoding: "+T);return E||T}pa.StringDecoder=s;function s(T){this.encoding=r(T);var E;switch(this.encoding){case"utf16le":this.text=g,this.end=p,E=4;break;case"utf8":this.fillLast=l,E=4;break;case"base64":this.text=h,this.end=_,E=3;break;default:this.write=P,this.end=B;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(E)}s.prototype.write=function(T){if(T.length===0)return"";var E,I;if(this.lastNeed){if(E=this.fillLast(T),E===void 0)return"";I=this.lastNeed,this.lastNeed=0}else I=0;return I<T.length?E?E+this.text(T,I):this.text(T,I):E||""},s.prototype.end=f,s.prototype.text=c,s.prototype.fillLast=function(T){if(this.lastNeed<=T.length)return T.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);T.copy(this.lastChar,this.lastTotal-this.lastNeed,0,T.length),this.lastNeed-=T.length};function o(T){return T<=127?0:T>>5===6?2:T>>4===14?3:T>>3===30?4:T>>6===2?-1:-2}function i(T,E,I){var D=E.length-1;if(D<I)return 0;var $=o(E[D]);return $>=0?($>0&&(T.lastNeed=$-1),$):--D<I||$===-2?0:($=o(E[D]),$>=0?($>0&&(T.lastNeed=$-2),$):--D<I||$===-2?0:($=o(E[D]),$>=0?($>0&&($===2?$=0:T.lastNeed=$-3),$):0))}function a(T,E,I){if((E[0]&192)!==128)return T.lastNeed=0,"\uFFFD";if(T.lastNeed>1&&E.length>1){if((E[1]&192)!==128)return T.lastNeed=1,"\uFFFD";if(T.lastNeed>2&&E.length>2&&(E[2]&192)!==128)return T.lastNeed=2,"\uFFFD"}}function l(T){var E=this.lastTotal-this.lastNeed,I=a(this,T);if(I!==void 0)return I;if(this.lastNeed<=T.length)return T.copy(this.lastChar,E,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);T.copy(this.lastChar,E,0,T.length),this.lastNeed-=T.length}function c(T,E){var I=i(this,T,E);if(!this.lastNeed)return T.toString("utf8",E);this.lastTotal=I;var D=T.length-(I-this.lastNeed);return T.copy(this.lastChar,0,D),T.toString("utf8",E,D)}function f(T){var E=T&&T.length?this.write(T):"";return this.lastNeed?E+"\uFFFD":E}function g(T,E){if((T.length-E)%2===0){var I=T.toString("utf16le",E);if(I){var D=I.charCodeAt(I.length-1);if(D>=55296&&D<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=T[T.length-2],this.lastChar[1]=T[T.length-1],I.slice(0,-1)}return I}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=T[T.length-1],T.toString("utf16le",E,T.length-1)}function p(T){var E=T&&T.length?this.write(T):"";if(this.lastNeed){var I=this.lastTotal-this.lastNeed;return E+this.lastChar.toString("utf16le",0,I)}return E}function h(T,E){var I=(T.length-E)%3;return I===0?T.toString("base64",E):(this.lastNeed=3-I,this.lastTotal=3,I===1?this.lastChar[0]=T[T.length-1]:(this.lastChar[0]=T[T.length-2],this.lastChar[1]=T[T.length-1]),T.toString("base64",E,T.length-I))}function _(T){var E=T&&T.length?this.write(T):"";return this.lastNeed?E+this.lastChar.toString("base64",0,3-this.lastNeed):E}function P(T){return T.toString(this.encoding)}function B(T){return T&&T.length?this.write(T):""}return pa}var Qr,Ky,pa,Wy,ei,JC,Fy=it(()=>{S();A();k();mi();Qr={},Ky=!1;pa={},Wy=!1;ei=AE();ei.StringDecoder;JC=ei.StringDecoder});function CE(){if(zy)return ga;zy=!0;var t=ga={},e,n;function r(){throw new Error("setTimeout has not been defined")}function s(){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=s}catch{n=s}})();function o(P){if(e===setTimeout)return setTimeout(P,0);if((e===r||!e)&&setTimeout)return e=setTimeout,setTimeout(P,0);try{return e(P,0)}catch{try{return e.call(null,P,0)}catch{return e.call(this||dr,P,0)}}}function i(P){if(n===clearTimeout)return clearTimeout(P);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(P);try{return n(P)}catch{try{return n.call(null,P)}catch{return n.call(this||dr,P)}}}var a=[],l=!1,c,f=-1;function g(){!l||!c||(l=!1,c.length?a=c.concat(a):f=-1,a.length&&p())}function p(){if(!l){var P=o(g);l=!0;for(var B=a.length;B;){for(c=a,a=[];++f<B;)c&&c[f].run();f=-1,B=a.length}c=null,l=!1,i(P)}}t.nextTick=function(P){var B=new Array(arguments.length-1);if(arguments.length>1)for(var T=1;T<arguments.length;T++)B[T-1]=arguments[T];a.push(new h(P,B)),a.length===1&&!l&&o(p)};function h(P,B){(this||dr).fun=P,(this||dr).array=B}h.prototype.run=function(){(this||dr).fun.apply(null,(this||dr).array)},t.title="browser",t.browser=!0,t.env={},t.argv=[],t.version="",t.versions={};function _(){}return t.on=_,t.addListener=_,t.once=_,t.off=_,t.removeListener=_,t.removeAllListeners=_,t.emit=_,t.prependListener=_,t.prependOnceListener=_,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},ga}var ga,zy,dr,Ue,ma=it(()=>{S();A();k();ga={},zy=!1,dr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ue=CE();Ue.platform="browser";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});function OE(){if(qy)return ya;qy=!0;var t=Ue;function e(o){if(typeof o!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(o))}function n(o,i){for(var a="",l=0,c=-1,f=0,g,p=0;p<=o.length;++p){if(p<o.length)g=o.charCodeAt(p);else{if(g===47)break;g=47}if(g===47){if(!(c===p-1||f===1))if(c!==p-1&&f===2){if(a.length<2||l!==2||a.charCodeAt(a.length-1)!==46||a.charCodeAt(a.length-2)!==46){if(a.length>2){var h=a.lastIndexOf("/");if(h!==a.length-1){h===-1?(a="",l=0):(a=a.slice(0,h),l=a.length-1-a.lastIndexOf("/")),c=p,f=0;continue}}else if(a.length===2||a.length===1){a="",l=0,c=p,f=0;continue}}i&&(a.length>0?a+="/..":a="..",l=2)}else a.length>0?a+="/"+o.slice(c+1,p):a=o.slice(c+1,p),l=p-c-1;c=p,f=0}else g===46&&f!==-1?++f:f=-1}return a}function r(o,i){var a=i.dir||i.root,l=i.base||(i.name||"")+(i.ext||"");return a?a===i.root?a+l:a+o+l:l}var s={resolve:function(){for(var i="",a=!1,l,c=arguments.length-1;c>=-1&&!a;c--){var f;c>=0?f=arguments[c]:(l===void 0&&(l=t.cwd()),f=l),e(f),f.length!==0&&(i=f+"/"+i,a=f.charCodeAt(0)===47)}return i=n(i,!a),a?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(i){if(e(i),i.length===0)return".";var a=i.charCodeAt(0)===47,l=i.charCodeAt(i.length-1)===47;return i=n(i,!a),i.length===0&&!a&&(i="."),i.length>0&&l&&(i+="/"),a?"/"+i:i},isAbsolute:function(i){return e(i),i.length>0&&i.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var i,a=0;a<arguments.length;++a){var l=arguments[a];e(l),l.length>0&&(i===void 0?i=l:i+="/"+l)}return i===void 0?".":s.normalize(i)},relative:function(i,a){if(e(i),e(a),i===a||(i=s.resolve(i),a=s.resolve(a),i===a))return"";for(var l=1;l<i.length&&i.charCodeAt(l)===47;++l);for(var c=i.length,f=c-l,g=1;g<a.length&&a.charCodeAt(g)===47;++g);for(var p=a.length,h=p-g,_=f<h?f:h,P=-1,B=0;B<=_;++B){if(B===_){if(h>_){if(a.charCodeAt(g+B)===47)return a.slice(g+B+1);if(B===0)return a.slice(g+B)}else f>_&&(i.charCodeAt(l+B)===47?P=B:B===0&&(P=0));break}var T=i.charCodeAt(l+B),E=a.charCodeAt(g+B);if(T!==E)break;T===47&&(P=B)}var I="";for(B=l+P+1;B<=c;++B)(B===c||i.charCodeAt(B)===47)&&(I.length===0?I+="..":I+="/..");return I.length>0?I+a.slice(g+P):(g+=P,a.charCodeAt(g)===47&&++g,a.slice(g))},_makeLong:function(i){return i},dirname:function(i){if(e(i),i.length===0)return".";for(var a=i.charCodeAt(0),l=a===47,c=-1,f=!0,g=i.length-1;g>=1;--g)if(a=i.charCodeAt(g),a===47){if(!f){c=g;break}}else f=!1;return c===-1?l?"/":".":l&&c===1?"//":i.slice(0,c)},basename:function(i,a){if(a!==void 0&&typeof a!="string")throw new TypeError('"ext" argument must be a string');e(i);var l=0,c=-1,f=!0,g;if(a!==void 0&&a.length>0&&a.length<=i.length){if(a.length===i.length&&a===i)return"";var p=a.length-1,h=-1;for(g=i.length-1;g>=0;--g){var _=i.charCodeAt(g);if(_===47){if(!f){l=g+1;break}}else h===-1&&(f=!1,h=g+1),p>=0&&(_===a.charCodeAt(p)?--p===-1&&(c=g):(p=-1,c=h))}return l===c?c=h:c===-1&&(c=i.length),i.slice(l,c)}else{for(g=i.length-1;g>=0;--g)if(i.charCodeAt(g)===47){if(!f){l=g+1;break}}else c===-1&&(f=!1,c=g+1);return c===-1?"":i.slice(l,c)}},extname:function(i){e(i);for(var a=-1,l=0,c=-1,f=!0,g=0,p=i.length-1;p>=0;--p){var h=i.charCodeAt(p);if(h===47){if(!f){l=p+1;break}continue}c===-1&&(f=!1,c=p+1),h===46?a===-1?a=p:g!==1&&(g=1):a!==-1&&(g=-1)}return a===-1||c===-1||g===0||g===1&&a===c-1&&a===l+1?"":i.slice(a,c)},format:function(i){if(i===null||typeof i!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof i);return r("/",i)},parse:function(i){e(i);var a={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return a;var l=i.charCodeAt(0),c=l===47,f;c?(a.root="/",f=1):f=0;for(var g=-1,p=0,h=-1,_=!0,P=i.length-1,B=0;P>=f;--P){if(l=i.charCodeAt(P),l===47){if(!_){p=P+1;break}continue}h===-1&&(_=!1,h=P+1),l===46?g===-1?g=P:B!==1&&(B=1):g!==-1&&(B=-1)}return g===-1||h===-1||B===0||B===1&&g===h-1&&g===p+1?h!==-1&&(p===0&&c?a.base=a.name=i.slice(1,h):a.base=a.name=i.slice(p,h)):(p===0&&c?(a.name=i.slice(1,g),a.base=i.slice(1,h)):(a.name=i.slice(p,g),a.base=i.slice(p,h)),a.ext=i.slice(g,h)),p>0?a.dir=i.slice(0,p-1):c&&(a.dir="/"),a},sep:"/",delimiter:":",win32:null,posix:null};return s.posix=s,ya=s,ya}function qn(t){throw new RangeError(DE[t])}function Vy(t,e){let n=t.split("@"),r="";n.length>1&&(r=n[0]+"@",t=n[1]);let s=(function(o,i){let a=[],l=o.length;for(;l--;)a[l]=i(o[l]);return a})((t=t.replace(NE,".")).split("."),e).join(".");return r+s}function ih(t){let e=[],n=0,r=t.length;for(;n<r;){let s=t.charCodeAt(n++);if(s>=55296&&s<=56319&&n<r){let o=t.charCodeAt(n++);(64512&o)==56320?e.push(((1023&s)<<10)+(1023&o)+65536):(e.push(s),n--)}else e.push(s)}return e}function UE(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 ni(t,e,n){if(t&&Kt.isObject(t)&&t instanceof Bt)return t;var r=new Bt;return r.parse(t,e,n),r}function GE(){if(nh)return _a;nh=!0;var t=He;function e(o){if(typeof o!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(o))}function n(o,i){for(var a="",l=0,c=-1,f=0,g,p=0;p<=o.length;++p){if(p<o.length)g=o.charCodeAt(p);else{if(g===47)break;g=47}if(g===47){if(!(c===p-1||f===1))if(c!==p-1&&f===2){if(a.length<2||l!==2||a.charCodeAt(a.length-1)!==46||a.charCodeAt(a.length-2)!==46){if(a.length>2){var h=a.lastIndexOf("/");if(h!==a.length-1){h===-1?(a="",l=0):(a=a.slice(0,h),l=a.length-1-a.lastIndexOf("/")),c=p,f=0;continue}}else if(a.length===2||a.length===1){a="",l=0,c=p,f=0;continue}}i&&(a.length>0?a+="/..":a="..",l=2)}else a.length>0?a+="/"+o.slice(c+1,p):a=o.slice(c+1,p),l=p-c-1;c=p,f=0}else g===46&&f!==-1?++f:f=-1}return a}function r(o,i){var a=i.dir||i.root,l=i.base||(i.name||"")+(i.ext||"");return a?a===i.root?a+l:a+o+l:l}var s={resolve:function(){for(var i="",a=!1,l,c=arguments.length-1;c>=-1&&!a;c--){var f;c>=0?f=arguments[c]:(l===void 0&&(l=t.cwd()),f=l),e(f),f.length!==0&&(i=f+"/"+i,a=f.charCodeAt(0)===47)}return i=n(i,!a),a?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(i){if(e(i),i.length===0)return".";var a=i.charCodeAt(0)===47,l=i.charCodeAt(i.length-1)===47;return i=n(i,!a),i.length===0&&!a&&(i="."),i.length>0&&l&&(i+="/"),a?"/"+i:i},isAbsolute:function(i){return e(i),i.length>0&&i.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var i,a=0;a<arguments.length;++a){var l=arguments[a];e(l),l.length>0&&(i===void 0?i=l:i+="/"+l)}return i===void 0?".":s.normalize(i)},relative:function(i,a){if(e(i),e(a),i===a||(i=s.resolve(i),a=s.resolve(a),i===a))return"";for(var l=1;l<i.length&&i.charCodeAt(l)===47;++l);for(var c=i.length,f=c-l,g=1;g<a.length&&a.charCodeAt(g)===47;++g);for(var p=a.length,h=p-g,_=f<h?f:h,P=-1,B=0;B<=_;++B){if(B===_){if(h>_){if(a.charCodeAt(g+B)===47)return a.slice(g+B+1);if(B===0)return a.slice(g+B)}else f>_&&(i.charCodeAt(l+B)===47?P=B:B===0&&(P=0));break}var T=i.charCodeAt(l+B),E=a.charCodeAt(g+B);if(T!==E)break;T===47&&(P=B)}var I="";for(B=l+P+1;B<=c;++B)(B===c||i.charCodeAt(B)===47)&&(I.length===0?I+="..":I+="/..");return I.length>0?I+a.slice(g+P):(g+=P,a.charCodeAt(g)===47&&++g,a.slice(g))},_makeLong:function(i){return i},dirname:function(i){if(e(i),i.length===0)return".";for(var a=i.charCodeAt(0),l=a===47,c=-1,f=!0,g=i.length-1;g>=1;--g)if(a=i.charCodeAt(g),a===47){if(!f){c=g;break}}else f=!1;return c===-1?l?"/":".":l&&c===1?"//":i.slice(0,c)},basename:function(i,a){if(a!==void 0&&typeof a!="string")throw new TypeError('"ext" argument must be a string');e(i);var l=0,c=-1,f=!0,g;if(a!==void 0&&a.length>0&&a.length<=i.length){if(a.length===i.length&&a===i)return"";var p=a.length-1,h=-1;for(g=i.length-1;g>=0;--g){var _=i.charCodeAt(g);if(_===47){if(!f){l=g+1;break}}else h===-1&&(f=!1,h=g+1),p>=0&&(_===a.charCodeAt(p)?--p===-1&&(c=g):(p=-1,c=h))}return l===c?c=h:c===-1&&(c=i.length),i.slice(l,c)}else{for(g=i.length-1;g>=0;--g)if(i.charCodeAt(g)===47){if(!f){l=g+1;break}}else c===-1&&(f=!1,c=g+1);return c===-1?"":i.slice(l,c)}},extname:function(i){e(i);for(var a=-1,l=0,c=-1,f=!0,g=0,p=i.length-1;p>=0;--p){var h=i.charCodeAt(p);if(h===47){if(!f){l=p+1;break}continue}c===-1&&(f=!1,c=p+1),h===46?a===-1?a=p:g!==1&&(g=1):a!==-1&&(g=-1)}return a===-1||c===-1||g===0||g===1&&a===c-1&&a===l+1?"":i.slice(a,c)},format:function(i){if(i===null||typeof i!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof i);return r("/",i)},parse:function(i){e(i);var a={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return a;var l=i.charCodeAt(0),c=l===47,f;c?(a.root="/",f=1):f=0;for(var g=-1,p=0,h=-1,_=!0,P=i.length-1,B=0;P>=f;--P){if(l=i.charCodeAt(P),l===47){if(!_){p=P+1;break}continue}h===-1&&(_=!1,h=P+1),l===46?g===-1?g=P:B!==1&&(B=1):g!==-1&&(B=-1)}return g===-1||h===-1||B===0||B===1&&g===h-1&&g===p+1?h!==-1&&(p===0&&c?a.base=a.name=i.slice(1,h):a.base=a.name=i.slice(p,h)):(p===0&&c?(a.name=i.slice(1,g),a.base=i.slice(1,h)):(a.name=i.slice(p,g),a.base=i.slice(p,h)),a.ext=i.slice(g,h)),p>0?a.dir=i.slice(0,p-1):c&&(a.dir="/"),a},sep:"/",delimiter:":",win32:null,posix:null};return s.posix=s,_a=s,_a}function oS(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 wa?aS(t):lS(t)}function aS(t){let e=t.hostname,n=t.pathname;for(let r=0;r<n.length;r++)if(n[r]==="%"){let s=n.codePointAt(r+2)||32;if(n[r+1]==="2"&&s===102||n[r+1]==="5"&&s===99)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(n=n.replace(eS,"\\"),n=decodeURIComponent(n),e!=="")return`\\\\${e}${n}`;{let r=n.codePointAt(1)|32,s=n[2];if(r<XE||r>QE||s!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return n.slice(1)}}function lS(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 uS(t){let e=rh.resolve(t),n=t.charCodeAt(t.length-1);(n===YE||wa&&n===JE)&&e[e.length-1]!==rh.sep&&(e+="/");let r=new URL("file://");return e.includes("%")&&(e=e.replace(tS,"%25")),!wa&&e.includes("\\")&&(e=e.replace(nS,"%5C")),e.includes(`
|
|
11
|
+
`)&&(e=e.replace(rS,"%0A")),e.includes("\r")&&(e=e.replace(iS,"%0D")),e.includes(" ")&&(e=e.replace(sS,"%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 xa?wS(t):xS(t)}function wS(t){let e=t.hostname,n=t.pathname;for(let r=0;r<n.length;r++)if(n[r]==="%"){let s=n.codePointAt(r+2)||32;if(n[r+1]==="2"&&s===102||n[r+1]==="5"&&s===99)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(n=n.replace(mS,"\\"),n=decodeURIComponent(n),e!=="")return`\\\\${e}${n}`;{let r=n.codePointAt(1)|32,s=n[2];if(r<pS||r>gS||s!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return n.slice(1)}}function xS(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 PS(t){let e=Gy.resolve(t),n=t.charCodeAt(t.length-1);(n===fS||xa&&n===dS)&&e[e.length-1]!==Gy.sep&&(e+="/");let r=new URL("file://");return e.includes("%")&&(e=e.replace(yS,"%25")),!xa&&e.includes("\\")&&(e=e.replace(hS,"%5C")),e.includes(`
|
|
12
|
+
`)&&(e=e.replace(TS,"%0A")),e.includes("\r")&&(e=e.replace(vS,"%0D")),e.includes(" ")&&(e=e.replace(_S,"%09")),r.pathname=e,r}var ya,qy,Gy,pr,RE,ME,NE,DE,Wt,ha,Jy,sh,Yy,Xy,HE,jE,ti,$E,ln,Ce,ZE,Kt,LE,KE,WE,FE,ba,Qy,eh,th,zE,qE,Ta,fr,va,_a,nh,rh,VE,JE,YE,XE,QE,wa,eS,tS,nS,rS,iS,sS,cS,dS,fS,pS,gS,xa,mS,yS,hS,TS,vS,_S,oh=it(()=>{S();A();k();ys();ma();ya={},qy=!1;Gy=OE(),pr=2147483647,RE=/^xn--/,ME=/[^\0-\x7E]/,NE=/[\x2E\u3002\uFF0E\uFF61]/g,DE={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Wt=Math.floor,ha=String.fromCharCode;Jy=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},sh=function(t,e,n){let r=0;for(t=n?Wt(t/700):t>>1,t+=Wt(t/e);t>455;r+=36)t=Wt(t/35);return Wt(r+36*t/(t+38))},Yy=function(t){let e=[],n=t.length,r=0,s=128,o=72,i=t.lastIndexOf("-");i<0&&(i=0);for(let l=0;l<i;++l)t.charCodeAt(l)>=128&&qn("not-basic"),e.push(t.charCodeAt(l));for(let l=i>0?i+1:0;l<n;){let c=r;for(let g=1,p=36;;p+=36){l>=n&&qn("invalid-input");let h=(a=t.charCodeAt(l++))-48<10?a-22:a-65<26?a-65:a-97<26?a-97:36;(h>=36||h>Wt((pr-r)/g))&&qn("overflow"),r+=h*g;let _=p<=o?1:p>=o+26?26:p-o;if(h<_)break;let P=36-_;g>Wt(pr/P)&&qn("overflow"),g*=P}let f=e.length+1;o=sh(r-c,f,c==0),Wt(r/f)>pr-s&&qn("overflow"),s+=Wt(r/f),r%=f,e.splice(r++,0,s)}var a;return String.fromCodePoint(...e)},Xy=function(t){let e=[],n=(t=ih(t)).length,r=128,s=0,o=72;for(let l of t)l<128&&e.push(ha(l));let i=e.length,a=i;for(i&&e.push("-");a<n;){let l=pr;for(let f of t)f>=r&&f<l&&(l=f);let c=a+1;l-r>Wt((pr-s)/c)&&qn("overflow"),s+=(l-r)*c,r=l;for(let f of t)if(f<r&&++s>pr&&qn("overflow"),f==r){let g=s;for(let p=36;;p+=36){let h=p<=o?1:p>=o+26?26:p-o;if(g<h)break;let _=g-h,P=36-h;e.push(ha(Jy(h+_%P,0))),g=Wt(_/P)}e.push(ha(Jy(g,0))),o=sh(s,c,a==i),s=0,++a}++s,++r}return e.join("")},HE={version:"2.1.0",ucs2:{decode:ih,encode:t=>String.fromCodePoint(...t)},decode:Yy,encode:Xy,toASCII:function(t){return Vy(t,(function(e){return ME.test(e)?"xn--"+Xy(e):e}))},toUnicode:function(t){return Vy(t,(function(e){return RE.test(e)?Yy(e.slice(4).toLowerCase()):e}))}};jE=function(t,e,n,r){e=e||"&",n=n||"=";var s={};if(typeof t!="string"||t.length===0)return s;var o=/\+/g;t=t.split(e);var i=1e3;r&&typeof r.maxKeys=="number"&&(i=r.maxKeys);var a=t.length;i>0&&a>i&&(a=i);for(var l=0;l<a;++l){var c,f,g,p,h=t[l].replace(o,"%20"),_=h.indexOf(n);_>=0?(c=h.substr(0,_),f=h.substr(_+1)):(c=h,f=""),g=decodeURIComponent(c),p=decodeURIComponent(f),UE(s,g)?Array.isArray(s[g])?s[g].push(p):s[g]=[s[g],p]:s[g]=p}return s},ti=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}},$E=function(t,e,n,r){return e=e||"&",n=n||"=",t===null&&(t=void 0),typeof t=="object"?Object.keys(t).map((function(s){var o=encodeURIComponent(ti(s))+n;return Array.isArray(t[s])?t[s].map((function(i){return o+encodeURIComponent(ti(i))})).join(e):o+encodeURIComponent(ti(t[s]))})).join(e):r?encodeURIComponent(ti(r))+n+encodeURIComponent(ti(t)):""},ln={};ln.decode=ln.parse=jE,ln.encode=ln.stringify=$E;ln.decode;ln.encode;ln.parse;ln.stringify;Ce={},ZE=HE,Kt={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}};Ce.parse=ni,Ce.resolve=function(t,e){return ni(t,!1,!0).resolve(e)},Ce.resolveObject=function(t,e){return t?ni(t,!1,!0).resolveObject(e):e},Ce.format=function(t){return Kt.isString(t)&&(t=ni(t)),t instanceof Bt?t.format():Bt.prototype.format.call(t)},Ce.Url=Bt;LE=/^([a-z0-9.+-]+:)/i,KE=/:[0-9]*$/,WE=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,FE=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r",`
|
|
13
|
+
`," "]),ba=["'"].concat(FE),Qy=["%","/","?",";","#"].concat(ba),eh=["/","?","#"],th=/^[+a-z0-9A-Z_-]{0,63}$/,zE=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,qE={javascript:!0,"javascript:":!0},Ta={javascript:!0,"javascript:":!0},fr={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},va=ln;Bt.prototype.parse=function(t,e,n){if(!Kt.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var r=t.indexOf("?"),s=r!==-1&&r<t.indexOf("#")?"?":"#",o=t.split(s);o[0]=o[0].replace(/\\/g,"/");var i=t=o.join(s);if(i=i.trim(),!n&&t.split("#").length===1){var a=WE.exec(i);if(a)return this.path=i,this.href=i,this.pathname=a[1],a[2]?(this.search=a[2],this.query=e?va.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var l=LE.exec(i);if(l){var c=(l=l[0]).toLowerCase();this.protocol=c,i=i.substr(l.length)}if(n||l||i.match(/^\/\/[^@\/]+@[^@\/]+/)){var f=i.substr(0,2)==="//";!f||l&&Ta[l]||(i=i.substr(2),this.slashes=!0)}if(!Ta[l]&&(f||l&&!fr[l])){for(var g,p,h=-1,_=0;_<eh.length;_++)(P=i.indexOf(eh[_]))!==-1&&(h===-1||P<h)&&(h=P);for((p=h===-1?i.lastIndexOf("@"):i.lastIndexOf("@",h))!==-1&&(g=i.slice(0,p),i=i.slice(p+1),this.auth=decodeURIComponent(g)),h=-1,_=0;_<Qy.length;_++){var P;(P=i.indexOf(Qy[_]))!==-1&&(h===-1||P<h)&&(h=P)}h===-1&&(h=i.length),this.host=i.slice(0,h),i=i.slice(h),this.parseHost(),this.hostname=this.hostname||"";var B=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!B)for(var T=this.hostname.split(/\./),E=(_=0,T.length);_<E;_++){var I=T[_];if(I&&!I.match(th)){for(var D="",$=0,ee=I.length;$<ee;$++)I.charCodeAt($)>127?D+="x":D+=I[$];if(!D.match(th)){var Y=T.slice(0,_),ce=T.slice(_+1),re=I.match(zE);re&&(Y.push(re[1]),ce.unshift(re[2])),ce.length&&(i="/"+ce.join(".")+i),this.hostname=Y.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),B||(this.hostname=ZE.toASCII(this.hostname));var Q=this.port?":"+this.port:"",Ie=this.hostname||"";this.host=Ie+Q,this.href+=this.host,B&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),i[0]!=="/"&&(i="/"+i))}if(!qE[c])for(_=0,E=ba.length;_<E;_++){var Le=ba[_];if(i.indexOf(Le)!==-1){var Xe=encodeURIComponent(Le);Xe===Le&&(Xe=escape(Le)),i=i.split(Le).join(Xe)}}var Fe=i.indexOf("#");Fe!==-1&&(this.hash=i.substr(Fe),i=i.slice(0,Fe));var ze=i.indexOf("?");if(ze!==-1?(this.search=i.substr(ze),this.query=i.substr(ze+1),e&&(this.query=va.parse(this.query)),i=i.slice(0,ze)):e&&(this.search="",this.query={}),i&&(this.pathname=i),fr[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){Q=this.pathname||"";var pt=this.search||"";this.path=Q+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||"",s=!1,o="";this.host?s=t+this.host:this.hostname&&(s=t+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&Kt.isObject(this.query)&&Object.keys(this.query).length&&(o=va.stringify(this.query));var i=this.search||o&&"?"+o||"";return e&&e.substr(-1)!==":"&&(e+=":"),this.slashes||(!e||fr[e])&&s!==!1?(s="//"+(s||""),n&&n.charAt(0)!=="/"&&(n="/"+n)):s||(s=""),r&&r.charAt(0)!=="#"&&(r="#"+r),i&&i.charAt(0)!=="?"&&(i="?"+i),e+s+(n=n.replace(/[?#]/g,(function(a){return encodeURIComponent(a)})))+(i=i.replace("#","%23"))+r},Bt.prototype.resolve=function(t){return this.resolveObject(ni(t,!1,!0)).format()},Bt.prototype.resolveObject=function(t){if(Kt.isString(t)){var e=new Bt;e.parse(t,!1,!0),t=e}for(var n=new Bt,r=Object.keys(this),s=0;s<r.length;s++){var o=r[s];n[o]=this[o]}if(n.hash=t.hash,t.href==="")return n.href=n.format(),n;if(t.slashes&&!t.protocol){for(var i=Object.keys(t),a=0;a<i.length;a++){var l=i[a];l!=="protocol"&&(n[l]=t[l])}return fr[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(t.protocol&&t.protocol!==n.protocol){if(!fr[t.protocol]){for(var c=Object.keys(t),f=0;f<c.length;f++){var g=c[f];n[g]=t[g]}return n.href=n.format(),n}if(n.protocol=t.protocol,t.host||Ta[t.protocol])n.pathname=t.pathname;else{for(var p=(t.pathname||"").split("/");p.length&&!(t.host=p.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),p[0]!==""&&p.unshift(""),p.length<2&&p.unshift(""),n.pathname=p.join("/")}if(n.search=t.search,n.query=t.query,n.host=t.host||"",n.auth=t.auth,n.hostname=t.hostname||t.host,n.port=t.port,n.pathname||n.search){var h=n.pathname||"",_=n.search||"";n.path=h+_}return n.slashes=n.slashes||t.slashes,n.href=n.format(),n}var P=n.pathname&&n.pathname.charAt(0)==="/",B=t.host||t.pathname&&t.pathname.charAt(0)==="/",T=B||P||n.host&&t.pathname,E=T,I=n.pathname&&n.pathname.split("/")||[],D=(p=t.pathname&&t.pathname.split("/")||[],n.protocol&&!fr[n.protocol]);if(D&&(n.hostname="",n.port=null,n.host&&(I[0]===""?I[0]=n.host:I.unshift(n.host)),n.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(p[0]===""?p[0]=t.host:p.unshift(t.host)),t.host=null),T=T&&(p[0]===""||I[0]==="")),B)n.host=t.host||t.host===""?t.host:n.host,n.hostname=t.hostname||t.hostname===""?t.hostname:n.hostname,n.search=t.search,n.query=t.query,I=p;else if(p.length)I||(I=[]),I.pop(),I=I.concat(p),n.search=t.search,n.query=t.query;else if(!Kt.isNullOrUndefined(t.search))return D&&(n.hostname=n.host=I.shift(),(re=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=re.shift(),n.host=n.hostname=re.shift())),n.search=t.search,n.query=t.query,Kt.isNull(n.pathname)&&Kt.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n;if(!I.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var $=I.slice(-1)[0],ee=(n.host||t.host||I.length>1)&&($==="."||$==="..")||$==="",Y=0,ce=I.length;ce>=0;ce--)($=I[ce])==="."?I.splice(ce,1):$===".."?(I.splice(ce,1),Y++):Y&&(I.splice(ce,1),Y--);if(!T&&!E)for(;Y--;Y)I.unshift("..");!T||I[0]===""||I[0]&&I[0].charAt(0)==="/"||I.unshift(""),ee&&I.join("/").substr(-1)!=="/"&&I.push("");var re,Q=I[0]===""||I[0]&&I[0].charAt(0)==="/";return D&&(n.hostname=n.host=Q?"":I.length?I.shift():"",(re=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=re.shift(),n.host=n.hostname=re.shift())),(T=T||n.host&&I.length)&&!Q&&I.unshift(""),I.length?n.pathname=I.join("/"):(n.pathname=null,n.path=null),Kt.isNull(n.pathname)&&Kt.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=KE.exec(t);e&&((e=e[0])!==":"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};Ce.Url;Ce.format;Ce.resolve;Ce.resolveObject;_a={},nh=!1;rh=GE(),VE=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;Ce.URL=typeof URL<"u"?URL:null;Ce.pathToFileURL=uS;Ce.fileURLToPath=oS;Ce.Url;Ce.format;Ce.resolve;Ce.resolveObject;Ce.URL;JE=92,YE=47,XE=97,QE=122,wa=VE==="win32",eS=/\//g,tS=/%/g,nS=/\\/g,rS=/\n/g,iS=/\r/g,sS=/\t/g;cS=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;Ce.URL=typeof URL<"u"?URL:null;Ce.pathToFileURL=PS;Ce.fileURLToPath=bS;Ce.Url;Ce.format;Ce.resolve;Ce.resolveObject;Ce.parse;Ce.URL;dS=92,fS=47,pS=97,gS=122,xa=cS==="win32",mS=/\//g,yS=/%/g,hS=/\\/g,TS=/\n/g,vS=/\r/g,_S=/\t/g});var jh={};bn(jh,{Agent:()=>NS,ClientRequest:()=>DS,IncomingMessage:()=>HS,METHODS:()=>US,STATUS_CODES:()=>jS,default:()=>un,get:()=>$S,globalAgent:()=>ZS,request:()=>LS});function Ah(){if(ah)return wt;ah=!0,wt.fetch=r(Gn.fetch)&&r(Gn.ReadableStream),wt.writableStream=r(Gn.WritableStream),wt.abortController=r(Gn.AbortController);var t;function e(){if(t!==void 0)return t;if(Gn.XMLHttpRequest){t=new Gn.XMLHttpRequest;try{t.open("GET",Gn.XDomainRequest?"/":"https://example.com")}catch{t=null}}else t=null;return t}function n(s){var o=e();if(!o)return!1;try{return o.responseType=s,o.responseType===s}catch{}return!1}wt.arraybuffer=wt.fetch||n("arraybuffer"),wt.msstream=!wt.fetch&&n("ms-stream"),wt.mozchunkedarraybuffer=!wt.fetch&&n("moz-chunked-arraybuffer"),wt.overrideMimeType=wt.fetch||(e()?r(e().overrideMimeType):!1);function r(s){return typeof s=="function"}return t=null,wt}function Ch(){return lh||(lh=!0,Pa=yt.EventEmitter),Pa}function BS(){if(uh)return Ba;uh=!0;function t(_,P){var B=Object.keys(_);if(Object.getOwnPropertySymbols){var T=Object.getOwnPropertySymbols(_);P&&(T=T.filter(function(E){return Object.getOwnPropertyDescriptor(_,E).enumerable})),B.push.apply(B,T)}return B}function e(_){for(var P=1;P<arguments.length;P++){var B=arguments[P]!=null?arguments[P]:{};P%2?t(Object(B),!0).forEach(function(T){n(_,T,B[T])}):Object.getOwnPropertyDescriptors?Object.defineProperties(_,Object.getOwnPropertyDescriptors(B)):t(Object(B)).forEach(function(T){Object.defineProperty(_,T,Object.getOwnPropertyDescriptor(B,T))})}return _}function n(_,P,B){return P=i(P),P in _?Object.defineProperty(_,P,{value:B,enumerable:!0,configurable:!0,writable:!0}):_[P]=B,_}function r(_,P){if(!(_ instanceof P))throw new TypeError("Cannot call a class as a function")}function s(_,P){for(var B=0;B<P.length;B++){var T=P[B];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(_,i(T.key),T)}}function o(_,P,B){return P&&s(_.prototype,P),Object.defineProperty(_,"prototype",{writable:!1}),_}function i(_){var P=a(_,"string");return typeof P=="symbol"?P:String(P)}function a(_,P){if(typeof _!="object"||_===null)return _;var B=_[Symbol.toPrimitive];if(B!==void 0){var T=B.call(_,P||"default");if(typeof T!="object")return T;throw new TypeError("@@toPrimitive must return a primitive value.")}return(P==="string"?String:Number)(_)}var l=Ut(),c=l.Buffer,f=L,g=f.inspect,p=g&&g.custom||"inspect";function h(_,P,B){c.prototype.copy.call(_,P,B)}return Ba=(function(){function _(){r(this,_),this.head=null,this.tail=null,this.length=0}return o(_,[{key:"push",value:function(B){var T={data:B,next:null};this.length>0?this.tail.next=T:this.head=T,this.tail=T,++this.length}},{key:"unshift",value:function(B){var T={data:B,next:this.head};this.length===0&&(this.tail=T),this.head=T,++this.length}},{key:"shift",value:function(){if(this.length!==0){var B=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,B}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(B){if(this.length===0)return"";for(var T=this.head,E=""+T.data;T=T.next;)E+=B+T.data;return E}},{key:"concat",value:function(B){if(this.length===0)return c.alloc(0);for(var T=c.allocUnsafe(B>>>0),E=this.head,I=0;E;)h(E.data,T,I),I+=E.data.length,E=E.next;return T}},{key:"consume",value:function(B,T){var E;return B<this.head.data.length?(E=this.head.data.slice(0,B),this.head.data=this.head.data.slice(B)):B===this.head.data.length?E=this.shift():E=T?this._getString(B):this._getBuffer(B),E}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(B){var T=this.head,E=1,I=T.data;for(B-=I.length;T=T.next;){var D=T.data,$=B>D.length?D.length:B;if($===D.length?I+=D:I+=D.slice(0,B),B-=$,B===0){$===D.length?(++E,T.next?this.head=T.next:this.head=this.tail=null):(this.head=T,T.data=D.slice($));break}++E}return this.length-=E,I}},{key:"_getBuffer",value:function(B){var T=c.allocUnsafe(B),E=this.head,I=1;for(E.data.copy(T),B-=E.data.length;E=E.next;){var D=E.data,$=B>D.length?D.length:B;if(D.copy(T,T.length-B,0,$),B-=$,B===0){$===D.length?(++I,E.next?this.head=E.next:this.head=this.tail=null):(this.head=E,E.data=D.slice($));break}++I}return this.length-=I,T}},{key:p,value:function(B,T){return g(this,e(e({},T),{},{depth:0,customInspect:!1}))}}]),_})(),Ba}function Oh(){if(ch)return Ia;ch=!0;var t=Rt;function e(a,l){var c=this,f=this._readableState&&this._readableState.destroyed,g=this._writableState&&this._writableState.destroyed;return f||g?(l?l(a):a&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(o,this,a)):t.nextTick(o,this,a)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(a||null,function(p){!l&&p?c._writableState?c._writableState.errorEmitted?t.nextTick(r,c):(c._writableState.errorEmitted=!0,t.nextTick(n,c,p)):t.nextTick(n,c,p):l?(t.nextTick(r,c),l(p)):t.nextTick(r,c)}),this)}function n(a,l){o(a,l),r(a)}function r(a){a._writableState&&!a._writableState.emitClose||a._readableState&&!a._readableState.emitClose||a.emit("close")}function s(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function o(a,l){a.emit("error",l)}function i(a,l){var c=a._readableState,f=a._writableState;c&&c.autoDestroy||f&&f.autoDestroy?a.destroy(l):a.emit("error",l)}return Ia={destroy:e,undestroy:s,errorOrDestroy:i},Ia}function mr(){if(dh)return Ea;dh=!0;let t={};function e(i,a,l){l||(l=Error);function c(g,p,h){return typeof a=="string"?a:a(g,p,h)}class f extends l{constructor(p,h,_){super(c(p,h,_))}}f.prototype.name=l.name,f.prototype.code=i,t[i]=f}function n(i,a){if(Array.isArray(i)){let l=i.length;return i=i.map(c=>String(c)),l>2?`one of ${a} ${i.slice(0,l-1).join(", ")}, or `+i[l-1]:l===2?`one of ${a} ${i[0]} or ${i[1]}`:`of ${a} ${i[0]}`}else return`of ${a} ${String(i)}`}function r(i,a,l){return i.substr(0,a.length)===a}function s(i,a,l){return(l===void 0||l>i.length)&&(l=i.length),i.substring(l-a.length,l)===a}function o(i,a,l){return typeof l!="number"&&(l=0),l+a.length>i.length?!1:i.indexOf(a,l)!==-1}return e("ERR_INVALID_OPT_VALUE",function(i,a){return'The value "'+a+'" is invalid for option "'+i+'"'},TypeError),e("ERR_INVALID_ARG_TYPE",function(i,a,l){let c;typeof a=="string"&&r(a,"not ")?(c="must not be",a=a.replace(/^not /,"")):c="must be";let f;if(s(i," argument"))f=`The ${i} ${c} ${n(a,"type")}`;else{let g=o(i,".")?"property":"argument";f=`The "${i}" ${g} ${c} ${n(a,"type")}`}return f+=`. Received type ${typeof l}`,f},TypeError),e("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),e("ERR_METHOD_NOT_IMPLEMENTED",function(i){return"The "+i+" method is not implemented"}),e("ERR_STREAM_PREMATURE_CLOSE","Premature close"),e("ERR_STREAM_DESTROYED",function(i){return"Cannot call "+i+" after a stream was destroyed"}),e("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),e("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),e("ERR_STREAM_WRITE_AFTER_END","write after end"),e("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),e("ERR_UNKNOWN_ENCODING",function(i){return"Unknown encoding: "+i},TypeError),e("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),Ea.codes=t,Ea}function Rh(){if(fh)return Sa;fh=!0;var t=mr().codes.ERR_INVALID_OPT_VALUE;function e(r,s,o){return r.highWaterMark!=null?r.highWaterMark:s?r[o]:null}function n(r,s,o,i){var a=e(s,i,o);if(a!=null){if(!(isFinite(a)&&Math.floor(a)===a)||a<0){var l=i?o:"highWaterMark";throw new t(l,a)}return Math.floor(a)}return r.objectMode?16:16*1024}return Sa={getHighWaterMark:n},Sa}function Mh(){if(ph)return ka;ph=!0;var t=Rt;ka=re;function e(R){var C=this;this.next=null,this.entry=null,this.finish=function(){ge(C,R)}}var n;re.WritableState=Y;var r={deprecate:Zy()},s=Ch(),o=Ut().Buffer,i=(typeof gh<"u"?gh:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function a(R){return o.from(R)}function l(R){return o.isBuffer(R)||R instanceof i}var c=Oh(),f=Rh(),g=f.getHighWaterMark,p=mr().codes,h=p.ERR_INVALID_ARG_TYPE,_=p.ERR_METHOD_NOT_IMPLEMENTED,P=p.ERR_MULTIPLE_CALLBACK,B=p.ERR_STREAM_CANNOT_PIPE,T=p.ERR_STREAM_DESTROYED,E=p.ERR_STREAM_NULL_VALUES,I=p.ERR_STREAM_WRITE_AFTER_END,D=p.ERR_UNKNOWN_ENCODING,$=c.errorOrDestroy;Zt()(re,s);function ee(){}function Y(R,C,j){n=n||gr(),R=R||{},typeof j!="boolean"&&(j=C instanceof n),this.objectMode=!!R.objectMode,j&&(this.objectMode=this.objectMode||!!R.writableObjectMode),this.highWaterMark=g(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(te){Re(C,te)},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)}Y.prototype.getBuffer=function(){for(var C=this.bufferedRequest,j=[];C;)j.push(C),C=C.next;return j},(function(){try{Object.defineProperty(Y.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(re,Symbol.hasInstance,{value:function(C){return ce.call(this,C)?!0:this!==re?!1:C&&C._writableState instanceof Y}})):ce=function(C){return C instanceof this};function re(R){n=n||gr();var C=this instanceof n;if(!C&&!ce.call(re,this))return new re(R);this._writableState=new Y(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)),s.call(this)}re.prototype.pipe=function(){$(this,new B)};function Q(R,C){var j=new I;$(R,j),t.nextTick(C,j)}function Ie(R,C,j,V){var te;return j===null?te=new E:typeof j!="string"&&!C.objectMode&&(te=new h("chunk",["string","Buffer"],j)),te?($(R,te),t.nextTick(V,te),!1):!0}re.prototype.write=function(R,C,j){var V=this._writableState,te=!1,b=!V.objectMode&&l(R);return b&&!o.isBuffer(R)&&(R=a(R)),typeof C=="function"&&(j=C,C=null),b?C="buffer":C||(C=V.defaultEncoding),typeof j!="function"&&(j=ee),V.ending?Q(this,j):(b||Ie(this,V,R,j))&&(V.pendingcb++,te=Xe(this,V,b,R,C,j)),te},re.prototype.cork=function(){this._writableState.corked++},re.prototype.uncork=function(){var R=this._writableState;R.corked&&(R.corked--,!R.writing&&!R.corked&&!R.bufferProcessing&&R.bufferedRequest&&oe(this,R))},re.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(re.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function Le(R,C,j){return!R.objectMode&&R.decodeStrings!==!1&&typeof C=="string"&&(C=o.from(C,j)),C}Object.defineProperty(re.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Xe(R,C,j,V,te,b){if(!j){var x=Le(C,V,te);V!==x&&(j=!0,te="buffer",V=x)}var F=C.objectMode?1:V.length;C.length+=F;var J=C.length<C.highWaterMark;if(J||(C.needDrain=!0),C.writing||C.corked){var Se=C.lastBufferedRequest;C.lastBufferedRequest={chunk:V,encoding:te,isBuf:j,callback:b,next:null},Se?Se.next=C.lastBufferedRequest:C.bufferedRequest=C.lastBufferedRequest,C.bufferedRequestCount+=1}else Fe(R,C,!1,F,V,te,b);return J}function Fe(R,C,j,V,te,b,x){C.writelen=V,C.writecb=x,C.writing=!0,C.sync=!0,C.destroyed?C.onwrite(new T("write")):j?R._writev(te,C.onwrite):R._write(te,b,C.onwrite),C.sync=!1}function ze(R,C,j,V,te){--C.pendingcb,j?(t.nextTick(te,V),t.nextTick(K,R,C),R._writableState.errorEmitted=!0,$(R,V)):(te(V),R._writableState.errorEmitted=!0,$(R,V),K(R,C))}function pt(R){R.writing=!1,R.writecb=null,R.length-=R.writelen,R.writelen=0}function Re(R,C){var j=R._writableState,V=j.sync,te=j.writecb;if(typeof te!="function")throw new P;if(pt(j),C)ze(R,j,V,C,te);else{var b=de(j)||R.destroyed;!b&&!j.corked&&!j.bufferProcessing&&j.bufferedRequest&&oe(R,j),V?t.nextTick(ve,R,j,b,te):ve(R,j,b,te)}}function ve(R,C,j,V){j||we(R,C),C.pendingcb--,V(),K(R,C)}function we(R,C){C.length===0&&C.needDrain&&(C.needDrain=!1,R.emit("drain"))}function oe(R,C){C.bufferProcessing=!0;var j=C.bufferedRequest;if(R._writev&&j&&j.next){var V=C.bufferedRequestCount,te=new Array(V),b=C.corkedRequestsFree;b.entry=j;for(var x=0,F=!0;j;)te[x]=j,j.isBuf||(F=!1),j=j.next,x+=1;te.allBuffers=F,Fe(R,C,!0,C.length,te,"",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 J=j.chunk,Se=j.encoding,me=j.callback,U=C.objectMode?1:J.length;if(Fe(R,C,!1,U,J,Se,me),j=j.next,C.bufferedRequestCount--,C.writing)break}j===null&&(C.lastBufferedRequest=null)}C.bufferedRequest=j,C.bufferProcessing=!1}re.prototype._write=function(R,C,j){j(new _("_write()"))},re.prototype._writev=null,re.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(re.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"),K(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 K(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,K(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 te=V.callback;C.pendingcb--,te(j),V=V.next}C.corkedRequestsFree.next=R}return Object.defineProperty(re.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(C){this._writableState&&(this._writableState.destroyed=C)}}),re.prototype.destroy=c.destroy,re.prototype._undestroy=c.undestroy,re.prototype._destroy=function(R,C){C(R)},ka}function gr(){if(mh)return Aa;mh=!0;var t=Rt,e=Object.keys||function(f){var g=[];for(var p in f)g.push(p);return g};Aa=a;var n=Nh(),r=Mh();Zt()(a,n);for(var s=e(r.prototype),o=0;o<s.length;o++){var i=s[o];a.prototype[i]||(a.prototype[i]=r.prototype[i])}function a(f){if(!(this instanceof a))return new a(f);n.call(this,f),r.call(this,f),this.allowHalfOpen=!0,f&&(f.readable===!1&&(this.readable=!1),f.writable===!1&&(this.writable=!1),f.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",l)))}Object.defineProperty(a.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(a.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(a.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function l(){this._writableState.ended||t.nextTick(c,this)}function c(f){f.end()}return Object.defineProperty(a.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(g){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=g,this._writableState.destroyed=g)}}),Aa}function La(){if(yh)return Ca;yh=!0;var t=mr().codes.ERR_STREAM_PREMATURE_CLOSE;function e(o){var i=!1;return function(){if(!i){i=!0;for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];o.apply(this,l)}}}function n(){}function r(o){return o.setHeader&&typeof o.abort=="function"}function s(o,i,a){if(typeof i=="function")return s(o,null,i);i||(i={}),a=e(a||n);var l=i.readable||i.readable!==!1&&o.readable,c=i.writable||i.writable!==!1&&o.writable,f=function(){o.writable||p()},g=o._writableState&&o._writableState.finished,p=function(){c=!1,g=!0,l||a.call(o)},h=o._readableState&&o._readableState.endEmitted,_=function(){l=!1,h=!0,c||a.call(o)},P=function(I){a.call(o,I)},B=function(){var I;if(l&&!h)return(!o._readableState||!o._readableState.ended)&&(I=new t),a.call(o,I);if(c&&!g)return(!o._writableState||!o._writableState.ended)&&(I=new t),a.call(o,I)},T=function(){o.req.on("finish",p)};return r(o)?(o.on("complete",p),o.on("abort",B),o.req?T():o.on("request",T)):c&&!o._writableState&&(o.on("end",f),o.on("close",f)),o.on("end",_),o.on("finish",p),i.error!==!1&&o.on("error",P),o.on("close",B),function(){o.removeListener("complete",p),o.removeListener("abort",B),o.removeListener("request",T),o.req&&o.req.removeListener("finish",p),o.removeListener("end",f),o.removeListener("close",f),o.removeListener("finish",p),o.removeListener("end",_),o.removeListener("error",P),o.removeListener("close",B)}}return Ca=s,Ca}function IS(){if(hh)return Oa;hh=!0;var t=Rt,e;function n(D,$,ee){return $=r($),$ in D?Object.defineProperty(D,$,{value:ee,enumerable:!0,configurable:!0,writable:!0}):D[$]=ee,D}function r(D){var $=s(D,"string");return typeof $=="symbol"?$:String($)}function s(D,$){if(typeof D!="object"||D===null)return D;var ee=D[Symbol.toPrimitive];if(ee!==void 0){var Y=ee.call(D,$||"default");if(typeof Y!="object")return Y;throw new TypeError("@@toPrimitive must return a primitive value.")}return($==="string"?String:Number)(D)}var o=La(),i=Symbol("lastResolve"),a=Symbol("lastReject"),l=Symbol("error"),c=Symbol("ended"),f=Symbol("lastPromise"),g=Symbol("handlePromise"),p=Symbol("stream");function h(D,$){return{value:D,done:$}}function _(D){var $=D[i];if($!==null){var ee=D[p].read();ee!==null&&(D[f]=null,D[i]=null,D[a]=null,$(h(ee,!1)))}}function P(D){t.nextTick(_,D)}function B(D,$){return function(ee,Y){D.then(function(){if($[c]){ee(h(void 0,!0));return}$[g](ee,Y)},Y)}}var T=Object.getPrototypeOf(function(){}),E=Object.setPrototypeOf((e={get stream(){return this[p]},next:function(){var $=this,ee=this[l];if(ee!==null)return Promise.reject(ee);if(this[c])return Promise.resolve(h(void 0,!0));if(this[p].destroyed)return new Promise(function(Q,Ie){t.nextTick(function(){$[l]?Ie($[l]):Q(h(void 0,!0))})});var Y=this[f],ce;if(Y)ce=new Promise(B(Y,this));else{var re=this[p].read();if(re!==null)return Promise.resolve(h(re,!1));ce=new Promise(this[g])}return this[f]=ce,ce}},n(e,Symbol.asyncIterator,function(){return this}),n(e,"return",function(){var $=this;return new Promise(function(ee,Y){$[p].destroy(null,function(ce){if(ce){Y(ce);return}ee(h(void 0,!0))})})}),e),T),I=function($){var ee,Y=Object.create(E,(ee={},n(ee,p,{value:$,writable:!0}),n(ee,i,{value:null,writable:!0}),n(ee,a,{value:null,writable:!0}),n(ee,l,{value:null,writable:!0}),n(ee,c,{value:$._readableState.endEmitted,writable:!0}),n(ee,g,{value:function(re,Q){var Ie=Y[p].read();Ie?(Y[f]=null,Y[i]=null,Y[a]=null,re(h(Ie,!1))):(Y[i]=re,Y[a]=Q)},writable:!0}),ee));return Y[f]=null,o($,function(ce){if(ce&&ce.code!=="ERR_STREAM_PREMATURE_CLOSE"){var re=Y[a];re!==null&&(Y[f]=null,Y[i]=null,Y[a]=null,re(ce)),Y[l]=ce;return}var Q=Y[i];Q!==null&&(Y[f]=null,Y[i]=null,Y[a]=null,Q(h(void 0,!0))),Y[c]=!0}),$.on("readable",P.bind(null,Y)),Y};return Oa=I,Oa}function ES(){return Th||(Th=!0,Ra=function(){throw new Error("Readable.from is not available in the browser")}),Ra}function Nh(){if(vh)return Ma;vh=!0;var t=Rt;Ma=Q;var e;Q.ReadableState=re,yt.EventEmitter;var n=function(x,F){return x.listeners(F).length},r=Ch(),s=Ut().Buffer,o=(typeof _h<"u"?_h:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function i(b){return s.from(b)}function a(b){return s.isBuffer(b)||b instanceof o}var l=L,c;l&&l.debuglog?c=l.debuglog("stream"):c=function(){};var f=BS(),g=Oh(),p=Rh(),h=p.getHighWaterMark,_=mr().codes,P=_.ERR_INVALID_ARG_TYPE,B=_.ERR_STREAM_PUSH_AFTER_EOF,T=_.ERR_METHOD_NOT_IMPLEMENTED,E=_.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,I,D,$;Zt()(Q,r);var ee=g.errorOrDestroy,Y=["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 re(b,x,F){e=e||gr(),b=b||{},typeof F!="boolean"&&(F=x instanceof e),this.objectMode=!!b.objectMode,F&&(this.objectMode=this.objectMode||!!b.readableObjectMode),this.highWaterMark=h(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&&(I||(I=ei.StringDecoder),this.decoder=new I(b.encoding),this.encoding=b.encoding)}function Q(b){if(e=e||gr(),!(this instanceof Q))return new Q(b);var x=this instanceof e;this._readableState=new re(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(Q.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(x){this._readableState&&(this._readableState.destroyed=x)}}),Q.prototype.destroy=g.destroy,Q.prototype._undestroy=g.undestroy,Q.prototype._destroy=function(b,x){x(b)},Q.prototype.push=function(b,x){var F=this._readableState,J;return F.objectMode?J=!0:typeof b=="string"&&(x=x||F.defaultEncoding,x!==F.encoding&&(b=s.from(b,x),x=""),J=!0),Ie(this,b,x,!1,J)},Q.prototype.unshift=function(b){return Ie(this,b,null,!0,!1)};function Ie(b,x,F,J,Se){c("readableAddChunk",x);var me=b._readableState;if(x===null)me.reading=!1,Re(b,me);else{var U;if(Se||(U=Xe(me,x)),U)ee(b,U);else if(me.objectMode||x&&x.length>0)if(typeof x!="string"&&!me.objectMode&&Object.getPrototypeOf(x)!==s.prototype&&(x=i(x)),J)me.endEmitted?ee(b,new E):Le(b,me,x,!0);else if(me.ended)ee(b,new B);else{if(me.destroyed)return!1;me.reading=!1,me.decoder&&!F?(x=me.decoder.write(x),me.objectMode||x.length!==0?Le(b,me,x,!1):oe(b,me)):Le(b,me,x,!1)}else J||(me.reading=!1,oe(b,me))}return!me.ended&&(me.length<me.highWaterMark||me.length===0)}function Le(b,x,F,J){x.flowing&&x.length===0&&!x.sync?(x.awaitDrain=0,b.emit("data",F)):(x.length+=x.objectMode?1:F.length,J?x.buffer.unshift(F):x.buffer.push(F),x.needReadable&&ve(b)),oe(b,x)}function Xe(b,x){var F;return!a(x)&&typeof x!="string"&&x!==void 0&&!b.objectMode&&(F=new P("chunk",["string","Buffer","Uint8Array"],x)),F}Q.prototype.isPaused=function(){return this._readableState.flowing===!1},Q.prototype.setEncoding=function(b){I||(I=ei.StringDecoder);var x=new I(b);this._readableState.decoder=x,this._readableState.encoding=this._readableState.decoder.encoding;for(var F=this._readableState.buffer.head,J="";F!==null;)J+=x.write(F.data),F=F.next;return this._readableState.buffer.clear(),J!==""&&this._readableState.buffer.push(J),this._readableState.length=J.length,this};var Fe=1073741824;function ze(b){return b>=Fe?b=Fe:(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=ze(b)),b<=x.length?b:x.ended?x.length:(x.needReadable=!0,0))}Q.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 J=x.needReadable;c("need readable",J),(x.length===0||x.length-b<x.highWaterMark)&&(J=!0,c("length less than watermark",J)),x.ended||x.reading?(J=!1,c("reading or ended",J)):J&&(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 Se;return b>0?Se=C(b,x):Se=null,Se===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)),Se!==null&&this.emit("data",Se),Se};function Re(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 oe(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}Q.prototype._read=function(b){ee(this,new T("_read()"))},Q.prototype.pipe=function(b,x){var F=this,J=this._readableState;switch(J.pipesCount){case 0:J.pipes=b;break;case 1:J.pipes=[J.pipes,b];break;default:J.pipes.push(b);break}J.pipesCount+=1,c("pipe count=%d opts=%j",J.pipesCount,x);var Se=(!x||x.end!==!1)&&b!==t.stdout&&b!==t.stderr,me=Se?kt:u;J.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,Tr())}function kt(){c("onend"),b.end()}var Ht=N(F);b.on("drain",Ht);var vt=!1;function Tr(){c("cleanup"),b.removeListener("close",vr),b.removeListener("finish",y),b.removeListener("drain",Ht),b.removeListener("error",xt),b.removeListener("unpipe",U),F.removeListener("end",kt),F.removeListener("end",u),F.removeListener("data",ci),vt=!0,J.awaitDrain&&(!b._writableState||b._writableState.needDrain)&&Ht()}F.on("data",ci);function ci(d){c("ondata");var v=b.write(d);c("dest.write",v),v===!1&&((J.pipesCount===1&&J.pipes===b||J.pipesCount>1&&te(J.pipes,b)!==-1)&&!vt&&(c("false write response, pause",J.awaitDrain),J.awaitDrain++),F.pause())}function xt(d){c("onerror",d),u(),b.removeListener("error",xt),n(b,"error")===0&&ee(b,d)}ce(b,"error",xt);function vr(){b.removeListener("finish",y),u()}b.once("close",vr);function y(){c("onfinish"),b.removeListener("close",vr),u()}b.once("finish",y);function u(){c("unpipe"),F.unpipe(b)}return b.emit("pipe",F),J.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))}}Q.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 J=x.pipes,Se=x.pipesCount;x.pipes=null,x.pipesCount=0,x.flowing=!1;for(var me=0;me<Se;me++)J[me].emit("unpipe",this,{hasUnpiped:!1});return this}var U=te(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)},Q.prototype.on=function(b,x){var F=r.prototype.on.call(this,b,x),J=this._readableState;return b==="data"?(J.readableListening=this.listenerCount("readable")>0,J.flowing!==!1&&this.resume()):b==="readable"&&!J.endEmitted&&!J.readableListening&&(J.readableListening=J.needReadable=!0,J.flowing=!1,J.emittedReadable=!1,c("on readable",J.length,J.reading),J.length?ve(this):J.reading||t.nextTick(K,this)),F},Q.prototype.addListener=Q.prototype.on,Q.prototype.removeListener=function(b,x){var F=r.prototype.removeListener.call(this,b,x);return b==="readable"&&t.nextTick(Z,this),F},Q.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 K(b){c("readable nexttick read 0"),b.read(0)}Q.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)}Q.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;);}Q.prototype.wrap=function(b){var x=this,F=this._readableState,J=!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 kt=x.push(U);kt||(J=!0,b.pause())}});for(var Se in b)this[Se]===void 0&&typeof b[Se]=="function"&&(this[Se]=(function(kt){return function(){return b[kt].apply(b,arguments)}})(Se));for(var me=0;me<Y.length;me++)b.on(Y[me],this.emit.bind(this,Y[me]));return this._read=function(U){c("wrapped _read",U),J&&(J=!1,b.resume())},this},typeof Symbol=="function"&&(Q.prototype[Symbol.asyncIterator]=function(){return D===void 0&&(D=IS()),D(this)}),Object.defineProperty(Q.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(Q.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(Q.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(x){this._readableState&&(this._readableState.flowing=x)}}),Q._fromList=C,Object.defineProperty(Q.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"&&(Q.from=function(b,x){return $===void 0&&($=ES()),$(Q,b,x)});function te(b,x){for(var F=0,J=b.length;F<J;F++)if(b[F]===x)return F;return-1}return Ma}function Dh(){if(bh)return Na;bh=!0,Na=a;var t=mr().codes,e=t.ERR_METHOD_NOT_IMPLEMENTED,n=t.ERR_MULTIPLE_CALLBACK,r=t.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=t.ERR_TRANSFORM_WITH_LENGTH_0,o=gr();Zt()(a,o);function i(f,g){var p=this._transformState;p.transforming=!1;var h=p.writecb;if(h===null)return this.emit("error",new n);p.writechunk=null,p.writecb=null,g!=null&&this.push(g),h(f);var _=this._readableState;_.reading=!1,(_.needReadable||_.length<_.highWaterMark)&&this._read(_.highWaterMark)}function a(f){if(!(this instanceof a))return new a(f);o.call(this,f),this._transformState={afterTransform:i.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,f&&(typeof f.transform=="function"&&(this._transform=f.transform),typeof f.flush=="function"&&(this._flush=f.flush)),this.on("prefinish",l)}function l(){var f=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(g,p){c(f,g,p)}):c(this,null,null)}a.prototype.push=function(f,g){return this._transformState.needTransform=!1,o.prototype.push.call(this,f,g)},a.prototype._transform=function(f,g,p){p(new e("_transform()"))},a.prototype._write=function(f,g,p){var h=this._transformState;if(h.writecb=p,h.writechunk=f,h.writeencoding=g,!h.transforming){var _=this._readableState;(h.needTransform||_.needReadable||_.length<_.highWaterMark)&&this._read(_.highWaterMark)}},a.prototype._read=function(f){var g=this._transformState;g.writechunk!==null&&!g.transforming?(g.transforming=!0,this._transform(g.writechunk,g.writeencoding,g.afterTransform)):g.needTransform=!0},a.prototype._destroy=function(f,g){o.prototype._destroy.call(this,f,function(p){g(p)})};function c(f,g,p){if(g)return f.emit("error",g);if(p!=null&&f.push(p),f._writableState.length)throw new s;if(f._transformState.transforming)throw new r;return f.push(null)}return Na}function SS(){if(wh)return Da;wh=!0,Da=e;var t=Dh();Zt()(e,t);function e(n){if(!(this instanceof e))return new e(n);t.call(this,n)}return e.prototype._transform=function(n,r,s){s(null,n)},Da}function kS(){if(xh)return Ha;xh=!0;var t;function e(p){var h=!1;return function(){h||(h=!0,p.apply(void 0,arguments))}}var n=mr().codes,r=n.ERR_MISSING_ARGS,s=n.ERR_STREAM_DESTROYED;function o(p){if(p)throw p}function i(p){return p.setHeader&&typeof p.abort=="function"}function a(p,h,_,P){P=e(P);var B=!1;p.on("close",function(){B=!0}),t===void 0&&(t=La()),t(p,{readable:h,writable:_},function(E){if(E)return P(E);B=!0,P()});var T=!1;return function(E){if(!B&&!T){if(T=!0,i(p))return p.abort();if(typeof p.destroy=="function")return p.destroy();P(E||new s("pipe"))}}}function l(p){p()}function c(p,h){return p.pipe(h)}function f(p){return!p.length||typeof p[p.length-1]!="function"?o:p.pop()}function g(){for(var p=arguments.length,h=new Array(p),_=0;_<p;_++)h[_]=arguments[_];var P=f(h);if(Array.isArray(h[0])&&(h=h[0]),h.length<2)throw new r("streams");var B,T=h.map(function(E,I){var D=I<h.length-1,$=I>0;return a(E,D,$,function(ee){B||(B=ee),ee&&T.forEach(l),!D&&(T.forEach(l),P(B))})});return h.reduce(c)}return Ha=g,Ha}function Hh(){return Ph||(Ph=!0,Tt=Tt=Nh(),Tt.Stream=Tt,Tt.Readable=Tt,Tt.Writable=Mh(),Tt.Duplex=gr(),Tt.Transform=Dh(),Tt.PassThrough=SS(),Tt.finished=La(),Tt.pipeline=kS()),Tt}function Uh(){if(Bh)return Ts;Bh=!0;var t=Ut().Buffer,e=Rt,n=Ah(),r=Zt(),s=Hh(),o=Ts.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},i=Ts.IncomingMessage=function(a,l,c,f){var g=this||vs;if(s.Readable.call(g),g._mode=c,g.headers={},g.rawHeaders=[],g.trailers={},g.rawTrailers=[],g.on("end",function(){e.nextTick(function(){g.emit("close")})}),c==="fetch"){let T=function(){h.read().then(function(E){if(!g._destroyed){if(f(E.done),E.done){g.push(null);return}g.push(t.from(E.value)),T()}}).catch(function(E){f(!0),g._destroyed||g.emit("error",E)})};if(g._fetchResponse=l,g.url=l.url,g.statusCode=l.status,g.statusMessage=l.statusText,l.headers.forEach(function(E,I){g.headers[I.toLowerCase()]=E,g.rawHeaders.push(I,E)}),n.writableStream){var p=new WritableStream({write:function(E){return f(!1),new Promise(function(I,D){g._destroyed?D():g.push(t.from(E))?I():g._resumeFetch=I})},close:function(){f(!0),g._destroyed||g.push(null)},abort:function(E){f(!0),g._destroyed||g.emit("error",E)}});try{l.body.pipeTo(p).catch(function(E){f(!0),g._destroyed||g.emit("error",E)});return}catch{}}var h=l.body.getReader();T()}else{g._xhr=a,g._pos=0,g.url=a.responseURL,g.statusCode=a.status,g.statusMessage=a.statusText;var _=a.getAllResponseHeaders().split(/\r?\n/);if(_.forEach(function(T){var E=T.match(/^([^:]+):\s*(.*)/);if(E){var I=E[1].toLowerCase();I==="set-cookie"?(g.headers[I]===void 0&&(g.headers[I]=[]),g.headers[I].push(E[2])):g.headers[I]!==void 0?g.headers[I]+=", "+E[2]:g.headers[I]=E[2],g.rawHeaders.push(E[1],E[2])}}),g._charset="x-user-defined",!n.overrideMimeType){var P=g.rawHeaders["mime-type"];if(P){var B=P.match(/;\s*charset=([^;])(;|$)/);B&&(g._charset=B[1].toLowerCase())}g._charset||(g._charset="utf-8")}}};return r(i,s.Readable),i.prototype._read=function(){var a=this||vs,l=a._resumeFetch;l&&(a._resumeFetch=null,l())},i.prototype._onXHRProgress=function(a){var l=this||vs,c=l._xhr,f=null;switch(l._mode){case"text":if(f=c.responseText,f.length>l._pos){var g=f.substr(l._pos);if(l._charset==="x-user-defined"){for(var p=t.alloc(g.length),h=0;h<g.length;h++)p[h]=g.charCodeAt(h)&255;l.push(p)}else l.push(g,l._charset);l._pos=f.length}break;case"arraybuffer":if(c.readyState!==o.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!==o.LOADING||!f)break;l.push(t.from(new Uint8Array(f)));break;case"ms-stream":if(f=c.response,c.readyState!==o.LOADING)break;var _=new vs.MSStreamReader;_.onprogress=function(){_.result.byteLength>l._pos&&(l.push(t.from(new Uint8Array(_.result.slice(l._pos)))),l._pos=_.result.byteLength)},_.onload=function(){a(!0),l.push(null)},_.readAsArrayBuffer(f);break}l._xhr.readyState===o.DONE&&l._mode!=="ms-stream"&&(a(!0),l.push(null))},Ts}function AS(){if(Ih)return Ua;Ih=!0;var t=Ut().Buffer,e=Rt,n=Ah(),r=Zt(),s=Uh(),o=Hh(),i=s.IncomingMessage,a=s.readyStates;function l(p,h){return n.fetch&&h?"fetch":n.mozchunkedarraybuffer?"moz-chunked-arraybuffer":n.msstream?"ms-stream":n.arraybuffer&&p?"arraybuffer":"text"}var c=Ua=function(p){var h=this||rt;o.Writable.call(h),h._opts=p,h._body=[],h._headers={},p.auth&&h.setHeader("Authorization","Basic "+t.from(p.auth).toString("base64")),Object.keys(p.headers).forEach(function(B){h.setHeader(B,p.headers[B])});var _,P=!0;if(p.mode==="disable-fetch"||"requestTimeout"in p&&!n.abortController)P=!1,_=!0;else if(p.mode==="prefer-streaming")_=!1;else if(p.mode==="allow-wrong-content-type")_=!n.overrideMimeType;else if(!p.mode||p.mode==="default"||p.mode==="prefer-fast")_=!0;else throw new Error("Invalid value for opts.mode");h._mode=l(_,P),h._fetchTimer=null,h._socketTimeout=null,h._socketTimer=null,h.on("finish",function(){h._onFinish()})};r(c,o.Writable),c.prototype.setHeader=function(p,h){var _=this||rt,P=p.toLowerCase();g.indexOf(P)===-1&&(_._headers[P]={name:p,value:h})},c.prototype.getHeader=function(p){var h=(this||rt)._headers[p.toLowerCase()];return h?h.value:null},c.prototype.removeHeader=function(p){var h=this||rt;delete h._headers[p.toLowerCase()]},c.prototype._onFinish=function(){var p=this||rt;if(!p._destroyed){var h=p._opts;"timeout"in h&&h.timeout!==0&&p.setTimeout(h.timeout);var _=p._headers,P=null;h.method!=="GET"&&h.method!=="HEAD"&&(P=new Blob(p._body,{type:(_["content-type"]||{}).value||""}));var B=[];if(Object.keys(_).forEach(function(D){var $=_[D].name,ee=_[D].value;Array.isArray(ee)?ee.forEach(function(Y){B.push([$,Y])}):B.push([$,ee])}),p._mode==="fetch"){var T=null;if(n.abortController){var E=new AbortController;T=E.signal,p._fetchAbortController=E,"requestTimeout"in h&&h.requestTimeout!==0&&(p._fetchTimer=rt.setTimeout(function(){p.emit("requestTimeout"),p._fetchAbortController&&p._fetchAbortController.abort()},h.requestTimeout))}rt.fetch(p._opts.url,{method:p._opts.method,headers:B,body:P||void 0,mode:"cors",credentials:h.withCredentials?"include":"same-origin",signal:T}).then(function(D){p._fetchResponse=D,p._resetTimers(!1),p._connect()},function(D){p._resetTimers(!0),p._destroyed||p.emit("error",D)})}else{var I=p._xhr=new rt.XMLHttpRequest;try{I.open(p._opts.method,p._opts.url,!0)}catch(D){e.nextTick(function(){p.emit("error",D)});return}"responseType"in I&&(I.responseType=p._mode),"withCredentials"in I&&(I.withCredentials=!!h.withCredentials),p._mode==="text"&&"overrideMimeType"in I&&I.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in h&&(I.timeout=h.requestTimeout,I.ontimeout=function(){p.emit("requestTimeout")}),B.forEach(function(D){I.setRequestHeader(D[0],D[1])}),p._response=null,I.onreadystatechange=function(){switch(I.readyState){case a.LOADING:case a.DONE:p._onXHRProgress();break}},p._mode==="moz-chunked-arraybuffer"&&(I.onprogress=function(){p._onXHRProgress()}),I.onerror=function(){p._destroyed||(p._resetTimers(!0),p.emit("error",new Error("XHR error")))};try{I.send(P)}catch(D){e.nextTick(function(){p.emit("error",D)});return}}}};function f(p){try{var h=p.status;return h!==null&&h!==0}catch{return!1}}c.prototype._onXHRProgress=function(){var p=this||rt;p._resetTimers(!1),!(!f(p._xhr)||p._destroyed)&&(p._response||p._connect(),p._response._onXHRProgress(p._resetTimers.bind(p)))},c.prototype._connect=function(){var p=this||rt;p._destroyed||(p._response=new i(p._xhr,p._fetchResponse,p._mode,p._resetTimers.bind(p)),p._response.on("error",function(h){p.emit("error",h)}),p.emit("response",p._response))},c.prototype._write=function(p,h,_){var P=this||rt;P._body.push(p),_()},c.prototype._resetTimers=function(p){var h=this||rt;rt.clearTimeout(h._socketTimer),h._socketTimer=null,p?(rt.clearTimeout(h._fetchTimer),h._fetchTimer=null):h._socketTimeout&&(h._socketTimer=rt.setTimeout(function(){h.emit("timeout")},h._socketTimeout))},c.prototype.abort=c.prototype.destroy=function(p){var h=this||rt;h._destroyed=!0,h._resetTimers(!0),h._response&&(h._response._destroyed=!0),h._xhr?h._xhr.abort():h._fetchAbortController&&h._fetchAbortController.abort(),p&&h.emit("error",p)},c.prototype.end=function(p,h,_){var P=this||rt;typeof p=="function"&&(_=p,p=void 0),o.Writable.prototype.end.call(P,p,h,_)},c.prototype.setTimeout=function(p,h){var _=this||rt;h&&_.once("timeout",h),_._socketTimeout=p,_._resetTimers(!1)},c.prototype.flushHeaders=function(){},c.prototype.setNoDelay=function(){},c.prototype.setSocketKeepAlive=function(){};var g=["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 Ua}function CS(){if(Eh)return ja;Eh=!0,ja=e;var t=Object.prototype.hasOwnProperty;function e(){for(var n={},r=0;r<arguments.length;r++){var s=arguments[r];for(var o in s)t.call(s,o)&&(n[o]=s[o])}return n}return ja}function OS(){return Sh||(Sh=!0,$a={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"}),$a}function MS(){if(kh)return Za;kh=!0;var t=AS(),e=Uh(),n=CS(),r=OS(),s=Ce,o=Za;return o.request=function(i,a){typeof i=="string"?i=s.parse(i):i=n(i);var l=RS.location.protocol.search(/^https?:$/)===-1?"http:":"",c=i.protocol||l,f=i.hostname||i.host,g=i.port,p=i.path||"/";f&&f.indexOf(":")!==-1&&(f="["+f+"]"),i.url=(f?c+"//"+f:"")+(g?":"+g:"")+p,i.method=(i.method||"GET").toUpperCase(),i.headers=i.headers||{};var h=new t(i);return a&&h.on("response",a),h},o.get=function(a,l){var c=o.request(a,l);return c.end(),c},o.ClientRequest=t,o.IncomingMessage=e.IncomingMessage,o.Agent=function(){},o.Agent.defaultMaxSockets=4,o.globalAgent=new o.Agent,o.STATUS_CODES=r,o.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"],Za}var wt,ah,Gn,Pa,lh,Ba,uh,Ia,ch,Ea,dh,Sa,fh,ka,ph,gh,Aa,mh,Ca,yh,Oa,hh,Ra,Th,Ma,vh,_h,Na,bh,Da,wh,Ha,xh,Tt,Ph,Ts,Bh,vs,Ua,Ih,rt,ja,Eh,$a,Sh,Za,kh,RS,un,NS,DS,HS,US,jS,$S,ZS,LS,$h=it(()=>{S();A();k();qo();ty();Go();mi();Hy();ys();ca();Ly();Fy();oh();ma();wt={},ah=!1,Gn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Pa={},lh=!1;Ba={},uh=!1;Ia={},ch=!1;Ea={},dh=!1;Sa={},fh=!1;ka={},ph=!1,gh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Aa={},mh=!1;Ca={},yh=!1;Oa={},hh=!1;Ra={},Th=!1;Ma={},vh=!1,_h=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Na={},bh=!1;Da={},wh=!1;Ha={},xh=!1;Tt={},Ph=!1;Ts={},Bh=!1,vs=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ua={},Ih=!1,rt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;ja={},Eh=!1;$a={},Sh=!1;Za={},kh=!1,RS=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;un=MS(),NS=un.Agent,DS=un.ClientRequest,HS=un.IncomingMessage,US=un.METHODS,jS=un.STATUS_CODES,$S=un.get,ZS=un.globalAgent,LS=un.request});S();A();k();var Lm={};bn(Lm,{defaults:()=>LB,markdown:()=>$B,markdownBloc:()=>ZB});S();A();k();S();A();k();S();A();k();var so=Object.defineProperty,QT=Object.defineProperties,ev=Object.getOwnPropertyDescriptors,Ei=Object.getOwnPropertySymbols,Kc=Object.prototype.hasOwnProperty,Wc=Object.prototype.propertyIsEnumerable,ac=(t,e,n)=>e in t?so(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,w=(t,e)=>{for(var n in e||(e={}))Kc.call(e,n)&&ac(t,n,e[n]);if(Ei)for(var n of Ei(e))Wc.call(e,n)&&ac(t,n,e[n]);return t},M=(t,e)=>QT(t,ev(e)),m=(t,e)=>so(t,"name",{value:e,configurable:!0}),Fc=(t,e)=>{var n={};for(var r in t)Kc.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Ei)for(var r of Ei(t))e.indexOf(r)<0&&Wc.call(t,r)&&(n[r]=t[r]);return n},Ot=(t,e)=>{for(var n in e)so(t,n,{get:e[n],enumerable:!0})},ne={};Ot(ne,{DIRTY:()=>jo,ERR:()=>Uo,OK:()=>Oi,any:()=>On,array:()=>An,bigint:()=>Ki,boolean:()=>Zn,branded:()=>Ho,catch:()=>No,coerce:()=>kg,custom:()=>Zi,date:()=>Wi,default:()=>Mo,discriminatedUnion:()=>qi,downstream:()=>Ao,enum:()=>zi,function:()=>Eo,instanceof:()=>To,intersection:()=>Gi,is:()=>et,lazy:()=>Bo,literal:()=>Kr,map:()=>Po,nan:()=>bo,nativeEnum:()=>wo,never:()=>Lr,null:()=>qr,nullable:()=>Oo,number:()=>$n,object:()=>rr,optional:()=>Co,pipeline:()=>Do,preprocess:()=>So,promise:()=>Io,readonly:()=>Ro,record:()=>Wr,ref:()=>Fi,set:()=>Vi,strictObject:()=>xo,string:()=>Qt,symbol:()=>_o,transforms:()=>zc,tuple:()=>Gr,undefined:()=>Li,union:()=>ir,unknown:()=>yn,upstream:()=>ko,void:()=>vo,zuiKey:()=>ke});var zc={};Ot(zc,{errors:()=>Ag,fromJSONSchema:()=>Yg,fromJSONSchemaLegacy:()=>kP,fromObject:()=>no,json:()=>HB,toJSONSchema:()=>st,toJSONSchemaLegacy:()=>iB,toTypescriptSchema:()=>Fo,toTypescriptType:()=>Wo});var en={};Ot(en,{DIRTY:()=>jo,ERR:()=>Uo,OK:()=>Oi,any:()=>On,array:()=>An,bigint:()=>Ki,boolean:()=>Zn,branded:()=>Ho,catch:()=>No,coerce:()=>kg,custom:()=>Zi,date:()=>Wi,default:()=>Mo,discriminatedUnion:()=>qi,downstream:()=>Ao,enum:()=>zi,function:()=>Eo,instanceof:()=>To,intersection:()=>Gi,is:()=>et,lazy:()=>Bo,literal:()=>Kr,map:()=>Po,nan:()=>bo,nativeEnum:()=>wo,never:()=>Lr,null:()=>qr,nullable:()=>Oo,number:()=>$n,object:()=>rr,optional:()=>Co,pipeline:()=>Do,preprocess:()=>So,promise:()=>Io,readonly:()=>Ro,record:()=>Wr,ref:()=>Fi,set:()=>Vi,strictObject:()=>xo,string:()=>Qt,symbol:()=>_o,tuple:()=>Gr,undefined:()=>Li,union:()=>ir,unknown:()=>yn,upstream:()=>ko,void:()=>vo,zuiKey:()=>ke});var ke="x-zui",Ve={};Ot(Ve,{CustomSet:()=>ax});var $t={};Ot($t,{isEqual:()=>pp,unique:()=>sx});var tv=typeof global=="object"&&global&&global.Object===Object&&global,qc=tv,nv=typeof self=="object"&&self&&self.Object===Object&&self,rv=qc||nv||Function("return this")(),tn=rv,iv=tn.Symbol,mn=iv,Gc=Object.prototype,sv=Gc.hasOwnProperty,ov=Gc.toString,br=mn?mn.toStringTag:void 0;function Vc(t){var e=sv.call(t,br),n=t[br];try{t[br]=void 0;var r=!0}catch{}var s=ov.call(t);return r&&(e?t[br]=n:delete t[br]),s}m(Vc,"getRawTag");var av=Vc,lv=Object.prototype,uv=lv.toString;function Jc(t){return uv.call(t)}m(Jc,"objectToString");var cv=Jc,dv="[object Null]",fv="[object Undefined]",lc=mn?mn.toStringTag:void 0;function Yc(t){return t==null?t===void 0?fv:dv:lc&&lc in Object(t)?av(t):cv(t)}m(Yc,"baseGetTag");var Rn=Yc;function Xc(t){return t!=null&&typeof t=="object"}m(Xc,"isObjectLike");var Cn=Xc,pv="[object Symbol]";function Qc(t){return typeof t=="symbol"||Cn(t)&&Rn(t)==pv}m(Qc,"isSymbol");var oo=Qc;function ed(t,e){for(var n=-1,r=t==null?0:t.length,s=Array(r);++n<r;)s[n]=e(t[n],n,t);return s}m(ed,"arrayMap");var td=ed,gv=Array.isArray,Xt=gv,mv=1/0,uc=mn?mn.prototype:void 0,cc=uc?uc.toString:void 0;function ao(t){if(typeof t=="string")return t;if(Xt(t))return td(t,ao)+"";if(oo(t))return cc?cc.call(t):"";var e=t+"";return e=="0"&&1/t==-mv?"-0":e}m(ao,"baseToString");var yv=ao;function nd(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}m(nd,"isObject");var nr=nd;function rd(t){return t}m(rd,"identity");var hv=rd,Tv="[object AsyncFunction]",vv="[object Function]",_v="[object GeneratorFunction]",bv="[object Proxy]";function id(t){if(!nr(t))return!1;var e=Rn(t);return e==vv||e==_v||e==Tv||e==bv}m(id,"isFunction");var sd=id,wv=tn["__core-js_shared__"],Ms=wv,dc=(function(){var t=/[^.]+$/.exec(Ms&&Ms.keys&&Ms.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function od(t){return!!dc&&dc in t}m(od,"isMasked");var xv=od,Pv=Function.prototype,Bv=Pv.toString;function ad(t){if(t!=null){try{return Bv.call(t)}catch{}try{return t+""}catch{}}return""}m(ad,"toSource");var Mn=ad,Iv=/[\\^$.*+?()[\]{}|]/g,Ev=/^\[object .+?Constructor\]$/,Sv=Function.prototype,kv=Object.prototype,Av=Sv.toString,Cv=kv.hasOwnProperty,Ov=RegExp("^"+Av.call(Cv).replace(Iv,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ld(t){if(!nr(t)||xv(t))return!1;var e=sd(t)?Ov:Ev;return e.test(Mn(t))}m(ld,"baseIsNative");var Rv=ld;function ud(t,e){return t?.[e]}m(ud,"getValue");var Mv=ud;function cd(t,e){var n=Mv(t,e);return Rv(n)?n:void 0}m(cd,"getNative");var Nn=cd,Nv=Nn(tn,"WeakMap"),zs=Nv,Dv=(function(){try{var t=Nn(Object,"defineProperty");return t({},"",{}),t}catch{}})(),fc=Dv,Hv=9007199254740991,Uv=/^(?:0|[1-9]\d*)$/;function dd(t,e){var n=typeof t;return e=e??Hv,!!e&&(n=="number"||n!="symbol"&&Uv.test(t))&&t>-1&&t%1==0&&t<e}m(dd,"isIndex");var lo=dd;function fd(t,e,n){e=="__proto__"&&fc?fc(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}m(fd,"baseAssignValue");var pd=fd;function gd(t,e){return t===e||t!==t&&e!==e}m(gd,"eq");var uo=gd,jv=Object.prototype,$v=jv.hasOwnProperty;function md(t,e,n){var r=t[e];(!($v.call(t,e)&&uo(r,n))||n===void 0&&!(e in t))&&pd(t,e,n)}m(md,"assignValue");var Zv=md,Lv=9007199254740991;function yd(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Lv}m(yd,"isLength");var co=yd;function hd(t){return t!=null&&co(t.length)&&!sd(t)}m(hd,"isArrayLike");var Td=hd,Kv=Object.prototype;function vd(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||Kv;return t===n}m(vd,"isPrototype");var _d=vd;function bd(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}m(bd,"baseTimes");var Wv=bd,Fv="[object Arguments]";function wd(t){return Cn(t)&&Rn(t)==Fv}m(wd,"baseIsArguments");var pc=wd,xd=Object.prototype,zv=xd.hasOwnProperty,qv=xd.propertyIsEnumerable,Gv=pc((function(){return arguments})())?pc:function(t){return Cn(t)&&zv.call(t,"callee")&&!qv.call(t,"callee")},Pd=Gv;function Bd(){return!1}m(Bd,"stubFalse");var Vv=Bd,Id=typeof exports=="object"&&exports&&!exports.nodeType&&exports,gc=Id&&typeof module=="object"&&module&&!module.nodeType&&module,Jv=gc&&gc.exports===Id,mc=Jv?tn.Buffer:void 0,Yv=mc?mc.isBuffer:void 0,Xv=Yv||Vv,qs=Xv,Qv="[object Arguments]",e_="[object Array]",t_="[object Boolean]",n_="[object Date]",r_="[object Error]",i_="[object Function]",s_="[object Map]",o_="[object Number]",a_="[object Object]",l_="[object RegExp]",u_="[object Set]",c_="[object String]",d_="[object WeakMap]",f_="[object ArrayBuffer]",p_="[object DataView]",g_="[object Float32Array]",m_="[object Float64Array]",y_="[object Int8Array]",h_="[object Int16Array]",T_="[object Int32Array]",v_="[object Uint8Array]",__="[object Uint8ClampedArray]",b_="[object Uint16Array]",w_="[object Uint32Array]",Me={};Me[g_]=Me[m_]=Me[y_]=Me[h_]=Me[T_]=Me[v_]=Me[__]=Me[b_]=Me[w_]=!0;Me[Qv]=Me[e_]=Me[f_]=Me[t_]=Me[p_]=Me[n_]=Me[r_]=Me[i_]=Me[s_]=Me[o_]=Me[a_]=Me[l_]=Me[u_]=Me[c_]=Me[d_]=!1;function Ed(t){return Cn(t)&&co(t.length)&&!!Me[Rn(t)]}m(Ed,"baseIsTypedArray");var x_=Ed;function Sd(t){return function(e){return t(e)}}m(Sd,"baseUnary");var P_=Sd,kd=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Dr=kd&&typeof module=="object"&&module&&!module.nodeType&&module,B_=Dr&&Dr.exports===kd,Ns=B_&&qc.process,I_=(function(){try{var t=Dr&&Dr.require&&Dr.require("util").types;return t||Ns&&Ns.binding&&Ns.binding("util")}catch{}})(),yc=I_,hc=yc&&yc.isTypedArray,E_=hc?P_(hc):x_,Ad=E_,S_=Object.prototype,k_=S_.hasOwnProperty;function Cd(t,e){var n=Xt(t),r=!n&&Pd(t),s=!n&&!r&&qs(t),o=!n&&!r&&!s&&Ad(t),i=n||r||s||o,a=i?Wv(t.length,String):[],l=a.length;for(var c in t)(e||k_.call(t,c))&&!(i&&(c=="length"||s&&(c=="offset"||c=="parent")||o&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||lo(c,l)))&&a.push(c);return a}m(Cd,"arrayLikeKeys");var Od=Cd;function Rd(t,e){return function(n){return t(e(n))}}m(Rd,"overArg");var Md=Rd,A_=Md(Object.keys,Object),C_=A_,O_=Object.prototype,R_=O_.hasOwnProperty;function Nd(t){if(!_d(t))return C_(t);var e=[];for(var n in Object(t))R_.call(t,n)&&n!="constructor"&&e.push(n);return e}m(Nd,"baseKeys");var M_=Nd;function Dd(t){return Td(t)?Od(t):M_(t)}m(Dd,"keys");var fo=Dd;function Hd(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}m(Hd,"nativeKeysIn");var N_=Hd,D_=Object.prototype,H_=D_.hasOwnProperty;function Ud(t){if(!nr(t))return N_(t);var e=_d(t),n=[];for(var r in t)r=="constructor"&&(e||!H_.call(t,r))||n.push(r);return n}m(Ud,"baseKeysIn");var U_=Ud;function jd(t){return Td(t)?Od(t,!0):U_(t)}m(jd,"keysIn");var j_=jd,$_=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Z_=/^\w*$/;function $d(t,e){if(Xt(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||oo(t)?!0:Z_.test(t)||!$_.test(t)||e!=null&&t in Object(e)}m($d,"isKey");var po=$d,L_=Nn(Object,"create"),jr=L_;function Zd(){this.__data__=jr?jr(null):{},this.size=0}m(Zd,"hashClear");var K_=Zd;function Ld(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}m(Ld,"hashDelete");var W_=Ld,F_="__lodash_hash_undefined__",z_=Object.prototype,q_=z_.hasOwnProperty;function Kd(t){var e=this.__data__;if(jr){var n=e[t];return n===F_?void 0:n}return q_.call(e,t)?e[t]:void 0}m(Kd,"hashGet");var G_=Kd,V_=Object.prototype,J_=V_.hasOwnProperty;function Wd(t){var e=this.__data__;return jr?e[t]!==void 0:J_.call(e,t)}m(Wd,"hashHas");var Y_=Wd,X_="__lodash_hash_undefined__";function Fd(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=jr&&e===void 0?X_:e,this}m(Fd,"hashSet");var Q_=Fd;function Dn(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(Dn,"Hash");Dn.prototype.clear=K_;Dn.prototype.delete=W_;Dn.prototype.get=G_;Dn.prototype.has=Y_;Dn.prototype.set=Q_;var Tc=Dn;function zd(){this.__data__=[],this.size=0}m(zd,"listCacheClear");var eb=zd;function qd(t,e){for(var n=t.length;n--;)if(uo(t[n][0],e))return n;return-1}m(qd,"assocIndexOf");var Mi=qd,tb=Array.prototype,nb=tb.splice;function Gd(t){var e=this.__data__,n=Mi(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():nb.call(e,n,1),--this.size,!0}m(Gd,"listCacheDelete");var rb=Gd;function Vd(t){var e=this.__data__,n=Mi(e,t);return n<0?void 0:e[n][1]}m(Vd,"listCacheGet");var ib=Vd;function Jd(t){return Mi(this.__data__,t)>-1}m(Jd,"listCacheHas");var sb=Jd;function Yd(t,e){var n=this.__data__,r=Mi(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}m(Yd,"listCacheSet");var ob=Yd;function Hn(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}m(Hn,"ListCache");Hn.prototype.clear=eb;Hn.prototype.delete=rb;Hn.prototype.get=ib;Hn.prototype.has=sb;Hn.prototype.set=ob;var Ni=Hn,ab=Nn(tn,"Map"),$r=ab;function Xd(){this.size=0,this.__data__={hash:new Tc,map:new($r||Ni),string:new Tc}}m(Xd,"mapCacheClear");var lb=Xd;function Qd(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}m(Qd,"isKeyable");var ub=Qd;function ef(t,e){var n=t.__data__;return ub(e)?n[typeof e=="string"?"string":"hash"]:n.map}m(ef,"getMapData");var Di=ef;function tf(t){var e=Di(this,t).delete(t);return this.size-=e?1:0,e}m(tf,"mapCacheDelete");var cb=tf;function nf(t){return Di(this,t).get(t)}m(nf,"mapCacheGet");var db=nf;function rf(t){return Di(this,t).has(t)}m(rf,"mapCacheHas");var fb=rf;function sf(t,e){var n=Di(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}m(sf,"mapCacheSet");var pb=sf;function Un(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}m(Un,"MapCache");Un.prototype.clear=lb;Un.prototype.delete=cb;Un.prototype.get=db;Un.prototype.has=fb;Un.prototype.set=pb;var Hi=Un,gb="Expected a function";function Ui(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(gb);var n=m(function(){var r=arguments,s=e?e.apply(this,r):r[0],o=n.cache;if(o.has(s))return o.get(s);var i=t.apply(this,r);return n.cache=o.set(s,i)||o,i},"memoized");return n.cache=new(Ui.Cache||Hi),n}m(Ui,"memoize");Ui.Cache=Hi;var mb=Ui,yb=500;function of(t){var e=mb(t,function(r){return n.size===yb&&n.clear(),r}),n=e.cache;return e}m(of,"memoizeCapped");var hb=of,Tb=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,vb=/\\(\\)?/g,_b=hb(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Tb,function(n,r,s,o){e.push(s?o.replace(vb,"$1"):r||n)}),e}),bb=_b;function af(t){return t==null?"":yv(t)}m(af,"toString");var wb=af;function lf(t,e){return Xt(t)?t:po(t,e)?[t]:bb(wb(t))}m(lf,"castPath");var ji=lf,xb=1/0;function uf(t){if(typeof t=="string"||oo(t))return t;var e=t+"";return e=="0"&&1/t==-xb?"-0":e}m(uf,"toKey");var zr=uf;function cf(t,e){e=ji(e,t);for(var n=0,r=e.length;t!=null&&n<r;)t=t[zr(e[n++])];return n&&n==r?t:void 0}m(cf,"baseGet");var go=cf;function df(t,e,n){var r=t==null?void 0:go(t,e);return r===void 0?n:r}m(df,"get");var Pb=df;function ff(t,e){for(var n=-1,r=e.length,s=t.length;++n<r;)t[s+n]=e[n];return t}m(ff,"arrayPush");var pf=ff,Bb=Md(Object.getPrototypeOf,Object),gf=Bb,Ib="[object Object]",Eb=Function.prototype,Sb=Object.prototype,mf=Eb.toString,kb=Sb.hasOwnProperty,Ab=mf.call(Object);function yf(t){if(!Cn(t)||Rn(t)!=Ib)return!1;var e=gf(t);if(e===null)return!0;var n=kb.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&mf.call(n)==Ab}m(yf,"isPlainObject");var Cb=yf;function hf(){this.__data__=new Ni,this.size=0}m(hf,"stackClear");var Ob=hf;function Tf(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}m(Tf,"stackDelete");var Rb=Tf;function vf(t){return this.__data__.get(t)}m(vf,"stackGet");var Mb=vf;function _f(t){return this.__data__.has(t)}m(_f,"stackHas");var Nb=_f,Db=200;function bf(t,e){var n=this.__data__;if(n instanceof Ni){var r=n.__data__;if(!$r||r.length<Db-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Hi(r)}return n.set(t,e),this.size=n.size,this}m(bf,"stackSet");var Hb=bf;function jn(t){var e=this.__data__=new Ni(t);this.size=e.size}m(jn,"Stack");jn.prototype.clear=Ob;jn.prototype.delete=Rb;jn.prototype.get=Mb;jn.prototype.has=Nb;jn.prototype.set=Hb;var Ti=jn;function wf(t,e){for(var n=-1,r=t==null?0:t.length,s=0,o=[];++n<r;){var i=t[n];e(i,n,t)&&(o[s++]=i)}return o}m(wf,"arrayFilter");var Ub=wf;function xf(){return[]}m(xf,"stubArray");var Pf=xf,jb=Object.prototype,$b=jb.propertyIsEnumerable,vc=Object.getOwnPropertySymbols,Zb=vc?function(t){return t==null?[]:(t=Object(t),Ub(vc(t),function(e){return $b.call(t,e)}))}:Pf,Bf=Zb,Lb=Object.getOwnPropertySymbols,Kb=Lb?function(t){for(var e=[];t;)pf(e,Bf(t)),t=gf(t);return e}:Pf,Wb=Kb;function If(t,e,n){var r=e(t);return Xt(t)?r:pf(r,n(t))}m(If,"baseGetAllKeys");var Ef=If;function Sf(t){return Ef(t,fo,Bf)}m(Sf,"getAllKeys");var _c=Sf;function kf(t){return Ef(t,j_,Wb)}m(kf,"getAllKeysIn");var Fb=kf,zb=Nn(tn,"DataView"),Gs=zb,qb=Nn(tn,"Promise"),Vs=qb,Gb=Nn(tn,"Set"),Js=Gb,bc="[object Map]",Vb="[object Object]",wc="[object Promise]",xc="[object Set]",Pc="[object WeakMap]",Bc="[object DataView]",Jb=Mn(Gs),Yb=Mn($r),Xb=Mn(Vs),Qb=Mn(Js),ew=Mn(zs),In=Rn;(Gs&&In(new Gs(new ArrayBuffer(1)))!=Bc||$r&&In(new $r)!=bc||Vs&&In(Vs.resolve())!=wc||Js&&In(new Js)!=xc||zs&&In(new zs)!=Pc)&&(In=m(function(t){var e=Rn(t),n=e==Vb?t.constructor:void 0,r=n?Mn(n):"";if(r)switch(r){case Jb:return Bc;case Yb:return bc;case Xb:return wc;case Qb:return xc;case ew:return Pc}return e},"getTag"));var Ic=In,tw=tn.Uint8Array,Ec=tw,nw="__lodash_hash_undefined__";function Af(t){return this.__data__.set(t,nw),this}m(Af,"setCacheAdd");var rw=Af;function Cf(t){return this.__data__.has(t)}m(Cf,"setCacheHas");var iw=Cf;function Zr(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new Hi;++e<n;)this.add(t[e])}m(Zr,"SetCache");Zr.prototype.add=Zr.prototype.push=rw;Zr.prototype.has=iw;var sw=Zr;function Of(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(Of,"arraySome");var ow=Of;function Rf(t,e){return t.has(e)}m(Rf,"cacheHas");var aw=Rf,lw=1,uw=2;function Mf(t,e,n,r,s,o){var i=n&lw,a=t.length,l=e.length;if(a!=l&&!(i&&l>a))return!1;var c=o.get(t),f=o.get(e);if(c&&f)return c==e&&f==t;var g=-1,p=!0,h=n&uw?new sw:void 0;for(o.set(t,e),o.set(e,t);++g<a;){var _=t[g],P=e[g];if(r)var B=i?r(P,_,g,e,t,o):r(_,P,g,t,e,o);if(B!==void 0){if(B)continue;p=!1;break}if(h){if(!ow(e,function(T,E){if(!aw(h,E)&&(_===T||s(_,T,n,r,o)))return h.push(E)})){p=!1;break}}else if(!(_===P||s(_,P,n,r,o))){p=!1;break}}return o.delete(t),o.delete(e),p}m(Mf,"equalArrays");var Nf=Mf;function Df(t){var e=-1,n=Array(t.size);return t.forEach(function(r,s){n[++e]=[s,r]}),n}m(Df,"mapToArray");var cw=Df;function Hf(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}m(Hf,"setToArray");var dw=Hf,fw=1,pw=2,gw="[object Boolean]",mw="[object Date]",yw="[object Error]",hw="[object Map]",Tw="[object Number]",vw="[object RegExp]",_w="[object Set]",bw="[object String]",ww="[object Symbol]",xw="[object ArrayBuffer]",Pw="[object DataView]",Sc=mn?mn.prototype:void 0,Ds=Sc?Sc.valueOf:void 0;function Uf(t,e,n,r,s,o,i){switch(n){case Pw:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case xw:return!(t.byteLength!=e.byteLength||!o(new Ec(t),new Ec(e)));case gw:case mw:case Tw:return uo(+t,+e);case yw:return t.name==e.name&&t.message==e.message;case vw:case bw:return t==e+"";case hw:var a=cw;case _w:var l=r&fw;if(a||(a=dw),t.size!=e.size&&!l)return!1;var c=i.get(t);if(c)return c==e;r|=pw,i.set(t,e);var f=Nf(a(t),a(e),r,s,o,i);return i.delete(t),f;case ww:if(Ds)return Ds.call(t)==Ds.call(e)}return!1}m(Uf,"equalByTag");var Bw=Uf,Iw=1,Ew=Object.prototype,Sw=Ew.hasOwnProperty;function jf(t,e,n,r,s,o){var i=n&Iw,a=_c(t),l=a.length,c=_c(e),f=c.length;if(l!=f&&!i)return!1;for(var g=l;g--;){var p=a[g];if(!(i?p in e:Sw.call(e,p)))return!1}var h=o.get(t),_=o.get(e);if(h&&_)return h==e&&_==t;var P=!0;o.set(t,e),o.set(e,t);for(var B=i;++g<l;){p=a[g];var T=t[p],E=e[p];if(r)var I=i?r(E,T,p,e,t,o):r(T,E,p,t,e,o);if(!(I===void 0?T===E||s(T,E,n,r,o):I)){P=!1;break}B||(B=p=="constructor")}if(P&&!B){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 o.delete(t),o.delete(e),P}m(jf,"equalObjects");var kw=jf,Aw=1,kc="[object Arguments]",Ac="[object Array]",yi="[object Object]",Cw=Object.prototype,Cc=Cw.hasOwnProperty;function $f(t,e,n,r,s,o){var i=Xt(t),a=Xt(e),l=i?Ac:Ic(t),c=a?Ac:Ic(e);l=l==kc?yi:l,c=c==kc?yi:c;var f=l==yi,g=c==yi,p=l==c;if(p&&qs(t)){if(!qs(e))return!1;i=!0,f=!1}if(p&&!f)return o||(o=new Ti),i||Ad(t)?Nf(t,e,n,r,s,o):Bw(t,e,l,n,r,s,o);if(!(n&Aw)){var h=f&&Cc.call(t,"__wrapped__"),_=g&&Cc.call(e,"__wrapped__");if(h||_){var P=h?t.value():t,B=_?e.value():e;return o||(o=new Ti),s(P,B,n,r,o)}}return p?(o||(o=new Ti),kw(t,e,n,r,s,o)):!1}m($f,"baseIsEqualDeep");var Ow=$f;function mo(t,e,n,r,s){return t===e?!0:t==null||e==null||!Cn(t)&&!Cn(e)?t!==t&&e!==e:Ow(t,e,n,r,mo,s)}m(mo,"baseIsEqual");var $i=mo,Rw=1,Mw=2;function Zf(t,e,n,r){var s=n.length,o=s,i=!r;if(t==null)return!o;for(t=Object(t);s--;){var a=n[s];if(i&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++s<o;){a=n[s];var l=a[0],c=t[l],f=a[1];if(i&&a[2]){if(c===void 0&&!(l in t))return!1}else{var g=new Ti;if(r)var p=r(c,f,l,t,e,g);if(!(p===void 0?$i(f,c,Rw|Mw,r,g):p))return!1}}return!0}m(Zf,"baseIsMatch");var Nw=Zf;function Lf(t){return t===t&&!nr(t)}m(Lf,"isStrictComparable");var Kf=Lf;function Wf(t){for(var e=fo(t),n=e.length;n--;){var r=e[n],s=t[r];e[n]=[r,s,Kf(s)]}return e}m(Wf,"getMatchData");var Dw=Wf;function Ff(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}m(Ff,"matchesStrictComparable");var zf=Ff;function qf(t){var e=Dw(t);return e.length==1&&e[0][2]?zf(e[0][0],e[0][1]):function(n){return n===t||Nw(n,t,e)}}m(qf,"baseMatches");var Hw=qf;function Gf(t,e){return t!=null&&e in Object(t)}m(Gf,"baseHasIn");var Uw=Gf;function Vf(t,e,n){e=ji(e,t);for(var r=-1,s=e.length,o=!1;++r<s;){var i=zr(e[r]);if(!(o=t!=null&&n(t,i)))break;t=t[i]}return o||++r!=s?o:(s=t==null?0:t.length,!!s&&co(s)&&lo(i,s)&&(Xt(t)||Pd(t)))}m(Vf,"hasPath");var jw=Vf;function Jf(t,e){return t!=null&&jw(t,e,Uw)}m(Jf,"hasIn");var $w=Jf,Zw=1,Lw=2;function Yf(t,e){return po(t)&&Kf(e)?zf(zr(t),e):function(n){var r=Pb(n,t);return r===void 0&&r===e?$w(n,t):$i(e,r,Zw|Lw)}}m(Yf,"baseMatchesProperty");var Kw=Yf;function Xf(t){return function(e){return e?.[t]}}m(Xf,"baseProperty");var Ww=Xf;function Qf(t){return function(e){return go(e,t)}}m(Qf,"basePropertyDeep");var Fw=Qf;function ep(t){return po(t)?Ww(zr(t)):Fw(t)}m(ep,"property");var zw=ep;function tp(t){return typeof t=="function"?t:t==null?hv:typeof t=="object"?Xt(t)?Kw(t[0],t[1]):Hw(t):zw(t)}m(tp,"baseIteratee");var yo=tp;function np(t){return function(e,n,r){for(var s=-1,o=Object(e),i=r(e),a=i.length;a--;){var l=i[t?a:++s];if(n(o[l],l,o)===!1)break}return e}}m(np,"createBaseFor");var qw=np,Gw=qw(),Vw=Gw;function rp(t,e){return t&&Vw(t,e,fo)}m(rp,"baseForOwn");var Jw=rp;function ip(t,e){return $i(t,e)}m(ip,"isEqual");var gn=ip;function sp(t,e,n){n=typeof n=="function"?n:void 0;var r=n?n(t,e):void 0;return r===void 0?$i(t,e,void 0,n):!!r}m(sp,"isEqualWith");var Yw=sp;function op(t){return t===void 0}m(op,"isUndefined");var Oc=op;function ap(t,e){var n={};return e=yo(e,3),Jw(t,function(r,s,o){pd(n,s,e(r,s,o))}),n}m(ap,"mapValues");var Xw=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(!nr(t))return t;e=ji(e,t);for(var s=-1,o=e.length,i=o-1,a=t;a!=null&&++s<o;){var l=zr(e[s]),c=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return t;if(s!=i){var f=a[l];c=r?r(f,l,a):void 0,c===void 0&&(c=nr(f)?f:lo(e[s+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,s=e.length,o={};++r<s;){var i=e[r],a=go(t,i);n(a,i)&&tx(o,ji(i,t),a)}return o}m(cp,"basePickBy");var nx=cp;function dp(t,e){if(t==null)return{};var n=td(Fb(t),function(r){return[r]});return e=yo(e),nx(t,n,function(r,s){return e(r,s[0])})}m(dp,"pickBy");var rx=dp;function fp(t,e){return rx(t,ex(yo(e)))}m(fp,"omitBy");var Rc=fp,pp=m((t,e)=>gp(t,e,new WeakSet),"isEqual"),Mc=m(t=>Cb(t),"_isPlainObject"),gp=m((t,e,n)=>Yw(t,e,ix(n)),"_isEqualWithVisitedTracking"),ix=m(t=>(e,n)=>{if(Mc(e)&&!t.has(e)&&Mc(n)&&!t.has(n)){let r=Rc(e,Oc),s=Rc(n,Oc);return t.add(r).add(s).add(e).add(n),gp(r,s,t)}},"_customizerWithVisitedTracking"),sx=m(t=>Array.from(new Set(t)),"unique"),ox={compare:pp},mp=class{constructor(e=[],n={}){this._options=w(w({},ox),n),this._items=[];for(let r of e)this.add(r)}get items(){return[...this._items]}get size(){return this._items.length}has(e){return this._items.some(n=>this._options.compare(n,e))}add(e){this.has(e)||this._items.push(e)}isEqual(e){return this.size!==e.size?!1:this.isSubsetOf(e)&&e.isSubsetOf(this)}isSubsetOf(e){return this.size>e.size?!1:this._items.every(n=>e.has(n))}};m(mp,"CustomSet");var ax=mp,ae={};Ot(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"),Ct={};Ot(Ct,{assertNever:()=>yp});function yp(t){throw new Error("assertNever called")}m(yp,"assertNever");var At={};Ot(At,{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={};Ot(Tp,{extractPrecisionAndOffset:()=>_p,generateDatetimeRegex:()=>vp});var vp=m(t=>{let e=t.precision?Ys+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+)?",Ys="\\.\\d{",px="}",gx=m(t=>{let e=t.slice(1+bp.length);return e.startsWith(xp)?null:e.startsWith(Ys)?parseInt(e.slice(Ys.length)):0},"_extractPrecision"),Si=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,At.jsonStringifyReplacer)}`;break;case"unrecognized_keys":n=`Unrecognized key(s) in object: ${At.joinValues(t.keys,", ")}`;break;case"invalid_union":n="Invalid input";break;case"invalid_union_discriminator":n=`Invalid discriminator value. Expected ${At.joinValues(t.options)}`;break;case"invalid_enum_value":n=`Invalid enum value. Expected ${At.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}"`:Ct.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,Ct.assertNever(t)}return{message:n}},"errorMap"),ki=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(o){return o.message},r={_errors:[]},s=m(o=>{for(let i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let a=r,l=0;for(;l<i.path.length;){let c=i.path[l];l===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(i))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}},"processError");return s(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,At.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}};m(ki,"ZodError");ki.create=m(t=>new ki(t),"create");var Yt=ki,mx=Si;function Ai(){return mx}m(Ai,"getErrorMap");var Ne={};function Bp(t){Object.assign(Ne,t)}m(Bp,"setBuilders");var Xs=m(t=>{var e;let{data:n,path:r,errorMaps:s,issueData:o}=t,i=[...r,...o.path||[]],a=M(w({},o),{path:i}),l="",c=s.filter(f=>!!f).slice().reverse();for(let f of c)l=f(a,{data:n,defaultError:l}).message;return M(w({},o),{path:i,message:(e=o.message)!=null?e:l})},"makeIssue");function X(t,e){let n=Xs({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ai(),Si].filter(r=>!!r)});t.common.issues.push(n)}m(X,"addIssueToContext");var Ip=class Ep{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 s of n){if(s.status==="aborted")return{status:"aborted"};s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let s of n)r.push({key:await s.key,value:await s.value});return Ep.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let s of n){let{key:o,value:i}=s;if(o.status==="aborted")return{status:"aborted"};if(i.status==="aborted")return{status:"aborted"};o.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(r[o.value]=i.value)}return{status:e.value,value:r}}};m(Ip,"ParseStatus");var _t=Ip,Ci=m(t=>typeof Promise<"u"&&t instanceof Promise,"isAsync"),kn=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"),Sp=class{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}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(Sp,"ParseInputLazyPath");var jt=Sp,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 Hs=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 s=new Yt(n.common.issues);return this._error=s,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 kn(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:kn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new _t,ctx:{common:e.parent.common,data:e.data,parsedType:kn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(Ci(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 s={common:{issues:[],async:(r=n?.async)!=null?r:!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:kn(e)},o=this._parseSync({data:e,path:s.path,parent:s});return this._handleResult(s,o)}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:kn(e)},s=this._parse({data:e,path:r.path,parent:r}),o=await(Ci(s)?s:Promise.resolve(s));return this._handleResult(r,o)}refine(e,n){let r=m(s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n,"getIssueProperties");return Ne.downstream(this,s=>{let o=e(s),i=[],a=m(()=>i.push(w({code:"custom"},r(s))),"setError");return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?{status:"valid",value:s}:(a(),{status:"dirty",value:s,issues:i})):o?{status:"valid",value:s}:(a(),{status:"dirty",value:s,issues:i})})}superRefine(e){return Ne.downstream(this,(n,r)=>{let s=[],o=e(n,{addIssue:i=>s.push(i),path:r.path});return typeof Promise<"u"&&o instanceof Promise?o.then(()=>s.some(i=>i.fatal)?{status:"aborted",issues:s}:s.length?{status:"dirty",value:n,issues:s}:{status:"valid",value:n}):s.some(i=>i.fatal)?{status:"aborted",issues:s}:s.length?{status:"dirty",value:n,issues:s}:{status:"valid",value:n}})}downstream(e,n){return Ne.downstream(this,e,n)}optional(){return Ne.optional(this,this._def)}nullable(){return Ne.nullable(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ne.array(this,this._def)}promise(){return Ne.promise(this,this._def)}mandatory(){return this}or(e){return Ne.union([this,e])}and(e){return Ne.intersection(this,e)}transform(e){return Ne.downstream(this,(n,r)=>{let s=[],o=e(n,{addIssue:i=>s.push(i),path:r.path});return o instanceof Promise?o.then(i=>s.some(a=>a.fatal)?{status:"aborted",issues:s}:s.length?{status:"dirty",value:i,issues:s}:{status:"valid",value:i}):s.some(i=>i.fatal)?{status:"aborted",issues:s}:s.length?{status:"dirty",value:o,issues:s}:{status:"valid",value:o}},{failFast:!0})}default(e){let n=typeof e=="function"?e:()=>e;return Ne.default(this,n)}brand(){return Ne.branded(this)}catch(e){return Ne.catch(this,e)}describe(e){let n=this.clone();return n._metadataRoot._def.description=e,n}pipe(e){return Ne.pipeline(this,e)}readonly(){return Ne.readonly(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}metadata(e){var n,r,s;let o=this.clone(),i=o._metadataRoot;(s=(n=i._def)[r=ke])!=null||(n[r]={});for(let[a,l]of Object.entries(e))i._def[ke]=M(w({},i._def[ke]),{[a]:l});return o}getMetadata(){return w({},this._metadataRoot._def[ke])}setMetadata(e){this._metadataRoot._def[ke]=w({},e)}get ui(){return w({},this._metadataRoot._def[ke])}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(){throw new Hs("toJSONSchema")}toTypescriptType(e){throw new Hs("toTypescriptType")}toTypescriptSchema(){throw new Hs("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,s,o,i,a;return e instanceof En?gn((n=this._def.exactLength)==null?void 0:n.value,(r=e._def.exactLength)==null?void 0:r.value)&&gn((s=this._def.maxLength)==null?void 0:s.value,(o=e._def.maxLength)==null?void 0:o.value)&&gn((i=this._def.minLength)==null?void 0:i.value,(a=e._def.minLength)==null?void 0:a.value)&&this._def.type.isEqual(e._def.type):!1}_parse(e){let{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!=="array")return X(n,{code:"invalid_type",expected:"array",received:n.parsedType}),{status:"aborted"};if(s.exactLength!==null){let i=n.data.length>s.exactLength.value,a=n.data.length<s.exactLength.value;(i||a)&&(X(n,{code:i?"too_big":"too_small",minimum:a?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(X(n,{code:"too_small",minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(X(n,{code:"too_big",maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,a)=>s.type._parseAsync(new jt(n,i,n.path,a)))).then(i=>_t.mergeArray(r,i));let o=[...n.data].map((i,a)=>s.type._parseSync(new jt(n,i,n.path,a)));return _t.mergeArray(r,o)}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 vi 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 o=this._getOrReturnCtx(e);return X(o,{code:"invalid_type",expected:"bigint",received:o.parsedType}),{status:"aborted"}}let r,s=new _t;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),X(r,{code:"too_small",type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),X(r,{code:"too_big",type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),X(r,{code:"not_multiple_of",multipleOf:o.value,message:o.message}),s.dirty()):Ct.assertNever(o);return{status:s.value,value:e.data}}isEqual(e){if(!(e instanceof vi)||this._def.coerce!==e._def.coerce)return!1;let n=new Ve.CustomSet(this._def.checks),r=new Ve.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,s){return new vi(M(w({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ae.toString(s)}]}))}_addCheck(e){return new vi(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 X(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 Pr extends pe{dereference(e){return new Pr(M(w({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new Pr(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 Pr?this._def.type.isEqual(e._def.type):!1}naked(){return this._def.type.naked()}mandatory(){return new Pr(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:[]})}),s=this._def.innerType._parse({data:r.data,path:r.path,parent:w({},r)});return Ci(s)?s.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Yt(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Yt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}isEqual(e){return e instanceof Br?this._def.innerType.isEqual(e._def.innerType)&&At.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 Qs extends pe{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!=="date"){let o=this._getOrReturnCtx(e);return X(o,{code:"invalid_type",expected:"date",received:o.parsedType}),{status:"aborted"}}if(isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return X(o,{code:"invalid_date"}),{status:"aborted"}}let r=new _t,s;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(s=this._getOrReturnCtx(e,s),X(s,{code:"too_small",message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(s=this._getOrReturnCtx(e,s),X(s,{code:"too_big",message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):Ct.assertNever(o);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Qs(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 Qs))return!1;let n=new Ve.CustomSet(this._def.checks),r=new Ve.CustomSet(e._def.checks);return n.isEqual(r)&&this._def.coerce===e._def.coerce}};m(jp,"ZodDateImpl");var wx=jp,$p=class Ir 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 Ir(M(w({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Ir(M(w({},this._def),{innerType:this._def.innerType.clone()}))}isEqual(e){return e instanceof Ir?this._def.innerType.isEqual(e._def.innerType)&&gn(this._def.defaultValue(),e._def.defaultValue()):!1}unwrap(){return this._def.innerType}naked(){return this._def.innerType.naked()}mandatory(){return new Ir(M(w({},this._def),{innerType:this._def.innerType.mandatory()}))}};m($p,"ZodDefaultImpl");var xx=$p,Jt=m(t=>{let e=t;return e?e.typeName==="ZodLazy"?Jt(e.schema):e.typeName==="ZodEffects"?Jt(e.innerType()):e.typeName==="ZodLiteral"?[e.value]:e.typeName==="ZodEnum"?e.options:e.typeName==="ZodNativeEnum"?Object.values(e.enum):e.typeName==="ZodDefault"?Jt(e._def.innerType):e.typeName==="ZodUndefined"?[void 0]:e.typeName==="ZodNull"?[null]:e.typeName==="ZodOptional"?[void 0,...Jt(e.unwrap())]:e.typeName==="ZodNullable"?[null,...Jt(e.unwrap())]:e.typeName==="ZodBranded"||e.typeName==="ZodReadonly"?Jt(e.unwrap()):e.typeName==="ZodCatch"?Jt(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 $t.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 X(n,{code:"invalid_type",expected:"object",received:n.parsedType}),{status:"aborted"};let r=this.discriminator,s=n.data[r],o=this.optionsMap.get(s);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(X(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 s of n){let o=Jt(s.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of o){if(r.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);r.set(i,s)}}return r}isEqual(e){if(!(e instanceof Er)||this._def.discriminator!==e._def.discriminator)return!1;let n=m((o,i)=>o.isEqual(i),"compare"),r=new Ve.CustomSet(this._def.options,{compare:n}),s=new Ve.CustomSet(e._def.options,{compare:n});return r.isEqual(s)}};m(Zp,"ZodDiscriminatedUnionImpl");var Px=Zp,Lp=class Kp extends pe{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return X(n,{expected:At.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 X(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 Ne.enum(e,w(w({},this._def),n))}exclude(e,n=this._def){return Ne.enum(this.options.filter(r=>!e.includes(r)),w(w({},this._def),n))}isEqual(e){if(!(e instanceof Kp))return!1;let n=new Ve.CustomSet(this._def.values),r=new Ve.CustomSet(e._def.values);return n.isEqual(r)}};m(Lp,"ZodEnumImpl");var Bx=Lp,Wp=class Xn 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 Xn(M(w({},this._def),{args:n,returns:r}))}getReferences(){return $t.unique([...this._def.args.getReferences(),...this._def.returns.getReferences()])}clone(){return new Xn(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 X(n,{code:"invalid_type",expected:"function",received:n.parsedType}),{status:"aborted"};function r(c,f){return Xs({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Ai(),Si].filter(g=>!!g),issueData:{code:"invalid_arguments",argumentsError:f}})}m(r,"makeArgsIssue");function s(c,f){return Xs({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Ai(),Si].filter(g=>!!g),issueData:{code:"invalid_return_type",returnTypeError:f}})}m(s,"makeReturnsIssue");let o={errorMap:n.common.contextualErrorMap},i=n.data,a=this,l=this._def.returns;return et.zuiPromise(l)?{status:"valid",async value(...c){let f=new Yt([]),g=await a._def.args.parseAsync(c,o).catch(_=>{throw f.addIssue(r(c,_)),f}),p=await Reflect.apply(i,this,g);return await l._def.type.parseAsync(p,o).catch(_=>{throw et.zuiError(_)?(f.addIssue(s(p,_)),f):_})}}:{status:"valid",value(...c){let f=a._def.args.safeParse(c,o);if(!f.success)throw new Yt([r(c,f.error)]);let g=Reflect.apply(i,this,f.data),p=a._def.returns.safeParse(g,o);if(!p.success)throw new Yt([s(g,p.error)]);return p.data}}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Xn(M(w({},this._def),{args:Ne.tuple(e).rest(Ne.unknown())}))}returns(e){return new Xn(M(w({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}isEqual(e){return e instanceof Xn&&this._def.args.isEqual(e._def.args)&&this._def.returns.isEqual(e._def.returns)}};m(Wp,"ZodFunctionImpl");var Ix=Wp,Fp=class _i extends pe{dereference(e){return new _i(M(w({},this._def),{left:this._def.left.dereference(e),right:this._def.right.dereference(e)}))}getReferences(){return $t.unique([...this._def.left.getReferences(),...this._def.right.getReferences()])}clone(){return new _i(M(w({},this._def),{left:this._def.left.clone(),right:this._def.right.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),s=m((o,i)=>{if(o.status==="aborted"||i.status==="aborted")return{status:"aborted"};let a=this._mergeValues(o.value,i.value);return a.valid?((o.status==="dirty"||i.status==="dirty")&&n.dirty(),{status:n.value,value:a.data}):(X(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(([o,i])=>s(o,i)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}isEqual(e){if(!(e instanceof _i))return!1;let n=m((o,i)=>o.isEqual(i),"compare"),r=new Ve.CustomSet([this._def.left,this._def.right],{compare:n}),s=new Ve.CustomSet([e._def.left,e._def.right],{compare:n});return r.isEqual(s)}_mergeValues(e,n){let r=kn(e),s=kn(n);if(e===n)return{valid:!0,data:e};if(r==="object"&&s==="object"){let o=Object.keys(n),i=Object.keys(e).filter(l=>o.indexOf(l)!==-1),a=w(w({},e),n);for(let l of i){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"&&s==="array"){if(e.length!==n.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let a=e[i],l=n[i],c=this._mergeValues(a,l);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r==="date"&&s==="date"&&+e==+n?{valid:!0,data:e}:{valid:!1}}};m(Fp,"ZodIntersectionImpl");var Ex=Fp,zp=class Sr extends pe{get schema(){return this._def.getter()}dereference(e){return new Sr(M(w({},this._def),{getter:()=>this._def.getter().dereference(e)}))}getReferences(){return this._def.getter().getReferences()}clone(){return new Sr(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 Sr?this._def.getter().isEqual(e._def.getter()):!1}naked(){return this._def.getter().naked()}mandatory(){return new Sr(M(w({},this._def),{getter:()=>this._def.getter().mandatory()}))}};m(zp,"ZodLazyImpl");var Sx=zp,qp=class Gp extends pe{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return X(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?gn(this._def.value,e._def.value):!1}};m(qp,"ZodLiteralImpl");var kx=qp,Vp=class bi 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 bi(M(w({},this._def),{keyType:n,valueType:r}))}getReferences(){return $t.unique([...this._def.keyType.getReferences(),...this._def.valueType.getReferences()])}clone(){return new bi(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 X(r,{code:"invalid_type",expected:"map",received:r.parsedType}),{status:"aborted"};let s=this._def.keyType,o=this._def.valueType,i=[...r.data.entries()].map(([a,l],c)=>({key:s._parse(new jt(r,a,r.path,[c,"key"])),value:o._parse(new jt(r,l,r.path,[c,"value"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let l of i){let c=await l.key,f=await l.value;if(c.status==="aborted"||f.status==="aborted")return{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 i){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 bi)||!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 X(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(s=>typeof e[e[s]]!="number"),r={};for(let s of n)r[s]=e[s];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 s=Object.values(n);return X(r,{expected:At.joinValues(s),received:r.parsedType,code:"invalid_type"}),{status:"aborted"}}if(n.indexOf(e.data)===-1){let s=Object.values(n);return X(r,{received:r.data,code:"invalid_enum_value",options:s}),{status:"aborted"}}return{status:"valid",value:e.data}}get enum(){return this._def.values}isEqual(e){return e instanceof Qp?gn(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 X(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 X(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 kr extends pe{dereference(e){return new kr(M(w({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new kr(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 kr?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return new kr(M(w({},this._def),{innerType:this._def.innerType.mandatory()}))}};m(ig,"ZodNullableImpl");var Nx=ig,sg=class wi 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 o=this._getOrReturnCtx(e);return X(o,{code:"invalid_type",expected:"number",received:o.parsedType}),{status:"aborted"}}let r,s=new _t;for(let o of this._def.checks)o.kind==="int"?Number.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),X(r,{code:"invalid_type",expected:"integer",received:"float",message:o.message}),s.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),X(r,{code:"too_small",minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),X(r,{code:"too_big",maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="multipleOf"?this._floatSafeRemainder(e.data,o.value)!==0&&(r=this._getOrReturnCtx(e,r),X(r,{code:"not_multiple_of",multipleOf:o.value,message:o.message}),s.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),X(r,{code:"not_finite",message:o.message}),s.dirty()):Ct.assertNever(o);return{status:s.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,s){return new wi(M(w({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ae.toString(s)}]}))}_addCheck(e){return new wi(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 wi))return!1;let n=new Ve.CustomSet(this._def.checks),r=new Ve.CustomSet(e._def.checks);return n.isEqual(r)}_floatSafeRemainder(e,n){let r=(e.toString().split(".")[1]||"").length,s=(n.toString().split(".")[1]||"").length,o=r>s?r:s,i=parseInt(e.toFixed(o).replace(".","")),a=parseInt(n.toFixed(o).replace(".",""));return i%a/Math.pow(10,o)}};m(sg,"ZodNumberImpl");var Dx=sg,og=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 s in n)r[s]=n[s].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 $t.unique(n)}clone(){let e={},n=this._def.shape();for(let[s,o]of Object.entries(n))e[s]=o.clone();return new gt(M(w({},this._def),{shape:()=>e}))}_parse(e){if(this._getType(e)!=="object"){let f=this._getOrReturnCtx(e);return X(f,{code:"invalid_type",expected:"object",received:f.parsedType}),{status:"aborted"}}let{status:r,ctx:s}=this._processInputParams(e),{shape:o,keys:i}=this._getCached(),a=[];if(this._def.unknownKeys!=="strip")for(let f in s.data)i.includes(f)||a.push(f);let l=[];for(let f of i){let g=o[f],p=s.data[f];l.push({key:{status:"valid",value:f},value:g._parse(new jt(s,p,s.path,f)),alwaysSet:f in s.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:s.data[f]}});else if(c==="strict")a.length>0&&(X(s,{code:"unrecognized_keys",keys:a}),r.dirty());else if(c!=="strip")for(let f of a){let g=s.data[f];l.push({key:{status:"valid",value:f},value:c._parse(new jt(s,g,s.path,f)),alwaysSet:f in s.data})}return s.common.async?Promise.resolve().then(async()=>{let f=[];for(let g of l){let p=await g.key;f.push({key:p,value:await g.value,alwaysSet:g.alwaysSet})}return f}).then(f=>_t.mergeObjectSync(r,f)):_t.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 s,o,i,a;let l=(i=(o=(s=this._def).errorMap)==null?void 0:o.call(s,n,r).message)!=null?i: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 Ne.any();if(this._def.unknownKeys==="strict")return Ne.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(s=>{e[s]&&this.shape[s]&&(n[s]=this.shape[s])}),new gt(M(w({},this._def),{shape:()=>n}))}omit(e){let n={};return Object.entries(this.shape).forEach(([s,o])=>{e[s]||(n[s]=o)}),new gt(M(w({},this._def),{shape:()=>n}))}partial(e){let n={};return Object.keys(this.shape).forEach(s=>{let o=this.shape[s];e&&!e[s]?n[s]=o:n[s]=o?.optional()}),new gt(M(w({},this._def),{shape:()=>n}))}required(e){let n={};return Object.entries(this.shape).forEach(([r,s])=>{if(e&&!e[r])n[r]=s;else{let i=s;for(;et.zuiOptional(i);)i=i._def.innerType;n[r]=i}}),new gt(M(w({},this._def),{shape:()=>n}))}keyof(){let e=Object.keys(this.shape);return Ne.enum(e)}isEqual(e){if(!(e instanceof gt)||!this._unknownKeysEqual(e))return!1;let n=this._def.shape(),r=e._def.shape(),s=m((a,l)=>a[0]===l[0]&&a[1].isEqual(l[1]),"compare"),o=new Ve.CustomSet(Object.entries(n),{compare:s}),i=new Ve.CustomSet(Object.entries(r),{compare:s});return o.isEqual(i)}_unknownKeysEqual(e){let n=this.additionalProperties(),r=e.additionalProperties();return n===void 0||r===void 0?n===r:n.isEqual(r)}};m(og,"ZodObjectImpl");var ag=og,lg=class xi extends pe{dereference(e){return new xi(M(w({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new xi(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 xi?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 Pi extends pe{dereference(e){return new Pi(M(w({},this._def),{in:this._def.in.dereference(e),out:this._def.out.dereference(e)}))}getReferences(){return $t.unique([...this._def.in.getReferences(),...this._def.out.getReferences()])}clone(){return new Pi(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 o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?{status:"aborted"}:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})},"handleAsync")();{let s=this._def.in._parseSync({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._parseSync({data:s.value,path:r.path,parent:r})}}isEqual(e){return!(!(e instanceof Pi)||!this._def.in.isEqual(e._def.in)||!this._def.out.isEqual(e._def.out))}};m(ug,"ZodPipelineImpl");var Ux=ug,cg=class Bi extends pe{unwrap(){return this._def.type}dereference(e){return new Bi(M(w({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new Bi(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?(X(n,{code:"invalid_type",expected:"promise",received:n.parsedType}),{status:"aborted"}):{status:"valid",value:(n.parsedType==="promise"?n.data:Promise.resolve(n.data)).then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap}))}}isEqual(e){return e instanceof Bi?this._def.type.isEqual(e._def.type):!1}naked(){return this._def.type.naked()}};m(cg,"ZodPromiseImpl");var jx=cg,dg=class Ar 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 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){let n=this._def.innerType._parse(e);return Ci(n)?n.then(this._freeze):this._freeze(n)}unwrap(){return this._def.innerType}isEqual(e){return e instanceof Ar?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return new Ar(M(w({},this._def),{innerType:this._def.innerType.mandatory()}))}};m(dg,"ZodReadonlyImpl");var $x=dg,fg=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 $t.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!=="object")return X(r,{code:"invalid_type",expected:"object",received:r.parsedType}),{status:"aborted"};let s=[],o=this._def.keyType,i=this._def.valueType;for(let a in r.data)s.push({key:o._parse(new jt(r,a,r.path,a)),value:i._parse(new jt(r,r.data[a],r.path,a))});return r.common.async?_t.mergeObjectAsync(n,s):_t.mergeObjectSync(n,s)}get element(){return this._def.valueType}isEqual(e){return!(!(e instanceof Ii)||!this._def.keyType.isEqual(e._def.keyType)||!this._def.valueType.isEqual(e._def.valueType))}};m(fg,"ZodRecordImpl");var Nc=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 X(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 Qn extends pe{dereference(e){return new Qn(M(w({},this._def),{valueType:this._def.valueType.dereference(e)}))}getReferences(){return this._def.valueType.getReferences()}clone(){return new Qn(M(w({},this._def),{valueType:this._def.valueType.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!=="set")return X(r,{code:"invalid_type",expected:"set",received:r.parsedType}),{status:"aborted"};let s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(X(r,{code:"too_small",minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(X(r,{code:"too_big",maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());let o=this._def.valueType;function i(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(i,"finalizeSet");let a=[...r.data.values()].map((l,c)=>o._parse(new jt(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>i(l)):i(a)}min(e,n){return new Qn(M(w({},this._def),{minSize:{value:e,message:ae.toString(n)}}))}max(e,n){return new Qn(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,s,o;if(!(e instanceof Qn))return!1;let i=(n=this._def.minSize)==null?void 0:n.value,a=(r=e._def.minSize)==null?void 0:r.value;if(i!==a)return!1;let l=(s=this._def.maxSize)==null?void 0:s.value,c=(o=e._def.maxSize)==null?void 0:o.value;return l!==c?!1:this._def.valueType.isEqual(e._def.valueType)}};m(mg,"ZodSetImpl");var Lx=mg,Kx=/^c[^\s-]{8,}$/i,Wx=/^[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})+$",Us,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 er extends pe{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!=="string"){let o=this._getOrReturnCtx(e);return X(o,{code:"invalid_type",expected:"string",received:o.parsedType}),{status:"aborted"}}let r=new _t,s;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(s=this._getOrReturnCtx(e,s),X(s,{code:"too_small",minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="max")e.data.length>o.value&&(s=this._getOrReturnCtx(e,s),X(s,{code:"too_big",maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){let i=e.data.length>o.value,a=e.data.length<o.value;(i||a)&&(s=this._getOrReturnCtx(e,s),i?X(s,{code:"too_big",maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&X(s,{code:"too_small",minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")qx.test(e.data)||(s=this._getOrReturnCtx(e,s),X(s,{validation:"email",code:"invalid_string",message:o.message}),r.dirty());else if(o.kind==="emoji")Us||(Us=new RegExp(Gx,"u")),Us.test(e.data)||(s=this._getOrReturnCtx(e,s),X(s,{validation:"emoji",code:"invalid_string",message:o.message}),r.dirty());else if(o.kind==="uuid")zx.test(e.data)||(s=this._getOrReturnCtx(e,s),X(s,{validation:"uuid",code:"invalid_string",message:o.message}),r.dirty());else if(o.kind==="cuid")Kx.test(e.data)||(s=this._getOrReturnCtx(e,s),X(s,{validation:"cuid",code:"invalid_string",message:o.message}),r.dirty());else if(o.kind==="cuid2")Wx.test(e.data)||(s=this._getOrReturnCtx(e,s),X(s,{validation:"cuid2",code:"invalid_string",message:o.message}),r.dirty());else if(o.kind==="ulid")Fx.test(e.data)||(s=this._getOrReturnCtx(e,s),X(s,{validation:"ulid",code:"invalid_string",message:o.message}),r.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),X(s,{validation:"url",code:"invalid_string",message:o.message}),r.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),X(s,{validation:"regex",code:"invalid_string",message:o.message}),r.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(s=this._getOrReturnCtx(e,s),X(s,{code:"invalid_string",validation:{includes:o.value,position:o.position},message:o.message}),r.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(s=this._getOrReturnCtx(e,s),X(s,{code:"invalid_string",validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(s=this._getOrReturnCtx(e,s),X(s,{code:"invalid_string",validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?Tp.generateDatetimeRegex(o).test(e.data)||(s=this._getOrReturnCtx(e,s),X(s,{code:"invalid_string",validation:"datetime",message:o.message}),r.dirty()):o.kind==="ip"?yg(e.data,o.version)||(s=this._getOrReturnCtx(e,s),X(s,{validation:"ip",code:"invalid_string",message:o.message}),r.dirty()):Ct.assertNever(o);return{status:r.value,value:e.data}}_addCheck(e){return new er(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 er(M(w({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}secret(){return this._def[ke]=M(w({},this._def[ke]),{secret:!0}),this}toLowerCase(){return new er(M(w({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new er(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 er))return!1;let n=new Ve.CustomSet(this._def.checks),r=new Ve.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 X(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 Cr extends pe{innerType(){return this._def.schema}sourceType(){return et.zuiEffects(this._def.schema)?this._def.schema.sourceType():this._def.schema}dereference(e){return new Cr(M(w({},this._def),{schema:this._def.schema.dereference(e)}))}getReferences(){return this._def.schema.getReferences()}clone(){return new Cr(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 s=r.effect(n.data,{path:n.path});if(n.common.async)return Promise.resolve(s).then(async o=>{if(o??(o={status:"valid",value:n.data}),this._processResult(n,o),o.status==="aborted")return{status:"aborted"};let i=await this._def.schema._parseAsync({data:o.value,path:n.path,parent:n});return i.status==="aborted"?{status:"aborted"}:i.status==="dirty"?{status:"dirty",value:i.value}:o.status==="dirty"?{status:"dirty",value:i.value}:i});{if(s instanceof Promise)throw new Error("Asynchronous upstream transform encountered during synchronous parse operation. Use .parseAsync instead.");if(s??(s={status:"valid",value:n.data}),this._processResult(n,s),s.status==="aborted")return{status:"aborted"};let o=this._def.schema._parseSync({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(r.type==="downstream")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(s.status==="aborted"||s.status==="dirty"&&r.failFast)return s;let o=r.effect(s.value,{path:n.path});if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return o??(o={status:"valid",value:s.value}),this._processResult(n,o),o.status==="aborted"?{status:"aborted"}:o.status==="dirty"?{status:"dirty",value:o.value}:s.status==="dirty"?{status:"dirty",value:o.value}:o}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"||s.status==="dirty"&&r.failFast?s:Promise.resolve(r.effect(s.value,{path:n.path})).then(o=>(o??(o={status:"valid",value:s.value}),this._processResult(n,o),o.status==="aborted"?{status:"aborted"}:o.status==="dirty"?{status:"dirty",value:o.value}:s.status==="dirty"?{status:"dirty",value:o.value}:o)));Ct.assertNever(r)}_processResult(e,n){if(n.status!=="valid")for(let r of n.issues)X(e,r)}isEqual(e){return!(e instanceof Cr)||!this._def.schema.isEqual(e._def.schema)?!1:this._def.effect.type==="upstream"?e._def.effect.type!=="upstream"?!1:At.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:At.compareFunctions(this._def.effect.effect,e._def.effect.effect):(this._def.effect,!1)}naked(){return this._def.schema.naked()}mandatory(){return new Cr(M(w({},this._def),{schema:this._def.schema.mandatory()}))}};m(_g,"ZodEffectsImpl");var ho=_g,bg=class Or extends pe{dereference(e){let n=this._def.items.map(s=>s.dereference(e)),r=this._def.rest?this._def.rest.dereference(e):null;return new Or(M(w({},this._def),{items:n,rest:r}))}getReferences(){return $t.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 Or(M(w({},this._def),{items:e,rest:n}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!=="array")return X(r,{code:"invalid_type",expected:"array",received:r.parsedType}),{status:"aborted"};if(r.data.length<this._def.items.length)return X(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&&(X(r,{code:"too_big",maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let o=[...r.data].map((i,a)=>{let l=this._def.items[a]||this._def.rest;return l?l._parse(new jt(r,i,r.path,a)):null}).filter(i=>!!i);return r.common.async?Promise.all(o).then(i=>_t.mergeArray(n,i)):_t.mergeArray(n,o)}get items(){return this._def.items}rest(e){return new Or(M(w({},this._def),{rest:e}))}isEqual(e){if(!(e instanceof Or)||!this._restEquals(e))return!1;let n=m((o,i)=>o.isEqual(i),"compare"),r=new Ve.CustomSet(this._def.items,{compare:n}),s=new Ve.CustomSet(e._def.items,{compare:n});return r.isEqual(s)}_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 X(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 Ne.never(w({},this._def))}};m(wg,"ZodUndefinedImpl");var eP=wg,Pg=class Rr extends pe{dereference(e){let n=this._def.options.map(r=>r.dereference(e));return new Rr(M(w({},this._def),{options:n}))}getReferences(){return $t.unique(this._def.options.reduce((e,n)=>[...e,...n.getReferences()],[]))}clone(){let e=this._def.options.map(n=>n.clone());return new Rr(M(w({},this._def),{options:e}))}_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function s(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;let i=o.map(a=>new Yt(a.ctx.common.issues));return X(n,{code:"invalid_union",unionErrors:i}),{status:"aborted"}}if(m(s,"handleResults"),n.common.async)return Promise.all(r.map(async o=>{let i=M(w({},n),{common:M(w({},n.common),{issues:[]}),parent:null});return{result:await o._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(s);{let o,i=[];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"&&!o&&(o={result:f,ctx:c}),c.common.issues.length&&i.push(c.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;let a=i.map(l=>new Yt(l));return X(n,{code:"invalid_union",unionErrors:a}),{status:"aborted"}}}get options(){return this._def.options}isEqual(e){if(!(e instanceof Rr))return!1;let n=m((o,i)=>o.isEqual(i),"compare"),r=new Ve.CustomSet([...this._def.options],{compare:n}),s=new Ve.CustomSet([...e._def.options],{compare:n});return r.isEqual(s)}mandatory(){let e=this._def.options.filter(o=>!et.zuiUndefined(o)).map(o=>o.mandatory()),[n,r,...s]=e;return n?r?new Rr(M(w({},this._def),{options:[n,r,...s]})):n:Ne.never(w({},this._def))}};m(Pg,"ZodUnionImpl");var tP=Pg,Bg=class Ig extends pe{constructor(){super(...arguments),this._unknown=!0}_parse(e){return{status:"valid",value:e.data}}isEqual(e){return e instanceof Ig}};m(Bg,"ZodUnknownImpl");var nP=Bg,Eg=class Sg extends pe{_parse(e){if(this._getType(e)!=="undefined"){let r=this._getOrReturnCtx(e);return X(r,{code:"invalid_type",expected:"void",received:r.parsedType}),{status:"aborted"}}return{status:"valid",value:e.data}}isEqual(e){return e instanceof Sg}};m(Eg,"ZodVoidImpl");var rP=Eg,iP=m(t=>t instanceof Error,"_isError"),sP=m(t=>typeof t=="object"&&t!==null,"_isObject"),et={zuiError:t=>t instanceof Yt||iP(t)&&"__type__"in t&&t.__type__==="ZuiError",zuiType:t=>t instanceof pe||sP(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:s,supportsExtensions:o,[ke]:i}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);let a=i?Object.fromEntries(Object.entries(i).filter(([c])=>c!=="secret"||o?.includes("secret"))):void 0;return e?{errorMap:e,description:s,[ke]: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:s,[ke]:a}},"_processCreateParams"),Zi=m((t,e={},n)=>t?On().downstream(r=>{var s,o;if(!t(r)){let i=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e;return((o=(s=i.fatal)!=null?s:n)!=null?o:!0)?Uo(w({code:"custom"},i)):jo(r,w({code:"custom"},i))}}):On(),"customType"),To=m((t,e={message:`Input not instance of ${t.name}`})=>Zi(n=>n instanceof t,e),"instanceOfType"),On=m(t=>new yx(w({typeName:"ZodAny"},ye(t))),"anyType"),yn=m(t=>new nP(w({typeName:"ZodUnknown"},ye(t))),"unknownType"),Lr=m(t=>new Rx(w({typeName:"ZodNever"},ye(t))),"neverType"),vo=m(t=>new rP(w({typeName:"ZodVoid"},ye(t))),"voidType"),qr=m(t=>new Mx(w({typeName:"ZodNull"},ye(t))),"nullType"),Li=m(t=>new eP(w({typeName:"ZodUndefined"},ye(t))),"undefinedType"),_o=m(t=>new Xx(w({typeName:"ZodSymbol"},ye(t))),"symbolType"),bo=m(t=>new Cx(w({typeName:"ZodNaN"},ye(t))),"nanType"),Qt=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"),$n=m(t=>new Dx(w({checks:[],typeName:"ZodNumber",coerce:t?.coerce||!1},ye(t))),"numberType"),Zn=m(t=>new vx(w({typeName:"ZodBoolean",coerce:t?.coerce||!1},ye(t))),"booleanType"),Ki=m(t=>{var e;return new Tx(w({checks:[],typeName:"ZodBigInt",coerce:(e=t?.coerce)!=null?e:!1},ye(t)))},"bigIntType"),Wi=m(t=>new wx(w({checks:[],coerce:t?.coerce||!1,typeName:"ZodDate"},ye(t))),"dateType"),Fi=m(t=>new Zx({typeName:"ZodRef",uri:t}),"refType"),Kr=m((t,e)=>new kx(w({value:t,typeName:"ZodLiteral"},ye(e))),"literalType"),zi=m((t,e)=>new Bx(w({values:t,typeName:"ZodEnum"},ye(e))),"enumType"),wo=m((t,e)=>new Ox(w({values:t,typeName:"ZodNativeEnum"},ye(e))),"nativeEnumType"),An=m((t,e)=>new hx(w({type:t,minLength:null,maxLength:null,exactLength:null,typeName:"ZodArray"},ye(e))),"arrayType"),rr=m((t,e)=>new ag(w({shape:()=>t,unknownKeys:"strip",typeName:"ZodObject"},ye(e))),"objectType"),xo=m((t,e)=>new ag(w({shape:()=>t,unknownKeys:"strict",typeName:"ZodObject"},ye(e))),"strictObjectType"),ir=m((t,e)=>new tP(w({options:t,typeName:"ZodUnion"},ye(e))),"unionType"),qi=m((t,e,n)=>new Px(w({typeName:"ZodDiscriminatedUnion",discriminator:t,options:e},ye(n))),"discriminatedUnionType"),Gi=m((t,e,n)=>new Ex(w({left:t,right:e,typeName:"ZodIntersection"},ye(n))),"intersectionType"),Gr=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"),Wr=m((t,e,n)=>e instanceof pe?new Nc(w({keyType:t,valueType:e,typeName:"ZodRecord"},ye(n))):new Nc(w({keyType:Qt(),valueType:t,typeName:"ZodRecord"},ye(e))),"recordType"),Po=m((t,e,n)=>new Ax(w({valueType:e,keyType:t,typeName:"ZodMap"},ye(n))),"mapType"),Vi=m((t,e)=>new Lx(w({valueType:t,minSize:null,maxSize:null,typeName:"ZodSet"},ye(e))),"setType"),Bo=m((t,e)=>new Sx(w({getter:t,typeName:"ZodLazy"},ye(e))),"lazyType"),Io=m((t,e)=>new jx(w({type:t,typeName:"ZodPromise"},ye(e))),"promiseType"),Eo=m((t,e,n)=>new Ix(w({args:t||Gr([]).rest(yn()),returns:e||yn(),typeName:"ZodFunction"},ye(n))),"functionType"),So=m((t,e,n)=>new ho(w({schema:e,effect:{type:"upstream",effect:(r,s)=>{let o=t(r,s);return o instanceof Promise?o.then(i=>Oi(i)):Oi(o)}},typeName:"ZodEffects"},ye(n))),"preprocessType"),ko=m((t,e,n)=>new ho(w({schema:e,effect:{type:"upstream",effect:t},typeName:"ZodEffects"},ye(n))),"upstreamType"),Ao=m((t,e,n)=>new ho(w({schema:t,effect:{type:"downstream",effect:e,failFast:n?.failFast},typeName:"ZodEffects"},ye(n))),"downstreamType"),Co=m((t,e)=>new Hx(w({innerType:t,typeName:"ZodOptional"},ye(e))),"optionalType"),Oo=m((t,e)=>new Nx(w({innerType:t,typeName:"ZodNullable"},ye(e))),"nullableType"),Ro=m((t,e)=>new $x(w({innerType:t,typeName:"ZodReadonly"},ye(e))),"readonlyType"),Mo=m((t,e,n)=>new xx(w({innerType:t,typeName:"ZodDefault",defaultValue:typeof e=="function"?e:()=>e},ye(n))),"defaultType"),No=m((t,e,n)=>new bx(w({innerType:t,typeName:"ZodCatch",catchValue:typeof e=="function"?e:()=>e},ye(n))),"catchType"),Do=m((t,e)=>new Ux({in:t,out:e,typeName:"ZodPipeline"}),"pipelineType"),Ho=m(t=>new _x(w({typeName:"ZodBranded",type:t},ye({supportsExtensions:["secret"]}))),"brandedType");Bp({any:On,array:An,bigint:Ki,boolean:Zn,branded:Ho,catch:No,custom:Zi,date:Wi,default:Mo,discriminatedUnion:qi,enum:zi,function:Eo,instanceof:To,intersection:Gi,lazy:Bo,literal:Kr,map:Po,nan:bo,nativeEnum:wo,never:Lr,null:qr,nullable:Oo,number:$n,object:rr,optional:Co,pipeline:Do,preprocess:So,upstream:ko,downstream:Ao,promise:Io,record:Wr,ref:Fi,readonly:Ro,set:Vi,strictObject:xo,string:Qt,symbol:_o,tuple:Gr,undefined:Li,union:ir,unknown:yn,void:vo});var kg={string(t){return Qt(M(w({},t),{coerce:!0}))},number(t){return $n(M(w({},t),{coerce:!0}))},boolean(t){return Zn(M(w({},t),{coerce:!0}))},bigint(t){return Ki(M(w({},t),{coerce:!0}))},date(t){return Wi(M(w({},t),{coerce:!0}))}},Oi=m(t=>({status:"valid",value:t}),"OK"),Uo=m((t,...e)=>({status:"aborted",issues:[t,...e]}),"ERR"),jo=m((t,e,...n)=>({status:"dirty",value:t,issues:[e,...n]}),"DIRTY"),Ag={};Ot(Ag,{JSONSchemaToZuiError:()=>Ji,ObjectToZuiError:()=>eo,UnrepresentableGenericError:()=>to,UnsupportedJSONSchemaToZuiError:()=>pn,UnsupportedZuiCheckToJSONSchemaError:()=>Hg,UnsupportedZuiToJSONSchemaError:()=>dt,UnsupportedZuiToTypescriptSchemaError:()=>Sn,UnsupportedZuiToTypescriptTypeError:()=>Wg,UntitledDeclarationError:()=>zg,ZuiToJSONSchemaError:()=>Yi,ZuiToTypescriptSchemaError:()=>$g,ZuiToTypescriptTypeError:()=>Xi,ZuiTransformError:()=>sr});var Cg=class extends Error{constructor(e,n){super(n),this.transform=e}};m(Cg,"ZuiTransformError");var sr=Cg,Og=class extends sr{constructor(e){super("json-schema-to-zui",e)}};m(Og,"JSONSchemaToZuiError");var Ji=Og,Rg=class extends sr{constructor(e){super("object-to-zui",e)}};m(Rg,"ObjectToZuiError");var eo=Rg,Mg=class extends sr{constructor(e){super("zui-to-json-schema",e)}};m(Mg,"ZuiToJSONSchemaError");var Yi=Mg,Ng=class extends Yi{constructor(e,{suggestedAlternative:n}={}){super(`Zod type ${e} cannot be transformed to JSON Schema.`+(n?` Suggested alternative: ${n}`:""))}};m(Ng,"UnsupportedZuiToJSONSchemaError");var dt=Ng,Dg=class extends Yi{constructor({zodType:e,checkKind:n}){super(`Zod check .${n}() of type ${e} cannot be transformed to JSON Schema.`)}};m(Dg,"UnsupportedZuiCheckToJSONSchemaError");var Hg=Dg,Ug=class extends Ji{constructor(e){super(`JSON Schema ${JSON.stringify(e)} cannot be transformed to ZUI type.`)}};m(Ug,"UnsupportedJSONSchemaToZuiError");var pn=Ug,jg=class extends sr{constructor(e){super("zui-to-typescript-schema",e)}};m(jg,"ZuiToTypescriptSchemaError");var $g=jg,Zg=class extends $g{constructor(e){super(`Zod type ${e} cannot be transformed to TypeScript schema.`)}};m(Zg,"UnsupportedZuiToTypescriptSchemaError");var Sn=Zg,Lg=class extends sr{constructor(e){super("zui-to-typescript-type",e)}};m(Lg,"ZuiToTypescriptTypeError");var Xi=Lg,Kg=class extends Xi{constructor(e){super(`Zod type ${e} cannot be transformed to TypeScript type.`)}};m(Kg,"UnsupportedZuiToTypescriptTypeError");var Wg=Kg,Fg=class extends Xi{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 Xi{constructor(){super('ZodRef can only be transformed to a TypeScript type with a "type" declaration.')}};m(qg,"UnrepresentableGenericError");var to=qg,oP=m(t=>{let e;try{e=new Function("z",`return ${t}`)(en)}catch(n){return{sucess:!1,error:`Failed to evaluate schema: ${(n instanceof Error?n:new Error(String(n))).message}`}}return et.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 s=t[e],o="";if(s!==void 0){let i=n({value:s,json:JSON.stringify(s)});if(i){let a=i[0],l=i.length===3?i[1]:"",c=i.length===3?i[2]:i[1];o+=a,((r=t.errorMessage)==null?void 0:r[e])!==void 0&&(o+=l+JSON.stringify(t.errorMessage[e])),o+=c}}return o}m(at,"withMessage");var Mr=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?{[Mr]:n}:{[Mr]:n,not:{}});else{if(Mr in r)return t;e.push(M(w({},r),{[Mr]:n}))}}return e},"ensureOriginalIndex");function Fr(t,e){if(t.allOf.length===0)return"z.never()";if(t.allOf.length===1){let n=t.allOf[0];return tt(n,M(w({},e),{path:[...e.path,"allOf",n[Mr]]}))}else{let[n,r]=aP(uP(t.allOf));return`z.intersection(${Fr({allOf:n},e)}, ${Fr({allOf:r},e)})`}}m(Fr,"parseAllOf");var Gg=m((t,e)=>t.anyOf.length?t.anyOf.length===1?tt(t.anyOf[0],M(w({},e),{path:[...e.path,"anyOf",0]})):`z.union([${t.anyOf.map((n,r)=>tt(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,s)=>tt(r,M(w({},e),{path:[...e.path,"items",s]})))}])`;let n=t.items?`z.array(${tt(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[ke])!=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"),$o=m((t,e)=>t.oneOf.length?t.oneOf.length===1?tt(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)=>tt(n,M(w({},e),{path:[...e.path,"oneOf",r]}))).join(", ")}];
|
|
15
15
|
const errors = schemas.reduce(
|
|
16
16
|
(errors: z.ZodError[], schema) =>
|
|
@@ -27,22 +27,22 @@ var Co=Object.defineProperty;var FT=Object.getOwnPropertyDescriptor;var zT=Objec
|
|
|
27
27
|
message: "Invalid input: Should pass single schema",
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
-
})`:"z.any()","parseOneOf"),gP=m((t,e)=>{var n,r;if(t.oneOf.length<=1||!((n=t.discriminator)!=null&&n.propertyName))return $
|
|
30
|
+
})`:"z.any()","parseOneOf"),gP=m((t,e)=>{var n,r;if(t.oneOf.length<=1||!((n=t.discriminator)!=null&&n.propertyName))return $o(t,e);let s=t.oneOf.map((o,i)=>tt(o,M(w({},e),{path:[...e.path,"oneOf",i]})));return`z.discriminatedUnion("${(r=t.discriminator)==null?void 0:r.propertyName}", [${s.join(", ")}])`},"parseDiscriminator"),mP=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"),yP=m((t,e)=>{let n=tt(t.if,M(w({},e),{path:[...e.path,"if"]})),r=tt(t.then,M(w({},e),{path:[...e.path,"then"]})),s=tt(t.else,M(w({},e),{path:[...e.path,"else"]}));return`z.union([${r}, ${s}]).superRefine((value,ctx) => {
|
|
31
31
|
const result = ${n}.safeParse(value).success
|
|
32
32
|
? ${r}.safeParse(value)
|
|
33
|
-
: ${
|
|
33
|
+
: ${s}.safeParse(value);
|
|
34
34
|
if (!result.success) {
|
|
35
35
|
result.error.errors.forEach((error) => ctx.addIssue(error))
|
|
36
36
|
}
|
|
37
|
-
})`},"parseIfThenElse"),hP=m((t,e)=>`z.union([${t.type.map(n=>tt(M(w({},t),{type:n}),e)).join(", ")}])`,"parseMultipleType"),TP=m((t,e)=>`z.any().refine((value) => !${tt(t.not,M(w({},e),{path:[...e.path,"not"]}))}.safeParse(value).success, "Invalid input: Should NOT be valid against schema")`,"parseNot"),vP=m(t=>"z.null()","parseNull"),_P=m((t,e)=>`${tt(lP(t,"nullable"),e,!0)}.nullable()`,"parseNullable"),bP=m(t=>{var e;let n="z.number()";return(e=t[ke])!=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:
|
|
38
|
-
`,
|
|
39
|
-
`,r&&(t.properties?
|
|
40
|
-
`:
|
|
41
|
-
`);for(let a in t.patternProperties)
|
|
42
|
-
`,r&&(
|
|
43
|
-
`),
|
|
44
|
-
`,
|
|
45
|
-
`,
|
|
37
|
+
})`},"parseIfThenElse"),hP=m((t,e)=>`z.union([${t.type.map(n=>tt(M(w({},t),{type:n}),e)).join(", ")}])`,"parseMultipleType"),TP=m((t,e)=>`z.any().refine((value) => !${tt(t.not,M(w({},e),{path:[...e.path,"not"]}))}.safeParse(value).success, "Invalid input: Should NOT be valid against schema")`,"parseNot"),vP=m(t=>"z.null()","parseNull"),_P=m((t,e)=>`${tt(lP(t,"nullable"),e,!0)}.nullable()`,"parseNullable"),bP=m(t=>{var e;let n="z.number()";return(e=t[ke])!=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:s})=>r===1?n.startsWith("z.number().int(")?void 0:[".int(",")"]:[`.multipleOf(${s}`,", ",")"]),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 Vg(t,e){let n;t.properties&&(Object.keys(t.properties).length?(n="z.object({ ",n+=Object.keys(t.properties).map(i=>{let a=t.properties[i],l=`${JSON.stringify(i)}: ${tt(a,M(w({},e),{path:[...e.path,"properties",i]}))}`,c=typeof a=="object"&&a.default!==void 0||typeof t.default=="object"&&t.default!==null&&i in t.default,f=Array.isArray(t.required)?t.required.includes(i):typeof a=="object"&&a.required===!0;return!c&&!f?`${l}.optional()`:l}).join(", "),n+=" })"):n="z.object({})");let r=t.additionalProperties!==void 0?tt(t.additionalProperties,M(w({},e),{path:[...e.path,"additionalProperties"]})):void 0,s;if(t.patternProperties){let i=Object.fromEntries(Object.entries(t.patternProperties).map(([a,l])=>[a,tt(l,M(w({},e),{path:[...e.path,"patternProperties",a]}))],{}));s="",n?r?s+=`.catchall(z.union([${[...Object.values(i),r].join(", ")}]))`:Object.keys(i).length>1?s+=`.catchall(z.union([${Object.values(i).join(", ")}]))`:s+=`.catchall(${Object.values(i)})`:r?s+=`z.record(z.union([${[...Object.values(i),r].join(", ")}]))`:Object.keys(i).length>1?s+=`z.record(z.union([${Object.values(i).join(", ")}]))`:s+=`z.record(${Object.values(i)})`,s+=`.superRefine((value, ctx) => {
|
|
38
|
+
`,s+=`for (const key in value) {
|
|
39
|
+
`,r&&(t.properties?s+=`let evaluated = [${Object.keys(t.properties).map(a=>JSON.stringify(a)).join(", ")}].includes(key)
|
|
40
|
+
`:s+=`let evaluated = false
|
|
41
|
+
`);for(let a in t.patternProperties)s+="if (key.match(new RegExp("+JSON.stringify(a)+`))) {
|
|
42
|
+
`,r&&(s+=`evaluated = true
|
|
43
|
+
`),s+="const result = "+i[a]+`.safeParse(value[key])
|
|
44
|
+
`,s+=`if (!result.success) {
|
|
45
|
+
`,s+=`ctx.addIssue({
|
|
46
46
|
path: [...ctx.path, key],
|
|
47
47
|
code: 'custom',
|
|
48
48
|
message: \`Invalid input: Key matching regex /\${key}/ must match schema\`,
|
|
@@ -50,12 +50,12 @@ var Co=Object.defineProperty;var FT=Object.getOwnPropertyDescriptor;var zT=Objec
|
|
|
50
50
|
issues: result.error.issues
|
|
51
51
|
}
|
|
52
52
|
})
|
|
53
|
-
`,
|
|
54
|
-
`,
|
|
55
|
-
`;r&&(
|
|
56
|
-
`,
|
|
57
|
-
`,
|
|
58
|
-
`,
|
|
53
|
+
`,s+=`}
|
|
54
|
+
`,s+=`}
|
|
55
|
+
`;r&&(s+=`if (!evaluated) {
|
|
56
|
+
`,s+="const result = "+r+`.safeParse(value[key])
|
|
57
|
+
`,s+=`if (!result.success) {
|
|
58
|
+
`,s+=`ctx.addIssue({
|
|
59
59
|
path: [...ctx.path, key],
|
|
60
60
|
code: 'custom',
|
|
61
61
|
message: \`Invalid input: must match catchall schema\`,
|
|
@@ -63,25 +63,25 @@ var Co=Object.defineProperty;var FT=Object.getOwnPropertyDescriptor;var zT=Objec
|
|
|
63
63
|
issues: result.error.issues
|
|
64
64
|
}
|
|
65
65
|
})
|
|
66
|
-
`,
|
|
67
|
-
`,
|
|
68
|
-
`),
|
|
69
|
-
`,o+="})"}let s=n?o?n+o:r?r==="z.never()"?n+".strict()":n+`.catchall(${r})`:n:o||(r?`z.record(${r})`:"z.record(z.any())");return qe.an.anyOf(t)&&(s+=`.and(${Gg(M(w({},t),{anyOf:t.anyOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?M(w({},i),{type:"object"}):i)}),e)})`),qe.a.oneOf(t)&&(s+=`.and(${$s(M(w({},t),{oneOf:t.oneOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?M(w({},i),{type:"object"}):i)}),e)})`),qe.an.allOf(t)&&(s+=`.and(${Fr(M(w({},t),{allOf:t.allOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?M(w({},i),{type:"object"}):i)}),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[ke])!=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"),tt=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 o=IP(t,e);return n||(o=PP(t,o),e.withoutDefaults||(o=BP(t,o))),r.r=o,o},"parseSchema"),PP=m((t,e)=>(t.description&&(e+=`.describe(${JSON.stringify(t.description)})`),e),"addMeta"),BP=m((t,e)=>(t.default!==void 0&&(e+=`.default(${JSON.stringify(t.default)})`),e),"addDefaults"),IP=m((t,e)=>qe.a.nullable(t)?_P(t,e):qe.an.object(t)?Vg(t,e):qe.an.array(t)?cP(t,e):qe.an.anyOf(t)?Gg(t,e):qe.an.allOf(t)?Fr(t,e):qe.a.discriminator(t)?gP(t,e):qe.a.oneOf(t)?$s(t,e):qe.a.not(t)?TP(t,e):qe.an.enum(t)?mP(t):qe.a.const(t)?fP(t):qe.a.multipleType(t)?hP(t,e):qe.a.primitive(t,"string")?xP(t):qe.a.primitive(t,"number")||qe.a.primitive(t,"integer")?bP(t):qe.a.primitive(t,"boolean")?dP(t):qe.a.primitive(t,"null")?vP(t):qe.a.conditional(t)?yP(t,e):qe.a.ref(t)?wP(t):pP(t),"selectParser"),qe={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}},EP=m(t=>tt(t,{seen:new Map,path:[]}),"jsonSchemaToZodStr"),SP=m(t=>{let e=EP(t);e=e.replaceAll("errors: z.ZodError[]","errors");let n=sP(e);if(!n.sucess)throw new Ji(n.error);return n.value},"jsonSchemaToZod"),Nr=m((t,e)=>{var n,r;if(e[ke]&&t._def&&(t.naked()._def[ke]=e[ke]),((n=t._def)==null?void 0:n.typeName)==="ZodObject"&&e.type==="object"&&e.properties&&Object.entries(e.properties).forEach(([o,s])=>{let i=typeof t._def.shape=="function"?t._def.shape():t._def.shape;i[o]&&Nr(i[o],s)}),((r=t._def)==null?void 0:r.typeName)==="ZodRecord"&&e.type==="object"&&e.additionalProperties&&Nr(t._def.valueType,e.additionalProperties),e.type==="array"&&e.items){let o=e.items;if(typeof o=="object"&&!Array.isArray(o)){let s=t._def.type;s&&Nr(s,o)}else Array.isArray(o)&&o.forEach((s,i)=>{let a=t._def;a.typeName===fe.ZodTuple&&Nr(a.items[i],s)})}},"applyZuiPropsRecursively"),kP=m(t=>{let e=SP(t);return Nr(e,t),e},"fromJSONSchemaLegacy"),AP=m(t=>{var e,n;return t.anyOf!==void 0&&t.anyOf.length===2&&t.anyOf.some(r=>typeof r!="boolean"&&Jg(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"),Jg=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,e)=>NP(t)?HP(t,e):DP(t)?UP(t,e):jP(t,e),"arrayJSONSchemaToZuiArray"),NP=m(t=>Array.isArray(t.items),"_isTuple"),DP=m(t=>t.items!==void 0&&t.uniqueItems,"_isSet"),HP=m(({items:t,additionalItems:e},n)=>{let r=t.map(n),o=Gr(r);return e!==void 0&&(o=o.rest(n(e))),o},"_handleTuple"),UP=m(({items:t,minItems:e,maxItems:n},r)=>{let o=Vi(r(t));return e&&(o=o.min(e)),n&&(o=o.max(n)),o},"_handleSet"),jP=m(({minItems:t,maxItems:e,items:n},r)=>{let o=An(r(n));return t&&t===e?o.length(t):(t&&(o=o.min(t)),e&&(o=o.max(e)),o)},"_handleArray"),$P=m(({type:t,minimum:e,exclusiveMinimum:n,maximum:r,exclusiveMaximum:o,multipleOf:s,format:i})=>{let a=$n();return t==="integer"&&(a=a.int()),i==="finite"&&(a=a.finite()),n!==void 0?a=a.gt(n):e!==void 0&&(a=a.gte(e)),o!==void 0?a=a.lt(o):r!==void 0&&(a=a.lte(r)),s!==void 0&&(a=a.multipleOf(s)),a},"numberJSONSchemaToZuiNumber"),Hr={};Ot(Hr,{escapeSpecialChars:()=>ZP});var ZP=m(t=>t.replaceAll(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeSpecialChars");function Zs(t,e,n,r){r?.errorMessages&&n&&(t.errorMessage=M(w({},t.errorMessage),{[e]:n}))}m(Zs,"addErrorMessage");function Ee(t,e,n,r,o){t[e]=n,Zs(t,e,r,o)}m(Ee,"setResponseValueAndErrors");var Ge={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 Ls(t,e){let n=w({type:"string"},t.coerce?{[ke]:{coerce:t.coerce||void 0}}:{});function r(o){return e.patternStrategy==="escape"?Hr.escapeSpecialChars(o):o}if(m(r,"processPattern"),t.checks)for(let o of t.checks)switch(o.kind){case"min":Ee(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,o.value):o.value,o.message,e);break;case"max":Ee(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,o.value):o.value,o.message,e);break;case"email":switch(e.emailStrategy){case"format:email":Bn(n,"email",o.message,e);break;case"format:idn-email":Bn(n,"idn-email",o.message,e);break;case"pattern:zod":Vt(n,Ge.email,o.message,e);break}break;case"url":Bn(n,"uri",o.message,e);break;case"uuid":Bn(n,"uuid",o.message,e);break;case"regex":Vt(n,o.regex.source,o.message,e);break;case"cuid":Vt(n,Ge.cuid,o.message,e);break;case"cuid2":Vt(n,Ge.cuid2,o.message,e);break;case"startsWith":Vt(n,"^"+r(o.value),o.message,e);break;case"endsWith":Vt(n,r(o.value)+"$",o.message,e);break;case"datetime":Bn(n,"date-time",o.message,e);break;case"length":Ee(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,o.value):o.value,o.message,e),Ee(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,o.value):o.value,o.message,e);break;case"includes":{Vt(n,r(o.value),o.message,e);break}case"ip":{o.version!=="v6"&&Bn(n,"ipv4",o.message,e),o.version!=="v4"&&Bn(n,"ipv6",o.message,e);break}case"emoji":Vt(n,Ge.emoji,o.message,e);break;case"ulid":{Vt(n,Ge.ulid,o.message,e);break}case"toLowerCase":case"toUpperCase":case"trim":break;default:}return n}m(Ls,"parseStringDef");var Bn=m((t,e,n,r)=>{var o;t.format||(o=t.anyOf)!=null&&o.some(s=>s.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push(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"),Vt=m((t,e,n,r)=>{var o;t.pattern||(o=t.allOf)!=null&&o.some(s=>s.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push(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"),LP=m(({format:t,pattern:e,minLength:n,maxLength:r})=>{let o=Qt();if(n&&r&&n===r?o=o.length(n):(n&&(o=o.min(n)),r&&(o=o.max(r))),t==="cuid"||e===Ge.cuid)o=o.cuid();else if(t==="cuid2"||e===Ge.cuid2)o=o.cuid2();else if(t==="emoji"||e===Ge.emoji)o=o.emoji();else if(t==="ulid"||e===Ge.ulid)o=o.ulid();else if(t==="date-time"){let{precision:s,offset:i}=e?_p(e):{};o=o.datetime({precision:s,offset:i})}else t==="email"||e===Ge.email?o=o.email():t==="ipv4"||e===Ge.ipv4?o=o.ip():t==="ipv6"||e===Ge.ipv6?o=o.ip("v6"):t==="uri"?o=o.url():t==="uuid"||e===Ge.uuid?o=o.uuid():e&&(o=o.regex(new RegExp(e)));return o},"stringJSONSchemaToZuiString"),wr=m((t,e)=>{let n=[];e.enum!==void 0&&n.push(...e.enum),e.const!==void 0&&n.push(e.const);let r,o=n.filter(i=>typeof i===t),[s]=o;if(s)if(o.length===1)r=Kr(s);else{let i=o.map(a=>Kr(a));r=ir(i)}else if(t==="string"&&e.type==="string"&&(r=LP(e)),t==="number"&&(e.type==="number"||e.type==="integer")&&(r=$P(e)),t==="boolean"&&(r=Zn()),t==="null"&&(r=qr()),!r)throw new Ji(`Unknown primitive type: "${t}"`);return e.description&&(r=r.describe(e.description)),r},"toZuiPrimitive"),Yn=On();function Yg(t){return Ye(t)}m(Yg,"fromJSONSchema");function Ye(t){var e,n,r;if(t===void 0)return Yn;if(t===!0)return On();if(t===!1)return Lr();if(t.default!==void 0)return Ye(M(w({},t),{default:void 0})).default(t.default);if(t.readOnly)return Ye(M(w({},t),{readOnly:void 0})).readonly();if(t.description!==void 0)return Ye(M(w({},t),{description:void 0})).describe(t.description);if(t.oneOf!==void 0)throw new pn({oneOf:t.oneOf});if(t.patternProperties!==void 0)throw new pn({patternProperties:t.patternProperties});if(t.propertyNames!==void 0)throw new pn({propertyNames:t.propertyNames});if(t.if!==void 0)throw new pn({if:t.if});if(t.then!==void 0)throw new pn({then:t.then});if(t.else!==void 0)throw new pn({else:t.else});if(t.$ref!==void 0)return Fi(t.$ref);if(t.not!==void 0){if(Jg(t))return Li();if(t.not===!0)return Lr();throw new pn({not:t.not})}if(Array.isArray(t.type)){if(t.type.length===0)return Yn;if(t.type.length===1)return Ye(M(w({},t),{type:t.type[0]}));let o=t,{type:s}=o,i=Fc(o,["type"]),a=t.type.map(l=>Ye(M(w({},i),{type:l})));return ir(a)}if(t.type==="string")return t.enum&&t.enum.length>0?zi(t.enum):wr("string",t);if(t.type==="integer"){let o=wr("number",t);return o.typeName==="ZodNumber"?o.int():o}if(t.type==="number")return wr("number",t);if(t.type==="boolean")return wr("boolean",t);if(t.type==="null")return wr("null",t);if(t.type==="array")return MP(t,Ye);if(t.type==="object"){if(t.additionalProperties!==void 0&&t.properties!==void 0){let o=Ye(t.additionalProperties);return Ye(M(w({},t),{additionalProperties:void 0})).catchall(o)}if(t.properties!==void 0){let o={};for(let[s,i]of Object.entries(t.properties)){let a=Ye(i),l=(e=t.required)!=null?e:[];o[s]=l.includes(s)||a.isOptional()?a:a.optional()}return rr(o)}if(t.additionalProperties!==void 0){let o=Ye(t.additionalProperties);return Wr(o)}return Wr(Yn)}if(t.anyOf!==void 0){if(t.anyOf.length===0)return Yn;if(t.anyOf.length===1)return Ye(t.anyOf[0]);if(AP(t))return Ye(t.anyOf[0]).optional();if(CP(t))return Ye(t.anyOf[0]).nullable();if(RP(t)&&((r=(n=t["x-zui"])==null?void 0:n.def)!=null&&r.discriminator)){let{discriminator:s}=t["x-zui"].def,i=t.anyOf.map(Ye);return qi(s,i)}let o=t.anyOf.map(Ye);return ir(o)}if(t.allOf!==void 0){if(t.allOf.length===0)return Yn;if(t.allOf.length===1)return Ye(t.allOf[0]);let[o,...s]=t.allOf,i=Ye(o),a=Ye({allOf:s});return Gi(i,a)}return t.type,OP(t)?yn():Yn}m(Ye,"_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))?$/,rs=m((t,e,n=!0)=>{if(typeof t!="object")throw new ts("Input must be an object");let r=m(i=>{let a=i;return e?.nullable&&(a=a.nullable()),e?.optional&&(a=a.optional()),e?.passtrough&&et.zuiObject(a)&&(a=a.passthrough()),a},"applyOptions"),o=Object.entries(t).reduce((i,[a,l])=>{if(l===null)i[a]=r(qr());else switch(typeof l){case"string":i[a]=KP.test(l)?r(Qt().datetime()):r(Qt());break;case"number":i[a]=r($n());break;case"boolean":i[a]=r(Zn());break;case"object":if(Array.isArray(l)){let[c]=l;if(c==null)i[a]=r(An(yn()));else if(typeof c=="object")i[a]=r(An(rs(c,e,!1)));else if(typeof c=="string"||typeof c=="number"||typeof c=="boolean"){let f=WP(c);i[a]=r(An(f))}}else i[a]=r(rs(l,e,!1));break;default:throw new ts(`Unsupported type for key ${a}`)}return i},{}),s=Object.keys(o).length>0;return e?.passtrough||!n&&!s?rr(o).passthrough():rr(o)},"fromObject"),WP=m(t=>typeof t=="string"?Qt():typeof t=="number"?$n():typeof t=="boolean"?Zn():yn(),"_getInnerType");function Xg(){return{}}m(Xg,"parseAnyDef");function Qg(t,e){var n,r;let o={type:"array"};return((r=(n=t.type)==null?void 0:n._def)==null?void 0:r.typeName)!==fe.ZodAny&&(o.items=Pe(t.type._def,M(w({},e),{currentPath:[...e.currentPath,"items"]}))),t.minLength&&Ee(o,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Ee(o,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Ee(o,"minItems",t.exactLength.value,t.exactLength.message,e),Ee(o,"maxItems",t.exactLength.value,t.exactLength.message,e)),o}m(Qg,"parseArrayDef");function em(t,e){let n=w({type:"integer",format:"int64"},t.coerce?{[ke]:{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(em,"parseBigintDef");function tm(t){return w({type:"boolean"},t.coerce?{[ke]:{coerce:t.coerce||void 0}}:{})}m(tm,"parseBooleanDef");function nm(t,e){return Pe(t.type._def,e)}m(nm,"parseBrandedDef");var FP=m((t,e)=>Pe(t.innerType._def,e),"parseCatchDef");function rm(t,e){return e.dateStrategy==="integer"?zP(t,e):w({type:"string",format:"date-time"},t.coerce?{[ke]:{coerce:t.coerce||void 0}}:{})}m(rm,"parseDateDef");var zP=m((t,e)=>{let n=w({type:"integer",format:"unix-time"},t.coerce?{[ke]:{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 im(t,e){return M(w({},Pe(t.innerType._def,e)),{default:t.defaultValue()})}m(im,"parseDefaultDef");function om(t,e){return e.effectStrategy==="input"?Pe(t.schema._def,e):{}}m(om,"parseEffectsDef");function sm(t){return{type:"string",enum:t.values}}m(sm,"parseEnumDef");var qP=m(t=>"type"in t&&t.type==="string"?!1:"allOf"in t,"isJsonSchema7AllOfType");function am(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,o=[];return n.forEach(s=>{if(qP(s))o.push(...s.allOf),s.unevaluatedProperties===void 0&&(r=void 0);else{let i=s;if("additionalProperties"in s&&s.additionalProperties===!1){let a=s,{additionalProperties:l}=a;i=Fc(a,["additionalProperties"])}else r=void 0;o.push(i)}}),o.length?w({allOf:o},r):void 0}m(am,"parseIntersectionDef");function lm(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(lm,"parseLiteralDef");function Ks(t,e){var n,r,o,s,i;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(((o=t.keyType)==null?void 0:o._def.typeName)===fe.ZodString&&((s=t.keyType._def.checks)!=null&&s.length)){let l=Object.entries(Ls(t.keyType._def,e)).reduce((c,[f,g])=>f==="type"?c:M(w({},c),{[f]:g}),{});return M(w({},a),{propertyNames:l})}else if(((i=t.keyType)==null?void 0:i._def.typeName)===fe.ZodEnum)return M(w({},a),{propertyNames:{enum:t.keyType._def.values}});return a}m(Ks,"parseRecordDef");function um(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(um,"parseMapDef");function cm(t){let e=t.values,r=Object.keys(t.values).filter(s=>typeof e[e[s]]!="number").map(s=>e[s]),o=Array.from(new Set(r.map(s=>typeof s)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:r.filter(s=>typeof s=="string"||typeof s=="number")}}m(cm,"parseNativeEnumDef");function dm(){return{not:{}}}m(dm,"parseNeverDef");function fm(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}m(fm,"parseNullDef");var Ri={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function pm(t,e){if(e.target==="openApi3")return Dc(t,e);let n=t.options instanceof Map?Array.from(t.options.values()):t.options;if(n.every(r=>r._def.typeName in Ri&&(!r._def.checks||!r._def.checks.length))){let r=n.reduce((o,s)=>{let i=Ri[s._def.typeName];return i&&!o.includes(i)?[...o,i]:o},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){let r=n.reduce((o,s)=>{let i=typeof s._def.value;switch(i){case"string":case"number":case"boolean":return[...o,i];case"bigint":return[...o,"integer"];case"object":if(s._def.value===null)return[...o,"null"];case"symbol":case"undefined":case"function":default:return o}},[]);if(r.length===n.length){let o=r.filter((s,i,a)=>a.indexOf(s)===i);return{type:o.length>1?o:o[0],enum:n.reduce((s,i)=>s.includes(i._def.value)?s:[...s,i._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,o)=>[...r,...o._def.values.filter(s=>!r.includes(s))],[])};return Dc(t,e)}m(pm,"parseUnionDef");var Dc=m((t,e)=>{let n=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((o,s)=>Pe(o._def,M(w({},e),{currentPath:[...e.currentPath,e.unionStrategy,`${s}`]}))).filter(o=>!!o&&(!e.strictUnions||typeof o=="object"&&Object.keys(o).length>0)),r=e.discriminator&&t.typeName==="ZodDiscriminatedUnion"&&typeof t.discriminator=="string"?{discriminator:{propertyName:t.discriminator}}:{};if(n.length)return e.unionStrategy==="anyOf"?w({anyOf:n},r):w({oneOf:n},r)},"asUnionOf");function gm(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:Ri[n._def.typeName],nullable:!0};return is(n._def,e,s)}let o={type:[Ri[n._def.typeName],"null"]};return is(n._def,e,o)}if(e.target==="openApi3"){let o=Pe(n._def,M(w({},e),{currentPath:[...e.currentPath]}));return o&&M(w({},o),{nullable:!0})}let r=Pe(n._def,M(w({},e),{currentPath:[...e.currentPath,"anyOf","0"]}));return r&&{anyOf:[r,{type:"null"}]}}m(gm,"parseNullableDef");function mm(t,e){let n=w({type:"number"},t.coerce?{[ke]:{coerce:t.coerce||void 0}}:{});if(!t.checks)return n;for(let r of t.checks)switch(r.kind){case"int":n.type="integer",Zs(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(mm,"parseNumberDef");var{zuiKey:WA}=en,GP=m((t,e)=>{var n;return et.zuiType(t.unknownKeys)?(n=Pe(t.unknownKeys._def,M(w({},e),{currentPath:[...e.currentPath,"additionalProperties"]})))!=null?n:!0:t.unknownKeys==="passthrough"},"getAdditionalProperties");function ym(t,e){let n=M(w({type:"object"},Object.entries(t.shape()).reduce((r,[o,s])=>{if(s===void 0||s._def===void 0)return r;let i=Pe(s._def,M(w({},e),{currentPath:[...e.currentPath,"properties",o],propertyPath:[...e.currentPath,"properties",o]}));return i===void 0?r:{properties:M(w({},r.properties),{[o]:i}),required:s.isOptional()?r.required:[...r.required,o]}},{properties:{},required:[]})),{additionalProperties:GP(t,e)});return n.required.length||delete n.required,n}m(ym,"parseObjectDef");var VP=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"),JP=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(o=>o!==void 0)}},"parsePipelineDef");function hm(t,e){return Pe(t.type._def,e)}m(hm,"parsePromiseDef");var YP=m((t,e)=>Pe(t.innerType._def,e),"parseReadonlyDef");function Tm(t){return{$ref:t.uri}}m(Tm,"parseRefDef");function vm(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(vm,"parseSetDef");function _m(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(_m,"parseTupleDef");function bm(){return{not:{}}}m(bm,"parseUndefinedDef");function wm(){return{}}m(wm,"parseUnknownDef");function Pe(t,e,n=!1){let r=e.seen.get(t);if(r&&!n){let i=XP(r,e);if(i!==void 0)return i}let o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);let s=eB(t,t.typeName,e);return s&&is(t,e,s),o.jsonSchema=s,s}m(Pe,"parseDef");var XP=m((t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:QP(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"),QP=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"),eB=m((t,e,n)=>{switch(e){case fe.ZodString:return Ls(t,n);case fe.ZodNumber:return mm(t,n);case fe.ZodObject:return ym(t,n);case fe.ZodBigInt:return em(t,n);case fe.ZodBoolean:return tm(t);case fe.ZodDate:return rm(t,n);case fe.ZodUndefined:return bm();case fe.ZodNull:return fm(n);case fe.ZodArray:return Qg(t,n);case fe.ZodUnion:case fe.ZodDiscriminatedUnion:return pm(t,n);case fe.ZodIntersection:return am(t,n);case fe.ZodTuple:return _m(t,n);case fe.ZodRecord:return Ks(t,n);case fe.ZodRef:return Tm(t);case fe.ZodLiteral:return lm(t,n);case fe.ZodEnum:return sm(t);case fe.ZodNativeEnum:return cm(t);case fe.ZodNullable:return gm(t,n);case fe.ZodOptional:return VP(t,n);case fe.ZodMap:return um(t,n);case fe.ZodSet:return vm(t,n);case fe.ZodLazy:return Pe(t.getter()._def,n);case fe.ZodPromise:return hm(t,n);case fe.ZodNaN:case fe.ZodNever:return dm();case fe.ZodEffects:return om(t,n);case fe.ZodAny:return Xg();case fe.ZodUnknown:return wm();case fe.ZodDefault:return im(t,n);case fe.ZodBranded:return nm(t,n);case fe.ZodReadonly:return YP(t,n);case fe.ZodCatch:return FP(t,n);case fe.ZodPipeline:return JP(t,n);case fe.ZodFunction:case fe.ZodVoid:case fe.ZodSymbol:return;default:return(r=>{})(e)}},"selectParser"),is=m((t,e,n)=>(t.description&&(n.description=t.description,e.markdownDescription&&(n.markdownDescription=t.description)),Object.assign(n,{[ke]:w(w({},t[ke]),n[ke])}),n),"addMeta"),Hc={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"},tB=m(t=>typeof t=="string"?M(w({},Hc),{name:t}):w(w({},Hc),t),"getDefaultOptions"),nB=m(t=>{let e=tB(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,o])=>[o._def,{def:o._def,path:[...e.basePath,e.definitionPath,r],jsonSchema:void 0}]))})},"getRefs"),rB=m((t,e)=>{var n;let r=nB(e),o=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[c,f])=>{var g;return M(w({},l),{[c]:(g=Pe(f._def,M(w({},r),{currentPath:[...r.basePath,r.definitionPath,c]}),!0))!=null?g:{}})},{}):void 0,s=typeof e=="string"?e:e?.name,i=(n=Pe(t._def,s===void 0?r:M(w({},r),{currentPath:[...r.basePath,r.definitionPath,s]}),!1))!=null?n:{},a=s===void 0?o?M(w({},i),{[r.definitionPath]:o}):i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,s].join("/"),[r.definitionPath]:M(w({},o),{[s]:i})};return r.target==="jsonSchema7"?a.$schema="http://json-schema.org/draft-07/schema#":r.target==="jsonSchema2019-09"&&(a.$schema="https://json-schema.org/draft/2019-09/schema#"),a},"zodToJsonSchema"),iB=m((t,e={target:"openApi3"})=>{let n=rB(t,e);return e.$schemaUrl===!1?delete n.$schema:typeof e.$schemaUrl=="string"&&(n.$schema=e.$schemaUrl),n},"toJSONSchemaLegacy"),{zuiKey:$o}=en,oB=m((t,e)=>{let n={type:"array",description:t.description,items:e(t._def.type),"x-zui":t._def["x-zui"]};return t._def[$o]&&(n[$o]=t._def[$o]),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}=en,sB=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",o=n.inclusive?"exclusiveMinimum":"minimum";e[r]=n.value,delete e[o];break}case"max":{let r=n.inclusive?"maximum":"exclusiveMaximum",o=n.inclusive?"exclusiveMaximum":"maximum";e[r]=n.value,delete e[o];break}case"int":e.type="integer";break;case"finite":{e.format="finite";break}case"multipleOf":e.multipleOf=n.value;break;default:}return e},"zodNumberToJsonNumber"),{zuiKey:Lo}=en,aB=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[Lo]&&(n[Lo]=t._def[Lo]),t._def.minSize&&(n.minItems=t._def.minSize.value),t._def.maxSize&&(n.maxItems=t._def.maxSize.value),n},"zodSetToJsonSet"),{zuiKey:xr}=en,lB=m(t=>{let e={type:"string",description:t.description,"x-zui":t._def["x-zui"]};t._def[xr]&&(e[xr]=t._def[xr]);for(let n of t._def.checks)switch(n.kind){case"cuid":e.format="cuid",e.pattern=Ge.cuid;break;case"cuid2":e.format="cuid2",e.pattern=Ge.cuid2;break;case"ulid":e.format="ulid",e.pattern=Ge.ulid;break;case"uuid":e.format="uuid",e.pattern=Ge.uuid;break;case"emoji":e.format="emoji",e.pattern=Ge.emoji;break;case"email":e.format="email",e.pattern=Ge.email;break;case"ip":e.format=n.version==="v6"?"ipv6":"ipv4",e.pattern=n.version==="v6"?Ge.ipv6:Ge.ipv4;break;case"datetime":e.format="date-time",(n.precision!==null||n.offset)&&(e.pattern=vp(n).source,e[xr]=M(w({},e[xr]),{precision:n.precision,offset:n.offset}));break;case"url":e.format="uri";break;case"endsWith":e.pattern=`${Hr.escapeSpecialChars(n.value)}$`;break;case"startsWith":e.pattern=`^${Hr.escapeSpecialChars(n.value)}`;break;case"includes":let r=n.position&&n.position>=1?`^(?:.{${n.position}}).*`:"";e.pattern=`${r}${Hr.escapeSpecialChars(n.value)}`;break;case"regex":e.pattern=n.regex.source;break;case"length":e.minLength=e.maxLength=Math.max(0,n.value);break;case"min":e.minLength=Math.max(0,n.value);break;case"max":e.maxLength=Math.max(0,n.value);break;default:throw new Hg({zodType:"ZodString",checkKind:n.kind})}return e},"zodStringToJsonString"),{zuiKey:Ko}=en,uB=m((t,e)=>{let n={type:"array",description:t.description,items:t._def.items.map(r=>e(r))};return t._def[Ko]&&(n[Ko]=t._def[Ko]),t._def.rest&&(n.additionalItems=e(t._def.rest)),n},"zodTupleToJsonTuple");function ot(t){let e=t;switch(e.typeName){case"ZodString":return lB(e);case"ZodNumber":return sB(e);case"ZodNaN":throw new dt("ZodNaN");case"ZodBigInt":throw new dt("ZodBigInt",{suggestedAlternative:"serialize bigint to string"});case"ZodBoolean":return{type:"boolean",description:e.description,"x-zui":e._def["x-zui"]};case"ZodDate":throw new dt("ZodDate",{suggestedAlternative:"use z.string().datetime() instead"});case"ZodUndefined":return Wo(e);case"ZodNull":return Fo(e);case"ZodAny":return{description:e.description,"x-zui":e._def["x-zui"]};case"ZodUnknown":return{description:e.description,"x-zui":M(w({},e._def["x-zui"]),{def:{typeName:"ZodUnknown"}})};case"ZodNever":return{not:!0,description:e.description,"x-zui":e._def["x-zui"]};case"ZodVoid":throw new dt("ZodVoid");case"ZodArray":return oB(e,ot);case"ZodObject":let n=Object.entries(e.shape),r=n.filter(([l,c])=>!c.isOptional()),o=r.length?r.map(([l])=>l):void 0,s=n.map(([l,c])=>[l,c.mandatory()]).map(([l,c])=>[l,ot(c)]);return{type:"object",description:e.description,properties:Object.fromEntries(s),required:o,additionalProperties:cB(e._def),"x-zui":e._def["x-zui"]};case"ZodUnion":return{description:e.description,anyOf:e.options.map(l=>ot(l)),"x-zui":e._def["x-zui"]};case"ZodDiscriminatedUnion":return{description:e.description,anyOf:e.options.map(l=>ot(l)),"x-zui":M(w({},e._def["x-zui"]),{def:{typeName:"ZodDiscriminatedUnion",discriminator:e.discriminator}})};case"ZodIntersection":let i=ot(e._def.left),a=ot(e._def.right);return"additionalProperties"in i&&delete i.additionalProperties,"additionalProperties"in a&&delete a.additionalProperties,{description:e.description,allOf:[i,a],"x-zui":e._def["x-zui"]};case"ZodTuple":return uB(e,ot);case"ZodRecord":return{type:"object",description:e.description,additionalProperties:ot(e._def.valueType),"x-zui":e._def["x-zui"]};case"ZodMap":throw new dt("ZodMap");case"ZodSet":return aB(e,ot);case"ZodFunction":throw new dt("ZodFunction");case"ZodLazy":throw new dt("ZodLazy");case"ZodLiteral":if(typeof e.value=="string")return{type:"string",description:e.description,const:e.value,"x-zui":e._def["x-zui"]};if(typeof e.value=="number")return{type:"number",description:e.description,const:e.value,"x-zui":e._def["x-zui"]};if(typeof e.value=="boolean")return{type:"boolean",description:e.description,const:e.value,"x-zui":e._def["x-zui"]};if(e.value===null)return Fo(e._def);if(e.value===void 0)return Wo(e._def);{e.value;let l=typeof e.value;throw new Yi(`Unsupported literal type: "${l}"`)}case"ZodEnum":return{type:"string",description:e.description,enum:e._def.values,"x-zui":e._def["x-zui"]};case"ZodEffects":throw new dt("ZodEffects");case"ZodNativeEnum":throw new dt("ZodNativeEnum");case"ZodOptional":return{description:e.description,anyOf:[ot(e._def.innerType),Wo()],"x-zui":M(w({},e._def["x-zui"]),{def:{typeName:"ZodOptional"}})};case"ZodNullable":return{anyOf:[ot(e._def.innerType),Fo()],"x-zui":M(w({},e._def["x-zui"]),{def:{typeName:"ZodNullable"}})};case"ZodDefault":return M(w({},ot(e._def.innerType)),{default:e._def.defaultValue()});case"ZodCatch":throw new dt("ZodCatch");case"ZodPromise":throw new dt("ZodPromise");case"ZodBranded":throw new dt("ZodBranded");case"ZodPipeline":throw new dt("ZodPipeline");case"ZodSymbol":throw new dt("ZodPipeline");case"ZodReadonly":return M(w({},ot(e._def.innerType)),{readOnly:!0});case"ZodRef":return{$ref:e._def.uri,description:e.description,"x-zui":e._def["x-zui"]};default:Ct.assertNever(e)}}m(ot,"toJSONSchema");var Wo=m(t=>({not:!0,description:t?.description,"x-zui":M(w({},t?.["x-zui"]),{def:{typeName:"ZodUndefined"}})}),"undefinedSchema"),Fo=m(t=>({type:"null",description:t?.description,"x-zui":t?.["x-zui"]}),"nullSchema"),cB=m(t=>t.unknownKeys==="passthrough"?!0:t.unknownKeys==="strict"||!et.zuiType(t.unknownKeys)||t.unknownKeys.typeName==="ZodNever"?!1:ot(t.unknownKeys),"additionalPropertiesSchema");function xm(t){return typeof t=="symbol"?"symbol":typeof t=="bigint"?`${t.toString()}n`:ie(t)}m(xm,"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"?Im(t):JSON.stringify(t)}m(ie,"primitiveToTypescriptValue");function tr(t){return typeof t>"u"?"undefined":JSON.stringify(t)}m(tr,"unknownToTypescriptValue");var Pm=m((t,e)=>{let n=Object.entries(t),r=e?" as const":"";return`{ ${n.map(([o,s])=>`${os(o)}: ${tr(s)}`).join(", ")} }${r}`},"recordOfUnknownToTypescriptRecord"),os=m(t=>/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t)?t:ie(t),"toPropertyKey"),dB=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(dB).filter(r=>!!r).join("")},"toTypeArgumentName"),Uc=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"),Qe=m(t=>{t=t?.replace(/(\n(\s*)?){3,}/g,`
|
|
66
|
+
`,s+=`}
|
|
67
|
+
`,s+=`}
|
|
68
|
+
`),s+=`}
|
|
69
|
+
`,s+="})"}let o=n?s?n+s:r?r==="z.never()"?n+".strict()":n+`.catchall(${r})`:n:s||(r?`z.record(${r})`:"z.record(z.any())");return qe.an.anyOf(t)&&(o+=`.and(${Gg(M(w({},t),{anyOf:t.anyOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?M(w({},i),{type:"object"}):i)}),e)})`),qe.a.oneOf(t)&&(o+=`.and(${$o(M(w({},t),{oneOf:t.oneOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?M(w({},i),{type:"object"}):i)}),e)})`),qe.an.allOf(t)&&(o+=`.and(${Fr(M(w({},t),{allOf:t.allOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?M(w({},i),{type:"object"}):i)}),e)})`),o}m(Vg,"parseObject");var wP=m(t=>`z.ref('${t.$ref}')`,"parseRef"),xP=m(t=>{var e;let n="z.string()";if((e=t[ke])!=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"),tt=m((t,e={seen:new Map,path:[]},n)=>{if(typeof t!="object")return t?"z.any()":"z.never()";if(e.parserOverride){let o=e.parserOverride(t,e);if(typeof o=="string")return o}let r=e.seen.get(t);if(r){if(r.r!==void 0)return r.r;if(e.depth===void 0||r.n>=e.depth)return"z.any()";r.n+=1}else r={r:void 0,n:0},e.seen.set(t,r);let s=IP(t,e);return n||(s=PP(t,s),e.withoutDefaults||(s=BP(t,s))),r.r=s,s},"parseSchema"),PP=m((t,e)=>(t.description&&(e+=`.describe(${JSON.stringify(t.description)})`),e),"addMeta"),BP=m((t,e)=>(t.default!==void 0&&(e+=`.default(${JSON.stringify(t.default)})`),e),"addDefaults"),IP=m((t,e)=>qe.a.nullable(t)?_P(t,e):qe.an.object(t)?Vg(t,e):qe.an.array(t)?cP(t,e):qe.an.anyOf(t)?Gg(t,e):qe.an.allOf(t)?Fr(t,e):qe.a.discriminator(t)?gP(t,e):qe.a.oneOf(t)?$o(t,e):qe.a.not(t)?TP(t,e):qe.an.enum(t)?mP(t):qe.a.const(t)?fP(t):qe.a.multipleType(t)?hP(t,e):qe.a.primitive(t,"string")?xP(t):qe.a.primitive(t,"number")||qe.a.primitive(t,"integer")?bP(t):qe.a.primitive(t,"boolean")?dP(t):qe.a.primitive(t,"null")?vP(t):qe.a.conditional(t)?yP(t,e):qe.a.ref(t)?wP(t):pP(t),"selectParser"),qe={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}},EP=m(t=>tt(t,{seen:new Map,path:[]}),"jsonSchemaToZodStr"),SP=m(t=>{let e=EP(t);e=e.replaceAll("errors: z.ZodError[]","errors");let n=oP(e);if(!n.sucess)throw new Ji(n.error);return n.value},"jsonSchemaToZod"),Nr=m((t,e)=>{var n,r;if(e[ke]&&t._def&&(t.naked()._def[ke]=e[ke]),((n=t._def)==null?void 0:n.typeName)==="ZodObject"&&e.type==="object"&&e.properties&&Object.entries(e.properties).forEach(([s,o])=>{let i=typeof t._def.shape=="function"?t._def.shape():t._def.shape;i[s]&&Nr(i[s],o)}),((r=t._def)==null?void 0:r.typeName)==="ZodRecord"&&e.type==="object"&&e.additionalProperties&&Nr(t._def.valueType,e.additionalProperties),e.type==="array"&&e.items){let s=e.items;if(typeof s=="object"&&!Array.isArray(s)){let o=t._def.type;o&&Nr(o,s)}else Array.isArray(s)&&s.forEach((o,i)=>{let a=t._def;a.typeName===fe.ZodTuple&&Nr(a.items[i],o)})}},"applyZuiPropsRecursively"),kP=m(t=>{let e=SP(t);return Nr(e,t),e},"fromJSONSchemaLegacy"),AP=m(t=>{var e,n;return t.anyOf!==void 0&&t.anyOf.length===2&&t.anyOf.some(r=>typeof r!="boolean"&&Jg(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"),Jg=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,e)=>NP(t)?HP(t,e):DP(t)?UP(t,e):jP(t,e),"arrayJSONSchemaToZuiArray"),NP=m(t=>Array.isArray(t.items),"_isTuple"),DP=m(t=>t.items!==void 0&&t.uniqueItems,"_isSet"),HP=m(({items:t,additionalItems:e},n)=>{let r=t.map(n),s=Gr(r);return e!==void 0&&(s=s.rest(n(e))),s},"_handleTuple"),UP=m(({items:t,minItems:e,maxItems:n},r)=>{let s=Vi(r(t));return e&&(s=s.min(e)),n&&(s=s.max(n)),s},"_handleSet"),jP=m(({minItems:t,maxItems:e,items:n},r)=>{let s=An(r(n));return t&&t===e?s.length(t):(t&&(s=s.min(t)),e&&(s=s.max(e)),s)},"_handleArray"),$P=m(({type:t,minimum:e,exclusiveMinimum:n,maximum:r,exclusiveMaximum:s,multipleOf:o,format:i})=>{let a=$n();return t==="integer"&&(a=a.int()),i==="finite"&&(a=a.finite()),n!==void 0?a=a.gt(n):e!==void 0&&(a=a.gte(e)),s!==void 0?a=a.lt(s):r!==void 0&&(a=a.lte(r)),o!==void 0&&(a=a.multipleOf(o)),a},"numberJSONSchemaToZuiNumber"),Hr={};Ot(Hr,{escapeSpecialChars:()=>ZP});var ZP=m(t=>t.replaceAll(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeSpecialChars");function Zo(t,e,n,r){r?.errorMessages&&n&&(t.errorMessage=M(w({},t.errorMessage),{[e]:n}))}m(Zo,"addErrorMessage");function Ee(t,e,n,r,s){t[e]=n,Zo(t,e,r,s)}m(Ee,"setResponseValueAndErrors");var Ge={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 Lo(t,e){let n=w({type:"string"},t.coerce?{[ke]:{coerce:t.coerce||void 0}}:{});function r(s){return e.patternStrategy==="escape"?Hr.escapeSpecialChars(s):s}if(m(r,"processPattern"),t.checks)for(let s of t.checks)switch(s.kind){case"min":Ee(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,s.value):s.value,s.message,e);break;case"max":Ee(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,s.value):s.value,s.message,e);break;case"email":switch(e.emailStrategy){case"format:email":Bn(n,"email",s.message,e);break;case"format:idn-email":Bn(n,"idn-email",s.message,e);break;case"pattern:zod":Vt(n,Ge.email,s.message,e);break}break;case"url":Bn(n,"uri",s.message,e);break;case"uuid":Bn(n,"uuid",s.message,e);break;case"regex":Vt(n,s.regex.source,s.message,e);break;case"cuid":Vt(n,Ge.cuid,s.message,e);break;case"cuid2":Vt(n,Ge.cuid2,s.message,e);break;case"startsWith":Vt(n,"^"+r(s.value),s.message,e);break;case"endsWith":Vt(n,r(s.value)+"$",s.message,e);break;case"datetime":Bn(n,"date-time",s.message,e);break;case"length":Ee(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,s.value):s.value,s.message,e),Ee(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,s.value):s.value,s.message,e);break;case"includes":{Vt(n,r(s.value),s.message,e);break}case"ip":{s.version!=="v6"&&Bn(n,"ipv4",s.message,e),s.version!=="v4"&&Bn(n,"ipv6",s.message,e);break}case"emoji":Vt(n,Ge.emoji,s.message,e);break;case"ulid":{Vt(n,Ge.ulid,s.message,e);break}case"toLowerCase":case"toUpperCase":case"trim":break;default:}return n}m(Lo,"parseStringDef");var Bn=m((t,e,n,r)=>{var s;t.format||(s=t.anyOf)!=null&&s.some(o=>o.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"),Vt=m((t,e,n,r)=>{var s;t.pattern||(s=t.allOf)!=null&&s.some(o=>o.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"),LP=m(({format:t,pattern:e,minLength:n,maxLength:r})=>{let s=Qt();if(n&&r&&n===r?s=s.length(n):(n&&(s=s.min(n)),r&&(s=s.max(r))),t==="cuid"||e===Ge.cuid)s=s.cuid();else if(t==="cuid2"||e===Ge.cuid2)s=s.cuid2();else if(t==="emoji"||e===Ge.emoji)s=s.emoji();else if(t==="ulid"||e===Ge.ulid)s=s.ulid();else if(t==="date-time"){let{precision:o,offset:i}=e?_p(e):{};s=s.datetime({precision:o,offset:i})}else t==="email"||e===Ge.email?s=s.email():t==="ipv4"||e===Ge.ipv4?s=s.ip():t==="ipv6"||e===Ge.ipv6?s=s.ip("v6"):t==="uri"?s=s.url():t==="uuid"||e===Ge.uuid?s=s.uuid():e&&(s=s.regex(new RegExp(e)));return s},"stringJSONSchemaToZuiString"),wr=m((t,e)=>{let n=[];e.enum!==void 0&&n.push(...e.enum),e.const!==void 0&&n.push(e.const);let r,s=n.filter(i=>typeof i===t),[o]=s;if(o)if(s.length===1)r=Kr(o);else{let i=s.map(a=>Kr(a));r=ir(i)}else if(t==="string"&&e.type==="string"&&(r=LP(e)),t==="number"&&(e.type==="number"||e.type==="integer")&&(r=$P(e)),t==="boolean"&&(r=Zn()),t==="null"&&(r=qr()),!r)throw new Ji(`Unknown primitive type: "${t}"`);return e.description&&(r=r.describe(e.description)),r},"toZuiPrimitive"),Yn=On();function Yg(t){return Ye(t)}m(Yg,"fromJSONSchema");function Ye(t){var e,n,r;if(t===void 0)return Yn;if(t===!0)return On();if(t===!1)return Lr();if(t.default!==void 0)return Ye(M(w({},t),{default:void 0})).default(t.default);if(t.readOnly)return Ye(M(w({},t),{readOnly:void 0})).readonly();if(t.description!==void 0)return Ye(M(w({},t),{description:void 0})).describe(t.description);if(t.oneOf!==void 0)throw new pn({oneOf:t.oneOf});if(t.patternProperties!==void 0)throw new pn({patternProperties:t.patternProperties});if(t.propertyNames!==void 0)throw new pn({propertyNames:t.propertyNames});if(t.if!==void 0)throw new pn({if:t.if});if(t.then!==void 0)throw new pn({then:t.then});if(t.else!==void 0)throw new pn({else:t.else});if(t.$ref!==void 0)return Fi(t.$ref);if(t.not!==void 0){if(Jg(t))return Li();if(t.not===!0)return Lr();throw new pn({not:t.not})}if(Array.isArray(t.type)){if(t.type.length===0)return Yn;if(t.type.length===1)return Ye(M(w({},t),{type:t.type[0]}));let s=t,{type:o}=s,i=Fc(s,["type"]),a=t.type.map(l=>Ye(M(w({},i),{type:l})));return ir(a)}if(t.type==="string")return t.enum&&t.enum.length>0?zi(t.enum):wr("string",t);if(t.type==="integer"){let s=wr("number",t);return s.typeName==="ZodNumber"?s.int():s}if(t.type==="number")return wr("number",t);if(t.type==="boolean")return wr("boolean",t);if(t.type==="null")return wr("null",t);if(t.type==="array")return MP(t,Ye);if(t.type==="object"){if(t.additionalProperties!==void 0&&t.properties!==void 0){let s=Ye(t.additionalProperties);return Ye(M(w({},t),{additionalProperties:void 0})).catchall(s)}if(t.properties!==void 0){let s={};for(let[o,i]of Object.entries(t.properties)){let a=Ye(i),l=(e=t.required)!=null?e:[];s[o]=l.includes(o)||a.isOptional()?a:a.optional()}return rr(s)}if(t.additionalProperties!==void 0){let s=Ye(t.additionalProperties);return Wr(s)}return Wr(Yn)}if(t.anyOf!==void 0){if(t.anyOf.length===0)return Yn;if(t.anyOf.length===1)return Ye(t.anyOf[0]);if(AP(t))return Ye(t.anyOf[0]).optional();if(CP(t))return Ye(t.anyOf[0]).nullable();if(RP(t)&&((r=(n=t["x-zui"])==null?void 0:n.def)!=null&&r.discriminator)){let{discriminator:o}=t["x-zui"].def,i=t.anyOf.map(Ye);return qi(o,i)}let s=t.anyOf.map(Ye);return ir(s)}if(t.allOf!==void 0){if(t.allOf.length===0)return Yn;if(t.allOf.length===1)return Ye(t.allOf[0]);let[s,...o]=t.allOf,i=Ye(s),a=Ye({allOf:o});return Gi(i,a)}return t.type,OP(t)?yn():Yn}m(Ye,"_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))?$/,no=m((t,e,n=!0)=>{if(typeof t!="object")throw new eo("Input must be an object");let r=m(i=>{let a=i;return e?.nullable&&(a=a.nullable()),e?.optional&&(a=a.optional()),e?.passtrough&&et.zuiObject(a)&&(a=a.passthrough()),a},"applyOptions"),s=Object.entries(t).reduce((i,[a,l])=>{if(l===null)i[a]=r(qr());else switch(typeof l){case"string":i[a]=KP.test(l)?r(Qt().datetime()):r(Qt());break;case"number":i[a]=r($n());break;case"boolean":i[a]=r(Zn());break;case"object":if(Array.isArray(l)){let[c]=l;if(c==null)i[a]=r(An(yn()));else if(typeof c=="object")i[a]=r(An(no(c,e,!1)));else if(typeof c=="string"||typeof c=="number"||typeof c=="boolean"){let f=WP(c);i[a]=r(An(f))}}else i[a]=r(no(l,e,!1));break;default:throw new eo(`Unsupported type for key ${a}`)}return i},{}),o=Object.keys(s).length>0;return e?.passtrough||!n&&!o?rr(s).passthrough():rr(s)},"fromObject"),WP=m(t=>typeof t=="string"?Qt():typeof t=="number"?$n():typeof t=="boolean"?Zn():yn(),"_getInnerType");function Xg(){return{}}m(Xg,"parseAnyDef");function Qg(t,e){var n,r;let s={type:"array"};return((r=(n=t.type)==null?void 0:n._def)==null?void 0:r.typeName)!==fe.ZodAny&&(s.items=Pe(t.type._def,M(w({},e),{currentPath:[...e.currentPath,"items"]}))),t.minLength&&Ee(s,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Ee(s,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Ee(s,"minItems",t.exactLength.value,t.exactLength.message,e),Ee(s,"maxItems",t.exactLength.value,t.exactLength.message,e)),s}m(Qg,"parseArrayDef");function em(t,e){let n=w({type:"integer",format:"int64"},t.coerce?{[ke]:{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(em,"parseBigintDef");function tm(t){return w({type:"boolean"},t.coerce?{[ke]:{coerce:t.coerce||void 0}}:{})}m(tm,"parseBooleanDef");function nm(t,e){return Pe(t.type._def,e)}m(nm,"parseBrandedDef");var FP=m((t,e)=>Pe(t.innerType._def,e),"parseCatchDef");function rm(t,e){return e.dateStrategy==="integer"?zP(t,e):w({type:"string",format:"date-time"},t.coerce?{[ke]:{coerce:t.coerce||void 0}}:{})}m(rm,"parseDateDef");var zP=m((t,e)=>{let n=w({type:"integer",format:"unix-time"},t.coerce?{[ke]:{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 im(t,e){return M(w({},Pe(t.innerType._def,e)),{default:t.defaultValue()})}m(im,"parseDefaultDef");function sm(t,e){return e.effectStrategy==="input"?Pe(t.schema._def,e):{}}m(sm,"parseEffectsDef");function om(t){return{type:"string",enum:t.values}}m(om,"parseEnumDef");var qP=m(t=>"type"in t&&t.type==="string"?!1:"allOf"in t,"isJsonSchema7AllOfType");function am(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(o=>!!o),r=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,s=[];return n.forEach(o=>{if(qP(o))s.push(...o.allOf),o.unevaluatedProperties===void 0&&(r=void 0);else{let i=o;if("additionalProperties"in o&&o.additionalProperties===!1){let a=o,{additionalProperties:l}=a;i=Fc(a,["additionalProperties"])}else r=void 0;s.push(i)}}),s.length?w({allOf:s},r):void 0}m(am,"parseIntersectionDef");function lm(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(lm,"parseLiteralDef");function Ko(t,e){var n,r,s,o,i;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(((s=t.keyType)==null?void 0:s._def.typeName)===fe.ZodString&&((o=t.keyType._def.checks)!=null&&o.length)){let l=Object.entries(Lo(t.keyType._def,e)).reduce((c,[f,g])=>f==="type"?c:M(w({},c),{[f]:g}),{});return M(w({},a),{propertyNames:l})}else if(((i=t.keyType)==null?void 0:i._def.typeName)===fe.ZodEnum)return M(w({},a),{propertyNames:{enum:t.keyType._def.values}});return a}m(Ko,"parseRecordDef");function um(t,e){if(e.mapStrategy==="record")return Ko(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(um,"parseMapDef");function cm(t){let e=t.values,r=Object.keys(t.values).filter(o=>typeof e[e[o]]!="number").map(o=>e[o]),s=Array.from(new Set(r.map(o=>typeof o)));return{type:s.length===1?s[0]==="string"?"string":"number":["string","number"],enum:r.filter(o=>typeof o=="string"||typeof o=="number")}}m(cm,"parseNativeEnumDef");function dm(){return{not:{}}}m(dm,"parseNeverDef");function fm(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}m(fm,"parseNullDef");var Ri={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function pm(t,e){if(e.target==="openApi3")return Dc(t,e);let n=t.options instanceof Map?Array.from(t.options.values()):t.options;if(n.every(r=>r._def.typeName in Ri&&(!r._def.checks||!r._def.checks.length))){let r=n.reduce((s,o)=>{let i=Ri[o._def.typeName];return i&&!s.includes(i)?[...s,i]:s},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){let r=n.reduce((s,o)=>{let i=typeof o._def.value;switch(i){case"string":case"number":case"boolean":return[...s,i];case"bigint":return[...s,"integer"];case"object":if(o._def.value===null)return[...s,"null"];case"symbol":case"undefined":case"function":default:return s}},[]);if(r.length===n.length){let s=r.filter((o,i,a)=>a.indexOf(o)===i);return{type:s.length>1?s:s[0],enum:n.reduce((o,i)=>o.includes(i._def.value)?o:[...o,i._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,s)=>[...r,...s._def.values.filter(o=>!r.includes(o))],[])};return Dc(t,e)}m(pm,"parseUnionDef");var Dc=m((t,e)=>{let n=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((s,o)=>Pe(s._def,M(w({},e),{currentPath:[...e.currentPath,e.unionStrategy,`${o}`]}))).filter(s=>!!s&&(!e.strictUnions||typeof s=="object"&&Object.keys(s).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 gm(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 o={type:Ri[n._def.typeName],nullable:!0};return ro(n._def,e,o)}let s={type:[Ri[n._def.typeName],"null"]};return ro(n._def,e,s)}if(e.target==="openApi3"){let s=Pe(n._def,M(w({},e),{currentPath:[...e.currentPath]}));return s&&M(w({},s),{nullable:!0})}let r=Pe(n._def,M(w({},e),{currentPath:[...e.currentPath,"anyOf","0"]}));return r&&{anyOf:[r,{type:"null"}]}}m(gm,"parseNullableDef");function mm(t,e){let n=w({type:"number"},t.coerce?{[ke]:{coerce:t.coerce||void 0}}:{});if(!t.checks)return n;for(let r of t.checks)switch(r.kind){case"int":n.type="integer",Zo(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(mm,"parseNumberDef");var{zuiKey:WA}=en,GP=m((t,e)=>{var n;return et.zuiType(t.unknownKeys)?(n=Pe(t.unknownKeys._def,M(w({},e),{currentPath:[...e.currentPath,"additionalProperties"]})))!=null?n:!0:t.unknownKeys==="passthrough"},"getAdditionalProperties");function ym(t,e){let n=M(w({type:"object"},Object.entries(t.shape()).reduce((r,[s,o])=>{if(o===void 0||o._def===void 0)return r;let i=Pe(o._def,M(w({},e),{currentPath:[...e.currentPath,"properties",s],propertyPath:[...e.currentPath,"properties",s]}));return i===void 0?r:{properties:M(w({},r.properties),{[s]:i}),required:o.isOptional()?r.required:[...r.required,s]}},{properties:{},required:[]})),{additionalProperties:GP(t,e)});return n.required.length||delete n.required,n}m(ym,"parseObjectDef");var VP=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"),JP=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(s=>s!==void 0)}},"parsePipelineDef");function hm(t,e){return Pe(t.type._def,e)}m(hm,"parsePromiseDef");var YP=m((t,e)=>Pe(t.innerType._def,e),"parseReadonlyDef");function Tm(t){return{$ref:t.uri}}m(Tm,"parseRefDef");function vm(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(vm,"parseSetDef");function _m(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(_m,"parseTupleDef");function bm(){return{not:{}}}m(bm,"parseUndefinedDef");function wm(){return{}}m(wm,"parseUnknownDef");function Pe(t,e,n=!1){let r=e.seen.get(t);if(r&&!n){let i=XP(r,e);if(i!==void 0)return i}let s={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,s);let o=eB(t,t.typeName,e);return o&&ro(t,e,o),s.jsonSchema=o,o}m(Pe,"parseDef");var XP=m((t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:QP(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"),QP=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"),eB=m((t,e,n)=>{switch(e){case fe.ZodString:return Lo(t,n);case fe.ZodNumber:return mm(t,n);case fe.ZodObject:return ym(t,n);case fe.ZodBigInt:return em(t,n);case fe.ZodBoolean:return tm(t);case fe.ZodDate:return rm(t,n);case fe.ZodUndefined:return bm();case fe.ZodNull:return fm(n);case fe.ZodArray:return Qg(t,n);case fe.ZodUnion:case fe.ZodDiscriminatedUnion:return pm(t,n);case fe.ZodIntersection:return am(t,n);case fe.ZodTuple:return _m(t,n);case fe.ZodRecord:return Ko(t,n);case fe.ZodRef:return Tm(t);case fe.ZodLiteral:return lm(t,n);case fe.ZodEnum:return om(t);case fe.ZodNativeEnum:return cm(t);case fe.ZodNullable:return gm(t,n);case fe.ZodOptional:return VP(t,n);case fe.ZodMap:return um(t,n);case fe.ZodSet:return vm(t,n);case fe.ZodLazy:return Pe(t.getter()._def,n);case fe.ZodPromise:return hm(t,n);case fe.ZodNaN:case fe.ZodNever:return dm();case fe.ZodEffects:return sm(t,n);case fe.ZodAny:return Xg();case fe.ZodUnknown:return wm();case fe.ZodDefault:return im(t,n);case fe.ZodBranded:return nm(t,n);case fe.ZodReadonly:return YP(t,n);case fe.ZodCatch:return FP(t,n);case fe.ZodPipeline:return JP(t,n);case fe.ZodFunction:case fe.ZodVoid:case fe.ZodSymbol:return;default:return(r=>{})(e)}},"selectParser"),ro=m((t,e,n)=>(t.description&&(n.description=t.description,e.markdownDescription&&(n.markdownDescription=t.description)),Object.assign(n,{[ke]:w(w({},t[ke]),n[ke])}),n),"addMeta"),Hc={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"},tB=m(t=>typeof t=="string"?M(w({},Hc),{name:t}):w(w({},Hc),t),"getDefaultOptions"),nB=m(t=>{let e=tB(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,s])=>[s._def,{def:s._def,path:[...e.basePath,e.definitionPath,r],jsonSchema:void 0}]))})},"getRefs"),rB=m((t,e)=>{var n;let r=nB(e),s=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[c,f])=>{var g;return M(w({},l),{[c]:(g=Pe(f._def,M(w({},r),{currentPath:[...r.basePath,r.definitionPath,c]}),!0))!=null?g:{}})},{}):void 0,o=typeof e=="string"?e:e?.name,i=(n=Pe(t._def,o===void 0?r:M(w({},r),{currentPath:[...r.basePath,r.definitionPath,o]}),!1))!=null?n:{},a=o===void 0?s?M(w({},i),{[r.definitionPath]:s}):i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,o].join("/"),[r.definitionPath]:M(w({},s),{[o]:i})};return r.target==="jsonSchema7"?a.$schema="http://json-schema.org/draft-07/schema#":r.target==="jsonSchema2019-09"&&(a.$schema="https://json-schema.org/draft/2019-09/schema#"),a},"zodToJsonSchema"),iB=m((t,e={target:"openApi3"})=>{let n=rB(t,e);return e.$schemaUrl===!1?delete n.$schema:typeof e.$schemaUrl=="string"&&(n.$schema=e.$schemaUrl),n},"toJSONSchemaLegacy"),{zuiKey:js}=en,sB=m((t,e)=>{let n={type:"array",description:t.description,items:e(t._def.type),"x-zui":t._def["x-zui"]};return t._def[js]&&(n[js]=t._def[js]),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:$s}=en,oB=m(t=>{let e={type:"number",description:t.description,"x-zui":t._def["x-zui"]};t._def[$s]&&(e[$s]=t._def[$s]);for(let n of t._def.checks)switch(n.kind){case"min":{let r=n.inclusive?"minimum":"exclusiveMinimum",s=n.inclusive?"exclusiveMinimum":"minimum";e[r]=n.value,delete e[s];break}case"max":{let r=n.inclusive?"maximum":"exclusiveMaximum",s=n.inclusive?"exclusiveMaximum":"maximum";e[r]=n.value,delete e[s];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:Zs}=en,aB=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[Zs]&&(n[Zs]=t._def[Zs]),t._def.minSize&&(n.minItems=t._def.minSize.value),t._def.maxSize&&(n.maxItems=t._def.maxSize.value),n},"zodSetToJsonSet"),{zuiKey:xr}=en,lB=m(t=>{let e={type:"string",description:t.description,"x-zui":t._def["x-zui"]};t._def[xr]&&(e[xr]=t._def[xr]);for(let n of t._def.checks)switch(n.kind){case"cuid":e.format="cuid",e.pattern=Ge.cuid;break;case"cuid2":e.format="cuid2",e.pattern=Ge.cuid2;break;case"ulid":e.format="ulid",e.pattern=Ge.ulid;break;case"uuid":e.format="uuid",e.pattern=Ge.uuid;break;case"emoji":e.format="emoji",e.pattern=Ge.emoji;break;case"email":e.format="email",e.pattern=Ge.email;break;case"ip":e.format=n.version==="v6"?"ipv6":"ipv4",e.pattern=n.version==="v6"?Ge.ipv6:Ge.ipv4;break;case"datetime":e.format="date-time",(n.precision!==null||n.offset)&&(e.pattern=vp(n).source,e[xr]=M(w({},e[xr]),{precision:n.precision,offset:n.offset}));break;case"url":e.format="uri";break;case"endsWith":e.pattern=`${Hr.escapeSpecialChars(n.value)}$`;break;case"startsWith":e.pattern=`^${Hr.escapeSpecialChars(n.value)}`;break;case"includes":let r=n.position&&n.position>=1?`^(?:.{${n.position}}).*`:"";e.pattern=`${r}${Hr.escapeSpecialChars(n.value)}`;break;case"regex":e.pattern=n.regex.source;break;case"length":e.minLength=e.maxLength=Math.max(0,n.value);break;case"min":e.minLength=Math.max(0,n.value);break;case"max":e.maxLength=Math.max(0,n.value);break;default:throw new Hg({zodType:"ZodString",checkKind:n.kind})}return e},"zodStringToJsonString"),{zuiKey:Ls}=en,uB=m((t,e)=>{let n={type:"array",description:t.description,items:t._def.items.map(r=>e(r))};return t._def[Ls]&&(n[Ls]=t._def[Ls]),t._def.rest&&(n.additionalItems=e(t._def.rest)),n},"zodTupleToJsonTuple");function st(t){let e=t;switch(e.typeName){case"ZodString":return lB(e);case"ZodNumber":return oB(e);case"ZodNaN":throw new dt("ZodNaN");case"ZodBigInt":throw new dt("ZodBigInt",{suggestedAlternative:"serialize bigint to string"});case"ZodBoolean":return{type:"boolean",description:e.description,"x-zui":e._def["x-zui"]};case"ZodDate":throw new dt("ZodDate",{suggestedAlternative:"use z.string().datetime() instead"});case"ZodUndefined":return Ks(e);case"ZodNull":return Ws(e);case"ZodAny":return{description:e.description,"x-zui":e._def["x-zui"]};case"ZodUnknown":return{description:e.description,"x-zui":M(w({},e._def["x-zui"]),{def:{typeName:"ZodUnknown"}})};case"ZodNever":return{not:!0,description:e.description,"x-zui":e._def["x-zui"]};case"ZodVoid":throw new dt("ZodVoid");case"ZodArray":return sB(e,st);case"ZodObject":let n=Object.entries(e.shape),r=n.filter(([l,c])=>!c.isOptional()),s=r.length?r.map(([l])=>l):void 0,o=n.map(([l,c])=>[l,c.mandatory()]).map(([l,c])=>[l,st(c)]);return{type:"object",description:e.description,properties:Object.fromEntries(o),required:s,additionalProperties:cB(e._def),"x-zui":e._def["x-zui"]};case"ZodUnion":return{description:e.description,anyOf:e.options.map(l=>st(l)),"x-zui":e._def["x-zui"]};case"ZodDiscriminatedUnion":return{description:e.description,anyOf:e.options.map(l=>st(l)),"x-zui":M(w({},e._def["x-zui"]),{def:{typeName:"ZodDiscriminatedUnion",discriminator:e.discriminator}})};case"ZodIntersection":let i=st(e._def.left),a=st(e._def.right);return"additionalProperties"in i&&delete i.additionalProperties,"additionalProperties"in a&&delete a.additionalProperties,{description:e.description,allOf:[i,a],"x-zui":e._def["x-zui"]};case"ZodTuple":return uB(e,st);case"ZodRecord":return{type:"object",description:e.description,additionalProperties:st(e._def.valueType),"x-zui":e._def["x-zui"]};case"ZodMap":throw new dt("ZodMap");case"ZodSet":return aB(e,st);case"ZodFunction":throw new dt("ZodFunction");case"ZodLazy":throw new dt("ZodLazy");case"ZodLiteral":if(typeof e.value=="string")return{type:"string",description:e.description,const:e.value,"x-zui":e._def["x-zui"]};if(typeof e.value=="number")return{type:"number",description:e.description,const:e.value,"x-zui":e._def["x-zui"]};if(typeof e.value=="boolean")return{type:"boolean",description:e.description,const:e.value,"x-zui":e._def["x-zui"]};if(e.value===null)return Ws(e._def);if(e.value===void 0)return Ks(e._def);{e.value;let l=typeof e.value;throw new Yi(`Unsupported literal type: "${l}"`)}case"ZodEnum":return{type:"string",description:e.description,enum:e._def.values,"x-zui":e._def["x-zui"]};case"ZodEffects":throw new dt("ZodEffects");case"ZodNativeEnum":throw new dt("ZodNativeEnum");case"ZodOptional":return{description:e.description,anyOf:[st(e._def.innerType),Ks()],"x-zui":M(w({},e._def["x-zui"]),{def:{typeName:"ZodOptional"}})};case"ZodNullable":return{anyOf:[st(e._def.innerType),Ws()],"x-zui":M(w({},e._def["x-zui"]),{def:{typeName:"ZodNullable"}})};case"ZodDefault":return M(w({},st(e._def.innerType)),{default:e._def.defaultValue()});case"ZodCatch":throw new dt("ZodCatch");case"ZodPromise":throw new dt("ZodPromise");case"ZodBranded":throw new dt("ZodBranded");case"ZodPipeline":throw new dt("ZodPipeline");case"ZodSymbol":throw new dt("ZodPipeline");case"ZodReadonly":return M(w({},st(e._def.innerType)),{readOnly:!0});case"ZodRef":return{$ref:e._def.uri,description:e.description,"x-zui":e._def["x-zui"]};default:Ct.assertNever(e)}}m(st,"toJSONSchema");var Ks=m(t=>({not:!0,description:t?.description,"x-zui":M(w({},t?.["x-zui"]),{def:{typeName:"ZodUndefined"}})}),"undefinedSchema"),Ws=m(t=>({type:"null",description:t?.description,"x-zui":t?.["x-zui"]}),"nullSchema"),cB=m(t=>t.unknownKeys==="passthrough"?!0:t.unknownKeys==="strict"||!et.zuiType(t.unknownKeys)||t.unknownKeys.typeName==="ZodNever"?!1:st(t.unknownKeys),"additionalPropertiesSchema");function xm(t){return typeof t=="symbol"?"symbol":typeof t=="bigint"?`${t.toString()}n`:ie(t)}m(xm,"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"?Im(t):JSON.stringify(t)}m(ie,"primitiveToTypescriptValue");function tr(t){return typeof t>"u"?"undefined":JSON.stringify(t)}m(tr,"unknownToTypescriptValue");var Pm=m((t,e)=>{let n=Object.entries(t),r=e?" as const":"";return`{ ${n.map(([s,o])=>`${io(s)}: ${tr(o)}`).join(", ")} }${r}`},"recordOfUnknownToTypescriptRecord"),io=m(t=>/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t)?t:ie(t),"toPropertyKey"),dB=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(dB).filter(r=>!!r).join("")},"toTypeArgumentName"),Uc=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"),Qe=m(t=>{t=t?.replace(/(\n(\s*)?){3,}/g,`
|
|
70
70
|
|
|
71
|
-
`);let e=m(
|
|
72
|
-
`).map(
|
|
71
|
+
`);let e=m(s=>s.startsWith("* ")?` ${s}`:` * ${s}`,"ensureLineStartsWithAsterisk"),n=m(s=>s.replace(/\*\//g,"*\\/"),"escapeCommentEnd"),r=(t??"").split(`
|
|
72
|
+
`).map(s=>s.trim());return Uc(r),r.length&&(r[0]=r[0].replace(/^\/\*\*?/,""),r[r.length-1]=r[r.length-1].replace(/\*\/$/,"")),Uc(r),r.length===0?"":r.length===1?`/** ${n(r[0])} */`:`/**
|
|
73
73
|
${r.map(e).map(n).join(`
|
|
74
74
|
`)}
|
|
75
|
-
*/`},"getMultilineComment");function Im(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(Im,"escapeString");var Em=["string","number","boolean","unknown","void","any","null","undefined","never","bigint","symbol","object"],fB=5,pB=m(t=>Em.includes(t),"isPrimitive"),gB=m(t=>Em.map(e=>`${e}[]`).includes(t),"isArrayOfPrimitives"),
|
|
76
|
-
`:"",f=t.value.describe(""),p=et.zuiAny(t.value)?Zc(t.key):t.key;return`${c}${l}${c}${p}: ${xe(f,
|
|
77
|
-
${c.join(" | ")}`;case"ZodDiscriminatedUnion":let f=i._def.options.map(D=>xe(D,
|
|
78
|
-
${f.join(" | ")}`;case"ZodIntersection":return`${xe(i._def.left,
|
|
75
|
+
*/`},"getMultilineComment");function Im(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(Im,"escapeString");var Em=["string","number","boolean","unknown","void","any","null","undefined","never","bigint","symbol","object"],fB=5,pB=m(t=>Em.includes(t),"isPrimitive"),gB=m(t=>Em.map(e=>`${e}[]`).includes(t),"isArrayOfPrimitives"),Fs=m(t=>t.replace(/ +/g," ").trim(),"stripSpaces"),Sm=class{constructor(e,n){this.key=e,this.value=n}};m(Sm,"KeyValue");var hi=Sm,km=class{constructor(e){this.schema=e}};m(km,"FnParameters");var jc=km,Am=class{constructor(e){this.schema=e}};m(Am,"FnReturn");var $c=Am,Cm=class{constructor(e){this.props=e}};m(Cm,"Declaration");var Ur=Cm;function Wo(t,e={}){let n=hB(t,e),r=xe(n,e);return e.formatter&&(r=e.formatter(r)),r}m(Wo,"toTypescriptType");var Zc=m(t=>t.endsWith("?")?t:`${t}?`,"_optionalKey");function xe(t,e){var n,r,s;let o=M(w({},e),{declaration:!1,parent:t});if(t===null)return"";if(t instanceof Ur)return mB(t,o);if(t instanceof hi){let a;if(et.zuiOptional(t.value)?a=t.value:et.zuiDefault(t.value)&&e.treatDefaultAsOptional&&(a=t.value._def.innerType.optional()),a){let h=a._def.innerType;return et.zuiType(h)&&!h.description&&a.description&&(h=h?.describe(a.description)),xe(new hi(Zc(t.key),h),o)}let l=Qe(t.value._def.description||t.value.description),c=l?.trim().length>0?`
|
|
76
|
+
`:"",f=t.value.describe(""),p=et.zuiAny(t.value)?Zc(t.key):t.key;return`${c}${l}${c}${p}: ${xe(f,o)}${c}`}if(t instanceof jc){if(et.zuiTuple(t.schema)){let f="";for(let g=0;g<t.schema.items.length;g++){let p=(s=(r=(n=t.schema.items[g])==null?void 0:n.ui)==null?void 0:r.title)!=null?s:`arg${g}`,h=t.schema.items[g];f+=`${xe(new hi(io(p),h),o)}${g<t.schema.items.length-1?", ":""} `}return f}let a=et.zuiLiteral(t.schema.naked()),l=xe(t.schema,o).trim();return l.startsWith("{")&&l.endsWith("}")||l.startsWith("[")&&l.endsWith("]")||l.startsWith("(")&&l.endsWith(")")||l.startsWith("Array<")&&l.endsWith(">")||l.startsWith("Record<")&&l.endsWith(">")||gB(l)||a?`args: ${l}`:l}if(t instanceof $c)return et.zuiOptional(t.schema)?`${xe(t.schema.unwrap(),o)} | undefined`:xe(t.schema,o);let i=t;switch(i.typeName){case"ZodString":return`${Qe(i.description)} string`.trim();case"ZodNumber":case"ZodNaN":case"ZodBigInt":return`${Qe(i.description)} number`.trim();case"ZodBoolean":return`${Qe(i.description)} boolean`.trim();case"ZodDate":return`${Qe(i.description)} Date`.trim();case"ZodUndefined":return`${Qe(i.description)} undefined`.trim();case"ZodNull":return`${Qe(i.description)} null`.trim();case"ZodAny":return`${Qe(i.description)} any`.trim();case"ZodUnknown":return`${Qe(i.description)} unknown`.trim();case"ZodNever":return`${Qe(i.description)} never`.trim();case"ZodVoid":return`${Qe(i.description)} void`.trim();case"ZodArray":let a=xe(i._def.type,o);return pB(a)?`${a}[]`:`Array<${a}>`;case"ZodObject":return`{ ${Object.entries(i._def.shape()).map(([D,$])=>et.zuiType($)?xe(new hi(io(D),$),o):`${D}: unknown`).join("; ")} }`;case"ZodUnion":let c=i._def.options.map(D=>xe(D,o));return`${Qe(i.description)}
|
|
77
|
+
${c.join(" | ")}`;case"ZodDiscriminatedUnion":let f=i._def.options.map(D=>xe(D,o));return`${Qe(i.description)}
|
|
78
|
+
${f.join(" | ")}`;case"ZodIntersection":return`${xe(i._def.left,o)} & ${xe(i._def.right,o)}`;case"ZodTuple":return i._def.items.length===0?"[]":`[${i._def.items.map(D=>xe(D,o)).join(", ")}]`;case"ZodRecord":let p=xe(i._def.keyType,o),h=xe(i._def.valueType,o);return`${Qe(i.description)} { [key: ${p}]: ${h} }`;case"ZodMap":return`Map<${xe(i._def.keyType,o)}, ${xe(i._def.valueType,o)}>`;case"ZodSet":return`Set<${xe(i._def.valueType,o)}>`;case"ZodFunction":let _=xe(new jc(i._def.args),o),P=xe(new $c(i._def.returns),o),B=e?.parent instanceof Ur&&e?.parent.props.type==="type";return e?.declaration&&!B?`${Qe(i.description)}
|
|
79
79
|
(${_}): ${P}`:`${Qe(i.description)}
|
|
80
|
-
(${_}) => ${P}`;case"ZodLazy":return xe(i._def.getter(),
|
|
81
|
-
${T}`.trim();case"ZodEnum":return i._def.values.map(ie).join(" | ");case"ZodEffects":return xe(i._def.schema,
|
|
82
|
-
`).length>=fB&&e.includeClosingTags?`// end of ${r}`:"";if(t.props.type!=="type"&&n.typeName==="ZodFunction")return
|
|
83
|
-
declare function ${r}${i};${l}`);if(t.props.type==="variable")return
|
|
84
|
-
`).trim();case"ZodUnion":return`z.union([${e._def.options.map($e).join(", ")}])${Be(e._def)}`.trim();case"ZodDiscriminatedUnion":let i=e._def.options.map($e);return`z.discriminatedUnion(${ie(e._def.discriminator)}, [${i.join(", ")}])${Be(e._def)}`.trim();case"ZodIntersection":let l=$e(e._def.left),c=$e(e._def.right);return`z.intersection(${l}, ${c})${Be(e._def)}`.trim();case"ZodTuple":return`z.tuple([${e._def.items.map($e).join(", ")}])${Be(e._def)}`.trim();case"ZodRecord":let g=$e(e._def.keyType),p=$e(e._def.valueType);return`z.record(${g}, ${p})${Be(e._def)}`.trim();case"ZodMap":let h=$e(e._def.keyType),_=$e(e._def.valueType);return`z.map(${h}, ${_})${Be(e._def)}`.trim();case"ZodSet":return`z.set(${$e(e._def.valueType)})${BB(e._def)}${Be(e._def)}`.trim();case"ZodFunction":let P=e._def.args.items.map($e),B=P.length?`.args(${P.join(", ")})`:"",T=$e(e._def.returns);return`z.function()${B}.returns(${T})${Be(e._def)}`.trim();case"ZodLazy":return`z.lazy(() => ${$e(e._def.getter())})${Be(e._def)}`.trim();case"ZodLiteral":return`z.literal(${ie(e._def.value)})${Be(e._def)}`.trim();case"ZodEnum":return`z.enum([${e._def.values.map(ie).join(", ")}])${Be(e._def)}`.trim();case"ZodEffects":throw new Sn("ZodEffects");case"ZodNativeEnum":throw new Sn("ZodNativeEnum");case"ZodOptional":return`z.optional(${$e(e._def.innerType)})${Be(e._def,e._def.innerType)}`.trim();case"ZodNullable":return`z.nullable(${$e(e._def.innerType)})${Be(e._def,e._def.innerType)}`.trim();case"ZodDefault":let D=tr(e._def.defaultValue());return`z.default(${$e(e._def.innerType)}, ${D})${Be(e._def,e._def.innerType)}`.trim();case"ZodCatch":throw new Sn("ZodCatch");case"ZodPromise":return`z.promise(${$e(e._def.type)})${Be(e._def,e._def.type)}`.trim();case"ZodBranded":throw new Sn("ZodBranded");case"ZodPipeline":throw new Sn("ZodPipeline");case"ZodSymbol":throw new Sn("ZodSymbol");case"ZodReadonly":return`z.readonly(${$e(e._def.innerType)})${Be(e._def,e._def.innerType)}`.trim();case"ZodRef":return`z.ref(${ie(e._def.uri)})${Be(e._def)}`.trim();default:Ct.assertNever(e)}}m($e,"sUnwrapZod");var Be=m((t,e)=>{let n=e?._def;return`${kB(t,n)}${SB(t,n)}`},"_addMetadata"),SB=m((t,e)=>!t.description||e&&e.description===t.description?"":`.describe(${ie(t.description)})`,"_maybeDescribe"),kB=m((t,e)=>`${AB(t,e)}${CB(t,e)}${OB(t,e)}${RB(t,e)}${MB(t,e)}${NB(t,e)}${DB(t,e)}`,"_addZuiExtensions"),AB=m((t,e)=>{var n,r;let o=(n=t[mt])==null?void 0:n.title;return!o||e&&((r=e[mt])==null?void 0:r.title)===o?"":`.title(${ie(o)})`},"_maybeTitle"),CB=m((t,e)=>{var n,r;let o=(n=t[mt])==null?void 0:n.displayAs;return!o||e&&gn((r=e[mt])==null?void 0:r.displayAs,o)?"":`.displayAs(${Pm({id:o[0],params:o[1]})})`},"_maybeDisplayAs"),OB=m((t,e)=>{var n,r;let o=(n=t[mt])==null?void 0:n.disabled;return!o||e&&((r=e[mt])==null?void 0:r.disabled)===o?"":`.disabled(${o})`},"_maybeDisabled"),RB=m((t,e)=>{var n,r;let o=(n=t[mt])==null?void 0:n.hidden;return!o||e&&((r=e[mt])==null?void 0:r.hidden)===o?"":`.hidden(${o})`},"_maybeHidden"),MB=m((t,e)=>{var n,r;let o=(n=t[mt])==null?void 0:n.placeholder;return!o||e&&((r=e[mt])==null?void 0:r.placeholder)===o?"":`.placeholder(${ie(o)})`},"_maybePlaceholder"),NB=m((t,e)=>{var n,r;let o=(n=t[mt])==null?void 0:n.secret;return!o||e&&((r=e[mt])==null?void 0:r.secret)===o?"":".secret()"},"_maybeSecret"),DB=m((t,e)=>{var n,r;let o=["title","tooltip","displayAs","disabled","hidden","placeholder","secret","coerce"],s=Object.entries((n=t[mt])!=null?n:{}).filter(([i])=>!o.includes(i));if(s.length===0)return"";if(e){let i=Object.entries((r=e[mt])!=null?r:{}).filter(([a])=>!o.includes(a));if(gn(Object.fromEntries(s),Object.fromEntries(i)))return""}return`.metadata(${Pm(Object.fromEntries(s))})`},"_maybeSetMetadata"),HB={};pe.prototype.toJSONSchema=function(){return ot(this)};pe.prototype.toTypescriptType=function(t){return Ws(this,t)};pe.prototype.toTypescriptSchema=function(){return Fs(this)};var nt=ne.string().min(1),Rm=ne.object({text:nt}),Mm=ne.object({markdown:nt}),Nm=ne.object({imageUrl:nt,title:nt.optional()}),Dm=ne.object({audioUrl:nt,title:nt.optional()}),Hm=ne.object({videoUrl:nt,title:nt.optional()}),Um=ne.object({fileUrl:nt,title:nt.optional()}),jm=ne.object({latitude:ne.number(),longitude:ne.number(),address:ne.string().optional(),title:ne.string().optional()}),$m=ne.object({title:nt,subtitle:nt.optional(),imageUrl:nt.optional(),actions:ne.array(ne.object({action:ne.enum(["postback","url","say"]),label:nt,value:nt}))}),Om=ne.object({text:nt,options:ne.array(ne.object({label:nt,value:nt}))}),UB=ne.object({items:ne.array($m)}),Zm=ne.union([ne.object({type:ne.literal("text"),payload:Rm}),ne.object({type:ne.literal("image"),payload:Nm}),ne.object({type:ne.literal("audio"),payload:Dm}),ne.object({type:ne.literal("video"),payload:Hm}),ne.object({type:ne.literal("file"),payload:Um}),ne.object({type:ne.literal("location"),payload:jm})]),jB=ne.object({items:ne.array(Zm)}),$B={schema:Mm},ZB={schema:ne.object({items:ne.array(ne.union([...Zm.options,ne.object({type:ne.literal("markdown"),payload:Mm})]))})},LB={text:{schema:Rm},image:{schema:Nm},audio:{schema:Dm},video:{schema:Hm},file:{schema:Um},location:{schema:jm},carousel:{schema:UB},card:{schema:$m},dropdown:{schema:Om},choice:{schema:Om},bloc:{schema:jB}};S();A();k();var uC={HIDDEN_IN_STUDIO:{bpActionHiddenInStudio:"true"},AWAIT_RETURN:{bpActionAwaitReturn:"true"}};S();A();k();import{isNode as KS}from"browser-or-node";S();A();k();var zs=console;function Mt(t){if(!t.body)throw new Error("Missing body");return JSON.parse(t.body)}async function bo(t,e=8072,n=qS){if(!KS)throw new Error("This function can only be called in Node.js");let o=($h(),VT(jh)).createServer(async(s,i)=>{try{let a=await WS(s);if(a.path==="/health"){i.writeHead(200).end("ok");return}let l=await t(a);i.writeHead(l?.status??200,l?.headers??{}).end(l?.body??"{}")}catch(a){let l=a instanceof Error?a.message:String(a);zs.error("Error while handling request",{error:l??"Internal error occured"}),i.writeHead(500).end(JSON.stringify({error:l??"Internal error occured"}))}});return o.listen(e,()=>n(e)),o}async function WS(t){let e=await zS(t),n={};for(let o=0;o<t.rawHeaders.length;o+=2){let s=t.rawHeaders[o].toLowerCase(),i=t.rawHeaders[o+1];n[s]=i}let r=new URL(t.url??"",t.headers.host?`http://${t.headers.host}`:"http://botpress.cloud");return{body:e,path:r.pathname,query:FS(r.search,"?"),headers:n,method:t.method?.toUpperCase()??"GET"}}function FS(t,e){return t.indexOf(e)===0?t.slice(e.length):t}async function zS(t){return new Promise((e,n)=>{if(t.method!=="POST"&&t.method!=="PUT"&&t.method!=="PATCH")return e(void 0);let r="";t.on("data",o=>r+=o.toString()),t.on("error",o=>n(o)),t.on("end",()=>e(r))})}function qS(t){zs.info(`Listening on port ${t}`)}import{isApiError as Oj,RuntimeError as Rj}from"@botpress/client";S();A();k();S();A();k();S();A();k();S();A();k();var je={};bn(je,{mapKeys:()=>JS,mapValues:()=>VS,mergeRecords:()=>XS,pairs:()=>wo,stripUndefinedProps:()=>YS,values:()=>GS});S();A();k();var wo=t=>Object.entries(t),GS=t=>Object.values(t),VS=(t,e)=>Object.fromEntries(wo(t).map(([n,r])=>[n,e(r,n)])),JS=(t,e)=>Object.fromEntries(wo(t).map(([n,r])=>[e(n),r])),YS=t=>Object.fromEntries(wo(t).filter(([,e])=>e!==void 0)),XS=(t,e,n)=>{let r=[...Object.keys(t),...Object.keys(e)],o=[...new Set(r)],s={};for(let i of o){let a=t[i],l=e[i];a&&l?s[i]=n(a,l):a?s[i]=a:l&&(s[i]=l)}return s};var ue={};bn(ue,{safePush:()=>QS,unique:()=>ek});S();A();k();var QS=(t,...e)=>t?[...t,...e]:[...e],ek=t=>Array.from(new Set(t));S();A();k();var ut={};bn(ut,{setName:()=>tk});S();A();k();var tk=(t,e)=>(Object.defineProperty(t,"name",{value:e}),t);var Zh=t=>{let{name:e,version:n}=t,r={actions:{},events:{},channels:{}},o={name:e,version:n,entities:je.mapValues(t.entities,i=>({name:i.name})),actions:{},events:{},channels:{}},s=je.mapValues(t.entities,i=>i.schema);for(let[i,a]of Object.entries(t.definition.actions??{})){let l=a.input.schema.dereference(s),c=a.output.schema.dereference(s),f=t.actions?.[i]?.name??i;r.actions[f]={...a,...t.actions?.[i]??{},input:{schema:l},output:{schema:c}},o.actions[i]={name:f}}for(let[i,a]of Object.entries(t.definition.events??{})){let l=a.schema.dereference(s),c=t.events?.[i]?.name??i;r.events[c]={...a,...t.events?.[i]??{},schema:l},o.events[i]={name:c}}for(let[i,a]of Object.entries(t.definition.channels??{})){let l={};for(let[f,g]of Object.entries(a.messages)){let p=g.schema.dereference(s);l[f]={...g,schema:p}}let c=t.channels?.[i]?.name??i;r.channels[c]={...a,...t.channels?.[i]??{},message:{...a.message??{},tags:{...a.message?.tags??{},...t.channels?.[i]?.message?.tags??{}}},conversation:{...a.conversation??{},tags:{...a.conversation?.tags??{},...t.channels?.[i]?.conversation?.tags??{}}},messages:l},o.channels[i]={name:c}}return{resolved:r,statement:o}};S();A();k();var Lh="6.1.0";var _n=Lh;S();A();k();var xo=Symbol("schemaName"),Kh=t=>t?je.mapValues(t,(n,r)=>({...n,[xo]:r})):{},Wh=t=>xo in t&&t[xo]!==void 0,Fh=t=>t[xo];S();A();k();var Ka=class{constructor(e){this.props=e;this.name=e.name,this.version=e.version,this.icon=e.icon,this.readme=e.readme,this.title=e.title,this.identifier=e.identifier,this.description=e.description,this.configuration=e.configuration,this.configurations=e.configurations,this.events=e.events,this.actions=e.actions,this.channels=e.channels,this.states=e.states,this.user=e.user,this.secrets=e.secrets,this.entities=e.entities,this.interfaces=e.interfaces,this.__advanced=e.__advanced,this.attributes=e.attributes}name;version;title;description;icon;readme;configuration;configurations;events;actions;channels;states;user;secrets;identifier;entities;interfaces;__advanced;attributes;get metadata(){return{sdkVersion:_n}}extend(e,n){let{entities:r,actions:o,events:s,channels:i}=this._callBuilder(e,n),a=this;a.interfaces??={};let l=Object.values(r).map(p=>p.name),c=l.length===0?e.name:`${e.name}<${l.join(",")}>`,{resolved:f,statement:g}=Zh({...e,entities:r,actions:je.stripUndefinedProps(o),events:je.stripUndefinedProps(s),channels:je.stripUndefinedProps(i)});return a.actions=je.mergeRecords(a.actions??{},f.actions,this._mergeActions),a.channels=je.mergeRecords(a.channels??{},f.channels,this._mergeChannels),a.events=je.mergeRecords(a.events??{},f.events,this._mergeEvents),a.interfaces[c]={id:e.id,...g},this}_callBuilder(e,n){let o={entities:Kh(this.entities)},s=n(o),i=je.pairs(s.entities).find(([l,c])=>!Wh(c));if(i)throw new Error(`Cannot extend interface "${e.name}" with entity "${i[0]}"; the provided schema is not part of the integration's entities.`);return{entities:je.mapValues(s.entities,l=>({name:Fh(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=je.mergeRecords(e.messages,n.messages,this._mergeMessage),o;(e.conversation||n.conversation)&&(o={tags:{...e.conversation?.tags,...n.conversation?.tags}});let s;return(e.message||n.message)&&(s={tags:{...e.message?.tags,...n.message?.tags}}),{...e,...n,messages:r,conversation:o,message:s}};_mergeMessage=(e,n)=>({schema:this._mergeObjectSchemas(e.schema,n.schema)});_mergeObjectSchemas=(e,n)=>{let r=e._def,o=n._def;if(r.typeName==="ZodObject"&&o.typeName==="ZodObject"){let s=r.shape(),i=o.shape();return ne.object({...s,...i})}if(r.typeName==="ZodRecord"&&o.typeName==="ZodRecord")return ne.record(ne.intersection(r.valueType,o.valueType));throw new Error("Cannot merge object schemas with record schemas")}};S();A();k();S();A();k();import{isApiError as Ok,Client as Rk,RuntimeError as NT,InvalidPayloadError as Mk}from"@botpress/client";S();A();k();import*as zh from"@botpress/client";var Po={retries:3,retryCondition:t=>zh.axiosRetry.isNetworkOrIdempotentRequestError(t)||[429,502].includes(t.response?.status??0),retryDelay:(t,e)=>(rk(e.response?.headers??{})??t)*1e3},rk=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 ik(String(r))}},ik=t=>{let e=ok(t)?sk(t):t.length>0?parseInt(t,10):void 0;return e===void 0||isNaN(e)?void 0:e},ok=t=>t.includes(" "),sk=t=>{let e=ak(t);if(!e)return;let n=new Date;return Math.max(0,Math.floor((e.getTime()-n.getTime())/1e3))},ak=t=>{let e=new Date(t);return isNaN(e.getTime())?void 0:e};S();A();k();S();A();k();var ri=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 Bo=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 Nt="#",Io="x-bot-id",qh="x-bot-user-id",Gh="x-integration-id",Vh="x-integration-alias",Jh="x-webhook-id",Yh="x-bp-configuration-type",Eo="x-bp-configuration",So="x-bp-operation",Xh="x-bp-type";S();A();k();var It=t=>{throw t instanceof Error?t:new Error(t)};var GR=ne.enum(["webhook_received","message_created","action_triggered","register","unregister","ping","create_user","create_conversation"]),Qh=t=>({botId:t[Io]||It("Missing bot header"),botUserId:t[qh]||It("Missing bot user header"),integrationId:t[Gh]||It("Missing integration header"),integrationAlias:t[Vh]||It("Missing integration alias header"),webhookId:t[Jh]||It("Missing webhook header"),operation:t[So]||It("Missing operation header"),configurationType:t[Yh]??null,configuration:JSON.parse(z.from(t[Eo]||It("Missing configuration header"),"base64").toString("utf-8"))});S();A();k();S();A();k();S();A();k();S();A();k();var Fa={},eT=!1;function dl(){return eT||(eT=!0,Fa=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},n=Symbol("test"),r=Object(n);if(typeof n=="string"||Object.prototype.toString.call(n)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var o=42;e[n]=o;for(n in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==n||!Object.prototype.propertyIsEnumerable.call(e,n))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var i=Object.getOwnPropertyDescriptor(e,n);if(i.value!==o||i.enumerable!==!0)return!1}return!0}),Fa}var za={},tT=!1;function lk(){return tT||(tT=!0,za=Error),za}var qa={},nT=!1;function uk(){return nT||(nT=!0,qa=EvalError),qa}var Ga={},rT=!1;function ck(){return rT||(rT=!0,Ga=RangeError),Ga}var Va={},iT=!1;function dk(){return iT||(iT=!0,Va=ReferenceError),Va}var Ja={},oT=!1;function bT(){return oT||(oT=!0,Ja=SyntaxError),Ja}var Ya={},sT=!1;function ko(){return sT||(sT=!0,Ya=TypeError),Ya}var Xa={},aT=!1;function fk(){return aT||(aT=!0,Xa=URIError),Xa}var Qa={},lT=!1;function pk(){if(lT)return Qa;lT=!0;var t=typeof Symbol<"u"&&Symbol,e=dl();return Qa=function(){return typeof t!="function"||typeof Symbol!="function"||typeof t("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},Qa}var el={},uT=!1;function gk(){if(uT)return el;uT=!0;var t={__proto__:null,foo:{}},e=Object;return el=function(){return{__proto__:t}.foo===t.foo&&!(t instanceof e)},el}var tl={},cT=!1;function mk(){if(cT)return tl;cT=!0;var t="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,n=Math.max,r="[object Function]",o=function(l,c){for(var f=[],g=0;g<l.length;g+=1)f[g]=l[g];for(var p=0;p<c.length;p+=1)f[p+l.length]=c[p];return f},s=function(l,c){for(var f=[],g=c,p=0;g<l.length;g+=1,p+=1)f[p]=l[g];return f},i=function(a,l){for(var c="",f=0;f<a.length;f+=1)c+=a[f],f+1<a.length&&(c+=l);return c};return tl=function(l){var c=this;if(typeof c!="function"||e.apply(c)!==r)throw new TypeError(t+c);for(var f=s(arguments,1),g,p=function(){if(this instanceof g){var T=c.apply(this,o(f,arguments));return Object(T)===T?T:this}return c.apply(l,o(f,arguments))},h=n(0,c.length-f.length),_=[],P=0;P<h;P++)_[P]="$"+P;if(g=Function("binder","return function ("+i(_,",")+"){ return binder.apply(this,arguments); }")(p),c.prototype){var B=function(){};B.prototype=c.prototype,g.prototype=new B,B.prototype=null}return g},tl}var nl={},dT=!1;function fl(){if(dT)return nl;dT=!0;var t=mk();return nl=Function.prototype.bind||t,nl}var rl={},fT=!1;function yk(){if(fT)return rl;fT=!0;var t=Function.prototype.call,e=Object.prototype.hasOwnProperty,n=fl();return rl=n.call(t,e),rl}var il={},pT=!1;function oi(){if(pT)return il;pT=!0;var t,e=lk(),n=uk(),r=ck(),o=dk(),s=bT(),i=ko(),a=fk(),l=Function,c=function(Re){try{return l('"use strict"; return ('+Re+").constructor;")()}catch{}},f=Object.getOwnPropertyDescriptor;if(f)try{f({},"")}catch{f=null}var g=function(){throw new i},p=f?(function(){try{return arguments.callee,g}catch{try{return f(arguments,"callee").get}catch{return g}}})():g,h=pk()(),_=gk()(),P=Object.getPrototypeOf||(_?function(Re){return Re.__proto__}:null),B={},T=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%":h&&P?P([][Symbol.iterator]()):t,"%AsyncFromSyncIteratorPrototype%":t,"%AsyncFunction%":B,"%AsyncGenerator%":B,"%AsyncGeneratorFunction%":B,"%AsyncIteratorPrototype%":B,"%Atomics%":typeof Atomics>"u"?t:Atomics,"%BigInt%":typeof BigInt>"u"?t:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?t:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?t:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?t:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":e,"%eval%":eval,"%EvalError%":n,"%Float32Array%":typeof Float32Array>"u"?t:Float32Array,"%Float64Array%":typeof Float64Array>"u"?t:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?t:FinalizationRegistry,"%Function%":l,"%GeneratorFunction%":B,"%Int8Array%":typeof Int8Array>"u"?t:Int8Array,"%Int16Array%":typeof Int16Array>"u"?t:Int16Array,"%Int32Array%":typeof Int32Array>"u"?t:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":h&&P?P(P([][Symbol.iterator]())):t,"%JSON%":typeof JSON=="object"?JSON:t,"%Map%":typeof Map>"u"?t:Map,"%MapIteratorPrototype%":typeof Map>"u"||!h||!P?t:P(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?t:Promise,"%Proxy%":typeof Proxy>"u"?t:Proxy,"%RangeError%":r,"%ReferenceError%":o,"%Reflect%":typeof Reflect>"u"?t:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?t:Set,"%SetIteratorPrototype%":typeof Set>"u"||!h||!P?t:P(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?t:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":h&&P?P(""[Symbol.iterator]()):t,"%Symbol%":h?Symbol:t,"%SyntaxError%":s,"%ThrowTypeError%":p,"%TypedArray%":T,"%TypeError%":i,"%Uint8Array%":typeof Uint8Array>"u"?t:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?t:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?t:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?t:Uint32Array,"%URIError%":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(Re){var I=P(P(Re));E["%Error.prototype%"]=I}var D=function Re(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=Re("%AsyncGeneratorFunction%");se&&(we=se.prototype)}else if(ve==="%AsyncIteratorPrototype%"){var de=Re("%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"]},ee=fl(),Y=yk(),ce=ee.call(Function.call,Array.prototype.concat),re=ee.call(Function.apply,Array.prototype.splice),Q=ee.call(Function.call,String.prototype.replace),Ie=ee.call(Function.call,String.prototype.slice),Le=ee.call(Function.call,RegExp.prototype.exec),Xe=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Fe=/\\(\\)?/g,ze=function(ve){var we=Ie(ve,0,1),se=Ie(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 Q(ve,Xe,function(N,Z,K,le){de[de.length]=K?Q(le,Fe,"$1"):Z||N}),de},pt=function(ve,we){var se=ve,de;if(Y($,se)&&(de=$[se],se="%"+de[0]+"%"),Y(E,se)){var N=E[se];if(N===B&&(N=D(se)),typeof N>"u"&&!we)throw new i("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 il=function(ve,we){if(typeof ve!="string"||ve.length===0)throw new i("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof we!="boolean")throw new i('"allowMissing" argument must be a boolean');if(Le(/^%?[^%]*%?$/,ve)===null)throw new s("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var se=ze(ve),de=se.length>0?se[0]:"",N=pt("%"+de+"%",we),Z=N.name,K=N.value,le=!1,ge=N.alias;ge&&(de=ge[0],re(se,ce([0,1],ge)));for(var R=1,C=!0;R<se.length;R+=1){var j=se[R],V=Ie(j,0,1),te=Ie(j,-1);if((V==='"'||V==="'"||V==="`"||te==='"'||te==="'"||te==="`")&&V!==te)throw new s("property names with quotes must have matching quotes");if((j==="constructor"||!C)&&(le=!0),de+="."+j,Z="%"+de+"%",Y(E,Z))K=E[Z];else if(K!=null){if(!(j in K)){if(!we)throw new i("base intrinsic for "+ve+" exists, but the property is not available.");return}if(f&&R+1>=se.length){var b=f(K,j);C=!!b,C&&"get"in b&&!("originalValue"in b.get)?K=b.get:K=K[j]}else C=Y(K,j),K=K[j];C&&!le&&(E[Z]=K)}}return K},il}var ol={},gT=!1;function pl(){if(gT)return ol;gT=!0;var t=oi(),e=t("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return ol=e,ol}var sl={},mT=!1;function Ao(){if(mT)return sl;mT=!0;var t=oi(),e=t("%Object.getOwnPropertyDescriptor%",!0);if(e)try{e([],"length")}catch{e=null}return sl=e,sl}var al={},yT=!1;function hk(){if(yT)return al;yT=!0;var t=pl(),e=bT(),n=ko(),r=Ao();return al=function(s,i,a){if(!s||typeof s!="object"&&typeof s!="function")throw new n("`obj` must be an object or a function`");if(typeof i!="string"&&typeof i!="symbol")throw new n("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new n("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new n("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new n("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new n("`loose`, if provided, must be a boolean");var l=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,f=arguments.length>5?arguments[5]:null,g=arguments.length>6?arguments[6]:!1,p=!!r&&r(s,i);if(t)t(s,i,{configurable:f===null&&p?p.configurable:!f,enumerable:l===null&&p?p.enumerable:!l,value:a,writable:c===null&&p?p.writable:!c});else if(g||!l&&!c&&!f)s[i]=a;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},al}var ll={},hT=!1;function Tk(){if(hT)return ll;hT=!0;var t=pl(),e=function(){return!!t};return e.hasArrayLengthDefineBug=function(){if(!t)return null;try{return t([],"length",{value:1}).length!==1}catch{return!0}},ll=e,ll}var ul={},TT=!1;function vk(){if(TT)return ul;TT=!0;var t=oi(),e=hk(),n=Tk()(),r=Ao(),o=ko(),s=t("%Math.floor%");return ul=function(a,l){if(typeof a!="function")throw new o("`fn` is not a function");if(typeof l!="number"||l<0||l>4294967295||s(l)!==l)throw new o("`length` must be a positive 32-bit integer");var c=arguments.length>2&&!!arguments[2],f=!0,g=!0;if("length"in a&&r){var p=r(a,"length");p&&!p.configurable&&(f=!1),p&&!p.writable&&(g=!1)}return(f||g||!c)&&(n?e(a,"length",l,!0,!0):e(a,"length",l)),a},ul}var ii={},vT=!1;function gl(){if(vT)return ii;vT=!0;var t=fl(),e=oi(),n=vk(),r=ko(),o=e("%Function.prototype.apply%"),s=e("%Function.prototype.call%"),i=e("%Reflect.apply%",!0)||t.call(s,o),a=pl(),l=e("%Math.max%");ii=function(g){if(typeof g!="function")throw new r("a function is required");var p=i(t,s,arguments);return n(p,1+l(0,g.length-(arguments.length-1)),!0)};var c=function(){return i(t,o,arguments)};return a?a(ii,"apply",{value:c}):ii.apply=c,ii}var cl={},_T=!1;function ml(){if(_T)return cl;_T=!0;var t=oi(),e=gl(),n=e(t("String.prototype.indexOf"));return cl=function(o,s){var i=t(o,!!s);return typeof i=="function"&&n(o,".prototype.")>-1?e(i):i},cl}qs();ca();var yl={},wT=!1;function Il(){if(wT)return yl;wT=!0;var t=dl();return yl=function(){return t()&&!!Symbol.toStringTag},yl}var hl={},xT=!1;function _k(){if(xT)return hl;xT=!0;var t=Il()(),e=ml(),n=e("Object.prototype.toString"),r=function(a){return t&&a&&typeof a=="object"&&Symbol.toStringTag in a?!1:n(a)==="[object Arguments]"},o=function(a){return r(a)?!0:a!==null&&typeof a=="object"&&typeof a.length=="number"&&a.length>=0&&n(a)!=="[object Array]"&&n(a.callee)==="[object Function]"},s=(function(){return r(arguments)})();return r.isLegacyArguments=o,hl=s?r:o,hl}var Tl={},PT=!1;function bk(){if(PT)return Tl;PT=!0;var t=Object.prototype.toString,e=Function.prototype.toString,n=/^\s*(?:function)?\*/,r=Il()(),o=Object.getPrototypeOf,s=function(){if(!r)return!1;try{return Function("return function*() {}")()}catch{}},i;return Tl=function(l){if(typeof l!="function")return!1;if(n.test(e.call(l)))return!0;if(!r){var c=t.call(l);return c==="[object GeneratorFunction]"}if(!o)return!1;if(typeof i>"u"){var f=s();i=f?o(f):!1}return o(l)===i},Tl}var vl={},BT=!1;function wk(){if(BT)return vl;BT=!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 o=/^\s*class\b/,s=function(I){try{var D=t.call(I);return o.test(D)}catch{return!1}},i=function(I){try{return s(I)?!1:(t.call(I),!0)}catch{return!1}},a=Object.prototype.toString,l="[object Object]",c="[object Function]",f="[object GeneratorFunction]",g="[object HTMLAllCollection]",p="[object HTML document.all class]",h="[object HTMLCollection]",_=typeof Symbol=="function"&&!!Symbol.toStringTag,P=!(0 in[,]),B=function(){return!1};if(typeof document=="object"){var T=document.all;a.call(T)===a.call(document.all)&&(B=function(I){if((P||!I)&&(typeof I>"u"||typeof I=="object"))try{var D=a.call(I);return(D===g||D===p||D===h||D===l)&&I("")==null}catch{}return!1})}return vl=e?function(I){if(B(I))return!0;if(!I||typeof I!="function"&&typeof I!="object")return!1;try{e(I,null,n)}catch(D){if(D!==r)return!1}return!s(I)&&i(I)}:function(I){if(B(I))return!0;if(!I||typeof I!="function"&&typeof I!="object")return!1;if(_)return i(I);if(s(I))return!1;var D=a.call(I);return D!==c&&D!==f&&!/^\[object HTML/.test(D)?!1:i(I)},vl}var _l={},IT=!1;function xk(){if(IT)return _l;IT=!0;var t=wk(),e=Object.prototype.toString,n=Object.prototype.hasOwnProperty,r=function(l,c,f){for(var g=0,p=l.length;g<p;g++)n.call(l,g)&&(f==null?c(l[g],g,l):c.call(f,l[g],g,l))},o=function(l,c,f){for(var g=0,p=l.length;g<p;g++)f==null?c(l.charAt(g),g,l):c.call(f,l.charAt(g),g,l)},s=function(l,c,f){for(var g in l)n.call(l,g)&&(f==null?c(l[g],g,l):c.call(f,l[g],g,l))},i=function(l,c,f){if(!t(c))throw new TypeError("iterator must be a function");var g;arguments.length>=3&&(g=f),e.call(l)==="[object Array]"?r(l,c,g):typeof l=="string"?o(l,c,g):s(l,c,g)};return _l=i,_l}var bl={},ET=!1;function Pk(){return ET||(ET=!0,bl=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),bl}var wl={},ST=!1,Bk=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function Ik(){if(ST)return wl;ST=!0;var t=Pk(),e=typeof globalThis>"u"?Bk:globalThis;return wl=function(){for(var r=[],o=0;o<t.length;o++)typeof e[t[o]]=="function"&&(r[r.length]=t[o]);return r},wl}var xl={},kT=!1,Ek=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function MT(){if(kT)return xl;kT=!0;var t=xk(),e=Ik(),n=gl(),r=ml(),o=Ao(),s=r("Object.prototype.toString"),i=Il()(),a=typeof globalThis>"u"?Ek:globalThis,l=e(),c=r("String.prototype.slice"),f=Object.getPrototypeOf,g=r("Array.prototype.indexOf",!0)||function(B,T){for(var E=0;E<B.length;E+=1)if(B[E]===T)return E;return-1},p={__proto__:null};i&&o&&f?t(l,function(P){var B=new a[P];if(Symbol.toStringTag in B){var T=f(B),E=o(T,Symbol.toStringTag);if(!E){var I=f(T);E=o(I,Symbol.toStringTag)}p["$"+P]=n(E.get)}}):t(l,function(P){var B=new a[P],T=B.slice||B.set;T&&(p["$"+P]=n(T))});var h=function(B){var T=!1;return t(p,function(E,I){if(!T)try{"$"+E(B)===I&&(T=c(I,1))}catch{}}),T},_=function(B){var T=!1;return t(p,function(E,I){if(!T)try{E(B),T=c(I,1)}catch{}}),T};return xl=function(B){if(!B||typeof B!="object")return!1;if(!i){var T=c(s(B),8,-1);return g(l,T)>-1?T:T!=="Object"?!1:_(B)}return o?h(B):null},xl}var Pl={},AT=!1;function Sk(){if(AT)return Pl;AT=!0;var t=MT();return Pl=function(n){return!!t(n)},Pl}var he={},CT=!1;function kk(){if(CT)return he;CT=!0;var t=_k(),e=bk(),n=MT(),r=Sk();function o(U){return U.call.bind(U)}var s=typeof BigInt<"u",i=typeof Symbol<"u",a=o(Object.prototype.toString),l=o(Number.prototype.valueOf),c=o(String.prototype.valueOf),f=o(Boolean.prototype.valueOf);if(s)var g=o(BigInt.prototype.valueOf);if(i)var p=o(Symbol.prototype.valueOf);function h(U,kt){if(typeof U!="object")return!1;try{return kt(U),!0}catch{return!1}}he.isArgumentsObject=t,he.isGeneratorFunction=e,he.isTypedArray=r;function _(U){return typeof Promise<"u"&&U instanceof Promise||U!==null&&typeof U=="object"&&typeof U.then=="function"&&typeof U.catch=="function"}he.isPromise=_;function P(U){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(U):r(U)||N(U)}he.isArrayBufferView=P;function B(U){return n(U)==="Uint8Array"}he.isUint8Array=B;function T(U){return n(U)==="Uint8ClampedArray"}he.isUint8ClampedArray=T;function E(U){return n(U)==="Uint16Array"}he.isUint16Array=E;function I(U){return n(U)==="Uint32Array"}he.isUint32Array=I;function D(U){return n(U)==="Int8Array"}he.isInt8Array=D;function $(U){return n(U)==="Int16Array"}he.isInt16Array=$;function ee(U){return n(U)==="Int32Array"}he.isInt32Array=ee;function Y(U){return n(U)==="Float32Array"}he.isFloat32Array=Y;function ce(U){return n(U)==="Float64Array"}he.isFloat64Array=ce;function re(U){return n(U)==="BigInt64Array"}he.isBigInt64Array=re;function Q(U){return n(U)==="BigUint64Array"}he.isBigUint64Array=Q;function Ie(U){return a(U)==="[object Map]"}Ie.working=typeof Map<"u"&&Ie(new Map);function Le(U){return typeof Map>"u"?!1:Ie.working?Ie(U):U instanceof Map}he.isMap=Le;function Xe(U){return a(U)==="[object Set]"}Xe.working=typeof Set<"u"&&Xe(new Set);function Fe(U){return typeof Set>"u"?!1:Xe.working?Xe(U):U instanceof Set}he.isSet=Fe;function ze(U){return a(U)==="[object WeakMap]"}ze.working=typeof WeakMap<"u"&&ze(new WeakMap);function pt(U){return typeof WeakMap>"u"?!1:ze.working?ze(U):U instanceof WeakMap}he.isWeakMap=pt;function Re(U){return a(U)==="[object WeakSet]"}Re.working=typeof WeakSet<"u"&&Re(new WeakSet);function ve(U){return Re(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 K(U){return a(U)==="[object SharedArrayBuffer]"}function le(U){return typeof Z>"u"?!1:(typeof K.working>"u"&&(K.working=K(new Z)),K.working?K(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 te(U){return h(U,l)}he.isNumberObject=te;function b(U){return h(U,c)}he.isStringObject=b;function x(U){return h(U,f)}he.isBooleanObject=x;function F(U){return s&&h(U,g)}he.isBigIntObject=F;function J(U){return i&&h(U,p)}he.isSymbolObject=J;function Se(U){return te(U)||b(U)||x(U)||F(U)||J(U)}he.isBoxedPrimitive=Se;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 Bl={},OT=!1;function Ak(){return OT||(OT=!0,Bl=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"}),Bl}var Te={},RT=!1,si=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function Ck(){if(RT)return Te;RT=!0;var t=Rt,e=Object.getOwnPropertyDescriptors||function(Z){for(var K=Object.keys(Z),le={},ge=0;ge<K.length;ge++)le[K[ge]]=Object.getOwnPropertyDescriptor(Z,K[ge]);return le},n=/%[sdj%]/g;Te.format=function(N){if(!$(N)){for(var Z=[],K=0;K<arguments.length;K++)Z.push(i(arguments[K]));return Z.join(" ")}for(var K=1,le=arguments,ge=le.length,R=String(N).replace(n,function(j){if(j==="%%")return"%";if(K>=ge)return j;switch(j){case"%s":return String(le[K++]);case"%d":return Number(le[K++]);case"%j":try{return JSON.stringify(le[K++])}catch{return"[Circular]"}default:return j}}),C=le[K];K<ge;C=le[++K])E(C)||!re(C)?R+=" "+C:R+=" "+i(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||si,arguments)};var K=!1;function le(){if(!K){if(t.throwDeprecation)throw new Error(Z);t.traceDeprecation?console.trace(Z):console.error(Z),K=!0}return N.apply(this||si,arguments)}return le};var r={},o=/^$/;if(t.env.NODE_DEBUG){var s=t.env.NODE_DEBUG;s=s.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),o=new RegExp("^"+s+"$","i")}Te.debuglog=function(N){if(N=N.toUpperCase(),!r[N])if(o.test(N)){var Z=t.pid;r[N]=function(){var K=Te.format.apply(Te,arguments);console.error("%s %d: %s",N,Z,K)}}else r[N]=function(){};return r[N]};function i(N,Z){var K={seen:[],stylize:l};return arguments.length>=3&&(K.depth=arguments[2]),arguments.length>=4&&(K.colors=arguments[3]),T(Z)?K.showHidden=Z:Z&&Te._extend(K,Z),Y(K.showHidden)&&(K.showHidden=!1),Y(K.depth)&&(K.depth=2),Y(K.colors)&&(K.colors=!1),Y(K.customInspect)&&(K.customInspect=!0),K.colors&&(K.stylize=a),f(K,N,K.depth)}Te.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function a(N,Z){var K=i.styles[Z];return K?"\x1B["+i.colors[K][0]+"m"+N+"\x1B["+i.colors[K][1]+"m":N}function l(N,Z){return N}function c(N){var Z={};return N.forEach(function(K,le){Z[K]=!0}),Z}function f(N,Z,K){if(N.customInspect&&Z&&Le(Z.inspect)&&Z.inspect!==Te.inspect&&!(Z.constructor&&Z.constructor.prototype===Z)){var le=Z.inspect(K,N);return $(le)||(le=f(N,le,K)),le}var ge=g(N,Z);if(ge)return ge;var R=Object.keys(Z),C=c(R);if(N.showHidden&&(R=Object.getOwnPropertyNames(Z)),Ie(Z)&&(R.indexOf("message")>=0||R.indexOf("description")>=0))return p(Z);if(R.length===0){if(Le(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(Q(Z))return N.stylize(Date.prototype.toString.call(Z),"date");if(Ie(Z))return p(Z)}var V="",te=!1,b=["{","}"];if(B(Z)&&(te=!0,b=["[","]"]),Le(Z)){var x=Z.name?": "+Z.name:"";V=" [Function"+x+"]"}if(ce(Z)&&(V=" "+RegExp.prototype.toString.call(Z)),Q(Z)&&(V=" "+Date.prototype.toUTCString.call(Z)),Ie(Z)&&(V=" "+p(Z)),R.length===0&&(!te||Z.length==0))return b[0]+V+b[1];if(K<0)return ce(Z)?N.stylize(RegExp.prototype.toString.call(Z),"regexp"):N.stylize("[Object]","special");N.seen.push(Z);var F;return te?F=h(N,Z,K,C,R):F=R.map(function(J){return _(N,Z,K,C,J,te)}),N.seen.pop(),P(F,V,b)}function g(N,Z){if(Y(Z))return N.stylize("undefined","undefined");if($(Z)){var K="'"+JSON.stringify(Z).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return N.stylize(K,"string")}if(D(Z))return N.stylize(""+Z,"number");if(T(Z))return N.stylize(""+Z,"boolean");if(E(Z))return N.stylize("null","null")}function p(N){return"["+Error.prototype.toString.call(N)+"]"}function h(N,Z,K,le,ge){for(var R=[],C=0,j=Z.length;C<j;++C)ve(Z,String(C))?R.push(_(N,Z,K,le,String(C),!0)):R.push("");return ge.forEach(function(V){V.match(/^\d+$/)||R.push(_(N,Z,K,le,V,!0))}),R}function _(N,Z,K,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(K)?j=f(N,V.value,null):j=f(N,V.value,K-1),j.indexOf(`
|
|
80
|
+
(${_}) => ${P}`;case"ZodLazy":return xe(i._def.getter(),o);case"ZodLiteral":let T=xm(i._def.value);return`${Qe(i.description)}
|
|
81
|
+
${T}`.trim();case"ZodEnum":return i._def.values.map(ie).join(" | ");case"ZodEffects":return xe(i._def.schema,o);case"ZodNativeEnum":throw new Wg("ZodNativeEnum");case"ZodOptional":return`${xe(i._def.innerType,o)} | undefined`;case"ZodNullable":return`${xe(i._def.innerType,o)} | null`;case"ZodDefault":let I=e.treatDefaultAsOptional?i._def.innerType.optional():i._def.innerType;return xe(I,o);case"ZodCatch":return xe(i._def.innerType,o);case"ZodPromise":return`Promise<${xe(i._def.type,o)}>`;case"ZodBranded":return xe(i._def.type,o);case"ZodPipeline":return xe(i._def.in,o);case"ZodSymbol":return`${Qe(i.description)} symbol`.trim();case"ZodReadonly":return`Readonly<${xe(i._def.innerType,o)}>`;case"ZodRef":return Bm(i._def.uri);default:Ct.assertNever(i)}}m(xe,"sUnwrapZod");var mB=m((t,e)=>{if(t.props.type==="none")return xe(t.props.schema,e);let{schema:n,identifier:r}=t.props,s=Qe(n.description),o=n.describe(""),i=xe(o,M(w({},e),{declaration:!0})),l=i.split(`
|
|
82
|
+
`).length>=fB&&e.includeClosingTags?`// end of ${r}`:"";if(t.props.type!=="type"&&n.typeName==="ZodFunction")return Fs(`${s}
|
|
83
|
+
declare function ${r}${i};${l}`);if(t.props.type==="variable")return Fs(`${s}declare const ${r}: ${i};${l}`);let c=t.props.args.length>0?`<${t.props.args.map(Bm).join(", ")}>`:"";return Fs(`${s}type ${t.props.identifier}${c} = ${i};${l}`)},"unwrapDeclaration"),yB=m(t=>t.declaration?t.declaration===!0?"variable":t.declaration:"none","getDeclarationType"),hB=m((t,e)=>{let n=yB(e),r=t.getReferences();if(n==="none"){if(r.length>0)throw new to;return new Ur({type:"none",schema:t})}let s="title"in t.ui?t.ui.title:null;if(!s)throw new zg;if(n==="variable"){if(r.length>0)throw new to;return new Ur({type:"variable",identifier:s,schema:t})}return new Ur({type:"type",identifier:s,schema:t,args:r})},"getDeclarationProps"),TB=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"),vB=m(t=>{let e=t.checks;return e.length===0?"":e.map(_B).join("")},"generateBigIntChecks"),_B=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"),bB=m(t=>{let e=t.checks;return e.length===0?"":e.map(wB).join("")},"generateDateChecks"),wB=m(t=>{switch(t.kind){case"min":return`.min(${Lc(t.value)}, ${ie(t.message)})`;case"max":return`.max(${Lc(t.value)}, ${ie(t.message)})`;default:return""}},"_generateDateCheck"),Lc=m(t=>`new Date(${t})`,"dateTs"),xB=m(t=>{let e=t.checks;return e.length===0?"":e.map(PB).join("")},"generateNumberChecks"),PB=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"),BB=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"),IB=m(t=>{let e=t.checks;return e.length===0?"":e.map(EB).join("")},"generateStringChecks"),EB=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=tr({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(${tr({message:t.message,precision:r,offset:t.offset})})`;case"ip":return`.ip(${tr({message:t.message,version:t.version})})`;default:return""}},"_generateStringCheck"),{zuiKey:mt}=en;function Fo(t){return $e(t)}m(Fo,"toTypescriptSchema");function $e(t){let e=t;switch(e.typeName){case"ZodString":return`z.string()${IB(e._def)}${Be(e._def)}`.trim();case"ZodNumber":return`z.number()${xB(e._def)}${Be(e._def)}`.trim();case"ZodNaN":return`z.nan()${Be(e._def)}`.trim();case"ZodBigInt":return`z.bigint()${vB(e._def)}${Be(e._def)}`.trim();case"ZodBoolean":return`z.boolean()${Be(e._def)}`.trim();case"ZodDate":return`z.date()${bB(e._def)}${Be(e._def)}`.trim();case"ZodUndefined":return`z.undefined()${Be(e._def)}`.trim();case"ZodNull":return`z.null()${Be(e._def)}`.trim();case"ZodAny":return`z.any()${Be(e._def)}`.trim();case"ZodUnknown":return`z.unknown()${Be(e._def)}`.trim();case"ZodNever":return`z.never()${Be(e._def)}`.trim();case"ZodVoid":return`z.void()${Be(e._def)}`.trim();case"ZodArray":return`z.array(${$e(e._def.type)})${TB(e._def)}${Be(e._def,e._def.type)}`;case"ZodObject":let n=Xw(e.shape,$e),r=e.additionalProperties(),s=r?`.catchall(${$e(r)})`:"";return["z.object({",...Object.entries(n).map(([ee,Y])=>` ${ee}: ${Y},`),`})${s}${Be(e._def)}`].join(`
|
|
84
|
+
`).trim();case"ZodUnion":return`z.union([${e._def.options.map($e).join(", ")}])${Be(e._def)}`.trim();case"ZodDiscriminatedUnion":let i=e._def.options.map($e);return`z.discriminatedUnion(${ie(e._def.discriminator)}, [${i.join(", ")}])${Be(e._def)}`.trim();case"ZodIntersection":let l=$e(e._def.left),c=$e(e._def.right);return`z.intersection(${l}, ${c})${Be(e._def)}`.trim();case"ZodTuple":return`z.tuple([${e._def.items.map($e).join(", ")}])${Be(e._def)}`.trim();case"ZodRecord":let g=$e(e._def.keyType),p=$e(e._def.valueType);return`z.record(${g}, ${p})${Be(e._def)}`.trim();case"ZodMap":let h=$e(e._def.keyType),_=$e(e._def.valueType);return`z.map(${h}, ${_})${Be(e._def)}`.trim();case"ZodSet":return`z.set(${$e(e._def.valueType)})${BB(e._def)}${Be(e._def)}`.trim();case"ZodFunction":let P=e._def.args.items.map($e),B=P.length?`.args(${P.join(", ")})`:"",T=$e(e._def.returns);return`z.function()${B}.returns(${T})${Be(e._def)}`.trim();case"ZodLazy":return`z.lazy(() => ${$e(e._def.getter())})${Be(e._def)}`.trim();case"ZodLiteral":return`z.literal(${ie(e._def.value)})${Be(e._def)}`.trim();case"ZodEnum":return`z.enum([${e._def.values.map(ie).join(", ")}])${Be(e._def)}`.trim();case"ZodEffects":throw new Sn("ZodEffects");case"ZodNativeEnum":throw new Sn("ZodNativeEnum");case"ZodOptional":return`z.optional(${$e(e._def.innerType)})${Be(e._def,e._def.innerType)}`.trim();case"ZodNullable":return`z.nullable(${$e(e._def.innerType)})${Be(e._def,e._def.innerType)}`.trim();case"ZodDefault":let D=tr(e._def.defaultValue());return`z.default(${$e(e._def.innerType)}, ${D})${Be(e._def,e._def.innerType)}`.trim();case"ZodCatch":throw new Sn("ZodCatch");case"ZodPromise":return`z.promise(${$e(e._def.type)})${Be(e._def,e._def.type)}`.trim();case"ZodBranded":throw new Sn("ZodBranded");case"ZodPipeline":throw new Sn("ZodPipeline");case"ZodSymbol":throw new Sn("ZodSymbol");case"ZodReadonly":return`z.readonly(${$e(e._def.innerType)})${Be(e._def,e._def.innerType)}`.trim();case"ZodRef":return`z.ref(${ie(e._def.uri)})${Be(e._def)}`.trim();default:Ct.assertNever(e)}}m($e,"sUnwrapZod");var Be=m((t,e)=>{let n=e?._def;return`${kB(t,n)}${SB(t,n)}`},"_addMetadata"),SB=m((t,e)=>!t.description||e&&e.description===t.description?"":`.describe(${ie(t.description)})`,"_maybeDescribe"),kB=m((t,e)=>`${AB(t,e)}${CB(t,e)}${OB(t,e)}${RB(t,e)}${MB(t,e)}${NB(t,e)}${DB(t,e)}`,"_addZuiExtensions"),AB=m((t,e)=>{var n,r;let s=(n=t[mt])==null?void 0:n.title;return!s||e&&((r=e[mt])==null?void 0:r.title)===s?"":`.title(${ie(s)})`},"_maybeTitle"),CB=m((t,e)=>{var n,r;let s=(n=t[mt])==null?void 0:n.displayAs;return!s||e&&gn((r=e[mt])==null?void 0:r.displayAs,s)?"":`.displayAs(${Pm({id:s[0],params:s[1]})})`},"_maybeDisplayAs"),OB=m((t,e)=>{var n,r;let s=(n=t[mt])==null?void 0:n.disabled;return!s||e&&((r=e[mt])==null?void 0:r.disabled)===s?"":`.disabled(${s})`},"_maybeDisabled"),RB=m((t,e)=>{var n,r;let s=(n=t[mt])==null?void 0:n.hidden;return!s||e&&((r=e[mt])==null?void 0:r.hidden)===s?"":`.hidden(${s})`},"_maybeHidden"),MB=m((t,e)=>{var n,r;let s=(n=t[mt])==null?void 0:n.placeholder;return!s||e&&((r=e[mt])==null?void 0:r.placeholder)===s?"":`.placeholder(${ie(s)})`},"_maybePlaceholder"),NB=m((t,e)=>{var n,r;let s=(n=t[mt])==null?void 0:n.secret;return!s||e&&((r=e[mt])==null?void 0:r.secret)===s?"":".secret()"},"_maybeSecret"),DB=m((t,e)=>{var n,r;let s=["title","tooltip","displayAs","disabled","hidden","placeholder","secret","coerce"],o=Object.entries((n=t[mt])!=null?n:{}).filter(([i])=>!s.includes(i));if(o.length===0)return"";if(e){let i=Object.entries((r=e[mt])!=null?r:{}).filter(([a])=>!s.includes(a));if(gn(Object.fromEntries(o),Object.fromEntries(i)))return""}return`.metadata(${Pm(Object.fromEntries(o))})`},"_maybeSetMetadata"),HB={};pe.prototype.toJSONSchema=function(){return st(this)};pe.prototype.toTypescriptType=function(t){return Wo(this,t)};pe.prototype.toTypescriptSchema=function(){return Fo(this)};var nt=ne.string().min(1),Rm=ne.object({text:nt}),Mm=ne.object({markdown:nt}),Nm=ne.object({imageUrl:nt,title:nt.optional()}),Dm=ne.object({audioUrl:nt,title:nt.optional()}),Hm=ne.object({videoUrl:nt,title:nt.optional()}),Um=ne.object({fileUrl:nt,title:nt.optional()}),jm=ne.object({latitude:ne.number(),longitude:ne.number(),address:ne.string().optional(),title:ne.string().optional()}),$m=ne.object({title:nt,subtitle:nt.optional(),imageUrl:nt.optional(),actions:ne.array(ne.object({action:ne.enum(["postback","url","say"]),label:nt,value:nt}))}),Om=ne.object({text:nt,options:ne.array(ne.object({label:nt,value:nt}))}),UB=ne.object({items:ne.array($m)}),Zm=ne.union([ne.object({type:ne.literal("text"),payload:Rm}),ne.object({type:ne.literal("image"),payload:Nm}),ne.object({type:ne.literal("audio"),payload:Dm}),ne.object({type:ne.literal("video"),payload:Hm}),ne.object({type:ne.literal("file"),payload:Um}),ne.object({type:ne.literal("location"),payload:jm})]),jB=ne.object({items:ne.array(Zm)}),$B={schema:Mm},ZB={schema:ne.object({items:ne.array(ne.union([...Zm.options,ne.object({type:ne.literal("markdown"),payload:Mm})]))})},LB={text:{schema:Rm},image:{schema:Nm},audio:{schema:Dm},video:{schema:Hm},file:{schema:Um},location:{schema:jm},carousel:{schema:UB},card:{schema:$m},dropdown:{schema:Om},choice:{schema:Om},bloc:{schema:jB}};S();A();k();var uC={HIDDEN_IN_STUDIO:{bpActionHiddenInStudio:"true"},AWAIT_RETURN:{bpActionAwaitReturn:"true"}};S();A();k();import{isNode as KS}from"browser-or-node";S();A();k();var zo=console;function Mt(t){if(!t.body)throw new Error("Missing body");return JSON.parse(t.body)}async function _s(t,e=8072,n=qS){if(!KS)throw new Error("This function can only be called in Node.js");let s=($h(),VT(jh)).createServer(async(o,i)=>{try{let a=await WS(o);if(a.path==="/health"){i.writeHead(200).end("ok");return}let l=await t(a);i.writeHead(l?.status??200,l?.headers??{}).end(l?.body??"{}")}catch(a){let l=a instanceof Error?a.message:String(a);zo.error("Error while handling request",{error:l??"Internal error occured"}),i.writeHead(500).end(JSON.stringify({error:l??"Internal error occured"}))}});return s.listen(e,()=>n(e)),s}async function WS(t){let e=await zS(t),n={};for(let s=0;s<t.rawHeaders.length;s+=2){let o=t.rawHeaders[s].toLowerCase(),i=t.rawHeaders[s+1];n[o]=i}let r=new URL(t.url??"",t.headers.host?`http://${t.headers.host}`:"http://botpress.cloud");return{body:e,path:r.pathname,query:FS(r.search,"?"),headers:n,method:t.method?.toUpperCase()??"GET"}}function FS(t,e){return t.indexOf(e)===0?t.slice(e.length):t}async function zS(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",s=>r+=s.toString()),t.on("error",s=>n(s)),t.on("end",()=>e(r))})}function qS(t){zo.info(`Listening on port ${t}`)}import{isApiError as Oj,RuntimeError as Rj}from"@botpress/client";S();A();k();S();A();k();S();A();k();S();A();k();var je={};bn(je,{mapKeys:()=>JS,mapValues:()=>VS,mergeRecords:()=>XS,pairs:()=>bs,stripUndefinedProps:()=>YS,values:()=>GS});S();A();k();var bs=t=>Object.entries(t),GS=t=>Object.values(t),VS=(t,e)=>Object.fromEntries(bs(t).map(([n,r])=>[n,e(r,n)])),JS=(t,e)=>Object.fromEntries(bs(t).map(([n,r])=>[e(n),r])),YS=t=>Object.fromEntries(bs(t).filter(([,e])=>e!==void 0)),XS=(t,e,n)=>{let r=[...Object.keys(t),...Object.keys(e)],s=[...new Set(r)],o={};for(let i of s){let a=t[i],l=e[i];a&&l?o[i]=n(a,l):a?o[i]=a:l&&(o[i]=l)}return o};var ue={};bn(ue,{safePush:()=>QS,unique:()=>ek});S();A();k();var QS=(t,...e)=>t?[...t,...e]:[...e],ek=t=>Array.from(new Set(t));S();A();k();var ut={};bn(ut,{setName:()=>tk});S();A();k();var tk=(t,e)=>(Object.defineProperty(t,"name",{value:e}),t);var Zh=t=>{let{name:e,version:n}=t,r={actions:{},events:{},channels:{}},s={name:e,version:n,entities:je.mapValues(t.entities,i=>({name:i.name})),actions:{},events:{},channels:{}},o=je.mapValues(t.entities,i=>i.schema);for(let[i,a]of Object.entries(t.definition.actions??{})){let l=a.input.schema.dereference(o),c=a.output.schema.dereference(o),f=t.actions?.[i]?.name??i;r.actions[f]={...a,...t.actions?.[i]??{},input:{schema:l},output:{schema:c}},s.actions[i]={name:f}}for(let[i,a]of Object.entries(t.definition.events??{})){let l=a.schema.dereference(o),c=t.events?.[i]?.name??i;r.events[c]={...a,...t.events?.[i]??{},schema:l},s.events[i]={name:c}}for(let[i,a]of Object.entries(t.definition.channels??{})){let l={};for(let[f,g]of Object.entries(a.messages)){let p=g.schema.dereference(o);l[f]={...g,schema:p}}let c=t.channels?.[i]?.name??i;r.channels[c]={...a,...t.channels?.[i]??{},message:{...a.message??{},tags:{...a.message?.tags??{},...t.channels?.[i]?.message?.tags??{}}},conversation:{...a.conversation??{},tags:{...a.conversation?.tags??{},...t.channels?.[i]?.conversation?.tags??{}}},messages:l},s.channels[i]={name:c}}return{resolved:r,statement:s}};S();A();k();var Lh="6.2.0";var _n=Lh;S();A();k();var ws=Symbol("schemaName"),Kh=t=>t?je.mapValues(t,(n,r)=>({...n,[ws]:r})):{},Wh=t=>ws in t&&t[ws]!==void 0,Fh=t=>t[ws];S();A();k();var Ka=class{constructor(e){this.props=e;this.name=e.name,this.version=e.version,this.icon=e.icon,this.readme=e.readme,this.title=e.title,this.identifier=e.identifier,this.description=e.description,this.configuration=e.configuration,this.configurations=e.configurations,this.events=e.events,this.actions=e.actions,this.channels=e.channels,this.states=e.states,this.user=e.user,this.secrets=e.secrets,this.entities=e.entities,this.interfaces=e.interfaces,this.__advanced=e.__advanced,this.attributes=e.attributes}name;version;title;description;icon;readme;configuration;configurations;events;actions;channels;states;user;secrets;identifier;entities;interfaces;__advanced;attributes;get metadata(){return{sdkVersion:_n}}extend(e,n){let{entities:r,actions:s,events:o,channels:i}=this._callBuilder(e,n),a=this;a.interfaces??={};let l=Object.values(r).map(p=>p.name),c=l.length===0?e.name:`${e.name}<${l.join(",")}>`,{resolved:f,statement:g}=Zh({...e,entities:r,actions:je.stripUndefinedProps(s),events:je.stripUndefinedProps(o),channels:je.stripUndefinedProps(i)});return a.actions=je.mergeRecords(a.actions??{},f.actions,this._mergeActions),a.channels=je.mergeRecords(a.channels??{},f.channels,this._mergeChannels),a.events=je.mergeRecords(a.events??{},f.events,this._mergeEvents),a.interfaces[c]={id:e.id,...g},this}_callBuilder(e,n){let s={entities:Kh(this.entities)},o=n(s),i=je.pairs(o.entities).find(([l,c])=>!Wh(c));if(i)throw new Error(`Cannot extend interface "${e.name}" with entity "${i[0]}"; the provided schema is not part of the integration's entities.`);return{entities:je.mapValues(o.entities,l=>({name:Fh(l),schema:l.schema})),actions:o.actions??{},events:o.events??{},channels:o.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=je.mergeRecords(e.messages,n.messages,this._mergeMessage),s;(e.conversation||n.conversation)&&(s={tags:{...e.conversation?.tags,...n.conversation?.tags}});let o;return(e.message||n.message)&&(o={tags:{...e.message?.tags,...n.message?.tags}}),{...e,...n,messages:r,conversation:s,message:o}};_mergeMessage=(e,n)=>({schema:this._mergeObjectSchemas(e.schema,n.schema)});_mergeObjectSchemas=(e,n)=>{let r=e._def,s=n._def;if(r.typeName==="ZodObject"&&s.typeName==="ZodObject"){let o=r.shape(),i=s.shape();return ne.object({...o,...i})}if(r.typeName==="ZodRecord"&&s.typeName==="ZodRecord")return ne.record(ne.intersection(r.valueType,s.valueType));throw new Error("Cannot merge object schemas with record schemas")}};S();A();k();S();A();k();import{isApiError as Ok,Client as Rk,RuntimeError as NT,InvalidPayloadError as Mk}from"@botpress/client";S();A();k();import*as zh from"@botpress/client";var xs={retries:3,retryCondition:t=>zh.axiosRetry.isNetworkOrIdempotentRequestError(t)||[429,502].includes(t.response?.status??0),retryDelay:(t,e)=>(rk(e.response?.headers??{})??t)*1e3},rk=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 ik(String(r))}},ik=t=>{let e=sk(t)?ok(t):t.length>0?parseInt(t,10):void 0;return e===void 0||isNaN(e)?void 0:e},sk=t=>t.includes(" "),ok=t=>{let e=ak(t);if(!e)return;let n=new Date;return Math.max(0,Math.floor((e.getTime()-n.getTime())/1e3))},ak=t=>{let e=new Date(t);return isNaN(e.getTime())?void 0:e};S();A();k();S();A();k();var ri=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 Ps=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 Nt="#",Bs="x-bot-id",qh="x-bot-user-id",Gh="x-integration-id",Vh="x-integration-alias",Jh="x-webhook-id",Yh="x-bp-configuration-type",Is="x-bp-configuration",Es="x-bp-operation",Xh="x-bp-type";S();A();k();var It=t=>{throw t instanceof Error?t:new Error(t)};var GR=ne.enum(["webhook_received","message_created","action_triggered","register","unregister","ping","create_user","create_conversation"]),Qh=t=>({botId:t[Bs]||It("Missing bot header"),botUserId:t[qh]||It("Missing bot user header"),integrationId:t[Gh]||It("Missing integration header"),integrationAlias:t[Vh]||It("Missing integration alias header"),webhookId:t[Jh]||It("Missing webhook header"),operation:t[Es]||It("Missing operation header"),configurationType:t[Yh]??null,configuration:JSON.parse(z.from(t[Is]||It("Missing configuration header"),"base64").toString("utf-8"))});S();A();k();S();A();k();S();A();k();S();A();k();var Fa={},eT=!1;function dl(){return eT||(eT=!0,Fa=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 s=42;e[n]=s;for(n in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==n||!Object.prototype.propertyIsEnumerable.call(e,n))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var i=Object.getOwnPropertyDescriptor(e,n);if(i.value!==s||i.enumerable!==!0)return!1}return!0}),Fa}var za={},tT=!1;function lk(){return tT||(tT=!0,za=Error),za}var qa={},nT=!1;function uk(){return nT||(nT=!0,qa=EvalError),qa}var Ga={},rT=!1;function ck(){return rT||(rT=!0,Ga=RangeError),Ga}var Va={},iT=!1;function dk(){return iT||(iT=!0,Va=ReferenceError),Va}var Ja={},sT=!1;function bT(){return sT||(sT=!0,Ja=SyntaxError),Ja}var Ya={},oT=!1;function Ss(){return oT||(oT=!0,Ya=TypeError),Ya}var Xa={},aT=!1;function fk(){return aT||(aT=!0,Xa=URIError),Xa}var Qa={},lT=!1;function pk(){if(lT)return Qa;lT=!0;var t=typeof Symbol<"u"&&Symbol,e=dl();return Qa=function(){return typeof t!="function"||typeof Symbol!="function"||typeof t("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},Qa}var el={},uT=!1;function gk(){if(uT)return el;uT=!0;var t={__proto__:null,foo:{}},e=Object;return el=function(){return{__proto__:t}.foo===t.foo&&!(t instanceof e)},el}var tl={},cT=!1;function mk(){if(cT)return tl;cT=!0;var t="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,n=Math.max,r="[object Function]",s=function(l,c){for(var f=[],g=0;g<l.length;g+=1)f[g]=l[g];for(var p=0;p<c.length;p+=1)f[p+l.length]=c[p];return f},o=function(l,c){for(var f=[],g=c,p=0;g<l.length;g+=1,p+=1)f[p]=l[g];return f},i=function(a,l){for(var c="",f=0;f<a.length;f+=1)c+=a[f],f+1<a.length&&(c+=l);return c};return tl=function(l){var c=this;if(typeof c!="function"||e.apply(c)!==r)throw new TypeError(t+c);for(var f=o(arguments,1),g,p=function(){if(this instanceof g){var T=c.apply(this,s(f,arguments));return Object(T)===T?T:this}return c.apply(l,s(f,arguments))},h=n(0,c.length-f.length),_=[],P=0;P<h;P++)_[P]="$"+P;if(g=Function("binder","return function ("+i(_,",")+"){ return binder.apply(this,arguments); }")(p),c.prototype){var B=function(){};B.prototype=c.prototype,g.prototype=new B,B.prototype=null}return g},tl}var nl={},dT=!1;function fl(){if(dT)return nl;dT=!0;var t=mk();return nl=Function.prototype.bind||t,nl}var rl={},fT=!1;function yk(){if(fT)return rl;fT=!0;var t=Function.prototype.call,e=Object.prototype.hasOwnProperty,n=fl();return rl=n.call(t,e),rl}var il={},pT=!1;function si(){if(pT)return il;pT=!0;var t,e=lk(),n=uk(),r=ck(),s=dk(),o=bT(),i=Ss(),a=fk(),l=Function,c=function(Re){try{return l('"use strict"; return ('+Re+").constructor;")()}catch{}},f=Object.getOwnPropertyDescriptor;if(f)try{f({},"")}catch{f=null}var g=function(){throw new i},p=f?(function(){try{return arguments.callee,g}catch{try{return f(arguments,"callee").get}catch{return g}}})():g,h=pk()(),_=gk()(),P=Object.getPrototypeOf||(_?function(Re){return Re.__proto__}:null),B={},T=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%":h&&P?P([][Symbol.iterator]()):t,"%AsyncFromSyncIteratorPrototype%":t,"%AsyncFunction%":B,"%AsyncGenerator%":B,"%AsyncGeneratorFunction%":B,"%AsyncIteratorPrototype%":B,"%Atomics%":typeof Atomics>"u"?t:Atomics,"%BigInt%":typeof BigInt>"u"?t:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?t:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?t:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?t:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":e,"%eval%":eval,"%EvalError%":n,"%Float32Array%":typeof Float32Array>"u"?t:Float32Array,"%Float64Array%":typeof Float64Array>"u"?t:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?t:FinalizationRegistry,"%Function%":l,"%GeneratorFunction%":B,"%Int8Array%":typeof Int8Array>"u"?t:Int8Array,"%Int16Array%":typeof Int16Array>"u"?t:Int16Array,"%Int32Array%":typeof Int32Array>"u"?t:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":h&&P?P(P([][Symbol.iterator]())):t,"%JSON%":typeof JSON=="object"?JSON:t,"%Map%":typeof Map>"u"?t:Map,"%MapIteratorPrototype%":typeof Map>"u"||!h||!P?t:P(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?t:Promise,"%Proxy%":typeof Proxy>"u"?t:Proxy,"%RangeError%":r,"%ReferenceError%":s,"%Reflect%":typeof Reflect>"u"?t:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?t:Set,"%SetIteratorPrototype%":typeof Set>"u"||!h||!P?t:P(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?t:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":h&&P?P(""[Symbol.iterator]()):t,"%Symbol%":h?Symbol:t,"%SyntaxError%":o,"%ThrowTypeError%":p,"%TypedArray%":T,"%TypeError%":i,"%Uint8Array%":typeof Uint8Array>"u"?t:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?t:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?t:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?t:Uint32Array,"%URIError%":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(Re){var I=P(P(Re));E["%Error.prototype%"]=I}var D=function Re(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 oe=Re("%AsyncGeneratorFunction%");oe&&(we=oe.prototype)}else if(ve==="%AsyncIteratorPrototype%"){var de=Re("%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"]},ee=fl(),Y=yk(),ce=ee.call(Function.call,Array.prototype.concat),re=ee.call(Function.apply,Array.prototype.splice),Q=ee.call(Function.call,String.prototype.replace),Ie=ee.call(Function.call,String.prototype.slice),Le=ee.call(Function.call,RegExp.prototype.exec),Xe=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Fe=/\\(\\)?/g,ze=function(ve){var we=Ie(ve,0,1),oe=Ie(ve,-1);if(we==="%"&&oe!=="%")throw new o("invalid intrinsic syntax, expected closing `%`");if(oe==="%"&&we!=="%")throw new o("invalid intrinsic syntax, expected opening `%`");var de=[];return Q(ve,Xe,function(N,Z,K,le){de[de.length]=K?Q(le,Fe,"$1"):Z||N}),de},pt=function(ve,we){var oe=ve,de;if(Y($,oe)&&(de=$[oe],oe="%"+de[0]+"%"),Y(E,oe)){var N=E[oe];if(N===B&&(N=D(oe)),typeof N>"u"&&!we)throw new i("intrinsic "+ve+" exists, but is not available. Please file an issue!");return{alias:de,name:oe,value:N}}throw new o("intrinsic "+ve+" does not exist!")};return il=function(ve,we){if(typeof ve!="string"||ve.length===0)throw new i("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof we!="boolean")throw new i('"allowMissing" argument must be a boolean');if(Le(/^%?[^%]*%?$/,ve)===null)throw new o("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var oe=ze(ve),de=oe.length>0?oe[0]:"",N=pt("%"+de+"%",we),Z=N.name,K=N.value,le=!1,ge=N.alias;ge&&(de=ge[0],re(oe,ce([0,1],ge)));for(var R=1,C=!0;R<oe.length;R+=1){var j=oe[R],V=Ie(j,0,1),te=Ie(j,-1);if((V==='"'||V==="'"||V==="`"||te==='"'||te==="'"||te==="`")&&V!==te)throw new o("property names with quotes must have matching quotes");if((j==="constructor"||!C)&&(le=!0),de+="."+j,Z="%"+de+"%",Y(E,Z))K=E[Z];else if(K!=null){if(!(j in K)){if(!we)throw new i("base intrinsic for "+ve+" exists, but the property is not available.");return}if(f&&R+1>=oe.length){var b=f(K,j);C=!!b,C&&"get"in b&&!("originalValue"in b.get)?K=b.get:K=K[j]}else C=Y(K,j),K=K[j];C&&!le&&(E[Z]=K)}}return K},il}var sl={},gT=!1;function pl(){if(gT)return sl;gT=!0;var t=si(),e=t("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return sl=e,sl}var ol={},mT=!1;function ks(){if(mT)return ol;mT=!0;var t=si(),e=t("%Object.getOwnPropertyDescriptor%",!0);if(e)try{e([],"length")}catch{e=null}return ol=e,ol}var al={},yT=!1;function hk(){if(yT)return al;yT=!0;var t=pl(),e=bT(),n=Ss(),r=ks();return al=function(o,i,a){if(!o||typeof o!="object"&&typeof o!="function")throw new n("`obj` must be an object or a function`");if(typeof i!="string"&&typeof i!="symbol")throw new n("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new n("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new n("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new n("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new n("`loose`, if provided, must be a boolean");var l=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,f=arguments.length>5?arguments[5]:null,g=arguments.length>6?arguments[6]:!1,p=!!r&&r(o,i);if(t)t(o,i,{configurable:f===null&&p?p.configurable:!f,enumerable:l===null&&p?p.enumerable:!l,value:a,writable:c===null&&p?p.writable:!c});else if(g||!l&&!c&&!f)o[i]=a;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},al}var ll={},hT=!1;function Tk(){if(hT)return ll;hT=!0;var t=pl(),e=function(){return!!t};return e.hasArrayLengthDefineBug=function(){if(!t)return null;try{return t([],"length",{value:1}).length!==1}catch{return!0}},ll=e,ll}var ul={},TT=!1;function vk(){if(TT)return ul;TT=!0;var t=si(),e=hk(),n=Tk()(),r=ks(),s=Ss(),o=t("%Math.floor%");return ul=function(a,l){if(typeof a!="function")throw new s("`fn` is not a function");if(typeof l!="number"||l<0||l>4294967295||o(l)!==l)throw new s("`length` must be a positive 32-bit integer");var c=arguments.length>2&&!!arguments[2],f=!0,g=!0;if("length"in a&&r){var p=r(a,"length");p&&!p.configurable&&(f=!1),p&&!p.writable&&(g=!1)}return(f||g||!c)&&(n?e(a,"length",l,!0,!0):e(a,"length",l)),a},ul}var ii={},vT=!1;function gl(){if(vT)return ii;vT=!0;var t=fl(),e=si(),n=vk(),r=Ss(),s=e("%Function.prototype.apply%"),o=e("%Function.prototype.call%"),i=e("%Reflect.apply%",!0)||t.call(o,s),a=pl(),l=e("%Math.max%");ii=function(g){if(typeof g!="function")throw new r("a function is required");var p=i(t,o,arguments);return n(p,1+l(0,g.length-(arguments.length-1)),!0)};var c=function(){return i(t,s,arguments)};return a?a(ii,"apply",{value:c}):ii.apply=c,ii}var cl={},_T=!1;function ml(){if(_T)return cl;_T=!0;var t=si(),e=gl(),n=e(t("String.prototype.indexOf"));return cl=function(s,o){var i=t(s,!!o);return typeof i=="function"&&n(s,".prototype.")>-1?e(i):i},cl}qo();ca();var yl={},wT=!1;function Il(){if(wT)return yl;wT=!0;var t=dl();return yl=function(){return t()&&!!Symbol.toStringTag},yl}var hl={},xT=!1;function _k(){if(xT)return hl;xT=!0;var t=Il()(),e=ml(),n=e("Object.prototype.toString"),r=function(a){return t&&a&&typeof a=="object"&&Symbol.toStringTag in a?!1:n(a)==="[object Arguments]"},s=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]"},o=(function(){return r(arguments)})();return r.isLegacyArguments=s,hl=o?r:s,hl}var Tl={},PT=!1;function bk(){if(PT)return Tl;PT=!0;var t=Object.prototype.toString,e=Function.prototype.toString,n=/^\s*(?:function)?\*/,r=Il()(),s=Object.getPrototypeOf,o=function(){if(!r)return!1;try{return Function("return function*() {}")()}catch{}},i;return Tl=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(!s)return!1;if(typeof i>"u"){var f=o();i=f?s(f):!1}return s(l)===i},Tl}var vl={},BT=!1;function wk(){if(BT)return vl;BT=!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 s=/^\s*class\b/,o=function(I){try{var D=t.call(I);return s.test(D)}catch{return!1}},i=function(I){try{return o(I)?!1:(t.call(I),!0)}catch{return!1}},a=Object.prototype.toString,l="[object Object]",c="[object Function]",f="[object GeneratorFunction]",g="[object HTMLAllCollection]",p="[object HTML document.all class]",h="[object HTMLCollection]",_=typeof Symbol=="function"&&!!Symbol.toStringTag,P=!(0 in[,]),B=function(){return!1};if(typeof document=="object"){var T=document.all;a.call(T)===a.call(document.all)&&(B=function(I){if((P||!I)&&(typeof I>"u"||typeof I=="object"))try{var D=a.call(I);return(D===g||D===p||D===h||D===l)&&I("")==null}catch{}return!1})}return vl=e?function(I){if(B(I))return!0;if(!I||typeof I!="function"&&typeof I!="object")return!1;try{e(I,null,n)}catch(D){if(D!==r)return!1}return!o(I)&&i(I)}:function(I){if(B(I))return!0;if(!I||typeof I!="function"&&typeof I!="object")return!1;if(_)return i(I);if(o(I))return!1;var D=a.call(I);return D!==c&&D!==f&&!/^\[object HTML/.test(D)?!1:i(I)},vl}var _l={},IT=!1;function xk(){if(IT)return _l;IT=!0;var t=wk(),e=Object.prototype.toString,n=Object.prototype.hasOwnProperty,r=function(l,c,f){for(var g=0,p=l.length;g<p;g++)n.call(l,g)&&(f==null?c(l[g],g,l):c.call(f,l[g],g,l))},s=function(l,c,f){for(var g=0,p=l.length;g<p;g++)f==null?c(l.charAt(g),g,l):c.call(f,l.charAt(g),g,l)},o=function(l,c,f){for(var g in l)n.call(l,g)&&(f==null?c(l[g],g,l):c.call(f,l[g],g,l))},i=function(l,c,f){if(!t(c))throw new TypeError("iterator must be a function");var g;arguments.length>=3&&(g=f),e.call(l)==="[object Array]"?r(l,c,g):typeof l=="string"?s(l,c,g):o(l,c,g)};return _l=i,_l}var bl={},ET=!1;function Pk(){return ET||(ET=!0,bl=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),bl}var wl={},ST=!1,Bk=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function Ik(){if(ST)return wl;ST=!0;var t=Pk(),e=typeof globalThis>"u"?Bk:globalThis;return wl=function(){for(var r=[],s=0;s<t.length;s++)typeof e[t[s]]=="function"&&(r[r.length]=t[s]);return r},wl}var xl={},kT=!1,Ek=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function MT(){if(kT)return xl;kT=!0;var t=xk(),e=Ik(),n=gl(),r=ml(),s=ks(),o=r("Object.prototype.toString"),i=Il()(),a=typeof globalThis>"u"?Ek:globalThis,l=e(),c=r("String.prototype.slice"),f=Object.getPrototypeOf,g=r("Array.prototype.indexOf",!0)||function(B,T){for(var E=0;E<B.length;E+=1)if(B[E]===T)return E;return-1},p={__proto__:null};i&&s&&f?t(l,function(P){var B=new a[P];if(Symbol.toStringTag in B){var T=f(B),E=s(T,Symbol.toStringTag);if(!E){var I=f(T);E=s(I,Symbol.toStringTag)}p["$"+P]=n(E.get)}}):t(l,function(P){var B=new a[P],T=B.slice||B.set;T&&(p["$"+P]=n(T))});var h=function(B){var T=!1;return t(p,function(E,I){if(!T)try{"$"+E(B)===I&&(T=c(I,1))}catch{}}),T},_=function(B){var T=!1;return t(p,function(E,I){if(!T)try{E(B),T=c(I,1)}catch{}}),T};return xl=function(B){if(!B||typeof B!="object")return!1;if(!i){var T=c(o(B),8,-1);return g(l,T)>-1?T:T!=="Object"?!1:_(B)}return s?h(B):null},xl}var Pl={},AT=!1;function Sk(){if(AT)return Pl;AT=!0;var t=MT();return Pl=function(n){return!!t(n)},Pl}var he={},CT=!1;function kk(){if(CT)return he;CT=!0;var t=_k(),e=bk(),n=MT(),r=Sk();function s(U){return U.call.bind(U)}var o=typeof BigInt<"u",i=typeof Symbol<"u",a=s(Object.prototype.toString),l=s(Number.prototype.valueOf),c=s(String.prototype.valueOf),f=s(Boolean.prototype.valueOf);if(o)var g=s(BigInt.prototype.valueOf);if(i)var p=s(Symbol.prototype.valueOf);function h(U,kt){if(typeof U!="object")return!1;try{return kt(U),!0}catch{return!1}}he.isArgumentsObject=t,he.isGeneratorFunction=e,he.isTypedArray=r;function _(U){return typeof Promise<"u"&&U instanceof Promise||U!==null&&typeof U=="object"&&typeof U.then=="function"&&typeof U.catch=="function"}he.isPromise=_;function P(U){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(U):r(U)||N(U)}he.isArrayBufferView=P;function B(U){return n(U)==="Uint8Array"}he.isUint8Array=B;function T(U){return n(U)==="Uint8ClampedArray"}he.isUint8ClampedArray=T;function E(U){return n(U)==="Uint16Array"}he.isUint16Array=E;function I(U){return n(U)==="Uint32Array"}he.isUint32Array=I;function D(U){return n(U)==="Int8Array"}he.isInt8Array=D;function $(U){return n(U)==="Int16Array"}he.isInt16Array=$;function ee(U){return n(U)==="Int32Array"}he.isInt32Array=ee;function Y(U){return n(U)==="Float32Array"}he.isFloat32Array=Y;function ce(U){return n(U)==="Float64Array"}he.isFloat64Array=ce;function re(U){return n(U)==="BigInt64Array"}he.isBigInt64Array=re;function Q(U){return n(U)==="BigUint64Array"}he.isBigUint64Array=Q;function Ie(U){return a(U)==="[object Map]"}Ie.working=typeof Map<"u"&&Ie(new Map);function Le(U){return typeof Map>"u"?!1:Ie.working?Ie(U):U instanceof Map}he.isMap=Le;function Xe(U){return a(U)==="[object Set]"}Xe.working=typeof Set<"u"&&Xe(new Set);function Fe(U){return typeof Set>"u"?!1:Xe.working?Xe(U):U instanceof Set}he.isSet=Fe;function ze(U){return a(U)==="[object WeakMap]"}ze.working=typeof WeakMap<"u"&&ze(new WeakMap);function pt(U){return typeof WeakMap>"u"?!1:ze.working?ze(U):U instanceof WeakMap}he.isWeakMap=pt;function Re(U){return a(U)==="[object WeakSet]"}Re.working=typeof WeakSet<"u"&&Re(new WeakSet);function ve(U){return Re(U)}he.isWeakSet=ve;function we(U){return a(U)==="[object ArrayBuffer]"}we.working=typeof ArrayBuffer<"u"&&we(new ArrayBuffer);function oe(U){return typeof ArrayBuffer>"u"?!1:we.working?we(U):U instanceof ArrayBuffer}he.isArrayBuffer=oe;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 K(U){return a(U)==="[object SharedArrayBuffer]"}function le(U){return typeof Z>"u"?!1:(typeof K.working>"u"&&(K.working=K(new Z)),K.working?K(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 te(U){return h(U,l)}he.isNumberObject=te;function b(U){return h(U,c)}he.isStringObject=b;function x(U){return h(U,f)}he.isBooleanObject=x;function F(U){return o&&h(U,g)}he.isBigIntObject=F;function J(U){return i&&h(U,p)}he.isSymbolObject=J;function Se(U){return te(U)||b(U)||x(U)||F(U)||J(U)}he.isBoxedPrimitive=Se;function me(U){return typeof Uint8Array<"u"&&(oe(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 Bl={},OT=!1;function Ak(){return OT||(OT=!0,Bl=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"}),Bl}var Te={},RT=!1,oi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function Ck(){if(RT)return Te;RT=!0;var t=Rt,e=Object.getOwnPropertyDescriptors||function(Z){for(var K=Object.keys(Z),le={},ge=0;ge<K.length;ge++)le[K[ge]]=Object.getOwnPropertyDescriptor(Z,K[ge]);return le},n=/%[sdj%]/g;Te.format=function(N){if(!$(N)){for(var Z=[],K=0;K<arguments.length;K++)Z.push(i(arguments[K]));return Z.join(" ")}for(var K=1,le=arguments,ge=le.length,R=String(N).replace(n,function(j){if(j==="%%")return"%";if(K>=ge)return j;switch(j){case"%s":return String(le[K++]);case"%d":return Number(le[K++]);case"%j":try{return JSON.stringify(le[K++])}catch{return"[Circular]"}default:return j}}),C=le[K];K<ge;C=le[++K])E(C)||!re(C)?R+=" "+C:R+=" "+i(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||oi,arguments)};var K=!1;function le(){if(!K){if(t.throwDeprecation)throw new Error(Z);t.traceDeprecation?console.trace(Z):console.error(Z),K=!0}return N.apply(this||oi,arguments)}return le};var r={},s=/^$/;if(t.env.NODE_DEBUG){var o=t.env.NODE_DEBUG;o=o.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),s=new RegExp("^"+o+"$","i")}Te.debuglog=function(N){if(N=N.toUpperCase(),!r[N])if(s.test(N)){var Z=t.pid;r[N]=function(){var K=Te.format.apply(Te,arguments);console.error("%s %d: %s",N,Z,K)}}else r[N]=function(){};return r[N]};function i(N,Z){var K={seen:[],stylize:l};return arguments.length>=3&&(K.depth=arguments[2]),arguments.length>=4&&(K.colors=arguments[3]),T(Z)?K.showHidden=Z:Z&&Te._extend(K,Z),Y(K.showHidden)&&(K.showHidden=!1),Y(K.depth)&&(K.depth=2),Y(K.colors)&&(K.colors=!1),Y(K.customInspect)&&(K.customInspect=!0),K.colors&&(K.stylize=a),f(K,N,K.depth)}Te.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function a(N,Z){var K=i.styles[Z];return K?"\x1B["+i.colors[K][0]+"m"+N+"\x1B["+i.colors[K][1]+"m":N}function l(N,Z){return N}function c(N){var Z={};return N.forEach(function(K,le){Z[K]=!0}),Z}function f(N,Z,K){if(N.customInspect&&Z&&Le(Z.inspect)&&Z.inspect!==Te.inspect&&!(Z.constructor&&Z.constructor.prototype===Z)){var le=Z.inspect(K,N);return $(le)||(le=f(N,le,K)),le}var ge=g(N,Z);if(ge)return ge;var R=Object.keys(Z),C=c(R);if(N.showHidden&&(R=Object.getOwnPropertyNames(Z)),Ie(Z)&&(R.indexOf("message")>=0||R.indexOf("description")>=0))return p(Z);if(R.length===0){if(Le(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(Q(Z))return N.stylize(Date.prototype.toString.call(Z),"date");if(Ie(Z))return p(Z)}var V="",te=!1,b=["{","}"];if(B(Z)&&(te=!0,b=["[","]"]),Le(Z)){var x=Z.name?": "+Z.name:"";V=" [Function"+x+"]"}if(ce(Z)&&(V=" "+RegExp.prototype.toString.call(Z)),Q(Z)&&(V=" "+Date.prototype.toUTCString.call(Z)),Ie(Z)&&(V=" "+p(Z)),R.length===0&&(!te||Z.length==0))return b[0]+V+b[1];if(K<0)return ce(Z)?N.stylize(RegExp.prototype.toString.call(Z),"regexp"):N.stylize("[Object]","special");N.seen.push(Z);var F;return te?F=h(N,Z,K,C,R):F=R.map(function(J){return _(N,Z,K,C,J,te)}),N.seen.pop(),P(F,V,b)}function g(N,Z){if(Y(Z))return N.stylize("undefined","undefined");if($(Z)){var K="'"+JSON.stringify(Z).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return N.stylize(K,"string")}if(D(Z))return N.stylize(""+Z,"number");if(T(Z))return N.stylize(""+Z,"boolean");if(E(Z))return N.stylize("null","null")}function p(N){return"["+Error.prototype.toString.call(N)+"]"}function h(N,Z,K,le,ge){for(var R=[],C=0,j=Z.length;C<j;++C)ve(Z,String(C))?R.push(_(N,Z,K,le,String(C),!0)):R.push("");return ge.forEach(function(V){V.match(/^\d+$/)||R.push(_(N,Z,K,le,V,!0))}),R}function _(N,Z,K,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(K)?j=f(N,V.value,null):j=f(N,V.value,K-1),j.indexOf(`
|
|
85
85
|
`)>-1&&(R?j=j.split(`
|
|
86
86
|
`).map(function(te){return" "+te}).join(`
|
|
87
87
|
`).slice(2):j=`
|
|
@@ -90,10 +90,10 @@ declare function ${r}${i};${l}`);if(t.props.type==="variable")return zo(`${o}dec
|
|
|
90
90
|
`))):j=N.stylize("[Circular]","special")),Y(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,K){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?K[0]+(Z===""?"":Z+`
|
|
92
92
|
`)+" "+N.join(`,
|
|
93
|
-
`)+" "+K[1]:K[0]+Z+" "+N.join(", ")+" "+K[1]}Te.types=kk();function B(N){return Array.isArray(N)}Te.isArray=B;function T(N){return typeof N=="boolean"}Te.isBoolean=T;function E(N){return N===null}Te.isNull=E;function I(N){return N==null}Te.isNullOrUndefined=I;function D(N){return typeof N=="number"}Te.isNumber=D;function $(N){return typeof N=="string"}Te.isString=$;function ee(N){return typeof N=="symbol"}Te.isSymbol=ee;function Y(N){return N===void 0}Te.isUndefined=Y;function ce(N){return re(N)&&Fe(N)==="[object RegExp]"}Te.isRegExp=ce,Te.types.isRegExp=ce;function re(N){return typeof N=="object"&&N!==null}Te.isObject=re;function Q(N){return re(N)&&Fe(N)==="[object Date]"}Te.isDate=Q,Te.types.isDate=Q;function Ie(N){return re(N)&&(Fe(N)==="[object Error]"||N instanceof Error)}Te.isError=Ie,Te.types.isNativeError=Ie;function Le(N){return typeof N=="function"}Te.isFunction=Le;function Xe(N){return N===null||typeof N=="boolean"||typeof N=="number"||typeof N=="string"||typeof N=="symbol"||typeof N>"u"}Te.isPrimitive=Xe,Te.isBuffer=Ak();function Fe(N){return Object.prototype.toString.call(N)}function ze(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 Re(){var N=new Date,Z=[ze(N.getHours()),ze(N.getMinutes()),ze(N.getSeconds())].join(":");return[N.getDate(),pt[N.getMonth()],Z].join(" ")}Te.log=function(){console.log("%s - %s",Re(),Te.format.apply(Te,arguments))},Te.inherits=Zt(),Te._extend=function(N,Z){if(!Z||!re(Z))return N;for(var K=Object.keys(Z),le=K.length;le--;)N[K[le]]=Z[K[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(K=Z[we],typeof K!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(K,we,{value:K,enumerable:!1,writable:!1,configurable:!0}),K}function K(){for(var le,ge,R=new Promise(function(V,te){le=V,ge=te}),C=[],j=0;j<arguments.length;j++)C.push(arguments[j]);C.push(function(V,te){V?ge(V):le(te)});try{Z.apply(this||si,C)}catch(V){ge(V)}return R}return Object.setPrototypeOf(K,Object.getPrototypeOf(Z)),we&&Object.defineProperty(K,we,{value:K,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(K,e(Z))},Te.promisify.custom=we;function se(N,Z){if(!N){var K=new Error("Promise was rejected with a falsy value");K.reason=N,N=K}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 K=[],le=0;le<arguments.length;le++)K.push(arguments[le]);var ge=K.pop();if(typeof ge!="function")throw new TypeError("The last argument must be of type Function");var R=this||si,C=function(){return ge.apply(R,arguments)};N.apply(this||si,K).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=Ck();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 s0=oe._extend,a0=oe.callbackify,l0=oe.debuglog,u0=oe.deprecate,c0=oe.format,d0=oe.inherits,f0=oe.inspect,p0=oe.isArray,g0=oe.isBoolean,m0=oe.isBuffer,y0=oe.isDate,h0=oe.isError,T0=oe.isFunction,v0=oe.isNull,_0=oe.isNullOrUndefined,b0=oe.isNumber,w0=oe.isObject,x0=oe.isPrimitive,P0=oe.isRegExp,B0=oe.isString,I0=oe.isSymbol,E0=oe.isUndefined,S0=oe.log,k0=oe.promisify,A0=oe.types,C0=oe.TextEncoder=globalThis.TextEncoder,O0=oe.TextDecoder=globalThis.TextDecoder;var yr=class{defaultOptions;constructor(e){this.defaultOptions=e}info(...e){this._log("info",e)}debug(...e){this._log("debug",e)}warn(...e){this._log("warn",e)}error(...e){this._log("error",e)}issue(e){console.info(JSON.stringify(e))}_log(e,n){this._getConsoleMethod(e)(this._serializeMessage(n))}_serializeMessage(e){let n=oe.format(...e);return G.env.BP_LOG_FORMAT==="json"?this.getJsonMessage(n):n}getJsonMessage(e){return JSON.stringify({msg:e,options:this.defaultOptions})}_getConsoleMethod(e){switch(e){case"debug":return console.debug;case"warn":return console.warn;case"error":return console.error;default:return console.info}}};var ai=class t extends yr{constructor(e){super({visibleToBotOwners:!1,hiddenToIntegrationOwners:!1,...e})}with(e){return new t({...this.defaultOptions,...e})}withUserId(e){return this.with({userId:e})}withConversationId(e){return this.with({conversationId:e})}withVisibleToBotOwners(e){return this.with({visibleToBotOwners:e})}withHiddenToIntegrationOwners(e){return this.with({hiddenToIntegrationOwners:e})}forBot(){return this.with({hiddenToIntegrationOwners:!1,visibleToBotOwners:!0})}forBotOnly(){return this.with({hiddenToIntegrationOwners:!0,visibleToBotOwners:!0})}getJsonMessage(e){return JSON.stringify({msg:e,visible_to_bot_owner:this.defaultOptions.visibleToBotOwners,hidden_to_integration_owner:this.defaultOptions.hiddenToIntegrationOwners,options:this.defaultOptions})}};S();A();k();var Nk=t=>["traceparent","tracestate","sentry-trace"].reduce((e,n)=>(t[n]&&(e[n]=t[n]),e),{}),Dk=(t,e,n)=>{let[,r]=(e.headers.traceparent||"").split("-"),o=new Rk({botId:t.botId,integrationId:t.integrationId,integrationAlias:t.integrationAlias,retry:Po,headers:Nk(e.headers)}),s=new ri(o),i=new ai({traceId:r});return{ctx:t,req:e,client:s,logger:i,instance:n}},Hk=async t=>{let{ctx:e}=t;switch(e.operation){case"webhook_received":return await jk(t);case"register":return await $k(t);case"unregister":return await Zk(t);case"message_created":return await Wk(t);case"action_triggered":return await Fk(t);case"ping":return await Uk(t);case"create_user":return await Lk(t);case"create_conversation":return await Kk(t);default:throw new Mk(`Unknown operation ${e.operation}`)}},DT=t=>async e=>{let n=Qh(e.headers),r=Dk(n,e,t),{logger:o}=r;try{let s;return s=await zk(r),s?{...s,status:s.status??200}:(s=await Hk(r),s?{...s,status:s.status??200}:{status:200})}catch(s){if(Ok(s)){let a=s.type==="Runtime"?s:new NT(s.message,s);return o.forBot().error(a.message),{status:a.code,body:JSON.stringify(a.toJSON())}}console.error(s);let i=new NT("An unexpected error occurred in the integration. Bot owners: Check logs for more informations. Integration owners: throw a RuntimeError to return a custom error message instead.");return o.forBot().error(i.message),{status:i.code,body:JSON.stringify(i.toJSON())}}},Uk=async t=>{},jk=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{let{req:s}=Mt(n);return o.webhook({client:t,ctx:e,req:s,logger:r})},$k=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{if(!o.register)return;let{webhookUrl:s}=Mt(n);await o.register({client:t,ctx:e,webhookUrl:s,logger:r})},Zk=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{if(!o.unregister)return;let{webhookUrl:s}=Mt(n);await o.unregister({ctx:e,webhookUrl:s,client:t,logger:r})},Lk=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{if(!o.createUser)return;let{tags:s}=Mt(n);return await o.createUser({ctx:e,client:t,tags:s,logger:r})},Kk=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{if(!o.createConversation)return;let{channel:s,tags:i}=Mt(n);return await o.createConversation({ctx:e,client:t,channel:s,tags:i,logger:r})},Wk=async({ctx:t,req:e,client:n,logger:r,instance:o})=>{let{conversation:s,user:i,type:a,payload:l,message:c}=Mt(e),f=o.channels[s.channel];if(!f)throw new Error(`Channel ${s.channel} not found`);let g=f.messages[a];if(!g)throw new Error(`Message of type ${a} not found in channel ${s.channel}`);await g({ctx:t,conversation:s,message:c,user:i,type:a,client:n,payload:l,ack:async({tags:h})=>{await n.updateMessage({id:c.id,tags:h})},logger:r})},Fk=async({req:t,ctx:e,client:n,logger:r,instance:o})=>{let{input:s,type:i}=Mt(t);if(!i)throw new Error("Missing action type");let a=o.actions[i];if(!a)throw new Error(`Action ${i} not found`);let l=new Bo,f={output:await a({ctx:e,input:s,client:n,type:i,logger:r,metadata:l}),meta:l.toJSON()};return{body:JSON.stringify(f)}},zk=async({instance:t,client:e,ctx:n,logger:r,req:o})=>{let s=t.unknownOperationHandler;if(s)return await s({client:e,ctx:n,logger:r,req:o})};var El=class{constructor(e){this.props=e;this.actions=e.actions,this.channels=e.channels,this.register=e.register,this.unregister=e.unregister,this.createUser=e.createUser,this.createConversation=e.createConversation,this.webhook=e.handler,this.unknownOperationHandler=e.__advanced?.unknownOperationHandler}actions;channels;register;unregister;createUser;createConversation;webhook;unknownOperationHandler;handler=DT(this);start=e=>bo(this.handler,e)};S();A();k();S();A();k();S();A();k();S();A();k();var Sl=class{constructor(e){this.props=e;this.integrations=e.integrations,this.plugins=e.plugins,this.user=e.user,this.conversation=e.conversation,this.message=e.message,this.states=e.states,this.configuration=e.configuration,this.events=e.events,this.recurringEvents=e.recurringEvents,this.actions=e.actions,this.tables=e.tables,this.workflows=e.workflows,this.attributes=e.attributes,this.__advanced=e.__advanced,this.withPlugins={user:e.user,conversation:e.conversation,message:e.message,states:e.states,events:e.events,recurringEvents:e.recurringEvents,actions:e.actions,tables:e.tables,workflows:e.workflows}}integrations;plugins;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;workflows;attributes;__advanced;withPlugins;get metadata(){return{sdkVersion:_n}}addIntegration(e,n){let r=this;r.integrations||(r.integrations={});let o=n?.alias??e.name;if(r.integrations[o])throw new Error(`Another integration with alias "${o}" is already installed in the bot`);return r.integrations[o]={...e,alias:o,enabled:n?.enabled,configurationType:n&&"configurationType"in n?n.configurationType:void 0,configuration:n&&"configuration"in n?n.configuration??{}:{},disabledChannels:n?.disabledChannels},this}addPlugin(e,n){let r=this;r.plugins||(r.plugins={});let o=n.alias??e.name;if(r.plugins[o])throw new Error(`Another plugin with alias "${o}" is already installed in the bot`);let s=Object.fromEntries(Object.entries(n.dependencies??{}).filter(([a,l])=>"integrationInterfaceAlias"in l).map(([a,l])=>{let c=this.integrations?.[l.integrationAlias];if(!c){let g=Object.keys(this.integrations??{}).join(", ")||"(none)";throw new Error(`Interface with alias "${a}" of plugin with alias "${o}" references integration with alias "${l.integrationAlias}" which is not installed. Please make sure to add the integration via addIntegration() before calling addPlugin().
|
|
94
|
-
Available integration aliases: ${g}`)}let f=c.definition.interfaces?.[l.integrationInterfaceAlias];if(!f){let g=Object.keys(c.definition.interfaces??{}).join(", ")||"(none)";throw new Error(`Interface with alias "${l.integrationInterfaceAlias}" does not exist in integration "${c.name}" referenced by interface with alias "${a}" of plugin with alias "${
|
|
95
|
-
Available interface aliases: ${g}`)}return[a,{...f,id:c.id,name:c.name,version:c.version,...l}]})),i=Object.fromEntries(Object.entries(n.dependencies??{}).filter(([a,l])=>!("integrationInterfaceAlias"in l)).map(([a,l])=>{let c=this.integrations?.[l.integrationAlias];if(!c){let f=Object.keys(this.integrations??{}).join(", ")||"(none)";throw new Error(`Integration with alias "${a}" of plugin with alias "${
|
|
96
|
-
Available integration aliases: ${f}`)}return[a,{...c,...l}]}));return r.plugins[o]={...e,alias:o,configuration:n.configuration??{},interfaces:s,integrations:i},r.withPlugins.user=this._mergeUser(r.withPlugins.user,e.definition.user),r.withPlugins.conversation=this._mergeConversation(r.withPlugins.conversation,e.definition.conversation),r.withPlugins.message=this._mergeMessage(r.withPlugins.message,e.definition.message),r.withPlugins.recurringEvents=this._mergeRecurringEvents(r.withPlugins.recurringEvents,e.definition.recurringEvents),r.withPlugins.tables=this._mergeTables(r.withPlugins.tables,e.definition.tables),r.withPlugins.workflows=this._mergeWorkflows(r.withPlugins.workflows,e.definition.workflows),r.withPlugins.states=this._mergeStates(r.withPlugins.states,this._prefixKeysWithPluginAlias(e.definition.states,o)),r.withPlugins.events=this._mergeEvents(r.withPlugins.events,this._prefixKeysWithPluginAlias(e.definition.events,o)),r.withPlugins.actions=this._mergeActions(r.withPlugins.actions,this._prefixKeysWithPluginAlias(e.definition.actions,o)),this}_mergeUser=(e,n)=>({tags:{...e?.tags,...n?.tags}});_mergeConversation=(e,n)=>({tags:{...e?.tags,...n?.tags}});_mergeMessage=(e,n)=>({tags:{...e?.tags,...n?.tags}});_mergeStates=(e,n)=>({...e,...n});_mergeEvents=(e,n)=>({...e,...n});_mergeRecurringEvents=(e,n)=>({...e,...n});_mergeActions=(e,n)=>({...e,...n});_mergeTables=(e,n)=>({...e,...n});_mergeWorkflows=(e,n)=>({...e,...n});_prefixKeysWithPluginAlias=(e,n)=>je.mapKeys(e??{},r=>`${n}${Nt}${r}`);dereferencePluginEntities(){let e=this._buildZuiReferenceMap();return{...this,withPlugins:{...this.withPlugins,events:this._dereferenceDefinitionSchemas(this.withPlugins.events,e),states:this._dereferenceDefinitionSchemas(this.withPlugins.states,e),tables:this._dereferenceDefinitionSchemas(this.withPlugins.tables,e),actions:this._dereferenceActionDefinitionSchemas(this.withPlugins.actions,e)},plugins:Object.fromEntries(Object.entries(this.plugins??{}).map(([n,r])=>[n,{...r,definition:{...r.definition,configuration:this._dereferenceDefinitionSchema(r.definition.configuration,e),events:this._dereferenceDefinitionSchemas(r.definition.events,e),states:this._dereferenceDefinitionSchemas(r.definition.states,e),tables:this._dereferenceDefinitionSchemas(r.definition.tables,e),actions:this._dereferenceActionDefinitionSchemas(r.definition.actions,e)}}]))}}_buildZuiReferenceMap(){let e={},n=Object.entries(this.plugins??{});for(let[r,o]of n){let s=Object.entries(o.interfaces??{});for(let[i,a]of s){let l=this.integrations?.[a.integrationAlias];if(!l)throw new Error(`Interface with alias "${i}" of plugin with alias "${r}" references integration "${a.name}" which is not installed`);let c=Object.entries(a.entities??{});for(let[f,{name:g}]of c){let p=l.definition.entities?.[g]?.schema;if(!p)throw new Error(`Interface entity "${g}" does not exist in integration "${l.name}"`);e[`interface:${i}/entities/${f}`]=p}}}return e}_dereferenceZuiSchema(e,n){return e.dereference(n)}_dereferenceDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,o])=>[r,this._dereferenceDefinitionSchema(o,n)]))}_dereferenceDefinitionSchema(e,n){return e&&{...e,schema:this._dereferenceZuiSchema(e.schema,n)}}_dereferenceActionDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,o])=>[r,{...o,input:{schema:this._dereferenceZuiSchema(o.input.schema,n)},output:{schema:this._dereferenceZuiSchema(o.output.schema,n)}}]))}};S();A();k();S();A();k();import{isApiError as Xk,Client as Qk,RuntimeError as jT}from"@botpress/client";S();A();k();var li=class t extends yr{constructor(e){super({...e})}with(e){return new t({...this.defaultOptions,...e})}withUserId(e){return this.with({userId:e})}withConversationId(e){return this.with({conversationId:e})}withWorkflowId(e){return this.with({workflowId:e})}withEventId(e){return this.with({eventId:e})}withMessageId(e){return this.with({messageId:e})}};S();A();k();S();A();k();var cn=class{constructor(e,n={before:{},after:{}}){this._client=e;this._hooks=n}get _inner(){return this._client}getConversation=(e=>this._run("getConversation",e));listConversations=(e=>this._run("listConversations",e));updateConversation=(e=>this._run("updateConversation",e));deleteConversation=(e=>this._run("deleteConversation",e));listParticipants=(e=>this._run("listParticipants",e));addParticipant=(e=>this._run("addParticipant",e));getParticipant=(e=>this._run("getParticipant",e));removeParticipant=(e=>this._run("removeParticipant",e));createEvent=(e=>this._run("createEvent",e));getEvent=(e=>this._run("getEvent",e));listEvents=(e=>this._run("listEvents",e));createMessage=(e=>this._run("createMessage",e));getOrCreateMessage=(e=>this._run("getOrCreateMessage",e));getMessage=(e=>this._run("getMessage",e));updateMessage=(e=>this._run("updateMessage",e));listMessages=(e=>this._run("listMessages",e));deleteMessage=(e=>this._run("deleteMessage",e));getUser=(e=>this._run("getUser",e));listUsers=(e=>this._run("listUsers",e));updateUser=(e=>this._run("updateUser",e));deleteUser=(e=>this._run("deleteUser",e));getState=(e=>this._run("getState",e));setState=(e=>this._run("setState",e));getOrSetState=(e=>this._run("getOrSetState",e));patchState=(e=>this._run("patchState",e));callAction=(e=>this._run("callAction",e));uploadFile=(e=>this._run("uploadFile",e));upsertFile=(e=>this._run("upsertFile",e));deleteFile=(e=>this._run("deleteFile",e));listFiles=(e=>this._run("listFiles",e));getFile=(e=>this._run("getFile",e));updateFileMetadata=(e=>this._run("updateFileMetadata",e));searchFiles=(e=>this._run("searchFiles",e));trackAnalytics=(e=>this._run("trackAnalytics",e));getTableRow=(e=>this._run("getTableRow",e));createTableRows=(e=>this._run("createTableRows",e));findTableRows=(e=>this._run("findTableRows",e));deleteTableRows=(e=>this._run("deleteTableRows",e));updateTableRows=(e=>this._run("updateTableRows",e));upsertTableRows=(e=>this._run("upsertTableRows",e));createWorkflow=(e=>this._run("createWorkflow",e));getOrCreateWorkflow=(e=>this._run("getOrCreateWorkflow",e));getWorkflow=(e=>this._run("getWorkflow",e));updateWorkflow=(e=>this._run("updateWorkflow",e));deleteWorkflow=(e=>this._run("deleteWorkflow",e));listWorkflows=(e=>this._run("listWorkflows",e));createConversation=e=>this._client.createConversation(e);getOrCreateConversation=e=>this._client.getOrCreateConversation(e);createUser=e=>this._client.createUser(e);getOrCreateUser=e=>this._client.getOrCreateUser(e);_run=async(e,n)=>{let r=this._hooks.before[e];r&&(n=await r(n));let o=await this._client[e](n),s=this._hooks.after[e];return s&&(o=await s(o,n)),o}};S();A();k();var qk=ne.enum(["event_received","register","unregister","ping","action_triggered"]),HT=t=>({botId:t[Io]||It("Missing bot id header"),operation:qk.parse(t[So]),type:t[Xh]||It("Missing type header"),configuration:JSON.parse(z.from(t[Eo]||It("Missing configuration header"),"base64").toString("utf-8"))});S();A();k();var ct={status:200};S();A();k();S();A();k();var kl=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 Gk=["child_workflow_deleted","child_workflow_finished","workflow_timedout","workflow_started","workflow_continued"],UT=async(t,e)=>{if(t.ctx.type!=="workflow_update"||!Gk.includes(e.payload.type))throw new Error("Unexpected event type");let n={...t,logger:Vk(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 Jk(n,e);default:e.payload.type}return ct},Vk=(t,e)=>t.logger.with({eventId:e.id,workflowId:e.payload.workflow.id,conversationId:e.payload.conversation?.id,userId:e.payload.user?.id}),Jk=async(t,e)=>{let n=kl(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:o}=await Yk(t,e);return o.status==="pending"&&t.logger.warn(`Workflow "${e.payload.workflow.name}" is still in pending status after processing "${n}" event. This may indicate that the workflow was not properly acknowledged or terminated by the handler. `),ct},Yk=async(t,e)=>{let n=kl(e.payload.type),r=t.self.workflowHandlers[n]?.[e.payload.workflow.name],o=structuredClone(e.payload.workflow);for(let s of r??[])o=await s({...t,event:e,conversation:e.payload.conversation,user:e.payload.user,workflow:o});return{updatedWorkflow:o}};S();A();k();var $T=t=>async e=>{let n=HT(e.headers),r=new li,o=new Qk({botId:n.botId,retry:Po}),s=new cn(o,{before:{createMessage:async a=>{let l=t.hookHandlers.before_outgoing_message[a.type]??[];for(let c of l){let f=new cn(o);a=(await c({client:f,ctx:n,logger:r.with({conversationId:a.conversationId,userId:a.userId}),data:a}))?.data??a}return a},callAction:async a=>{let l=t.hookHandlers.before_outgoing_call_action[a.type]??[];for(let c of l){let f=new cn(o);a=(await c({client:f,ctx:n,logger:r,data:a}))?.data??a}return a}},after:{createMessage:async a=>{let l=t.hookHandlers.after_outgoing_message[a.message.type]??[];for(let c of l){let f=new cn(o);a=(await c({client:f,ctx:n,logger:r.with({messageId:a.message.id,conversationId:a.message.conversationId,userId:a.message.userId}),data:a}))?.data??a}return a},callAction:async(a,l)=>{let{type:c}=l,f=t.hookHandlers.after_outgoing_call_action[c]??[];for(let g of f){let p=new cn(o);a=(await g({client:p,ctx:n,logger:r,data:{type:c,...a}}))?.data??a}return a}}}),i={req:e,ctx:n,logger:r,client:s,self:t};try{switch(n.operation){case"action_triggered":return await iA(i);case"event_received":return await rA(i);case"register":return await tA(i);case"unregister":return await nA(i);case"ping":return await eA(i);default:throw new Error(`Unknown operation ${n.operation}`)}}catch(a){let l=a instanceof Error?a:new Error(String(a));if(Xk(l)){let f=l.type==="Runtime"?l:new jT(l.message,l);return r.error(f.message),{status:f.code,body:JSON.stringify(f.toJSON())}}let c=new jT("An unexpected error occurred in the bot.",l);return r.error(c.message,l),{status:c.code,body:JSON.stringify(c.toJSON())}}},eA=async t=>ct,tA=async t=>(await t.self.registerHandler?.({client:t.client,ctx:t.ctx,logger:t.logger}),ct),nA=async t=>ct,rA=async t=>{let{ctx:e,logger:n,req:r,client:o,self:s}=t,i={client:o,ctx:e,logger:n},a=Mt(r);if(i.logger=i.logger.with({eventId:a.event.id,messageId:a.event.messageId,conversationId:a.event.conversationId,userId:a.event.userId}),e.type==="workflow_update")return await UT(t,a.event);if(e.type==="message_created"){let h=a.event,_=h.payload.message;i.logger=i.logger.with({messageId:_.id,conversationId:_.conversationId,userId:_.userId});let P=s.hookHandlers.before_incoming_message[_.type]??[];for(let I of P){let D=await I({...i,data:_});if(_=D?.data??_,D?.stop)return ct}let B={...i,user:h.payload.user,conversation:h.payload.conversation,message:_,event:h},T=s.messageHandlers[_.type]??[];for(let I of T)await I(B);let E=s.hookHandlers.after_incoming_message[_.type]??[];for(let I of E){let D=await I({...i,data:_});if(_=D?.data??_,D?.stop)return ct}return ct}if(e.type==="state_expired"){let _=a.event.payload.state,P={...i,state:_},B=s.stateExpiredHandlers[_.name]??[];for(let T of B)await T(P);return ct}let l=a.event,c=s.hookHandlers.before_incoming_event[l.type]??[];for(let h of c){let _=await h({...i,data:l});if(l=_?.data??l,_?.stop)return ct}let f={...i,event:l},g=s.eventHandlers[l.type]??[];for(let h of g)await h(f);let p=s.hookHandlers.after_incoming_event[l.type]??[];for(let h of p){let _=await h({...i,data:l});if(l=_?.data??l,_?.stop)return ct}return ct},iA=async({ctx:t,logger:e,req:n,client:r,self:o})=>{let{input:s,type:i}=Mt(n);if(!i)throw new Error("Missing action type");let a=o.hookHandlers.before_incoming_call_action[i]??[];for(let p of a){let h=await p({ctx:t,logger:e,client:r,data:{type:i,input:s}});s=h?.data?.input??s,i=h?.data?.type??i}let l=o.actionHandlers[i];if(!l)throw new Error(`Action ${i} not found`);let c=await l({ctx:t,logger:e,input:s,client:r,type:i}),f=o.hookHandlers.after_incoming_call_action[i]??[];for(let p of f){let h=await p({ctx:t,logger:e,client:r,data:{type:i,output:c}});i=h?.data?.type??i,c=h?.data?.output??c}return{status:200,body:JSON.stringify({output:c})}};S();A();k();S();A();k();S();A();k();var Ft=(t,{alias:e})=>{if(!("tags"in t)||!e)return t;let n=`${e}${Nt}`,r=Object.fromEntries(Object.entries(t.tags??{}).flatMap(([o,s])=>o.startsWith(n)?[[o.slice(n.length),s]]:[]));return{...t,tags:r}},ft=(t,{alias:e})=>{if(!("tags"in t)||!e)return t;let n=`${e}${Nt}`,r=Object.fromEntries(Object.entries(t.tags??{}).map(([o,s])=>[o.startsWith(n)?o:`${n}${o}`,s]));return{...t,tags:r}};S();A();k();var Al=class{constructor(e){this._list=e}_nextToken;_elementsBuffer=[];_isExhausted=!1;[Symbol.asyncIterator](){return this}async next(){return this._bufferIsEmpty&&!this._isExhausted&&await this._fetchNextPageIntoBuffer(),this._bufferIsEmpty?{done:!0,value:void 0}:{done:!1,value:this._elementsBuffer.shift()}}async take(e){let n=[];for(let r=0;r<e;++r){let o=await this.next();if(o.done)break;n.push(o.value)}return n}async takePage(e){for(let r=0;r<e;++r)this._isExhausted||await this._fetchNextPageIntoBuffer();let n=[...this._elementsBuffer];return this._elementsBuffer.length=0,n}async takeAll(){return this.take(Number.POSITIVE_INFINITY)}get isExhausted(){return this._isExhausted}async _fetchNextPageIntoBuffer(){let{items:e,meta:n}=await this._list({nextToken:this._nextToken});this._elementsBuffer.push(...e),this._nextToken=n.nextToken,n.nextToken||(this._isExhausted=!0)}get _bufferIsEmpty(){return this._elementsBuffer.length===0}},Et=t=>new Al(t);var dn=t=>new Proxy({},{get:(e,n)=>({listInstances:r=>Et(({nextToken:o})=>t.client.listWorkflows({...r,name:n,nextToken:o}).then(({meta:s,workflows:i})=>({meta:s,items:i.map(a=>St({...t,workflow:a}))}))),startNewInstance:async r=>{let{workflow:o}=await t.client.createWorkflow({name:n,status:"pending",...ft(r,{alias:void 0})});return{workflow:St({...t,workflow:o})}}})}),St=t=>{let e=!1;return{...Ft(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:St({...t,workflow:r})}},async acknowledgeStartOfProcessing(){if(!t.event||t.workflow.status!=="pending"||e)return{workflow:St(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:St({...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:St({...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:St({...t,workflow:r})}},async cancel(){let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,status:"cancelled"});return await t.onWorkflowUpdate?.(n),{workflow:St({...t,workflow:n})}}}};S();A();k();var Cl=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(o=>r({...o,workflows:dn(o)}),r.name);for(let[o,s]of Object.entries(this._plugins)){let[i,a]=n.split(Nt);if(!(i!==o||!a))return s.actionHandlers[a]}}})}get messageHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(a=>a.messageHandlers[n]??[]),o=n==="*"?[]:this._messageHandlers[n]??[],s=this._messageHandlers["*"]??[],i=[...o,...s].sort((a,l)=>a.order-l.order).map(({handler:a})=>ut.setName(l=>a({...l,workflows:dn(l)}),a.name));return ue.unique([...r,...i])}})}get eventHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(a=>a.eventHandlers[n]??[]),o=n==="*"?[]:this._eventHandlers[n]??[],s=this._eventHandlers["*"]??[],i=[...o,...s].sort((a,l)=>a.order-l.order).map(({handler:a})=>ut.setName(l=>a({...l,workflows:dn(l)}),a.name));return ue.unique([...r,...i])}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(a=>a.stateExpiredHandlers[n]??[]),o=n==="*"?[]:this._stateExpiredHandlers[n]??[],s=this._stateExpiredHandlers["*"]??[],i=[...o,...s].sort((a,l)=>a.order-l.order).map(({handler:a})=>ut.setName(l=>a({...l,workflows:dn(l)}),a.name));return ue.unique([...r,...i])}})}get hookHandlers(){return new Proxy({},{get:(e,n)=>{if(this._hookHandlers[n])return new Proxy({},{get:(o,s)=>{let i=Object.values(this._plugins).flatMap(g=>g.hookHandlers[n]?.[s]??[]),a=this._hookHandlers[n]??{},l=s==="*"?[]:a[s]??[],c=a["*"]??[],f=[...l,...c].sort((g,p)=>g.order-p.order).map(({handler:g})=>ut.setName(p=>g({...p,workflows:dn(p)}),g.name));return ue.unique([...i,...f])}})}})}get workflowHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._workflowHandlers[n];if(r)return new Proxy({},{get:(o,s)=>{let i=r[s]?.sort((l,c)=>l.order-c.order).map(({handler:l})=>ut.setName(async c=>{let f=c.workflow;return await l({...c,workflow:St({...c,onWorkflowUpdate(g){f=g}}),workflows:dn(c)}),f},l.name))??[],a=Object.values(this._plugins).flatMap(l=>l.workflowHandlers[n]?.[s]??[]);return ue.unique([...i,...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=$T(this);start=e=>bo(this.handler,e)};S();A();k();S();A();k();S();A();k();S();A();k();S();A();k();var Ol=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?{}:je.mapValues(e.events,i=>({...i,schema:i.schema(n)})),o=e.actions===void 0?{}:je.mapValues(e.actions,i=>({...i,input:{...i.input,schema:i.input.schema(n)},output:{...i.output,schema:i.output.schema(n)}})),s=e.channels===void 0?{}:je.mapValues(e.channels,i=>({...i,messages:je.mapValues(i.messages,a=>({...a,schema:a.schema(n)}))}));this.events=r,this.actions=o,this.channels=s}name;version;title;description;icon;readme;attributes;entities;events;actions;channels;__advanced;get metadata(){return{sdkVersion:_n}}_getEntityReference=e=>{let n={};for(let[r,o]of Object.entries(e)){let s=o.schema._def["x-zui"]?.title,i=o.schema._def.description,a=ne.ref(r);s&&a.title(s),i&&a.describe(i),n[r]=a}return n}};S();A();k();S();A();k();S();A();k();S();A();k();var Rl=class{constructor(e){this.props=e;let n=Object.fromEntries(Object.entries(e.interfaces??{}).map(([o,s])=>[o,Object.fromEntries(Object.entries(s.definition.entities??{}).map(([i])=>[i,ne.ref(`interface:${o}/entities/${i}`)]))]));this.name=e.name,this.version=e.version,this.icon=e.icon,this.readme=e.readme,this.title=e.title,this.description=e.description,this.integrations=e.integrations,this.interfaces=e.interfaces,this.user=e.user,this.conversation=e.conversation,this.message=e.message,this.recurringEvents=e.recurringEvents,this.workflows=e.workflows,this.attributes=e.attributes,this.__advanced=e.__advanced;let r=new Set;for(let o of[...Object.keys(e.integrations??{}),...Object.keys(e.interfaces??{})]){if(r.has(o))throw new Error(`Duplicate interface or integration alias detected in plugin definition: '${o}'. Please use unique aliases for each interface and integration.`);r.add(o)}this.configuration=e.configuration?{...e.configuration,schema:typeof e.configuration.schema=="object"?e.configuration.schema:e.configuration.schema({entities:n})}:void 0,this.states=Object.fromEntries(Object.entries(e.states??{}).map(([o,s])=>[o,{...s,schema:typeof s.schema=="object"?s.schema:s.schema({entities:n})}])),this.events=Object.fromEntries(Object.entries(e.events??{}).map(([o,s])=>[o,{...s,schema:typeof s.schema=="object"?s.schema:s.schema({entities:n})}])),this.actions=Object.fromEntries(Object.entries(e.actions??{}).map(([o,s])=>[o,{...s,input:{...s.input,schema:typeof s.input.schema=="object"?s.input.schema:s.input.schema({entities:n})},output:{...s.output,schema:typeof s.output.schema=="object"?s.output.schema:s.output.schema({entities:n})}}])),this.tables=Object.fromEntries(Object.entries(e.tables??{}).map(([o,s])=>[o,{...s,schema:typeof s.schema=="object"?s.schema:s.schema({entities:n})}]))}name;version;title;description;icon;readme;attributes;integrations;interfaces;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;workflows;__advanced;get metadata(){return{sdkVersion:_n}}dereferenceEntities({intersectWithUnknownRecord:e}={intersectWithUnknownRecord:!0}){let n=this._buildZuiReferenceMap(e);return{...this,configuration:this.configuration?{...this.configuration,schema:this._dereferenceZuiSchema(this.configuration.schema,n)}:void 0,events:this._dereferenceDefinitionSchemas(this.events,n),states:this._dereferenceDefinitionSchemas(this.states,n),tables:this._dereferenceDefinitionSchemas(this.tables,n),actions:this._dereferenceActionDefinitionSchemas(this.actions,n)}}_buildZuiReferenceMap(e){return Object.fromEntries(Object.entries(this.interfaces??{}).flatMap(([n,r])=>Object.entries(r.definition.entities??{}).map(([o,s])=>[`interface:${n}/entities/${o}`,e?s.schema.and(ne.record(ne.string(),ne.unknown())):s.schema])))}_dereferenceZuiSchema(e,n){return e.dereference(n)}_dereferenceDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,o])=>[r,{...o,schema:this._dereferenceZuiSchema(o.schema,n)}]))}_dereferenceActionDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,o])=>[r,{...o,input:{schema:this._dereferenceZuiSchema(o.input.schema,n)},output:{schema:this._dereferenceZuiSchema(o.output.schema,n)}}]))}};S();A();k();S();A();k();S();A();k();var ZT=(t,e)=>new Proxy({},{get:(n,r)=>new Proxy({},{get:(o,s)=>i=>{let a=(e.integrations[r]??e.interfaces[r])?.integrationAlias,l=e.interfaces[r]?.actions?.[s]?.name??s;return t.callAction({type:`${a}:${l}`,input:i}).then(c=>c.output)}})});S();A();k();S();A();k();S();A();k();S();A();k();var Ml=t=>({async getById({id:e}){let n=await t.client.getMessage({id:e});return Dt({...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:o})=>({meta:r,items:o.map(s=>Dt({...t,message:s}))})))}}),Dt=t=>({...Ft(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 Dt({...t,message:n})}});S();A();k();S();A();k();var Nl=t=>({list(e){return Et(({nextToken:n})=>t.client.listUsers({...ft(e??{},{alias:t.pluginAlias}),nextToken:n}).then(({meta:r,users:o})=>({meta:r,items:o.map(s=>zt({...t,conversationId:e?.conversationId,user:s}))})))},async getById({id:e}){let n=await t.client.getUser({id:e});return zt({...t,user:n.user,conversationId:void 0})}}),zt=t=>{let e={...Ft(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 zt({...t,user:r})}};return t.conversationId?{...e,async removeFromConversation(){return await t.client.removeParticipant({id:t.conversationId,userId:t.user.id}),zt({...t,conversationId:void 0})}}:{...e,async addToConversation({conversationId:n}){let{participant:r}=await t.client.addParticipant({id:n,userId:t.user.id});return zt({...t,user:r,conversationId:n})}}};S();A();k();var Dl=t=>new Proxy({},{get:(e,n)=>new Proxy({},{get:(r,o)=>({list(s){let i=t.plugin?.interfaces[n]?.integrationAlias??t.plugin?.integrations[n]?.integrationAlias,a=t.plugin?.interfaces[n]?.channels?.[o]?.name??o;return Et(({nextToken:l})=>t.client.listConversations({...ft(s??{},{alias:t.plugin?.alias}),channel:a==="*"?void 0:a,integrationName:i==="*"?void 0:i,nextToken:l}).then(({meta:c,conversations:f})=>({meta:c,items:f.map(g=>hr({...t,conversation:g}))})))},async getById({id:s}){let i=await t.client.getConversation({id:s});return hr({...t,conversation:i.conversation})}})})}),hr=t=>{let e=t.client;return{...Ft(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 hr({...t,conversation:r})},async getMessage({id:n}){let r=await e.getMessage({id:n});return Dt({...t,message:r.message})},async getOrCreateMessage(n){let{message:r}=await e.getOrCreateMessage({...ft(n,{alias:t.plugin?.alias}),conversationId:t.conversation.id});return Dt({...t,message:r})},async createMessage(n){let{message:r}=await e.createMessage({...ft(n,{alias:t.plugin?.alias}),conversationId:t.conversation.id});return Dt({...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:o,messages:s})=>({meta:o,items:s.map(i=>Dt({...t,message:i}))})))},listParticipants(){return Et(({nextToken:n})=>e.listParticipants({id:t.conversation.id,nextToken:n}).then(({meta:r,participants:o})=>({meta:r,items:o.map(s=>zt({...t,user:s,conversationId:t.conversation.id}))})))}}};S();A();k();S();A();k();S();A();k();var Hl=class t{constructor(e){this._props=e}async emit(e){let{conversationId:n,userId:r,messageId:o}=this._props,{event:s}=await this._props.client.createEvent({type:this._props.eventName,payload:e,conversationId:n,userId:r,messageId:o});return s}async schedule(e,n){let{conversationId:r,userId:o,messageId:s}=this._props,{event:i}=await this._props.client.createEvent({type:this._props.eventName,payload:e,conversationId:r,userId:o,messageId:s,schedule:n});return i}withConversationId(e){return new t({...this._props,conversationId:e})}withUserId(e){return new t({...this._props,userId:e})}withMessageId(e){return new t({...this._props,messageId:e})}async getById(e){return(await this._props.client.getEvent({id:e.id})).event}list(e){return 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:o})=>({meta:r,items:o})))}},LT=(t,e)=>new Proxy({},{get:(n,r)=>{let o=e.alias!==void 0?`${e.alias}${Nt}${r}`:r;return new Hl({client:t,eventName:o})}});S();A();k();S();A();k();S();A();k();S();A();k();S();A();k();var Ul=class{constructor(e,n,r){this._client=e;this._stateType=n;this._stateName=r}async get(e){return await this._client.getState({type:this._stateType,name:this._stateName,id:e}).then(n=>n.state.payload)}async set(e,n,r){await this._client.setState({type:this._stateType,name:this._stateName,id:e,payload:n,expiry:r?.expiryMs})}async getOrSet(e,n,r){return await this._client.getOrSetState({type:this._stateType,name:this._stateName,id:e,payload:n,expiry:r?.expiryMs}).then(o=>o.state.payload)}async delete(e){await this._client.setState({type:this._stateType,name:this._stateName,id:e,payload:null})}async patch(e,n){await this._client.patchState({type:this._stateType,name:this._stateName,id:e,payload:n})}},KT=(t,e)=>new Proxy({},{get:(n,r)=>new Proxy({},{get:(o,s)=>{let i=e.alias!==void 0?`${e.alias}${Nt}${s}`:s;return new Ul(t,r,i)}})});S();A();k();var jl=class{constructor(e){this.props=e;this._actionHandlers=e.actions}_runtimeProps;_actionHandlers;_messageHandlers={};_eventHandlers={};_stateExpiredHandlers={};_hookHandlers={before_incoming_event:{},before_incoming_message:{},before_outgoing_message:{},before_outgoing_call_action:{},before_incoming_call_action:{},after_incoming_event:{},after_incoming_message:{},after_outgoing_message:{},after_outgoing_call_action:{},after_incoming_call_action:{}};_workflowHandlers={started:{},continued:{},timed_out:{}};_registerOrder=0;initialize(e){return this._runtimeProps=e,this}get _runtime(){if(!this._runtimeProps)throw new Error("Plugin not correctly initialized. This is likely because you access your plugin config outside of an handler.");return this._runtimeProps}_getTools(e){let{configuration:n,interfaces:r,integrations:o,alias:s}=this._runtime,i=ZT(e,this._runtime),a=KT(e,this._runtime),l=dn({client:e,pluginAlias:this._runtime.alias}),c=LT(e,this._runtime),f=Nl({client:e,pluginAlias:this._runtime.alias}),g=Dl({client:e,plugin:this._runtime}),p=Ml({client:e,plugin:this._runtime});return{configuration:n,interfaces:r,integrations:o,actions:i,states:a,alias:s,workflows:l,events:c,users:f,conversations:g,messages:p}}get actionHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._actionHandlers[n];if(r)return ut.setName(o=>r({...o,...this._getTools(o.client)}),r.name)}})}get messageHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=n==="*"?[]:this._messageHandlers[n]??[],o=this._messageHandlers["*"]??[];return ue.unique([...r,...o]).sort((i,a)=>i.order-a.order).map(({handler:i})=>ut.setName(a=>i({...a,user:zt({...a,conversationId:a.conversation.id,pluginAlias:this._runtime.alias}),message:Dt({...a,plugin:this._runtime,message:a.message}),conversation:hr({...a,plugin:this._runtime,conversation:a.conversation}),...this._getTools(a.client)}),i.name))}})}get eventHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=n==="*"?[]:this._eventHandlers[n]??[],o=Object.entries(this._eventHandlers).filter(([a])=>this._eventResolvesTo(a,n)).flatMap(([,a])=>a??[]),s=this._eventHandlers["*"]??[];return ue.unique([...r,...o,...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]??[],o=this._stateExpiredHandlers["*"]??[];return ue.unique([...r,...o]).sort((i,a)=>i.order-a.order).map(({handler:i})=>ut.setName(a=>i({...a,...this._getTools(a.client)}),i.name))}})}get hookHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._hookHandlers[n];if(r)return new Proxy({},{get:(o,s)=>{s=this._stripAliasPrefix(s);let i=s==="*"?[]:r[s]??[],a=Object.entries(r).filter(([f])=>this._eventResolvesTo(f,s)).flatMap(([,f])=>f??[]),l=r["*"]??[];return ue.unique([...i,...a,...l]).sort((f,g)=>f.order-g.order).map(({handler:f})=>ut.setName(g=>f({...g,data:Ft(g.data,{alias:this._runtime.alias}),...this._getTools(g.client)}),f.name))}})}})}get workflowHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._workflowHandlers[n];if(r)return new Proxy({},{get:(o,s)=>(r[s]?.sort((a,l)=>a.order-l.order)??[]).map(({handler:a})=>ut.setName(async l=>{let c=l.workflow;return await a({...l,workflow:St({...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[o,s]=e.split(":");if(!o||!s)return!1;let i=this._runtime.interfaces[o];if(i&&n===`${i.integrationAlias}:${i?.events?.[s]?.name}`)return!0;let a=this._runtime.integrations[o];return!!(a&&n===`${a.integrationAlias}:${s}`)};_stripAliasPrefix=e=>{let{alias:n}=this._runtime;if(!n)return e;let r=`${n}#`;return e.startsWith(r)?e.slice(r.length):e}};S();A();k();S();A();k();S();A();k();S();A();k();S();A();k();var WT={};bn(WT,{allWithinMajorOf:()=>oA,allWithinMinorOf:()=>sA});S();A();k();import*as ui from"semver";function oA(t){let e=ui.major(t.version);return{...t,version:`>=${e}.0.0 <${e+1}.0.0`}}function sA(t){let e=ui.major(t.version),n=ui.minor(t.version);return{...t,version:`>=${e}.${n}.0 <${e}.${n+1}.0`}}S();A();k();export{Cl as Bot,Sl as BotDefinition,li as BotLogger,cn as BotSpecificClient,El as Integration,Ka as IntegrationDefinition,ai as IntegrationLogger,ri as IntegrationSpecificClient,Ol as InterfaceDefinition,jl as Plugin,Rl as PluginDefinition,Rj as RuntimeError,uC as WELL_KNOWN_ATTRIBUTES,Oj as isApiError,Lm as messages,Mt as parseBody,bo as serve,WT as version,ne as z};
|
|
93
|
+
`)+" "+K[1]:K[0]+Z+" "+N.join(", ")+" "+K[1]}Te.types=kk();function B(N){return Array.isArray(N)}Te.isArray=B;function T(N){return typeof N=="boolean"}Te.isBoolean=T;function E(N){return N===null}Te.isNull=E;function I(N){return N==null}Te.isNullOrUndefined=I;function D(N){return typeof N=="number"}Te.isNumber=D;function $(N){return typeof N=="string"}Te.isString=$;function ee(N){return typeof N=="symbol"}Te.isSymbol=ee;function Y(N){return N===void 0}Te.isUndefined=Y;function ce(N){return re(N)&&Fe(N)==="[object RegExp]"}Te.isRegExp=ce,Te.types.isRegExp=ce;function re(N){return typeof N=="object"&&N!==null}Te.isObject=re;function Q(N){return re(N)&&Fe(N)==="[object Date]"}Te.isDate=Q,Te.types.isDate=Q;function Ie(N){return re(N)&&(Fe(N)==="[object Error]"||N instanceof Error)}Te.isError=Ie,Te.types.isNativeError=Ie;function Le(N){return typeof N=="function"}Te.isFunction=Le;function Xe(N){return N===null||typeof N=="boolean"||typeof N=="number"||typeof N=="string"||typeof N=="symbol"||typeof N>"u"}Te.isPrimitive=Xe,Te.isBuffer=Ak();function Fe(N){return Object.prototype.toString.call(N)}function ze(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 Re(){var N=new Date,Z=[ze(N.getHours()),ze(N.getMinutes()),ze(N.getSeconds())].join(":");return[N.getDate(),pt[N.getMonth()],Z].join(" ")}Te.log=function(){console.log("%s - %s",Re(),Te.format.apply(Te,arguments))},Te.inherits=Zt(),Te._extend=function(N,Z){if(!Z||!re(Z))return N;for(var K=Object.keys(Z),le=K.length;le--;)N[K[le]]=Z[K[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(K=Z[we],typeof K!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(K,we,{value:K,enumerable:!1,writable:!1,configurable:!0}),K}function K(){for(var le,ge,R=new Promise(function(V,te){le=V,ge=te}),C=[],j=0;j<arguments.length;j++)C.push(arguments[j]);C.push(function(V,te){V?ge(V):le(te)});try{Z.apply(this||oi,C)}catch(V){ge(V)}return R}return Object.setPrototypeOf(K,Object.getPrototypeOf(Z)),we&&Object.defineProperty(K,we,{value:K,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(K,e(Z))},Te.promisify.custom=we;function oe(N,Z){if(!N){var K=new Error("Promise was rejected with a falsy value");K.reason=N,N=K}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 K=[],le=0;le<arguments.length;le++)K.push(arguments[le]);var ge=K.pop();if(typeof ge!="function")throw new TypeError("The last argument must be of type Function");var R=this||oi,C=function(){return ge.apply(R,arguments)};N.apply(this||oi,K).then(function(j){t.nextTick(C.bind(null,null,j))},function(j){t.nextTick(oe.bind(null,j,C))})}return Object.setPrototypeOf(Z,Object.getPrototypeOf(N)),Object.defineProperties(Z,e(N)),Z}return Te.callbackify=de,Te}var se=Ck();se.format;se.deprecate;se.debuglog;se.inspect;se.types;se.isArray;se.isBoolean;se.isNull;se.isNullOrUndefined;se.isNumber;se.isString;se.isSymbol;se.isUndefined;se.isRegExp;se.isObject;se.isDate;se.isError;se.isFunction;se.isPrimitive;se.isBuffer;se.log;se.inherits;se._extend;se.promisify;se.callbackify;var o0=se._extend,a0=se.callbackify,l0=se.debuglog,u0=se.deprecate,c0=se.format,d0=se.inherits,f0=se.inspect,p0=se.isArray,g0=se.isBoolean,m0=se.isBuffer,y0=se.isDate,h0=se.isError,T0=se.isFunction,v0=se.isNull,_0=se.isNullOrUndefined,b0=se.isNumber,w0=se.isObject,x0=se.isPrimitive,P0=se.isRegExp,B0=se.isString,I0=se.isSymbol,E0=se.isUndefined,S0=se.log,k0=se.promisify,A0=se.types,C0=se.TextEncoder=globalThis.TextEncoder,O0=se.TextDecoder=globalThis.TextDecoder;var yr=class{defaultOptions;constructor(e){this.defaultOptions=e}info(...e){this._log("info",e)}debug(...e){this._log("debug",e)}warn(...e){this._log("warn",e)}error(...e){this._log("error",e)}issue(e){console.info(JSON.stringify(e))}_log(e,n){this._getConsoleMethod(e)(this._serializeMessage(n))}_serializeMessage(e){let n=se.format(...e);return G.env.BP_LOG_FORMAT==="json"?this.getJsonMessage(n):n}getJsonMessage(e){return JSON.stringify({msg:e,options:this.defaultOptions})}_getConsoleMethod(e){switch(e){case"debug":return console.debug;case"warn":return console.warn;case"error":return console.error;default:return console.info}}};var ai=class t extends yr{constructor(e){super({visibleToBotOwners:!1,hiddenToIntegrationOwners:!1,...e})}with(e){return new t({...this.defaultOptions,...e})}withUserId(e){return this.with({userId:e})}withConversationId(e){return this.with({conversationId:e})}withVisibleToBotOwners(e){return this.with({visibleToBotOwners:e})}withHiddenToIntegrationOwners(e){return this.with({hiddenToIntegrationOwners:e})}forBot(){return this.with({hiddenToIntegrationOwners:!1,visibleToBotOwners:!0})}forBotOnly(){return this.with({hiddenToIntegrationOwners:!0,visibleToBotOwners:!0})}getJsonMessage(e){return JSON.stringify({msg:e,visible_to_bot_owner:this.defaultOptions.visibleToBotOwners,hidden_to_integration_owner:this.defaultOptions.hiddenToIntegrationOwners,options:this.defaultOptions})}};S();A();k();var Nk=t=>["traceparent","tracestate","sentry-trace"].reduce((e,n)=>(t[n]&&(e[n]=t[n]),e),{}),Dk=(t,e,n)=>{let[,r]=(e.headers.traceparent||"").split("-"),s=new Rk({botId:t.botId,integrationId:t.integrationId,integrationAlias:t.integrationAlias,retry:xs,headers:Nk(e.headers)}),o=new ri(s),i=new ai({traceId:r});return{ctx:t,req:e,client:o,logger:i,instance:n}},Hk=async t=>{let{ctx:e}=t;switch(e.operation){case"webhook_received":return await jk(t);case"register":return await $k(t);case"unregister":return await Zk(t);case"message_created":return await Wk(t);case"action_triggered":return await Fk(t);case"ping":return await Uk(t);case"create_user":return await Lk(t);case"create_conversation":return await Kk(t);default:throw new Mk(`Unknown operation ${e.operation}`)}},DT=t=>async e=>{let n=Qh(e.headers),r=Dk(n,e,t),{logger:s}=r;try{let o;return o=await zk(r),o?{...o,status:o.status??200}:(o=await Hk(r),o?{...o,status:o.status??200}:{status:200})}catch(o){if(Ok(o)){let a=o.type==="Runtime"?o:new NT(o.message,o);return s.forBot().error(a.message),{status:a.code,body:JSON.stringify(a.toJSON())}}console.error(o);let i=new NT("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 s.forBot().error(i.message),{status:i.code,body:JSON.stringify(i.toJSON())}}},Uk=async t=>{},jk=async({client:t,ctx:e,req:n,logger:r,instance:s})=>{let{req:o}=Mt(n);return s.webhook({client:t,ctx:e,req:o,logger:r})},$k=async({client:t,ctx:e,req:n,logger:r,instance:s})=>{if(!s.register)return;let{webhookUrl:o}=Mt(n);await s.register({client:t,ctx:e,webhookUrl:o,logger:r})},Zk=async({client:t,ctx:e,req:n,logger:r,instance:s})=>{if(!s.unregister)return;let{webhookUrl:o}=Mt(n);await s.unregister({ctx:e,webhookUrl:o,client:t,logger:r})},Lk=async({client:t,ctx:e,req:n,logger:r,instance:s})=>{if(!s.createUser)return;let{tags:o}=Mt(n);return await s.createUser({ctx:e,client:t,tags:o,logger:r})},Kk=async({client:t,ctx:e,req:n,logger:r,instance:s})=>{if(!s.createConversation)return;let{channel:o,tags:i}=Mt(n);return await s.createConversation({ctx:e,client:t,channel:o,tags:i,logger:r})},Wk=async({ctx:t,req:e,client:n,logger:r,instance:s})=>{let{conversation:o,user:i,type:a,payload:l,message:c}=Mt(e),f=s.channels[o.channel];if(!f)throw new Error(`Channel ${o.channel} not found`);let g=f.messages[a];if(!g)throw new Error(`Message of type ${a} not found in channel ${o.channel}`);await g({ctx:t,conversation:o,message:c,user:i,type:a,client:n,payload:l,ack:async({tags:h})=>{await n.updateMessage({id:c.id,tags:h})},logger:r})},Fk=async({req:t,ctx:e,client:n,logger:r,instance:s})=>{let{input:o,type:i}=Mt(t);if(!i)throw new Error("Missing action type");let a=s.actions[i];if(!a)throw new Error(`Action ${i} not found`);let l=new Ps,f={output:await a({ctx:e,input:o,client:n,type:i,logger:r,metadata:l}),meta:l.toJSON()};return{body:JSON.stringify(f)}},zk=async({instance:t,client:e,ctx:n,logger:r,req:s})=>{let o=t.unknownOperationHandler;if(o)return await o({client:e,ctx:n,logger:r,req:s})};var El=class{constructor(e){this.props=e;this.actions=e.actions,this.channels=e.channels,this.register=e.register,this.unregister=e.unregister,this.createUser=e.createUser,this.createConversation=e.createConversation,this.webhook=e.handler,this.unknownOperationHandler=e.__advanced?.unknownOperationHandler}actions;channels;register;unregister;createUser;createConversation;webhook;unknownOperationHandler;handler=DT(this);start=e=>_s(this.handler,e)};S();A();k();S();A();k();S();A();k();S();A();k();var Sl=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:_n}}addIntegration(e,n){let r=this;r.integrations||(r.integrations={});let s=n?.alias??e.name;if(r.integrations[s])throw new Error(`Another integration with alias "${s}" is already installed in the bot`);return r.integrations[s]={...e,alias:s,enabled:n?.enabled,configurationType:n&&"configurationType"in n?n.configurationType:void 0,configuration:n&&"configuration"in n?n.configuration??{}:{},disabledChannels:n?.disabledChannels},this}addPlugin(e,n){let r=this;r.plugins||(r.plugins={});let s=n.alias??e.name;if(r.plugins[s])throw new Error(`Another plugin with alias "${s}" is already installed in the bot`);let o=Object.fromEntries(Object.entries(n.dependencies??{}).filter(([a,l])=>"integrationInterfaceAlias"in l).map(([a,l])=>{let c=this.integrations?.[l.integrationAlias];if(!c){let g=Object.keys(this.integrations??{}).join(", ")||"(none)";throw new Error(`Interface with alias "${a}" of plugin with alias "${s}" references integration with alias "${l.integrationAlias}" which is not installed. Please make sure to add the integration via addIntegration() before calling addPlugin().
|
|
94
|
+
Available integration aliases: ${g}`)}let f=c.definition.interfaces?.[l.integrationInterfaceAlias];if(!f){let g=Object.keys(c.definition.interfaces??{}).join(", ")||"(none)";throw new Error(`Interface with alias "${l.integrationInterfaceAlias}" does not exist in integration "${c.name}" referenced by interface with alias "${a}" of plugin with alias "${s}".
|
|
95
|
+
Available interface aliases: ${g}`)}return[a,{...f,id:c.id,name:c.name,version:c.version,...l}]})),i=Object.fromEntries(Object.entries(n.dependencies??{}).filter(([a,l])=>!("integrationInterfaceAlias"in l)).map(([a,l])=>{let c=this.integrations?.[l.integrationAlias];if(!c){let f=Object.keys(this.integrations??{}).join(", ")||"(none)";throw new Error(`Integration with alias "${a}" of plugin with alias "${s}" references integration with alias "${l.integrationAlias}" which is not installed. Please make sure to add the integration via addIntegration() before calling addPlugin().
|
|
96
|
+
Available integration aliases: ${f}`)}return[a,{...c,...l}]}));return r.plugins[s]={...e,alias:s,configuration:n.configuration??{},interfaces:o,integrations:i},r.withPlugins.user=this._mergeUser(r.withPlugins.user,e.definition.user),r.withPlugins.conversation=this._mergeConversation(r.withPlugins.conversation,e.definition.conversation),r.withPlugins.message=this._mergeMessage(r.withPlugins.message,e.definition.message),r.withPlugins.recurringEvents=this._mergeRecurringEvents(r.withPlugins.recurringEvents,e.definition.recurringEvents),r.withPlugins.tables=this._mergeTables(r.withPlugins.tables,e.definition.tables),r.withPlugins.workflows=this._mergeWorkflows(r.withPlugins.workflows,e.definition.workflows),r.withPlugins.states=this._mergeStates(r.withPlugins.states,this._prefixKeysWithPluginAlias(e.definition.states,s)),r.withPlugins.events=this._mergeEvents(r.withPlugins.events,this._prefixKeysWithPluginAlias(e.definition.events,s)),r.withPlugins.actions=this._mergeActions(r.withPlugins.actions,this._prefixKeysWithPluginAlias(e.definition.actions,s)),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)=>je.mapKeys(e??{},r=>`${n}${Nt}${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,s]of n){let o=Object.entries(s.interfaces??{});for(let[i,a]of o){let l=this.integrations?.[a.integrationAlias];if(!l)throw new Error(`Interface with alias "${i}" of plugin with alias "${r}" references integration "${a.name}" which is not installed`);let c=Object.entries(a.entities??{});for(let[f,{name:g}]of c){let p=l.definition.entities?.[g]?.schema;if(!p)throw new Error(`Interface entity "${g}" does not exist in integration "${l.name}"`);e[`interface:${i}/entities/${f}`]=p}}}return e}_dereferenceZuiSchema(e,n){return e.dereference(n)}_dereferenceDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,s])=>[r,this._dereferenceDefinitionSchema(s,n)]))}_dereferenceDefinitionSchema(e,n){return e&&{...e,schema:this._dereferenceZuiSchema(e.schema,n)}}_dereferenceActionDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,s])=>[r,{...s,input:{schema:this._dereferenceZuiSchema(s.input.schema,n)},output:{schema:this._dereferenceZuiSchema(s.output.schema,n)}}]))}};S();A();k();S();A();k();import{isApiError as Xk,Client as Qk,RuntimeError as jT}from"@botpress/client";S();A();k();var li=class t extends yr{constructor(e){super({...e})}with(e){return new t({...this.defaultOptions,...e})}withUserId(e){return this.with({userId:e})}withConversationId(e){return this.with({conversationId:e})}withWorkflowId(e){return this.with({workflowId:e})}withEventId(e){return this.with({eventId:e})}withMessageId(e){return this.with({messageId:e})}};S();A();k();S();A();k();var cn=class{constructor(e,n={before:{},after:{}}){this._client=e;this._hooks=n}get _inner(){return this._client}getConversation=(e=>this._run("getConversation",e));listConversations=(e=>this._run("listConversations",e));updateConversation=(e=>this._run("updateConversation",e));deleteConversation=(e=>this._run("deleteConversation",e));listParticipants=(e=>this._run("listParticipants",e));addParticipant=(e=>this._run("addParticipant",e));getParticipant=(e=>this._run("getParticipant",e));removeParticipant=(e=>this._run("removeParticipant",e));createEvent=(e=>this._run("createEvent",e));getEvent=(e=>this._run("getEvent",e));listEvents=(e=>this._run("listEvents",e));createMessage=(e=>this._run("createMessage",e));getOrCreateMessage=(e=>this._run("getOrCreateMessage",e));getMessage=(e=>this._run("getMessage",e));updateMessage=(e=>this._run("updateMessage",e));listMessages=(e=>this._run("listMessages",e));deleteMessage=(e=>this._run("deleteMessage",e));getUser=(e=>this._run("getUser",e));listUsers=(e=>this._run("listUsers",e));updateUser=(e=>this._run("updateUser",e));deleteUser=(e=>this._run("deleteUser",e));getState=(e=>this._run("getState",e));setState=(e=>this._run("setState",e));getOrSetState=(e=>this._run("getOrSetState",e));patchState=(e=>this._run("patchState",e));callAction=(e=>this._run("callAction",e));uploadFile=(e=>this._run("uploadFile",e));upsertFile=(e=>this._run("upsertFile",e));deleteFile=(e=>this._run("deleteFile",e));listFiles=(e=>this._run("listFiles",e));getFile=(e=>this._run("getFile",e));updateFileMetadata=(e=>this._run("updateFileMetadata",e));searchFiles=(e=>this._run("searchFiles",e));trackAnalytics=(e=>this._run("trackAnalytics",e));getTableRow=(e=>this._run("getTableRow",e));createTableRows=(e=>this._run("createTableRows",e));findTableRows=(e=>this._run("findTableRows",e));deleteTableRows=(e=>this._run("deleteTableRows",e));updateTableRows=(e=>this._run("updateTableRows",e));upsertTableRows=(e=>this._run("upsertTableRows",e));createWorkflow=(e=>this._run("createWorkflow",e));getOrCreateWorkflow=(e=>this._run("getOrCreateWorkflow",e));getWorkflow=(e=>this._run("getWorkflow",e));updateWorkflow=(e=>this._run("updateWorkflow",e));deleteWorkflow=(e=>this._run("deleteWorkflow",e));listWorkflows=(e=>this._run("listWorkflows",e));createConversation=e=>this._client.createConversation(e);getOrCreateConversation=e=>this._client.getOrCreateConversation(e);createUser=e=>this._client.createUser(e);getOrCreateUser=e=>this._client.getOrCreateUser(e);_run=async(e,n)=>{let r=this._hooks.before[e];r&&(n=await r(n));let s=await this._client[e](n),o=this._hooks.after[e];return o&&(s=await o(s,n)),s}};S();A();k();var qk=ne.enum(["event_received","register","unregister","ping","action_triggered"]),HT=t=>({botId:t[Bs]||It("Missing bot id header"),operation:qk.parse(t[Es]),type:t[Xh]||It("Missing type header"),configuration:JSON.parse(z.from(t[Is]||It("Missing configuration header"),"base64").toString("utf-8"))});S();A();k();var ct={status:200};S();A();k();S();A();k();var kl=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 Gk=["child_workflow_deleted","child_workflow_finished","workflow_timedout","workflow_started","workflow_continued"],UT=async(t,e)=>{if(t.ctx.type!=="workflow_update"||!Gk.includes(e.payload.type))throw new Error("Unexpected event type");let n={...t,logger:Vk(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 Jk(n,e);default:e.payload.type}return ct},Vk=(t,e)=>t.logger.with({eventId:e.id,workflowId:e.payload.workflow.id,conversationId:e.payload.conversation?.id,userId:e.payload.user?.id}),Jk=async(t,e)=>{let n=kl(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:s}=await Yk(t,e);return s.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},Yk=async(t,e)=>{let n=kl(e.payload.type),r=t.self.workflowHandlers[n]?.[e.payload.workflow.name],s=structuredClone(e.payload.workflow);for(let o of r??[])s=await o({...t,event:e,conversation:e.payload.conversation,user:e.payload.user,workflow:s});return{updatedWorkflow:s}};S();A();k();var $T=t=>async e=>{let n=HT(e.headers),r=new li,s=new Qk({botId:n.botId,retry:xs}),o=new cn(s,{before:{createMessage:async a=>{let l=t.hookHandlers.before_outgoing_message[a.type]??[];for(let c of l){let f=new cn(s);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 cn(s);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 cn(s);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 g of f){let p=new cn(s);a=(await g({client:p,ctx:n,logger:r,data:{type:c,...a}}))?.data??a}return a}}}),i={req:e,ctx:n,logger:r,client:o,self:t};try{switch(n.operation){case"action_triggered":return await iA(i);case"event_received":return await rA(i);case"register":return await tA(i);case"unregister":return await nA(i);case"ping":return await eA(i);default:throw new Error(`Unknown operation ${n.operation}`)}}catch(a){let l=a instanceof Error?a:new Error(String(a));if(Xk(l)){let f=l.type==="Runtime"?l:new jT(l.message,l);return r.error(f.message),{status:f.code,body:JSON.stringify(f.toJSON())}}let c=new jT("An unexpected error occurred in the bot.",l);return r.error(c.message,l),{status:c.code,body:JSON.stringify(c.toJSON())}}},eA=async t=>ct,tA=async t=>(await t.self.registerHandler?.({client:t.client,ctx:t.ctx,logger:t.logger}),ct),nA=async t=>ct,rA=async t=>{let{ctx:e,logger:n,req:r,client:s,self:o}=t,i={client:s,ctx:e,logger:n},a=Mt(r);if(i.logger=i.logger.with({eventId:a.event.id,messageId:a.event.messageId,conversationId:a.event.conversationId,userId:a.event.userId}),e.type==="workflow_update")return await UT(t,a.event);if(e.type==="message_created"){let h=a.event,_=h.payload.message;i.logger=i.logger.with({messageId:_.id,conversationId:_.conversationId,userId:_.userId});let P=o.hookHandlers.before_incoming_message[_.type]??[];for(let I of P){let D=await I({...i,data:_});if(_=D?.data??_,D?.stop)return ct}let B={...i,user:h.payload.user,conversation:h.payload.conversation,message:_,event:h},T=o.messageHandlers[_.type]??[];for(let I of T)await I(B);let E=o.hookHandlers.after_incoming_message[_.type]??[];for(let I of E){let D=await I({...i,data:_});if(_=D?.data??_,D?.stop)return ct}return ct}if(e.type==="state_expired"){let _=a.event.payload.state,P={...i,state:_},B=o.stateExpiredHandlers[_.name]??[];for(let T of B)await T(P);return ct}let l=a.event,c=o.hookHandlers.before_incoming_event[l.type]??[];for(let h of c){let _=await h({...i,data:l});if(l=_?.data??l,_?.stop)return ct}let f={...i,event:l},g=o.eventHandlers[l.type]??[];for(let h of g)await h(f);let p=o.hookHandlers.after_incoming_event[l.type]??[];for(let h of p){let _=await h({...i,data:l});if(l=_?.data??l,_?.stop)return ct}return ct},iA=async({ctx:t,logger:e,req:n,client:r,self:s})=>{let{input:o,type:i}=Mt(n);if(!i)throw new Error("Missing action type");let a=s.hookHandlers.before_incoming_call_action[i]??[];for(let p of a){let h=await p({ctx:t,logger:e,client:r,data:{type:i,input:o}});o=h?.data?.input??o,i=h?.data?.type??i}let l=s.actionHandlers[i];if(!l)throw new Error(`Action ${i} not found`);let c=await l({ctx:t,logger:e,input:o,client:r,type:i}),f=s.hookHandlers.after_incoming_call_action[i]??[];for(let p of f){let h=await p({ctx:t,logger:e,client:r,data:{type:i,output:c}});i=h?.data?.type??i,c=h?.data?.output??c}return{status:200,body:JSON.stringify({output:c})}};S();A();k();S();A();k();S();A();k();var Ft=(t,{alias:e})=>{if(!("tags"in t)||!e)return t;let n=`${e}${Nt}`,r=Object.fromEntries(Object.entries(t.tags??{}).flatMap(([s,o])=>s.startsWith(n)?[[s.slice(n.length),o]]:[]));return{...t,tags:r}},ft=(t,{alias:e})=>{if(!("tags"in t)||!e)return t;let n=`${e}${Nt}`,r=Object.fromEntries(Object.entries(t.tags??{}).map(([s,o])=>[s.startsWith(n)?s:`${n}${s}`,o]));return{...t,tags:r}};S();A();k();var Al=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 s=await this.next();if(s.done)break;n.push(s.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 Al(t);var dn=t=>new Proxy({},{get:(e,n)=>({listInstances:r=>Et(({nextToken:s})=>t.client.listWorkflows({...r,name:n,nextToken:s}).then(({meta:o,workflows:i})=>({meta:o,items:i.map(a=>St({...t,workflow:a}))}))),startNewInstance:async r=>{let{workflow:s}=await t.client.createWorkflow({name:n,status:"pending",...ft(r,{alias:void 0})});return{workflow:St({...t,workflow:s})}}})}),St=t=>{let e=!1;return{...Ft(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:St({...t,workflow:r})}},async acknowledgeStartOfProcessing(){if(!t.event||t.workflow.status!=="pending"||e)return{workflow:St(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:St({...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:St({...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:St({...t,workflow:r})}},async cancel(){let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,status:"cancelled"});return await t.onWorkflowUpdate?.(n),{workflow:St({...t,workflow:n})}}}};S();A();k();var Cl=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(s=>r({...s,workflows:dn(s)}),r.name);for(let[s,o]of Object.entries(this._plugins)){let[i,a]=n.split(Nt);if(!(i!==s||!a))return o.actionHandlers[a]}}})}get messageHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(a=>a.messageHandlers[n]??[]),s=n==="*"?[]:this._messageHandlers[n]??[],o=this._messageHandlers["*"]??[],i=[...s,...o].sort((a,l)=>a.order-l.order).map(({handler:a})=>ut.setName(l=>a({...l,workflows:dn(l)}),a.name));return ue.unique([...r,...i])}})}get eventHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(a=>a.eventHandlers[n]??[]),s=n==="*"?[]:this._eventHandlers[n]??[],o=this._eventHandlers["*"]??[],i=[...s,...o].sort((a,l)=>a.order-l.order).map(({handler:a})=>ut.setName(l=>a({...l,workflows:dn(l)}),a.name));return ue.unique([...r,...i])}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(a=>a.stateExpiredHandlers[n]??[]),s=n==="*"?[]:this._stateExpiredHandlers[n]??[],o=this._stateExpiredHandlers["*"]??[],i=[...s,...o].sort((a,l)=>a.order-l.order).map(({handler:a})=>ut.setName(l=>a({...l,workflows:dn(l)}),a.name));return ue.unique([...r,...i])}})}get hookHandlers(){return new Proxy({},{get:(e,n)=>{if(this._hookHandlers[n])return new Proxy({},{get:(s,o)=>{let i=Object.values(this._plugins).flatMap(g=>g.hookHandlers[n]?.[o]??[]),a=this._hookHandlers[n]??{},l=o==="*"?[]:a[o]??[],c=a["*"]??[],f=[...l,...c].sort((g,p)=>g.order-p.order).map(({handler:g})=>ut.setName(p=>g({...p,workflows:dn(p)}),g.name));return ue.unique([...i,...f])}})}})}get workflowHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._workflowHandlers[n];if(r)return new Proxy({},{get:(s,o)=>{let i=r[o]?.sort((l,c)=>l.order-c.order).map(({handler:l})=>ut.setName(async c=>{let f=c.workflow;return await l({...c,workflow:St({...c,onWorkflowUpdate(g){f=g}}),workflows:dn(c)}),f},l.name))??[],a=Object.values(this._plugins).flatMap(l=>l.workflowHandlers[n]?.[o]??[]);return ue.unique([...i,...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=$T(this);start=e=>_s(this.handler,e)};S();A();k();S();A();k();S();A();k();S();A();k();S();A();k();var Ol=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?{}:je.mapValues(e.events,i=>({...i,schema:i.schema(n)})),s=e.actions===void 0?{}:je.mapValues(e.actions,i=>({...i,input:{...i.input,schema:i.input.schema(n)},output:{...i.output,schema:i.output.schema(n)}})),o=e.channels===void 0?{}:je.mapValues(e.channels,i=>({...i,messages:je.mapValues(i.messages,a=>({...a,schema:a.schema(n)}))}));this.events=r,this.actions=s,this.channels=o}name;version;title;description;icon;readme;attributes;entities;events;actions;channels;__advanced;get metadata(){return{sdkVersion:_n}}_getEntityReference=e=>{let n={};for(let[r,s]of Object.entries(e)){let o=s.schema._def["x-zui"]?.title,i=s.schema._def.description,a=ne.ref(r);o&&a.title(o),i&&a.describe(i),n[r]=a}return n}};S();A();k();S();A();k();S();A();k();S();A();k();var Rl=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(([i])=>[i,ne.ref(`interface:${s}/entities/${i}`)]))]));this.name=e.name,this.version=e.version,this.icon=e.icon,this.readme=e.readme,this.title=e.title,this.description=e.description,this.integrations=e.integrations,this.interfaces=e.interfaces,this.user=e.user,this.conversation=e.conversation,this.message=e.message,this.recurringEvents=e.recurringEvents,this.workflows=e.workflows,this.attributes=e.attributes,this.__advanced=e.__advanced;let r=new Set;for(let s of[...Object.keys(e.integrations??{}),...Object.keys(e.interfaces??{})]){if(r.has(s))throw new Error(`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})}])),this.events=Object.fromEntries(Object.entries(e.events??{}).map(([s,o])=>[s,{...o,schema:typeof o.schema=="object"?o.schema:o.schema({entities:n})}])),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:_n}}dereferenceEntities({intersectWithUnknownRecord:e}={intersectWithUnknownRecord:!0}){let n=this._buildZuiReferenceMap(e);return{...this,configuration:this.configuration?{...this.configuration,schema:this._dereferenceZuiSchema(this.configuration.schema,n)}:void 0,events:this._dereferenceDefinitionSchemas(this.events,n),states:this._dereferenceDefinitionSchemas(this.states,n),tables:this._dereferenceDefinitionSchemas(this.tables,n),actions:this._dereferenceActionDefinitionSchemas(this.actions,n)}}_buildZuiReferenceMap(e){return Object.fromEntries(Object.entries(this.interfaces??{}).flatMap(([n,r])=>Object.entries(r.definition.entities??{}).map(([s,o])=>[`interface:${n}/entities/${s}`,e?o.schema.and(ne.record(ne.string(),ne.unknown())):o.schema])))}_dereferenceZuiSchema(e,n){return e.dereference(n)}_dereferenceDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,s])=>[r,{...s,schema:this._dereferenceZuiSchema(s.schema,n)}]))}_dereferenceActionDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,s])=>[r,{...s,input:{schema:this._dereferenceZuiSchema(s.input.schema,n)},output:{schema:this._dereferenceZuiSchema(s.output.schema,n)}}]))}};S();A();k();S();A();k();S();A();k();var ZT=(t,e)=>new Proxy({},{get:(n,r)=>new Proxy({},{get:(s,o)=>i=>{let a=(e.integrations[r]??e.interfaces[r])?.integrationAlias,l=e.interfaces[r]?.actions?.[o]?.name??o;return t.callAction({type:`${a}:${l}`,input:i}).then(c=>c.output)}})});S();A();k();S();A();k();S();A();k();S();A();k();var Ml=t=>({async getById({id:e}){let n=await t.client.getMessage({id:e});return Dt({...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:s})=>({meta:r,items:s.map(o=>Dt({...t,message:o}))})))}}),Dt=t=>({...Ft(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 Dt({...t,message:n})}});S();A();k();S();A();k();var Nl=t=>({list(e){return Et(({nextToken:n})=>t.client.listUsers({...ft(e??{},{alias:t.pluginAlias}),nextToken:n}).then(({meta:r,users:s})=>({meta:r,items:s.map(o=>zt({...t,conversationId:e?.conversationId,user:o}))})))},async getById({id:e}){let n=await t.client.getUser({id:e});return zt({...t,user:n.user,conversationId:void 0})}}),zt=t=>{let e={...Ft(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 zt({...t,user:r})}};return t.conversationId?{...e,async removeFromConversation(){return await t.client.removeParticipant({id:t.conversationId,userId:t.user.id}),zt({...t,conversationId:void 0})}}:{...e,async addToConversation({conversationId:n}){let{participant:r}=await t.client.addParticipant({id:n,userId:t.user.id});return zt({...t,user:r,conversationId:n})}}};S();A();k();var Dl=t=>new Proxy({},{get:(e,n)=>new Proxy({},{get:(r,s)=>({list(o){let i=t.plugin?.interfaces[n]?.integrationAlias??t.plugin?.integrations[n]?.integrationAlias,a=t.plugin?.interfaces[n]?.channels?.[s]?.name??s;return Et(({nextToken:l})=>t.client.listConversations({...ft(o??{},{alias:t.plugin?.alias}),channel:a==="*"?void 0:a,integrationName:i==="*"?void 0:i,nextToken:l}).then(({meta:c,conversations:f})=>({meta:c,items:f.map(g=>hr({...t,conversation:g}))})))},async getById({id:o}){let i=await t.client.getConversation({id:o});return hr({...t,conversation:i.conversation})}})})}),hr=t=>{let e=t.client;return{...Ft(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 hr({...t,conversation:r})},async getMessage({id:n}){let r=await e.getMessage({id:n});return Dt({...t,message:r.message})},async getOrCreateMessage(n){let{message:r}=await e.getOrCreateMessage({...ft(n,{alias:t.plugin?.alias}),conversationId:t.conversation.id});return Dt({...t,message:r})},async createMessage(n){let{message:r}=await e.createMessage({...ft(n,{alias:t.plugin?.alias}),conversationId:t.conversation.id});return Dt({...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:s,messages:o})=>({meta:s,items:o.map(i=>Dt({...t,message:i}))})))},listParticipants(){return Et(({nextToken:n})=>e.listParticipants({id:t.conversation.id,nextToken:n}).then(({meta:r,participants:s})=>({meta:r,items:s.map(o=>zt({...t,user:o,conversationId:t.conversation.id}))})))}}};S();A();k();S();A();k();S();A();k();var Hl=class t{constructor(e){this._props=e}async emit(e){let{conversationId:n,userId:r,messageId:s}=this._props,{event:o}=await this._props.client.createEvent({type:this._props.eventName,payload:e,conversationId:n,userId:r,messageId:s});return o}async schedule(e,n){let{conversationId:r,userId:s,messageId:o}=this._props,{event:i}=await this._props.client.createEvent({type:this._props.eventName,payload:e,conversationId:r,userId:s,messageId:o,schedule:n});return i}withConversationId(e){return new t({...this._props,conversationId:e})}withUserId(e){return new t({...this._props,userId:e})}withMessageId(e){return new t({...this._props,messageId:e})}async getById(e){return(await this._props.client.getEvent({id:e.id})).event}list(e){return 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:s})=>({meta:r,items:s})))}},LT=(t,e)=>new Proxy({},{get:(n,r)=>{let s=e.alias!==void 0?`${e.alias}${Nt}${r}`:r;return new Hl({client:t,eventName:s})}});S();A();k();S();A();k();S();A();k();S();A();k();S();A();k();var Ul=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(s=>s.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})}},KT=(t,e)=>new Proxy({},{get:(n,r)=>new Proxy({},{get:(s,o)=>{let i=e.alias!==void 0?`${e.alias}${Nt}${o}`:o;return new Ul(t,r,i)}})});S();A();k();var jl=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:s,alias:o}=this._runtime,i=ZT(e,this._runtime),a=KT(e,this._runtime),l=dn({client:e,pluginAlias:this._runtime.alias}),c=LT(e,this._runtime),f=Nl({client:e,pluginAlias:this._runtime.alias}),g=Dl({client:e,plugin:this._runtime}),p=Ml({client:e,plugin:this._runtime});return{configuration:n,interfaces:r,integrations:s,actions:i,states:a,alias:o,workflows:l,events:c,users:f,conversations:g,messages:p}}get actionHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._actionHandlers[n];if(r)return ut.setName(s=>r({...s,...this._getTools(s.client)}),r.name)}})}get messageHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=n==="*"?[]:this._messageHandlers[n]??[],s=this._messageHandlers["*"]??[];return ue.unique([...r,...s]).sort((i,a)=>i.order-a.order).map(({handler:i})=>ut.setName(a=>i({...a,user:zt({...a,conversationId:a.conversation.id,pluginAlias:this._runtime.alias}),message:Dt({...a,plugin:this._runtime,message:a.message}),conversation:hr({...a,plugin:this._runtime,conversation:a.conversation}),...this._getTools(a.client)}),i.name))}})}get eventHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=n==="*"?[]:this._eventHandlers[n]??[],s=Object.entries(this._eventHandlers).filter(([a])=>this._eventResolvesTo(a,n)).flatMap(([,a])=>a??[]),o=this._eventHandlers["*"]??[];return ue.unique([...r,...s,...o]).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]??[],s=this._stateExpiredHandlers["*"]??[];return ue.unique([...r,...s]).sort((i,a)=>i.order-a.order).map(({handler:i})=>ut.setName(a=>i({...a,...this._getTools(a.client)}),i.name))}})}get hookHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._hookHandlers[n];if(r)return new Proxy({},{get:(s,o)=>{o=this._stripAliasPrefix(o);let i=o==="*"?[]:r[o]??[],a=Object.entries(r).filter(([f])=>this._eventResolvesTo(f,o)).flatMap(([,f])=>f??[]),l=r["*"]??[];return ue.unique([...i,...a,...l]).sort((f,g)=>f.order-g.order).map(({handler:f})=>ut.setName(g=>f({...g,data:Ft(g.data,{alias:this._runtime.alias}),...this._getTools(g.client)}),f.name))}})}})}get workflowHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._workflowHandlers[n];if(r)return new Proxy({},{get:(s,o)=>(r[o]?.sort((a,l)=>a.order-l.order)??[]).map(({handler:a})=>ut.setName(async l=>{let c=l.workflow;return await a({...l,workflow:St({...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[s,o]=e.split(":");if(!s||!o)return!1;let i=this._runtime.interfaces[s];if(i&&n===`${i.integrationAlias}:${i?.events?.[o]?.name}`)return!0;let a=this._runtime.integrations[s];return!!(a&&n===`${a.integrationAlias}:${o}`)};_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 WT={};bn(WT,{allWithinMajorOf:()=>sA,allWithinMinorOf:()=>oA});S();A();k();import*as ui from"semver";function sA(t){let e=ui.major(t.version);return{...t,version:`>=${e}.0.0 <${e+1}.0.0`}}function oA(t){let e=ui.major(t.version),n=ui.minor(t.version);return{...t,version:`>=${e}.${n}.0 <${e}.${n+1}.0`}}S();A();k();export{Cl as Bot,Sl as BotDefinition,li as BotLogger,cn as BotSpecificClient,El as Integration,Ka as IntegrationDefinition,ai as IntegrationLogger,ri as IntegrationSpecificClient,Ol as InterfaceDefinition,jl as Plugin,Rl as PluginDefinition,Rj as RuntimeError,uC as WELL_KNOWN_ATTRIBUTES,Oj as isApiError,Lm as messages,Mt as parseBody,_s as serve,WT as version,ne as z};
|
|
97
97
|
/*! Bundled license information:
|
|
98
98
|
|
|
99
99
|
lodash-es/lodash.js:
|