@fern-api/typescript-dynamic-snippets 3.75.1 → 3.75.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var qr=Object.defineProperty;var fs=(n,e,t)=>e in n?qr(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var ot=(n,e,t)=>()=>{if(t)throw t[0];try{return n&&(e=n(n=0)),e}catch(r){throw t=[r],r}};var he=(n,e)=>{for(var t in e)qr(n,t,{get:e[t],enumerable:!0})};var E=(n,e,t)=>fs(n,typeof e!="symbol"?e+"":e,t);var p=ot(()=>{"use strict"});var v={};he(v,{_debugEnd:()=>On,_debugProcess:()=>Bn,_events:()=>Yn,_eventsCount:()=>Xn,_exiting:()=>mn,_fatalExceptions:()=>Sn,_getActiveHandles:()=>xn,_getActiveRequests:()=>gn,_kill:()=>bn,_linkedBinding:()=>dn,_maxListeners:()=>Jn,_preload_modules:()=>Zn,_rawDebug:()=>ln,_startProfilerIdleNotifier:()=>Ln,_stopProfilerIdleNotifier:()=>Pn,_tickCallback:()=>Fn,abort:()=>$n,addListener:()=>Kn,allowedNodeEnvironmentFlags:()=>In,arch:()=>Jr,argv:()=>Kr,argv0:()=>zn,assert:()=>An,binding:()=>nn,browser:()=>cn,chdir:()=>on,config:()=>hn,cpuUsage:()=>Jt,cwd:()=>sn,debugPort:()=>qn,default:()=>oi,dlopen:()=>yn,domain:()=>fn,emit:()=>ni,emitWarning:()=>rn,env:()=>Xr,execArgv:()=>Qr,execPath:()=>Wn,exit:()=>kn,features:()=>Rn,hasUncaughtExceptionCaptureCallback:()=>Cn,hrtime:()=>Ht,kill:()=>Tn,listeners:()=>si,memoryUsage:()=>_n,moduleLoadList:()=>pn,nextTick:()=>Zr,off:()=>ei,on:()=>we,once:()=>Qn,openStdin:()=>En,pid:()=>Dn,platform:()=>Yr,ppid:()=>Vn,prependListener:()=>ii,prependOnceListener:()=>ai,reallyExit:()=>vn,release:()=>un,removeAllListeners:()=>ri,removeListener:()=>ti,resourceUsage:()=>wn,setSourceMapsEnabled:()=>Gn,setUncaughtExceptionCaptureCallback:()=>Nn,stderr:()=>Mn,stdin:()=>Un,stdout:()=>jn,title:()=>Hr,umask:()=>an,uptime:()=>Hn,version:()=>en,versions:()=>tn});function hr(n){throw new Error("Node.js process "+n+" is not supported by JSPM core outside of Node.js")}function ms(){!ut||!Pe||(ut=!1,Pe.length?be=Pe.concat(be):Gt=-1,be.length&&zr())}function zr(){if(!ut){var n=setTimeout(ms,0);ut=!0;for(var e=be.length;e;){for(Pe=be,be=[];++Gt<e;)Pe&&Pe[Gt].run();Gt=-1,e=be.length}Pe=null,ut=!1,clearTimeout(n)}}function Zr(n){var e=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)e[t-1]=arguments[t];be.push(new Gr(n,e)),be.length===1&&!ut&&setTimeout(zr,0)}function Gr(n,e){this.fun=n,this.array=e}function Q(){}function dn(n){hr("_linkedBinding")}function yn(n){hr("dlopen")}function gn(){return[]}function xn(){return[]}function An(n,e){if(!n)throw new Error(e||"assertion error")}function Cn(){return!1}function Hn(){return Se.now()/1e3}function Ht(n){var e=Math.floor((Date.now()-Se.now())*.001),t=Se.now()*.001,r=Math.floor(t)+e,a=Math.floor(t%1*1e9);return n&&(r=r-n[0],a=a-n[1],a<0&&(r--,a+=mr)),[r,a]}function we(){return oi}function si(n){return[]}var be,ut,Pe,Gt,Hr,Jr,Yr,Xr,Kr,Qr,en,tn,rn,nn,an,sn,on,un,cn,ln,pn,fn,mn,hn,vn,bn,Jt,wn,_n,Tn,kn,En,In,Rn,Sn,Nn,Fn,Bn,On,Ln,Pn,jn,Mn,Un,$n,Dn,Vn,Wn,qn,zn,Zn,Gn,Se,fr,mr,Jn,Yn,Xn,Kn,Qn,ei,ti,ri,ni,ii,ai,oi,ui=ot(()=>{"use strict";p();f();d();be=[],ut=!1,Gt=-1;Gr.prototype.run=function(){this.fun.apply(null,this.array)};Hr="browser",Jr="x64",Yr="browser",Xr={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},Kr=["/usr/bin/node"],Qr=[],en="v16.8.0",tn={},rn=function(n,e){console.warn((e?e+": ":"")+n)},nn=function(n){hr("binding")},an=function(n){return 0},sn=function(){return"/"},on=function(n){},un={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};cn=!0,ln=Q,pn=[];fn={},mn=!1,hn={};vn=Q,bn=Q,Jt=function(){return{}},wn=Jt,_n=Jt,Tn=Q,kn=Q,En=Q,In={};Rn={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Sn=Q,Nn=Q;Fn=Q,Bn=Q,On=Q,Ln=Q,Pn=Q,jn=void 0,Mn=void 0,Un=void 0,$n=Q,Dn=2,Vn=1,Wn="/bin/usr/node",qn=9229,zn="node",Zn=[],Gn=Q,Se={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};Se.now===void 0&&(fr=Date.now(),Se.timing&&Se.timing.navigationStart&&(fr=Se.timing.navigationStart),Se.now=()=>Date.now()-fr);mr=1e9;Ht.bigint=function(n){var e=Ht(n);return typeof BigInt>"u"?e[0]*mr+e[1]:BigInt(e[0]*mr)+BigInt(e[1])};Jn=10,Yn={},Xn=0;Kn=we,Qn=we,ei=we,ti=we,ri=we,ni=Q,ii=we,ai=we;oi={version:en,versions:tn,arch:Jr,platform:Yr,browser:cn,release:un,_rawDebug:ln,moduleLoadList:pn,binding:nn,_linkedBinding:dn,_events:Yn,_eventsCount:Xn,_maxListeners:Jn,on:we,addListener:Kn,once:Qn,off:ei,removeListener:ti,removeAllListeners:ri,emit:ni,prependListener:ii,prependOnceListener:ai,listeners:si,domain:fn,_exiting:mn,config:hn,dlopen:yn,uptime:Hn,_getActiveRequests:gn,_getActiveHandles:xn,reallyExit:vn,_kill:bn,cpuUsage:Jt,resourceUsage:wn,memoryUsage:_n,kill:Tn,exit:kn,openStdin:En,allowedNodeEnvironmentFlags:In,assert:An,features:Rn,_fatalExceptions:Sn,setUncaughtExceptionCaptureCallback:Nn,hasUncaughtExceptionCaptureCallback:Cn,emitWarning:rn,nextTick:Zr,_tickCallback:Fn,_debugProcess:Bn,_debugEnd:On,_startProfilerIdleNotifier:Ln,_stopProfilerIdleNotifier:Pn,stdout:jn,stdin:Un,stderr:Mn,abort:$n,umask:an,chdir:on,cwd:sn,env:Xr,title:Hr,argv:Kr,execArgv:Qr,pid:Dn,ppid:Vn,execPath:Wn,debugPort:qn,hrtime:Ht,argv0:zn,_preload_modules:Zn,setSourceMapsEnabled:Gn}});var d=ot(()=>{"use strict";ui()});function hs(){if(ci)return At;ci=!0,At.byteLength=m,At.toByteArray=k,At.fromByteArray=Y;for(var n=[],e=[],t=typeof Uint8Array<"u"?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,o=r.length;a<o;++a)n[a]=r[a],e[r.charCodeAt(a)]=a;e[45]=62,e[95]=63;function u(C){var j=C.length;if(j%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var D=C.indexOf("=");D===-1&&(D=j);var J=D===j?0:4-D%4;return[D,J]}function m(C){var j=u(C),D=j[0],J=j[1];return(D+J)*3/4-J}function x(C,j,D){return(j+D)*3/4-D}function k(C){var j,D=u(C),J=D[0],re=D[1],H=new t(x(C,J,re)),ne=0,oe=re>0?J-4:J,te;for(te=0;te<oe;te+=4)j=e[C.charCodeAt(te)]<<18|e[C.charCodeAt(te+1)]<<12|e[C.charCodeAt(te+2)]<<6|e[C.charCodeAt(te+3)],H[ne++]=j>>16&255,H[ne++]=j>>8&255,H[ne++]=j&255;return re===2&&(j=e[C.charCodeAt(te)]<<2|e[C.charCodeAt(te+1)]>>4,H[ne++]=j&255),re===1&&(j=e[C.charCodeAt(te)]<<10|e[C.charCodeAt(te+1)]<<4|e[C.charCodeAt(te+2)]>>2,H[ne++]=j>>8&255,H[ne++]=j&255),H}function R(C){return n[C>>18&63]+n[C>>12&63]+n[C>>6&63]+n[C&63]}function P(C,j,D){for(var J,re=[],H=j;H<D;H+=3)J=(C[H]<<16&16711680)+(C[H+1]<<8&65280)+(C[H+2]&255),re.push(R(J));return re.join("")}function Y(C){for(var j,D=C.length,J=D%3,re=[],H=16383,ne=0,oe=D-J;ne<oe;ne+=H)re.push(P(C,ne,ne+H>oe?oe:ne+H));return J===1?(j=C[D-1],re.push(n[j>>2]+n[j<<4&63]+"==")):J===2&&(j=(C[D-2]<<8)+C[D-1],re.push(n[j>>10]+n[j>>4&63]+n[j<<2&63]+"=")),re.join("")}return At}function ys(){if(li)return Yt;li=!0;return Yt.read=function(n,e,t,r,a){var o,u,m=a*8-r-1,x=(1<<m)-1,k=x>>1,R=-7,P=t?a-1:0,Y=t?-1:1,C=n[e+P];for(P+=Y,o=C&(1<<-R)-1,C>>=-R,R+=m;R>0;o=o*256+n[e+P],P+=Y,R-=8);for(u=o&(1<<-R)-1,o>>=-R,R+=r;R>0;u=u*256+n[e+P],P+=Y,R-=8);if(o===0)o=1-k;else{if(o===x)return u?NaN:(C?-1:1)*(1/0);u=u+Math.pow(2,r),o=o-k}return(C?-1:1)*u*Math.pow(2,o-r)},Yt.write=function(n,e,t,r,a,o){var u,m,x,k=o*8-a-1,R=(1<<k)-1,P=R>>1,Y=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,C=r?0:o-1,j=r?1:-1,D=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(m=isNaN(e)?1:0,u=R):(u=Math.floor(Math.log(e)/Math.LN2),e*(x=Math.pow(2,-u))<1&&(u--,x*=2),u+P>=1?e+=Y/x:e+=Y*Math.pow(2,1-P),e*x>=2&&(u++,x/=2),u+P>=R?(m=0,u=R):u+P>=1?(m=(e*x-1)*Math.pow(2,a),u=u+P):(m=e*Math.pow(2,P-1)*Math.pow(2,a),u=0));a>=8;n[t+C]=m&255,C+=j,m/=256,a-=8);for(u=u<<a|m,k+=a;k>0;n[t+C]=u&255,C+=j,u/=256,k-=8);n[t+C-j]|=D*128},Yt}function di(){if(pi)return je;pi=!0;let n=hs(),e=ys(),t=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;je.Buffer=u,je.SlowBuffer=re,je.INSPECT_MAX_BYTES=50;let r=2147483647;je.kMaxLength=r,u.TYPED_ARRAY_SUPPORT=a(),!u.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{let c=new Uint8Array(1),i={foo:function(){return 42}};return Object.setPrototypeOf(i,Uint8Array.prototype),Object.setPrototypeOf(c,i),c.foo()===42}catch{return!1}}Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}});function o(c){if(c>r)throw new RangeError('The value "'+c+'" is invalid for option "size"');let i=new Uint8Array(c);return Object.setPrototypeOf(i,u.prototype),i}function u(c,i,s){if(typeof c=="number"){if(typeof i=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return R(c)}return m(c,i,s)}u.poolSize=8192;function m(c,i,s){if(typeof c=="string")return P(c,i);if(ArrayBuffer.isView(c))return C(c);if(c==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof c);if(me(c,ArrayBuffer)||c&&me(c.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(me(c,SharedArrayBuffer)||c&&me(c.buffer,SharedArrayBuffer)))return j(c,i,s);if(typeof c=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let l=c.valueOf&&c.valueOf();if(l!=null&&l!==c)return u.from(l,i,s);let h=D(c);if(h)return h;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof c[Symbol.toPrimitive]=="function")return u.from(c[Symbol.toPrimitive]("string"),i,s);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof c)}u.from=function(c,i,s){return m(c,i,s)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array);function x(c){if(typeof c!="number")throw new TypeError('"size" argument must be of type number');if(c<0)throw new RangeError('The value "'+c+'" is invalid for option "size"')}function k(c,i,s){return x(c),c<=0?o(c):i!==void 0?typeof s=="string"?o(c).fill(i,s):o(c).fill(i):o(c)}u.alloc=function(c,i,s){return k(c,i,s)};function R(c){return x(c),o(c<0?0:J(c)|0)}u.allocUnsafe=function(c){return R(c)},u.allocUnsafeSlow=function(c){return R(c)};function P(c,i){if((typeof i!="string"||i==="")&&(i="utf8"),!u.isEncoding(i))throw new TypeError("Unknown encoding: "+i);let s=H(c,i)|0,l=o(s),h=l.write(c,i);return h!==s&&(l=l.slice(0,h)),l}function Y(c){let i=c.length<0?0:J(c.length)|0,s=o(i);for(let l=0;l<i;l+=1)s[l]=c[l]&255;return s}function C(c){if(me(c,Uint8Array)){let i=new Uint8Array(c);return j(i.buffer,i.byteOffset,i.byteLength)}return Y(c)}function j(c,i,s){if(i<0||c.byteLength<i)throw new RangeError('"offset" is outside of buffer bounds');if(c.byteLength<i+(s||0))throw new RangeError('"length" is outside of buffer bounds');let l;return i===void 0&&s===void 0?l=new Uint8Array(c):s===void 0?l=new Uint8Array(c,i):l=new Uint8Array(c,i,s),Object.setPrototypeOf(l,u.prototype),l}function D(c){if(u.isBuffer(c)){let i=J(c.length)|0,s=o(i);return s.length===0||c.copy(s,0,0,i),s}if(c.length!==void 0)return typeof c.length!="number"||dr(c.length)?o(0):Y(c);if(c.type==="Buffer"&&Array.isArray(c.data))return Y(c.data)}function J(c){if(c>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return c|0}function re(c){return+c!=c&&(c=0),u.alloc(+c)}u.isBuffer=function(i){return i!=null&&i._isBuffer===!0&&i!==u.prototype},u.compare=function(i,s){if(me(i,Uint8Array)&&(i=u.from(i,i.offset,i.byteLength)),me(s,Uint8Array)&&(s=u.from(s,s.offset,s.byteLength)),!u.isBuffer(i)||!u.isBuffer(s))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(i===s)return 0;let l=i.length,h=s.length;for(let g=0,_=Math.min(l,h);g<_;++g)if(i[g]!==s[g]){l=i[g],h=s[g];break}return l<h?-1:h<l?1:0},u.isEncoding=function(i){switch(String(i).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}},u.concat=function(i,s){if(!Array.isArray(i))throw new TypeError('"list" argument must be an Array of Buffers');if(i.length===0)return u.alloc(0);let l;if(s===void 0)for(s=0,l=0;l<i.length;++l)s+=i[l].length;let h=u.allocUnsafe(s),g=0;for(l=0;l<i.length;++l){let _=i[l];if(me(_,Uint8Array))g+_.length>h.length?(u.isBuffer(_)||(_=u.from(_)),_.copy(h,g)):Uint8Array.prototype.set.call(h,_,g);else if(u.isBuffer(_))_.copy(h,g);else throw new TypeError('"list" argument must be an Array of Buffers');g+=_.length}return h};function H(c,i){if(u.isBuffer(c))return c.length;if(ArrayBuffer.isView(c)||me(c,ArrayBuffer))return c.byteLength;if(typeof c!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof c);let s=c.length,l=arguments.length>2&&arguments[2]===!0;if(!l&&s===0)return 0;let h=!1;for(;;)switch(i){case"ascii":case"latin1":case"binary":return s;case"utf8":case"utf-8":return pr(c).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s*2;case"hex":return s>>>1;case"base64":return Wr(c).length;default:if(h)return l?-1:pr(c).length;i=(""+i).toLowerCase(),h=!0}}u.byteLength=H;function ne(c,i,s){let l=!1;if((i===void 0||i<0)&&(i=0),i>this.length||((s===void 0||s>this.length)&&(s=this.length),s<=0)||(s>>>=0,i>>>=0,s<=i))return"";for(c||(c="utf8");;)switch(c){case"hex":return is(this,i,s);case"utf8":case"utf-8":return Or(this,i,s);case"ascii":return rs(this,i,s);case"latin1":case"binary":return ns(this,i,s);case"base64":return es(this,i,s);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return as(this,i,s);default:if(l)throw new TypeError("Unknown encoding: "+c);c=(c+"").toLowerCase(),l=!0}}u.prototype._isBuffer=!0;function oe(c,i,s){let l=c[i];c[i]=c[s],c[s]=l}u.prototype.swap16=function(){let i=this.length;if(i%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let s=0;s<i;s+=2)oe(this,s,s+1);return this},u.prototype.swap32=function(){let i=this.length;if(i%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let s=0;s<i;s+=4)oe(this,s,s+3),oe(this,s+1,s+2);return this},u.prototype.swap64=function(){let i=this.length;if(i%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let s=0;s<i;s+=8)oe(this,s,s+7),oe(this,s+1,s+6),oe(this,s+2,s+5),oe(this,s+3,s+4);return this},u.prototype.toString=function(){let i=this.length;return i===0?"":arguments.length===0?Or(this,0,i):ne.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(i){if(!u.isBuffer(i))throw new TypeError("Argument must be a Buffer");return this===i?!0:u.compare(this,i)===0},u.prototype.inspect=function(){let i="",s=je.INSPECT_MAX_BYTES;return i=this.toString("hex",0,s).replace(/(.{2})/g,"$1 ").trim(),this.length>s&&(i+=" ... "),"<Buffer "+i+">"},t&&(u.prototype[t]=u.prototype.inspect),u.prototype.compare=function(i,s,l,h,g){if(me(i,Uint8Array)&&(i=u.from(i,i.offset,i.byteLength)),!u.isBuffer(i))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof i);if(s===void 0&&(s=0),l===void 0&&(l=i?i.length:0),h===void 0&&(h=0),g===void 0&&(g=this.length),s<0||l>i.length||h<0||g>this.length)throw new RangeError("out of range index");if(h>=g&&s>=l)return 0;if(h>=g)return-1;if(s>=l)return 1;if(s>>>=0,l>>>=0,h>>>=0,g>>>=0,this===i)return 0;let _=g-h,M=l-s,Z=Math.min(_,M),z=this.slice(h,g),G=i.slice(s,l);for(let V=0;V<Z;++V)if(z[V]!==G[V]){_=z[V],M=G[V];break}return _<M?-1:M<_?1:0};function te(c,i,s,l,h){if(c.length===0)return-1;if(typeof s=="string"?(l=s,s=0):s>2147483647?s=2147483647:s<-2147483648&&(s=-2147483648),s=+s,dr(s)&&(s=h?0:c.length-1),s<0&&(s=c.length+s),s>=c.length){if(h)return-1;s=c.length-1}else if(s<0)if(h)s=0;else return-1;if(typeof i=="string"&&(i=u.from(i,l)),u.isBuffer(i))return i.length===0?-1:Br(c,i,s,l,h);if(typeof i=="number")return i=i&255,typeof Uint8Array.prototype.indexOf=="function"?h?Uint8Array.prototype.indexOf.call(c,i,s):Uint8Array.prototype.lastIndexOf.call(c,i,s):Br(c,[i],s,l,h);throw new TypeError("val must be string, number or Buffer")}function Br(c,i,s,l,h){let g=1,_=c.length,M=i.length;if(l!==void 0&&(l=String(l).toLowerCase(),l==="ucs2"||l==="ucs-2"||l==="utf16le"||l==="utf-16le")){if(c.length<2||i.length<2)return-1;g=2,_/=2,M/=2,s/=2}function Z(G,V){return g===1?G[V]:G.readUInt16BE(V*g)}let z;if(h){let G=-1;for(z=s;z<_;z++)if(Z(c,z)===Z(i,G===-1?0:z-G)){if(G===-1&&(G=z),z-G+1===M)return G*g}else G!==-1&&(z-=z-G),G=-1}else for(s+M>_&&(s=_-M),z=s;z>=0;z--){let G=!0;for(let V=0;V<M;V++)if(Z(c,z+V)!==Z(i,V)){G=!1;break}if(G)return z}return-1}u.prototype.includes=function(i,s,l){return this.indexOf(i,s,l)!==-1},u.prototype.indexOf=function(i,s,l){return te(this,i,s,l,!0)},u.prototype.lastIndexOf=function(i,s,l){return te(this,i,s,l,!1)};function Ja(c,i,s,l){s=Number(s)||0;let h=c.length-s;l?(l=Number(l),l>h&&(l=h)):l=h;let g=i.length;l>g/2&&(l=g/2);let _;for(_=0;_<l;++_){let M=parseInt(i.substr(_*2,2),16);if(dr(M))return _;c[s+_]=M}return _}function Ya(c,i,s,l){return Zt(pr(i,c.length-s),c,s,l)}function Xa(c,i,s,l){return Zt(cs(i),c,s,l)}function Ka(c,i,s,l){return Zt(Wr(i),c,s,l)}function Qa(c,i,s,l){return Zt(ls(i,c.length-s),c,s,l)}u.prototype.write=function(i,s,l,h){if(s===void 0)h="utf8",l=this.length,s=0;else if(l===void 0&&typeof s=="string")h=s,l=this.length,s=0;else if(isFinite(s))s=s>>>0,isFinite(l)?(l=l>>>0,h===void 0&&(h="utf8")):(h=l,l=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let g=this.length-s;if((l===void 0||l>g)&&(l=g),i.length>0&&(l<0||s<0)||s>this.length)throw new RangeError("Attempt to write outside buffer bounds");h||(h="utf8");let _=!1;for(;;)switch(h){case"hex":return Ja(this,i,s,l);case"utf8":case"utf-8":return Ya(this,i,s,l);case"ascii":case"latin1":case"binary":return Xa(this,i,s,l);case"base64":return Ka(this,i,s,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Qa(this,i,s,l);default:if(_)throw new TypeError("Unknown encoding: "+h);h=(""+h).toLowerCase(),_=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function es(c,i,s){return i===0&&s===c.length?n.fromByteArray(c):n.fromByteArray(c.slice(i,s))}function Or(c,i,s){s=Math.min(c.length,s);let l=[],h=i;for(;h<s;){let g=c[h],_=null,M=g>239?4:g>223?3:g>191?2:1;if(h+M<=s){let Z,z,G,V;switch(M){case 1:g<128&&(_=g);break;case 2:Z=c[h+1],(Z&192)===128&&(V=(g&31)<<6|Z&63,V>127&&(_=V));break;case 3:Z=c[h+1],z=c[h+2],(Z&192)===128&&(z&192)===128&&(V=(g&15)<<12|(Z&63)<<6|z&63,V>2047&&(V<55296||V>57343)&&(_=V));break;case 4:Z=c[h+1],z=c[h+2],G=c[h+3],(Z&192)===128&&(z&192)===128&&(G&192)===128&&(V=(g&15)<<18|(Z&63)<<12|(z&63)<<6|G&63,V>65535&&V<1114112&&(_=V))}}_===null?(_=65533,M=1):_>65535&&(_-=65536,l.push(_>>>10&1023|55296),_=56320|_&1023),l.push(_),h+=M}return ts(l)}let Lr=4096;function ts(c){let i=c.length;if(i<=Lr)return String.fromCharCode.apply(String,c);let s="",l=0;for(;l<i;)s+=String.fromCharCode.apply(String,c.slice(l,l+=Lr));return s}function rs(c,i,s){let l="";s=Math.min(c.length,s);for(let h=i;h<s;++h)l+=String.fromCharCode(c[h]&127);return l}function ns(c,i,s){let l="";s=Math.min(c.length,s);for(let h=i;h<s;++h)l+=String.fromCharCode(c[h]);return l}function is(c,i,s){let l=c.length;(!i||i<0)&&(i=0),(!s||s<0||s>l)&&(s=l);let h="";for(let g=i;g<s;++g)h+=ps[c[g]];return h}function as(c,i,s){let l=c.slice(i,s),h="";for(let g=0;g<l.length-1;g+=2)h+=String.fromCharCode(l[g]+l[g+1]*256);return h}u.prototype.slice=function(i,s){let l=this.length;i=~~i,s=s===void 0?l:~~s,i<0?(i+=l,i<0&&(i=0)):i>l&&(i=l),s<0?(s+=l,s<0&&(s=0)):s>l&&(s=l),s<i&&(s=i);let h=this.subarray(i,s);return Object.setPrototypeOf(h,u.prototype),h};function X(c,i,s){if(c%1!==0||c<0)throw new RangeError("offset is not uint");if(c+i>s)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUintLE=u.prototype.readUIntLE=function(i,s,l){i=i>>>0,s=s>>>0,l||X(i,s,this.length);let h=this[i],g=1,_=0;for(;++_<s&&(g*=256);)h+=this[i+_]*g;return h},u.prototype.readUintBE=u.prototype.readUIntBE=function(i,s,l){i=i>>>0,s=s>>>0,l||X(i,s,this.length);let h=this[i+--s],g=1;for(;s>0&&(g*=256);)h+=this[i+--s]*g;return h},u.prototype.readUint8=u.prototype.readUInt8=function(i,s){return i=i>>>0,s||X(i,1,this.length),this[i]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(i,s){return i=i>>>0,s||X(i,2,this.length),this[i]|this[i+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(i,s){return i=i>>>0,s||X(i,2,this.length),this[i]<<8|this[i+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(i,s){return i=i>>>0,s||X(i,4,this.length),(this[i]|this[i+1]<<8|this[i+2]<<16)+this[i+3]*16777216},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(i,s){return i=i>>>0,s||X(i,4,this.length),this[i]*16777216+(this[i+1]<<16|this[i+2]<<8|this[i+3])},u.prototype.readBigUInt64LE=Re(function(i){i=i>>>0,st(i,"offset");let s=this[i],l=this[i+7];(s===void 0||l===void 0)&&It(i,this.length-8);let h=s+this[++i]*2**8+this[++i]*2**16+this[++i]*2**24,g=this[++i]+this[++i]*2**8+this[++i]*2**16+l*2**24;return BigInt(h)+(BigInt(g)<<BigInt(32))}),u.prototype.readBigUInt64BE=Re(function(i){i=i>>>0,st(i,"offset");let s=this[i],l=this[i+7];(s===void 0||l===void 0)&&It(i,this.length-8);let h=s*2**24+this[++i]*2**16+this[++i]*2**8+this[++i],g=this[++i]*2**24+this[++i]*2**16+this[++i]*2**8+l;return(BigInt(h)<<BigInt(32))+BigInt(g)}),u.prototype.readIntLE=function(i,s,l){i=i>>>0,s=s>>>0,l||X(i,s,this.length);let h=this[i],g=1,_=0;for(;++_<s&&(g*=256);)h+=this[i+_]*g;return g*=128,h>=g&&(h-=Math.pow(2,8*s)),h},u.prototype.readIntBE=function(i,s,l){i=i>>>0,s=s>>>0,l||X(i,s,this.length);let h=s,g=1,_=this[i+--h];for(;h>0&&(g*=256);)_+=this[i+--h]*g;return g*=128,_>=g&&(_-=Math.pow(2,8*s)),_},u.prototype.readInt8=function(i,s){return i=i>>>0,s||X(i,1,this.length),this[i]&128?(255-this[i]+1)*-1:this[i]},u.prototype.readInt16LE=function(i,s){i=i>>>0,s||X(i,2,this.length);let l=this[i]|this[i+1]<<8;return l&32768?l|4294901760:l},u.prototype.readInt16BE=function(i,s){i=i>>>0,s||X(i,2,this.length);let l=this[i+1]|this[i]<<8;return l&32768?l|4294901760:l},u.prototype.readInt32LE=function(i,s){return i=i>>>0,s||X(i,4,this.length),this[i]|this[i+1]<<8|this[i+2]<<16|this[i+3]<<24},u.prototype.readInt32BE=function(i,s){return i=i>>>0,s||X(i,4,this.length),this[i]<<24|this[i+1]<<16|this[i+2]<<8|this[i+3]},u.prototype.readBigInt64LE=Re(function(i){i=i>>>0,st(i,"offset");let s=this[i],l=this[i+7];(s===void 0||l===void 0)&&It(i,this.length-8);let h=this[i+4]+this[i+5]*2**8+this[i+6]*2**16+(l<<24);return(BigInt(h)<<BigInt(32))+BigInt(s+this[++i]*2**8+this[++i]*2**16+this[++i]*2**24)}),u.prototype.readBigInt64BE=Re(function(i){i=i>>>0,st(i,"offset");let s=this[i],l=this[i+7];(s===void 0||l===void 0)&&It(i,this.length-8);let h=(s<<24)+this[++i]*2**16+this[++i]*2**8+this[++i];return(BigInt(h)<<BigInt(32))+BigInt(this[++i]*2**24+this[++i]*2**16+this[++i]*2**8+l)}),u.prototype.readFloatLE=function(i,s){return i=i>>>0,s||X(i,4,this.length),e.read(this,i,!0,23,4)},u.prototype.readFloatBE=function(i,s){return i=i>>>0,s||X(i,4,this.length),e.read(this,i,!1,23,4)},u.prototype.readDoubleLE=function(i,s){return i=i>>>0,s||X(i,8,this.length),e.read(this,i,!0,52,8)},u.prototype.readDoubleBE=function(i,s){return i=i>>>0,s||X(i,8,this.length),e.read(this,i,!1,52,8)};function ie(c,i,s,l,h,g){if(!u.isBuffer(c))throw new TypeError('"buffer" argument must be a Buffer instance');if(i>h||i<g)throw new RangeError('"value" argument is out of bounds');if(s+l>c.length)throw new RangeError("Index out of range")}u.prototype.writeUintLE=u.prototype.writeUIntLE=function(i,s,l,h){if(i=+i,s=s>>>0,l=l>>>0,!h){let M=Math.pow(2,8*l)-1;ie(this,i,s,l,M,0)}let g=1,_=0;for(this[s]=i&255;++_<l&&(g*=256);)this[s+_]=i/g&255;return s+l},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(i,s,l,h){if(i=+i,s=s>>>0,l=l>>>0,!h){let M=Math.pow(2,8*l)-1;ie(this,i,s,l,M,0)}let g=l-1,_=1;for(this[s+g]=i&255;--g>=0&&(_*=256);)this[s+g]=i/_&255;return s+l},u.prototype.writeUint8=u.prototype.writeUInt8=function(i,s,l){return i=+i,s=s>>>0,l||ie(this,i,s,1,255,0),this[s]=i&255,s+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(i,s,l){return i=+i,s=s>>>0,l||ie(this,i,s,2,65535,0),this[s]=i&255,this[s+1]=i>>>8,s+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(i,s,l){return i=+i,s=s>>>0,l||ie(this,i,s,2,65535,0),this[s]=i>>>8,this[s+1]=i&255,s+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(i,s,l){return i=+i,s=s>>>0,l||ie(this,i,s,4,4294967295,0),this[s+3]=i>>>24,this[s+2]=i>>>16,this[s+1]=i>>>8,this[s]=i&255,s+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(i,s,l){return i=+i,s=s>>>0,l||ie(this,i,s,4,4294967295,0),this[s]=i>>>24,this[s+1]=i>>>16,this[s+2]=i>>>8,this[s+3]=i&255,s+4};function Pr(c,i,s,l,h){Vr(i,l,h,c,s,7);let g=Number(i&BigInt(4294967295));c[s++]=g,g=g>>8,c[s++]=g,g=g>>8,c[s++]=g,g=g>>8,c[s++]=g;let _=Number(i>>BigInt(32)&BigInt(4294967295));return c[s++]=_,_=_>>8,c[s++]=_,_=_>>8,c[s++]=_,_=_>>8,c[s++]=_,s}function jr(c,i,s,l,h){Vr(i,l,h,c,s,7);let g=Number(i&BigInt(4294967295));c[s+7]=g,g=g>>8,c[s+6]=g,g=g>>8,c[s+5]=g,g=g>>8,c[s+4]=g;let _=Number(i>>BigInt(32)&BigInt(4294967295));return c[s+3]=_,_=_>>8,c[s+2]=_,_=_>>8,c[s+1]=_,_=_>>8,c[s]=_,s+8}u.prototype.writeBigUInt64LE=Re(function(i,s=0){return Pr(this,i,s,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeBigUInt64BE=Re(function(i,s=0){return jr(this,i,s,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeIntLE=function(i,s,l,h){if(i=+i,s=s>>>0,!h){let Z=Math.pow(2,8*l-1);ie(this,i,s,l,Z-1,-Z)}let g=0,_=1,M=0;for(this[s]=i&255;++g<l&&(_*=256);)i<0&&M===0&&this[s+g-1]!==0&&(M=1),this[s+g]=(i/_>>0)-M&255;return s+l},u.prototype.writeIntBE=function(i,s,l,h){if(i=+i,s=s>>>0,!h){let Z=Math.pow(2,8*l-1);ie(this,i,s,l,Z-1,-Z)}let g=l-1,_=1,M=0;for(this[s+g]=i&255;--g>=0&&(_*=256);)i<0&&M===0&&this[s+g+1]!==0&&(M=1),this[s+g]=(i/_>>0)-M&255;return s+l},u.prototype.writeInt8=function(i,s,l){return i=+i,s=s>>>0,l||ie(this,i,s,1,127,-128),i<0&&(i=255+i+1),this[s]=i&255,s+1},u.prototype.writeInt16LE=function(i,s,l){return i=+i,s=s>>>0,l||ie(this,i,s,2,32767,-32768),this[s]=i&255,this[s+1]=i>>>8,s+2},u.prototype.writeInt16BE=function(i,s,l){return i=+i,s=s>>>0,l||ie(this,i,s,2,32767,-32768),this[s]=i>>>8,this[s+1]=i&255,s+2},u.prototype.writeInt32LE=function(i,s,l){return i=+i,s=s>>>0,l||ie(this,i,s,4,2147483647,-2147483648),this[s]=i&255,this[s+1]=i>>>8,this[s+2]=i>>>16,this[s+3]=i>>>24,s+4},u.prototype.writeInt32BE=function(i,s,l){return i=+i,s=s>>>0,l||ie(this,i,s,4,2147483647,-2147483648),i<0&&(i=4294967295+i+1),this[s]=i>>>24,this[s+1]=i>>>16,this[s+2]=i>>>8,this[s+3]=i&255,s+4},u.prototype.writeBigInt64LE=Re(function(i,s=0){return Pr(this,i,s,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeBigInt64BE=Re(function(i,s=0){return jr(this,i,s,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Mr(c,i,s,l,h,g){if(s+l>c.length)throw new RangeError("Index out of range");if(s<0)throw new RangeError("Index out of range")}function Ur(c,i,s,l,h){return i=+i,s=s>>>0,h||Mr(c,i,s,4),e.write(c,i,s,l,23,4),s+4}u.prototype.writeFloatLE=function(i,s,l){return Ur(this,i,s,!0,l)},u.prototype.writeFloatBE=function(i,s,l){return Ur(this,i,s,!1,l)};function $r(c,i,s,l,h){return i=+i,s=s>>>0,h||Mr(c,i,s,8),e.write(c,i,s,l,52,8),s+8}u.prototype.writeDoubleLE=function(i,s,l){return $r(this,i,s,!0,l)},u.prototype.writeDoubleBE=function(i,s,l){return $r(this,i,s,!1,l)},u.prototype.copy=function(i,s,l,h){if(!u.isBuffer(i))throw new TypeError("argument should be a Buffer");if(l||(l=0),!h&&h!==0&&(h=this.length),s>=i.length&&(s=i.length),s||(s=0),h>0&&h<l&&(h=l),h===l||i.length===0||this.length===0)return 0;if(s<0)throw new RangeError("targetStart out of bounds");if(l<0||l>=this.length)throw new RangeError("Index out of range");if(h<0)throw new RangeError("sourceEnd out of bounds");h>this.length&&(h=this.length),i.length-s<h-l&&(h=i.length-s+l);let g=h-l;return this===i&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(s,l,h):Uint8Array.prototype.set.call(i,this.subarray(l,h),s),g},u.prototype.fill=function(i,s,l,h){if(typeof i=="string"){if(typeof s=="string"?(h=s,s=0,l=this.length):typeof l=="string"&&(h=l,l=this.length),h!==void 0&&typeof h!="string")throw new TypeError("encoding must be a string");if(typeof h=="string"&&!u.isEncoding(h))throw new TypeError("Unknown encoding: "+h);if(i.length===1){let _=i.charCodeAt(0);(h==="utf8"&&_<128||h==="latin1")&&(i=_)}}else typeof i=="number"?i=i&255:typeof i=="boolean"&&(i=Number(i));if(s<0||this.length<s||this.length<l)throw new RangeError("Out of range index");if(l<=s)return this;s=s>>>0,l=l===void 0?this.length:l>>>0,i||(i=0);let g;if(typeof i=="number")for(g=s;g<l;++g)this[g]=i;else{let _=u.isBuffer(i)?i:u.from(i,h),M=_.length;if(M===0)throw new TypeError('The value "'+i+'" is invalid for argument "value"');for(g=0;g<l-s;++g)this[g+s]=_[g%M]}return this};let at={};function lr(c,i,s){at[c]=class extends s{constructor(){super(),Object.defineProperty(this,"message",{value:i.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${c}]`,this.stack,delete this.name}get code(){return c}set code(h){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:h,writable:!0})}toString(){return`${this.name} [${c}]: ${this.message}`}}}lr("ERR_BUFFER_OUT_OF_BOUNDS",function(c){return c?`${c} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),lr("ERR_INVALID_ARG_TYPE",function(c,i){return`The "${c}" argument must be of type number. Received type ${typeof i}`},TypeError),lr("ERR_OUT_OF_RANGE",function(c,i,s){let l=`The value of "${c}" is out of range.`,h=s;return Number.isInteger(s)&&Math.abs(s)>2**32?h=Dr(String(s)):typeof s=="bigint"&&(h=String(s),(s>BigInt(2)**BigInt(32)||s<-(BigInt(2)**BigInt(32)))&&(h=Dr(h)),h+="n"),l+=` It must be ${i}. Received ${h}`,l},RangeError);function Dr(c){let i="",s=c.length,l=c[0]==="-"?1:0;for(;s>=l+4;s-=3)i=`_${c.slice(s-3,s)}${i}`;return`${c.slice(0,s)}${i}`}function ss(c,i,s){st(i,"offset"),(c[i]===void 0||c[i+s]===void 0)&&It(i,c.length-(s+1))}function Vr(c,i,s,l,h,g){if(c>s||c<i){let _=typeof i=="bigint"?"n":"",M;throw i===0||i===BigInt(0)?M=`>= 0${_} and < 2${_} ** ${(g+1)*8}${_}`:M=`>= -(2${_} ** ${(g+1)*8-1}${_}) and < 2 ** ${(g+1)*8-1}${_}`,new at.ERR_OUT_OF_RANGE("value",M,c)}ss(l,h,g)}function st(c,i){if(typeof c!="number")throw new at.ERR_INVALID_ARG_TYPE(i,"number",c)}function It(c,i,s){throw Math.floor(c)!==c?(st(c,s),new at.ERR_OUT_OF_RANGE("offset","an integer",c)):i<0?new at.ERR_BUFFER_OUT_OF_BOUNDS:new at.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${i}`,c)}let os=/[^+/0-9A-Za-z-_]/g;function us(c){if(c=c.split("=")[0],c=c.trim().replace(os,""),c.length<2)return"";for(;c.length%4!==0;)c=c+"=";return c}function pr(c,i){i=i||1/0;let s,l=c.length,h=null,g=[];for(let _=0;_<l;++_){if(s=c.charCodeAt(_),s>55295&&s<57344){if(!h){if(s>56319){(i-=3)>-1&&g.push(239,191,189);continue}else if(_+1===l){(i-=3)>-1&&g.push(239,191,189);continue}h=s;continue}if(s<56320){(i-=3)>-1&&g.push(239,191,189),h=s;continue}s=(h-55296<<10|s-56320)+65536}else h&&(i-=3)>-1&&g.push(239,191,189);if(h=null,s<128){if((i-=1)<0)break;g.push(s)}else if(s<2048){if((i-=2)<0)break;g.push(s>>6|192,s&63|128)}else if(s<65536){if((i-=3)<0)break;g.push(s>>12|224,s>>6&63|128,s&63|128)}else if(s<1114112){if((i-=4)<0)break;g.push(s>>18|240,s>>12&63|128,s>>6&63|128,s&63|128)}else throw new Error("Invalid code point")}return g}function cs(c){let i=[];for(let s=0;s<c.length;++s)i.push(c.charCodeAt(s)&255);return i}function ls(c,i){let s,l,h,g=[];for(let _=0;_<c.length&&!((i-=2)<0);++_)s=c.charCodeAt(_),l=s>>8,h=s%256,g.push(h),g.push(l);return g}function Wr(c){return n.toByteArray(us(c))}function Zt(c,i,s,l){let h;for(h=0;h<l&&!(h+s>=i.length||h>=c.length);++h)i[h+s]=c[h];return h}function me(c,i){return c instanceof i||c!=null&&c.constructor!=null&&c.constructor.name!=null&&c.constructor.name===i.name}function dr(c){return c!==c}let ps=(function(){let c="0123456789abcdef",i=new Array(256);for(let s=0;s<16;++s){let l=s*16;for(let h=0;h<16;++h)i[l+h]=c[s]+c[h]}return i})();function Re(c){return typeof BigInt>"u"?ds:c}function ds(){throw new Error("BigInt not supported")}return je}var At,ci,Yt,li,je,pi,fi=ot(()=>{"use strict";p();f();d();At={},ci=!1;Yt={},li=!1;je={},pi=!1});var Me,b,Zc,Gc,mi=ot(()=>{"use strict";p();f();d();fi();Me=di();Me.Buffer;Me.SlowBuffer;Me.INSPECT_MAX_BYTES;Me.kMaxLength;b=Me.Buffer,Zc=Me.INSPECT_MAX_BYTES,Gc=Me.kMaxLength});var f=ot(()=>{"use strict";mi()});p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();var gs=typeof global=="object"&&global&&global.Object===Object&&global,hi=gs;var xs=typeof self=="object"&&self&&self.Object===Object&&self,vs=hi||xs||Function("return this")(),yi=vs;var bs=yi.Symbol,_e=bs;p();f();d();var gi=Object.prototype,ws=gi.hasOwnProperty,_s=gi.toString,Rt=_e?_e.toStringTag:void 0;function Ts(n){var e=ws.call(n,Rt),t=n[Rt];try{n[Rt]=void 0;var r=!0}catch{}var a=_s.call(n);return r&&(e?n[Rt]=t:delete n[Rt]),a}var xi=Ts;p();f();d();var ks=Object.prototype,Es=ks.toString;function Is(n){return Es.call(n)}var vi=Is;var As="[object Null]",Rs="[object Undefined]",bi=_e?_e.toStringTag:void 0;function Ss(n){return n==null?n===void 0?Rs:As:bi&&bi in Object(n)?xi(n):vi(n)}var wi=Ss;p();f();d();function Ns(n){return n!=null&&typeof n=="object"}var _i=Ns;var Cs="[object Symbol]";function Fs(n){return typeof n=="symbol"||_i(n)&&wi(n)==Cs}var Ti=Fs;p();f();d();p();f();d();function Bs(n,e){for(var t=-1,r=n==null?0:n.length,a=Array(r);++t<r;)a[t]=e(n[t],t,n);return a}var ki=Bs;p();f();d();var Os=Array.isArray,Ei=Os;var Ls=1/0,Ii=_e?_e.prototype:void 0,Ai=Ii?Ii.toString:void 0;function Ri(n){if(typeof n=="string")return n;if(Ei(n))return ki(n,Ri)+"";if(Ti(n))return Ai?Ai.call(n):"";var e=n+"";return e=="0"&&1/n==-Ls?"-0":e}var Si=Ri;p();f();d();function Ps(n){return n==null?"":Si(n)}var Ne=Ps;p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();function js(n,e,t){var r=-1,a=n.length;e<0&&(e=-e>a?0:a+e),t=t>a?a:t,t<0&&(t+=a),a=e>t?0:t-e>>>0,e>>>=0;for(var o=Array(a);++r<a;)o[r]=n[r+e];return o}var Ni=js;function Ms(n,e,t){var r=n.length;return t=t===void 0?r:t,!e&&t>=r?n:Ni(n,e,t)}var Ci=Ms;p();f();d();var Us="\\ud800-\\udfff",$s="\\u0300-\\u036f",Ds="\\ufe20-\\ufe2f",Vs="\\u20d0-\\u20ff",Ws=$s+Ds+Vs,qs="\\ufe0e\\ufe0f",zs="\\u200d",Zs=RegExp("["+zs+Us+Ws+qs+"]");function Gs(n){return Zs.test(n)}var Xt=Gs;p();f();d();p();f();d();function Hs(n){return n.split("")}var Fi=Hs;p();f();d();var Bi="\\ud800-\\udfff",Js="\\u0300-\\u036f",Ys="\\ufe20-\\ufe2f",Xs="\\u20d0-\\u20ff",Ks=Js+Ys+Xs,Qs="\\ufe0e\\ufe0f",eo="["+Bi+"]",yr="["+Ks+"]",gr="\\ud83c[\\udffb-\\udfff]",to="(?:"+yr+"|"+gr+")",Oi="[^"+Bi+"]",Li="(?:\\ud83c[\\udde6-\\uddff]){2}",Pi="[\\ud800-\\udbff][\\udc00-\\udfff]",ro="\\u200d",ji=to+"?",Mi="["+Qs+"]?",no="(?:"+ro+"(?:"+[Oi,Li,Pi].join("|")+")"+Mi+ji+")*",io=Mi+ji+no,ao="(?:"+[Oi+yr+"?",yr,Li,Pi,eo].join("|")+")",so=RegExp(gr+"(?="+gr+")|"+ao+io,"g");function oo(n){return n.match(so)||[]}var Ui=oo;function uo(n){return Xt(n)?Ui(n):Fi(n)}var $i=uo;function co(n){return function(e){e=Ne(e);var t=Xt(e)?$i(e):void 0,r=t?t[0]:e.charAt(0),a=t?Ci(t,1).join(""):e.slice(1);return r[n]()+a}}var Di=co;var lo=Di("toUpperCase"),Ue=lo;function po(n){return Ue(Ne(n).toLowerCase())}var Vi=po;p();f();d();p();f();d();function fo(n,e,t,r){var a=-1,o=n==null?0:n.length;for(r&&o&&(t=n[++a]);++a<o;)t=e(t,n[a],a,n);return t}var Wi=fo;p();f();d();p();f();d();p();f();d();function mo(n){return function(e){return n?.[e]}}var qi=mo;var ho={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},yo=qi(ho),zi=yo;var go=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,xo="\\u0300-\\u036f",vo="\\ufe20-\\ufe2f",bo="\\u20d0-\\u20ff",wo=xo+vo+bo,_o="["+wo+"]",To=RegExp(_o,"g");function ko(n){return n=Ne(n),n&&n.replace(go,zi).replace(To,"")}var Zi=ko;p();f();d();p();f();d();var Eo=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Io(n){return n.match(Eo)||[]}var Gi=Io;p();f();d();var Ao=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function Ro(n){return Ao.test(n)}var Hi=Ro;p();f();d();var Qi="\\ud800-\\udfff",So="\\u0300-\\u036f",No="\\ufe20-\\ufe2f",Co="\\u20d0-\\u20ff",Fo=So+No+Co,ea="\\u2700-\\u27bf",ta="a-z\\xdf-\\xf6\\xf8-\\xff",Bo="\\xac\\xb1\\xd7\\xf7",Oo="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Lo="\\u2000-\\u206f",Po=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ra="A-Z\\xc0-\\xd6\\xd8-\\xde",jo="\\ufe0e\\ufe0f",na=Bo+Oo+Lo+Po,ia="['\u2019]",Ji="["+na+"]",Mo="["+Fo+"]",aa="\\d+",Uo="["+ea+"]",sa="["+ta+"]",oa="[^"+Qi+na+aa+ea+ta+ra+"]",$o="\\ud83c[\\udffb-\\udfff]",Do="(?:"+Mo+"|"+$o+")",Vo="[^"+Qi+"]",ua="(?:\\ud83c[\\udde6-\\uddff]){2}",ca="[\\ud800-\\udbff][\\udc00-\\udfff]",ct="["+ra+"]",Wo="\\u200d",Yi="(?:"+sa+"|"+oa+")",qo="(?:"+ct+"|"+oa+")",Xi="(?:"+ia+"(?:d|ll|m|re|s|t|ve))?",Ki="(?:"+ia+"(?:D|LL|M|RE|S|T|VE))?",la=Do+"?",pa="["+jo+"]?",zo="(?:"+Wo+"(?:"+[Vo,ua,ca].join("|")+")"+pa+la+")*",Zo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Go="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Ho=pa+la+zo,Jo="(?:"+[Uo,ua,ca].join("|")+")"+Ho,Yo=RegExp([ct+"?"+sa+"+"+Xi+"(?="+[Ji,ct,"$"].join("|")+")",qo+"+"+Ki+"(?="+[Ji,ct+Yi,"$"].join("|")+")",ct+"?"+Yi+"+"+Xi,ct+"+"+Ki,Go,Zo,aa,Jo].join("|"),"g");function Xo(n){return n.match(Yo)||[]}var da=Xo;function Ko(n,e,t){return n=Ne(n),e=t?void 0:e,e===void 0?Hi(n)?da(n):Gi(n):n.match(e)||[]}var fa=Ko;var Qo="['\u2019]",eu=RegExp(Qo,"g");function tu(n){return function(e){return Wi(fa(Zi(e).replace(eu,"")),n,"")}}var ma=tu;var ru=ma(function(n,e,t){return e=e.toLowerCase(),n+(t?Vi(e):e)}),St=ru;p();f();d();function q(n){throw new Error("Unexpected value: "+JSON.stringify(n))}p();f();d();function Nt(n){return Object.keys(n)}p();f();d();p();f();d();p();f();d();var Ct=v.env.FERN_STACK_TRACK?.toLowerCase()??"",ye=Ct!==""&&Ct!=="0"&&Ct!=="false",xr=["single","multiline","box"].includes(Ct)?Ct:"single";ye&&(Error.stackTraceLimit=50);var nu=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),iu=new Set(["stacktrace"]);function Qt({maxFrames:n=50,skip:e=0,filterPaths:t=[],filterFunctions:r=[],stopOn:a=[],filterNode:o=!0,filterJs:u=!0,formatFilename:m=x=>x}={}){if(!ye)return[];r=[...r,...nu],t=[...t,...iu],a=[...a,"runInteractiveTask"];let x=!1;return(new Error().stack??"").split(`
|
|
2
|
-
`).map(k=>{let R=k.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(R&&R.length===5){let[,P,Y,C,j]=R;if(!P||!Y||!C||!j)return;if(x||a.some(D=>P?.includes(D))){x=!0;return}switch(P){case"Object.<anonymous>":P="";break;case"Object.object":case"Object.alias":case"Object.union":case"Object.enum":case"Object.undiscriminatedUnion":P=`${P.substring(P.indexOf(".")+1)}()=> { ... }`;break}return{fn:P,path:m(Y),position:`${C}:${j}`}}}).filter(k=>k&&!r.some(R=>k.fn.includes(R))&&!(o&&k.path?.startsWith("node:"))&&!(u&&k.path?.endsWith(".js"))&&!t.some(R=>k.path.includes(R))).slice(e,e+n)}var
|
|
3
|
-
`:""}${r.fn} - ${r.path}:${r.position}`).join(""):""}frames(e){let t=this.tracking.get(e);return t?[...t]:[]}free(e){this.tracking.delete(e)}clear(){this.tracking=new WeakMap}},vr;function ha({maxFrames:n=50,skip:e=0,filterPaths:t=[],filterFunctions:r=[],stopOn:a=[],filterNode:o=!0,filterJs:u=!0,multiline:m=!1,formatFilename:x=k=>k}={}){ye&&(vr??(vr=new
|
|
1
|
+
var qr=Object.defineProperty;var ms=(n,e,t)=>e in n?qr(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var ot=(n,e,t)=>()=>{if(t)throw t[0];try{return n&&(e=n(n=0)),e}catch(r){throw t=[r],r}};var he=(n,e)=>{for(var t in e)qr(n,t,{get:e[t],enumerable:!0})};var E=(n,e,t)=>ms(n,typeof e!="symbol"?e+"":e,t);var p=ot(()=>{"use strict"});var v={};he(v,{_debugEnd:()=>On,_debugProcess:()=>Bn,_events:()=>Yn,_eventsCount:()=>Kn,_exiting:()=>mn,_fatalExceptions:()=>Sn,_getActiveHandles:()=>xn,_getActiveRequests:()=>gn,_kill:()=>bn,_linkedBinding:()=>dn,_maxListeners:()=>Jn,_preload_modules:()=>Zn,_rawDebug:()=>ln,_startProfilerIdleNotifier:()=>Ln,_stopProfilerIdleNotifier:()=>Pn,_tickCallback:()=>Fn,abort:()=>$n,addListener:()=>Xn,allowedNodeEnvironmentFlags:()=>In,arch:()=>Jr,argv:()=>Xr,argv0:()=>zn,assert:()=>An,binding:()=>nn,browser:()=>cn,chdir:()=>on,config:()=>hn,cpuUsage:()=>Jt,cwd:()=>sn,debugPort:()=>qn,default:()=>oi,dlopen:()=>yn,domain:()=>fn,emit:()=>ni,emitWarning:()=>rn,env:()=>Kr,execArgv:()=>Qr,execPath:()=>Wn,exit:()=>kn,features:()=>Rn,hasUncaughtExceptionCaptureCallback:()=>Cn,hrtime:()=>Ht,kill:()=>Tn,listeners:()=>si,memoryUsage:()=>_n,moduleLoadList:()=>pn,nextTick:()=>Zr,off:()=>ei,on:()=>we,once:()=>Qn,openStdin:()=>En,pid:()=>Dn,platform:()=>Yr,ppid:()=>Vn,prependListener:()=>ii,prependOnceListener:()=>ai,reallyExit:()=>vn,release:()=>un,removeAllListeners:()=>ri,removeListener:()=>ti,resourceUsage:()=>wn,setSourceMapsEnabled:()=>Gn,setUncaughtExceptionCaptureCallback:()=>Nn,stderr:()=>Mn,stdin:()=>Un,stdout:()=>jn,title:()=>Hr,umask:()=>an,uptime:()=>Hn,version:()=>en,versions:()=>tn});function hr(n){throw new Error("Node.js process "+n+" is not supported by JSPM core outside of Node.js")}function hs(){!ut||!Pe||(ut=!1,Pe.length?be=Pe.concat(be):Gt=-1,be.length&&zr())}function zr(){if(!ut){var n=setTimeout(hs,0);ut=!0;for(var e=be.length;e;){for(Pe=be,be=[];++Gt<e;)Pe&&Pe[Gt].run();Gt=-1,e=be.length}Pe=null,ut=!1,clearTimeout(n)}}function Zr(n){var e=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)e[t-1]=arguments[t];be.push(new Gr(n,e)),be.length===1&&!ut&&setTimeout(zr,0)}function Gr(n,e){this.fun=n,this.array=e}function Q(){}function dn(n){hr("_linkedBinding")}function yn(n){hr("dlopen")}function gn(){return[]}function xn(){return[]}function An(n,e){if(!n)throw new Error(e||"assertion error")}function Cn(){return!1}function Hn(){return Se.now()/1e3}function Ht(n){var e=Math.floor((Date.now()-Se.now())*.001),t=Se.now()*.001,r=Math.floor(t)+e,a=Math.floor(t%1*1e9);return n&&(r=r-n[0],a=a-n[1],a<0&&(r--,a+=mr)),[r,a]}function we(){return oi}function si(n){return[]}var be,ut,Pe,Gt,Hr,Jr,Yr,Kr,Xr,Qr,en,tn,rn,nn,an,sn,on,un,cn,ln,pn,fn,mn,hn,vn,bn,Jt,wn,_n,Tn,kn,En,In,Rn,Sn,Nn,Fn,Bn,On,Ln,Pn,jn,Mn,Un,$n,Dn,Vn,Wn,qn,zn,Zn,Gn,Se,fr,mr,Jn,Yn,Kn,Xn,Qn,ei,ti,ri,ni,ii,ai,oi,ui=ot(()=>{"use strict";p();f();d();be=[],ut=!1,Gt=-1;Gr.prototype.run=function(){this.fun.apply(null,this.array)};Hr="browser",Jr="x64",Yr="browser",Kr={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},Xr=["/usr/bin/node"],Qr=[],en="v16.8.0",tn={},rn=function(n,e){console.warn((e?e+": ":"")+n)},nn=function(n){hr("binding")},an=function(n){return 0},sn=function(){return"/"},on=function(n){},un={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};cn=!0,ln=Q,pn=[];fn={},mn=!1,hn={};vn=Q,bn=Q,Jt=function(){return{}},wn=Jt,_n=Jt,Tn=Q,kn=Q,En=Q,In={};Rn={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Sn=Q,Nn=Q;Fn=Q,Bn=Q,On=Q,Ln=Q,Pn=Q,jn=void 0,Mn=void 0,Un=void 0,$n=Q,Dn=2,Vn=1,Wn="/bin/usr/node",qn=9229,zn="node",Zn=[],Gn=Q,Se={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};Se.now===void 0&&(fr=Date.now(),Se.timing&&Se.timing.navigationStart&&(fr=Se.timing.navigationStart),Se.now=()=>Date.now()-fr);mr=1e9;Ht.bigint=function(n){var e=Ht(n);return typeof BigInt>"u"?e[0]*mr+e[1]:BigInt(e[0]*mr)+BigInt(e[1])};Jn=10,Yn={},Kn=0;Xn=we,Qn=we,ei=we,ti=we,ri=we,ni=Q,ii=we,ai=we;oi={version:en,versions:tn,arch:Jr,platform:Yr,browser:cn,release:un,_rawDebug:ln,moduleLoadList:pn,binding:nn,_linkedBinding:dn,_events:Yn,_eventsCount:Kn,_maxListeners:Jn,on:we,addListener:Xn,once:Qn,off:ei,removeListener:ti,removeAllListeners:ri,emit:ni,prependListener:ii,prependOnceListener:ai,listeners:si,domain:fn,_exiting:mn,config:hn,dlopen:yn,uptime:Hn,_getActiveRequests:gn,_getActiveHandles:xn,reallyExit:vn,_kill:bn,cpuUsage:Jt,resourceUsage:wn,memoryUsage:_n,kill:Tn,exit:kn,openStdin:En,allowedNodeEnvironmentFlags:In,assert:An,features:Rn,_fatalExceptions:Sn,setUncaughtExceptionCaptureCallback:Nn,hasUncaughtExceptionCaptureCallback:Cn,emitWarning:rn,nextTick:Zr,_tickCallback:Fn,_debugProcess:Bn,_debugEnd:On,_startProfilerIdleNotifier:Ln,_stopProfilerIdleNotifier:Pn,stdout:jn,stdin:Un,stderr:Mn,abort:$n,umask:an,chdir:on,cwd:sn,env:Kr,title:Hr,argv:Xr,execArgv:Qr,pid:Dn,ppid:Vn,execPath:Wn,debugPort:qn,hrtime:Ht,argv0:zn,_preload_modules:Zn,setSourceMapsEnabled:Gn}});var d=ot(()=>{"use strict";ui()});function ys(){if(ci)return At;ci=!0,At.byteLength=m,At.toByteArray=k,At.fromByteArray=Y;for(var n=[],e=[],t=typeof Uint8Array<"u"?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,o=r.length;a<o;++a)n[a]=r[a],e[r.charCodeAt(a)]=a;e[45]=62,e[95]=63;function u(C){var j=C.length;if(j%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var D=C.indexOf("=");D===-1&&(D=j);var J=D===j?0:4-D%4;return[D,J]}function m(C){var j=u(C),D=j[0],J=j[1];return(D+J)*3/4-J}function x(C,j,D){return(j+D)*3/4-D}function k(C){var j,D=u(C),J=D[0],re=D[1],H=new t(x(C,J,re)),ne=0,oe=re>0?J-4:J,te;for(te=0;te<oe;te+=4)j=e[C.charCodeAt(te)]<<18|e[C.charCodeAt(te+1)]<<12|e[C.charCodeAt(te+2)]<<6|e[C.charCodeAt(te+3)],H[ne++]=j>>16&255,H[ne++]=j>>8&255,H[ne++]=j&255;return re===2&&(j=e[C.charCodeAt(te)]<<2|e[C.charCodeAt(te+1)]>>4,H[ne++]=j&255),re===1&&(j=e[C.charCodeAt(te)]<<10|e[C.charCodeAt(te+1)]<<4|e[C.charCodeAt(te+2)]>>2,H[ne++]=j>>8&255,H[ne++]=j&255),H}function R(C){return n[C>>18&63]+n[C>>12&63]+n[C>>6&63]+n[C&63]}function P(C,j,D){for(var J,re=[],H=j;H<D;H+=3)J=(C[H]<<16&16711680)+(C[H+1]<<8&65280)+(C[H+2]&255),re.push(R(J));return re.join("")}function Y(C){for(var j,D=C.length,J=D%3,re=[],H=16383,ne=0,oe=D-J;ne<oe;ne+=H)re.push(P(C,ne,ne+H>oe?oe:ne+H));return J===1?(j=C[D-1],re.push(n[j>>2]+n[j<<4&63]+"==")):J===2&&(j=(C[D-2]<<8)+C[D-1],re.push(n[j>>10]+n[j>>4&63]+n[j<<2&63]+"=")),re.join("")}return At}function gs(){if(li)return Yt;li=!0;return Yt.read=function(n,e,t,r,a){var o,u,m=a*8-r-1,x=(1<<m)-1,k=x>>1,R=-7,P=t?a-1:0,Y=t?-1:1,C=n[e+P];for(P+=Y,o=C&(1<<-R)-1,C>>=-R,R+=m;R>0;o=o*256+n[e+P],P+=Y,R-=8);for(u=o&(1<<-R)-1,o>>=-R,R+=r;R>0;u=u*256+n[e+P],P+=Y,R-=8);if(o===0)o=1-k;else{if(o===x)return u?NaN:(C?-1:1)*(1/0);u=u+Math.pow(2,r),o=o-k}return(C?-1:1)*u*Math.pow(2,o-r)},Yt.write=function(n,e,t,r,a,o){var u,m,x,k=o*8-a-1,R=(1<<k)-1,P=R>>1,Y=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,C=r?0:o-1,j=r?1:-1,D=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(m=isNaN(e)?1:0,u=R):(u=Math.floor(Math.log(e)/Math.LN2),e*(x=Math.pow(2,-u))<1&&(u--,x*=2),u+P>=1?e+=Y/x:e+=Y*Math.pow(2,1-P),e*x>=2&&(u++,x/=2),u+P>=R?(m=0,u=R):u+P>=1?(m=(e*x-1)*Math.pow(2,a),u=u+P):(m=e*Math.pow(2,P-1)*Math.pow(2,a),u=0));a>=8;n[t+C]=m&255,C+=j,m/=256,a-=8);for(u=u<<a|m,k+=a;k>0;n[t+C]=u&255,C+=j,u/=256,k-=8);n[t+C-j]|=D*128},Yt}function di(){if(pi)return je;pi=!0;let n=ys(),e=gs(),t=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;je.Buffer=u,je.SlowBuffer=re,je.INSPECT_MAX_BYTES=50;let r=2147483647;je.kMaxLength=r,u.TYPED_ARRAY_SUPPORT=a(),!u.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{let c=new Uint8Array(1),i={foo:function(){return 42}};return Object.setPrototypeOf(i,Uint8Array.prototype),Object.setPrototypeOf(c,i),c.foo()===42}catch{return!1}}Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}});function o(c){if(c>r)throw new RangeError('The value "'+c+'" is invalid for option "size"');let i=new Uint8Array(c);return Object.setPrototypeOf(i,u.prototype),i}function u(c,i,s){if(typeof c=="number"){if(typeof i=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return R(c)}return m(c,i,s)}u.poolSize=8192;function m(c,i,s){if(typeof c=="string")return P(c,i);if(ArrayBuffer.isView(c))return C(c);if(c==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof c);if(me(c,ArrayBuffer)||c&&me(c.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(me(c,SharedArrayBuffer)||c&&me(c.buffer,SharedArrayBuffer)))return j(c,i,s);if(typeof c=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let l=c.valueOf&&c.valueOf();if(l!=null&&l!==c)return u.from(l,i,s);let h=D(c);if(h)return h;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof c[Symbol.toPrimitive]=="function")return u.from(c[Symbol.toPrimitive]("string"),i,s);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof c)}u.from=function(c,i,s){return m(c,i,s)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array);function x(c){if(typeof c!="number")throw new TypeError('"size" argument must be of type number');if(c<0)throw new RangeError('The value "'+c+'" is invalid for option "size"')}function k(c,i,s){return x(c),c<=0?o(c):i!==void 0?typeof s=="string"?o(c).fill(i,s):o(c).fill(i):o(c)}u.alloc=function(c,i,s){return k(c,i,s)};function R(c){return x(c),o(c<0?0:J(c)|0)}u.allocUnsafe=function(c){return R(c)},u.allocUnsafeSlow=function(c){return R(c)};function P(c,i){if((typeof i!="string"||i==="")&&(i="utf8"),!u.isEncoding(i))throw new TypeError("Unknown encoding: "+i);let s=H(c,i)|0,l=o(s),h=l.write(c,i);return h!==s&&(l=l.slice(0,h)),l}function Y(c){let i=c.length<0?0:J(c.length)|0,s=o(i);for(let l=0;l<i;l+=1)s[l]=c[l]&255;return s}function C(c){if(me(c,Uint8Array)){let i=new Uint8Array(c);return j(i.buffer,i.byteOffset,i.byteLength)}return Y(c)}function j(c,i,s){if(i<0||c.byteLength<i)throw new RangeError('"offset" is outside of buffer bounds');if(c.byteLength<i+(s||0))throw new RangeError('"length" is outside of buffer bounds');let l;return i===void 0&&s===void 0?l=new Uint8Array(c):s===void 0?l=new Uint8Array(c,i):l=new Uint8Array(c,i,s),Object.setPrototypeOf(l,u.prototype),l}function D(c){if(u.isBuffer(c)){let i=J(c.length)|0,s=o(i);return s.length===0||c.copy(s,0,0,i),s}if(c.length!==void 0)return typeof c.length!="number"||dr(c.length)?o(0):Y(c);if(c.type==="Buffer"&&Array.isArray(c.data))return Y(c.data)}function J(c){if(c>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return c|0}function re(c){return+c!=c&&(c=0),u.alloc(+c)}u.isBuffer=function(i){return i!=null&&i._isBuffer===!0&&i!==u.prototype},u.compare=function(i,s){if(me(i,Uint8Array)&&(i=u.from(i,i.offset,i.byteLength)),me(s,Uint8Array)&&(s=u.from(s,s.offset,s.byteLength)),!u.isBuffer(i)||!u.isBuffer(s))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(i===s)return 0;let l=i.length,h=s.length;for(let g=0,_=Math.min(l,h);g<_;++g)if(i[g]!==s[g]){l=i[g],h=s[g];break}return l<h?-1:h<l?1:0},u.isEncoding=function(i){switch(String(i).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}},u.concat=function(i,s){if(!Array.isArray(i))throw new TypeError('"list" argument must be an Array of Buffers');if(i.length===0)return u.alloc(0);let l;if(s===void 0)for(s=0,l=0;l<i.length;++l)s+=i[l].length;let h=u.allocUnsafe(s),g=0;for(l=0;l<i.length;++l){let _=i[l];if(me(_,Uint8Array))g+_.length>h.length?(u.isBuffer(_)||(_=u.from(_)),_.copy(h,g)):Uint8Array.prototype.set.call(h,_,g);else if(u.isBuffer(_))_.copy(h,g);else throw new TypeError('"list" argument must be an Array of Buffers');g+=_.length}return h};function H(c,i){if(u.isBuffer(c))return c.length;if(ArrayBuffer.isView(c)||me(c,ArrayBuffer))return c.byteLength;if(typeof c!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof c);let s=c.length,l=arguments.length>2&&arguments[2]===!0;if(!l&&s===0)return 0;let h=!1;for(;;)switch(i){case"ascii":case"latin1":case"binary":return s;case"utf8":case"utf-8":return pr(c).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s*2;case"hex":return s>>>1;case"base64":return Wr(c).length;default:if(h)return l?-1:pr(c).length;i=(""+i).toLowerCase(),h=!0}}u.byteLength=H;function ne(c,i,s){let l=!1;if((i===void 0||i<0)&&(i=0),i>this.length||((s===void 0||s>this.length)&&(s=this.length),s<=0)||(s>>>=0,i>>>=0,s<=i))return"";for(c||(c="utf8");;)switch(c){case"hex":return as(this,i,s);case"utf8":case"utf-8":return Or(this,i,s);case"ascii":return ns(this,i,s);case"latin1":case"binary":return is(this,i,s);case"base64":return ts(this,i,s);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ss(this,i,s);default:if(l)throw new TypeError("Unknown encoding: "+c);c=(c+"").toLowerCase(),l=!0}}u.prototype._isBuffer=!0;function oe(c,i,s){let l=c[i];c[i]=c[s],c[s]=l}u.prototype.swap16=function(){let i=this.length;if(i%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let s=0;s<i;s+=2)oe(this,s,s+1);return this},u.prototype.swap32=function(){let i=this.length;if(i%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let s=0;s<i;s+=4)oe(this,s,s+3),oe(this,s+1,s+2);return this},u.prototype.swap64=function(){let i=this.length;if(i%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let s=0;s<i;s+=8)oe(this,s,s+7),oe(this,s+1,s+6),oe(this,s+2,s+5),oe(this,s+3,s+4);return this},u.prototype.toString=function(){let i=this.length;return i===0?"":arguments.length===0?Or(this,0,i):ne.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(i){if(!u.isBuffer(i))throw new TypeError("Argument must be a Buffer");return this===i?!0:u.compare(this,i)===0},u.prototype.inspect=function(){let i="",s=je.INSPECT_MAX_BYTES;return i=this.toString("hex",0,s).replace(/(.{2})/g,"$1 ").trim(),this.length>s&&(i+=" ... "),"<Buffer "+i+">"},t&&(u.prototype[t]=u.prototype.inspect),u.prototype.compare=function(i,s,l,h,g){if(me(i,Uint8Array)&&(i=u.from(i,i.offset,i.byteLength)),!u.isBuffer(i))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof i);if(s===void 0&&(s=0),l===void 0&&(l=i?i.length:0),h===void 0&&(h=0),g===void 0&&(g=this.length),s<0||l>i.length||h<0||g>this.length)throw new RangeError("out of range index");if(h>=g&&s>=l)return 0;if(h>=g)return-1;if(s>=l)return 1;if(s>>>=0,l>>>=0,h>>>=0,g>>>=0,this===i)return 0;let _=g-h,M=l-s,Z=Math.min(_,M),z=this.slice(h,g),G=i.slice(s,l);for(let V=0;V<Z;++V)if(z[V]!==G[V]){_=z[V],M=G[V];break}return _<M?-1:M<_?1:0};function te(c,i,s,l,h){if(c.length===0)return-1;if(typeof s=="string"?(l=s,s=0):s>2147483647?s=2147483647:s<-2147483648&&(s=-2147483648),s=+s,dr(s)&&(s=h?0:c.length-1),s<0&&(s=c.length+s),s>=c.length){if(h)return-1;s=c.length-1}else if(s<0)if(h)s=0;else return-1;if(typeof i=="string"&&(i=u.from(i,l)),u.isBuffer(i))return i.length===0?-1:Br(c,i,s,l,h);if(typeof i=="number")return i=i&255,typeof Uint8Array.prototype.indexOf=="function"?h?Uint8Array.prototype.indexOf.call(c,i,s):Uint8Array.prototype.lastIndexOf.call(c,i,s):Br(c,[i],s,l,h);throw new TypeError("val must be string, number or Buffer")}function Br(c,i,s,l,h){let g=1,_=c.length,M=i.length;if(l!==void 0&&(l=String(l).toLowerCase(),l==="ucs2"||l==="ucs-2"||l==="utf16le"||l==="utf-16le")){if(c.length<2||i.length<2)return-1;g=2,_/=2,M/=2,s/=2}function Z(G,V){return g===1?G[V]:G.readUInt16BE(V*g)}let z;if(h){let G=-1;for(z=s;z<_;z++)if(Z(c,z)===Z(i,G===-1?0:z-G)){if(G===-1&&(G=z),z-G+1===M)return G*g}else G!==-1&&(z-=z-G),G=-1}else for(s+M>_&&(s=_-M),z=s;z>=0;z--){let G=!0;for(let V=0;V<M;V++)if(Z(c,z+V)!==Z(i,V)){G=!1;break}if(G)return z}return-1}u.prototype.includes=function(i,s,l){return this.indexOf(i,s,l)!==-1},u.prototype.indexOf=function(i,s,l){return te(this,i,s,l,!0)},u.prototype.lastIndexOf=function(i,s,l){return te(this,i,s,l,!1)};function Ya(c,i,s,l){s=Number(s)||0;let h=c.length-s;l?(l=Number(l),l>h&&(l=h)):l=h;let g=i.length;l>g/2&&(l=g/2);let _;for(_=0;_<l;++_){let M=parseInt(i.substr(_*2,2),16);if(dr(M))return _;c[s+_]=M}return _}function Ka(c,i,s,l){return Zt(pr(i,c.length-s),c,s,l)}function Xa(c,i,s,l){return Zt(ls(i),c,s,l)}function Qa(c,i,s,l){return Zt(Wr(i),c,s,l)}function es(c,i,s,l){return Zt(ps(i,c.length-s),c,s,l)}u.prototype.write=function(i,s,l,h){if(s===void 0)h="utf8",l=this.length,s=0;else if(l===void 0&&typeof s=="string")h=s,l=this.length,s=0;else if(isFinite(s))s=s>>>0,isFinite(l)?(l=l>>>0,h===void 0&&(h="utf8")):(h=l,l=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let g=this.length-s;if((l===void 0||l>g)&&(l=g),i.length>0&&(l<0||s<0)||s>this.length)throw new RangeError("Attempt to write outside buffer bounds");h||(h="utf8");let _=!1;for(;;)switch(h){case"hex":return Ya(this,i,s,l);case"utf8":case"utf-8":return Ka(this,i,s,l);case"ascii":case"latin1":case"binary":return Xa(this,i,s,l);case"base64":return Qa(this,i,s,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return es(this,i,s,l);default:if(_)throw new TypeError("Unknown encoding: "+h);h=(""+h).toLowerCase(),_=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ts(c,i,s){return i===0&&s===c.length?n.fromByteArray(c):n.fromByteArray(c.slice(i,s))}function Or(c,i,s){s=Math.min(c.length,s);let l=[],h=i;for(;h<s;){let g=c[h],_=null,M=g>239?4:g>223?3:g>191?2:1;if(h+M<=s){let Z,z,G,V;switch(M){case 1:g<128&&(_=g);break;case 2:Z=c[h+1],(Z&192)===128&&(V=(g&31)<<6|Z&63,V>127&&(_=V));break;case 3:Z=c[h+1],z=c[h+2],(Z&192)===128&&(z&192)===128&&(V=(g&15)<<12|(Z&63)<<6|z&63,V>2047&&(V<55296||V>57343)&&(_=V));break;case 4:Z=c[h+1],z=c[h+2],G=c[h+3],(Z&192)===128&&(z&192)===128&&(G&192)===128&&(V=(g&15)<<18|(Z&63)<<12|(z&63)<<6|G&63,V>65535&&V<1114112&&(_=V))}}_===null?(_=65533,M=1):_>65535&&(_-=65536,l.push(_>>>10&1023|55296),_=56320|_&1023),l.push(_),h+=M}return rs(l)}let Lr=4096;function rs(c){let i=c.length;if(i<=Lr)return String.fromCharCode.apply(String,c);let s="",l=0;for(;l<i;)s+=String.fromCharCode.apply(String,c.slice(l,l+=Lr));return s}function ns(c,i,s){let l="";s=Math.min(c.length,s);for(let h=i;h<s;++h)l+=String.fromCharCode(c[h]&127);return l}function is(c,i,s){let l="";s=Math.min(c.length,s);for(let h=i;h<s;++h)l+=String.fromCharCode(c[h]);return l}function as(c,i,s){let l=c.length;(!i||i<0)&&(i=0),(!s||s<0||s>l)&&(s=l);let h="";for(let g=i;g<s;++g)h+=ds[c[g]];return h}function ss(c,i,s){let l=c.slice(i,s),h="";for(let g=0;g<l.length-1;g+=2)h+=String.fromCharCode(l[g]+l[g+1]*256);return h}u.prototype.slice=function(i,s){let l=this.length;i=~~i,s=s===void 0?l:~~s,i<0?(i+=l,i<0&&(i=0)):i>l&&(i=l),s<0?(s+=l,s<0&&(s=0)):s>l&&(s=l),s<i&&(s=i);let h=this.subarray(i,s);return Object.setPrototypeOf(h,u.prototype),h};function K(c,i,s){if(c%1!==0||c<0)throw new RangeError("offset is not uint");if(c+i>s)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUintLE=u.prototype.readUIntLE=function(i,s,l){i=i>>>0,s=s>>>0,l||K(i,s,this.length);let h=this[i],g=1,_=0;for(;++_<s&&(g*=256);)h+=this[i+_]*g;return h},u.prototype.readUintBE=u.prototype.readUIntBE=function(i,s,l){i=i>>>0,s=s>>>0,l||K(i,s,this.length);let h=this[i+--s],g=1;for(;s>0&&(g*=256);)h+=this[i+--s]*g;return h},u.prototype.readUint8=u.prototype.readUInt8=function(i,s){return i=i>>>0,s||K(i,1,this.length),this[i]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(i,s){return i=i>>>0,s||K(i,2,this.length),this[i]|this[i+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(i,s){return i=i>>>0,s||K(i,2,this.length),this[i]<<8|this[i+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(i,s){return i=i>>>0,s||K(i,4,this.length),(this[i]|this[i+1]<<8|this[i+2]<<16)+this[i+3]*16777216},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(i,s){return i=i>>>0,s||K(i,4,this.length),this[i]*16777216+(this[i+1]<<16|this[i+2]<<8|this[i+3])},u.prototype.readBigUInt64LE=Re(function(i){i=i>>>0,st(i,"offset");let s=this[i],l=this[i+7];(s===void 0||l===void 0)&&It(i,this.length-8);let h=s+this[++i]*2**8+this[++i]*2**16+this[++i]*2**24,g=this[++i]+this[++i]*2**8+this[++i]*2**16+l*2**24;return BigInt(h)+(BigInt(g)<<BigInt(32))}),u.prototype.readBigUInt64BE=Re(function(i){i=i>>>0,st(i,"offset");let s=this[i],l=this[i+7];(s===void 0||l===void 0)&&It(i,this.length-8);let h=s*2**24+this[++i]*2**16+this[++i]*2**8+this[++i],g=this[++i]*2**24+this[++i]*2**16+this[++i]*2**8+l;return(BigInt(h)<<BigInt(32))+BigInt(g)}),u.prototype.readIntLE=function(i,s,l){i=i>>>0,s=s>>>0,l||K(i,s,this.length);let h=this[i],g=1,_=0;for(;++_<s&&(g*=256);)h+=this[i+_]*g;return g*=128,h>=g&&(h-=Math.pow(2,8*s)),h},u.prototype.readIntBE=function(i,s,l){i=i>>>0,s=s>>>0,l||K(i,s,this.length);let h=s,g=1,_=this[i+--h];for(;h>0&&(g*=256);)_+=this[i+--h]*g;return g*=128,_>=g&&(_-=Math.pow(2,8*s)),_},u.prototype.readInt8=function(i,s){return i=i>>>0,s||K(i,1,this.length),this[i]&128?(255-this[i]+1)*-1:this[i]},u.prototype.readInt16LE=function(i,s){i=i>>>0,s||K(i,2,this.length);let l=this[i]|this[i+1]<<8;return l&32768?l|4294901760:l},u.prototype.readInt16BE=function(i,s){i=i>>>0,s||K(i,2,this.length);let l=this[i+1]|this[i]<<8;return l&32768?l|4294901760:l},u.prototype.readInt32LE=function(i,s){return i=i>>>0,s||K(i,4,this.length),this[i]|this[i+1]<<8|this[i+2]<<16|this[i+3]<<24},u.prototype.readInt32BE=function(i,s){return i=i>>>0,s||K(i,4,this.length),this[i]<<24|this[i+1]<<16|this[i+2]<<8|this[i+3]},u.prototype.readBigInt64LE=Re(function(i){i=i>>>0,st(i,"offset");let s=this[i],l=this[i+7];(s===void 0||l===void 0)&&It(i,this.length-8);let h=this[i+4]+this[i+5]*2**8+this[i+6]*2**16+(l<<24);return(BigInt(h)<<BigInt(32))+BigInt(s+this[++i]*2**8+this[++i]*2**16+this[++i]*2**24)}),u.prototype.readBigInt64BE=Re(function(i){i=i>>>0,st(i,"offset");let s=this[i],l=this[i+7];(s===void 0||l===void 0)&&It(i,this.length-8);let h=(s<<24)+this[++i]*2**16+this[++i]*2**8+this[++i];return(BigInt(h)<<BigInt(32))+BigInt(this[++i]*2**24+this[++i]*2**16+this[++i]*2**8+l)}),u.prototype.readFloatLE=function(i,s){return i=i>>>0,s||K(i,4,this.length),e.read(this,i,!0,23,4)},u.prototype.readFloatBE=function(i,s){return i=i>>>0,s||K(i,4,this.length),e.read(this,i,!1,23,4)},u.prototype.readDoubleLE=function(i,s){return i=i>>>0,s||K(i,8,this.length),e.read(this,i,!0,52,8)},u.prototype.readDoubleBE=function(i,s){return i=i>>>0,s||K(i,8,this.length),e.read(this,i,!1,52,8)};function ie(c,i,s,l,h,g){if(!u.isBuffer(c))throw new TypeError('"buffer" argument must be a Buffer instance');if(i>h||i<g)throw new RangeError('"value" argument is out of bounds');if(s+l>c.length)throw new RangeError("Index out of range")}u.prototype.writeUintLE=u.prototype.writeUIntLE=function(i,s,l,h){if(i=+i,s=s>>>0,l=l>>>0,!h){let M=Math.pow(2,8*l)-1;ie(this,i,s,l,M,0)}let g=1,_=0;for(this[s]=i&255;++_<l&&(g*=256);)this[s+_]=i/g&255;return s+l},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(i,s,l,h){if(i=+i,s=s>>>0,l=l>>>0,!h){let M=Math.pow(2,8*l)-1;ie(this,i,s,l,M,0)}let g=l-1,_=1;for(this[s+g]=i&255;--g>=0&&(_*=256);)this[s+g]=i/_&255;return s+l},u.prototype.writeUint8=u.prototype.writeUInt8=function(i,s,l){return i=+i,s=s>>>0,l||ie(this,i,s,1,255,0),this[s]=i&255,s+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(i,s,l){return i=+i,s=s>>>0,l||ie(this,i,s,2,65535,0),this[s]=i&255,this[s+1]=i>>>8,s+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(i,s,l){return i=+i,s=s>>>0,l||ie(this,i,s,2,65535,0),this[s]=i>>>8,this[s+1]=i&255,s+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(i,s,l){return i=+i,s=s>>>0,l||ie(this,i,s,4,4294967295,0),this[s+3]=i>>>24,this[s+2]=i>>>16,this[s+1]=i>>>8,this[s]=i&255,s+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(i,s,l){return i=+i,s=s>>>0,l||ie(this,i,s,4,4294967295,0),this[s]=i>>>24,this[s+1]=i>>>16,this[s+2]=i>>>8,this[s+3]=i&255,s+4};function Pr(c,i,s,l,h){Vr(i,l,h,c,s,7);let g=Number(i&BigInt(4294967295));c[s++]=g,g=g>>8,c[s++]=g,g=g>>8,c[s++]=g,g=g>>8,c[s++]=g;let _=Number(i>>BigInt(32)&BigInt(4294967295));return c[s++]=_,_=_>>8,c[s++]=_,_=_>>8,c[s++]=_,_=_>>8,c[s++]=_,s}function jr(c,i,s,l,h){Vr(i,l,h,c,s,7);let g=Number(i&BigInt(4294967295));c[s+7]=g,g=g>>8,c[s+6]=g,g=g>>8,c[s+5]=g,g=g>>8,c[s+4]=g;let _=Number(i>>BigInt(32)&BigInt(4294967295));return c[s+3]=_,_=_>>8,c[s+2]=_,_=_>>8,c[s+1]=_,_=_>>8,c[s]=_,s+8}u.prototype.writeBigUInt64LE=Re(function(i,s=0){return Pr(this,i,s,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeBigUInt64BE=Re(function(i,s=0){return jr(this,i,s,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeIntLE=function(i,s,l,h){if(i=+i,s=s>>>0,!h){let Z=Math.pow(2,8*l-1);ie(this,i,s,l,Z-1,-Z)}let g=0,_=1,M=0;for(this[s]=i&255;++g<l&&(_*=256);)i<0&&M===0&&this[s+g-1]!==0&&(M=1),this[s+g]=(i/_>>0)-M&255;return s+l},u.prototype.writeIntBE=function(i,s,l,h){if(i=+i,s=s>>>0,!h){let Z=Math.pow(2,8*l-1);ie(this,i,s,l,Z-1,-Z)}let g=l-1,_=1,M=0;for(this[s+g]=i&255;--g>=0&&(_*=256);)i<0&&M===0&&this[s+g+1]!==0&&(M=1),this[s+g]=(i/_>>0)-M&255;return s+l},u.prototype.writeInt8=function(i,s,l){return i=+i,s=s>>>0,l||ie(this,i,s,1,127,-128),i<0&&(i=255+i+1),this[s]=i&255,s+1},u.prototype.writeInt16LE=function(i,s,l){return i=+i,s=s>>>0,l||ie(this,i,s,2,32767,-32768),this[s]=i&255,this[s+1]=i>>>8,s+2},u.prototype.writeInt16BE=function(i,s,l){return i=+i,s=s>>>0,l||ie(this,i,s,2,32767,-32768),this[s]=i>>>8,this[s+1]=i&255,s+2},u.prototype.writeInt32LE=function(i,s,l){return i=+i,s=s>>>0,l||ie(this,i,s,4,2147483647,-2147483648),this[s]=i&255,this[s+1]=i>>>8,this[s+2]=i>>>16,this[s+3]=i>>>24,s+4},u.prototype.writeInt32BE=function(i,s,l){return i=+i,s=s>>>0,l||ie(this,i,s,4,2147483647,-2147483648),i<0&&(i=4294967295+i+1),this[s]=i>>>24,this[s+1]=i>>>16,this[s+2]=i>>>8,this[s+3]=i&255,s+4},u.prototype.writeBigInt64LE=Re(function(i,s=0){return Pr(this,i,s,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeBigInt64BE=Re(function(i,s=0){return jr(this,i,s,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Mr(c,i,s,l,h,g){if(s+l>c.length)throw new RangeError("Index out of range");if(s<0)throw new RangeError("Index out of range")}function Ur(c,i,s,l,h){return i=+i,s=s>>>0,h||Mr(c,i,s,4),e.write(c,i,s,l,23,4),s+4}u.prototype.writeFloatLE=function(i,s,l){return Ur(this,i,s,!0,l)},u.prototype.writeFloatBE=function(i,s,l){return Ur(this,i,s,!1,l)};function $r(c,i,s,l,h){return i=+i,s=s>>>0,h||Mr(c,i,s,8),e.write(c,i,s,l,52,8),s+8}u.prototype.writeDoubleLE=function(i,s,l){return $r(this,i,s,!0,l)},u.prototype.writeDoubleBE=function(i,s,l){return $r(this,i,s,!1,l)},u.prototype.copy=function(i,s,l,h){if(!u.isBuffer(i))throw new TypeError("argument should be a Buffer");if(l||(l=0),!h&&h!==0&&(h=this.length),s>=i.length&&(s=i.length),s||(s=0),h>0&&h<l&&(h=l),h===l||i.length===0||this.length===0)return 0;if(s<0)throw new RangeError("targetStart out of bounds");if(l<0||l>=this.length)throw new RangeError("Index out of range");if(h<0)throw new RangeError("sourceEnd out of bounds");h>this.length&&(h=this.length),i.length-s<h-l&&(h=i.length-s+l);let g=h-l;return this===i&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(s,l,h):Uint8Array.prototype.set.call(i,this.subarray(l,h),s),g},u.prototype.fill=function(i,s,l,h){if(typeof i=="string"){if(typeof s=="string"?(h=s,s=0,l=this.length):typeof l=="string"&&(h=l,l=this.length),h!==void 0&&typeof h!="string")throw new TypeError("encoding must be a string");if(typeof h=="string"&&!u.isEncoding(h))throw new TypeError("Unknown encoding: "+h);if(i.length===1){let _=i.charCodeAt(0);(h==="utf8"&&_<128||h==="latin1")&&(i=_)}}else typeof i=="number"?i=i&255:typeof i=="boolean"&&(i=Number(i));if(s<0||this.length<s||this.length<l)throw new RangeError("Out of range index");if(l<=s)return this;s=s>>>0,l=l===void 0?this.length:l>>>0,i||(i=0);let g;if(typeof i=="number")for(g=s;g<l;++g)this[g]=i;else{let _=u.isBuffer(i)?i:u.from(i,h),M=_.length;if(M===0)throw new TypeError('The value "'+i+'" is invalid for argument "value"');for(g=0;g<l-s;++g)this[g+s]=_[g%M]}return this};let at={};function lr(c,i,s){at[c]=class extends s{constructor(){super(),Object.defineProperty(this,"message",{value:i.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${c}]`,this.stack,delete this.name}get code(){return c}set code(h){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:h,writable:!0})}toString(){return`${this.name} [${c}]: ${this.message}`}}}lr("ERR_BUFFER_OUT_OF_BOUNDS",function(c){return c?`${c} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),lr("ERR_INVALID_ARG_TYPE",function(c,i){return`The "${c}" argument must be of type number. Received type ${typeof i}`},TypeError),lr("ERR_OUT_OF_RANGE",function(c,i,s){let l=`The value of "${c}" is out of range.`,h=s;return Number.isInteger(s)&&Math.abs(s)>2**32?h=Dr(String(s)):typeof s=="bigint"&&(h=String(s),(s>BigInt(2)**BigInt(32)||s<-(BigInt(2)**BigInt(32)))&&(h=Dr(h)),h+="n"),l+=` It must be ${i}. Received ${h}`,l},RangeError);function Dr(c){let i="",s=c.length,l=c[0]==="-"?1:0;for(;s>=l+4;s-=3)i=`_${c.slice(s-3,s)}${i}`;return`${c.slice(0,s)}${i}`}function os(c,i,s){st(i,"offset"),(c[i]===void 0||c[i+s]===void 0)&&It(i,c.length-(s+1))}function Vr(c,i,s,l,h,g){if(c>s||c<i){let _=typeof i=="bigint"?"n":"",M;throw i===0||i===BigInt(0)?M=`>= 0${_} and < 2${_} ** ${(g+1)*8}${_}`:M=`>= -(2${_} ** ${(g+1)*8-1}${_}) and < 2 ** ${(g+1)*8-1}${_}`,new at.ERR_OUT_OF_RANGE("value",M,c)}os(l,h,g)}function st(c,i){if(typeof c!="number")throw new at.ERR_INVALID_ARG_TYPE(i,"number",c)}function It(c,i,s){throw Math.floor(c)!==c?(st(c,s),new at.ERR_OUT_OF_RANGE("offset","an integer",c)):i<0?new at.ERR_BUFFER_OUT_OF_BOUNDS:new at.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${i}`,c)}let us=/[^+/0-9A-Za-z-_]/g;function cs(c){if(c=c.split("=")[0],c=c.trim().replace(us,""),c.length<2)return"";for(;c.length%4!==0;)c=c+"=";return c}function pr(c,i){i=i||1/0;let s,l=c.length,h=null,g=[];for(let _=0;_<l;++_){if(s=c.charCodeAt(_),s>55295&&s<57344){if(!h){if(s>56319){(i-=3)>-1&&g.push(239,191,189);continue}else if(_+1===l){(i-=3)>-1&&g.push(239,191,189);continue}h=s;continue}if(s<56320){(i-=3)>-1&&g.push(239,191,189),h=s;continue}s=(h-55296<<10|s-56320)+65536}else h&&(i-=3)>-1&&g.push(239,191,189);if(h=null,s<128){if((i-=1)<0)break;g.push(s)}else if(s<2048){if((i-=2)<0)break;g.push(s>>6|192,s&63|128)}else if(s<65536){if((i-=3)<0)break;g.push(s>>12|224,s>>6&63|128,s&63|128)}else if(s<1114112){if((i-=4)<0)break;g.push(s>>18|240,s>>12&63|128,s>>6&63|128,s&63|128)}else throw new Error("Invalid code point")}return g}function ls(c){let i=[];for(let s=0;s<c.length;++s)i.push(c.charCodeAt(s)&255);return i}function ps(c,i){let s,l,h,g=[];for(let _=0;_<c.length&&!((i-=2)<0);++_)s=c.charCodeAt(_),l=s>>8,h=s%256,g.push(h),g.push(l);return g}function Wr(c){return n.toByteArray(cs(c))}function Zt(c,i,s,l){let h;for(h=0;h<l&&!(h+s>=i.length||h>=c.length);++h)i[h+s]=c[h];return h}function me(c,i){return c instanceof i||c!=null&&c.constructor!=null&&c.constructor.name!=null&&c.constructor.name===i.name}function dr(c){return c!==c}let ds=(function(){let c="0123456789abcdef",i=new Array(256);for(let s=0;s<16;++s){let l=s*16;for(let h=0;h<16;++h)i[l+h]=c[s]+c[h]}return i})();function Re(c){return typeof BigInt>"u"?fs:c}function fs(){throw new Error("BigInt not supported")}return je}var At,ci,Yt,li,je,pi,fi=ot(()=>{"use strict";p();f();d();At={},ci=!1;Yt={},li=!1;je={},pi=!1});var Me,b,Gc,Hc,mi=ot(()=>{"use strict";p();f();d();fi();Me=di();Me.Buffer;Me.SlowBuffer;Me.INSPECT_MAX_BYTES;Me.kMaxLength;b=Me.Buffer,Gc=Me.INSPECT_MAX_BYTES,Hc=Me.kMaxLength});var f=ot(()=>{"use strict";mi()});p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();var xs=typeof global=="object"&&global&&global.Object===Object&&global,hi=xs;var vs=typeof self=="object"&&self&&self.Object===Object&&self,bs=hi||vs||Function("return this")(),yi=bs;var ws=yi.Symbol,_e=ws;p();f();d();var gi=Object.prototype,_s=gi.hasOwnProperty,Ts=gi.toString,Rt=_e?_e.toStringTag:void 0;function ks(n){var e=_s.call(n,Rt),t=n[Rt];try{n[Rt]=void 0;var r=!0}catch{}var a=Ts.call(n);return r&&(e?n[Rt]=t:delete n[Rt]),a}var xi=ks;p();f();d();var Es=Object.prototype,Is=Es.toString;function As(n){return Is.call(n)}var vi=As;var Rs="[object Null]",Ss="[object Undefined]",bi=_e?_e.toStringTag:void 0;function Ns(n){return n==null?n===void 0?Ss:Rs:bi&&bi in Object(n)?xi(n):vi(n)}var wi=Ns;p();f();d();function Cs(n){return n!=null&&typeof n=="object"}var _i=Cs;var Fs="[object Symbol]";function Bs(n){return typeof n=="symbol"||_i(n)&&wi(n)==Fs}var Ti=Bs;p();f();d();p();f();d();function Os(n,e){for(var t=-1,r=n==null?0:n.length,a=Array(r);++t<r;)a[t]=e(n[t],t,n);return a}var ki=Os;p();f();d();var Ls=Array.isArray,Ei=Ls;var Ps=1/0,Ii=_e?_e.prototype:void 0,Ai=Ii?Ii.toString:void 0;function Ri(n){if(typeof n=="string")return n;if(Ei(n))return ki(n,Ri)+"";if(Ti(n))return Ai?Ai.call(n):"";var e=n+"";return e=="0"&&1/n==-Ps?"-0":e}var Si=Ri;p();f();d();function js(n){return n==null?"":Si(n)}var Ne=js;p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();function Ms(n,e,t){var r=-1,a=n.length;e<0&&(e=-e>a?0:a+e),t=t>a?a:t,t<0&&(t+=a),a=e>t?0:t-e>>>0,e>>>=0;for(var o=Array(a);++r<a;)o[r]=n[r+e];return o}var Ni=Ms;function Us(n,e,t){var r=n.length;return t=t===void 0?r:t,!e&&t>=r?n:Ni(n,e,t)}var Ci=Us;p();f();d();var $s="\\ud800-\\udfff",Ds="\\u0300-\\u036f",Vs="\\ufe20-\\ufe2f",Ws="\\u20d0-\\u20ff",qs=Ds+Vs+Ws,zs="\\ufe0e\\ufe0f",Zs="\\u200d",Gs=RegExp("["+Zs+$s+qs+zs+"]");function Hs(n){return Gs.test(n)}var Kt=Hs;p();f();d();p();f();d();function Js(n){return n.split("")}var Fi=Js;p();f();d();var Bi="\\ud800-\\udfff",Ys="\\u0300-\\u036f",Ks="\\ufe20-\\ufe2f",Xs="\\u20d0-\\u20ff",Qs=Ys+Ks+Xs,eo="\\ufe0e\\ufe0f",to="["+Bi+"]",yr="["+Qs+"]",gr="\\ud83c[\\udffb-\\udfff]",ro="(?:"+yr+"|"+gr+")",Oi="[^"+Bi+"]",Li="(?:\\ud83c[\\udde6-\\uddff]){2}",Pi="[\\ud800-\\udbff][\\udc00-\\udfff]",no="\\u200d",ji=ro+"?",Mi="["+eo+"]?",io="(?:"+no+"(?:"+[Oi,Li,Pi].join("|")+")"+Mi+ji+")*",ao=Mi+ji+io,so="(?:"+[Oi+yr+"?",yr,Li,Pi,to].join("|")+")",oo=RegExp(gr+"(?="+gr+")|"+so+ao,"g");function uo(n){return n.match(oo)||[]}var Ui=uo;function co(n){return Kt(n)?Ui(n):Fi(n)}var $i=co;function lo(n){return function(e){e=Ne(e);var t=Kt(e)?$i(e):void 0,r=t?t[0]:e.charAt(0),a=t?Ci(t,1).join(""):e.slice(1);return r[n]()+a}}var Di=lo;var po=Di("toUpperCase"),Ue=po;function fo(n){return Ue(Ne(n).toLowerCase())}var Vi=fo;p();f();d();p();f();d();function mo(n,e,t,r){var a=-1,o=n==null?0:n.length;for(r&&o&&(t=n[++a]);++a<o;)t=e(t,n[a],a,n);return t}var Wi=mo;p();f();d();p();f();d();p();f();d();function ho(n){return function(e){return n?.[e]}}var qi=ho;var yo={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},go=qi(yo),zi=go;var xo=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,vo="\\u0300-\\u036f",bo="\\ufe20-\\ufe2f",wo="\\u20d0-\\u20ff",_o=vo+bo+wo,To="["+_o+"]",ko=RegExp(To,"g");function Eo(n){return n=Ne(n),n&&n.replace(xo,zi).replace(ko,"")}var Zi=Eo;p();f();d();p();f();d();var Io=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Ao(n){return n.match(Io)||[]}var Gi=Ao;p();f();d();var Ro=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function So(n){return Ro.test(n)}var Hi=So;p();f();d();var Qi="\\ud800-\\udfff",No="\\u0300-\\u036f",Co="\\ufe20-\\ufe2f",Fo="\\u20d0-\\u20ff",Bo=No+Co+Fo,ea="\\u2700-\\u27bf",ta="a-z\\xdf-\\xf6\\xf8-\\xff",Oo="\\xac\\xb1\\xd7\\xf7",Lo="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Po="\\u2000-\\u206f",jo=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ra="A-Z\\xc0-\\xd6\\xd8-\\xde",Mo="\\ufe0e\\ufe0f",na=Oo+Lo+Po+jo,ia="['\u2019]",Ji="["+na+"]",Uo="["+Bo+"]",aa="\\d+",$o="["+ea+"]",sa="["+ta+"]",oa="[^"+Qi+na+aa+ea+ta+ra+"]",Do="\\ud83c[\\udffb-\\udfff]",Vo="(?:"+Uo+"|"+Do+")",Wo="[^"+Qi+"]",ua="(?:\\ud83c[\\udde6-\\uddff]){2}",ca="[\\ud800-\\udbff][\\udc00-\\udfff]",ct="["+ra+"]",qo="\\u200d",Yi="(?:"+sa+"|"+oa+")",zo="(?:"+ct+"|"+oa+")",Ki="(?:"+ia+"(?:d|ll|m|re|s|t|ve))?",Xi="(?:"+ia+"(?:D|LL|M|RE|S|T|VE))?",la=Vo+"?",pa="["+Mo+"]?",Zo="(?:"+qo+"(?:"+[Wo,ua,ca].join("|")+")"+pa+la+")*",Go="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ho="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Jo=pa+la+Zo,Yo="(?:"+[$o,ua,ca].join("|")+")"+Jo,Ko=RegExp([ct+"?"+sa+"+"+Ki+"(?="+[Ji,ct,"$"].join("|")+")",zo+"+"+Xi+"(?="+[Ji,ct+Yi,"$"].join("|")+")",ct+"?"+Yi+"+"+Ki,ct+"+"+Xi,Ho,Go,aa,Yo].join("|"),"g");function Xo(n){return n.match(Ko)||[]}var da=Xo;function Qo(n,e,t){return n=Ne(n),e=t?void 0:e,e===void 0?Hi(n)?da(n):Gi(n):n.match(e)||[]}var fa=Qo;var eu="['\u2019]",tu=RegExp(eu,"g");function ru(n){return function(e){return Wi(fa(Zi(e).replace(tu,"")),n,"")}}var ma=ru;var nu=ma(function(n,e,t){return e=e.toLowerCase(),n+(t?Vi(e):e)}),St=nu;p();f();d();function q(n){throw new Error("Unexpected value: "+JSON.stringify(n))}p();f();d();function Nt(n){return Object.keys(n)}p();f();d();p();f();d();p();f();d();var Ct=v.env.FERN_STACK_TRACK?.toLowerCase()??"",ye=Ct!==""&&Ct!=="0"&&Ct!=="false",xr=["single","multiline","box"].includes(Ct)?Ct:"single";ye&&(Error.stackTraceLimit=50);var iu=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),au=new Set(["stacktrace"]);function Qt({maxFrames:n=50,skip:e=0,filterPaths:t=[],filterFunctions:r=[],stopOn:a=[],filterNode:o=!0,filterJs:u=!0,formatFilename:m=x=>x}={}){if(!ye)return[];r=[...r,...iu],t=[...t,...au],a=[...a,"runInteractiveTask"];let x=!1;return(new Error().stack??"").split(`
|
|
2
|
+
`).map(k=>{let R=k.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(R&&R.length===5){let[,P,Y,C,j]=R;if(!P||!Y||!C||!j)return;if(x||a.some(D=>P?.includes(D))){x=!0;return}switch(P){case"Object.<anonymous>":P="";break;case"Object.object":case"Object.alias":case"Object.union":case"Object.enum":case"Object.undiscriminatedUnion":P=`${P.substring(P.indexOf(".")+1)}()=> { ... }`;break}return{fn:P,path:m(Y),position:`${C}:${j}`}}}).filter(k=>k&&!r.some(R=>k.fn.includes(R))&&!(o&&k.path?.startsWith("node:"))&&!(u&&k.path?.endsWith(".js"))&&!t.some(R=>k.path.includes(R))).slice(e,e+n)}var Xt=class{constructor({maxFrames:e=50,skip:t=0,filterPaths:r=[],filterFunctions:a=[],stopOn:o=[],filterNode:u=!0,filterJs:m=!0,multiline:x=!1,formatFilename:k=R=>R}={}){E(this,"maxFrames");E(this,"skip");E(this,"filterPaths");E(this,"filterFunctions");E(this,"stopOn");E(this,"filterNode");E(this,"filterJs");E(this,"multiline");E(this,"formatFilename");E(this,"tracking",new WeakMap);this.maxFrames=e,this.skip=t,this.filterPaths=r,this.filterFunctions=a,this.stopOn=o,this.filterNode=u,this.filterJs=m,this.multiline=x,this.formatFilename=k}tag(e){let t=this.tracking.get(e)||new Set;Qt({maxFrames:this.maxFrames,skip:this.skip,filterPaths:this.filterPaths,filterFunctions:this.filterFunctions,stopOn:this.stopOn,filterNode:this.filterNode,filterJs:this.filterJs,formatFilename:this.formatFilename}).forEach(r=>t.add(r)),this.tracking.set(e,t)}trace(e){if(!ye)return"";let t=this.tracking.get(e);return t?[...t].map(r=>`${this.multiline?`
|
|
3
|
+
`:""}${r.fn} - ${r.path}:${r.position}`).join(""):""}frames(e){let t=this.tracking.get(e);return t?[...t]:[]}free(e){this.tracking.delete(e)}clear(){this.tracking=new WeakMap}},vr;function ha({maxFrames:n=50,skip:e=0,filterPaths:t=[],filterFunctions:r=[],stopOn:a=[],filterNode:o=!0,filterJs:u=!0,multiline:m=!1,formatFilename:x=k=>k}={}){ye&&(vr??(vr=new Xt({maxFrames:n,skip:e,filterPaths:t,filterFunctions:r,stopOn:a,filterNode:o,filterJs:u,multiline:m,formatFilename:x})))}function ya(n){vr?.tag(n)}function br(n){return vr?.frames(n)??[]}var $e=class{constructor(){ya(this)}};p();f();d();var er=class{formatMultiple(e){return Promise.all(e.map(t=>this.format(t)))}formatMultipleSync(e){return e.map(t=>this.formatSync(t))}dispose(){}},Ft=class extends er{async format(e){return e}formatSync(e){return e}};p();f();d();p();f();d();p();f();d();var pe=class extends $e{constructor(t){super();E(this,"value");this.value=t}write(t){typeof this.value=="string"?t.write(this.value):typeof this.value=="function"?this.value(t):this.value.write(t)}};var su=4;ha({skip:0,maxFrames:15,filterFunctions:["Abstract"]});var Bt=class{constructor(){E(this,"lineBuffer",[]);E(this,"indentLevel",0);E(this,"hasWrittenAnything",!1);E(this,"lastCharacterIsSemicolon",!1);E(this,"lastCharacterIsNewline",!1);E(this,"nodeStackFrames",[])}get buffer(){return ye&&this.nodeStackFrames.length>0&&this.writeInternal(`
|
|
4
4
|
`),this.lineBuffer.join(`
|
|
5
5
|
`)+(this.lastCharacterIsNewline?`
|
|
6
6
|
`:"")}write(...e){for(let t of e)if(t!=null)if(typeof t=="string"){let r=t.length>0&&t.endsWith(`
|
|
@@ -12,16 +12,16 @@ ${o}`);this.isAtStartOfLine()&&(u=o+u),r&&(u+=`
|
|
|
12
12
|
`)}writeSemicolonIfLastCharacterIsNot(){this.lastCharacterIsSemicolon||this.writeInternal(";")}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
|
|
13
13
|
`)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:e,delimiter:t,writeFunction:r}){if(e.length>0){let a=e[0];a!=null&&r(a);for(let o=1;o<e.length;o++){this.write(t);let u=e[o];u!=null&&r(u)}}}toString(){return this.buffer}writeInternal(e){if(e.length===0)return;let t=!this.lastCharacterIsNewline;this.hasWrittenAnything=!0,this.lastCharacterIsNewline=e.endsWith(`
|
|
14
14
|
`),this.lastCharacterIsSemicolon=e.endsWith(";");let r=e.split(`
|
|
15
|
-
`),a=ye&&!this.shouldSkipTracking(r)&&this.lastCharacterIsNewline;t&&(this.lastLine=`${this.lastLine}${r.shift()||""}`),this.lastCharacterIsNewline&&r.pop(),this.lineBuffer.push(...r),a&&this.appendTrackingComment()}set lastLine(e){this.lineBuffer.length>0?this.lineBuffer[this.lineBuffer.length-1]=e:this.lineBuffer.push(e)}get lastLine(){return this.lineBuffer[this.lineBuffer.length-1]||""}shouldSkipTracking(e){return!1}formatStack(e,t=""){return e.map(r=>`${t?`(${t}) `:""} ${r.fn} - ${r.path} : ${r.position}`)}filterStack(e){return e.filter(t=>!t.fn.startsWith(`${this.constructor.name}.`))}appendTrackingComment(){let e=[...this.formatStack(this.filterStack(Qt({maxFrames:15,skip:3}))),...this.formatStack(this.filterStack(this.nodeStackFrames),"node")];switch(this.nodeStackFrames.length=0,xr){case"single":return this.singleLineTrackingComment(e);case"multiline":return this.multiLineTrackingComment(e);case"box":return this.boxTrackingComment(e)}}singleLineTrackingComment(e){this.lastLine=`${this.lastLine} // ${e.join(" ")}`}multiLineTrackingComment(e){this.lineBuffer.push(...e.map(t=>` // ${t}`))}boxTrackingComment(e){this.lineBuffer.push("/*",...e.map(t=>` ${t}`),"*/")}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*this.getTabSize())}getTabSize(){return au}};p();f();d();p();f();d();p();f();d();var Ot=class{constructor(){E(this,"reporter");E(this,"snippet");E(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:e,snippet:t}){this.shouldUpdate({snippet:t,reporter:e.errors})&&(this.reporter=e.errors.clone(),this.snippet=t)}getResponseOrThrow({endpoint:e}){if(this.snippet!=null&&this.reporter!=null)return{snippet:this.snippet,errors:this.reporter.toDynamicSnippetErrors()};throw this.err??new Error(`Failed to generate snippet for endpoint "${e.method} ${e.path}"`)}shouldUpdate({snippet:e,reporter:t}){return this.reporter==null||this.reporter.size()>0&&t.size()===0?!0:e.length>(this.snippet?.length??0)}};var Lt=class{constructor(e){E(this,"context");this.context=e}async generate(e,t={}){let r=this.resolveEndpoints({request:e,options:t});if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let a=new Ot;for(let o of r){let u=this.context.clone(),m=this.createSnippetGenerator(u);try{let x=await m.generateSnippet({endpoint:o,request:e,options:t});if(u.errors.empty())return{snippet:x,errors:void 0};a.update({context:u,snippet:x})}catch(x){a.err==null&&(a.err=x)}}return a.getResponseOrThrow({endpoint:e.endpoint})}async generateSnippetAst(e,t={}){let r=this.resolveEndpoints({request:e,options:t});if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let a;for(let o of r){let u=this.context.clone(),m=this.createSnippetGenerator(u);try{return await m.generateSnippetAst({endpoint:o,request:e,options:t})}catch(x){a=x}}throw a??new Error(`Failed to generate snippet AST for endpoint: ${e.endpoint.method} ${e.endpoint.path}`)}generateSync(e,t={}){let r=this.resolveEndpoints({request:e,options:t});if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let a=new Ot;for(let o of r){let u=this.context.clone(),m=this.createSnippetGenerator(u);try{let x=m.generateSnippetSync({endpoint:o,request:e,options:t});if(u.errors.empty())return{snippet:x,errors:void 0};a.update({context:u,snippet:x})}catch(x){a.err==null&&(a.err=x)}}return a.getResponseOrThrow({endpoint:e.endpoint})}resolveEndpoints({request:e,options:t}){if(t.endpointId!=null){let r=this.context.resolveEndpointById(t.endpointId);if(r==null)throw new Error(`No endpoint found with ID "${t.endpointId}"`);return[r]}return this.context.resolveEndpointLocationOrThrow(e.endpoint)}};p();f();d();p();f();d();p();f();d();var Pt=class{constructor(){E(this,"REFERENCE_REGEX",/^(?:(\w+)::)?(GET|POST|PUT|DELETE|PATCH|HEAD)\s(\/\S*)$/)}validate(e){return this.REFERENCE_REGEX.test(e)?{type:"valid"}:{type:"invalid"}}tryParse(e){if(this.validate(e).type==="invalid")return;let r=e.match(this.REFERENCE_REGEX);if(!(r==null||r[2]==null||r[3]==null))return{namespace:r[1],method:r[2],path:r[3]}}};p();f();d();var $={Critical:"CRITICAL",Warning:"WARNING"},jt=class n{constructor(){E(this,"errors");E(this,"path");this.errors=[],this.path=[]}add(e){this.errors.push({...e,path:[...this.path]})}scope(e){this.path.push(e)}unscope(){this.path.pop()}getBySeverity(e){return this.errors.filter(t=>t.severity===e)}empty(){return this.errors.length===0}size(){return this.errors.length}truncate(e){this.errors.length=e}clone(){let e=new n;return e.errors=[...this.errors],e.path=[...this.path],e}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(e=>({severity:e.severity,path:e.path!=null?this.pathToStringArray(e.path):void 0,message:e.message}))}pathToStringArray(e){let t=[];for(let r of e){if(typeof r=="string"){t.push(r);continue}t[t.length-1]+=`[${r.index}]`}return t}};var Mt=class{constructor({ir:e,config:t,options:r={}}){E(this,"config");E(this,"options");E(this,"errors");E(this,"_ir");E(this,"httpEndpointReferenceParser");this._ir=e,this.config=t,this.options=r,this.errors=new jt,this.httpEndpointReferenceParser=new Pt}associateQueryParametersByWireValue({parameters:e,values:t}){let r=[];for(let[a,o]of Object.entries(t))if(o!==void 0){this.errors.scope(a);try{let u=e.find(x=>x.name.wireValue===a);if(u==null)throw this.newParameterNotRecognizedError(a);let m=this.isListTypeReference(u.typeReference)&&!Array.isArray(o)?[o]:o;r.push({name:u.name,typeReference:u.typeReference,value:m})}finally{this.errors.unscope()}}return r}associateByWireValueOrDefault({parameters:e,values:t}){let r=[];for(let a of e){this.errors.scope(a.name.wireValue);try{let o=t[a.name.wireValue];if(o==null)if(a.typeReference.type==="primitive"&&a.typeReference.value==="STRING")o=`<${a.name.wireValue}>`;else{this.errors.add({severity:$.Critical,message:this.newParameterNotRecognizedError(a.name.wireValue).message});continue}r.push({name:a.name,typeReference:a.typeReference,value:o})}finally{this.errors.unscope()}}return r}associateByWireValue({parameters:e,values:t,ignoreMissingParameters:r}){let a=[],o=new Set;for(let u of e){let m=u.name.wireValue,x=t[m];if(x!==void 0){o.add(m),this.errors.scope(m);try{a.push({name:u.name,typeReference:u.typeReference,value:x})}finally{this.errors.unscope()}}}if(!r){for(let[u,m]of Object.entries(t))if(!(m===void 0||o.has(u))){this.errors.scope(u);try{this.errors.add({severity:$.Critical,message:this.newParameterNotRecognizedError(u).message})}finally{this.errors.unscope()}}}return a}getExampleObjectProperties({parameters:e,snippetObject:t}){let r=typeof t=="object"&&t!==null&&!Array.isArray(t)?t:{},a=[];for(let o of e){let u=r[o.name.wireValue];u==null?o.typeReference.type==="nullable"&&a.push({name:o.name,typeReference:o.typeReference,value:null}):a.push({name:o.name,typeReference:o.typeReference,value:u})}return a}getSingleFileValue({property:e,record:t}){let r=t[e.wireValue];if(r!=null){if(typeof r!="string"){this.errors.add({severity:$.Critical,message:`Expected file value to be a string, got ${typeof r}`});return}return r}}getFileArrayValues({property:e,record:t}){let r=t[e.wireValue];if(r==null)return;if(!Array.isArray(r)){this.errors.add({severity:$.Critical,message:`Expected file array value to be an array of strings, got ${typeof r}`});return}let a=[];for(let o of r){if(typeof o!="string"){this.errors.add({severity:$.Critical,message:`Expected file array value to be an array of strings, got ${typeof o}`});return}a.push(o)}return a}getRecord(e){if(typeof e!="object"||Array.isArray(e)){this.errors.add({severity:$.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(e)?"array":typeof e}`});return}return e??{}}resolveNamedType({typeId:e}){let t=this._ir.types[e];if(t==null){this.errors.add({severity:$.Critical,message:`Type identified by "${e}" could not be found`});return}return t}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:t}){let r=this.getRecord(t);if(r==null)return;let a=e.discriminant.wireValue,o=r[a];if(o==null){this.errors.add({severity:$.Critical,message:this.newParameterNotRecognizedError(a).message});return}if(typeof o!="string"){this.errors.add({severity:$.Critical,message:`Expected discriminant value to be a string but got: ${typeof o}`});return}let u=e.types[o];if(u==null){this.errors.add({severity:$.Critical,message:`No type found for discriminant value "${o}"`});return}let{[a]:m,...x}=r;return{singleDiscriminatedUnionType:u,discriminantValue:u.discriminantValue,value:x}}resolveEndpointOrThrow(e){let t=this.httpEndpointReferenceParser.tryParse(e);if(t==null)throw new Error(`Failed to parse endpoint reference "${e}"`);return this.resolveEndpointLocationOrThrow(t)}resolveEndpointLocation(e){let t=[];for(let r of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:r,parsedEndpoint:e})&&t.push(r);return t}resolveEndpointLocationOrThrow(e){let t=this.resolveEndpointLocation(e);if(t.length===0)throw new Error(`Failed to find endpoint identified by "${e.method} ${e.path}"`);return t}resolveEndpointById(e){return this._ir.endpoints[e]}resolveEndpointByIdOrThrow(e){let t=this.resolveEndpointById(e);if(t==null)throw new Error(`Failed to find endpoint with ID "${e}"`);return t}needsRequestParameter({request:e,inlinePathParameters:t,inlineFileProperties:r}){return this.includePathParametersInWrappedRequest({request:e,inlinePathParameters:t})||e.queryParameters!=null&&e.queryParameters.length>0||e.headers!=null&&e.headers.length>0?!0:e.body!=null?this.includeRequestBodyInWrappedRequest({body:e.body,inlineFileProperties:r}):!e.metadata?.onlyPathParameters}includePathParametersInWrappedRequest({request:e,inlinePathParameters:t}){return t&&(e.metadata?.includePathParameters??!1)}isFileUploadRequestBody(e){switch(e.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:q(e)}}resolveEnvironmentName(e){if(this._ir.environments==null)return;let t=this._ir.environments.environments;switch(t.type){case"singleBaseUrl":{let r=t.environments.find(a=>a.id===e);return r?.name}case"multipleBaseUrls":{let r=t.environments.find(a=>a.id===e);return r?.name}default:q(t)}}isSingleEnvironmentID(e){return typeof e=="string"}isMultiEnvironmentValues(e){return typeof e=="object"}validateMultiEnvironmentUrlValues(e){if(this._ir.environments==null)return this.errors.add({severity:$.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let t=this._ir.environments.environments;switch(t.type){case"singleBaseUrl":return this.errors.add({severity:$.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let r=t.environments[0];if(r==null)return this.errors.add({severity:$.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let a=new Set(Nt(r.urls));for(let o of Nt(e))a.has(o)&&a.delete(o);return a.size>0?(this.errors.add({severity:$.Critical,message:`The provided environments are invalid; got: [${Object.keys(e).join(", ")}], expected: [${Nt(r.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:e}){if(typeof e!="number"){this.errors.add({severity:$.Critical,message:this.newTypeMismatchError({expected:"number",value:e}).message});return}return e}getValueAsBoolean({value:e}){if(typeof e!="boolean"){this.errors.add({severity:$.Critical,message:this.newTypeMismatchError({expected:"boolean",value:e}).message});return}return e}getValueAsString({value:e}){if(typeof e!="string"){this.errors.add({severity:$.Critical,message:this.newTypeMismatchError({expected:"string",value:e}).message});return}return e}isOptional(e){switch(e.type){case"nullable":return this.isOptional(e.value);case"optional":return!0;case"named":{let t=this.resolveNamedType({typeId:e.value});return t==null?!1:t.type==="alias"?this.isNullable(t.typeReference):!1}}return!1}isNullable(e){switch(e.type){case"nullable":return!0;case"optional":return this.isNullable(e.value);case"named":{let t=this.resolveNamedType({typeId:e.value});return t==null?!1:t.type==="alias"?this.isNullable(t.typeReference):!1}}return!1}newAuthMismatchError({auth:e,values:t}){return new Error(`Expected auth type ${e.type}, got ${t.type}`)}newParameterNotRecognizedError(e){return new Error(`"${e}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:e,value:t}){return new Error(`Expected ${e}, got ${typeof t}`)}includeRequestBodyInWrappedRequest({body:e,inlineFileProperties:t}){switch(e.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:t});default:q(e)}}includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:t}){return this.fileUploadHasBodyProperties({fileUpload:e})||t&&this.fileUploadHasFileProperties({fileUpload:e})}fileUploadHasBodyProperties({fileUpload:e}){return e.properties.some(t=>{switch(t.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:q(t)}})}fileUploadHasFileProperties({fileUpload:e}){return e.properties.some(t=>{switch(t.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:q(t)}})}isListTypeReference(e){return e.type==="optional"?this.isListTypeReference(e.value):e.type==="list"||e.type==="set"}parsedEndpointMatches({endpoint:e,parsedEndpoint:t}){return e.location.method===t.method&&e.location.path===t.path}};p();f();d();var de={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();var lt=class extends Bt{constructor({customConfig:t,formatter:r}){super();E(this,"customConfig");E(this,"formatter");E(this,"imports",{});E(this,"defaultImports",{});E(this,"starImportAliases",{});E(this,"starImportAliasesInverse",{});this.customConfig=t,this.formatter=r??new Ft}addImport(t){var r,a;if(t.importFrom!=null){switch(t.importFrom.type){case"default":{this.validateDefault(t);break}case"named":{this.validateNamed(t);break}case"star":{this.validateStar(t);break}}let o=(r=this.imports)[a=t.importFrom.moduleName]??(r[a]=[]);o.map(m=>m.name).includes(t.name)||o.push(t)}}validateDefault(t){var a,o;if(t.importFrom?.type!=="default")return;let r=(a=this.defaultImports)[o=t.importFrom.moduleName]??(a[o]=t);if(r.name!==t.name)throw new Error(`Cannot have multiple default imports for module ${t.importFrom.moduleName}: got ${t.name} but already had ${r.name}`)}validateNamed(t){if(t.importFrom?.type!=="named")return;let a=(this.imports[t.importFrom.moduleName]??[]).filter(u=>u.importFrom?.type==="star");if(a.length>0)throw new Error(`Cannot add named import ${t.name} because non-named imports ${a.map(u=>u.name)} already exist`);let o=[];for(let u of Object.values(this.imports))for(let m of u)m.importFrom?.type==="named"&&m.importFrom.moduleName!==t.importFrom.moduleName&&m.name===t.name&&o.push(m);if(o.length>0)throw new Error(`Cannot add named import from module ${t.importFrom.moduleName} because it is already imported from ${o[0]?.importFrom?.moduleName}`)}validateStar(t){var o,u,m,x;if(t.importFrom?.type!=="star")return;let r=(o=this.starImportAliases)[u=t.importFrom.moduleName]??(o[u]=t.importFrom.starImportAlias);if(r!==t.importFrom.starImportAlias)throw new Error(`Cannot have more than one alias for non-named imports from a module: got ${t.importFrom.starImportAlias} but already have ${r}.`);if(((m=this.starImportAliasesInverse)[x=t.importFrom.starImportAlias]??(m[x]=t.importFrom.moduleName))!==t.importFrom.moduleName)throw new Error(`Attempted to use alias ${t.importFrom.starImportAlias} for more than one module in the same file`)}};var Ut=class extends lt{constructor({customConfig:e,formatter:t}){super({customConfig:e,formatter:t})}async toStringAsync(){let e=this.getContent();if(this.formatter!=null)try{return this.formatter.format(e)}catch(t){throw new Error(`Failed to format TypeScript file: ${t}
|
|
15
|
+
`),a=ye&&!this.shouldSkipTracking(r)&&this.lastCharacterIsNewline;t&&(this.lastLine=`${this.lastLine}${r.shift()||""}`),this.lastCharacterIsNewline&&r.pop(),this.lineBuffer.push(...r),a&&this.appendTrackingComment()}set lastLine(e){this.lineBuffer.length>0?this.lineBuffer[this.lineBuffer.length-1]=e:this.lineBuffer.push(e)}get lastLine(){return this.lineBuffer[this.lineBuffer.length-1]||""}shouldSkipTracking(e){return!1}formatStack(e,t=""){return e.map(r=>`${t?`(${t}) `:""} ${r.fn} - ${r.path} : ${r.position}`)}filterStack(e){return e.filter(t=>!t.fn.startsWith(`${this.constructor.name}.`))}appendTrackingComment(){let e=[...this.formatStack(this.filterStack(Qt({maxFrames:15,skip:3}))),...this.formatStack(this.filterStack(this.nodeStackFrames),"node")];switch(this.nodeStackFrames.length=0,xr){case"single":return this.singleLineTrackingComment(e);case"multiline":return this.multiLineTrackingComment(e);case"box":return this.boxTrackingComment(e)}}singleLineTrackingComment(e){this.lastLine=`${this.lastLine} // ${e.join(" ")}`}multiLineTrackingComment(e){this.lineBuffer.push(...e.map(t=>` // ${t}`))}boxTrackingComment(e){this.lineBuffer.push("/*",...e.map(t=>` ${t}`),"*/")}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*this.getTabSize())}getTabSize(){return su}};p();f();d();p();f();d();p();f();d();var Ot=class{constructor(){E(this,"reporter");E(this,"snippet");E(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:e,snippet:t}){this.shouldUpdate({snippet:t,reporter:e.errors})&&(this.reporter=e.errors.clone(),this.snippet=t)}getResponseOrThrow({endpoint:e}){if(this.snippet!=null&&this.reporter!=null)return{snippet:this.snippet,errors:this.reporter.toDynamicSnippetErrors()};throw this.err??new Error(`Failed to generate snippet for endpoint "${e.method} ${e.path}"`)}shouldUpdate({snippet:e,reporter:t}){return this.reporter==null||this.reporter.size()>0&&t.size()===0?!0:e.length>(this.snippet?.length??0)}};var Lt=class{constructor(e){E(this,"context");this.context=e}async generate(e,t={}){let r=this.resolveEndpoints({request:e,options:t});if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let a=new Ot;for(let o of r){let u=this.context.clone(),m=this.createSnippetGenerator(u);try{let x=await m.generateSnippet({endpoint:o,request:e,options:t});if(u.errors.empty())return{snippet:x,errors:void 0};a.update({context:u,snippet:x})}catch(x){a.err==null&&(a.err=x)}}return a.getResponseOrThrow({endpoint:e.endpoint})}async generateSnippetAst(e,t={}){let r=this.resolveEndpoints({request:e,options:t});if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let a;for(let o of r){let u=this.context.clone(),m=this.createSnippetGenerator(u);try{return await m.generateSnippetAst({endpoint:o,request:e,options:t})}catch(x){a=x}}throw a??new Error(`Failed to generate snippet AST for endpoint: ${e.endpoint.method} ${e.endpoint.path}`)}generateSync(e,t={}){let r=this.resolveEndpoints({request:e,options:t});if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let a=new Ot;for(let o of r){let u=this.context.clone(),m=this.createSnippetGenerator(u);try{let x=m.generateSnippetSync({endpoint:o,request:e,options:t});if(u.errors.empty())return{snippet:x,errors:void 0};a.update({context:u,snippet:x})}catch(x){a.err==null&&(a.err=x)}}return a.getResponseOrThrow({endpoint:e.endpoint})}resolveEndpoints({request:e,options:t}){if(t.endpointId!=null){let r=this.context.resolveEndpointById(t.endpointId);if(r==null)throw new Error(`No endpoint found with ID "${t.endpointId}"`);return[r]}return this.context.resolveEndpointLocationOrThrow(e.endpoint)}};p();f();d();p();f();d();p();f();d();var Pt=class{constructor(){E(this,"REFERENCE_REGEX",/^(?:(\w+)::)?(GET|POST|PUT|DELETE|PATCH|HEAD)\s(\/\S*)$/)}validate(e){return this.REFERENCE_REGEX.test(e)?{type:"valid"}:{type:"invalid"}}tryParse(e){if(this.validate(e).type==="invalid")return;let r=e.match(this.REFERENCE_REGEX);if(!(r==null||r[2]==null||r[3]==null))return{namespace:r[1],method:r[2],path:r[3]}}};p();f();d();var $={Critical:"CRITICAL",Warning:"WARNING"},jt=class n{constructor(){E(this,"errors");E(this,"path");this.errors=[],this.path=[]}add(e){this.errors.push({...e,path:[...this.path]})}scope(e){this.path.push(e)}unscope(){this.path.pop()}getBySeverity(e){return this.errors.filter(t=>t.severity===e)}empty(){return this.errors.length===0}size(){return this.errors.length}truncate(e){this.errors.length=e}clone(){let e=new n;return e.errors=[...this.errors],e.path=[...this.path],e}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(e=>({severity:e.severity,path:e.path!=null?this.pathToStringArray(e.path):void 0,message:e.message}))}pathToStringArray(e){let t=[];for(let r of e){if(typeof r=="string"){t.push(r);continue}t[t.length-1]+=`[${r.index}]`}return t}};var Mt=class{constructor({ir:e,config:t,options:r={}}){E(this,"config");E(this,"options");E(this,"errors");E(this,"_ir");E(this,"httpEndpointReferenceParser");this._ir=e,this.config=t,this.options=r,this.errors=new jt,this.httpEndpointReferenceParser=new Pt}associateQueryParametersByWireValue({parameters:e,values:t}){let r=[];for(let[a,o]of Object.entries(t))if(o!==void 0){this.errors.scope(a);try{let u=e.find(x=>x.name.wireValue===a);if(u==null)throw this.newParameterNotRecognizedError(a);let m=this.isListTypeReference(u.typeReference)&&!Array.isArray(o)?[o]:o;r.push({name:u.name,typeReference:u.typeReference,value:m})}finally{this.errors.unscope()}}return r}associateByWireValueOrDefault({parameters:e,values:t}){let r=[];for(let a of e){this.errors.scope(a.name.wireValue);try{let o=t[a.name.wireValue];if(o==null)if(a.typeReference.type==="primitive"&&a.typeReference.value==="STRING")o=`<${a.name.wireValue}>`;else{this.errors.add({severity:$.Critical,message:this.newParameterNotRecognizedError(a.name.wireValue).message});continue}r.push({name:a.name,typeReference:a.typeReference,value:o})}finally{this.errors.unscope()}}return r}associateByWireValue({parameters:e,values:t,ignoreMissingParameters:r}){let a=[],o=new Set;for(let u of e){let m=u.name.wireValue,x=t[m];if(x!==void 0){o.add(m),this.errors.scope(m);try{a.push({name:u.name,typeReference:u.typeReference,value:x})}finally{this.errors.unscope()}}}if(!r){for(let[u,m]of Object.entries(t))if(!(m===void 0||o.has(u))){this.errors.scope(u);try{this.errors.add({severity:$.Critical,message:this.newParameterNotRecognizedError(u).message})}finally{this.errors.unscope()}}}return a}getExampleObjectProperties({parameters:e,snippetObject:t}){let r=typeof t=="object"&&t!==null&&!Array.isArray(t)?t:{},a=[];for(let o of e){let u=r[o.name.wireValue];u==null?o.typeReference.type==="nullable"&&a.push({name:o.name,typeReference:o.typeReference,value:null}):a.push({name:o.name,typeReference:o.typeReference,value:u})}return a}getSingleFileValue({property:e,record:t}){let r=t[e.wireValue];if(r!=null){if(typeof r!="string"){this.errors.add({severity:$.Critical,message:`Expected file value to be a string, got ${typeof r}`});return}return r}}getFileArrayValues({property:e,record:t}){let r=t[e.wireValue];if(r==null)return;if(!Array.isArray(r)){this.errors.add({severity:$.Critical,message:`Expected file array value to be an array of strings, got ${typeof r}`});return}let a=[];for(let o of r){if(typeof o!="string"){this.errors.add({severity:$.Critical,message:`Expected file array value to be an array of strings, got ${typeof o}`});return}a.push(o)}return a}getRecord(e){if(typeof e!="object"||Array.isArray(e)){this.errors.add({severity:$.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(e)?"array":typeof e}`});return}return e??{}}resolveNamedType({typeId:e}){let t=this._ir.types[e];if(t==null){this.errors.add({severity:$.Critical,message:`Type identified by "${e}" could not be found`});return}return t}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:t}){let r=this.getRecord(t);if(r==null)return;let a=e.discriminant.wireValue,o=r[a];if(o==null){this.errors.add({severity:$.Critical,message:this.newParameterNotRecognizedError(a).message});return}if(typeof o!="string"){this.errors.add({severity:$.Critical,message:`Expected discriminant value to be a string but got: ${typeof o}`});return}let u=e.types[o];if(u==null){this.errors.add({severity:$.Critical,message:`No type found for discriminant value "${o}"`});return}let{[a]:m,...x}=r;return{singleDiscriminatedUnionType:u,discriminantValue:u.discriminantValue,value:x}}resolveEndpointOrThrow(e){let t=this.httpEndpointReferenceParser.tryParse(e);if(t==null)throw new Error(`Failed to parse endpoint reference "${e}"`);return this.resolveEndpointLocationOrThrow(t)}resolveEndpointLocation(e){let t=[];for(let r of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:r,parsedEndpoint:e})&&t.push(r);return t}resolveEndpointLocationOrThrow(e){let t=this.resolveEndpointLocation(e);if(t.length===0)throw new Error(`Failed to find endpoint identified by "${e.method} ${e.path}"`);return t}resolveEndpointById(e){return this._ir.endpoints[e]}resolveEndpointByIdOrThrow(e){let t=this.resolveEndpointById(e);if(t==null)throw new Error(`Failed to find endpoint with ID "${e}"`);return t}needsRequestParameter({request:e,inlinePathParameters:t,inlineFileProperties:r}){return this.includePathParametersInWrappedRequest({request:e,inlinePathParameters:t})||e.queryParameters!=null&&e.queryParameters.length>0||e.headers!=null&&e.headers.length>0?!0:e.body!=null?this.includeRequestBodyInWrappedRequest({body:e.body,inlineFileProperties:r}):!e.metadata?.onlyPathParameters}includePathParametersInWrappedRequest({request:e,inlinePathParameters:t}){return t&&(e.metadata?.includePathParameters??!1)}isFileUploadRequestBody(e){switch(e.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:q(e)}}resolveEnvironmentName(e){if(this._ir.environments==null)return;let t=this._ir.environments.environments;switch(t.type){case"singleBaseUrl":{let r=t.environments.find(a=>a.id===e);return r?.name}case"multipleBaseUrls":{let r=t.environments.find(a=>a.id===e);return r?.name}default:q(t)}}isSingleEnvironmentID(e){return typeof e=="string"}isMultiEnvironmentValues(e){return typeof e=="object"}validateMultiEnvironmentUrlValues(e){if(this._ir.environments==null)return this.errors.add({severity:$.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let t=this._ir.environments.environments;switch(t.type){case"singleBaseUrl":return this.errors.add({severity:$.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let r=t.environments[0];if(r==null)return this.errors.add({severity:$.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let a=new Set(Nt(r.urls));for(let o of Nt(e))a.has(o)&&a.delete(o);return a.size>0?(this.errors.add({severity:$.Critical,message:`The provided environments are invalid; got: [${Object.keys(e).join(", ")}], expected: [${Nt(r.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:e}){if(typeof e!="number"){this.errors.add({severity:$.Critical,message:this.newTypeMismatchError({expected:"number",value:e}).message});return}return e}getValueAsBoolean({value:e}){if(typeof e!="boolean"){this.errors.add({severity:$.Critical,message:this.newTypeMismatchError({expected:"boolean",value:e}).message});return}return e}getValueAsString({value:e}){if(typeof e!="string"){this.errors.add({severity:$.Critical,message:this.newTypeMismatchError({expected:"string",value:e}).message});return}return e}isOptional(e){switch(e.type){case"nullable":return this.isOptional(e.value);case"optional":return!0;case"named":{let t=this.resolveNamedType({typeId:e.value});return t==null?!1:t.type==="alias"?this.isNullable(t.typeReference):!1}}return!1}isNullable(e){switch(e.type){case"nullable":return!0;case"optional":return this.isNullable(e.value);case"named":{let t=this.resolveNamedType({typeId:e.value});return t==null?!1:t.type==="alias"?this.isNullable(t.typeReference):!1}}return!1}newAuthMismatchError({auth:e,values:t}){return new Error(`Expected auth type ${e.type}, got ${t.type}`)}newParameterNotRecognizedError(e){return new Error(`"${e}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:e,value:t}){return new Error(`Expected ${e}, got ${typeof t}`)}includeRequestBodyInWrappedRequest({body:e,inlineFileProperties:t}){switch(e.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:t});default:q(e)}}includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:t}){return this.fileUploadHasBodyProperties({fileUpload:e})||t&&this.fileUploadHasFileProperties({fileUpload:e})}fileUploadHasBodyProperties({fileUpload:e}){return e.properties.some(t=>{switch(t.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:q(t)}})}fileUploadHasFileProperties({fileUpload:e}){return e.properties.some(t=>{switch(t.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:q(t)}})}isListTypeReference(e){return e.type==="optional"?this.isListTypeReference(e.value):e.type==="list"||e.type==="set"}parsedEndpointMatches({endpoint:e,parsedEndpoint:t}){return e.location.method===t.method&&e.location.path===t.path}};p();f();d();var de={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();var lt=class extends Bt{constructor({customConfig:t,formatter:r}){super();E(this,"customConfig");E(this,"formatter");E(this,"imports",{});E(this,"defaultImports",{});E(this,"starImportAliases",{});E(this,"starImportAliasesInverse",{});this.customConfig=t,this.formatter=r??new Ft}addImport(t){var r,a;if(t.importFrom!=null){switch(t.importFrom.type){case"default":{this.validateDefault(t);break}case"named":{this.validateNamed(t);break}case"star":{this.validateStar(t);break}}let o=(r=this.imports)[a=t.importFrom.moduleName]??(r[a]=[]);o.map(m=>m.name).includes(t.name)||o.push(t)}}validateDefault(t){var a,o;if(t.importFrom?.type!=="default")return;let r=(a=this.defaultImports)[o=t.importFrom.moduleName]??(a[o]=t);if(r.name!==t.name)throw new Error(`Cannot have multiple default imports for module ${t.importFrom.moduleName}: got ${t.name} but already had ${r.name}`)}validateNamed(t){if(t.importFrom?.type!=="named")return;let a=(this.imports[t.importFrom.moduleName]??[]).filter(u=>u.importFrom?.type==="star");if(a.length>0)throw new Error(`Cannot add named import ${t.name} because non-named imports ${a.map(u=>u.name)} already exist`);let o=[];for(let u of Object.values(this.imports))for(let m of u)m.importFrom?.type==="named"&&m.importFrom.moduleName!==t.importFrom.moduleName&&m.name===t.name&&o.push(m);if(o.length>0)throw new Error(`Cannot add named import from module ${t.importFrom.moduleName} because it is already imported from ${o[0]?.importFrom?.moduleName}`)}validateStar(t){var o,u,m,x;if(t.importFrom?.type!=="star")return;let r=(o=this.starImportAliases)[u=t.importFrom.moduleName]??(o[u]=t.importFrom.starImportAlias);if(r!==t.importFrom.starImportAlias)throw new Error(`Cannot have more than one alias for non-named imports from a module: got ${t.importFrom.starImportAlias} but already have ${r}.`);if(((m=this.starImportAliasesInverse)[x=t.importFrom.starImportAlias]??(m[x]=t.importFrom.moduleName))!==t.importFrom.moduleName)throw new Error(`Attempted to use alias ${t.importFrom.starImportAlias} for more than one module in the same file`)}};var Ut=class extends lt{constructor({customConfig:e,formatter:t}){super({customConfig:e,formatter:t})}async toStringAsync(){let e=this.getContent();if(this.formatter!=null)try{return this.formatter.format(e)}catch(t){throw new Error(`Failed to format TypeScript file: ${t}
|
|
16
16
|
${e}`)}return e}toString(){let e=this.getContent();if(this.formatter!=null)try{return this.formatter.formatSync(e)}catch(t){throw new Error(`Failed to format TypeScript file: ${t}
|
|
17
17
|
${e}`)}return e}getContent(){let e=this.stringifyImports();return e.length>0?e+`
|
|
18
18
|
`+this.buffer:this.buffer}stringifyImports(){let e="";for(let[t,r]of Object.entries(this.imports)){let a=this.defaultImports[t],o="",u=r.filter(x=>x.importFrom?.type==="named"),m=this.starImportAliases[t];if(u.length>0||a!=null||m!=null){if(e+="import",a!=null&&(e+=` ${a.name}`),u.length>0){for(let k of u.slice(0,-1))o+=`${k.name}, `;let x=u[u.length-1];x!=null&&(o+=`${x.name}`),a!=null&&(e+=","),e+=` { ${o} }`}m!=null&&((a!=null||u.length>0)&&(e+=", "),e+=` * as ${m}`),e+=` from "${t}";
|
|
19
|
-
`}}return e}};var W=class extends $e{async toStringAsync({customConfig:e,formatter:t}){let r=new Ut({customConfig:e,formatter:t});return this.write(r),await r.toStringAsync()}toString({customConfig:e,formatter:t}){let r=new Ut({customConfig:e,formatter:t});return this.write(r),r.toString()}};p();f();d();p();f();d();var y={};he(y,{BRAND:()=>Cu,DIRTY:()=>De,EMPTY_PATH:()=>cu,INVALID:()=>F,NEVER:()=>hc,OK:()=>ee,ParseStatus:()=>K,Schema:()=>L,ZodAny:()=>Be,ZodArray:()=>Ie,ZodBigInt:()=>We,ZodBoolean:()=>qe,ZodBranded:()=>Dt,ZodCatch:()=>tt,ZodDate:()=>ze,ZodDefault:()=>et,ZodDiscriminatedUnion:()=>nr,ZodEffects:()=>le,ZodEnum:()=>Ke,ZodError:()=>ae,ZodFirstPartyTypeKind:()=>B,ZodFunction:()=>ar,ZodIntersection:()=>Je,ZodIssueCode:()=>T,ZodLazy:()=>Ye,ZodLiteral:()=>Xe,ZodMap:()=>yt,ZodNaN:()=>xt,ZodNativeEnum:()=>Qe,ZodNever:()=>fe,ZodNull:()=>Ge,ZodNullable:()=>ve,ZodNumber:()=>Ve,ZodObject:()=>se,ZodOptional:()=>ue,ZodParsedType:()=>S,ZodPipeline:()=>Vt,ZodPromise:()=>Oe,ZodReadonly:()=>rt,ZodRecord:()=>ir,ZodSchema:()=>L,ZodSet:()=>gt,ZodString:()=>Fe,ZodSymbol:()=>mt,ZodTransformer:()=>le,ZodTuple:()=>xe,ZodType:()=>L,ZodUndefined:()=>Ze,ZodUnion:()=>He,ZodUnknown:()=>Ee,ZodVoid:()=>ht,addIssueToContext:()=>A,any:()=>$u,array:()=>qu,bigint:()=>Lu,boolean:()=>Aa,coerce:()=>mc,custom:()=>ka,date:()=>Pu,datetimeRegex:()=>_a,defaultErrorMap:()=>Te,discriminatedUnion:()=>Hu,effect:()=>sc,enum:()=>nc,function:()=>ec,getErrorMap:()=>pt,getParsedType:()=>ge,instanceof:()=>Bu,intersection:()=>Ju,isAborted:()=>tr,isAsync:()=>dt,isDirty:()=>rr,isValid:()=>Ce,late:()=>Fu,lazy:()=>tc,literal:()=>rc,makeIssue:()=>$t,map:()=>Ku,nan:()=>Ou,nativeEnum:()=>ic,never:()=>Vu,null:()=>Uu,nullable:()=>uc,number:()=>Ia,object:()=>zu,objectUtil:()=>wr,oboolean:()=>fc,onumber:()=>dc,optional:()=>oc,ostring:()=>pc,pipeline:()=>lc,preprocess:()=>cc,promise:()=>ac,quotelessJson:()=>su,record:()=>Xu,set:()=>Qu,setErrorMap:()=>uu,strictObject:()=>Zu,string:()=>Ea,symbol:()=>ju,transformer:()=>sc,tuple:()=>Yu,undefined:()=>Mu,union:()=>Gu,unknown:()=>Du,util:()=>U,void:()=>Wu});p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();var U;(function(n){n.assertEqual=a=>{};function e(a){}n.assertIs=e;function t(a){throw new Error}n.assertNever=t,n.arrayToEnum=a=>{let o={};for(let u of a)o[u]=u;return o},n.getValidEnumValues=a=>{let o=n.objectKeys(a).filter(m=>typeof a[a[m]]!="number"),u={};for(let m of o)u[m]=a[m];return n.objectValues(u)},n.objectValues=a=>n.objectKeys(a).map(function(o){return a[o]}),n.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let o=[];for(let u in a)Object.prototype.hasOwnProperty.call(a,u)&&o.push(u);return o},n.find=(a,o)=>{for(let u of a)if(o(u))return u},n.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function r(a,o=" | "){return a.map(u=>typeof u=="string"?`'${u}'`:u).join(o)}n.joinValues=r,n.jsonStringifyReplacer=(a,o)=>typeof o=="bigint"?o.toString():o})(U||(U={}));var wr;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(wr||(wr={}));var S=U.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ge=n=>{switch(typeof n){case"undefined":return S.undefined;case"string":return S.string;case"number":return Number.isNaN(n)?S.nan:S.number;case"boolean":return S.boolean;case"function":return S.function;case"bigint":return S.bigint;case"symbol":return S.symbol;case"object":return Array.isArray(n)?S.array:n===null?S.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?S.promise:typeof Map<"u"&&n instanceof Map?S.map:typeof Set<"u"&&n instanceof Set?S.set:typeof Date<"u"&&n instanceof Date?S.date:S.object;default:return S.unknown}};var T=U.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),su=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:"),ae=class n extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(o){return o.message},r={_errors:[]},a=o=>{for(let u of o.issues)if(u.code==="invalid_union")u.unionErrors.map(a);else if(u.code==="invalid_return_type")a(u.returnTypeError);else if(u.code==="invalid_arguments")a(u.argumentsError);else if(u.path.length===0)r._errors.push(t(u));else{let m=r,x=0;for(;x<u.path.length;){let k=u.path[x];x===u.path.length-1?(m[k]=m[k]||{_errors:[]},m[k]._errors.push(t(u))):m[k]=m[k]||{_errors:[]},m=m[k],x++}}};return a(this),r}static assert(e){if(!(e instanceof n))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,U.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},r=[];for(let a of this.issues)if(a.path.length>0){let o=a.path[0];t[o]=t[o]||[],t[o].push(e(a))}else r.push(e(a));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}};ae.create=n=>new ae(n);var ou=(n,e)=>{let t;switch(n.code){case T.invalid_type:n.received===S.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case T.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,U.jsonStringifyReplacer)}`;break;case T.unrecognized_keys:t=`Unrecognized key(s) in object: ${U.joinValues(n.keys,", ")}`;break;case T.invalid_union:t="Invalid input";break;case T.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${U.joinValues(n.options)}`;break;case T.invalid_enum_value:t=`Invalid enum value. Expected ${U.joinValues(n.options)}, received '${n.received}'`;break;case T.invalid_arguments:t="Invalid function arguments";break;case T.invalid_return_type:t="Invalid function return type";break;case T.invalid_date:t="Invalid date";break;case T.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:U.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case T.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case T.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case T.custom:t="Invalid input";break;case T.invalid_intersection_types:t="Intersection results could not be merged";break;case T.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case T.not_finite:t="Number must be finite";break;default:t=e.defaultError,U.assertNever(n)}return{message:t}},Te=ou;var ga=Te;function uu(n){ga=n}function pt(){return ga}p();f();d();var $t=n=>{let{data:e,path:t,errorMaps:r,issueData:a}=n,o=[...t,...a.path||[]],u={...a,path:o};if(a.message!==void 0)return{...a,path:o,message:a.message};let m="",x=r.filter(k=>!!k).slice().reverse();for(let k of x)m=k(u,{data:e,defaultError:m}).message;return{...a,path:o,message:m}},cu=[];function A(n,e){let t=pt(),r=$t({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===Te?void 0:Te].filter(a=>!!a)});n.common.issues.push(r)}var K=class n{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let a of t){if(a.status==="aborted")return F;a.status==="dirty"&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let a of t){let o=await a.key,u=await a.value;r.push({key:o,value:u})}return n.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let a of t){let{key:o,value:u}=a;if(o.status==="aborted"||u.status==="aborted")return F;o.status==="dirty"&&e.dirty(),u.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof u.value<"u"||a.alwaysSet)&&(r[o.value]=u.value)}return{status:e.value,value:r}}},F=Object.freeze({status:"aborted"}),De=n=>({status:"dirty",value:n}),ee=n=>({status:"valid",value:n}),tr=n=>n.status==="aborted",rr=n=>n.status==="dirty",Ce=n=>n.status==="valid",dt=n=>typeof Promise<"u"&&n instanceof Promise;p();f();d();p();f();d();var N;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e?.message})(N||(N={}));var ce=class{constructor(e,t,r,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},xa=(n,e)=>{if(Ce(e))return{success:!0,data:e.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 t=new ae(n.common.issues);return this._error=t,this._error}}};function O(n){if(!n)return{};let{errorMap:e,invalid_type_error:t,required_error:r,description:a}=n;if(e&&(t||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(u,m)=>{let{message:x}=n;return u.code==="invalid_enum_value"?{message:x??m.defaultError}:typeof m.data>"u"?{message:x??r??m.defaultError}:u.code!=="invalid_type"?{message:m.defaultError}:{message:x??t??m.defaultError}},description:a}}var L=class{get description(){return this._def.description}_getType(e){return ge(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ge(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new K,ctx:{common:e.parent.common,data:e.data,parsedType:ge(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(dt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ge(e)},a=this._parseSync({data:e,path:r.path,parent:r});return xa(r,a)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ge(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return Ce(r)?{value:r.value}:{issues:t.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(r=>Ce(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ge(e)},a=this._parse({data:e,path:r.path,parent:r}),o=await(dt(a)?a:Promise.resolve(a));return xa(r,o)}refine(e,t){let r=a=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(a):t;return this._refinement((a,o)=>{let u=e(a),m=()=>o.addIssue({code:T.custom,...r(a)});return typeof Promise<"u"&&u instanceof Promise?u.then(x=>x?!0:(m(),!1)):u?!0:(m(),!1)})}refinement(e,t){return this._refinement((r,a)=>e(r)?!0:(a.addIssue(typeof t=="function"?t(r,a):t),!1))}_refinement(e){return new le({schema:this,typeName:B.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return ue.create(this,this._def)}nullable(){return ve.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ie.create(this)}promise(){return Oe.create(this,this._def)}or(e){return He.create([this,e],this._def)}and(e){return Je.create(this,e,this._def)}transform(e){return new le({...O(this._def),schema:this,typeName:B.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new et({...O(this._def),innerType:this,defaultValue:t,typeName:B.ZodDefault})}brand(){return new Dt({typeName:B.ZodBranded,type:this,...O(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new tt({...O(this._def),innerType:this,catchValue:t,typeName:B.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Vt.create(this,e)}readonly(){return rt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},lu=/^c[^\s-]{8,}$/i,pu=/^[0-9a-z]+$/,du=/^[0-9A-HJKMNP-TV-Z]{26}$/i,fu=/^[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,mu=/^[a-z0-9_-]{21}$/i,hu=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,yu=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,gu=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,xu="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",_r,vu=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,bu=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,wu=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,_u=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Tu=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ku=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ba="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Eu=new RegExp(`^${ba}$`);function wa(n){let e="[0-5]\\d";n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`);let t=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Iu(n){return new RegExp(`^${wa(n)}$`)}function _a(n){let e=`${ba}T${wa(n)}`,t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Au(n,e){return!!((e==="v4"||!e)&&vu.test(n)||(e==="v6"||!e)&&wu.test(n))}function Ru(n,e){if(!hu.test(n))return!1;try{let[t]=n.split(".");if(!t)return!1;let r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),a=JSON.parse(atob(r));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function Su(n,e){return!!((e==="v4"||!e)&&bu.test(n)||(e==="v6"||!e)&&_u.test(n))}var Fe=class n extends L{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==S.string){let o=this._getOrReturnCtx(e);return A(o,{code:T.invalid_type,expected:S.string,received:o.parsedType}),F}let r=new K,a;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(a=this._getOrReturnCtx(e,a),A(a,{code:T.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="max")e.data.length>o.value&&(a=this._getOrReturnCtx(e,a),A(a,{code:T.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){let u=e.data.length>o.value,m=e.data.length<o.value;(u||m)&&(a=this._getOrReturnCtx(e,a),u?A(a,{code:T.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):m&&A(a,{code:T.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")gu.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"email",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="emoji")_r||(_r=new RegExp(xu,"u")),_r.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"emoji",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")fu.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"uuid",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="nanoid")mu.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"nanoid",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")lu.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"cuid",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid2")pu.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"cuid2",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="ulid")du.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"ulid",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),A(a,{validation:"url",code:T.invalid_string,message:o.message}),r.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"regex",code:T.invalid_string,message:o.message}),r.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(a=this._getOrReturnCtx(e,a),A(a,{code:T.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),r.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(a=this._getOrReturnCtx(e,a),A(a,{code:T.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(a=this._getOrReturnCtx(e,a),A(a,{code:T.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?_a(o).test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{code:T.invalid_string,validation:"datetime",message:o.message}),r.dirty()):o.kind==="date"?Eu.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{code:T.invalid_string,validation:"date",message:o.message}),r.dirty()):o.kind==="time"?Iu(o).test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{code:T.invalid_string,validation:"time",message:o.message}),r.dirty()):o.kind==="duration"?yu.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"duration",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="ip"?Au(e.data,o.version)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"ip",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="jwt"?Ru(e.data,o.alg)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"jwt",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="cidr"?Su(e.data,o.version)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"cidr",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="base64"?Tu.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"base64",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="base64url"?ku.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"base64url",code:T.invalid_string,message:o.message}),r.dirty()):U.assertNever(o);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(a=>e.test(a),{validation:t,code:T.invalid_string,...N.errToObj(r)})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...N.errToObj(e)})}url(e){return this._addCheck({kind:"url",...N.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...N.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...N.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...N.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...N.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...N.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...N.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...N.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...N.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...N.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...N.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...N.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...N.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...N.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...N.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...N.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...N.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...N.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...N.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...N.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...N.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...N.errToObj(t)})}nonempty(e){return this.min(1,N.errToObj(e))}trim(){return new n({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new n({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new n({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}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 isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}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 isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Fe.create=n=>new Fe({checks:[],typeName:B.ZodString,coerce:n?.coerce??!1,...O(n)});function Nu(n,e){let t=(n.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,a=t>r?t:r,o=Number.parseInt(n.toFixed(a).replace(".","")),u=Number.parseInt(e.toFixed(a).replace(".",""));return o%u/10**a}var Ve=class n extends L{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)!==S.number){let o=this._getOrReturnCtx(e);return A(o,{code:T.invalid_type,expected:S.number,received:o.parsedType}),F}let r,a=new K;for(let o of this._def.checks)o.kind==="int"?U.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),A(r,{code:T.invalid_type,expected:"integer",received:"float",message:o.message}),a.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),A(r,{code:T.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),A(r,{code:T.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="multipleOf"?Nu(e.data,o.value)!==0&&(r=this._getOrReturnCtx(e,r),A(r,{code:T.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),A(r,{code:T.not_finite,message:o.message}),a.dirty()):U.assertNever(o);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,N.toString(t))}gt(e,t){return this.setLimit("min",e,!1,N.toString(t))}lte(e,t){return this.setLimit("max",e,!0,N.toString(t))}lt(e,t){return this.setLimit("max",e,!1,N.toString(t))}setLimit(e,t,r,a){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:N.toString(a)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:N.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:N.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:N.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:N.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:N.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:N.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:N.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:N.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:N.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&U.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Ve.create=n=>new Ve({checks:[],typeName:B.ZodNumber,coerce:n?.coerce||!1,...O(n)});var We=class n extends L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==S.bigint)return this._getInvalidInput(e);let r,a=new K;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),A(r,{code:T.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),A(r,{code:T.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),A(r,{code:T.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):U.assertNever(o);return{status:a.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return A(t,{code:T.invalid_type,expected:S.bigint,received:t.parsedType}),F}gte(e,t){return this.setLimit("min",e,!0,N.toString(t))}gt(e,t){return this.setLimit("min",e,!1,N.toString(t))}lte(e,t){return this.setLimit("max",e,!0,N.toString(t))}lt(e,t){return this.setLimit("max",e,!1,N.toString(t))}setLimit(e,t,r,a){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:N.toString(a)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:N.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:N.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:N.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:N.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:N.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};We.create=n=>new We({checks:[],typeName:B.ZodBigInt,coerce:n?.coerce??!1,...O(n)});var qe=class extends L{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==S.boolean){let r=this._getOrReturnCtx(e);return A(r,{code:T.invalid_type,expected:S.boolean,received:r.parsedType}),F}return ee(e.data)}};qe.create=n=>new qe({typeName:B.ZodBoolean,coerce:n?.coerce||!1,...O(n)});var ze=class n extends L{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==S.date){let o=this._getOrReturnCtx(e);return A(o,{code:T.invalid_type,expected:S.date,received:o.parsedType}),F}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return A(o,{code:T.invalid_date}),F}let r=new K,a;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(a=this._getOrReturnCtx(e,a),A(a,{code:T.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(a=this._getOrReturnCtx(e,a),A(a,{code:T.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):U.assertNever(o);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:N.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:N.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};ze.create=n=>new ze({checks:[],coerce:n?.coerce||!1,typeName:B.ZodDate,...O(n)});var mt=class extends L{_parse(e){if(this._getType(e)!==S.symbol){let r=this._getOrReturnCtx(e);return A(r,{code:T.invalid_type,expected:S.symbol,received:r.parsedType}),F}return ee(e.data)}};mt.create=n=>new mt({typeName:B.ZodSymbol,...O(n)});var Ze=class extends L{_parse(e){if(this._getType(e)!==S.undefined){let r=this._getOrReturnCtx(e);return A(r,{code:T.invalid_type,expected:S.undefined,received:r.parsedType}),F}return ee(e.data)}};Ze.create=n=>new Ze({typeName:B.ZodUndefined,...O(n)});var Ge=class extends L{_parse(e){if(this._getType(e)!==S.null){let r=this._getOrReturnCtx(e);return A(r,{code:T.invalid_type,expected:S.null,received:r.parsedType}),F}return ee(e.data)}};Ge.create=n=>new Ge({typeName:B.ZodNull,...O(n)});var Be=class extends L{constructor(){super(...arguments),this._any=!0}_parse(e){return ee(e.data)}};Be.create=n=>new Be({typeName:B.ZodAny,...O(n)});var Ee=class extends L{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ee(e.data)}};Ee.create=n=>new Ee({typeName:B.ZodUnknown,...O(n)});var fe=class extends L{_parse(e){let t=this._getOrReturnCtx(e);return A(t,{code:T.invalid_type,expected:S.never,received:t.parsedType}),F}};fe.create=n=>new fe({typeName:B.ZodNever,...O(n)});var ht=class extends L{_parse(e){if(this._getType(e)!==S.undefined){let r=this._getOrReturnCtx(e);return A(r,{code:T.invalid_type,expected:S.void,received:r.parsedType}),F}return ee(e.data)}};ht.create=n=>new ht({typeName:B.ZodVoid,...O(n)});var Ie=class n extends L{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==S.array)return A(t,{code:T.invalid_type,expected:S.array,received:t.parsedType}),F;if(a.exactLength!==null){let u=t.data.length>a.exactLength.value,m=t.data.length<a.exactLength.value;(u||m)&&(A(t,{code:u?T.too_big:T.too_small,minimum:m?a.exactLength.value:void 0,maximum:u?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(a.minLength!==null&&t.data.length<a.minLength.value&&(A(t,{code:T.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),a.maxLength!==null&&t.data.length>a.maxLength.value&&(A(t,{code:T.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((u,m)=>a.type._parseAsync(new ce(t,u,t.path,m)))).then(u=>K.mergeArray(r,u));let o=[...t.data].map((u,m)=>a.type._parseSync(new ce(t,u,t.path,m)));return K.mergeArray(r,o)}get element(){return this._def.type}min(e,t){return new n({...this._def,minLength:{value:e,message:N.toString(t)}})}max(e,t){return new n({...this._def,maxLength:{value:e,message:N.toString(t)}})}length(e,t){return new n({...this._def,exactLength:{value:e,message:N.toString(t)}})}nonempty(e){return this.min(1,e)}};Ie.create=(n,e)=>new Ie({type:n,minLength:null,maxLength:null,exactLength:null,typeName:B.ZodArray,...O(e)});function ft(n){if(n instanceof se){let e={};for(let t in n.shape){let r=n.shape[t];e[t]=ue.create(ft(r))}return new se({...n._def,shape:()=>e})}else return n instanceof Ie?new Ie({...n._def,type:ft(n.element)}):n instanceof ue?ue.create(ft(n.unwrap())):n instanceof ve?ve.create(ft(n.unwrap())):n instanceof xe?xe.create(n.items.map(e=>ft(e))):n}var se=class n extends L{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(),t=U.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==S.object){let k=this._getOrReturnCtx(e);return A(k,{code:T.invalid_type,expected:S.object,received:k.parsedType}),F}let{status:r,ctx:a}=this._processInputParams(e),{shape:o,keys:u}=this._getCached(),m=[];if(!(this._def.catchall instanceof fe&&this._def.unknownKeys==="strip"))for(let k in a.data)u.includes(k)||m.push(k);let x=[];for(let k of u){let R=o[k],P=a.data[k];x.push({key:{status:"valid",value:k},value:R._parse(new ce(a,P,a.path,k)),alwaysSet:k in a.data})}if(this._def.catchall instanceof fe){let k=this._def.unknownKeys;if(k==="passthrough")for(let R of m)x.push({key:{status:"valid",value:R},value:{status:"valid",value:a.data[R]}});else if(k==="strict")m.length>0&&(A(a,{code:T.unrecognized_keys,keys:m}),r.dirty());else if(k!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let k=this._def.catchall;for(let R of m){let P=a.data[R];x.push({key:{status:"valid",value:R},value:k._parse(new ce(a,P,a.path,R)),alwaysSet:R in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let k=[];for(let R of x){let P=await R.key,Y=await R.value;k.push({key:P,value:Y,alwaysSet:R.alwaysSet})}return k}).then(k=>K.mergeObjectSync(r,k)):K.mergeObjectSync(r,x)}get shape(){return this._def.shape()}strict(e){return N.errToObj,new n({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{let a=this._def.errorMap?.(t,r).message??r.defaultError;return t.code==="unrecognized_keys"?{message:N.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new n({...this._def,unknownKeys:"strip"})}passthrough(){return new n({...this._def,unknownKeys:"passthrough"})}extend(e){return new n({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new n({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:B.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new n({...this._def,catchall:e})}pick(e){let t={};for(let r of U.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new n({...this._def,shape:()=>t})}omit(e){let t={};for(let r of U.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new n({...this._def,shape:()=>t})}deepPartial(){return ft(this)}partial(e){let t={};for(let r of U.objectKeys(this.shape)){let a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()}return new n({...this._def,shape:()=>t})}required(e){let t={};for(let r of U.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof ue;)o=o._def.innerType;t[r]=o}return new n({...this._def,shape:()=>t})}keyof(){return Ta(U.objectKeys(this.shape))}};se.create=(n,e)=>new se({shape:()=>n,unknownKeys:"strip",catchall:fe.create(),typeName:B.ZodObject,...O(e)});se.strictCreate=(n,e)=>new se({shape:()=>n,unknownKeys:"strict",catchall:fe.create(),typeName:B.ZodObject,...O(e)});se.lazycreate=(n,e)=>new se({shape:n,unknownKeys:"strip",catchall:fe.create(),typeName:B.ZodObject,...O(e)});var He=class extends L{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function a(o){for(let m of o)if(m.result.status==="valid")return m.result;for(let m of o)if(m.result.status==="dirty")return t.common.issues.push(...m.ctx.common.issues),m.result;let u=o.map(m=>new ae(m.ctx.common.issues));return A(t,{code:T.invalid_union,unionErrors:u}),F}if(t.common.async)return Promise.all(r.map(async o=>{let u={...t,common:{...t.common,issues:[]},parent:null};return{result:await o._parseAsync({data:t.data,path:t.path,parent:u}),ctx:u}})).then(a);{let o,u=[];for(let x of r){let k={...t,common:{...t.common,issues:[]},parent:null},R=x._parseSync({data:t.data,path:t.path,parent:k});if(R.status==="valid")return R;R.status==="dirty"&&!o&&(o={result:R,ctx:k}),k.common.issues.length&&u.push(k.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;let m=u.map(x=>new ae(x));return A(t,{code:T.invalid_union,unionErrors:m}),F}}get options(){return this._def.options}};He.create=(n,e)=>new He({options:n,typeName:B.ZodUnion,...O(e)});var ke=n=>n instanceof Ye?ke(n.schema):n instanceof le?ke(n.innerType()):n instanceof Xe?[n.value]:n instanceof Ke?n.options:n instanceof Qe?U.objectValues(n.enum):n instanceof et?ke(n._def.innerType):n instanceof Ze?[void 0]:n instanceof Ge?[null]:n instanceof ue?[void 0,...ke(n.unwrap())]:n instanceof ve?[null,...ke(n.unwrap())]:n instanceof Dt||n instanceof rt?ke(n.unwrap()):n instanceof tt?ke(n._def.innerType):[],nr=class n extends L{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==S.object)return A(t,{code:T.invalid_type,expected:S.object,received:t.parsedType}),F;let r=this.discriminator,a=t.data[r],o=this.optionsMap.get(a);return o?t.common.async?o._parseAsync({data:t.data,path:t.path,parent:t}):o._parseSync({data:t.data,path:t.path,parent:t}):(A(t,{code:T.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),F)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let a=new Map;for(let o of t){let u=ke(o.shape[e]);if(!u.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let m of u){if(a.has(m))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(m)}`);a.set(m,o)}}return new n({typeName:B.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...O(r)})}};function Tr(n,e){let t=ge(n),r=ge(e);if(n===e)return{valid:!0,data:n};if(t===S.object&&r===S.object){let a=U.objectKeys(e),o=U.objectKeys(n).filter(m=>a.indexOf(m)!==-1),u={...n,...e};for(let m of o){let x=Tr(n[m],e[m]);if(!x.valid)return{valid:!1};u[m]=x.data}return{valid:!0,data:u}}else if(t===S.array&&r===S.array){if(n.length!==e.length)return{valid:!1};let a=[];for(let o=0;o<n.length;o++){let u=n[o],m=e[o],x=Tr(u,m);if(!x.valid)return{valid:!1};a.push(x.data)}return{valid:!0,data:a}}else return t===S.date&&r===S.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}var Je=class extends L{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=(o,u)=>{if(tr(o)||tr(u))return F;let m=Tr(o.value,u.value);return m.valid?((rr(o)||rr(u))&&t.dirty(),{status:t.value,value:m.data}):(A(r,{code:T.invalid_intersection_types}),F)};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,u])=>a(o,u)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Je.create=(n,e,t)=>new Je({left:n,right:e,typeName:B.ZodIntersection,...O(t)});var xe=class n extends L{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==S.array)return A(r,{code:T.invalid_type,expected:S.array,received:r.parsedType}),F;if(r.data.length<this._def.items.length)return A(r,{code:T.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),F;!this._def.rest&&r.data.length>this._def.items.length&&(A(r,{code:T.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let o=[...r.data].map((u,m)=>{let x=this._def.items[m]||this._def.rest;return x?x._parse(new ce(r,u,r.path,m)):null}).filter(u=>!!u);return r.common.async?Promise.all(o).then(u=>K.mergeArray(t,u)):K.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new n({...this._def,rest:e})}};xe.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new xe({items:n,typeName:B.ZodTuple,rest:null,...O(e)})};var ir=class n extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==S.object)return A(r,{code:T.invalid_type,expected:S.object,received:r.parsedType}),F;let a=[],o=this._def.keyType,u=this._def.valueType;for(let m in r.data)a.push({key:o._parse(new ce(r,m,r.path,m)),value:u._parse(new ce(r,r.data[m],r.path,m)),alwaysSet:m in r.data});return r.common.async?K.mergeObjectAsync(t,a):K.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof L?new n({keyType:e,valueType:t,typeName:B.ZodRecord,...O(r)}):new n({keyType:Fe.create(),valueType:e,typeName:B.ZodRecord,...O(t)})}},yt=class extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==S.map)return A(r,{code:T.invalid_type,expected:S.map,received:r.parsedType}),F;let a=this._def.keyType,o=this._def.valueType,u=[...r.data.entries()].map(([m,x],k)=>({key:a._parse(new ce(r,m,r.path,[k,"key"])),value:o._parse(new ce(r,x,r.path,[k,"value"]))}));if(r.common.async){let m=new Map;return Promise.resolve().then(async()=>{for(let x of u){let k=await x.key,R=await x.value;if(k.status==="aborted"||R.status==="aborted")return F;(k.status==="dirty"||R.status==="dirty")&&t.dirty(),m.set(k.value,R.value)}return{status:t.value,value:m}})}else{let m=new Map;for(let x of u){let k=x.key,R=x.value;if(k.status==="aborted"||R.status==="aborted")return F;(k.status==="dirty"||R.status==="dirty")&&t.dirty(),m.set(k.value,R.value)}return{status:t.value,value:m}}}};yt.create=(n,e,t)=>new yt({valueType:e,keyType:n,typeName:B.ZodMap,...O(t)});var gt=class n extends L{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==S.set)return A(r,{code:T.invalid_type,expected:S.set,received:r.parsedType}),F;let a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(A(r,{code:T.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),a.maxSize!==null&&r.data.size>a.maxSize.value&&(A(r,{code:T.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());let o=this._def.valueType;function u(x){let k=new Set;for(let R of x){if(R.status==="aborted")return F;R.status==="dirty"&&t.dirty(),k.add(R.value)}return{status:t.value,value:k}}let m=[...r.data.values()].map((x,k)=>o._parse(new ce(r,x,r.path,k)));return r.common.async?Promise.all(m).then(x=>u(x)):u(m)}min(e,t){return new n({...this._def,minSize:{value:e,message:N.toString(t)}})}max(e,t){return new n({...this._def,maxSize:{value:e,message:N.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};gt.create=(n,e)=>new gt({valueType:n,minSize:null,maxSize:null,typeName:B.ZodSet,...O(e)});var ar=class n extends L{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==S.function)return A(t,{code:T.invalid_type,expected:S.function,received:t.parsedType}),F;function r(m,x){return $t({data:m,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,pt(),Te].filter(k=>!!k),issueData:{code:T.invalid_arguments,argumentsError:x}})}function a(m,x){return $t({data:m,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,pt(),Te].filter(k=>!!k),issueData:{code:T.invalid_return_type,returnTypeError:x}})}let o={errorMap:t.common.contextualErrorMap},u=t.data;if(this._def.returns instanceof Oe){let m=this;return ee(async function(...x){let k=new ae([]),R=await m._def.args.parseAsync(x,o).catch(C=>{throw k.addIssue(r(x,C)),k}),P=await Reflect.apply(u,this,R);return await m._def.returns._def.type.parseAsync(P,o).catch(C=>{throw k.addIssue(a(P,C)),k})})}else{let m=this;return ee(function(...x){let k=m._def.args.safeParse(x,o);if(!k.success)throw new ae([r(x,k.error)]);let R=Reflect.apply(u,this,k.data),P=m._def.returns.safeParse(R,o);if(!P.success)throw new ae([a(R,P.error)]);return P.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new n({...this._def,args:xe.create(e).rest(Ee.create())})}returns(e){return new n({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new n({args:e||xe.create([]).rest(Ee.create()),returns:t||Ee.create(),typeName:B.ZodFunction,...O(r)})}},Ye=class extends L{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Ye.create=(n,e)=>new Ye({getter:n,typeName:B.ZodLazy,...O(e)});var Xe=class extends L{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return A(t,{received:t.data,code:T.invalid_literal,expected:this._def.value}),F}return{status:"valid",value:e.data}}get value(){return this._def.value}};Xe.create=(n,e)=>new Xe({value:n,typeName:B.ZodLiteral,...O(e)});function Ta(n,e){return new Ke({values:n,typeName:B.ZodEnum,...O(e)})}var Ke=class n extends L{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return A(t,{expected:U.joinValues(r),received:t.parsedType,code:T.invalid_type}),F}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return A(t,{received:t.data,code:T.invalid_enum_value,options:r}),F}return ee(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return n.create(e,{...this._def,...t})}exclude(e,t=this._def){return n.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}};Ke.create=Ta;var Qe=class extends L{_parse(e){let t=U.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==S.string&&r.parsedType!==S.number){let a=U.objectValues(t);return A(r,{expected:U.joinValues(a),received:r.parsedType,code:T.invalid_type}),F}if(this._cache||(this._cache=new Set(U.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let a=U.objectValues(t);return A(r,{received:r.data,code:T.invalid_enum_value,options:a}),F}return ee(e.data)}get enum(){return this._def.values}};Qe.create=(n,e)=>new Qe({values:n,typeName:B.ZodNativeEnum,...O(e)});var Oe=class extends L{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==S.promise&&t.common.async===!1)return A(t,{code:T.invalid_type,expected:S.promise,received:t.parsedType}),F;let r=t.parsedType===S.promise?t.data:Promise.resolve(t.data);return ee(r.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Oe.create=(n,e)=>new Oe({type:n,typeName:B.ZodPromise,...O(e)});var le=class extends L{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===B.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=this._def.effect||null,o={addIssue:u=>{A(r,u),u.fatal?t.abort():t.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),a.type==="preprocess"){let u=a.transform(r.data,o);if(r.common.async)return Promise.resolve(u).then(async m=>{if(t.value==="aborted")return F;let x=await this._def.schema._parseAsync({data:m,path:r.path,parent:r});return x.status==="aborted"?F:x.status==="dirty"?De(x.value):t.value==="dirty"?De(x.value):x});{if(t.value==="aborted")return F;let m=this._def.schema._parseSync({data:u,path:r.path,parent:r});return m.status==="aborted"?F:m.status==="dirty"?De(m.value):t.value==="dirty"?De(m.value):m}}if(a.type==="refinement"){let u=m=>{let x=a.refinement(m,o);if(r.common.async)return Promise.resolve(x);if(x instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return m};if(r.common.async===!1){let m=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return m.status==="aborted"?F:(m.status==="dirty"&&t.dirty(),u(m.value),{status:t.value,value:m.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(m=>m.status==="aborted"?F:(m.status==="dirty"&&t.dirty(),u(m.value).then(()=>({status:t.value,value:m.value}))))}if(a.type==="transform")if(r.common.async===!1){let u=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ce(u))return F;let m=a.transform(u.value,o);if(m instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:m}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(u=>Ce(u)?Promise.resolve(a.transform(u.value,o)).then(m=>({status:t.value,value:m})):F);U.assertNever(a)}};le.create=(n,e,t)=>new le({schema:n,typeName:B.ZodEffects,effect:e,...O(t)});le.createWithPreprocess=(n,e,t)=>new le({schema:e,effect:{type:"preprocess",transform:n},typeName:B.ZodEffects,...O(t)});var ue=class extends L{_parse(e){return this._getType(e)===S.undefined?ee(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ue.create=(n,e)=>new ue({innerType:n,typeName:B.ZodOptional,...O(e)});var ve=class extends L{_parse(e){return this._getType(e)===S.null?ee(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ve.create=(n,e)=>new ve({innerType:n,typeName:B.ZodNullable,...O(e)});var et=class extends L{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===S.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};et.create=(n,e)=>new et({innerType:n,typeName:B.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...O(e)});var tt=class extends L{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return dt(a)?a.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new ae(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new ae(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};tt.create=(n,e)=>new tt({innerType:n,typeName:B.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...O(e)});var xt=class extends L{_parse(e){if(this._getType(e)!==S.nan){let r=this._getOrReturnCtx(e);return A(r,{code:T.invalid_type,expected:S.nan,received:r.parsedType}),F}return{status:"valid",value:e.data}}};xt.create=n=>new xt({typeName:B.ZodNaN,...O(n)});var Cu=Symbol("zod_brand"),Dt=class extends L{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}},Vt=class n extends L{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?F:o.status==="dirty"?(t.dirty(),De(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{let a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?F:a.status==="dirty"?(t.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(e,t){return new n({in:e,out:t,typeName:B.ZodPipeline})}},rt=class extends L{_parse(e){let t=this._def.innerType._parse(e),r=a=>(Ce(a)&&(a.value=Object.freeze(a.value)),a);return dt(t)?t.then(a=>r(a)):r(t)}unwrap(){return this._def.innerType}};rt.create=(n,e)=>new rt({innerType:n,typeName:B.ZodReadonly,...O(e)});function va(n,e){let t=typeof n=="function"?n(e):typeof n=="string"?{message:n}:n;return typeof t=="string"?{message:t}:t}function ka(n,e={},t){return n?Be.create().superRefine((r,a)=>{let o=n(r);if(o instanceof Promise)return o.then(u=>{if(!u){let m=va(e,r),x=m.fatal??t??!0;a.addIssue({code:"custom",...m,fatal:x})}});if(!o){let u=va(e,r),m=u.fatal??t??!0;a.addIssue({code:"custom",...u,fatal:m})}}):Be.create()}var Fu={object:se.lazycreate},B;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(B||(B={}));var Bu=(n,e={message:`Input not instance of ${n.name}`})=>ka(t=>t instanceof n,e),Ea=Fe.create,Ia=Ve.create,Ou=xt.create,Lu=We.create,Aa=qe.create,Pu=ze.create,ju=mt.create,Mu=Ze.create,Uu=Ge.create,$u=Be.create,Du=Ee.create,Vu=fe.create,Wu=ht.create,qu=Ie.create,zu=se.create,Zu=se.strictCreate,Gu=He.create,Hu=nr.create,Ju=Je.create,Yu=xe.create,Xu=ir.create,Ku=yt.create,Qu=gt.create,ec=ar.create,tc=Ye.create,rc=Xe.create,nc=Ke.create,ic=Qe.create,ac=Oe.create,sc=le.create,oc=ue.create,uc=ve.create,cc=le.createWithPreprocess,lc=Vt.create,pc=()=>Ea().optional(),dc=()=>Ia().optional(),fc=()=>Aa().optional(),mc={string:(n=>Fe.create({...n,coerce:!0})),number:(n=>Ve.create({...n,coerce:!0})),boolean:(n=>qe.create({...n,coerce:!0})),bigint:(n=>We.create({...n,coerce:!0})),date:(n=>ze.create({...n,coerce:!0}))};var hc=F;p();f();d();var Ra=y.strictObject({title:y.string(),content:y.string()});var yc=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,Sa=y.string().refine(n=>yc.test(n),{message:"Must be a valid JavaScript identifier (e.g., 'acme', 'MySDK')"}),Na=y.strictObject({namespace:y.optional(Sa),client:y.optional(y.string()),error:y.optional(y.string()),timeoutError:y.optional(y.string()),environment:y.optional(y.string()),environmentUrls:y.optional(y.string()),version:y.optional(y.string())}),Ca=y.union([Sa,Na]),gc=y.strictObject({neverThrowErrors:y.optional(y.boolean()),outputEsm:y.optional(y.boolean()),outputSourceFiles:y.optional(y.boolean()),outputSrcOnly:y.optional(y.boolean()),includeCredentialsOnCrossOriginRequests:y.optional(y.boolean()),bundle:y.optional(y.boolean()),allowCustomFetcher:y.optional(y.boolean()),generateWebSocketClients:y.optional(y.boolean()),defaultTimeoutInSeconds:y.optional(y.union([y.literal("infinity"),y.number()])),skipResponseValidation:y.optional(y.boolean()),extraDependencies:y.optional(y.record(y.string())),extraDevDependencies:y.optional(y.record(y.string())),extraPeerDependencies:y.optional(y.record(y.string())),extraPeerDependenciesMeta:y.optional(y.record(y.any())),treatUnknownAsAny:y.optional(y.boolean()),noOptionalProperties:y.optional(y.boolean()),tolerateRepublish:y.optional(y.boolean()),packageJson:y.optional(y.record(y.any())),publishToJsr:y.optional(y.boolean()),omitUndefined:y.optional(y.boolean()),useLegacyExports:y.optional(y.boolean()),streamType:y.optional(y.enum(["wrapper","web"])),fileResponseType:y.optional(y.enum(["stream","binary-response"])),formDataSupport:y.optional(y.enum(["Node16","Node18"])),fetchSupport:y.optional(y.enum(["node-fetch","native"])),packagePath:y.optional(y.string()),omitFernHeaders:y.optional(y.boolean()),useDefaultRequestParameterValues:y.optional(y.boolean()),packageManager:y.optional(y.enum(["pnpm","yarn"])),flattenRequestParameters:y.optional(y.boolean()),exportAllRequestsAtRoot:y.optional(y.boolean()),customReadmeSections:y.optional(y.array(Ra)),testFramework:y.optional(y.enum(["jest","vitest"])),consolidateTypeFiles:y.optional(y.boolean()),generateEndpointMetadata:y.optional(y.boolean()),wireTestsFallbackToAutoGeneratedErrorExamples:y.boolean().optional(),linter:y.optional(y.enum(["biome","oxlint","none"])),formatter:y.optional(y.enum(["prettier","biome","oxfmt","none"])),enableForwardCompatibleEnums:y.optional(y.boolean()),parameterNaming:y.optional(y.enum(["originalName","wireValue","camelCase","snakeCase","default"])),generateSubpackageExports:y.optional(y.boolean()),allowExtraFields:y.optional(y.boolean()),enableInlineTypes:y.optional(y.boolean()),inlineFileProperties:y.optional(y.boolean()),inlinePathParameters:y.optional(y.boolean()),naming:y.optional(Ca),namespaceExport:y.optional(y.string()),noSerdeLayer:y.optional(y.boolean()),serdeLayer:y.optional(y.boolean()),private:y.optional(y.boolean()),requireDefaultEnvironment:y.optional(y.boolean()),retainOriginalCasing:y.optional(y.boolean()),useBigInt:y.optional(y.boolean()),useBrandedStringAliases:y.optional(y.boolean()),offsetSemantics:y.optional(y.enum(["item-index","page-index"])),customPagerName:y.optional(y.string()),resolveQueryParameterNameConflicts:y.optional(y.boolean()),alwaysSendAuth:y.optional(y.boolean()),includeContentHeadersOnFileDownloadResponse:y.optional(y.boolean()),includeUtilsOnUnionMembers:y.optional(y.boolean()),includeOtherInUnionTypes:y.optional(y.boolean()),writeUnitTests:y.optional(y.boolean()),generateWireTests:y.optional(y.boolean()),noScripts:y.optional(y.boolean()),skipNpmPkgFix:y.optional(y.boolean()),experimentalGenerateReadWriteOnlyTypes:y.optional(y.boolean()),timeoutInSeconds:y.optional(y.union([y.literal("infinity"),y.number()])),includeApiReference:y.optional(y.boolean()),shouldGenerateWebsocketClients:y.optional(y.boolean()),_fernLicenseName:y.optional(y.string()),maxRetries:y.optional(y.number().int().min(0)),retryStatusCodes:y.optional(y.enum(["legacy","recommended"]))});function Wt(n){return n?.serdeLayer!=null?!n.serdeLayer:!!n?.noSerdeLayer}var I={};he(I,{AstNode:()=>W,ClassInstantiation:()=>vt,CodeBlock:()=>bt,Comment:()=>Le,Function:()=>wt,FunctionInvocation:()=>_t,MethodInvocation:()=>Tt,Parameter:()=>kt,Reference:()=>it,Type:()=>nt,TypeLiteral:()=>Ae,Types:()=>nt,Variable:()=>Et,Writer:()=>lt,codeblock:()=>_c,function_:()=>Tc,instantiateClass:()=>kc,invokeFunction:()=>Ec,invokeMethod:()=>Ic,parameter:()=>Ac,reference:()=>Rc,variable:()=>Sc});p();f();d();p();f();d();p();f();d();var vt=class extends W{constructor({class_:t,arguments_:r}){super();E(this,"class_");E(this,"arguments_");this.class_=t,this.arguments_=r}write(t){t.write("new "),t.writeNode(this.class_),t.write("("),t.delimit({nodes:this.arguments_,delimiter:", ",writeFunction:r=>r.write(t)}),t.write(")")}};p();f();d();var bt=class extends W{constructor(t){super();E(this,"args");this.args=t}write(t){return new pe(this.args).write(t)}};p();f();d();var Le=class extends W{constructor({docs:t}={docs:void 0}){super();E(this,"docs");this.docs=t}write(t){this.docs!=null&&(t.writeLine("/**"),this.docs.split(`
|
|
19
|
+
`}}return e}};var W=class extends $e{async toStringAsync({customConfig:e,formatter:t}){let r=new Ut({customConfig:e,formatter:t});return this.write(r),await r.toStringAsync()}toString({customConfig:e,formatter:t}){let r=new Ut({customConfig:e,formatter:t});return this.write(r),r.toString()}};p();f();d();p();f();d();var y={};he(y,{BRAND:()=>Fu,DIRTY:()=>De,EMPTY_PATH:()=>lu,INVALID:()=>F,NEVER:()=>yc,OK:()=>ee,ParseStatus:()=>X,Schema:()=>L,ZodAny:()=>Be,ZodArray:()=>Ie,ZodBigInt:()=>We,ZodBoolean:()=>qe,ZodBranded:()=>Dt,ZodCatch:()=>tt,ZodDate:()=>ze,ZodDefault:()=>et,ZodDiscriminatedUnion:()=>nr,ZodEffects:()=>le,ZodEnum:()=>Xe,ZodError:()=>ae,ZodFirstPartyTypeKind:()=>B,ZodFunction:()=>ar,ZodIntersection:()=>Je,ZodIssueCode:()=>T,ZodLazy:()=>Ye,ZodLiteral:()=>Ke,ZodMap:()=>yt,ZodNaN:()=>xt,ZodNativeEnum:()=>Qe,ZodNever:()=>fe,ZodNull:()=>Ge,ZodNullable:()=>ve,ZodNumber:()=>Ve,ZodObject:()=>se,ZodOptional:()=>ue,ZodParsedType:()=>S,ZodPipeline:()=>Vt,ZodPromise:()=>Oe,ZodReadonly:()=>rt,ZodRecord:()=>ir,ZodSchema:()=>L,ZodSet:()=>gt,ZodString:()=>Fe,ZodSymbol:()=>mt,ZodTransformer:()=>le,ZodTuple:()=>xe,ZodType:()=>L,ZodUndefined:()=>Ze,ZodUnion:()=>He,ZodUnknown:()=>Ee,ZodVoid:()=>ht,addIssueToContext:()=>A,any:()=>Du,array:()=>zu,bigint:()=>Pu,boolean:()=>Aa,coerce:()=>hc,custom:()=>ka,date:()=>ju,datetimeRegex:()=>_a,defaultErrorMap:()=>Te,discriminatedUnion:()=>Ju,effect:()=>oc,enum:()=>ic,function:()=>tc,getErrorMap:()=>pt,getParsedType:()=>ge,instanceof:()=>Ou,intersection:()=>Yu,isAborted:()=>tr,isAsync:()=>dt,isDirty:()=>rr,isValid:()=>Ce,late:()=>Bu,lazy:()=>rc,literal:()=>nc,makeIssue:()=>$t,map:()=>Qu,nan:()=>Lu,nativeEnum:()=>ac,never:()=>Wu,null:()=>$u,nullable:()=>cc,number:()=>Ia,object:()=>Zu,objectUtil:()=>wr,oboolean:()=>mc,onumber:()=>fc,optional:()=>uc,ostring:()=>dc,pipeline:()=>pc,preprocess:()=>lc,promise:()=>sc,quotelessJson:()=>ou,record:()=>Xu,set:()=>ec,setErrorMap:()=>cu,strictObject:()=>Gu,string:()=>Ea,symbol:()=>Mu,transformer:()=>oc,tuple:()=>Ku,undefined:()=>Uu,union:()=>Hu,unknown:()=>Vu,util:()=>U,void:()=>qu});p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();var U;(function(n){n.assertEqual=a=>{};function e(a){}n.assertIs=e;function t(a){throw new Error}n.assertNever=t,n.arrayToEnum=a=>{let o={};for(let u of a)o[u]=u;return o},n.getValidEnumValues=a=>{let o=n.objectKeys(a).filter(m=>typeof a[a[m]]!="number"),u={};for(let m of o)u[m]=a[m];return n.objectValues(u)},n.objectValues=a=>n.objectKeys(a).map(function(o){return a[o]}),n.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let o=[];for(let u in a)Object.prototype.hasOwnProperty.call(a,u)&&o.push(u);return o},n.find=(a,o)=>{for(let u of a)if(o(u))return u},n.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function r(a,o=" | "){return a.map(u=>typeof u=="string"?`'${u}'`:u).join(o)}n.joinValues=r,n.jsonStringifyReplacer=(a,o)=>typeof o=="bigint"?o.toString():o})(U||(U={}));var wr;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(wr||(wr={}));var S=U.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ge=n=>{switch(typeof n){case"undefined":return S.undefined;case"string":return S.string;case"number":return Number.isNaN(n)?S.nan:S.number;case"boolean":return S.boolean;case"function":return S.function;case"bigint":return S.bigint;case"symbol":return S.symbol;case"object":return Array.isArray(n)?S.array:n===null?S.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?S.promise:typeof Map<"u"&&n instanceof Map?S.map:typeof Set<"u"&&n instanceof Set?S.set:typeof Date<"u"&&n instanceof Date?S.date:S.object;default:return S.unknown}};var T=U.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),ou=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:"),ae=class n extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(o){return o.message},r={_errors:[]},a=o=>{for(let u of o.issues)if(u.code==="invalid_union")u.unionErrors.map(a);else if(u.code==="invalid_return_type")a(u.returnTypeError);else if(u.code==="invalid_arguments")a(u.argumentsError);else if(u.path.length===0)r._errors.push(t(u));else{let m=r,x=0;for(;x<u.path.length;){let k=u.path[x];x===u.path.length-1?(m[k]=m[k]||{_errors:[]},m[k]._errors.push(t(u))):m[k]=m[k]||{_errors:[]},m=m[k],x++}}};return a(this),r}static assert(e){if(!(e instanceof n))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,U.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},r=[];for(let a of this.issues)if(a.path.length>0){let o=a.path[0];t[o]=t[o]||[],t[o].push(e(a))}else r.push(e(a));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}};ae.create=n=>new ae(n);var uu=(n,e)=>{let t;switch(n.code){case T.invalid_type:n.received===S.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case T.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,U.jsonStringifyReplacer)}`;break;case T.unrecognized_keys:t=`Unrecognized key(s) in object: ${U.joinValues(n.keys,", ")}`;break;case T.invalid_union:t="Invalid input";break;case T.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${U.joinValues(n.options)}`;break;case T.invalid_enum_value:t=`Invalid enum value. Expected ${U.joinValues(n.options)}, received '${n.received}'`;break;case T.invalid_arguments:t="Invalid function arguments";break;case T.invalid_return_type:t="Invalid function return type";break;case T.invalid_date:t="Invalid date";break;case T.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:U.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case T.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case T.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case T.custom:t="Invalid input";break;case T.invalid_intersection_types:t="Intersection results could not be merged";break;case T.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case T.not_finite:t="Number must be finite";break;default:t=e.defaultError,U.assertNever(n)}return{message:t}},Te=uu;var ga=Te;function cu(n){ga=n}function pt(){return ga}p();f();d();var $t=n=>{let{data:e,path:t,errorMaps:r,issueData:a}=n,o=[...t,...a.path||[]],u={...a,path:o};if(a.message!==void 0)return{...a,path:o,message:a.message};let m="",x=r.filter(k=>!!k).slice().reverse();for(let k of x)m=k(u,{data:e,defaultError:m}).message;return{...a,path:o,message:m}},lu=[];function A(n,e){let t=pt(),r=$t({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===Te?void 0:Te].filter(a=>!!a)});n.common.issues.push(r)}var X=class n{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let a of t){if(a.status==="aborted")return F;a.status==="dirty"&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let a of t){let o=await a.key,u=await a.value;r.push({key:o,value:u})}return n.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let a of t){let{key:o,value:u}=a;if(o.status==="aborted"||u.status==="aborted")return F;o.status==="dirty"&&e.dirty(),u.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof u.value<"u"||a.alwaysSet)&&(r[o.value]=u.value)}return{status:e.value,value:r}}},F=Object.freeze({status:"aborted"}),De=n=>({status:"dirty",value:n}),ee=n=>({status:"valid",value:n}),tr=n=>n.status==="aborted",rr=n=>n.status==="dirty",Ce=n=>n.status==="valid",dt=n=>typeof Promise<"u"&&n instanceof Promise;p();f();d();p();f();d();var N;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e?.message})(N||(N={}));var ce=class{constructor(e,t,r,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},xa=(n,e)=>{if(Ce(e))return{success:!0,data:e.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 t=new ae(n.common.issues);return this._error=t,this._error}}};function O(n){if(!n)return{};let{errorMap:e,invalid_type_error:t,required_error:r,description:a}=n;if(e&&(t||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(u,m)=>{let{message:x}=n;return u.code==="invalid_enum_value"?{message:x??m.defaultError}:typeof m.data>"u"?{message:x??r??m.defaultError}:u.code!=="invalid_type"?{message:m.defaultError}:{message:x??t??m.defaultError}},description:a}}var L=class{get description(){return this._def.description}_getType(e){return ge(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ge(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new X,ctx:{common:e.parent.common,data:e.data,parsedType:ge(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(dt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ge(e)},a=this._parseSync({data:e,path:r.path,parent:r});return xa(r,a)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ge(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return Ce(r)?{value:r.value}:{issues:t.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(r=>Ce(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ge(e)},a=this._parse({data:e,path:r.path,parent:r}),o=await(dt(a)?a:Promise.resolve(a));return xa(r,o)}refine(e,t){let r=a=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(a):t;return this._refinement((a,o)=>{let u=e(a),m=()=>o.addIssue({code:T.custom,...r(a)});return typeof Promise<"u"&&u instanceof Promise?u.then(x=>x?!0:(m(),!1)):u?!0:(m(),!1)})}refinement(e,t){return this._refinement((r,a)=>e(r)?!0:(a.addIssue(typeof t=="function"?t(r,a):t),!1))}_refinement(e){return new le({schema:this,typeName:B.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return ue.create(this,this._def)}nullable(){return ve.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ie.create(this)}promise(){return Oe.create(this,this._def)}or(e){return He.create([this,e],this._def)}and(e){return Je.create(this,e,this._def)}transform(e){return new le({...O(this._def),schema:this,typeName:B.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new et({...O(this._def),innerType:this,defaultValue:t,typeName:B.ZodDefault})}brand(){return new Dt({typeName:B.ZodBranded,type:this,...O(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new tt({...O(this._def),innerType:this,catchValue:t,typeName:B.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Vt.create(this,e)}readonly(){return rt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},pu=/^c[^\s-]{8,}$/i,du=/^[0-9a-z]+$/,fu=/^[0-9A-HJKMNP-TV-Z]{26}$/i,mu=/^[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,hu=/^[a-z0-9_-]{21}$/i,yu=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,gu=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,xu=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,vu="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",_r,bu=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,wu=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,_u=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Tu=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ku=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Eu=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ba="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Iu=new RegExp(`^${ba}$`);function wa(n){let e="[0-5]\\d";n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`);let t=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Au(n){return new RegExp(`^${wa(n)}$`)}function _a(n){let e=`${ba}T${wa(n)}`,t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Ru(n,e){return!!((e==="v4"||!e)&&bu.test(n)||(e==="v6"||!e)&&_u.test(n))}function Su(n,e){if(!yu.test(n))return!1;try{let[t]=n.split(".");if(!t)return!1;let r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),a=JSON.parse(atob(r));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function Nu(n,e){return!!((e==="v4"||!e)&&wu.test(n)||(e==="v6"||!e)&&Tu.test(n))}var Fe=class n extends L{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==S.string){let o=this._getOrReturnCtx(e);return A(o,{code:T.invalid_type,expected:S.string,received:o.parsedType}),F}let r=new X,a;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(a=this._getOrReturnCtx(e,a),A(a,{code:T.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="max")e.data.length>o.value&&(a=this._getOrReturnCtx(e,a),A(a,{code:T.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){let u=e.data.length>o.value,m=e.data.length<o.value;(u||m)&&(a=this._getOrReturnCtx(e,a),u?A(a,{code:T.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):m&&A(a,{code:T.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")xu.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"email",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="emoji")_r||(_r=new RegExp(vu,"u")),_r.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"emoji",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")mu.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"uuid",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="nanoid")hu.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"nanoid",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")pu.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"cuid",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid2")du.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"cuid2",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="ulid")fu.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"ulid",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),A(a,{validation:"url",code:T.invalid_string,message:o.message}),r.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"regex",code:T.invalid_string,message:o.message}),r.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(a=this._getOrReturnCtx(e,a),A(a,{code:T.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),r.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(a=this._getOrReturnCtx(e,a),A(a,{code:T.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(a=this._getOrReturnCtx(e,a),A(a,{code:T.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?_a(o).test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{code:T.invalid_string,validation:"datetime",message:o.message}),r.dirty()):o.kind==="date"?Iu.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{code:T.invalid_string,validation:"date",message:o.message}),r.dirty()):o.kind==="time"?Au(o).test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{code:T.invalid_string,validation:"time",message:o.message}),r.dirty()):o.kind==="duration"?gu.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"duration",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="ip"?Ru(e.data,o.version)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"ip",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="jwt"?Su(e.data,o.alg)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"jwt",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="cidr"?Nu(e.data,o.version)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"cidr",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="base64"?ku.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"base64",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="base64url"?Eu.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"base64url",code:T.invalid_string,message:o.message}),r.dirty()):U.assertNever(o);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(a=>e.test(a),{validation:t,code:T.invalid_string,...N.errToObj(r)})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...N.errToObj(e)})}url(e){return this._addCheck({kind:"url",...N.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...N.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...N.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...N.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...N.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...N.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...N.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...N.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...N.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...N.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...N.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...N.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...N.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...N.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...N.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...N.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...N.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...N.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...N.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...N.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...N.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...N.errToObj(t)})}nonempty(e){return this.min(1,N.errToObj(e))}trim(){return new n({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new n({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new n({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}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 isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}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 isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Fe.create=n=>new Fe({checks:[],typeName:B.ZodString,coerce:n?.coerce??!1,...O(n)});function Cu(n,e){let t=(n.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,a=t>r?t:r,o=Number.parseInt(n.toFixed(a).replace(".","")),u=Number.parseInt(e.toFixed(a).replace(".",""));return o%u/10**a}var Ve=class n extends L{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)!==S.number){let o=this._getOrReturnCtx(e);return A(o,{code:T.invalid_type,expected:S.number,received:o.parsedType}),F}let r,a=new X;for(let o of this._def.checks)o.kind==="int"?U.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),A(r,{code:T.invalid_type,expected:"integer",received:"float",message:o.message}),a.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),A(r,{code:T.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),A(r,{code:T.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="multipleOf"?Cu(e.data,o.value)!==0&&(r=this._getOrReturnCtx(e,r),A(r,{code:T.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),A(r,{code:T.not_finite,message:o.message}),a.dirty()):U.assertNever(o);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,N.toString(t))}gt(e,t){return this.setLimit("min",e,!1,N.toString(t))}lte(e,t){return this.setLimit("max",e,!0,N.toString(t))}lt(e,t){return this.setLimit("max",e,!1,N.toString(t))}setLimit(e,t,r,a){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:N.toString(a)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:N.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:N.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:N.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:N.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:N.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:N.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:N.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:N.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:N.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&U.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Ve.create=n=>new Ve({checks:[],typeName:B.ZodNumber,coerce:n?.coerce||!1,...O(n)});var We=class n extends L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==S.bigint)return this._getInvalidInput(e);let r,a=new X;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),A(r,{code:T.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),A(r,{code:T.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),A(r,{code:T.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):U.assertNever(o);return{status:a.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return A(t,{code:T.invalid_type,expected:S.bigint,received:t.parsedType}),F}gte(e,t){return this.setLimit("min",e,!0,N.toString(t))}gt(e,t){return this.setLimit("min",e,!1,N.toString(t))}lte(e,t){return this.setLimit("max",e,!0,N.toString(t))}lt(e,t){return this.setLimit("max",e,!1,N.toString(t))}setLimit(e,t,r,a){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:N.toString(a)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:N.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:N.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:N.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:N.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:N.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};We.create=n=>new We({checks:[],typeName:B.ZodBigInt,coerce:n?.coerce??!1,...O(n)});var qe=class extends L{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==S.boolean){let r=this._getOrReturnCtx(e);return A(r,{code:T.invalid_type,expected:S.boolean,received:r.parsedType}),F}return ee(e.data)}};qe.create=n=>new qe({typeName:B.ZodBoolean,coerce:n?.coerce||!1,...O(n)});var ze=class n extends L{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==S.date){let o=this._getOrReturnCtx(e);return A(o,{code:T.invalid_type,expected:S.date,received:o.parsedType}),F}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return A(o,{code:T.invalid_date}),F}let r=new X,a;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(a=this._getOrReturnCtx(e,a),A(a,{code:T.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(a=this._getOrReturnCtx(e,a),A(a,{code:T.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):U.assertNever(o);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:N.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:N.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};ze.create=n=>new ze({checks:[],coerce:n?.coerce||!1,typeName:B.ZodDate,...O(n)});var mt=class extends L{_parse(e){if(this._getType(e)!==S.symbol){let r=this._getOrReturnCtx(e);return A(r,{code:T.invalid_type,expected:S.symbol,received:r.parsedType}),F}return ee(e.data)}};mt.create=n=>new mt({typeName:B.ZodSymbol,...O(n)});var Ze=class extends L{_parse(e){if(this._getType(e)!==S.undefined){let r=this._getOrReturnCtx(e);return A(r,{code:T.invalid_type,expected:S.undefined,received:r.parsedType}),F}return ee(e.data)}};Ze.create=n=>new Ze({typeName:B.ZodUndefined,...O(n)});var Ge=class extends L{_parse(e){if(this._getType(e)!==S.null){let r=this._getOrReturnCtx(e);return A(r,{code:T.invalid_type,expected:S.null,received:r.parsedType}),F}return ee(e.data)}};Ge.create=n=>new Ge({typeName:B.ZodNull,...O(n)});var Be=class extends L{constructor(){super(...arguments),this._any=!0}_parse(e){return ee(e.data)}};Be.create=n=>new Be({typeName:B.ZodAny,...O(n)});var Ee=class extends L{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ee(e.data)}};Ee.create=n=>new Ee({typeName:B.ZodUnknown,...O(n)});var fe=class extends L{_parse(e){let t=this._getOrReturnCtx(e);return A(t,{code:T.invalid_type,expected:S.never,received:t.parsedType}),F}};fe.create=n=>new fe({typeName:B.ZodNever,...O(n)});var ht=class extends L{_parse(e){if(this._getType(e)!==S.undefined){let r=this._getOrReturnCtx(e);return A(r,{code:T.invalid_type,expected:S.void,received:r.parsedType}),F}return ee(e.data)}};ht.create=n=>new ht({typeName:B.ZodVoid,...O(n)});var Ie=class n extends L{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==S.array)return A(t,{code:T.invalid_type,expected:S.array,received:t.parsedType}),F;if(a.exactLength!==null){let u=t.data.length>a.exactLength.value,m=t.data.length<a.exactLength.value;(u||m)&&(A(t,{code:u?T.too_big:T.too_small,minimum:m?a.exactLength.value:void 0,maximum:u?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(a.minLength!==null&&t.data.length<a.minLength.value&&(A(t,{code:T.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),a.maxLength!==null&&t.data.length>a.maxLength.value&&(A(t,{code:T.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((u,m)=>a.type._parseAsync(new ce(t,u,t.path,m)))).then(u=>X.mergeArray(r,u));let o=[...t.data].map((u,m)=>a.type._parseSync(new ce(t,u,t.path,m)));return X.mergeArray(r,o)}get element(){return this._def.type}min(e,t){return new n({...this._def,minLength:{value:e,message:N.toString(t)}})}max(e,t){return new n({...this._def,maxLength:{value:e,message:N.toString(t)}})}length(e,t){return new n({...this._def,exactLength:{value:e,message:N.toString(t)}})}nonempty(e){return this.min(1,e)}};Ie.create=(n,e)=>new Ie({type:n,minLength:null,maxLength:null,exactLength:null,typeName:B.ZodArray,...O(e)});function ft(n){if(n instanceof se){let e={};for(let t in n.shape){let r=n.shape[t];e[t]=ue.create(ft(r))}return new se({...n._def,shape:()=>e})}else return n instanceof Ie?new Ie({...n._def,type:ft(n.element)}):n instanceof ue?ue.create(ft(n.unwrap())):n instanceof ve?ve.create(ft(n.unwrap())):n instanceof xe?xe.create(n.items.map(e=>ft(e))):n}var se=class n extends L{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(),t=U.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==S.object){let k=this._getOrReturnCtx(e);return A(k,{code:T.invalid_type,expected:S.object,received:k.parsedType}),F}let{status:r,ctx:a}=this._processInputParams(e),{shape:o,keys:u}=this._getCached(),m=[];if(!(this._def.catchall instanceof fe&&this._def.unknownKeys==="strip"))for(let k in a.data)u.includes(k)||m.push(k);let x=[];for(let k of u){let R=o[k],P=a.data[k];x.push({key:{status:"valid",value:k},value:R._parse(new ce(a,P,a.path,k)),alwaysSet:k in a.data})}if(this._def.catchall instanceof fe){let k=this._def.unknownKeys;if(k==="passthrough")for(let R of m)x.push({key:{status:"valid",value:R},value:{status:"valid",value:a.data[R]}});else if(k==="strict")m.length>0&&(A(a,{code:T.unrecognized_keys,keys:m}),r.dirty());else if(k!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let k=this._def.catchall;for(let R of m){let P=a.data[R];x.push({key:{status:"valid",value:R},value:k._parse(new ce(a,P,a.path,R)),alwaysSet:R in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let k=[];for(let R of x){let P=await R.key,Y=await R.value;k.push({key:P,value:Y,alwaysSet:R.alwaysSet})}return k}).then(k=>X.mergeObjectSync(r,k)):X.mergeObjectSync(r,x)}get shape(){return this._def.shape()}strict(e){return N.errToObj,new n({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{let a=this._def.errorMap?.(t,r).message??r.defaultError;return t.code==="unrecognized_keys"?{message:N.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new n({...this._def,unknownKeys:"strip"})}passthrough(){return new n({...this._def,unknownKeys:"passthrough"})}extend(e){return new n({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new n({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:B.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new n({...this._def,catchall:e})}pick(e){let t={};for(let r of U.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new n({...this._def,shape:()=>t})}omit(e){let t={};for(let r of U.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new n({...this._def,shape:()=>t})}deepPartial(){return ft(this)}partial(e){let t={};for(let r of U.objectKeys(this.shape)){let a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()}return new n({...this._def,shape:()=>t})}required(e){let t={};for(let r of U.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof ue;)o=o._def.innerType;t[r]=o}return new n({...this._def,shape:()=>t})}keyof(){return Ta(U.objectKeys(this.shape))}};se.create=(n,e)=>new se({shape:()=>n,unknownKeys:"strip",catchall:fe.create(),typeName:B.ZodObject,...O(e)});se.strictCreate=(n,e)=>new se({shape:()=>n,unknownKeys:"strict",catchall:fe.create(),typeName:B.ZodObject,...O(e)});se.lazycreate=(n,e)=>new se({shape:n,unknownKeys:"strip",catchall:fe.create(),typeName:B.ZodObject,...O(e)});var He=class extends L{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function a(o){for(let m of o)if(m.result.status==="valid")return m.result;for(let m of o)if(m.result.status==="dirty")return t.common.issues.push(...m.ctx.common.issues),m.result;let u=o.map(m=>new ae(m.ctx.common.issues));return A(t,{code:T.invalid_union,unionErrors:u}),F}if(t.common.async)return Promise.all(r.map(async o=>{let u={...t,common:{...t.common,issues:[]},parent:null};return{result:await o._parseAsync({data:t.data,path:t.path,parent:u}),ctx:u}})).then(a);{let o,u=[];for(let x of r){let k={...t,common:{...t.common,issues:[]},parent:null},R=x._parseSync({data:t.data,path:t.path,parent:k});if(R.status==="valid")return R;R.status==="dirty"&&!o&&(o={result:R,ctx:k}),k.common.issues.length&&u.push(k.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;let m=u.map(x=>new ae(x));return A(t,{code:T.invalid_union,unionErrors:m}),F}}get options(){return this._def.options}};He.create=(n,e)=>new He({options:n,typeName:B.ZodUnion,...O(e)});var ke=n=>n instanceof Ye?ke(n.schema):n instanceof le?ke(n.innerType()):n instanceof Ke?[n.value]:n instanceof Xe?n.options:n instanceof Qe?U.objectValues(n.enum):n instanceof et?ke(n._def.innerType):n instanceof Ze?[void 0]:n instanceof Ge?[null]:n instanceof ue?[void 0,...ke(n.unwrap())]:n instanceof ve?[null,...ke(n.unwrap())]:n instanceof Dt||n instanceof rt?ke(n.unwrap()):n instanceof tt?ke(n._def.innerType):[],nr=class n extends L{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==S.object)return A(t,{code:T.invalid_type,expected:S.object,received:t.parsedType}),F;let r=this.discriminator,a=t.data[r],o=this.optionsMap.get(a);return o?t.common.async?o._parseAsync({data:t.data,path:t.path,parent:t}):o._parseSync({data:t.data,path:t.path,parent:t}):(A(t,{code:T.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),F)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let a=new Map;for(let o of t){let u=ke(o.shape[e]);if(!u.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let m of u){if(a.has(m))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(m)}`);a.set(m,o)}}return new n({typeName:B.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...O(r)})}};function Tr(n,e){let t=ge(n),r=ge(e);if(n===e)return{valid:!0,data:n};if(t===S.object&&r===S.object){let a=U.objectKeys(e),o=U.objectKeys(n).filter(m=>a.indexOf(m)!==-1),u={...n,...e};for(let m of o){let x=Tr(n[m],e[m]);if(!x.valid)return{valid:!1};u[m]=x.data}return{valid:!0,data:u}}else if(t===S.array&&r===S.array){if(n.length!==e.length)return{valid:!1};let a=[];for(let o=0;o<n.length;o++){let u=n[o],m=e[o],x=Tr(u,m);if(!x.valid)return{valid:!1};a.push(x.data)}return{valid:!0,data:a}}else return t===S.date&&r===S.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}var Je=class extends L{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=(o,u)=>{if(tr(o)||tr(u))return F;let m=Tr(o.value,u.value);return m.valid?((rr(o)||rr(u))&&t.dirty(),{status:t.value,value:m.data}):(A(r,{code:T.invalid_intersection_types}),F)};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,u])=>a(o,u)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Je.create=(n,e,t)=>new Je({left:n,right:e,typeName:B.ZodIntersection,...O(t)});var xe=class n extends L{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==S.array)return A(r,{code:T.invalid_type,expected:S.array,received:r.parsedType}),F;if(r.data.length<this._def.items.length)return A(r,{code:T.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),F;!this._def.rest&&r.data.length>this._def.items.length&&(A(r,{code:T.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let o=[...r.data].map((u,m)=>{let x=this._def.items[m]||this._def.rest;return x?x._parse(new ce(r,u,r.path,m)):null}).filter(u=>!!u);return r.common.async?Promise.all(o).then(u=>X.mergeArray(t,u)):X.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new n({...this._def,rest:e})}};xe.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new xe({items:n,typeName:B.ZodTuple,rest:null,...O(e)})};var ir=class n extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==S.object)return A(r,{code:T.invalid_type,expected:S.object,received:r.parsedType}),F;let a=[],o=this._def.keyType,u=this._def.valueType;for(let m in r.data)a.push({key:o._parse(new ce(r,m,r.path,m)),value:u._parse(new ce(r,r.data[m],r.path,m)),alwaysSet:m in r.data});return r.common.async?X.mergeObjectAsync(t,a):X.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof L?new n({keyType:e,valueType:t,typeName:B.ZodRecord,...O(r)}):new n({keyType:Fe.create(),valueType:e,typeName:B.ZodRecord,...O(t)})}},yt=class extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==S.map)return A(r,{code:T.invalid_type,expected:S.map,received:r.parsedType}),F;let a=this._def.keyType,o=this._def.valueType,u=[...r.data.entries()].map(([m,x],k)=>({key:a._parse(new ce(r,m,r.path,[k,"key"])),value:o._parse(new ce(r,x,r.path,[k,"value"]))}));if(r.common.async){let m=new Map;return Promise.resolve().then(async()=>{for(let x of u){let k=await x.key,R=await x.value;if(k.status==="aborted"||R.status==="aborted")return F;(k.status==="dirty"||R.status==="dirty")&&t.dirty(),m.set(k.value,R.value)}return{status:t.value,value:m}})}else{let m=new Map;for(let x of u){let k=x.key,R=x.value;if(k.status==="aborted"||R.status==="aborted")return F;(k.status==="dirty"||R.status==="dirty")&&t.dirty(),m.set(k.value,R.value)}return{status:t.value,value:m}}}};yt.create=(n,e,t)=>new yt({valueType:e,keyType:n,typeName:B.ZodMap,...O(t)});var gt=class n extends L{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==S.set)return A(r,{code:T.invalid_type,expected:S.set,received:r.parsedType}),F;let a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(A(r,{code:T.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),a.maxSize!==null&&r.data.size>a.maxSize.value&&(A(r,{code:T.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());let o=this._def.valueType;function u(x){let k=new Set;for(let R of x){if(R.status==="aborted")return F;R.status==="dirty"&&t.dirty(),k.add(R.value)}return{status:t.value,value:k}}let m=[...r.data.values()].map((x,k)=>o._parse(new ce(r,x,r.path,k)));return r.common.async?Promise.all(m).then(x=>u(x)):u(m)}min(e,t){return new n({...this._def,minSize:{value:e,message:N.toString(t)}})}max(e,t){return new n({...this._def,maxSize:{value:e,message:N.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};gt.create=(n,e)=>new gt({valueType:n,minSize:null,maxSize:null,typeName:B.ZodSet,...O(e)});var ar=class n extends L{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==S.function)return A(t,{code:T.invalid_type,expected:S.function,received:t.parsedType}),F;function r(m,x){return $t({data:m,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,pt(),Te].filter(k=>!!k),issueData:{code:T.invalid_arguments,argumentsError:x}})}function a(m,x){return $t({data:m,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,pt(),Te].filter(k=>!!k),issueData:{code:T.invalid_return_type,returnTypeError:x}})}let o={errorMap:t.common.contextualErrorMap},u=t.data;if(this._def.returns instanceof Oe){let m=this;return ee(async function(...x){let k=new ae([]),R=await m._def.args.parseAsync(x,o).catch(C=>{throw k.addIssue(r(x,C)),k}),P=await Reflect.apply(u,this,R);return await m._def.returns._def.type.parseAsync(P,o).catch(C=>{throw k.addIssue(a(P,C)),k})})}else{let m=this;return ee(function(...x){let k=m._def.args.safeParse(x,o);if(!k.success)throw new ae([r(x,k.error)]);let R=Reflect.apply(u,this,k.data),P=m._def.returns.safeParse(R,o);if(!P.success)throw new ae([a(R,P.error)]);return P.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new n({...this._def,args:xe.create(e).rest(Ee.create())})}returns(e){return new n({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new n({args:e||xe.create([]).rest(Ee.create()),returns:t||Ee.create(),typeName:B.ZodFunction,...O(r)})}},Ye=class extends L{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Ye.create=(n,e)=>new Ye({getter:n,typeName:B.ZodLazy,...O(e)});var Ke=class extends L{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return A(t,{received:t.data,code:T.invalid_literal,expected:this._def.value}),F}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ke.create=(n,e)=>new Ke({value:n,typeName:B.ZodLiteral,...O(e)});function Ta(n,e){return new Xe({values:n,typeName:B.ZodEnum,...O(e)})}var Xe=class n extends L{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return A(t,{expected:U.joinValues(r),received:t.parsedType,code:T.invalid_type}),F}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return A(t,{received:t.data,code:T.invalid_enum_value,options:r}),F}return ee(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return n.create(e,{...this._def,...t})}exclude(e,t=this._def){return n.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}};Xe.create=Ta;var Qe=class extends L{_parse(e){let t=U.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==S.string&&r.parsedType!==S.number){let a=U.objectValues(t);return A(r,{expected:U.joinValues(a),received:r.parsedType,code:T.invalid_type}),F}if(this._cache||(this._cache=new Set(U.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let a=U.objectValues(t);return A(r,{received:r.data,code:T.invalid_enum_value,options:a}),F}return ee(e.data)}get enum(){return this._def.values}};Qe.create=(n,e)=>new Qe({values:n,typeName:B.ZodNativeEnum,...O(e)});var Oe=class extends L{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==S.promise&&t.common.async===!1)return A(t,{code:T.invalid_type,expected:S.promise,received:t.parsedType}),F;let r=t.parsedType===S.promise?t.data:Promise.resolve(t.data);return ee(r.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Oe.create=(n,e)=>new Oe({type:n,typeName:B.ZodPromise,...O(e)});var le=class extends L{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===B.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=this._def.effect||null,o={addIssue:u=>{A(r,u),u.fatal?t.abort():t.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),a.type==="preprocess"){let u=a.transform(r.data,o);if(r.common.async)return Promise.resolve(u).then(async m=>{if(t.value==="aborted")return F;let x=await this._def.schema._parseAsync({data:m,path:r.path,parent:r});return x.status==="aborted"?F:x.status==="dirty"?De(x.value):t.value==="dirty"?De(x.value):x});{if(t.value==="aborted")return F;let m=this._def.schema._parseSync({data:u,path:r.path,parent:r});return m.status==="aborted"?F:m.status==="dirty"?De(m.value):t.value==="dirty"?De(m.value):m}}if(a.type==="refinement"){let u=m=>{let x=a.refinement(m,o);if(r.common.async)return Promise.resolve(x);if(x instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return m};if(r.common.async===!1){let m=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return m.status==="aborted"?F:(m.status==="dirty"&&t.dirty(),u(m.value),{status:t.value,value:m.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(m=>m.status==="aborted"?F:(m.status==="dirty"&&t.dirty(),u(m.value).then(()=>({status:t.value,value:m.value}))))}if(a.type==="transform")if(r.common.async===!1){let u=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ce(u))return F;let m=a.transform(u.value,o);if(m instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:m}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(u=>Ce(u)?Promise.resolve(a.transform(u.value,o)).then(m=>({status:t.value,value:m})):F);U.assertNever(a)}};le.create=(n,e,t)=>new le({schema:n,typeName:B.ZodEffects,effect:e,...O(t)});le.createWithPreprocess=(n,e,t)=>new le({schema:e,effect:{type:"preprocess",transform:n},typeName:B.ZodEffects,...O(t)});var ue=class extends L{_parse(e){return this._getType(e)===S.undefined?ee(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ue.create=(n,e)=>new ue({innerType:n,typeName:B.ZodOptional,...O(e)});var ve=class extends L{_parse(e){return this._getType(e)===S.null?ee(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ve.create=(n,e)=>new ve({innerType:n,typeName:B.ZodNullable,...O(e)});var et=class extends L{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===S.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};et.create=(n,e)=>new et({innerType:n,typeName:B.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...O(e)});var tt=class extends L{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return dt(a)?a.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new ae(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new ae(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};tt.create=(n,e)=>new tt({innerType:n,typeName:B.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...O(e)});var xt=class extends L{_parse(e){if(this._getType(e)!==S.nan){let r=this._getOrReturnCtx(e);return A(r,{code:T.invalid_type,expected:S.nan,received:r.parsedType}),F}return{status:"valid",value:e.data}}};xt.create=n=>new xt({typeName:B.ZodNaN,...O(n)});var Fu=Symbol("zod_brand"),Dt=class extends L{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}},Vt=class n extends L{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?F:o.status==="dirty"?(t.dirty(),De(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{let a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?F:a.status==="dirty"?(t.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(e,t){return new n({in:e,out:t,typeName:B.ZodPipeline})}},rt=class extends L{_parse(e){let t=this._def.innerType._parse(e),r=a=>(Ce(a)&&(a.value=Object.freeze(a.value)),a);return dt(t)?t.then(a=>r(a)):r(t)}unwrap(){return this._def.innerType}};rt.create=(n,e)=>new rt({innerType:n,typeName:B.ZodReadonly,...O(e)});function va(n,e){let t=typeof n=="function"?n(e):typeof n=="string"?{message:n}:n;return typeof t=="string"?{message:t}:t}function ka(n,e={},t){return n?Be.create().superRefine((r,a)=>{let o=n(r);if(o instanceof Promise)return o.then(u=>{if(!u){let m=va(e,r),x=m.fatal??t??!0;a.addIssue({code:"custom",...m,fatal:x})}});if(!o){let u=va(e,r),m=u.fatal??t??!0;a.addIssue({code:"custom",...u,fatal:m})}}):Be.create()}var Bu={object:se.lazycreate},B;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(B||(B={}));var Ou=(n,e={message:`Input not instance of ${n.name}`})=>ka(t=>t instanceof n,e),Ea=Fe.create,Ia=Ve.create,Lu=xt.create,Pu=We.create,Aa=qe.create,ju=ze.create,Mu=mt.create,Uu=Ze.create,$u=Ge.create,Du=Be.create,Vu=Ee.create,Wu=fe.create,qu=ht.create,zu=Ie.create,Zu=se.create,Gu=se.strictCreate,Hu=He.create,Ju=nr.create,Yu=Je.create,Ku=xe.create,Xu=ir.create,Qu=yt.create,ec=gt.create,tc=ar.create,rc=Ye.create,nc=Ke.create,ic=Xe.create,ac=Qe.create,sc=Oe.create,oc=le.create,uc=ue.create,cc=ve.create,lc=le.createWithPreprocess,pc=Vt.create,dc=()=>Ea().optional(),fc=()=>Ia().optional(),mc=()=>Aa().optional(),hc={string:(n=>Fe.create({...n,coerce:!0})),number:(n=>Ve.create({...n,coerce:!0})),boolean:(n=>qe.create({...n,coerce:!0})),bigint:(n=>We.create({...n,coerce:!0})),date:(n=>ze.create({...n,coerce:!0}))};var yc=F;p();f();d();var Ra=y.strictObject({title:y.string(),content:y.string()});var gc=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,Sa=y.string().refine(n=>gc.test(n),{message:"Must be a valid JavaScript identifier (e.g., 'acme', 'MySDK')"}),Na=y.strictObject({namespace:y.optional(Sa),client:y.optional(y.string()),error:y.optional(y.string()),timeoutError:y.optional(y.string()),environment:y.optional(y.string()),environmentUrls:y.optional(y.string()),version:y.optional(y.string())}),Ca=y.union([Sa,Na]),xc=y.strictObject({neverThrowErrors:y.optional(y.boolean()),outputEsm:y.optional(y.boolean()),outputSourceFiles:y.optional(y.boolean()),outputSrcOnly:y.optional(y.boolean()),includeCredentialsOnCrossOriginRequests:y.optional(y.boolean()),bundle:y.optional(y.boolean()),allowCustomFetcher:y.optional(y.boolean()),generateWebSocketClients:y.optional(y.boolean()),defaultTimeoutInSeconds:y.optional(y.union([y.literal("infinity"),y.number()])),skipResponseValidation:y.optional(y.boolean()),extraDependencies:y.optional(y.record(y.string())),extraDevDependencies:y.optional(y.record(y.string())),extraPeerDependencies:y.optional(y.record(y.string())),extraPeerDependenciesMeta:y.optional(y.record(y.any())),treatUnknownAsAny:y.optional(y.boolean()),noOptionalProperties:y.optional(y.boolean()),tolerateRepublish:y.optional(y.boolean()),packageJson:y.optional(y.record(y.any())),publishToJsr:y.optional(y.boolean()),omitUndefined:y.optional(y.boolean()),useLegacyExports:y.optional(y.boolean()),streamType:y.optional(y.enum(["wrapper","web"])),fileResponseType:y.optional(y.enum(["stream","binary-response"])),formDataSupport:y.optional(y.enum(["Node16","Node18"])),fetchSupport:y.optional(y.enum(["node-fetch","native"])),packagePath:y.optional(y.string()),omitFernHeaders:y.optional(y.boolean()),useDefaultRequestParameterValues:y.optional(y.boolean()),packageManager:y.optional(y.enum(["pnpm","yarn"])),flattenRequestParameters:y.optional(y.boolean()),exportAllRequestsAtRoot:y.optional(y.boolean()),customReadmeSections:y.optional(y.array(Ra)),testFramework:y.optional(y.enum(["jest","vitest"])),consolidateTypeFiles:y.optional(y.boolean()),generateEndpointMetadata:y.optional(y.boolean()),wireTestsFallbackToAutoGeneratedErrorExamples:y.boolean().optional(),linter:y.optional(y.enum(["biome","oxlint","none"])),formatter:y.optional(y.enum(["prettier","biome","oxfmt","none"])),enableForwardCompatibleEnums:y.optional(y.boolean()),parameterNaming:y.optional(y.enum(["originalName","wireValue","camelCase","snakeCase","default"])),generateSubpackageExports:y.optional(y.boolean()),allowExtraFields:y.optional(y.boolean()),enableInlineTypes:y.optional(y.boolean()),inlineFileProperties:y.optional(y.boolean()),inlinePathParameters:y.optional(y.boolean()),naming:y.optional(Ca),namespaceExport:y.optional(y.string()),noSerdeLayer:y.optional(y.boolean()),serdeLayer:y.optional(y.boolean()),private:y.optional(y.boolean()),requireDefaultEnvironment:y.optional(y.boolean()),retainOriginalCasing:y.optional(y.boolean()),useBigInt:y.optional(y.boolean()),useBrandedStringAliases:y.optional(y.boolean()),offsetSemantics:y.optional(y.enum(["item-index","page-index"])),customPagerName:y.optional(y.string()),resolveQueryParameterNameConflicts:y.optional(y.boolean()),alwaysSendAuth:y.optional(y.boolean()),includeContentHeadersOnFileDownloadResponse:y.optional(y.boolean()),includeUtilsOnUnionMembers:y.optional(y.boolean()),includeOtherInUnionTypes:y.optional(y.boolean()),writeUnitTests:y.optional(y.boolean()),generateWireTests:y.optional(y.boolean()),noScripts:y.optional(y.boolean()),skipNpmPkgFix:y.optional(y.boolean()),experimentalGenerateReadWriteOnlyTypes:y.optional(y.boolean()),timeoutInSeconds:y.optional(y.union([y.literal("infinity"),y.number()])),includeApiReference:y.optional(y.boolean()),shouldGenerateWebsocketClients:y.optional(y.boolean()),_fernLicenseName:y.optional(y.string()),maxRetries:y.optional(y.number().int().min(0)),retryStatusCodes:y.optional(y.enum(["legacy","recommended"]))});function Wt(n){return n?.serdeLayer!=null?!n.serdeLayer:!!n?.noSerdeLayer}var I={};he(I,{AstNode:()=>W,ClassInstantiation:()=>vt,CodeBlock:()=>bt,Comment:()=>Le,Function:()=>wt,FunctionInvocation:()=>_t,MethodInvocation:()=>Tt,Parameter:()=>kt,Reference:()=>it,Type:()=>nt,TypeLiteral:()=>Ae,Types:()=>nt,Variable:()=>Et,Writer:()=>lt,codeblock:()=>Tc,function_:()=>kc,instantiateClass:()=>Ec,invokeFunction:()=>Ic,invokeMethod:()=>Ac,parameter:()=>Rc,reference:()=>Sc,variable:()=>Nc});p();f();d();p();f();d();p();f();d();var vt=class extends W{constructor({class_:t,arguments_:r}){super();E(this,"class_");E(this,"arguments_");this.class_=t,this.arguments_=r}write(t){t.write("new "),t.writeNode(this.class_),t.write("("),t.delimit({nodes:this.arguments_,delimiter:", ",writeFunction:r=>r.write(t)}),t.write(")")}};p();f();d();var bt=class extends W{constructor(t){super();E(this,"args");this.args=t}write(t){return new pe(this.args).write(t)}};p();f();d();var Le=class extends W{constructor({docs:t}={docs:void 0}){super();E(this,"docs");this.docs=t}write(t){this.docs!=null&&(t.writeLine("/**"),this.docs.split(`
|
|
20
20
|
`).forEach(r=>{t.writeLine(` * ${r}`)}),t.writeLine("*/"))}};p();f();d();p();f();d();var nt=class extends W{constructor(t){super();E(this,"internalType");this.internalType=t}write(t){switch(this.internalType.type){case"string":t.write("string");break;case"number":t.write("number");break;case"bigint":t.write("bigint");break;case"boolean":t.write("boolean");break;case"array":this.internalType.valueType.write(t),t.write("[]");break;case"map":t.write("Record<"),this.internalType.keyType.write(t),t.write(", "),this.internalType.valueType.write(t),t.write(">");break;case"object":t.write("{"),t.indent();for(let[r,a]of Object.entries(this.internalType.fields))t.write(`${r}: `),a.write(t),t.writeLine(",");t.dedent(),t.write("}");break;case"enum":t.write("enum");break;case"any":t.write("any");break;case"promise":t.write("Promise<"),this.internalType.value.write(t),t.write(">");break;case"unknown":t.write("unknown");break;case"void":t.write("void");break;case"undefined":t.write("undefined");break;case"null":t.write("null");break;case"never":t.write("never");break;case"nop":break;default:q(this.internalType)}}static string(){return new this({type:"string"})}static number(){return new this({type:"number"})}static bigint(){return new this({type:"bigint"})}static boolean(){return new this({type:"boolean"})}static array(t){return new this({type:"array",valueType:t})}static object(t){return new this({type:"object",fields:t})}static enum(t){return new this({type:"enum",values:t})}static any(){return new this({type:"any"})}static promise(t){return t.internalType.type==="promise"?t:new this({type:"promise",value:t})}static unknown(){return new this({type:"unknown"})}static void(){return new this({type:"void"})}static undefined(){return new this({type:"undefined"})}static null(){return new this({type:"null"})}static never(){return new this({type:"never"})}static nop(){return new this({type:"nop"})}};var wt=class extends W{constructor({name:t,parameters:r,async:a,body:o,return_:u,docs:m}){super();E(this,"name");E(this,"parameters");E(this,"async");E(this,"body");E(this,"return_");E(this,"docs");this.name=t,this.parameters=r,this.async=a??!1,this.body=o,this.return_=u,this.docs=m}write(t){t.writeNode(new Le({docs:this.docs})),this.async&&t.write("async "),t.write("function "),t.write(`${this.name}`),this.writeParameters(t),this.return_!=null&&(t.write(": "),t.writeNode(this.async?nt.promise(this.return_):this.return_)),t.writeLine(" {"),t.indent(),this.body?.write(t),t.dedent(),t.writeNewLineIfLastLineNot(),t.writeLine("}")}writeParameters(t){if(this.parameters.length===0){t.write("()");return}t.indent(),t.writeLine("(");for(let r of this.parameters)t.writeNode(r),t.writeLine(",");t.dedent(),t.write(")")}};p();f();d();var _t=class extends W{constructor({function_:t,arguments_:r}){super();E(this,"function_");E(this,"arguments_");this.function_=t,this.arguments_=r}write(t){t.writeNode(this.function_),t.write("("),t.delimit({nodes:this.arguments_,delimiter:", ",writeFunction:r=>r.write(t)}),t.write(")")}};p();f();d();var Tt=class extends W{constructor({on:t,method:r,arguments_:a,async:o}){super();E(this,"on");E(this,"method");E(this,"arguments_");E(this,"async");this.on=t,this.method=r,this.arguments_=a,this.async=o}write(t){this.async&&t.write("await "),this.on.write(t),t.write("."),t.write(this.method),t.write("("),t.delimit({nodes:this.arguments_,delimiter:", ",writeFunction:r=>r.write(t)}),t.write(")")}};p();f();d();var kt=class extends W{constructor({name:t,type:r,docs:a}){super();E(this,"name");E(this,"type");E(this,"docs");this.name=t,this.type=r,this.docs=a}write(t){this.docs!=null&&t.writeNode(new Le({docs:this.docs})),t.write(`${this.name}: `),this.type.write(t)}};p();f();d();var it=class extends W{constructor({name:t,importFrom:r,memberName:a}){super();E(this,"name");E(this,"importFrom");E(this,"memberName");this.name=t,this.importFrom=r,this.memberName=a}write(t){this.importFrom!=null&&t.addImport(this);let r=this.importFrom?.type==="star"?`${this.importFrom.starImportAlias}.`:"",a=this.memberName!=null?`.${this.memberName}`:"";t.write(`${r}${this.name}${a}`)}};p();f();d();var Ae=class n extends W{constructor(t){super();E(this,"internalType");this.internalType=t}write(t){let r=Wt(t.customConfig),a=!!t.customConfig?.useBigInt;switch(this.internalType.type){case"array":{this.writeIterable({writer:t,iterable:this.internalType});break}case"blob":{if(r){t.writeNode(n.string(this.internalType.value));return}t.write("new Blob(["),t.writeNode(n.string(this.internalType.value)),t.write("])");break}case"boolean":{t.write(this.internalType.value.toString());break}case"bigint":{if(a){t.write(`BigInt("${this.internalType.value.toString()}")`);return}t.write(`"${this.internalType.value.toString()}"`);return}case"datetime":{if(r){t.writeNode(n.string(this.internalType.value));return}t.write("new Date("),t.writeNode(n.string(this.internalType.value)),t.write(")");break}case"number":{t.write(this.internalType.value.toString());break}case"object":{this.writeObject({writer:t,object:this.internalType});break}case"record":{this.writeRecord({writer:t,record:this.internalType});break}case"reference":{t.writeNode(this.internalType.value);break}case"set":{if(r||this.isSetOfObjects()){t.writeNode(n.array({values:this.internalType.values}));return}t.write("new Set("),this.writeIterable({writer:t,iterable:this.internalType}),t.write(")");break}case"string":{this.internalType.value.includes(`
|
|
21
21
|
`)?this.writeStringWithBackticks({writer:t,value:this.internalType.value}):t.write(`"${this.internalType.value.replaceAll('"','\\"')}"`);break}case"tuple":{this.writeIterable({writer:t,iterable:this.internalType});break}case"unknown":{this.writeUnknown({writer:t,value:this.internalType.value});break}case"null":{t.write("null");break}case"nop":break;default:q(this.internalType)}}isObject(){return this.internalType.type==="object"}asObjectOrThrow(){if(this.isObject())return this.internalType;throw new Error("Internal error; ts.TypeLiteral is not an object")}isSet(){return this.internalType.type==="set"}asSetOrThrow(){if(this.isSet())return this.internalType;throw new Error("Internal error; ts.TypeLiteral is not a set")}isSetOfObjects(){return this.isSet()&&this.asSetOrThrow().values.every(t=>t.isObject())}writeStringWithBackticks({writer:t,value:r}){t.write("`");let a=r.split(`
|
|
22
22
|
`),o=a[0]+`
|
|
23
23
|
`,u=a.slice(1).join(`
|
|
24
|
-
`);t.write(o.replaceAll("`","\\`")),t.writeNoIndent(u.replaceAll("`","\\`")),t.write("`")}writeIterable({writer:t,iterable:r}){let a=bc({values:r.values});if(a.length===0){t.write("[]");return}t.writeLine("["),t.indent();for(let o of a)o.write(t),t.writeLine(",");t.dedent(),t.write("]")}writeRecord({writer:t,record:r}){let a=vc({entries:r.entries});if(a.length===0){t.write("{}");return}t.writeLine("{"),t.indent();for(let o of a)o.key.write(t),t.write(": "),o.value.write(t),t.writeLine(",");t.dedent(),t.write("}")}writeObject({writer:t,object:r}){let a=xc({fields:r.fields});if(a.length===0){t.write("{}");return}t.writeLine("{"),t.indent();for(let o of a)t.write(`${o.name}: `),o.value.write(t),t.writeLine(",");t.dedent(),t.write("}")}static array({values:t}){return new this({type:"array",values:t})}static bigint(t){return new this({type:"bigint",value:t})}static blob(t){return new this({type:"blob",value:t})}static boolean(t){return new this({type:"boolean",value:t})}static datetime(t){return new this({type:"datetime",value:t})}static number(t){return new this({type:"number",value:t})}static object({fields:t}){return new this({type:"object",fields:t})}static record({entries:t}){return new this({type:"record",entries:t})}static reference(t){return new this({type:"reference",value:t})}static set({values:t}){return new this({type:"set",values:t})}static string(t){return new this({type:"string",value:t})}static tuple({values:t}){return new this({type:"tuple",values:t})}static unknown(t){return new this({type:"unknown",value:t})}static null(){return new this({type:"null"})}static nop(){return new this({type:"nop"})}static isNop(t){return t.internalType.type==="nop"}writeUnknown({writer:t,value:r}){switch(typeof r){case"boolean":t.write(r.toString());return;case"string":t.write(r.includes('"')?`\`${r}\``:`"${r}"`);return;case"number":t.write(r.toString());return;case"object":if(r==null){t.write("null");return}if(Array.isArray(r)){this.writeUnknownArray({writer:t,value:r});return}this.writeUnknownObject({writer:t,value:r});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof r}`)}}writeUnknownArray({writer:t,value:r}){if(r.length===0){t.write("[]");return}t.writeLine("["),t.indent();for(let a of r)t.writeNode(n.unknown(a)),t.writeLine(",");t.dedent(),t.write("]")}writeUnknownObject({writer:t,value:r}){let a=Object.entries(r);if(a.length===0){t.write("{}");return}t.writeLine("{"),t.indent();for(let[o,u]of a)t.write(`${o}: `),t.writeNode(n.unknown(u)),t.writeLine(",");t.dedent(),t.write("}")}};function xc({fields:n}){return n.filter(e=>!Ae.isNop(e.value))}function vc({entries:n}){return n.filter(e=>!Ae.isNop(e.key)&&!Ae.isNop(e.value))}function bc({values:n}){return n.filter(e=>!Ae.isNop(e))}p();f();d();var Et=class extends W{constructor(t){super();E(this,"args");this.args=t}write(t){this.args.export&&t.write("export "),this.args.const?t.write("const "):t.write("let "),t.write(`${this.args.name} = `),t.writeNode(this.args.initializer)}};function _c(n){return new bt(n)}function Tc(n){return new wt(n)}function kc(n){return new vt(n)}function Ec(n){return new _t(n)}function Ic(n){return new Tt(n)}function Ac(n){return new kt(n)}function Rc(n){return new it(n)}function Sc(n){return new Et(n)}p();f();d();p();f();d();function Ba({generatorConfig:n,isPackagePrivate:e}){let t=n.output.mode;switch(t.type){case"downloadFiles":return;case"publish":return{packageName:t.registriesV2.npm.packageName,version:t.version,private:e,publishInfo:{registryUrl:t.registriesV2.npm.registryUrl,token:t.registriesV2.npm.token},license:Fa(n.license),repoUrl:void 0};case"github":if(t.publishInfo!=null&&t.publishInfo.type!=="npm")throw new Error(`Expected to receive npm publish info but received ${t.publishInfo.type} instead`);return{packageName:t.publishInfo!=null?t.publishInfo.packageName:"",version:t.version,private:e,publishInfo:void 0,repoUrl:Nc(t.repoUrl),license:Fa(n.license)};default:throw new Error(`Encountered unknown output mode: ${t}`)}}function Nc(n){if(n!=null)return n.startsWith("https://github.com/")?`git+${n}`:n.startsWith("ssh://github.com/")?`github:${qt(n).replace("ssh://github.com/","")}`:n.startsWith("https://bitbucket.org/")?`bitbucket:${qt(n).replace("https://bitbucket.org/","")}`:n.startsWith("ssh://bitbucket.org/")?`bitbucket:${qt(n).replace("ssh://bitbucket.org/","")}`:n.startsWith("https://gitlab.com/")?`gitlab:${qt(n).replace("https://gitlab.com/","")}`:n.startsWith("ssh://gitlab.com/")?`gitlab:${qt(n).replace("ssh://gitlab.com/","")}`:(n.startsWith("git+")||(n=`git+${n}`),n.endsWith(".git")||(n=`${n}.git`),n)}function qt(n){return n.endsWith(".git")?n.slice(0,-4):n}function Fa(n){return n?._visit({basic:e=>e.id,custom:e=>`See ${e.filename}`,_other:()=>{}})}p();f();d();function kr({organization:n,workspaceName:e,namespaceExport:t,naming:r}){return(typeof r=="string"?r:r?.namespace)??t??`${Ue(St(n))}${Ue(St(e))}`}function Er({namespaceExport:n,naming:e}){let t=typeof e=="string"?{}:e,r=e!=null?Ue(St(n)):n;return{namespace:n,client:t?.client??`${r}Client`,error:t?.error??`${r}Error`,timeoutError:t?.timeoutError??`${r}TimeoutError`,environment:t?.environment??`${r}Environment`,environmentUrls:t?.environmentUrls??`${r}EnvironmentUrls`,version:t?.version??`${r}Version`}}p();f();d();p();f();d();var zt={};he(zt,{commons:()=>Oa,dynamic:()=>Sr,generatorExec:()=>Cr});p();f();d();p();f();d();var Oa={};p();f();d();var Sr={};he(Sr,{ErrorSeverity:()=>Va,HttpMethod:()=>$a,ObjectPropertyAccess:()=>Wa,PrimitiveTypeV1:()=>qa,auth:()=>La,commons:()=>Pa,declaration:()=>ja,endpoints:()=>Ma,environment:()=>Ua,http:()=>Ir,ir:()=>Da,snippets:()=>Ar,types:()=>Rr,variables:()=>za});p();f();d();p();f();d();var La={};p();f();d();var Pa={};p();f();d();var ja={};p();f();d();var Ma={};p();f();d();var Ua={};p();f();d();var Ir={};he(Ir,{HttpMethod:()=>$a});p();f();d();p();f();d();var $a={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD"};var Da={};p();f();d();var Ar={};he(Ar,{ErrorSeverity:()=>Va});p();f();d();p();f();d();var Va={Critical:"CRITICAL",Warning:"WARNING"};var Rr={};he(Rr,{ObjectPropertyAccess:()=>Wa,PrimitiveTypeV1:()=>qa});p();f();d();p();f();d();var Wa={ReadOnly:"READ_ONLY",WriteOnly:"WRITE_ONLY"};p();f();d();var qa={Integer:"INTEGER",Long:"LONG",Uint:"UINT",Uint64:"UINT_64",Float:"FLOAT",Double:"DOUBLE",Boolean:"BOOLEAN",String:"STRING",Date:"DATE",DateTime:"DATE_TIME",DateTimeRfc2822:"DATE_TIME_RFC_2822",Uuid:"UUID",Base64:"BASE_64",BigInteger:"BIG_INTEGER"};var za={};p();f();d();var Cr={};he(Cr,{LicenseId:()=>Za,config:()=>Nr});p();f();d();p();f();d();var Nr={};he(Nr,{LicenseId:()=>Za});p();f();d();p();f();d();var Za={Mit:"MIT",Apache2:"Apache-2.0"};var Cc="value",sr=class{constructor({context:e}){E(this,"context");this.context=e}convert(e){let t=e.convertOpts;if(e.value===null)return this.context.isNullable(e.typeReference)?I.TypeLiteral.null():(this.context.errors.add({severity:$.Critical,message:"Expected non-null value, but got null"}),I.TypeLiteral.nop());if(e.value===void 0)return I.TypeLiteral.nop();switch(e.typeReference.type){case"list":return this.convertList({list:e.typeReference.value,value:e.value,convertOpts:t});case"literal":return this.convertLiteral({literalType:e.typeReference.value,value:e.value,convertOpts:t});case"map":return this.convertMap({map:e.typeReference,value:e.value,convertOpts:t});case"named":{let r=this.context.resolveNamedType({typeId:e.typeReference.value});return r==null?I.TypeLiteral.nop():this.convertNamed({named:r,value:e.value,as:e.as,convertOpts:t})}case"optional":return this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as,convertOpts:t});case"nullable":return this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as,convertOpts:t});case"primitive":return this.convertPrimitive({primitive:e.typeReference.value,value:e.value,as:e.as,convertOpts:t});case"set":return this.convertSet({set:e.typeReference.value,value:e.value,convertOpts:t});case"unknown":return this.convertUnknown({value:e.value,convertOpts:t});default:q(e.typeReference)}}convertLiteral({literalType:e,value:t}){switch(e.type){case"boolean":{let r=this.context.getValueAsBoolean({value:t});return r==null?I.TypeLiteral.nop():I.TypeLiteral.boolean(r)}case"string":{let r=this.context.getValueAsString({value:t});return r==null?I.TypeLiteral.nop():I.TypeLiteral.string(r)}default:q(e)}}convertList({list:e,value:t,convertOpts:r}){return Array.isArray(t)?I.TypeLiteral.array({values:t.map((a,o)=>{this.context.errors.scope({index:o});try{return this.convert({typeReference:e,value:a,convertOpts:r})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:$.Critical,message:`Expected array but got: ${typeof t}`}),I.TypeLiteral.nop())}convertSet({set:e,value:t,convertOpts:r}){return Array.isArray(t)?I.TypeLiteral.set({values:t.map((a,o)=>{this.context.errors.scope({index:o});try{return this.convert({typeReference:e,value:a,convertOpts:r})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:$.Critical,message:`Expected array but got: ${typeof t}`}),I.TypeLiteral.nop())}convertMap({map:e,value:t,convertOpts:r}){return typeof t!="object"||t==null?(this.context.errors.add({severity:$.Critical,message:`Expected object but got: ${t==null?"null":typeof t}`}),I.TypeLiteral.nop()):I.TypeLiteral.record({entries:Object.entries(t).map(([a,o])=>{this.context.errors.scope(a);try{return{key:this.convert({typeReference:e.key,value:a,as:"key",convertOpts:r}),value:this.convert({typeReference:e.value,value:o,convertOpts:r})}}finally{this.context.errors.unscope()}})})}convertNamed({named:e,value:t,as:r,convertOpts:a}){switch(e.type){case"alias":return this.context.customConfig?.useBrandedStringAliases?I.TypeLiteral.reference(I.codeblock(o=>{o.writeNode(I.reference({name:this.context.namespaceExport,importFrom:this.context.getModuleImport(),memberName:this.context.getFullyQualifiedReference({declaration:e.declaration})})),o.write("("),o.writeNode(this.convert({typeReference:e.typeReference,value:t,as:r,convertOpts:a})),o.write(")")})):this.convert({typeReference:e.typeReference,value:t,as:r,convertOpts:a});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:e,value:t,convertOpts:a});case"enum":return this.convertEnum({enum_:e,value:t,convertOpts:a});case"object":return this.convertObject({object_:e,value:t,convertOpts:a});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t,convertOpts:a});default:q(e)}}convertDiscriminatedUnion({discriminatedUnion:e,value:t,convertOpts:r}){let a=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:t});if(a==null)return I.TypeLiteral.nop();let o=a.singleDiscriminatedUnionType,u=this.convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:a,unionVariant:o,convertOpts:r});if(u==null)return I.TypeLiteral.nop();if(this.context.customConfig?.includeUtilsOnUnionMembers)return I.TypeLiteral.reference(I.codeblock(x=>{x.writeNode(I.invokeMethod({on:I.reference({name:this.context.namespaceExport,importFrom:this.context.getModuleImport(),memberName:this.context.getFullyQualifiedReference({declaration:e.declaration})}),method:this.context.getMethodName(o.discriminantValue.name),arguments_:this.convertDiscriminatedUnionUtilsArgs({discriminatedUnionTypeInstance:a,unionVariant:o,unionProperties:u,convertOpts:r})}))}));let m={name:this.context.getPropertyName(e.discriminant.name),value:I.TypeLiteral.string(o.discriminantValue.wireValue)};return I.TypeLiteral.object({fields:[m,...u]})}convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:e,unionVariant:t,convertOpts:r}){let a=this.getBaseFields({discriminatedUnionTypeInstance:e,singleDiscriminatedUnionType:t});switch(t.type){case"samePropertiesAsObject":{let o=this.context.resolveNamedType({typeId:t.typeId});if(o==null)return;let u=this.convertNamed({named:o,value:e.value,convertOpts:r});if(!u.isObject()){this.context.errors.add({severity:$.Critical,message:"Internal error; expected union value to be an object"});return}let m=u.asObjectOrThrow();return[...a,...m.fields]}case"singleProperty":try{this.context.errors.scope(t.discriminantValue.wireValue);let o=this.context.getRecord(e.value);return o==null?[...a,{name:Cc,value:this.convert({typeReference:t.typeReference,value:e.value,convertOpts:r})}]:[...a,{name:this.context.getPropertyName(t.discriminantValue.name),value:this.convert({typeReference:t.typeReference,value:o[t.discriminantValue.wireValue],convertOpts:r})}]}finally{this.context.errors.unscope()}case"noProperties":return a;default:q(t)}}convertDiscriminatedUnionUtilsArgs({discriminatedUnionTypeInstance:e,unionVariant:t,unionProperties:r,convertOpts:a}){return t.type==="singleProperty"&&this.context.getRecord(e.value)==null&&r.length===1?[this.convert({typeReference:t.typeReference,value:e.value,convertOpts:a})]:r.length>0?[I.TypeLiteral.object({fields:r})]:[]}getBaseFields({discriminatedUnionTypeInstance:e,singleDiscriminatedUnionType:t,convertOpts:r}){return this.context.associateByWireValue({parameters:t.properties??[],values:this.context.getRecord(e.value)??{},ignoreMissingParameters:!0}).map(o=>{this.context.errors.scope(o.name.wireValue);try{return{name:this.context.getPropertyName(o.name.name),value:this.convert({...o,convertOpts:r})}}finally{this.context.errors.unscope()}})}convertObject({object_:e,value:t,convertOpts:r}){let a=this.context.associateByWireValue({parameters:this.filterReadWriteProperties(e.properties,r),values:this.context.getRecord(t)??{}});return I.TypeLiteral.object({fields:a.map(o=>{this.context.errors.scope(o.name.wireValue);try{return{name:this.context.getPropertyName(o.name.name),value:this.convert({...o,convertOpts:r})}}finally{this.context.errors.unscope()}})})}filterReadWriteProperties(e,t){return this.context.customConfig?.experimentalGenerateReadWriteOnlyTypes!==!0||typeof t>"u"||(t.isForRequest&&(e=e.filter(r=>r.propertyAccess!==zt.dynamic.ObjectPropertyAccess.ReadOnly)),t.isForResponse&&(e=e.filter(r=>r.propertyAccess!==zt.dynamic.ObjectPropertyAccess.WriteOnly))),e}convertEnum({enum_:e,value:t}){let r=this.getEnumValue({enum_:e,value:t});return r==null?I.TypeLiteral.nop():I.TypeLiteral.string(r)}getEnumValue({enum_:e,value:t}){if(typeof t!="string"){this.context.errors.add({severity:$.Critical,message:`Expected enum value string, got: ${typeof t}`});return}if(e.values.find(a=>a.wireValue===t)==null){this.context.errors.add({severity:$.Critical,message:`An enum value named "${t}" does not exist in this context`});return}return t}convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t,convertOpts:r}){let a=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t,convertOpts:r});return a??I.TypeLiteral.nop()}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t,convertOpts:r}){for(let a of e.types){let o=this.context.errors.size();try{let u=this.convert({typeReference:a,value:t,convertOpts:r});if(I.TypeLiteral.isNop(u)||this.context.errors.size()>o){this.context.errors.truncate(o);continue}return u}catch{this.context.errors.truncate(o);continue}}this.context.errors.add({severity:$.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof t}" value`})}convertUnknown({value:e,convertOpts:t}){return I.TypeLiteral.unknown(e)}convertPrimitive({primitive:e,value:t,as:r,convertOpts:a}){switch(e){case"INTEGER":case"UINT":{let o=this.getValueAsNumber({value:t,as:r});return o==null?I.TypeLiteral.nop():I.TypeLiteral.number(o)}case"LONG":case"UINT_64":{let o=this.getValueAsNumber({value:t,as:r});return o==null?I.TypeLiteral.nop():this.context.customConfig?.useBigInt?I.TypeLiteral.bigint(BigInt(o)):I.TypeLiteral.number(o)}case"FLOAT":case"DOUBLE":{let o=this.getValueAsNumber({value:t});return o==null?I.TypeLiteral.nop():I.TypeLiteral.number(o)}case"BOOLEAN":{let o=this.getValueAsBoolean({value:t,as:r});return o==null?I.TypeLiteral.nop():I.TypeLiteral.boolean(o)}case"BASE_64":case"DATE":case"UUID":case"STRING":{let o=this.context.getValueAsString({value:t});return o==null?I.TypeLiteral.nop():I.TypeLiteral.string(o)}case"DATE_TIME":case"DATE_TIME_RFC_2822":{let o=this.context.getValueAsString({value:t});return o==null?I.TypeLiteral.nop():I.TypeLiteral.datetime(o)}case"BIG_INTEGER":{let o=this.context.getValueAsString({value:t});return o==null?I.TypeLiteral.nop():this.context.customConfig?.useBigInt?I.TypeLiteral.bigint(BigInt(o)):I.TypeLiteral.string(o)}default:q(e)}}getValueAsNumber({value:e,as:t}){let r=t==="key"&&typeof e=="string"?Number(e):e;return this.context.getValueAsNumber({value:r})}getValueAsBoolean({value:e,as:t}){let r=t==="key"?typeof e=="string"?e==="true":e==="false"?!1:e:e;return this.context.getValueAsBoolean({value:r})}};p();f();d();var or=class{constructor({context:e}){E(this,"context");this.context=e}getFilePropertyInfo({body:e,value:t}){let r={fileFields:[],bodyPropertyFields:[]},a=this.context.getRecord(t)??{};for(let o of e.properties)switch(o.type){case"file":r.fileFields.push({name:this.context.getPropertyName(o.name),value:this.getSingleFileProperty({property:o,record:a})});break;case"fileArray":r.fileFields.push({name:this.context.getPropertyName(o.name),value:this.getArrayFileProperty({property:o,record:a})});break;case"bodyProperty":r.bodyPropertyFields.push({name:this.context.getPropertyName(o.name.name),value:this.getBodyProperty({property:o,record:a})});break;default:q(o)}return r}getSingleFileProperty({property:e,record:t}){let r=this.context.getSingleFileValue({property:e,record:t});return r==null?I.TypeLiteral.nop():I.TypeLiteral.blob(r)}getArrayFileProperty({property:e,record:t}){let r=this.context.getFileArrayValues({property:e,record:t});return r==null?I.TypeLiteral.nop():I.TypeLiteral.array({values:r.map(a=>I.TypeLiteral.blob(a))})}getBodyProperty({property:e,record:t}){let r=t[e.name.wireValue];return r==null?I.TypeLiteral.nop():this.context.dynamicTypeLiteralMapper.convert({typeReference:e.typeReference,value:r})}};var ur=class n extends Mt{constructor({ir:t,config:r}){super({ir:t,config:r});E(this,"ir");E(this,"customConfig");E(this,"dynamicTypeLiteralMapper");E(this,"filePropertyMapper");E(this,"moduleName");E(this,"namespaceExport");E(this,"resolvedClientName");E(this,"resolvedEnvironmentName");this.ir=t,this.customConfig=r.customConfig!=null?r.customConfig:void 0,this.dynamicTypeLiteralMapper=new sr({context:this}),this.filePropertyMapper=new or({context:this}),this.moduleName=Fc({config:r,customConfig:this.customConfig}),this.namespaceExport=kr({organization:r.organization,workspaceName:r.workspaceName,namespaceExport:this.customConfig?.namespaceExport,naming:this.customConfig?.naming});let a=Er({namespaceExport:this.namespaceExport,naming:this.customConfig?.naming});this.resolvedClientName=a.client,this.resolvedEnvironmentName=a.environment}clone(){return new n({ir:this.ir,config:this.config})}getModuleImport(){return{type:"named",moduleName:this.moduleName}}getRootClientName(){return this.resolvedClientName}getPropertyName(t){return this.customConfig?.retainOriginalCasing||Wt(this.customConfig)?this.formatOriginalPropertyName(t.originalName):t.camelCase.unsafeName}getMethodName(t){return t.camelCase.unsafeName}getTypeName(t){return t.pascalCase.unsafeName}getEnvironmentTypeReferenceFromID(t){let r=this.resolveEnvironmentName(t);if(r!=null)return this.getEnvironmentsTypeReference(r)}getFullyQualifiedReference({declaration:t}){return t.fernFilepath.allParts.length>0?`${t.fernFilepath.allParts.map(r=>r.camelCase.unsafeName).join(".")}.${this.getTypeName(t.name)}`:`${this.getTypeName(t.name)}`}getEnvironmentsTypeReference(t){return I.reference({name:this.resolvedEnvironmentName,importFrom:this.getModuleImport(),memberName:this.getTypeName(t)})}formatOriginalPropertyName(t){return t.includes("-")?`"${t}"`:t}};function Fc({config:n,customConfig:e}){return Ba({generatorConfig:n,isPackagePrivate:e?.private??!1})?.packageName??n.organization}p();f();d();var Ga="client",Ha="main",Bc={type:"primitive",value:"STRING"},cr=class{constructor({context:e}){E(this,"context");this.context=e}async generateSnippet({endpoint:e,request:t}){return await this.buildCodeBlock({endpoint:e,snippet:t}).toStringAsync({customConfig:this.context.customConfig})}generateSnippetSync({endpoint:e,request:t}){return this.buildCodeBlock({endpoint:e,snippet:t}).toString({customConfig:this.context.customConfig})}async generateSnippetAst({endpoint:e,request:t}){return this.buildCodeBlock({endpoint:e,snippet:t})}buildCodeBlock({endpoint:e,snippet:t}){return I.codeblock(r=>{r.writeNode(I.function_({name:Ha,async:!0,parameters:[],body:I.codeblock(a=>{a.writeNodeStatement(this.constructClient({endpoint:e,snippet:t})),a.writeNodeStatement(this.callMethod({endpoint:e,snippet:t}))})})),r.writeNodeStatement(I.invokeFunction({function_:I.reference({name:Ha}),arguments_:[]}))})}constructClient({endpoint:e,snippet:t}){return I.variable({name:Ga,const:!0,initializer:I.instantiateClass({class_:I.reference({name:this.context.getRootClientName(),importFrom:this.context.getModuleImport()}),arguments_:[this.getConstructorArgs({endpoint:e,snippet:t})]})})}getConstructorArgs({endpoint:e,snippet:t}){let r=[],a=this.getConstructorEnvironmentArgs({baseUrl:t.baseURL,environment:t.environment});return a.length>0&&r.push(...a),e.auth!=null&&(t.auth!=null?r.push(...this.getConstructorAuthArgs({auth:e.auth,values:t.auth})):this.context.errors.add({severity:$.Warning,message:`Auth with ${e.auth.type} configuration is required for this endpoint`})),this.context.errors.scope(de.PathParameters),this.context.ir.pathParameters!=null&&r.push(...this.getPathParameters({namedParameters:this.context.ir.pathParameters,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(de.Headers),this.context.ir.headers!=null&&t.headers!=null&&r.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:t.headers})),this.context.errors.unscope(),r.length===0?I.TypeLiteral.nop():I.TypeLiteral.object({fields:r})}getConstructorEnvironmentArgs({baseUrl:e,environment:t}){let r=this.getEnvironmentValue({baseUrl:e,environment:t});return r==null?[]:[{name:"environment",value:r}]}getEnvironmentValue({baseUrl:e,environment:t}){if(e!=null&&t!=null){this.context.errors.add({severity:$.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(e!=null)return I.TypeLiteral.string(e);if(t!=null){if(this.context.isSingleEnvironmentID(t)){let r=this.context.getEnvironmentTypeReferenceFromID(t);if(r==null){this.context.errors.add({severity:$.Warning,message:`Environment ${JSON.stringify(t)} was not found`});return}return I.TypeLiteral.reference(r)}if(this.context.isMultiEnvironmentValues(t))return this.context.validateMultiEnvironmentUrlValues(t)?I.TypeLiteral.object({fields:Object.entries(t).map(([r,a])=>({name:r,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:Bc,value:a})}))}):void 0}}getConstructorAuthArgs({auth:e,values:t}){switch(e.type){case"basic":return t.type!=="basic"?(this.addAuthMismatchError(e,t),[]):this.getConstructorBasicAuthArg({auth:e,values:t});case"bearer":return t.type!=="bearer"?(this.addAuthMismatchError(e,t),[]):this.getConstructorBearerAuthArgs({auth:e,values:t});case"header":return t.type!=="header"?(this.addAuthMismatchError(e,t),[]):this.getConstructorHeaderAuthArgs({auth:e,values:t});case"oauth":return t.type!=="oauth"?(this.addAuthMismatchError(e,t),[]):this.getConstructorOAuthArgs({auth:e,values:t});case"inferred":return t.type!=="inferred"?(this.addAuthMismatchError(e,t),[]):(this.addWarning("The TypeScript SDK v2 Generator does not support Inferred auth scheme yet"),[]);default:q(e)}}addAuthMismatchError(e,t){this.context.errors.add({severity:$.Critical,message:this.context.newAuthMismatchError({auth:e,values:t}).message})}addWarning(e){this.context.errors.add({severity:$.Warning,message:e})}getConstructorBasicAuthArg({auth:e,values:t}){return[{name:this.context.getPropertyName(e.username),value:I.TypeLiteral.string(t.username)},{name:this.context.getPropertyName(e.password),value:I.TypeLiteral.string(t.password)}]}getConstructorBearerAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.token),value:I.TypeLiteral.string(t.token)}]}getConstructorHeaderAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.header.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:e.header.typeReference,value:t.value})}]}getConstructorOAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.clientId),value:I.TypeLiteral.string(t.clientId)},{name:this.context.getPropertyName(e.clientSecret),value:I.TypeLiteral.string(t.clientSecret)}]}getConstructorHeaderArgs({headers:e,values:t}){let r=[];for(let a of e){let o=t[a.name.wireValue],u=this.getConstructorHeaderArg({header:a,value:o});u!=null&&r.push(u)}return r}getConstructorHeaderArg({header:e,value:t}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:e.typeReference,value:t});if(!I.TypeLiteral.isNop(r))return{name:this.context.getPropertyName(e.name.name),value:r}}callMethod({endpoint:e,snippet:t}){return I.invokeMethod({on:I.reference({name:Ga}),method:this.getMethod({endpoint:e}),async:!0,arguments_:this.getMethodArgs({endpoint:e,snippet:t})})}getMethodArgs({endpoint:e,snippet:t}){switch(e.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:e.request,snippet:t});case"body":return this.getMethodArgsForBodyRequest({request:e.request,snippet:t});default:q(e.request)}}getMethodArgsForBodyRequest({request:e,snippet:t}){let r=[];this.context.errors.scope(de.PathParameters);let a=[...this.context.ir.pathParameters??[],...e.pathParameters??[]];return a.length>0&&r.push(...this.getPathParameters({namedParameters:a,snippet:t}).map(o=>o.value)),this.context.errors.unscope(),this.context.errors.scope(de.RequestBody),e.body!=null&&r.push(this.getBodyRequestArg({body:e.body,value:t.requestBody})),this.context.errors.unscope(),r}getBodyRequestArg({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t,convertOpts:{isForRequest:!0}});default:q(e)}}getBytesBodyRequestArg({value:e}){return typeof e!="string"?(this.context.errors.add({severity:$.Critical,message:`Expected bytes value to be a string, got ${typeof e}`}),I.TypeLiteral.nop()):I.TypeLiteral.blob(e)}getMethodArgsForInlinedRequest({request:e,snippet:t}){let r=[],{inlinePathParameters:a,inlineFileProperties:o}={inlinePathParameters:this.context.customConfig?.inlinePathParameters??!0,inlineFileProperties:this.context.customConfig?.inlineFileProperties??!0};this.context.errors.scope(de.PathParameters);let u=[];e.pathParameters!=null&&u.push(...this.getPathParameters({namedParameters:e.pathParameters,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(de.RequestBody);let m=this.getFilePropertyInfo({request:e,snippet:t});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:a})||r.push(...u.map(x=>x.value)),o||r.push(...m.fileFields.map(x=>x.value)),this.context.needsRequestParameter({request:e,inlinePathParameters:a,inlineFileProperties:o})&&r.push(this.getInlinedRequestArg({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:a})?u:[],filePropertyInfo:m})),r}getFilePropertyInfo({request:e,snippet:t}){return e.body==null||!this.context.isFileUploadRequestBody(e.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:e.body,value:t.requestBody})}getInlinedRequestArg({request:e,snippet:t,pathParameterFields:r,filePropertyInfo:a}){this.context.errors.scope(de.QueryParameters);let u=this.context.associateQueryParametersByWireValue({parameters:e.queryParameters??[],values:t.queryParameters??{}}).map(R=>({name:this.context.getPropertyName(R.name.name),value:this.context.dynamicTypeLiteralMapper.convert({...R,convertOpts:{isForRequest:!0}})}));this.context.errors.unscope(),this.context.errors.scope(de.Headers);let x=this.context.associateByWireValue({parameters:e.headers??[],values:t.headers??{}}).map(R=>({name:this.context.getPropertyName(R.name.name),value:this.context.dynamicTypeLiteralMapper.convert({...R,convertOpts:{isForRequest:!0}})}));this.context.errors.unscope(),this.context.errors.scope(de.RequestBody);let k=e.body!=null?this.getInlinedRequestBodyObjectFields({body:e.body,value:t.requestBody,filePropertyInfo:a}):[];return this.context.errors.unscope(),I.TypeLiteral.object({fields:[...r,...u,...x,...k]})}getInlinedRequestBodyObjectFields({body:e,value:t,filePropertyInfo:r}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyObjectFields({parameters:e.value,value:t});case"referenced":return[this.getReferencedRequestBodyPropertyObjectField({body:e,value:t})];case"fileUpload":return this.getFileUploadRequestBodyObjectFields({filePropertyInfo:r});default:q(e)}}getFileUploadRequestBodyObjectFields({filePropertyInfo:e}){return this.context.customConfig?.inlineFileProperties??!0?[...e.fileFields,...e.bodyPropertyFields]:e.bodyPropertyFields}getReferencedRequestBodyPropertyObjectField({body:e,value:t}){return{name:this.context.getPropertyName(e.bodyKey),value:this.getReferencedRequestBodyPropertyTypeLiteral({body:e.bodyType,value:t})}}getReferencedRequestBodyPropertyTypeLiteral({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t,convertOpts:{isForRequest:!0}});default:q(e)}}getInlinedRequestBodyPropertyObjectFields({parameters:e,value:t}){let r=[],a=this.context.associateByWireValue({parameters:e,values:this.context.getRecord(t)??{}});for(let o of a)r.push({name:this.context.getPropertyName(o.name.name),value:this.context.dynamicTypeLiteralMapper.convert({...o,convertOpts:{isForRequest:!0}})});return r}getPathParameters({namedParameters:e,snippet:t}){let r=[],a=this.context.associateByWireValue({parameters:e,values:t.pathParameters??{},ignoreMissingParameters:!0});for(let o of a)r.push({name:this.context.getPropertyName(o.name.name),value:this.context.dynamicTypeLiteralMapper.convert({...o,convertOpts:{isForRequest:!0}})});return r}getMethod({endpoint:e}){return e.declaration.fernFilepath.allParts.length>0?`${e.declaration.fernFilepath.allParts.map(t=>this.context.getMethodName(t)).join(".")}.${this.context.getMethodName(e.declaration.name)}`:this.context.getMethodName(e.declaration.name)}};var Fr=class extends Lt{constructor({ir:e,config:t}){super(new ur({ir:e,config:t}))}async generate(e,t={}){return super.generate(e,t)}generateSync(e){return super.generateSync(e)}async generateSnippetAst(e){return super.generateSnippetAst(e)}createSnippetGenerator(e){return new cr({context:e})}};export{Fr as DynamicSnippetsGenerator};
|
|
24
|
+
`);t.write(o.replaceAll("`","\\`")),t.writeNoIndent(u.replaceAll("`","\\`")),t.write("`")}writeIterable({writer:t,iterable:r}){let a=wc({values:r.values});if(a.length===0){t.write("[]");return}t.writeLine("["),t.indent();for(let o of a)o.write(t),t.writeLine(",");t.dedent(),t.write("]")}writeRecord({writer:t,record:r}){let a=bc({entries:r.entries});if(a.length===0){t.write("{}");return}t.writeLine("{"),t.indent();for(let o of a)this.writeObjectKey({writer:t,key:o.key}),t.write(": "),o.value.write(t),t.writeLine(",");t.dedent(),t.write("}")}writeObjectKey({writer:t,key:r}){let a=r.internalType;if(a.type==="string"&&Fa(a.value)){t.write(a.value);return}r.write(t)}writeObject({writer:t,object:r}){let a=vc({fields:r.fields});if(a.length===0){t.write("{}");return}t.writeLine("{"),t.indent();for(let o of a)t.write(`${o.name}: `),o.value.write(t),t.writeLine(",");t.dedent(),t.write("}")}static array({values:t}){return new this({type:"array",values:t})}static bigint(t){return new this({type:"bigint",value:t})}static blob(t){return new this({type:"blob",value:t})}static boolean(t){return new this({type:"boolean",value:t})}static datetime(t){return new this({type:"datetime",value:t})}static number(t){return new this({type:"number",value:t})}static object({fields:t}){return new this({type:"object",fields:t})}static record({entries:t}){return new this({type:"record",entries:t})}static reference(t){return new this({type:"reference",value:t})}static set({values:t}){return new this({type:"set",values:t})}static string(t){return new this({type:"string",value:t})}static tuple({values:t}){return new this({type:"tuple",values:t})}static unknown(t){return new this({type:"unknown",value:t})}static null(){return new this({type:"null"})}static nop(){return new this({type:"nop"})}static isNop(t){return t.internalType.type==="nop"}writeUnknown({writer:t,value:r}){switch(typeof r){case"boolean":t.write(r.toString());return;case"string":t.write(r.includes('"')?`\`${r}\``:`"${r}"`);return;case"number":t.write(r.toString());return;case"object":if(r==null){t.write("null");return}if(Array.isArray(r)){this.writeUnknownArray({writer:t,value:r});return}this.writeUnknownObject({writer:t,value:r});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof r}`)}}writeUnknownArray({writer:t,value:r}){if(r.length===0){t.write("[]");return}t.writeLine("["),t.indent();for(let a of r)t.writeNode(n.unknown(a)),t.writeLine(",");t.dedent(),t.write("]")}writeUnknownObject({writer:t,value:r}){let a=Object.entries(r);if(a.length===0){t.write("{}");return}t.writeLine("{"),t.indent();for(let[o,u]of a)Fa(o)?t.write(`${o}: `):(t.writeNode(n.string(o)),t.write(": ")),t.writeNode(n.unknown(u)),t.writeLine(",");t.dedent(),t.write("}")}};function Fa(n){return/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(n)}function vc({fields:n}){return n.filter(e=>!Ae.isNop(e.value))}function bc({entries:n}){return n.filter(e=>!Ae.isNop(e.key)&&!Ae.isNop(e.value))}function wc({values:n}){return n.filter(e=>!Ae.isNop(e))}p();f();d();var Et=class extends W{constructor(t){super();E(this,"args");this.args=t}write(t){this.args.export&&t.write("export "),this.args.const?t.write("const "):t.write("let "),t.write(`${this.args.name} = `),t.writeNode(this.args.initializer)}};function Tc(n){return new bt(n)}function kc(n){return new wt(n)}function Ec(n){return new vt(n)}function Ic(n){return new _t(n)}function Ac(n){return new Tt(n)}function Rc(n){return new kt(n)}function Sc(n){return new it(n)}function Nc(n){return new Et(n)}p();f();d();p();f();d();function Oa({generatorConfig:n,isPackagePrivate:e}){let t=n.output.mode;switch(t.type){case"downloadFiles":return;case"publish":return{packageName:t.registriesV2.npm.packageName,version:t.version,private:e,publishInfo:{registryUrl:t.registriesV2.npm.registryUrl,token:t.registriesV2.npm.token},license:Ba(n.license),repoUrl:void 0};case"github":if(t.publishInfo!=null&&t.publishInfo.type!=="npm")throw new Error(`Expected to receive npm publish info but received ${t.publishInfo.type} instead`);return{packageName:t.publishInfo!=null?t.publishInfo.packageName:"",version:t.version,private:e,publishInfo:void 0,repoUrl:Cc(t.repoUrl),license:Ba(n.license)};default:throw new Error(`Encountered unknown output mode: ${t}`)}}function Cc(n){if(n!=null)return n.startsWith("https://github.com/")?`git+${n}`:n.startsWith("ssh://github.com/")?`github:${qt(n).replace("ssh://github.com/","")}`:n.startsWith("https://bitbucket.org/")?`bitbucket:${qt(n).replace("https://bitbucket.org/","")}`:n.startsWith("ssh://bitbucket.org/")?`bitbucket:${qt(n).replace("ssh://bitbucket.org/","")}`:n.startsWith("https://gitlab.com/")?`gitlab:${qt(n).replace("https://gitlab.com/","")}`:n.startsWith("ssh://gitlab.com/")?`gitlab:${qt(n).replace("ssh://gitlab.com/","")}`:(n.startsWith("git+")||(n=`git+${n}`),n.endsWith(".git")||(n=`${n}.git`),n)}function qt(n){return n.endsWith(".git")?n.slice(0,-4):n}function Ba(n){return n?._visit({basic:e=>e.id,custom:e=>`See ${e.filename}`,_other:()=>{}})}p();f();d();function kr({organization:n,workspaceName:e,namespaceExport:t,naming:r}){return(typeof r=="string"?r:r?.namespace)??t??`${Ue(St(n))}${Ue(St(e))}`}function Er({namespaceExport:n,naming:e}){let t=typeof e=="string"?{}:e,r=e!=null?Ue(St(n)):n;return{namespace:n,client:t?.client??`${r}Client`,error:t?.error??`${r}Error`,timeoutError:t?.timeoutError??`${r}TimeoutError`,environment:t?.environment??`${r}Environment`,environmentUrls:t?.environmentUrls??`${r}EnvironmentUrls`,version:t?.version??`${r}Version`}}p();f();d();p();f();d();var zt={};he(zt,{commons:()=>La,dynamic:()=>Sr,generatorExec:()=>Cr});p();f();d();p();f();d();var La={};p();f();d();var Sr={};he(Sr,{ErrorSeverity:()=>Wa,HttpMethod:()=>Da,ObjectPropertyAccess:()=>qa,PrimitiveTypeV1:()=>za,auth:()=>Pa,commons:()=>ja,declaration:()=>Ma,endpoints:()=>Ua,environment:()=>$a,http:()=>Ir,ir:()=>Va,snippets:()=>Ar,types:()=>Rr,variables:()=>Za});p();f();d();p();f();d();var Pa={};p();f();d();var ja={};p();f();d();var Ma={};p();f();d();var Ua={};p();f();d();var $a={};p();f();d();var Ir={};he(Ir,{HttpMethod:()=>Da});p();f();d();p();f();d();var Da={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD"};var Va={};p();f();d();var Ar={};he(Ar,{ErrorSeverity:()=>Wa});p();f();d();p();f();d();var Wa={Critical:"CRITICAL",Warning:"WARNING"};var Rr={};he(Rr,{ObjectPropertyAccess:()=>qa,PrimitiveTypeV1:()=>za});p();f();d();p();f();d();var qa={ReadOnly:"READ_ONLY",WriteOnly:"WRITE_ONLY"};p();f();d();var za={Integer:"INTEGER",Long:"LONG",Uint:"UINT",Uint64:"UINT_64",Float:"FLOAT",Double:"DOUBLE",Boolean:"BOOLEAN",String:"STRING",Date:"DATE",DateTime:"DATE_TIME",DateTimeRfc2822:"DATE_TIME_RFC_2822",Uuid:"UUID",Base64:"BASE_64",BigInteger:"BIG_INTEGER"};var Za={};p();f();d();var Cr={};he(Cr,{LicenseId:()=>Ga,config:()=>Nr});p();f();d();p();f();d();var Nr={};he(Nr,{LicenseId:()=>Ga});p();f();d();p();f();d();var Ga={Mit:"MIT",Apache2:"Apache-2.0"};var Fc="value",sr=class{constructor({context:e}){E(this,"context");this.context=e}convert(e){let t=e.convertOpts;if(e.value===null)return this.context.isNullable(e.typeReference)?I.TypeLiteral.null():(this.context.errors.add({severity:$.Critical,message:"Expected non-null value, but got null"}),I.TypeLiteral.nop());if(e.value===void 0)return I.TypeLiteral.nop();switch(e.typeReference.type){case"list":return this.convertList({list:e.typeReference.value,value:e.value,convertOpts:t});case"literal":return this.convertLiteral({literalType:e.typeReference.value,value:e.value,convertOpts:t});case"map":return this.convertMap({map:e.typeReference,value:e.value,convertOpts:t});case"named":{let r=this.context.resolveNamedType({typeId:e.typeReference.value});return r==null?I.TypeLiteral.nop():this.convertNamed({named:r,value:e.value,as:e.as,convertOpts:t})}case"optional":return this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as,convertOpts:t});case"nullable":return this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as,convertOpts:t});case"primitive":return this.convertPrimitive({primitive:e.typeReference.value,value:e.value,as:e.as,convertOpts:t});case"set":return this.convertSet({set:e.typeReference.value,value:e.value,convertOpts:t});case"unknown":return this.convertUnknown({value:e.value,convertOpts:t});default:q(e.typeReference)}}convertLiteral({literalType:e,value:t}){switch(e.type){case"boolean":{let r=this.context.getValueAsBoolean({value:t});return r==null?I.TypeLiteral.nop():I.TypeLiteral.boolean(r)}case"string":{let r=this.context.getValueAsString({value:t});return r==null?I.TypeLiteral.nop():I.TypeLiteral.string(r)}default:q(e)}}convertList({list:e,value:t,convertOpts:r}){return Array.isArray(t)?I.TypeLiteral.array({values:t.map((a,o)=>{this.context.errors.scope({index:o});try{return this.convert({typeReference:e,value:a,convertOpts:r})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:$.Critical,message:`Expected array but got: ${typeof t}`}),I.TypeLiteral.nop())}convertSet({set:e,value:t,convertOpts:r}){return Array.isArray(t)?I.TypeLiteral.set({values:t.map((a,o)=>{this.context.errors.scope({index:o});try{return this.convert({typeReference:e,value:a,convertOpts:r})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:$.Critical,message:`Expected array but got: ${typeof t}`}),I.TypeLiteral.nop())}convertMap({map:e,value:t,convertOpts:r}){return typeof t!="object"||t==null?(this.context.errors.add({severity:$.Critical,message:`Expected object but got: ${t==null?"null":typeof t}`}),I.TypeLiteral.nop()):I.TypeLiteral.record({entries:Object.entries(t).map(([a,o])=>{this.context.errors.scope(a);try{return{key:this.convert({typeReference:e.key,value:a,as:"key",convertOpts:r}),value:this.convert({typeReference:e.value,value:o,convertOpts:r})}}finally{this.context.errors.unscope()}})})}convertNamed({named:e,value:t,as:r,convertOpts:a}){switch(e.type){case"alias":return this.context.customConfig?.useBrandedStringAliases?I.TypeLiteral.reference(I.codeblock(o=>{o.writeNode(I.reference({name:this.context.namespaceExport,importFrom:this.context.getModuleImport(),memberName:this.context.getFullyQualifiedReference({declaration:e.declaration})})),o.write("("),o.writeNode(this.convert({typeReference:e.typeReference,value:t,as:r,convertOpts:a})),o.write(")")})):this.convert({typeReference:e.typeReference,value:t,as:r,convertOpts:a});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:e,value:t,convertOpts:a});case"enum":return this.convertEnum({enum_:e,value:t,convertOpts:a});case"object":return this.convertObject({object_:e,value:t,convertOpts:a});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t,convertOpts:a});default:q(e)}}convertDiscriminatedUnion({discriminatedUnion:e,value:t,convertOpts:r}){let a=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:t});if(a==null)return I.TypeLiteral.nop();let o=a.singleDiscriminatedUnionType,u=this.convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:a,unionVariant:o,convertOpts:r});if(u==null)return I.TypeLiteral.nop();if(this.context.customConfig?.includeUtilsOnUnionMembers)return I.TypeLiteral.reference(I.codeblock(x=>{x.writeNode(I.invokeMethod({on:I.reference({name:this.context.namespaceExport,importFrom:this.context.getModuleImport(),memberName:this.context.getFullyQualifiedReference({declaration:e.declaration})}),method:this.context.getMethodName(o.discriminantValue.name),arguments_:this.convertDiscriminatedUnionUtilsArgs({discriminatedUnionTypeInstance:a,unionVariant:o,unionProperties:u,convertOpts:r})}))}));let m={name:this.context.getPropertyName(e.discriminant.name),value:I.TypeLiteral.string(o.discriminantValue.wireValue)};return I.TypeLiteral.object({fields:[m,...u]})}convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:e,unionVariant:t,convertOpts:r}){let a=this.getBaseFields({discriminatedUnionTypeInstance:e,singleDiscriminatedUnionType:t});switch(t.type){case"samePropertiesAsObject":{let o=this.context.resolveNamedType({typeId:t.typeId});if(o==null)return;let u=this.convertNamed({named:o,value:e.value,convertOpts:r});if(!u.isObject()){this.context.errors.add({severity:$.Critical,message:"Internal error; expected union value to be an object"});return}let m=u.asObjectOrThrow();return[...a,...m.fields]}case"singleProperty":try{this.context.errors.scope(t.discriminantValue.wireValue);let o=this.context.getRecord(e.value);return o==null?[...a,{name:Fc,value:this.convert({typeReference:t.typeReference,value:e.value,convertOpts:r})}]:[...a,{name:this.context.getPropertyName(t.discriminantValue.name),value:this.convert({typeReference:t.typeReference,value:o[t.discriminantValue.wireValue],convertOpts:r})}]}finally{this.context.errors.unscope()}case"noProperties":return a;default:q(t)}}convertDiscriminatedUnionUtilsArgs({discriminatedUnionTypeInstance:e,unionVariant:t,unionProperties:r,convertOpts:a}){return t.type==="singleProperty"&&this.context.getRecord(e.value)==null&&r.length===1?[this.convert({typeReference:t.typeReference,value:e.value,convertOpts:a})]:r.length>0?[I.TypeLiteral.object({fields:r})]:[]}getBaseFields({discriminatedUnionTypeInstance:e,singleDiscriminatedUnionType:t,convertOpts:r}){return this.context.associateByWireValue({parameters:t.properties??[],values:this.context.getRecord(e.value)??{},ignoreMissingParameters:!0}).map(o=>{this.context.errors.scope(o.name.wireValue);try{return{name:this.context.getPropertyName(o.name.name),value:this.convert({...o,convertOpts:r})}}finally{this.context.errors.unscope()}})}convertObject({object_:e,value:t,convertOpts:r}){let a=this.context.associateByWireValue({parameters:this.filterReadWriteProperties(e.properties,r),values:this.context.getRecord(t)??{}});return I.TypeLiteral.object({fields:a.map(o=>{this.context.errors.scope(o.name.wireValue);try{return{name:this.context.getPropertyName(o.name.name),value:this.convert({...o,convertOpts:r})}}finally{this.context.errors.unscope()}})})}filterReadWriteProperties(e,t){return this.context.customConfig?.experimentalGenerateReadWriteOnlyTypes!==!0||typeof t>"u"||(t.isForRequest&&(e=e.filter(r=>r.propertyAccess!==zt.dynamic.ObjectPropertyAccess.ReadOnly)),t.isForResponse&&(e=e.filter(r=>r.propertyAccess!==zt.dynamic.ObjectPropertyAccess.WriteOnly))),e}convertEnum({enum_:e,value:t}){let r=this.getEnumValue({enum_:e,value:t});return r==null?I.TypeLiteral.nop():I.TypeLiteral.string(r)}getEnumValue({enum_:e,value:t}){if(typeof t!="string"){this.context.errors.add({severity:$.Critical,message:`Expected enum value string, got: ${typeof t}`});return}if(e.values.find(a=>a.wireValue===t)==null){this.context.errors.add({severity:$.Critical,message:`An enum value named "${t}" does not exist in this context`});return}return t}convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t,convertOpts:r}){let a=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t,convertOpts:r});return a??I.TypeLiteral.nop()}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t,convertOpts:r}){for(let a of e.types){let o=this.context.errors.size();try{let u=this.convert({typeReference:a,value:t,convertOpts:r});if(I.TypeLiteral.isNop(u)||this.context.errors.size()>o){this.context.errors.truncate(o);continue}return u}catch{this.context.errors.truncate(o);continue}}this.context.errors.add({severity:$.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof t}" value`})}convertUnknown({value:e,convertOpts:t}){return I.TypeLiteral.unknown(e)}convertPrimitive({primitive:e,value:t,as:r,convertOpts:a}){switch(e){case"INTEGER":case"UINT":{let o=this.getValueAsNumber({value:t,as:r});return o==null?I.TypeLiteral.nop():I.TypeLiteral.number(o)}case"LONG":case"UINT_64":{let o=this.getValueAsNumber({value:t,as:r});return o==null?I.TypeLiteral.nop():this.context.customConfig?.useBigInt?I.TypeLiteral.bigint(BigInt(o)):I.TypeLiteral.number(o)}case"FLOAT":case"DOUBLE":{let o=this.getValueAsNumber({value:t});return o==null?I.TypeLiteral.nop():I.TypeLiteral.number(o)}case"BOOLEAN":{let o=this.getValueAsBoolean({value:t,as:r});return o==null?I.TypeLiteral.nop():I.TypeLiteral.boolean(o)}case"BASE_64":case"DATE":case"UUID":case"STRING":{let o=this.context.getValueAsString({value:t});return o==null?I.TypeLiteral.nop():I.TypeLiteral.string(o)}case"DATE_TIME":case"DATE_TIME_RFC_2822":{let o=this.context.getValueAsString({value:t});return o==null?I.TypeLiteral.nop():I.TypeLiteral.datetime(o)}case"BIG_INTEGER":{let o=this.context.getValueAsString({value:t});return o==null?I.TypeLiteral.nop():this.context.customConfig?.useBigInt?I.TypeLiteral.bigint(BigInt(o)):I.TypeLiteral.string(o)}default:q(e)}}getValueAsNumber({value:e,as:t}){let r=t==="key"&&typeof e=="string"?Number(e):e;return this.context.getValueAsNumber({value:r})}getValueAsBoolean({value:e,as:t}){let r=t==="key"?typeof e=="string"?e==="true":e==="false"?!1:e:e;return this.context.getValueAsBoolean({value:r})}};p();f();d();var or=class{constructor({context:e}){E(this,"context");this.context=e}getFilePropertyInfo({body:e,value:t}){let r={fileFields:[],bodyPropertyFields:[]},a=this.context.getRecord(t)??{};for(let o of e.properties)switch(o.type){case"file":r.fileFields.push({name:this.context.getPropertyName(o.name),value:this.getSingleFileProperty({property:o,record:a})});break;case"fileArray":r.fileFields.push({name:this.context.getPropertyName(o.name),value:this.getArrayFileProperty({property:o,record:a})});break;case"bodyProperty":r.bodyPropertyFields.push({name:this.context.getPropertyName(o.name.name),value:this.getBodyProperty({property:o,record:a})});break;default:q(o)}return r}getSingleFileProperty({property:e,record:t}){let r=this.context.getSingleFileValue({property:e,record:t});return r==null?I.TypeLiteral.nop():I.TypeLiteral.blob(r)}getArrayFileProperty({property:e,record:t}){let r=this.context.getFileArrayValues({property:e,record:t});return r==null?I.TypeLiteral.nop():I.TypeLiteral.array({values:r.map(a=>I.TypeLiteral.blob(a))})}getBodyProperty({property:e,record:t}){let r=t[e.name.wireValue];return r==null?I.TypeLiteral.nop():this.context.dynamicTypeLiteralMapper.convert({typeReference:e.typeReference,value:r})}};var ur=class n extends Mt{constructor({ir:t,config:r}){super({ir:t,config:r});E(this,"ir");E(this,"customConfig");E(this,"dynamicTypeLiteralMapper");E(this,"filePropertyMapper");E(this,"moduleName");E(this,"namespaceExport");E(this,"resolvedClientName");E(this,"resolvedEnvironmentName");this.ir=t,this.customConfig=r.customConfig!=null?r.customConfig:void 0,this.dynamicTypeLiteralMapper=new sr({context:this}),this.filePropertyMapper=new or({context:this}),this.moduleName=Bc({config:r,customConfig:this.customConfig}),this.namespaceExport=kr({organization:r.organization,workspaceName:r.workspaceName,namespaceExport:this.customConfig?.namespaceExport,naming:this.customConfig?.naming});let a=Er({namespaceExport:this.namespaceExport,naming:this.customConfig?.naming});this.resolvedClientName=a.client,this.resolvedEnvironmentName=a.environment}clone(){return new n({ir:this.ir,config:this.config})}getModuleImport(){return{type:"named",moduleName:this.moduleName}}getRootClientName(){return this.resolvedClientName}getPropertyName(t){return this.customConfig?.retainOriginalCasing||Wt(this.customConfig)?this.formatOriginalPropertyName(t.originalName):t.camelCase.unsafeName}getMethodName(t){return t.camelCase.unsafeName}getTypeName(t){return t.pascalCase.unsafeName}getEnvironmentTypeReferenceFromID(t){let r=this.resolveEnvironmentName(t);if(r!=null)return this.getEnvironmentsTypeReference(r)}getFullyQualifiedReference({declaration:t}){return t.fernFilepath.allParts.length>0?`${t.fernFilepath.allParts.map(r=>r.camelCase.unsafeName).join(".")}.${this.getTypeName(t.name)}`:`${this.getTypeName(t.name)}`}getEnvironmentsTypeReference(t){return I.reference({name:this.resolvedEnvironmentName,importFrom:this.getModuleImport(),memberName:this.getTypeName(t)})}formatOriginalPropertyName(t){return t.includes("-")?`"${t}"`:t}};function Bc({config:n,customConfig:e}){return Oa({generatorConfig:n,isPackagePrivate:e?.private??!1})?.packageName??n.organization}p();f();d();var Ha="client",Ja="main",Oc={type:"primitive",value:"STRING"},cr=class{constructor({context:e}){E(this,"context");this.context=e}async generateSnippet({endpoint:e,request:t}){return await this.buildCodeBlock({endpoint:e,snippet:t}).toStringAsync({customConfig:this.context.customConfig})}generateSnippetSync({endpoint:e,request:t}){return this.buildCodeBlock({endpoint:e,snippet:t}).toString({customConfig:this.context.customConfig})}async generateSnippetAst({endpoint:e,request:t}){return this.buildCodeBlock({endpoint:e,snippet:t})}buildCodeBlock({endpoint:e,snippet:t}){return I.codeblock(r=>{r.writeNode(I.function_({name:Ja,async:!0,parameters:[],body:I.codeblock(a=>{a.writeNodeStatement(this.constructClient({endpoint:e,snippet:t})),a.writeNodeStatement(this.callMethod({endpoint:e,snippet:t}))})})),r.writeNodeStatement(I.invokeFunction({function_:I.reference({name:Ja}),arguments_:[]}))})}constructClient({endpoint:e,snippet:t}){return I.variable({name:Ha,const:!0,initializer:I.instantiateClass({class_:I.reference({name:this.context.getRootClientName(),importFrom:this.context.getModuleImport()}),arguments_:[this.getConstructorArgs({endpoint:e,snippet:t})]})})}getConstructorArgs({endpoint:e,snippet:t}){let r=[],a=this.getConstructorEnvironmentArgs({baseUrl:t.baseURL,environment:t.environment});return a.length>0&&r.push(...a),e.auth!=null&&(t.auth!=null?r.push(...this.getConstructorAuthArgs({auth:e.auth,values:t.auth})):this.context.errors.add({severity:$.Warning,message:`Auth with ${e.auth.type} configuration is required for this endpoint`})),this.context.errors.scope(de.PathParameters),this.context.ir.pathParameters!=null&&r.push(...this.getPathParameters({namedParameters:this.context.ir.pathParameters,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(de.Headers),this.context.ir.headers!=null&&t.headers!=null&&r.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:t.headers})),this.context.errors.unscope(),r.length===0?I.TypeLiteral.nop():I.TypeLiteral.object({fields:r})}getConstructorEnvironmentArgs({baseUrl:e,environment:t}){let r=this.getEnvironmentValue({baseUrl:e,environment:t});return r==null?[]:[{name:"environment",value:r}]}getEnvironmentValue({baseUrl:e,environment:t}){if(e!=null&&t!=null){this.context.errors.add({severity:$.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(e!=null)return I.TypeLiteral.string(e);if(t!=null){if(this.context.isSingleEnvironmentID(t)){let r=this.context.getEnvironmentTypeReferenceFromID(t);if(r==null){this.context.errors.add({severity:$.Warning,message:`Environment ${JSON.stringify(t)} was not found`});return}return I.TypeLiteral.reference(r)}if(this.context.isMultiEnvironmentValues(t))return this.context.validateMultiEnvironmentUrlValues(t)?I.TypeLiteral.object({fields:Object.entries(t).map(([r,a])=>({name:r,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:Oc,value:a})}))}):void 0}}getConstructorAuthArgs({auth:e,values:t}){switch(e.type){case"basic":return t.type!=="basic"?(this.addAuthMismatchError(e,t),[]):this.getConstructorBasicAuthArg({auth:e,values:t});case"bearer":return t.type!=="bearer"?(this.addAuthMismatchError(e,t),[]):this.getConstructorBearerAuthArgs({auth:e,values:t});case"header":return t.type!=="header"?(this.addAuthMismatchError(e,t),[]):this.getConstructorHeaderAuthArgs({auth:e,values:t});case"oauth":return t.type!=="oauth"?(this.addAuthMismatchError(e,t),[]):this.getConstructorOAuthArgs({auth:e,values:t});case"inferred":return t.type!=="inferred"?(this.addAuthMismatchError(e,t),[]):(this.addWarning("The TypeScript SDK v2 Generator does not support Inferred auth scheme yet"),[]);default:q(e)}}addAuthMismatchError(e,t){this.context.errors.add({severity:$.Critical,message:this.context.newAuthMismatchError({auth:e,values:t}).message})}addWarning(e){this.context.errors.add({severity:$.Warning,message:e})}getConstructorBasicAuthArg({auth:e,values:t}){return[{name:this.context.getPropertyName(e.username),value:I.TypeLiteral.string(t.username)},{name:this.context.getPropertyName(e.password),value:I.TypeLiteral.string(t.password)}]}getConstructorBearerAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.token),value:I.TypeLiteral.string(t.token)}]}getConstructorHeaderAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.header.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:e.header.typeReference,value:t.value})}]}getConstructorOAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.clientId),value:I.TypeLiteral.string(t.clientId)},{name:this.context.getPropertyName(e.clientSecret),value:I.TypeLiteral.string(t.clientSecret)}]}getConstructorHeaderArgs({headers:e,values:t}){let r=[];for(let a of e){let o=t[a.name.wireValue],u=this.getConstructorHeaderArg({header:a,value:o});u!=null&&r.push(u)}return r}getConstructorHeaderArg({header:e,value:t}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:e.typeReference,value:t});if(!I.TypeLiteral.isNop(r))return{name:this.context.getPropertyName(e.name.name),value:r}}callMethod({endpoint:e,snippet:t}){return I.invokeMethod({on:I.reference({name:Ha}),method:this.getMethod({endpoint:e}),async:!0,arguments_:this.getMethodArgs({endpoint:e,snippet:t})})}getMethodArgs({endpoint:e,snippet:t}){switch(e.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:e.request,snippet:t});case"body":return this.getMethodArgsForBodyRequest({request:e.request,snippet:t});default:q(e.request)}}getMethodArgsForBodyRequest({request:e,snippet:t}){let r=[];this.context.errors.scope(de.PathParameters);let a=[...this.context.ir.pathParameters??[],...e.pathParameters??[]];return a.length>0&&r.push(...this.getPathParameters({namedParameters:a,snippet:t}).map(o=>o.value)),this.context.errors.unscope(),this.context.errors.scope(de.RequestBody),e.body!=null&&r.push(this.getBodyRequestArg({body:e.body,value:t.requestBody})),this.context.errors.unscope(),r}getBodyRequestArg({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t,convertOpts:{isForRequest:!0}});default:q(e)}}getBytesBodyRequestArg({value:e}){return typeof e!="string"?(this.context.errors.add({severity:$.Critical,message:`Expected bytes value to be a string, got ${typeof e}`}),I.TypeLiteral.nop()):I.TypeLiteral.blob(e)}getMethodArgsForInlinedRequest({request:e,snippet:t}){let r=[],{inlinePathParameters:a,inlineFileProperties:o}={inlinePathParameters:this.context.customConfig?.inlinePathParameters??!0,inlineFileProperties:this.context.customConfig?.inlineFileProperties??!0};this.context.errors.scope(de.PathParameters);let u=[];e.pathParameters!=null&&u.push(...this.getPathParameters({namedParameters:e.pathParameters,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(de.RequestBody);let m=this.getFilePropertyInfo({request:e,snippet:t});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:a})||r.push(...u.map(x=>x.value)),o||r.push(...m.fileFields.map(x=>x.value)),this.context.needsRequestParameter({request:e,inlinePathParameters:a,inlineFileProperties:o})&&r.push(this.getInlinedRequestArg({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:a})?u:[],filePropertyInfo:m})),r}getFilePropertyInfo({request:e,snippet:t}){return e.body==null||!this.context.isFileUploadRequestBody(e.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:e.body,value:t.requestBody})}getInlinedRequestArg({request:e,snippet:t,pathParameterFields:r,filePropertyInfo:a}){this.context.errors.scope(de.QueryParameters);let u=this.context.associateQueryParametersByWireValue({parameters:e.queryParameters??[],values:t.queryParameters??{}}).map(R=>({name:this.context.getPropertyName(R.name.name),value:this.context.dynamicTypeLiteralMapper.convert({...R,convertOpts:{isForRequest:!0}})}));this.context.errors.unscope(),this.context.errors.scope(de.Headers);let x=this.context.associateByWireValue({parameters:e.headers??[],values:t.headers??{}}).map(R=>({name:this.context.getPropertyName(R.name.name),value:this.context.dynamicTypeLiteralMapper.convert({...R,convertOpts:{isForRequest:!0}})}));this.context.errors.unscope(),this.context.errors.scope(de.RequestBody);let k=e.body!=null?this.getInlinedRequestBodyObjectFields({body:e.body,value:t.requestBody,filePropertyInfo:a}):[];return this.context.errors.unscope(),I.TypeLiteral.object({fields:[...r,...u,...x,...k]})}getInlinedRequestBodyObjectFields({body:e,value:t,filePropertyInfo:r}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyObjectFields({parameters:e.value,value:t});case"referenced":return[this.getReferencedRequestBodyPropertyObjectField({body:e,value:t})];case"fileUpload":return this.getFileUploadRequestBodyObjectFields({filePropertyInfo:r});default:q(e)}}getFileUploadRequestBodyObjectFields({filePropertyInfo:e}){return this.context.customConfig?.inlineFileProperties??!0?[...e.fileFields,...e.bodyPropertyFields]:e.bodyPropertyFields}getReferencedRequestBodyPropertyObjectField({body:e,value:t}){return{name:this.context.getPropertyName(e.bodyKey),value:this.getReferencedRequestBodyPropertyTypeLiteral({body:e.bodyType,value:t})}}getReferencedRequestBodyPropertyTypeLiteral({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t,convertOpts:{isForRequest:!0}});default:q(e)}}getInlinedRequestBodyPropertyObjectFields({parameters:e,value:t}){let r=[],a=this.context.associateByWireValue({parameters:e,values:this.context.getRecord(t)??{}});for(let o of a)r.push({name:this.context.getPropertyName(o.name.name),value:this.context.dynamicTypeLiteralMapper.convert({...o,convertOpts:{isForRequest:!0}})});return r}getPathParameters({namedParameters:e,snippet:t}){let r=[],a=this.context.associateByWireValue({parameters:e,values:t.pathParameters??{},ignoreMissingParameters:!0});for(let o of a)r.push({name:this.context.getPropertyName(o.name.name),value:this.context.dynamicTypeLiteralMapper.convert({...o,convertOpts:{isForRequest:!0}})});return r}getMethod({endpoint:e}){return e.declaration.fernFilepath.allParts.length>0?`${e.declaration.fernFilepath.allParts.map(t=>this.context.getMethodName(t)).join(".")}.${this.context.getMethodName(e.declaration.name)}`:this.context.getMethodName(e.declaration.name)}};var Fr=class extends Lt{constructor({ir:e,config:t}){super(new ur({ir:e,config:t}))}async generate(e,t={}){return super.generate(e,t)}generateSync(e){return super.generateSync(e)}async generateSnippetAst(e){return super.generateSnippetAst(e)}createSnippetGenerator(e){return new cr({context:e})}};export{Fr as DynamicSnippetsGenerator};
|
|
25
25
|
/*! Bundled license information:
|
|
26
26
|
|
|
27
27
|
@jspm/core/nodelibs/browser/chunk-DtuTasat.js:
|