@fern-api/typescript-dynamic-snippets 3.71.8 → 3.72.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,27 +1,27 @@
1
- "use strict";var qe=Object.defineProperty;var Di=Object.getOwnPropertyDescriptor;var Wi=Object.getOwnPropertyNames;var Vi=Object.prototype.hasOwnProperty;var qi=(s,t,e)=>t in s?qe(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var ye=(s,t)=>()=>(s&&(t=s(s=0)),t);var K=(s,t)=>{for(var e in t)qe(s,e,{get:t[e],enumerable:!0})},Gi=(s,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let p of Wi(t))!Vi.call(s,p)&&p!==e&&qe(s,p,{get:()=>t[p],enumerable:!(i=Di(t,p))||i.enumerable});return s};var zi=s=>Gi(qe({},"__esModule",{value:!0}),s);var v=(s,t,e)=>qi(s,typeof t!="symbol"?t+"":t,e);var l=ye(()=>{"use strict"});var x={};K(x,{_debugEnd:()=>Er,_debugProcess:()=>br,_events:()=>$r,_eventsCount:()=>jr,_exiting:()=>rr,_fatalExceptions:()=>xr,_getActiveHandles:()=>ar,_getActiveRequests:()=>or,_kill:()=>ur,_linkedBinding:()=>er,_maxListeners:()=>Mr,_preload_modules:()=>Pr,_rawDebug:()=>Xt,_startProfilerIdleNotifier:()=>Ir,_stopProfilerIdleNotifier:()=>Tr,_tickCallback:()=>vr,abort:()=>Br,addListener:()=>_r,allowedNodeEnvironmentFlags:()=>mr,arch:()=>$t,argv:()=>Dt,argv0:()=>kr,assert:()=>hr,binding:()=>zt,browser:()=>Kt,chdir:()=>Jt,config:()=>nr,cpuUsage:()=>He,cwd:()=>Yt,debugPort:()=>Cr,default:()=>Jr,dlopen:()=>ir,domain:()=>tr,emit:()=>Gr,emitWarning:()=>Gt,env:()=>_t,execArgv:()=>Wt,execPath:()=>Lr,exit:()=>fr,features:()=>yr,hasUncaughtExceptionCaptureCallback:()=>wr,hrtime:()=>ze,kill:()=>cr,listeners:()=>Yr,memoryUsage:()=>lr,moduleLoadList:()=>Qt,nextTick:()=>Ot,off:()=>Wr,on:()=>ee,once:()=>Dr,openStdin:()=>dr,pid:()=>Fr,platform:()=>jt,ppid:()=>Sr,prependListener:()=>zr,prependOnceListener:()=>Hr,reallyExit:()=>sr,release:()=>Zt,removeAllListeners:()=>qr,removeListener:()=>Vr,resourceUsage:()=>pr,setSourceMapsEnabled:()=>Or,setUncaughtExceptionCaptureCallback:()=>gr,stderr:()=>Rr,stdin:()=>Nr,stdout:()=>Ar,title:()=>Mt,umask:()=>Ht,uptime:()=>Ur,version:()=>Vt,versions:()=>qt});function pt(s){throw new Error("Node.js process "+s+" is not supported by JSPM core outside of Node.js")}function Hi(){!xe||!se||(xe=!1,se.length?Q=se.concat(Q):Ge=-1,Q.length&&Pt())}function Pt(){if(!xe){var s=setTimeout(Hi,0);xe=!0;for(var t=Q.length;t;){for(se=Q,Q=[];++Ge<t;)se&&se[Ge].run();Ge=-1,t=Q.length}se=null,xe=!1,clearTimeout(s)}}function Ot(s){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];Q.push(new Ut(s,t)),Q.length===1&&!xe&&setTimeout(Pt,0)}function Ut(s,t){this.fun=s,this.array=t}function D(){}function er(s){pt("_linkedBinding")}function ir(s){pt("dlopen")}function or(){return[]}function ar(){return[]}function hr(s,t){if(!s)throw new Error(t||"assertion error")}function wr(){return!1}function Ur(){return ie.now()/1e3}function ze(s){var t=Math.floor((Date.now()-ie.now())*.001),e=ie.now()*.001,i=Math.floor(e)+t,p=Math.floor(e%1*1e9);return s&&(i=i-s[0],p=p-s[1],p<0&&(i--,p+=ut)),[i,p]}function ee(){return Jr}function Yr(s){return[]}var Q,xe,se,Ge,Mt,$t,jt,_t,Dt,Wt,Vt,qt,Gt,zt,Ht,Yt,Jt,Zt,Kt,Xt,Qt,tr,rr,nr,sr,ur,He,pr,lr,cr,fr,dr,mr,yr,xr,gr,vr,br,Er,Ir,Tr,Ar,Rr,Nr,Br,Fr,Sr,Lr,Cr,kr,Pr,Or,ie,st,ut,Mr,$r,jr,_r,Dr,Wr,Vr,qr,Gr,zr,Hr,Jr,Zr=ye(()=>{"use strict";l();f();c();Q=[],xe=!1,Ge=-1;Ut.prototype.run=function(){this.fun.apply(null,this.array)};Mt="browser",$t="x64",jt="browser",_t={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},Dt=["/usr/bin/node"],Wt=[],Vt="v16.8.0",qt={},Gt=function(s,t){console.warn((t?t+": ":"")+s)},zt=function(s){pt("binding")},Ht=function(s){return 0},Yt=function(){return"/"},Jt=function(s){},Zt={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};Kt=!0,Xt=D,Qt=[];tr={},rr=!1,nr={};sr=D,ur=D,He=function(){return{}},pr=He,lr=He,cr=D,fr=D,dr=D,mr={};yr={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},xr=D,gr=D;vr=D,br=D,Er=D,Ir=D,Tr=D,Ar=void 0,Rr=void 0,Nr=void 0,Br=D,Fr=2,Sr=1,Lr="/bin/usr/node",Cr=9229,kr="node",Pr=[],Or=D,ie={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};ie.now===void 0&&(st=Date.now(),ie.timing&&ie.timing.navigationStart&&(st=ie.timing.navigationStart),ie.now=()=>Date.now()-st);ut=1e9;ze.bigint=function(s){var t=ze(s);return typeof BigInt>"u"?t[0]*ut+t[1]:BigInt(t[0]*ut)+BigInt(t[1])};Mr=10,$r={},jr=0;_r=ee,Dr=ee,Wr=ee,Vr=ee,qr=ee,Gr=D,zr=ee,Hr=ee;Jr={version:Vt,versions:qt,arch:$t,platform:jt,browser:Kt,release:Zt,_rawDebug:Xt,moduleLoadList:Qt,binding:zt,_linkedBinding:er,_events:$r,_eventsCount:jr,_maxListeners:Mr,on:ee,addListener:_r,once:Dr,off:Wr,removeListener:Vr,removeAllListeners:qr,emit:Gr,prependListener:zr,prependOnceListener:Hr,listeners:Yr,domain:tr,_exiting:rr,config:nr,dlopen:ir,uptime:Ur,_getActiveRequests:or,_getActiveHandles:ar,reallyExit:sr,_kill:ur,cpuUsage:He,resourceUsage:pr,memoryUsage:lr,kill:cr,exit:fr,openStdin:dr,allowedNodeEnvironmentFlags:mr,assert:hr,features:yr,_fatalExceptions:xr,setUncaughtExceptionCaptureCallback:gr,hasUncaughtExceptionCaptureCallback:wr,emitWarning:Gt,nextTick:Ot,_tickCallback:vr,_debugProcess:br,_debugEnd:Er,_startProfilerIdleNotifier:Ir,_stopProfilerIdleNotifier:Tr,stdout:Ar,stdin:Nr,stderr:Rr,abort:Br,umask:Ht,chdir:Jt,cwd:Yt,env:_t,title:Mt,argv:Dt,execArgv:Wt,pid:Fr,ppid:Sr,execPath:Lr,debugPort:Cr,hrtime:ze,argv0:kr,_preload_modules:Pr,setSourceMapsEnabled:Or}});var c=ye(()=>{"use strict";Zr()});function Yi(){if(Kr)return Be;Kr=!0,Be.byteLength=E,Be.toByteArray=F,Be.fromByteArray=W;for(var s=[],t=[],e=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,d=i.length;p<d;++p)s[p]=i[p],t[i.charCodeAt(p)]=p;t[45]=62,t[95]=63;function u(T){var A=T.length;if(A%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var S=T.indexOf("=");S===-1&&(S=A);var j=S===A?0:4-S%4;return[S,j]}function E(T){var A=u(T),S=A[0],j=A[1];return(S+j)*3/4-j}function I(T,A,S){return(A+S)*3/4-S}function F(T){var A,S=u(T),j=S[0],q=S[1],$=new e(I(T,j,q)),G=0,H=q>0?j-4:j,V;for(V=0;V<H;V+=4)A=t[T.charCodeAt(V)]<<18|t[T.charCodeAt(V+1)]<<12|t[T.charCodeAt(V+2)]<<6|t[T.charCodeAt(V+3)],$[G++]=A>>16&255,$[G++]=A>>8&255,$[G++]=A&255;return q===2&&(A=t[T.charCodeAt(V)]<<2|t[T.charCodeAt(V+1)]>>4,$[G++]=A&255),q===1&&(A=t[T.charCodeAt(V)]<<10|t[T.charCodeAt(V+1)]<<4|t[T.charCodeAt(V+2)]>>2,$[G++]=A>>8&255,$[G++]=A&255),$}function R(T){return s[T>>18&63]+s[T>>12&63]+s[T>>6&63]+s[T&63]}function C(T,A,S){for(var j,q=[],$=A;$<S;$+=3)j=(T[$]<<16&16711680)+(T[$+1]<<8&65280)+(T[$+2]&255),q.push(R(j));return q.join("")}function W(T){for(var A,S=T.length,j=S%3,q=[],$=16383,G=0,H=S-j;G<H;G+=$)q.push(C(T,G,G+$>H?H:G+$));return j===1?(A=T[S-1],q.push(s[A>>2]+s[A<<4&63]+"==")):j===2&&(A=(T[S-2]<<8)+T[S-1],q.push(s[A>>10]+s[A>>4&63]+s[A<<2&63]+"=")),q.join("")}return Be}function Ji(){if(Xr)return Ye;Xr=!0;return Ye.read=function(s,t,e,i,p){var d,u,E=p*8-i-1,I=(1<<E)-1,F=I>>1,R=-7,C=e?p-1:0,W=e?-1:1,T=s[t+C];for(C+=W,d=T&(1<<-R)-1,T>>=-R,R+=E;R>0;d=d*256+s[t+C],C+=W,R-=8);for(u=d&(1<<-R)-1,d>>=-R,R+=i;R>0;u=u*256+s[t+C],C+=W,R-=8);if(d===0)d=1-F;else{if(d===I)return u?NaN:(T?-1:1)*(1/0);u=u+Math.pow(2,i),d=d-F}return(T?-1:1)*u*Math.pow(2,d-i)},Ye.write=function(s,t,e,i,p,d){var u,E,I,F=d*8-p-1,R=(1<<F)-1,C=R>>1,W=p===23?Math.pow(2,-24)-Math.pow(2,-77):0,T=i?0:d-1,A=i?1:-1,S=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(E=isNaN(t)?1:0,u=R):(u=Math.floor(Math.log(t)/Math.LN2),t*(I=Math.pow(2,-u))<1&&(u--,I*=2),u+C>=1?t+=W/I:t+=W*Math.pow(2,1-C),t*I>=2&&(u++,I/=2),u+C>=R?(E=0,u=R):u+C>=1?(E=(t*I-1)*Math.pow(2,p),u=u+C):(E=t*Math.pow(2,C-1)*Math.pow(2,p),u=0));p>=8;s[e+T]=E&255,T+=A,E/=256,p-=8);for(u=u<<p|E,F+=p;F>0;s[e+T]=u&255,T+=A,u/=256,F-=8);s[e+T-A]|=S*128},Ye}function en(){if(Qr)return ue;Qr=!0;let s=Yi(),t=Ji(),e=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ue.Buffer=u,ue.SlowBuffer=q,ue.INSPECT_MAX_BYTES=50;let i=2147483647;ue.kMaxLength=i,u.TYPED_ARRAY_SUPPORT=p(),!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 p(){try{let o=new Uint8Array(1),r={foo:function(){return 42}};return Object.setPrototypeOf(r,Uint8Array.prototype),Object.setPrototypeOf(o,r),o.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 d(o){if(o>i)throw new RangeError('The value "'+o+'" is invalid for option "size"');let r=new Uint8Array(o);return Object.setPrototypeOf(r,u.prototype),r}function u(o,r,n){if(typeof o=="number"){if(typeof r=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return R(o)}return E(o,r,n)}u.poolSize=8192;function E(o,r,n){if(typeof o=="string")return C(o,r);if(ArrayBuffer.isView(o))return T(o);if(o==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof o);if(Z(o,ArrayBuffer)||o&&Z(o.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Z(o,SharedArrayBuffer)||o&&Z(o.buffer,SharedArrayBuffer)))return A(o,r,n);if(typeof o=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let a=o.valueOf&&o.valueOf();if(a!=null&&a!==o)return u.from(a,r,n);let m=S(o);if(m)return m;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof o[Symbol.toPrimitive]=="function")return u.from(o[Symbol.toPrimitive]("string"),r,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof o)}u.from=function(o,r,n){return E(o,r,n)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array);function I(o){if(typeof o!="number")throw new TypeError('"size" argument must be of type number');if(o<0)throw new RangeError('The value "'+o+'" is invalid for option "size"')}function F(o,r,n){return I(o),o<=0?d(o):r!==void 0?typeof n=="string"?d(o).fill(r,n):d(o).fill(r):d(o)}u.alloc=function(o,r,n){return F(o,r,n)};function R(o){return I(o),d(o<0?0:j(o)|0)}u.allocUnsafe=function(o){return R(o)},u.allocUnsafeSlow=function(o){return R(o)};function C(o,r){if((typeof r!="string"||r==="")&&(r="utf8"),!u.isEncoding(r))throw new TypeError("Unknown encoding: "+r);let n=$(o,r)|0,a=d(n),m=a.write(o,r);return m!==n&&(a=a.slice(0,m)),a}function W(o){let r=o.length<0?0:j(o.length)|0,n=d(r);for(let a=0;a<r;a+=1)n[a]=o[a]&255;return n}function T(o){if(Z(o,Uint8Array)){let r=new Uint8Array(o);return A(r.buffer,r.byteOffset,r.byteLength)}return W(o)}function A(o,r,n){if(r<0||o.byteLength<r)throw new RangeError('"offset" is outside of buffer bounds');if(o.byteLength<r+(n||0))throw new RangeError('"length" is outside of buffer bounds');let a;return r===void 0&&n===void 0?a=new Uint8Array(o):n===void 0?a=new Uint8Array(o,r):a=new Uint8Array(o,r,n),Object.setPrototypeOf(a,u.prototype),a}function S(o){if(u.isBuffer(o)){let r=j(o.length)|0,n=d(r);return n.length===0||o.copy(n,0,0,r),n}if(o.length!==void 0)return typeof o.length!="number"||at(o.length)?d(0):W(o);if(o.type==="Buffer"&&Array.isArray(o.data))return W(o.data)}function j(o){if(o>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return o|0}function q(o){return+o!=o&&(o=0),u.alloc(+o)}u.isBuffer=function(r){return r!=null&&r._isBuffer===!0&&r!==u.prototype},u.compare=function(r,n){if(Z(r,Uint8Array)&&(r=u.from(r,r.offset,r.byteLength)),Z(n,Uint8Array)&&(n=u.from(n,n.offset,n.byteLength)),!u.isBuffer(r)||!u.isBuffer(n))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(r===n)return 0;let a=r.length,m=n.length;for(let h=0,y=Math.min(a,m);h<y;++h)if(r[h]!==n[h]){a=r[h],m=n[h];break}return a<m?-1:m<a?1:0},u.isEncoding=function(r){switch(String(r).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(r,n){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return u.alloc(0);let a;if(n===void 0)for(n=0,a=0;a<r.length;++a)n+=r[a].length;let m=u.allocUnsafe(n),h=0;for(a=0;a<r.length;++a){let y=r[a];if(Z(y,Uint8Array))h+y.length>m.length?(u.isBuffer(y)||(y=u.from(y)),y.copy(m,h)):Uint8Array.prototype.set.call(m,y,h);else if(u.isBuffer(y))y.copy(m,h);else throw new TypeError('"list" argument must be an Array of Buffers');h+=y.length}return m};function $(o,r){if(u.isBuffer(o))return o.length;if(ArrayBuffer.isView(o)||Z(o,ArrayBuffer))return o.byteLength;if(typeof o!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof o);let n=o.length,a=arguments.length>2&&arguments[2]===!0;if(!a&&n===0)return 0;let m=!1;for(;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return ot(o).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return kt(o).length;default:if(m)return a?-1:ot(o).length;r=(""+r).toLowerCase(),m=!0}}u.byteLength=$;function G(o,r,n){let a=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,r>>>=0,n<=r))return"";for(o||(o="utf8");;)switch(o){case"hex":return Ci(this,r,n);case"utf8":case"utf-8":return Tt(this,r,n);case"ascii":return Si(this,r,n);case"latin1":case"binary":return Li(this,r,n);case"base64":return Bi(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ki(this,r,n);default:if(a)throw new TypeError("Unknown encoding: "+o);o=(o+"").toLowerCase(),a=!0}}u.prototype._isBuffer=!0;function H(o,r,n){let a=o[r];o[r]=o[n],o[n]=a}u.prototype.swap16=function(){let r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let n=0;n<r;n+=2)H(this,n,n+1);return this},u.prototype.swap32=function(){let r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let n=0;n<r;n+=4)H(this,n,n+3),H(this,n+1,n+2);return this},u.prototype.swap64=function(){let r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let n=0;n<r;n+=8)H(this,n,n+7),H(this,n+1,n+6),H(this,n+2,n+5),H(this,n+3,n+4);return this},u.prototype.toString=function(){let r=this.length;return r===0?"":arguments.length===0?Tt(this,0,r):G.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(r){if(!u.isBuffer(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:u.compare(this,r)===0},u.prototype.inspect=function(){let r="",n=ue.INSPECT_MAX_BYTES;return r=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(r+=" ... "),"<Buffer "+r+">"},e&&(u.prototype[e]=u.prototype.inspect),u.prototype.compare=function(r,n,a,m,h){if(Z(r,Uint8Array)&&(r=u.from(r,r.offset,r.byteLength)),!u.isBuffer(r))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof r);if(n===void 0&&(n=0),a===void 0&&(a=r?r.length:0),m===void 0&&(m=0),h===void 0&&(h=this.length),n<0||a>r.length||m<0||h>this.length)throw new RangeError("out of range index");if(m>=h&&n>=a)return 0;if(m>=h)return-1;if(n>=a)return 1;if(n>>>=0,a>>>=0,m>>>=0,h>>>=0,this===r)return 0;let y=h-m,N=a-n,U=Math.min(y,N),O=this.slice(m,h),M=r.slice(n,a);for(let L=0;L<U;++L)if(O[L]!==M[L]){y=O[L],N=M[L];break}return y<N?-1:N<y?1:0};function V(o,r,n,a,m){if(o.length===0)return-1;if(typeof n=="string"?(a=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,at(n)&&(n=m?0:o.length-1),n<0&&(n=o.length+n),n>=o.length){if(m)return-1;n=o.length-1}else if(n<0)if(m)n=0;else return-1;if(typeof r=="string"&&(r=u.from(r,a)),u.isBuffer(r))return r.length===0?-1:It(o,r,n,a,m);if(typeof r=="number")return r=r&255,typeof Uint8Array.prototype.indexOf=="function"?m?Uint8Array.prototype.indexOf.call(o,r,n):Uint8Array.prototype.lastIndexOf.call(o,r,n):It(o,[r],n,a,m);throw new TypeError("val must be string, number or Buffer")}function It(o,r,n,a,m){let h=1,y=o.length,N=r.length;if(a!==void 0&&(a=String(a).toLowerCase(),a==="ucs2"||a==="ucs-2"||a==="utf16le"||a==="utf-16le")){if(o.length<2||r.length<2)return-1;h=2,y/=2,N/=2,n/=2}function U(M,L){return h===1?M[L]:M.readUInt16BE(L*h)}let O;if(m){let M=-1;for(O=n;O<y;O++)if(U(o,O)===U(r,M===-1?0:O-M)){if(M===-1&&(M=O),O-M+1===N)return M*h}else M!==-1&&(O-=O-M),M=-1}else for(n+N>y&&(n=y-N),O=n;O>=0;O--){let M=!0;for(let L=0;L<N;L++)if(U(o,O+L)!==U(r,L)){M=!1;break}if(M)return O}return-1}u.prototype.includes=function(r,n,a){return this.indexOf(r,n,a)!==-1},u.prototype.indexOf=function(r,n,a){return V(this,r,n,a,!0)},u.prototype.lastIndexOf=function(r,n,a){return V(this,r,n,a,!1)};function Ii(o,r,n,a){n=Number(n)||0;let m=o.length-n;a?(a=Number(a),a>m&&(a=m)):a=m;let h=r.length;a>h/2&&(a=h/2);let y;for(y=0;y<a;++y){let N=parseInt(r.substr(y*2,2),16);if(at(N))return y;o[n+y]=N}return y}function Ti(o,r,n,a){return Ve(ot(r,o.length-n),o,n,a)}function Ai(o,r,n,a){return Ve(Mi(r),o,n,a)}function Ri(o,r,n,a){return Ve(kt(r),o,n,a)}function Ni(o,r,n,a){return Ve($i(r,o.length-n),o,n,a)}u.prototype.write=function(r,n,a,m){if(n===void 0)m="utf8",a=this.length,n=0;else if(a===void 0&&typeof n=="string")m=n,a=this.length,n=0;else if(isFinite(n))n=n>>>0,isFinite(a)?(a=a>>>0,m===void 0&&(m="utf8")):(m=a,a=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let h=this.length-n;if((a===void 0||a>h)&&(a=h),r.length>0&&(a<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");m||(m="utf8");let y=!1;for(;;)switch(m){case"hex":return Ii(this,r,n,a);case"utf8":case"utf-8":return Ti(this,r,n,a);case"ascii":case"latin1":case"binary":return Ai(this,r,n,a);case"base64":return Ri(this,r,n,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ni(this,r,n,a);default:if(y)throw new TypeError("Unknown encoding: "+m);m=(""+m).toLowerCase(),y=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Bi(o,r,n){return r===0&&n===o.length?s.fromByteArray(o):s.fromByteArray(o.slice(r,n))}function Tt(o,r,n){n=Math.min(o.length,n);let a=[],m=r;for(;m<n;){let h=o[m],y=null,N=h>239?4:h>223?3:h>191?2:1;if(m+N<=n){let U,O,M,L;switch(N){case 1:h<128&&(y=h);break;case 2:U=o[m+1],(U&192)===128&&(L=(h&31)<<6|U&63,L>127&&(y=L));break;case 3:U=o[m+1],O=o[m+2],(U&192)===128&&(O&192)===128&&(L=(h&15)<<12|(U&63)<<6|O&63,L>2047&&(L<55296||L>57343)&&(y=L));break;case 4:U=o[m+1],O=o[m+2],M=o[m+3],(U&192)===128&&(O&192)===128&&(M&192)===128&&(L=(h&15)<<18|(U&63)<<12|(O&63)<<6|M&63,L>65535&&L<1114112&&(y=L))}}y===null?(y=65533,N=1):y>65535&&(y-=65536,a.push(y>>>10&1023|55296),y=56320|y&1023),a.push(y),m+=N}return Fi(a)}let At=4096;function Fi(o){let r=o.length;if(r<=At)return String.fromCharCode.apply(String,o);let n="",a=0;for(;a<r;)n+=String.fromCharCode.apply(String,o.slice(a,a+=At));return n}function Si(o,r,n){let a="";n=Math.min(o.length,n);for(let m=r;m<n;++m)a+=String.fromCharCode(o[m]&127);return a}function Li(o,r,n){let a="";n=Math.min(o.length,n);for(let m=r;m<n;++m)a+=String.fromCharCode(o[m]);return a}function Ci(o,r,n){let a=o.length;(!r||r<0)&&(r=0),(!n||n<0||n>a)&&(n=a);let m="";for(let h=r;h<n;++h)m+=ji[o[h]];return m}function ki(o,r,n){let a=o.slice(r,n),m="";for(let h=0;h<a.length-1;h+=2)m+=String.fromCharCode(a[h]+a[h+1]*256);return m}u.prototype.slice=function(r,n){let a=this.length;r=~~r,n=n===void 0?a:~~n,r<0?(r+=a,r<0&&(r=0)):r>a&&(r=a),n<0?(n+=a,n<0&&(n=0)):n>a&&(n=a),n<r&&(n=r);let m=this.subarray(r,n);return Object.setPrototypeOf(m,u.prototype),m};function _(o,r,n){if(o%1!==0||o<0)throw new RangeError("offset is not uint");if(o+r>n)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUintLE=u.prototype.readUIntLE=function(r,n,a){r=r>>>0,n=n>>>0,a||_(r,n,this.length);let m=this[r],h=1,y=0;for(;++y<n&&(h*=256);)m+=this[r+y]*h;return m},u.prototype.readUintBE=u.prototype.readUIntBE=function(r,n,a){r=r>>>0,n=n>>>0,a||_(r,n,this.length);let m=this[r+--n],h=1;for(;n>0&&(h*=256);)m+=this[r+--n]*h;return m},u.prototype.readUint8=u.prototype.readUInt8=function(r,n){return r=r>>>0,n||_(r,1,this.length),this[r]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(r,n){return r=r>>>0,n||_(r,2,this.length),this[r]|this[r+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(r,n){return r=r>>>0,n||_(r,2,this.length),this[r]<<8|this[r+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(r,n){return r=r>>>0,n||_(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(r,n){return r=r>>>0,n||_(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])},u.prototype.readBigUInt64LE=ne(function(r){r=r>>>0,he(r,"offset");let n=this[r],a=this[r+7];(n===void 0||a===void 0)&&Ne(r,this.length-8);let m=n+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24,h=this[++r]+this[++r]*2**8+this[++r]*2**16+a*2**24;return BigInt(m)+(BigInt(h)<<BigInt(32))}),u.prototype.readBigUInt64BE=ne(function(r){r=r>>>0,he(r,"offset");let n=this[r],a=this[r+7];(n===void 0||a===void 0)&&Ne(r,this.length-8);let m=n*2**24+this[++r]*2**16+this[++r]*2**8+this[++r],h=this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+a;return(BigInt(m)<<BigInt(32))+BigInt(h)}),u.prototype.readIntLE=function(r,n,a){r=r>>>0,n=n>>>0,a||_(r,n,this.length);let m=this[r],h=1,y=0;for(;++y<n&&(h*=256);)m+=this[r+y]*h;return h*=128,m>=h&&(m-=Math.pow(2,8*n)),m},u.prototype.readIntBE=function(r,n,a){r=r>>>0,n=n>>>0,a||_(r,n,this.length);let m=n,h=1,y=this[r+--m];for(;m>0&&(h*=256);)y+=this[r+--m]*h;return h*=128,y>=h&&(y-=Math.pow(2,8*n)),y},u.prototype.readInt8=function(r,n){return r=r>>>0,n||_(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]},u.prototype.readInt16LE=function(r,n){r=r>>>0,n||_(r,2,this.length);let a=this[r]|this[r+1]<<8;return a&32768?a|4294901760:a},u.prototype.readInt16BE=function(r,n){r=r>>>0,n||_(r,2,this.length);let a=this[r+1]|this[r]<<8;return a&32768?a|4294901760:a},u.prototype.readInt32LE=function(r,n){return r=r>>>0,n||_(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24},u.prototype.readInt32BE=function(r,n){return r=r>>>0,n||_(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]},u.prototype.readBigInt64LE=ne(function(r){r=r>>>0,he(r,"offset");let n=this[r],a=this[r+7];(n===void 0||a===void 0)&&Ne(r,this.length-8);let m=this[r+4]+this[r+5]*2**8+this[r+6]*2**16+(a<<24);return(BigInt(m)<<BigInt(32))+BigInt(n+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24)}),u.prototype.readBigInt64BE=ne(function(r){r=r>>>0,he(r,"offset");let n=this[r],a=this[r+7];(n===void 0||a===void 0)&&Ne(r,this.length-8);let m=(n<<24)+this[++r]*2**16+this[++r]*2**8+this[++r];return(BigInt(m)<<BigInt(32))+BigInt(this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+a)}),u.prototype.readFloatLE=function(r,n){return r=r>>>0,n||_(r,4,this.length),t.read(this,r,!0,23,4)},u.prototype.readFloatBE=function(r,n){return r=r>>>0,n||_(r,4,this.length),t.read(this,r,!1,23,4)},u.prototype.readDoubleLE=function(r,n){return r=r>>>0,n||_(r,8,this.length),t.read(this,r,!0,52,8)},u.prototype.readDoubleBE=function(r,n){return r=r>>>0,n||_(r,8,this.length),t.read(this,r,!1,52,8)};function z(o,r,n,a,m,h){if(!u.isBuffer(o))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>m||r<h)throw new RangeError('"value" argument is out of bounds');if(n+a>o.length)throw new RangeError("Index out of range")}u.prototype.writeUintLE=u.prototype.writeUIntLE=function(r,n,a,m){if(r=+r,n=n>>>0,a=a>>>0,!m){let N=Math.pow(2,8*a)-1;z(this,r,n,a,N,0)}let h=1,y=0;for(this[n]=r&255;++y<a&&(h*=256);)this[n+y]=r/h&255;return n+a},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(r,n,a,m){if(r=+r,n=n>>>0,a=a>>>0,!m){let N=Math.pow(2,8*a)-1;z(this,r,n,a,N,0)}let h=a-1,y=1;for(this[n+h]=r&255;--h>=0&&(y*=256);)this[n+h]=r/y&255;return n+a},u.prototype.writeUint8=u.prototype.writeUInt8=function(r,n,a){return r=+r,n=n>>>0,a||z(this,r,n,1,255,0),this[n]=r&255,n+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(r,n,a){return r=+r,n=n>>>0,a||z(this,r,n,2,65535,0),this[n]=r&255,this[n+1]=r>>>8,n+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(r,n,a){return r=+r,n=n>>>0,a||z(this,r,n,2,65535,0),this[n]=r>>>8,this[n+1]=r&255,n+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(r,n,a){return r=+r,n=n>>>0,a||z(this,r,n,4,4294967295,0),this[n+3]=r>>>24,this[n+2]=r>>>16,this[n+1]=r>>>8,this[n]=r&255,n+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(r,n,a){return r=+r,n=n>>>0,a||z(this,r,n,4,4294967295,0),this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255,n+4};function Rt(o,r,n,a,m){Ct(r,a,m,o,n,7);let h=Number(r&BigInt(4294967295));o[n++]=h,h=h>>8,o[n++]=h,h=h>>8,o[n++]=h,h=h>>8,o[n++]=h;let y=Number(r>>BigInt(32)&BigInt(4294967295));return o[n++]=y,y=y>>8,o[n++]=y,y=y>>8,o[n++]=y,y=y>>8,o[n++]=y,n}function Nt(o,r,n,a,m){Ct(r,a,m,o,n,7);let h=Number(r&BigInt(4294967295));o[n+7]=h,h=h>>8,o[n+6]=h,h=h>>8,o[n+5]=h,h=h>>8,o[n+4]=h;let y=Number(r>>BigInt(32)&BigInt(4294967295));return o[n+3]=y,y=y>>8,o[n+2]=y,y=y>>8,o[n+1]=y,y=y>>8,o[n]=y,n+8}u.prototype.writeBigUInt64LE=ne(function(r,n=0){return Rt(this,r,n,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeBigUInt64BE=ne(function(r,n=0){return Nt(this,r,n,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeIntLE=function(r,n,a,m){if(r=+r,n=n>>>0,!m){let U=Math.pow(2,8*a-1);z(this,r,n,a,U-1,-U)}let h=0,y=1,N=0;for(this[n]=r&255;++h<a&&(y*=256);)r<0&&N===0&&this[n+h-1]!==0&&(N=1),this[n+h]=(r/y>>0)-N&255;return n+a},u.prototype.writeIntBE=function(r,n,a,m){if(r=+r,n=n>>>0,!m){let U=Math.pow(2,8*a-1);z(this,r,n,a,U-1,-U)}let h=a-1,y=1,N=0;for(this[n+h]=r&255;--h>=0&&(y*=256);)r<0&&N===0&&this[n+h+1]!==0&&(N=1),this[n+h]=(r/y>>0)-N&255;return n+a},u.prototype.writeInt8=function(r,n,a){return r=+r,n=n>>>0,a||z(this,r,n,1,127,-128),r<0&&(r=255+r+1),this[n]=r&255,n+1},u.prototype.writeInt16LE=function(r,n,a){return r=+r,n=n>>>0,a||z(this,r,n,2,32767,-32768),this[n]=r&255,this[n+1]=r>>>8,n+2},u.prototype.writeInt16BE=function(r,n,a){return r=+r,n=n>>>0,a||z(this,r,n,2,32767,-32768),this[n]=r>>>8,this[n+1]=r&255,n+2},u.prototype.writeInt32LE=function(r,n,a){return r=+r,n=n>>>0,a||z(this,r,n,4,2147483647,-2147483648),this[n]=r&255,this[n+1]=r>>>8,this[n+2]=r>>>16,this[n+3]=r>>>24,n+4},u.prototype.writeInt32BE=function(r,n,a){return r=+r,n=n>>>0,a||z(this,r,n,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255,n+4},u.prototype.writeBigInt64LE=ne(function(r,n=0){return Rt(this,r,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeBigInt64BE=ne(function(r,n=0){return Nt(this,r,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Bt(o,r,n,a,m,h){if(n+a>o.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Ft(o,r,n,a,m){return r=+r,n=n>>>0,m||Bt(o,r,n,4),t.write(o,r,n,a,23,4),n+4}u.prototype.writeFloatLE=function(r,n,a){return Ft(this,r,n,!0,a)},u.prototype.writeFloatBE=function(r,n,a){return Ft(this,r,n,!1,a)};function St(o,r,n,a,m){return r=+r,n=n>>>0,m||Bt(o,r,n,8),t.write(o,r,n,a,52,8),n+8}u.prototype.writeDoubleLE=function(r,n,a){return St(this,r,n,!0,a)},u.prototype.writeDoubleBE=function(r,n,a){return St(this,r,n,!1,a)},u.prototype.copy=function(r,n,a,m){if(!u.isBuffer(r))throw new TypeError("argument should be a Buffer");if(a||(a=0),!m&&m!==0&&(m=this.length),n>=r.length&&(n=r.length),n||(n=0),m>0&&m<a&&(m=a),m===a||r.length===0||this.length===0)return 0;if(n<0)throw new RangeError("targetStart out of bounds");if(a<0||a>=this.length)throw new RangeError("Index out of range");if(m<0)throw new RangeError("sourceEnd out of bounds");m>this.length&&(m=this.length),r.length-n<m-a&&(m=r.length-n+a);let h=m-a;return this===r&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(n,a,m):Uint8Array.prototype.set.call(r,this.subarray(a,m),n),h},u.prototype.fill=function(r,n,a,m){if(typeof r=="string"){if(typeof n=="string"?(m=n,n=0,a=this.length):typeof a=="string"&&(m=a,a=this.length),m!==void 0&&typeof m!="string")throw new TypeError("encoding must be a string");if(typeof m=="string"&&!u.isEncoding(m))throw new TypeError("Unknown encoding: "+m);if(r.length===1){let y=r.charCodeAt(0);(m==="utf8"&&y<128||m==="latin1")&&(r=y)}}else typeof r=="number"?r=r&255:typeof r=="boolean"&&(r=Number(r));if(n<0||this.length<n||this.length<a)throw new RangeError("Out of range index");if(a<=n)return this;n=n>>>0,a=a===void 0?this.length:a>>>0,r||(r=0);let h;if(typeof r=="number")for(h=n;h<a;++h)this[h]=r;else{let y=u.isBuffer(r)?r:u.from(r,m),N=y.length;if(N===0)throw new TypeError('The value "'+r+'" is invalid for argument "value"');for(h=0;h<a-n;++h)this[h+n]=y[h%N]}return this};let me={};function it(o,r,n){me[o]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:r.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${o}]`,this.stack,delete this.name}get code(){return o}set code(m){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:m,writable:!0})}toString(){return`${this.name} [${o}]: ${this.message}`}}}it("ERR_BUFFER_OUT_OF_BOUNDS",function(o){return o?`${o} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),it("ERR_INVALID_ARG_TYPE",function(o,r){return`The "${o}" argument must be of type number. Received type ${typeof r}`},TypeError),it("ERR_OUT_OF_RANGE",function(o,r,n){let a=`The value of "${o}" is out of range.`,m=n;return Number.isInteger(n)&&Math.abs(n)>2**32?m=Lt(String(n)):typeof n=="bigint"&&(m=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(m=Lt(m)),m+="n"),a+=` It must be ${r}. Received ${m}`,a},RangeError);function Lt(o){let r="",n=o.length,a=o[0]==="-"?1:0;for(;n>=a+4;n-=3)r=`_${o.slice(n-3,n)}${r}`;return`${o.slice(0,n)}${r}`}function Pi(o,r,n){he(r,"offset"),(o[r]===void 0||o[r+n]===void 0)&&Ne(r,o.length-(n+1))}function Ct(o,r,n,a,m,h){if(o>n||o<r){let y=typeof r=="bigint"?"n":"",N;throw r===0||r===BigInt(0)?N=`>= 0${y} and < 2${y} ** ${(h+1)*8}${y}`:N=`>= -(2${y} ** ${(h+1)*8-1}${y}) and < 2 ** ${(h+1)*8-1}${y}`,new me.ERR_OUT_OF_RANGE("value",N,o)}Pi(a,m,h)}function he(o,r){if(typeof o!="number")throw new me.ERR_INVALID_ARG_TYPE(r,"number",o)}function Ne(o,r,n){throw Math.floor(o)!==o?(he(o,n),new me.ERR_OUT_OF_RANGE("offset","an integer",o)):r<0?new me.ERR_BUFFER_OUT_OF_BOUNDS:new me.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${r}`,o)}let Oi=/[^+/0-9A-Za-z-_]/g;function Ui(o){if(o=o.split("=")[0],o=o.trim().replace(Oi,""),o.length<2)return"";for(;o.length%4!==0;)o=o+"=";return o}function ot(o,r){r=r||1/0;let n,a=o.length,m=null,h=[];for(let y=0;y<a;++y){if(n=o.charCodeAt(y),n>55295&&n<57344){if(!m){if(n>56319){(r-=3)>-1&&h.push(239,191,189);continue}else if(y+1===a){(r-=3)>-1&&h.push(239,191,189);continue}m=n;continue}if(n<56320){(r-=3)>-1&&h.push(239,191,189),m=n;continue}n=(m-55296<<10|n-56320)+65536}else m&&(r-=3)>-1&&h.push(239,191,189);if(m=null,n<128){if((r-=1)<0)break;h.push(n)}else if(n<2048){if((r-=2)<0)break;h.push(n>>6|192,n&63|128)}else if(n<65536){if((r-=3)<0)break;h.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((r-=4)<0)break;h.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return h}function Mi(o){let r=[];for(let n=0;n<o.length;++n)r.push(o.charCodeAt(n)&255);return r}function $i(o,r){let n,a,m,h=[];for(let y=0;y<o.length&&!((r-=2)<0);++y)n=o.charCodeAt(y),a=n>>8,m=n%256,h.push(m),h.push(a);return h}function kt(o){return s.toByteArray(Ui(o))}function Ve(o,r,n,a){let m;for(m=0;m<a&&!(m+n>=r.length||m>=o.length);++m)r[m+n]=o[m];return m}function Z(o,r){return o instanceof r||o!=null&&o.constructor!=null&&o.constructor.name!=null&&o.constructor.name===r.name}function at(o){return o!==o}let ji=(function(){let o="0123456789abcdef",r=new Array(256);for(let n=0;n<16;++n){let a=n*16;for(let m=0;m<16;++m)r[a+m]=o[n]+o[m]}return r})();function ne(o){return typeof BigInt>"u"?_i:o}function _i(){throw new Error("BigInt not supported")}return ue}var Be,Kr,Ye,Xr,ue,Qr,tn=ye(()=>{"use strict";l();f();c();Be={},Kr=!1;Ye={},Xr=!1;ue={},Qr=!1});var pe,g,ms,hs,rn=ye(()=>{"use strict";l();f();c();tn();pe=en();pe.Buffer;pe.SlowBuffer;pe.INSPECT_MAX_BYTES;pe.kMaxLength;g=pe.Buffer,ms=pe.INSPECT_MAX_BYTES,hs=pe.kMaxLength});var f=ye(()=>{"use strict";rn()});var ts={};K(ts,{DynamicSnippetsGenerator:()=>nt});module.exports=zi(ts);l();f();c();l();f();c();l();f();c();l();f();c();l();f();c();l();f();c();l();f();c();l();f();c();l();f();c();var Zi=typeof global=="object"&&global&&global.Object===Object&&global,nn=Zi;var Ki=typeof self=="object"&&self&&self.Object===Object&&self,Xi=nn||Ki||Function("return this")(),on=Xi;var Qi=on.Symbol,te=Qi;l();f();c();var an=Object.prototype,eo=an.hasOwnProperty,to=an.toString,Fe=te?te.toStringTag:void 0;function ro(s){var t=eo.call(s,Fe),e=s[Fe];try{s[Fe]=void 0;var i=!0}catch{}var p=to.call(s);return i&&(t?s[Fe]=e:delete s[Fe]),p}var sn=ro;l();f();c();var no=Object.prototype,io=no.toString;function oo(s){return io.call(s)}var un=oo;var ao="[object Null]",so="[object Undefined]",pn=te?te.toStringTag:void 0;function uo(s){return s==null?s===void 0?so:ao:pn&&pn in Object(s)?sn(s):un(s)}var ln=uo;l();f();c();function po(s){return s!=null&&typeof s=="object"}var cn=po;var lo="[object Symbol]";function co(s){return typeof s=="symbol"||cn(s)&&ln(s)==lo}var fn=co;l();f();c();l();f();c();function fo(s,t){for(var e=-1,i=s==null?0:s.length,p=Array(i);++e<i;)p[e]=t(s[e],e,s);return p}var dn=fo;l();f();c();var mo=Array.isArray,mn=mo;var ho=1/0,hn=te?te.prototype:void 0,yn=hn?hn.toString:void 0;function xn(s){if(typeof s=="string")return s;if(mn(s))return dn(s,xn)+"";if(fn(s))return yn?yn.call(s):"";var t=s+"";return t=="0"&&1/s==-ho?"-0":t}var gn=xn;l();f();c();function yo(s){return s==null?"":gn(s)}var oe=yo;l();f();c();l();f();c();l();f();c();l();f();c();l();f();c();l();f();c();function xo(s,t,e){var i=-1,p=s.length;t<0&&(t=-t>p?0:p+t),e=e>p?p:e,e<0&&(e+=p),p=t>e?0:e-t>>>0,t>>>=0;for(var d=Array(p);++i<p;)d[i]=s[i+t];return d}var wn=xo;function go(s,t,e){var i=s.length;return e=e===void 0?i:e,!t&&e>=i?s:wn(s,t,e)}var vn=go;l();f();c();var wo="\\ud800-\\udfff",vo="\\u0300-\\u036f",bo="\\ufe20-\\ufe2f",Eo="\\u20d0-\\u20ff",Io=vo+bo+Eo,To="\\ufe0e\\ufe0f",Ao="\\u200d",Ro=RegExp("["+Ao+wo+Io+To+"]");function No(s){return Ro.test(s)}var Je=No;l();f();c();l();f();c();function Bo(s){return s.split("")}var bn=Bo;l();f();c();var En="\\ud800-\\udfff",Fo="\\u0300-\\u036f",So="\\ufe20-\\ufe2f",Lo="\\u20d0-\\u20ff",Co=Fo+So+Lo,ko="\\ufe0e\\ufe0f",Po="["+En+"]",lt="["+Co+"]",ct="\\ud83c[\\udffb-\\udfff]",Oo="(?:"+lt+"|"+ct+")",In="[^"+En+"]",Tn="(?:\\ud83c[\\udde6-\\uddff]){2}",An="[\\ud800-\\udbff][\\udc00-\\udfff]",Uo="\\u200d",Rn=Oo+"?",Nn="["+ko+"]?",Mo="(?:"+Uo+"(?:"+[In,Tn,An].join("|")+")"+Nn+Rn+")*",$o=Nn+Rn+Mo,jo="(?:"+[In+lt+"?",lt,Tn,An,Po].join("|")+")",_o=RegExp(ct+"(?="+ct+")|"+jo+$o,"g");function Do(s){return s.match(_o)||[]}var Bn=Do;function Wo(s){return Je(s)?Bn(s):bn(s)}var Fn=Wo;function Vo(s){return function(t){t=oe(t);var e=Je(t)?Fn(t):void 0,i=e?e[0]:t.charAt(0),p=e?vn(e,1).join(""):t.slice(1);return i[s]()+p}}var Sn=Vo;var qo=Sn("toUpperCase"),le=qo;function Go(s){return le(oe(s).toLowerCase())}var Ln=Go;l();f();c();l();f();c();function zo(s,t,e,i){var p=-1,d=s==null?0:s.length;for(i&&d&&(e=s[++p]);++p<d;)e=t(e,s[p],p,s);return e}var Cn=zo;l();f();c();l();f();c();l();f();c();function Ho(s){return function(t){return s?.[t]}}var kn=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"},Jo=kn(Yo),Pn=Jo;var Zo=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ko="\\u0300-\\u036f",Xo="\\ufe20-\\ufe2f",Qo="\\u20d0-\\u20ff",ea=Ko+Xo+Qo,ta="["+ea+"]",ra=RegExp(ta,"g");function na(s){return s=oe(s),s&&s.replace(Zo,Pn).replace(ra,"")}var On=na;l();f();c();l();f();c();var ia=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function oa(s){return s.match(ia)||[]}var Un=oa;l();f();c();var aa=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function sa(s){return aa.test(s)}var Mn=sa;l();f();c();var Wn="\\ud800-\\udfff",ua="\\u0300-\\u036f",pa="\\ufe20-\\ufe2f",la="\\u20d0-\\u20ff",ca=ua+pa+la,Vn="\\u2700-\\u27bf",qn="a-z\\xdf-\\xf6\\xf8-\\xff",fa="\\xac\\xb1\\xd7\\xf7",da="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",ma="\\u2000-\\u206f",ha=" \\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",Gn="A-Z\\xc0-\\xd6\\xd8-\\xde",ya="\\ufe0e\\ufe0f",zn=fa+da+ma+ha,Hn="['\u2019]",$n="["+zn+"]",xa="["+ca+"]",Yn="\\d+",ga="["+Vn+"]",Jn="["+qn+"]",Zn="[^"+Wn+zn+Yn+Vn+qn+Gn+"]",wa="\\ud83c[\\udffb-\\udfff]",va="(?:"+xa+"|"+wa+")",ba="[^"+Wn+"]",Kn="(?:\\ud83c[\\udde6-\\uddff]){2}",Xn="[\\ud800-\\udbff][\\udc00-\\udfff]",ge="["+Gn+"]",Ea="\\u200d",jn="(?:"+Jn+"|"+Zn+")",Ia="(?:"+ge+"|"+Zn+")",_n="(?:"+Hn+"(?:d|ll|m|re|s|t|ve))?",Dn="(?:"+Hn+"(?:D|LL|M|RE|S|T|VE))?",Qn=va+"?",ei="["+ya+"]?",Ta="(?:"+Ea+"(?:"+[ba,Kn,Xn].join("|")+")"+ei+Qn+")*",Aa="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ra="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Na=ei+Qn+Ta,Ba="(?:"+[ga,Kn,Xn].join("|")+")"+Na,Fa=RegExp([ge+"?"+Jn+"+"+_n+"(?="+[$n,ge,"$"].join("|")+")",Ia+"+"+Dn+"(?="+[$n,ge+jn,"$"].join("|")+")",ge+"?"+jn+"+"+_n,ge+"+"+Dn,Ra,Aa,Yn,Ba].join("|"),"g");function Sa(s){return s.match(Fa)||[]}var ti=Sa;function La(s,t,e){return s=oe(s),t=e?void 0:t,t===void 0?Mn(s)?ti(s):Un(s):s.match(t)||[]}var ri=La;var Ca="['\u2019]",ka=RegExp(Ca,"g");function Pa(s){return function(t){return Cn(ri(On(t).replace(ka,"")),s,"")}}var ni=Pa;var Oa=ni(function(s,t,e){return t=t.toLowerCase(),s+(e?Ln(t):t)}),Se=Oa;l();f();c();function P(s){throw new Error("Unexpected value: "+JSON.stringify(s))}l();f();c();function Le(s){return Object.keys(s)}l();f();c();l();f();c();l();f();c();var Ce=x.env.FERN_STACK_TRACK?.toLowerCase()??"",X=Ce!==""&&Ce!=="0"&&Ce!=="false",ft=["single","multiline","box"].includes(Ce)?Ce:"single";X&&(Error.stackTraceLimit=50);var Ua=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),Ma=new Set(["stacktrace"]);function Ke({maxFrames:s=50,skip:t=0,filterPaths:e=[],filterFunctions:i=[],stopOn:p=[],filterNode:d=!0,filterJs:u=!0,formatFilename:E=I=>I}={}){if(!X)return[];i=[...i,...Ua],e=[...e,...Ma],p=[...p,"runInteractiveTask"];let I=!1;return(new Error().stack??"").split(`
2
- `).map(F=>{let R=F.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(R&&R.length===5){let[,C,W,T,A]=R;if(!C||!W||!T||!A)return;if(I||p.some(S=>C?.includes(S))){I=!0;return}switch(C){case"Object.<anonymous>":C="";break;case"Object.object":case"Object.alias":case"Object.union":case"Object.enum":case"Object.undiscriminatedUnion":C=`${C.substring(C.indexOf(".")+1)}()=> { ... }`;break}return{fn:C,path:E(W),position:`${T}:${A}`}}}).filter(F=>F&&!i.some(R=>F.fn.includes(R))&&!(d&&F.path?.startsWith("node:"))&&!(u&&F.path?.endsWith(".js"))&&!e.some(R=>F.path.includes(R))).slice(t,t+s)}var Ze=class{constructor({maxFrames:t=50,skip:e=0,filterPaths:i=[],filterFunctions:p=[],stopOn:d=[],filterNode:u=!0,filterJs:E=!0,multiline:I=!1,formatFilename:F=R=>R}={}){v(this,"maxFrames");v(this,"skip");v(this,"filterPaths");v(this,"filterFunctions");v(this,"stopOn");v(this,"filterNode");v(this,"filterJs");v(this,"multiline");v(this,"formatFilename");v(this,"tracking",new WeakMap);this.maxFrames=t,this.skip=e,this.filterPaths=i,this.filterFunctions=p,this.stopOn=d,this.filterNode=u,this.filterJs=E,this.multiline=I,this.formatFilename=F}tag(t){let e=this.tracking.get(t)||new Set;Ke({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(i=>e.add(i)),this.tracking.set(t,e)}trace(t){if(!X)return"";let e=this.tracking.get(t);return e?[...e].map(i=>`${this.multiline?`
3
- `:""}${i.fn} - ${i.path}:${i.position}`).join(""):""}frames(t){let e=this.tracking.get(t);return e?[...e]:[]}free(t){this.tracking.delete(t)}clear(){this.tracking=new WeakMap}},dt;function ii({maxFrames:s=50,skip:t=0,filterPaths:e=[],filterFunctions:i=[],stopOn:p=[],filterNode:d=!0,filterJs:u=!0,multiline:E=!1,formatFilename:I=F=>F}={}){X&&(dt??(dt=new Ze({maxFrames:s,skip:t,filterPaths:e,filterFunctions:i,stopOn:p,filterNode:d,filterJs:u,multiline:E,formatFilename:I})))}function oi(s){dt?.tag(s)}function mt(s){return dt?.frames(s)??[]}var ce=class{constructor(){oi(this)}};l();f();c();var Xe=class{formatMultiple(t){return Promise.all(t.map(e=>this.format(e)))}formatMultipleSync(t){return t.map(e=>this.formatSync(e))}dispose(){}},ke=class extends Xe{async format(t){return t}formatSync(t){return t}};l();f();c();l();f();c();l();f();c();var Y=class extends ce{constructor(e){super();v(this,"value");this.value=e}write(e){typeof this.value=="string"?e.write(this.value):typeof this.value=="function"?this.value(e):this.value.write(e)}};var $a=4;ii({skip:0,maxFrames:15,filterFunctions:["Abstract"]});var Pe=class{constructor(){v(this,"lineBuffer",[]);v(this,"indentLevel",0);v(this,"hasWrittenAnything",!1);v(this,"lastCharacterIsSemicolon",!1);v(this,"lastCharacterIsNewline",!1);v(this,"nodeStackFrames",[])}get buffer(){return X&&this.nodeStackFrames.length>0&&this.writeInternal(`
1
+ "use strict";var Gt=Object.defineProperty;var fs=Object.getOwnPropertyDescriptor;var ms=Object.getOwnPropertyNames;var hs=Object.prototype.hasOwnProperty;var ys=(n,e,t)=>e in n?Gt(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var ot=(n,e)=>()=>(n&&(e=n(n=0)),e);var pe=(n,e)=>{for(var t in e)Gt(n,t,{get:e[t],enumerable:!0})},gs=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of ms(e))!hs.call(n,a)&&a!==t&&Gt(n,a,{get:()=>e[a],enumerable:!(r=fs(e,a))||r.enumerable});return n};var xs=n=>gs(Gt({},"__esModule",{value:!0}),n);var E=(n,e,t)=>ys(n,typeof e!="symbol"?e+"":e,t);var p=ot(()=>{"use strict"});var v={};pe(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:()=>Yt,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:()=>Jt,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 gr(n){throw new Error("Node.js process "+n+" is not supported by JSPM core outside of Node.js")}function vs(){!ut||!Pe||(ut=!1,Pe.length?be=Pe.concat(be):Ht=-1,be.length&&zr())}function zr(){if(!ut){var n=setTimeout(vs,0);ut=!0;for(var e=be.length;e;){for(Pe=be,be=[];++Ht<e;)Pe&&Pe[Ht].run();Ht=-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){gr("_linkedBinding")}function yn(n){gr("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 Jt(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+=yr)),[r,a]}function we(){return oi}function si(n){return[]}var be,ut,Pe,Ht,Hr,Jr,Yr,Xr,Kr,Qr,en,tn,rn,nn,an,sn,on,un,cn,ln,pn,fn,mn,hn,vn,bn,Yt,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,hr,yr,Jn,Yn,Xn,Kn,Qn,ei,ti,ri,ni,ii,ai,oi,ui=ot(()=>{"use strict";p();f();d();be=[],ut=!1,Ht=-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){gr("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,Yt=function(){return{}},wn=Yt,_n=Yt,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&&(hr=Date.now(),Se.timing&&Se.timing.navigationStart&&(hr=Se.timing.navigationStart),Se.now=()=>Date.now()-hr);yr=1e9;Jt.bigint=function(n){var e=Jt(n);return typeof BigInt>"u"?e[0]*yr+e[1]:BigInt(e[0]*yr)+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:Yt,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:Jt,argv0:zn,_preload_modules:Zn,setSourceMapsEnabled:Gn}});var d=ot(()=>{"use strict";ui()});function bs(){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 ws(){if(li)return Xt;li=!0;return Xt.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)},Xt.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},Xt}function di(){if(pi)return je;pi=!0;let n=bs(),e=ws(),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(he(c,ArrayBuffer)||c&&he(c.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(he(c,SharedArrayBuffer)||c&&he(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(he(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"||mr(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(he(i,Uint8Array)&&(i=u.from(i,i.offset,i.byteLength)),he(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(he(_,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)||he(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 fr(c).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s*2;case"hex":return s>>>1;case"base64":return qr(c).length;default:if(h)return l?-1:fr(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 Lr(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?Lr(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(he(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,mr(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:Or(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):Or(c,[i],s,l,h);throw new TypeError("val must be string, number or Buffer")}function Or(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(mr(M))return _;c[s+_]=M}return _}function Ya(c,i,s,l){return Zt(fr(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(qr(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 Lr(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 Pr=4096;function ts(c){let i=c.length;if(i<=Pr)return String.fromCharCode.apply(String,c);let s="",l=0;for(;l<i;)s+=String.fromCharCode.apply(String,c.slice(l,l+=Pr));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 jr(c,i,s,l,h){Wr(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 Mr(c,i,s,l,h){Wr(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 jr(this,i,s,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeBigUInt64BE=Re(function(i,s=0){return Mr(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 jr(this,i,s,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeBigInt64BE=Re(function(i,s=0){return Mr(this,i,s,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Ur(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 $r(c,i,s,l,h){return i=+i,s=s>>>0,h||Ur(c,i,s,4),e.write(c,i,s,l,23,4),s+4}u.prototype.writeFloatLE=function(i,s,l){return $r(this,i,s,!0,l)},u.prototype.writeFloatBE=function(i,s,l){return $r(this,i,s,!1,l)};function Dr(c,i,s,l,h){return i=+i,s=s>>>0,h||Ur(c,i,s,8),e.write(c,i,s,l,52,8),s+8}u.prototype.writeDoubleLE=function(i,s,l){return Dr(this,i,s,!0,l)},u.prototype.writeDoubleBE=function(i,s,l){return Dr(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 dr(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}`}}}dr("ERR_BUFFER_OUT_OF_BOUNDS",function(c){return c?`${c} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),dr("ERR_INVALID_ARG_TYPE",function(c,i){return`The "${c}" argument must be of type number. Received type ${typeof i}`},TypeError),dr("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=Vr(String(s)):typeof s=="bigint"&&(h=String(s),(s>BigInt(2)**BigInt(32)||s<-(BigInt(2)**BigInt(32)))&&(h=Vr(h)),h+="n"),l+=` It must be ${i}. Received ${h}`,l},RangeError);function Vr(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 Wr(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 fr(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 qr(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 he(c,i){return c instanceof i||c!=null&&c.constructor!=null&&c.constructor.name!=null&&c.constructor.name===i.name}function mr(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,Xt,li,je,pi,fi=ot(()=>{"use strict";p();f();d();At={},ci=!1;Xt={},li=!1;je={},pi=!1});var Me,b,Kc,Qc,mi=ot(()=>{"use strict";p();f();d();fi();Me=di();Me.Buffer;Me.SlowBuffer;Me.INSPECT_MAX_BYTES;Me.kMaxLength;b=Me.Buffer,Kc=Me.INSPECT_MAX_BYTES,Qc=Me.kMaxLength});var f=ot(()=>{"use strict";mi()});var Uc={};pe(Uc,{DynamicSnippetsGenerator:()=>pr});module.exports=xs(Uc);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 _s=typeof global=="object"&&global&&global.Object===Object&&global,hi=_s;var Ts=typeof self=="object"&&self&&self.Object===Object&&self,ks=hi||Ts||Function("return this")(),yi=ks;var Es=yi.Symbol,_e=Es;p();f();d();var gi=Object.prototype,Is=gi.hasOwnProperty,As=gi.toString,Rt=_e?_e.toStringTag:void 0;function Rs(n){var e=Is.call(n,Rt),t=n[Rt];try{n[Rt]=void 0;var r=!0}catch{}var a=As.call(n);return r&&(e?n[Rt]=t:delete n[Rt]),a}var xi=Rs;p();f();d();var Ss=Object.prototype,Ns=Ss.toString;function Cs(n){return Ns.call(n)}var vi=Cs;var Fs="[object Null]",Bs="[object Undefined]",bi=_e?_e.toStringTag:void 0;function Os(n){return n==null?n===void 0?Bs:Fs:bi&&bi in Object(n)?xi(n):vi(n)}var wi=Os;p();f();d();function Ls(n){return n!=null&&typeof n=="object"}var _i=Ls;var Ps="[object Symbol]";function js(n){return typeof n=="symbol"||_i(n)&&wi(n)==Ps}var Ti=js;p();f();d();p();f();d();function Ms(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=Ms;p();f();d();var Us=Array.isArray,Ei=Us;var $s=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==-$s?"-0":e}var Si=Ri;p();f();d();function Ds(n){return n==null?"":Si(n)}var Ne=Ds;p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();function Vs(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=Vs;function Ws(n,e,t){var r=n.length;return t=t===void 0?r:t,!e&&t>=r?n:Ni(n,e,t)}var Ci=Ws;p();f();d();var qs="\\ud800-\\udfff",zs="\\u0300-\\u036f",Zs="\\ufe20-\\ufe2f",Gs="\\u20d0-\\u20ff",Hs=zs+Zs+Gs,Js="\\ufe0e\\ufe0f",Ys="\\u200d",Xs=RegExp("["+Ys+qs+Hs+Js+"]");function Ks(n){return Xs.test(n)}var Kt=Ks;p();f();d();p();f();d();function Qs(n){return n.split("")}var Fi=Qs;p();f();d();var Bi="\\ud800-\\udfff",eo="\\u0300-\\u036f",to="\\ufe20-\\ufe2f",ro="\\u20d0-\\u20ff",no=eo+to+ro,io="\\ufe0e\\ufe0f",ao="["+Bi+"]",xr="["+no+"]",vr="\\ud83c[\\udffb-\\udfff]",so="(?:"+xr+"|"+vr+")",Oi="[^"+Bi+"]",Li="(?:\\ud83c[\\udde6-\\uddff]){2}",Pi="[\\ud800-\\udbff][\\udc00-\\udfff]",oo="\\u200d",ji=so+"?",Mi="["+io+"]?",uo="(?:"+oo+"(?:"+[Oi,Li,Pi].join("|")+")"+Mi+ji+")*",co=Mi+ji+uo,lo="(?:"+[Oi+xr+"?",xr,Li,Pi,ao].join("|")+")",po=RegExp(vr+"(?="+vr+")|"+lo+co,"g");function fo(n){return n.match(po)||[]}var Ui=fo;function mo(n){return Kt(n)?Ui(n):Fi(n)}var $i=mo;function ho(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=ho;var yo=Di("toUpperCase"),Ue=yo;function go(n){return Ue(Ne(n).toLowerCase())}var Vi=go;p();f();d();p();f();d();function xo(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=xo;p();f();d();p();f();d();p();f();d();function vo(n){return function(e){return n?.[e]}}var qi=vo;var bo={\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"},wo=qi(bo),zi=wo;var _o=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,To="\\u0300-\\u036f",ko="\\ufe20-\\ufe2f",Eo="\\u20d0-\\u20ff",Io=To+ko+Eo,Ao="["+Io+"]",Ro=RegExp(Ao,"g");function So(n){return n=Ne(n),n&&n.replace(_o,zi).replace(Ro,"")}var Zi=So;p();f();d();p();f();d();var No=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Co(n){return n.match(No)||[]}var Gi=Co;p();f();d();var Fo=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function Bo(n){return Fo.test(n)}var Hi=Bo;p();f();d();var Qi="\\ud800-\\udfff",Oo="\\u0300-\\u036f",Lo="\\ufe20-\\ufe2f",Po="\\u20d0-\\u20ff",jo=Oo+Lo+Po,ea="\\u2700-\\u27bf",ta="a-z\\xdf-\\xf6\\xf8-\\xff",Mo="\\xac\\xb1\\xd7\\xf7",Uo="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",$o="\\u2000-\\u206f",Do=" \\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",Vo="\\ufe0e\\ufe0f",na=Mo+Uo+$o+Do,ia="['\u2019]",Ji="["+na+"]",Wo="["+jo+"]",aa="\\d+",qo="["+ea+"]",sa="["+ta+"]",oa="[^"+Qi+na+aa+ea+ta+ra+"]",zo="\\ud83c[\\udffb-\\udfff]",Zo="(?:"+Wo+"|"+zo+")",Go="[^"+Qi+"]",ua="(?:\\ud83c[\\udde6-\\uddff]){2}",ca="[\\ud800-\\udbff][\\udc00-\\udfff]",ct="["+ra+"]",Ho="\\u200d",Yi="(?:"+sa+"|"+oa+")",Jo="(?:"+ct+"|"+oa+")",Xi="(?:"+ia+"(?:d|ll|m|re|s|t|ve))?",Ki="(?:"+ia+"(?:D|LL|M|RE|S|T|VE))?",la=Zo+"?",pa="["+Vo+"]?",Yo="(?:"+Ho+"(?:"+[Go,ua,ca].join("|")+")"+pa+la+")*",Xo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ko="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Qo=pa+la+Yo,eu="(?:"+[qo,ua,ca].join("|")+")"+Qo,tu=RegExp([ct+"?"+sa+"+"+Xi+"(?="+[Ji,ct,"$"].join("|")+")",Jo+"+"+Ki+"(?="+[Ji,ct+Yi,"$"].join("|")+")",ct+"?"+Yi+"+"+Xi,ct+"+"+Ki,Ko,Xo,aa,eu].join("|"),"g");function ru(n){return n.match(tu)||[]}var da=ru;function nu(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=nu;var iu="['\u2019]",au=RegExp(iu,"g");function su(n){return function(e){return Wi(fa(Zi(e).replace(au,"")),n,"")}}var ma=su;var ou=ma(function(n,e,t){return e=e.toLowerCase(),n+(t?Vi(e):e)}),St=ou;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",br=["single","multiline","box"].includes(Ct)?Ct:"single";ye&&(Error.stackTraceLimit=50);var uu=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),cu=new Set(["stacktrace"]);function er({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,...uu],t=[...t,...cu],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 Qt=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;er({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}},wr;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&&(wr??(wr=new Qt({maxFrames:n,skip:e,filterPaths:t,filterFunctions:r,stopOn:a,filterNode:o,filterJs:u,multiline:m,formatFilename:x})))}function ya(n){wr?.tag(n)}function _r(n){return wr?.frames(n)??[]}var $e=class{constructor(){ya(this)}};p();f();d();var tr=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 tr{async format(e){return e}formatSync(e){return e}};p();f();d();p();f();d();p();f();d();var de=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 lu=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
- `:"")}write(...t){for(let e of t)if(e!=null)if(typeof e=="string"){let i=e.length>0&&e.endsWith(`
7
- `),p=i?e.substring(0,e.length-1):e,d=this.getIndentString(),u=p.replaceAll(`
6
+ `:"")}write(...e){for(let t of e)if(t!=null)if(typeof t=="string"){let r=t.length>0&&t.endsWith(`
7
+ `),a=r?t.substring(0,t.length-1):t,o=this.getIndentString(),u=a.replaceAll(`
8
8
  `,`
9
- ${d}`);this.isAtStartOfLine()&&(u=d+u),i&&(u+=`
10
- `),this.writeInternal(u)}else this.writeNode(e)}writeStatement(...t){this.write(...t),this.write(";"),this.writeNewLineIfLastLineNot()}writeNoIndent(t){let e=this.indentLevel;this.indentLevel=0,this.write(t),this.indentLevel=e}writeNode(t){X&&this.nodeStackFrames.push(...mt(t)),t.write(this),X&&ft!=="single"&&this.writeInternal(`
11
- `)}writeNodeOrString(t){if(typeof t=="string"){this.write(t);return}this.writeNode(t)}writeNodeStatement(t){this.writeNode(t),this.write(";"),this.writeNewLineIfLastLineNot()}writeTextStatement(t){new Y(t).write(this),t.endsWith(";")||this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(t,e){new Y(t).write(this),this.write(" (",e,")"),this.pushScope()}controlFlowWithoutStatement(t){new Y(t).write(this),this.pushScope()}endControlFlow(){this.popScope()}contiguousControlFlow(t,e){this.dedent(),this.write("} "),new Y(t).write(this),this.write(" (",e,")"),this.pushScope()}alternativeControlFlow(t){this.dedent(),this.write("} "),new Y(t).write(this),this.pushScope()}pushScope(){this.writeLine("{"),this.indent()}popScope(t=!0){this.dedent(),this.writeNewLineIfLastLineNot(),t?this.writeLine("}"):this.write("}")}writeLine(...t){this.write(...t.length===0?[""]:t),this.writeNewLineIfLastLineNot()}newLine(){this.writeInternal(`
9
+ ${o}`);this.isAtStartOfLine()&&(u=o+u),r&&(u+=`
10
+ `),this.writeInternal(u)}else this.writeNode(t)}writeStatement(...e){this.write(...e),this.write(";"),this.writeNewLineIfLastLineNot()}writeNoIndent(e){let t=this.indentLevel;this.indentLevel=0,this.write(e),this.indentLevel=t}writeNode(e){ye&&this.nodeStackFrames.push(..._r(e)),e.write(this),ye&&br!=="single"&&this.writeInternal(`
11
+ `)}writeNodeOrString(e){if(typeof e=="string"){this.write(e);return}this.writeNode(e)}writeNodeStatement(e){this.writeNode(e),this.write(";"),this.writeNewLineIfLastLineNot()}writeTextStatement(e){new de(e).write(this),e.endsWith(";")||this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(e,t){new de(e).write(this),this.write(" (",t,")"),this.pushScope()}controlFlowWithoutStatement(e){new de(e).write(this),this.pushScope()}endControlFlow(){this.popScope()}contiguousControlFlow(e,t){this.dedent(),this.write("} "),new de(e).write(this),this.write(" (",t,")"),this.pushScope()}alternativeControlFlow(e){this.dedent(),this.write("} "),new de(e).write(this),this.pushScope()}pushScope(){this.writeLine("{"),this.indent()}popScope(e=!0){this.dedent(),this.writeNewLineIfLastLineNot(),e?this.writeLine("}"):this.write("}")}writeLine(...e){this.write(...e.length===0?[""]:e),this.writeNewLineIfLastLineNot()}newLine(){this.writeInternal(`
12
12
  `)}writeSemicolonIfLastCharacterIsNot(){this.lastCharacterIsSemicolon||this.writeInternal(";")}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
13
- `)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:t,delimiter:e,writeFunction:i}){if(t.length>0){let p=t[0];p!=null&&i(p);for(let d=1;d<t.length;d++){this.write(e);let u=t[d];u!=null&&i(u)}}}toString(){return this.buffer}writeInternal(t){if(t.length===0)return;let e=!this.lastCharacterIsNewline;this.hasWrittenAnything=!0,this.lastCharacterIsNewline=t.endsWith(`
14
- `),this.lastCharacterIsSemicolon=t.endsWith(";");let i=t.split(`
15
- `),p=X&&!this.shouldSkipTracking(i)&&this.lastCharacterIsNewline;e&&(this.lastLine=`${this.lastLine}${i.shift()||""}`),this.lastCharacterIsNewline&&i.pop(),this.lineBuffer.push(...i),p&&this.appendTrackingComment()}set lastLine(t){this.lineBuffer.length>0?this.lineBuffer[this.lineBuffer.length-1]=t:this.lineBuffer.push(t)}get lastLine(){return this.lineBuffer[this.lineBuffer.length-1]||""}shouldSkipTracking(t){return!1}formatStack(t,e=""){return t.map(i=>`${e?`(${e}) `:""} ${i.fn} - ${i.path} : ${i.position}`)}filterStack(t){return t.filter(e=>!e.fn.startsWith(`${this.constructor.name}.`))}appendTrackingComment(){let t=[...this.formatStack(this.filterStack(Ke({maxFrames:15,skip:3}))),...this.formatStack(this.filterStack(this.nodeStackFrames),"node")];switch(this.nodeStackFrames.length=0,ft){case"single":return this.singleLineTrackingComment(t);case"multiline":return this.multiLineTrackingComment(t);case"box":return this.boxTrackingComment(t)}}singleLineTrackingComment(t){this.lastLine=`${this.lastLine} // ${t.join(" ")}`}multiLineTrackingComment(t){this.lineBuffer.push(...t.map(e=>` // ${e}`))}boxTrackingComment(t){this.lineBuffer.push("/*",...t.map(e=>` ${e}`),"*/")}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*this.getTabSize())}getTabSize(){return $a}};l();f();c();l();f();c();l();f();c();var Oe=class{constructor(){v(this,"reporter");v(this,"snippet");v(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:t,snippet:e}){this.shouldUpdate({snippet:e,reporter:t.errors})&&(this.reporter=t.errors.clone(),this.snippet=e)}getResponseOrThrow({endpoint:t}){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 "${t.method} ${t.path}"`)}shouldUpdate({snippet:t,reporter:e}){return this.reporter==null||this.reporter.size()>0&&e.size()===0?!0:t.length>(this.snippet?.length??0)}};var Ue=class{constructor(t){v(this,"context");this.context=t}async generate(t,e={}){let i=this.resolveEndpoints({request:t,options:e});if(i.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let p=new Oe;for(let d of i){let u=this.context.clone(),E=this.createSnippetGenerator(u);try{let I=await E.generateSnippet({endpoint:d,request:t,options:e});if(u.errors.empty())return{snippet:I,errors:void 0};p.update({context:u,snippet:I})}catch(I){p.err==null&&(p.err=I)}}return p.getResponseOrThrow({endpoint:t.endpoint})}async generateSnippetAst(t,e={}){let i=this.resolveEndpoints({request:t,options:e});if(i.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let p;for(let d of i){let u=this.context.clone(),E=this.createSnippetGenerator(u);try{return await E.generateSnippetAst({endpoint:d,request:t,options:e})}catch(I){p=I}}throw p??new Error(`Failed to generate snippet AST for endpoint: ${t.endpoint.method} ${t.endpoint.path}`)}generateSync(t,e={}){let i=this.resolveEndpoints({request:t,options:e});if(i.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let p=new Oe;for(let d of i){let u=this.context.clone(),E=this.createSnippetGenerator(u);try{let I=E.generateSnippetSync({endpoint:d,request:t,options:e});if(u.errors.empty())return{snippet:I,errors:void 0};p.update({context:u,snippet:I})}catch(I){p.err==null&&(p.err=I)}}return p.getResponseOrThrow({endpoint:t.endpoint})}resolveEndpoints({request:t,options:e}){if(e.endpointId!=null){let i=this.context.resolveEndpointById(e.endpointId);if(i==null)throw new Error(`No endpoint found with ID "${e.endpointId}"`);return[i]}return this.context.resolveEndpointLocationOrThrow(t.endpoint)}};l();f();c();l();f();c();l();f();c();var Me=class{constructor(){v(this,"REFERENCE_REGEX",/^(?:(\w+)::)?(GET|POST|PUT|DELETE|PATCH|HEAD)\s(\/\S*)$/)}validate(t){return this.REFERENCE_REGEX.test(t)?{type:"valid"}:{type:"invalid"}}tryParse(t){if(this.validate(t).type==="invalid")return;let i=t.match(this.REFERENCE_REGEX);if(!(i==null||i[2]==null||i[3]==null))return{namespace:i[1],method:i[2],path:i[3]}}};l();f();c();var B={Critical:"CRITICAL",Warning:"WARNING"},$e=class s{constructor(){v(this,"errors");v(this,"path");this.errors=[],this.path=[]}add(t){this.errors.push({...t,path:[...this.path]})}scope(t){this.path.push(t)}unscope(){this.path.pop()}getBySeverity(t){return this.errors.filter(e=>e.severity===t)}empty(){return this.errors.length===0}size(){return this.errors.length}truncate(t){this.errors.length=t}clone(){let t=new s;return t.errors=[...this.errors],t.path=[...this.path],t}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(t=>({severity:t.severity,path:t.path!=null?this.pathToStringArray(t.path):void 0,message:t.message}))}pathToStringArray(t){let e=[];for(let i of t){if(typeof i=="string"){e.push(i);continue}e[e.length-1]+=`[${i.index}]`}return e}};var je=class{constructor({ir:t,config:e,options:i={}}){v(this,"config");v(this,"options");v(this,"errors");v(this,"_ir");v(this,"httpEndpointReferenceParser");this._ir=t,this.config=e,this.options=i,this.errors=new $e,this.httpEndpointReferenceParser=new Me}associateQueryParametersByWireValue({parameters:t,values:e}){let i=[];for(let[p,d]of Object.entries(e))if(d!==void 0){this.errors.scope(p);try{let u=t.find(I=>I.name.wireValue===p);if(u==null)throw this.newParameterNotRecognizedError(p);let E=this.isListTypeReference(u.typeReference)&&!Array.isArray(d)?[d]:d;i.push({name:u.name,typeReference:u.typeReference,value:E})}finally{this.errors.unscope()}}return i}associateByWireValueOrDefault({parameters:t,values:e}){let i=[];for(let p of t){this.errors.scope(p.name.wireValue);try{let d=e[p.name.wireValue];if(d==null)if(p.typeReference.type==="primitive"&&p.typeReference.value==="STRING")d=`<${p.name.wireValue}>`;else{this.errors.add({severity:B.Critical,message:this.newParameterNotRecognizedError(p.name.wireValue).message});continue}i.push({name:p.name,typeReference:p.typeReference,value:d})}finally{this.errors.unscope()}}return i}associateByWireValue({parameters:t,values:e,ignoreMissingParameters:i}){let p=[],d=new Set;for(let u of t){let E=u.name.wireValue,I=e[E];if(I!==void 0){d.add(E),this.errors.scope(E);try{p.push({name:u.name,typeReference:u.typeReference,value:I})}finally{this.errors.unscope()}}}if(!i){for(let[u,E]of Object.entries(e))if(!(E===void 0||d.has(u))){this.errors.scope(u);try{this.errors.add({severity:B.Critical,message:this.newParameterNotRecognizedError(u).message})}finally{this.errors.unscope()}}}return p}getExampleObjectProperties({parameters:t,snippetObject:e}){let i=typeof e=="object"&&e!==null&&!Array.isArray(e)?e:{},p=[];for(let d of t){let u=i[d.name.wireValue];u==null?d.typeReference.type==="nullable"&&p.push({name:d.name,typeReference:d.typeReference,value:null}):p.push({name:d.name,typeReference:d.typeReference,value:u})}return p}getSingleFileValue({property:t,record:e}){let i=e[t.wireValue];if(i!=null){if(typeof i!="string"){this.errors.add({severity:B.Critical,message:`Expected file value to be a string, got ${typeof i}`});return}return i}}getFileArrayValues({property:t,record:e}){let i=e[t.wireValue];if(i==null)return;if(!Array.isArray(i)){this.errors.add({severity:B.Critical,message:`Expected file array value to be an array of strings, got ${typeof i}`});return}let p=[];for(let d of i){if(typeof d!="string"){this.errors.add({severity:B.Critical,message:`Expected file array value to be an array of strings, got ${typeof d}`});return}p.push(d)}return p}getRecord(t){if(typeof t!="object"||Array.isArray(t)){this.errors.add({severity:B.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(t)?"array":typeof t}`});return}return t??{}}resolveNamedType({typeId:t}){let e=this._ir.types[t];if(e==null){this.errors.add({severity:B.Critical,message:`Type identified by "${t}" could not be found`});return}return e}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e}){let i=this.getRecord(e);if(i==null)return;let p=t.discriminant.wireValue,d=i[p];if(d==null){this.errors.add({severity:B.Critical,message:this.newParameterNotRecognizedError(p).message});return}if(typeof d!="string"){this.errors.add({severity:B.Critical,message:`Expected discriminant value to be a string but got: ${typeof d}`});return}let u=t.types[d];if(u==null){this.errors.add({severity:B.Critical,message:`No type found for discriminant value "${d}"`});return}let{[p]:E,...I}=i;return{singleDiscriminatedUnionType:u,discriminantValue:u.discriminantValue,value:I}}resolveEndpointOrThrow(t){let e=this.httpEndpointReferenceParser.tryParse(t);if(e==null)throw new Error(`Failed to parse endpoint reference "${t}"`);return this.resolveEndpointLocationOrThrow(e)}resolveEndpointLocation(t){let e=[];for(let i of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:i,parsedEndpoint:t})&&e.push(i);return e}resolveEndpointLocationOrThrow(t){let e=this.resolveEndpointLocation(t);if(e.length===0)throw new Error(`Failed to find endpoint identified by "${t.method} ${t.path}"`);return e}resolveEndpointById(t){return this._ir.endpoints[t]}resolveEndpointByIdOrThrow(t){let e=this.resolveEndpointById(t);if(e==null)throw new Error(`Failed to find endpoint with ID "${t}"`);return e}needsRequestParameter({request:t,inlinePathParameters:e,inlineFileProperties:i}){return this.includePathParametersInWrappedRequest({request:t,inlinePathParameters:e})||t.queryParameters!=null&&t.queryParameters.length>0||t.headers!=null&&t.headers.length>0?!0:t.body!=null?this.includeRequestBodyInWrappedRequest({body:t.body,inlineFileProperties:i}):!t.metadata?.onlyPathParameters}includePathParametersInWrappedRequest({request:t,inlinePathParameters:e}){return e&&(t.metadata?.includePathParameters??!1)}isFileUploadRequestBody(t){switch(t.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:P(t)}}resolveEnvironmentName(t){if(this._ir.environments==null)return;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":{let i=e.environments.find(p=>p.id===t);return i?.name}case"multipleBaseUrls":{let i=e.environments.find(p=>p.id===t);return i?.name}default:P(e)}}isSingleEnvironmentID(t){return typeof t=="string"}isMultiEnvironmentValues(t){return typeof t=="object"}validateMultiEnvironmentUrlValues(t){if(this._ir.environments==null)return this.errors.add({severity:B.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":return this.errors.add({severity:B.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let i=e.environments[0];if(i==null)return this.errors.add({severity:B.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let p=new Set(Le(i.urls));for(let d of Le(t))p.has(d)&&p.delete(d);return p.size>0?(this.errors.add({severity:B.Critical,message:`The provided environments are invalid; got: [${Object.keys(t).join(", ")}], expected: [${Le(i.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:t}){if(typeof t!="number"){this.errors.add({severity:B.Critical,message:this.newTypeMismatchError({expected:"number",value:t}).message});return}return t}getValueAsBoolean({value:t}){if(typeof t!="boolean"){this.errors.add({severity:B.Critical,message:this.newTypeMismatchError({expected:"boolean",value:t}).message});return}return t}getValueAsString({value:t}){if(typeof t!="string"){this.errors.add({severity:B.Critical,message:this.newTypeMismatchError({expected:"string",value:t}).message});return}return t}isOptional(t){switch(t.type){case"nullable":return this.isOptional(t.value);case"optional":return!0;case"named":{let e=this.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}isNullable(t){switch(t.type){case"nullable":return!0;case"optional":return this.isNullable(t.value);case"named":{let e=this.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}newAuthMismatchError({auth:t,values:e}){return new Error(`Expected auth type ${t.type}, got ${e.type}`)}newParameterNotRecognizedError(t){return new Error(`"${t}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:t,value:e}){return new Error(`Expected ${t}, got ${typeof e}`)}includeRequestBodyInWrappedRequest({body:t,inlineFileProperties:e}){switch(t.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:t,inlineFileProperties:e});default:P(t)}}includeFileUploadBodyInWrappedRequest({fileUpload:t,inlineFileProperties:e}){return this.fileUploadHasBodyProperties({fileUpload:t})||e&&this.fileUploadHasFileProperties({fileUpload:t})}fileUploadHasBodyProperties({fileUpload:t}){return t.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:P(e)}})}fileUploadHasFileProperties({fileUpload:t}){return t.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:P(e)}})}isListTypeReference(t){return t.type==="optional"?this.isListTypeReference(t.value):t.type==="list"||t.type==="set"}parsedEndpointMatches({endpoint:t,parsedEndpoint:e}){return t.location.method===e.method&&t.location.path===e.path}};l();f();c();var J={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};l();f();c();l();f();c();l();f();c();l();f();c();l();f();c();l();f();c();var we=class extends Pe{constructor({customConfig:e,formatter:i}){super();v(this,"customConfig");v(this,"formatter");v(this,"imports",{});v(this,"defaultImports",{});v(this,"starImportAliases",{});v(this,"starImportAliasesInverse",{});this.customConfig=e,this.formatter=i??new ke}addImport(e){var i,p;if(e.importFrom!=null){switch(e.importFrom.type){case"default":{this.validateDefault(e);break}case"named":{this.validateNamed(e);break}case"star":{this.validateStar(e);break}}let d=(i=this.imports)[p=e.importFrom.moduleName]??(i[p]=[]);d.map(E=>E.name).includes(e.name)||d.push(e)}}validateDefault(e){var p,d;if(e.importFrom?.type!=="default")return;let i=(p=this.defaultImports)[d=e.importFrom.moduleName]??(p[d]=e);if(i.name!==e.name)throw new Error(`Cannot have multiple default imports for module ${e.importFrom.moduleName}: got ${e.name} but already had ${i.name}`)}validateNamed(e){if(e.importFrom?.type!=="named")return;let p=(this.imports[e.importFrom.moduleName]??[]).filter(u=>u.importFrom?.type==="star");if(p.length>0)throw new Error(`Cannot add named import ${e.name} because non-named imports ${p.map(u=>u.name)} already exist`);let d=[];for(let u of Object.values(this.imports))for(let E of u)E.importFrom?.type==="named"&&E.importFrom.moduleName!==e.importFrom.moduleName&&E.name===e.name&&d.push(E);if(d.length>0)throw new Error(`Cannot add named import from module ${e.importFrom.moduleName} because it is already imported from ${d[0]?.importFrom?.moduleName}`)}validateStar(e){var d,u,E,I;if(e.importFrom?.type!=="star")return;let i=(d=this.starImportAliases)[u=e.importFrom.moduleName]??(d[u]=e.importFrom.starImportAlias);if(i!==e.importFrom.starImportAlias)throw new Error(`Cannot have more than one alias for non-named imports from a module: got ${e.importFrom.starImportAlias} but already have ${i}.`);if(((E=this.starImportAliasesInverse)[I=e.importFrom.starImportAlias]??(E[I]=e.importFrom.moduleName))!==e.importFrom.moduleName)throw new Error(`Attempted to use alias ${e.importFrom.starImportAlias} for more than one module in the same file`)}};var _e=class extends we{constructor({customConfig:t,formatter:e}){super({customConfig:t,formatter:e})}async toStringAsync(){let t=this.getContent();if(this.formatter!=null)try{return this.formatter.format(t)}catch(e){throw new Error(`Failed to format TypeScript file: ${e}
16
- ${t}`)}return t}toString(){let t=this.getContent();if(this.formatter!=null)try{return this.formatter.formatSync(t)}catch(e){throw new Error(`Failed to format TypeScript file: ${e}
17
- ${t}`)}return t}getContent(){let t=this.stringifyImports();return t.length>0?t+`
18
- `+this.buffer:this.buffer}stringifyImports(){let t="";for(let[e,i]of Object.entries(this.imports)){let p=this.defaultImports[e],d="",u=i.filter(I=>I.importFrom?.type==="named"),E=this.starImportAliases[e];if(u.length>0||p!=null||E!=null){if(t+="import",p!=null&&(t+=` ${p.name}`),u.length>0){for(let F of u.slice(0,-1))d+=`${F.name}, `;let I=u[u.length-1];I!=null&&(d+=`${I.name}`),p!=null&&(t+=","),t+=` { ${d} }`}E!=null&&((p!=null||u.length>0)&&(t+=", "),t+=` * as ${E}`),t+=` from "${e}";
19
- `}}return t}};var k=class extends ce{async toStringAsync({customConfig:t,formatter:e}){let i=new _e({customConfig:t,formatter:e});return this.write(i),await i.toStringAsync()}toString({customConfig:t,formatter:e}){let i=new _e({customConfig:t,formatter:e});return this.write(i),i.toString()}};var b={};K(b,{AstNode:()=>k,ClassInstantiation:()=>ve,CodeBlock:()=>be,Comment:()=>ae,Function:()=>Ee,FunctionInvocation:()=>Ie,MethodInvocation:()=>Te,Parameter:()=>Ae,Reference:()=>de,Type:()=>fe,TypeLiteral:()=>re,Types:()=>fe,Variable:()=>Re,Writer:()=>we,codeblock:()=>Va,function_:()=>qa,instantiateClass:()=>Ga,invokeFunction:()=>za,invokeMethod:()=>Ha,parameter:()=>Ya,reference:()=>Ja,variable:()=>Za});l();f();c();l();f();c();l();f();c();var ve=class extends k{constructor({class_:e,arguments_:i}){super();v(this,"class_");v(this,"arguments_");this.class_=e,this.arguments_=i}write(e){e.write("new "),e.writeNode(this.class_),e.write("("),e.delimit({nodes:this.arguments_,delimiter:", ",writeFunction:i=>i.write(e)}),e.write(")")}};l();f();c();var be=class extends k{constructor(e){super();v(this,"args");this.args=e}write(e){return new Y(this.args).write(e)}};l();f();c();var ae=class extends k{constructor({docs:e}={docs:void 0}){super();v(this,"docs");this.docs=e}write(e){this.docs!=null&&(e.writeLine("/**"),this.docs.split(`
20
- `).forEach(i=>{e.writeLine(` * ${i}`)}),e.writeLine("*/"))}};l();f();c();l();f();c();var fe=class extends k{constructor(e){super();v(this,"internalType");this.internalType=e}write(e){switch(this.internalType.type){case"string":e.write("string");break;case"number":e.write("number");break;case"bigint":e.write("bigint");break;case"boolean":e.write("boolean");break;case"array":this.internalType.valueType.write(e),e.write("[]");break;case"map":e.write("Record<"),this.internalType.keyType.write(e),e.write(", "),this.internalType.valueType.write(e),e.write(">");break;case"object":e.write("{"),e.indent();for(let[i,p]of Object.entries(this.internalType.fields))e.write(`${i}: `),p.write(e),e.writeLine(",");e.dedent(),e.write("}");break;case"enum":e.write("enum");break;case"any":e.write("any");break;case"promise":e.write("Promise<"),this.internalType.value.write(e),e.write(">");break;case"unknown":e.write("unknown");break;case"void":e.write("void");break;case"undefined":e.write("undefined");break;case"null":e.write("null");break;case"never":e.write("never");break;case"nop":break;default:P(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(e){return new this({type:"array",valueType:e})}static object(e){return new this({type:"object",fields:e})}static enum(e){return new this({type:"enum",values:e})}static any(){return new this({type:"any"})}static promise(e){return e.internalType.type==="promise"?e:new this({type:"promise",value:e})}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 Ee=class extends k{constructor({name:e,parameters:i,async:p,body:d,return_:u,docs:E}){super();v(this,"name");v(this,"parameters");v(this,"async");v(this,"body");v(this,"return_");v(this,"docs");this.name=e,this.parameters=i,this.async=p??!1,this.body=d,this.return_=u,this.docs=E}write(e){e.writeNode(new ae({docs:this.docs})),this.async&&e.write("async "),e.write("function "),e.write(`${this.name}`),this.writeParameters(e),this.return_!=null&&(e.write(": "),e.writeNode(this.async?fe.promise(this.return_):this.return_)),e.writeLine(" {"),e.indent(),this.body?.write(e),e.dedent(),e.writeNewLineIfLastLineNot(),e.writeLine("}")}writeParameters(e){if(this.parameters.length===0){e.write("()");return}e.indent(),e.writeLine("(");for(let i of this.parameters)e.writeNode(i),e.writeLine(",");e.dedent(),e.write(")")}};l();f();c();var Ie=class extends k{constructor({function_:e,arguments_:i}){super();v(this,"function_");v(this,"arguments_");this.function_=e,this.arguments_=i}write(e){e.writeNode(this.function_),e.write("("),e.delimit({nodes:this.arguments_,delimiter:", ",writeFunction:i=>i.write(e)}),e.write(")")}};l();f();c();var Te=class extends k{constructor({on:e,method:i,arguments_:p,async:d}){super();v(this,"on");v(this,"method");v(this,"arguments_");v(this,"async");this.on=e,this.method=i,this.arguments_=p,this.async=d}write(e){this.async&&e.write("await "),this.on.write(e),e.write("."),e.write(this.method),e.write("("),e.delimit({nodes:this.arguments_,delimiter:", ",writeFunction:i=>i.write(e)}),e.write(")")}};l();f();c();var Ae=class extends k{constructor({name:e,type:i,docs:p}){super();v(this,"name");v(this,"type");v(this,"docs");this.name=e,this.type=i,this.docs=p}write(e){this.docs!=null&&e.writeNode(new ae({docs:this.docs})),e.write(`${this.name}: `),this.type.write(e)}};l();f();c();var de=class extends k{constructor({name:e,importFrom:i,memberName:p}){super();v(this,"name");v(this,"importFrom");v(this,"memberName");this.name=e,this.importFrom=i,this.memberName=p}write(e){this.importFrom!=null&&e.addImport(this);let i=this.importFrom?.type==="star"?`${this.importFrom.starImportAlias}.`:"",p=this.memberName!=null?`.${this.memberName}`:"";e.write(`${i}${this.name}${p}`)}};l();f();c();var re=class s extends k{constructor(e){super();v(this,"internalType");this.internalType=e}write(e){let i=!!e.customConfig?.noSerdeLayer,p=!!e.customConfig?.useBigInt;switch(this.internalType.type){case"array":{this.writeIterable({writer:e,iterable:this.internalType});break}case"blob":{if(i){e.writeNode(s.string(this.internalType.value));return}e.write("new Blob(["),e.writeNode(s.string(this.internalType.value)),e.write("])");break}case"boolean":{e.write(this.internalType.value.toString());break}case"bigint":{if(p){e.write(`BigInt("${this.internalType.value.toString()}")`);return}e.write(`"${this.internalType.value.toString()}"`);return}case"datetime":{if(i){e.writeNode(s.string(this.internalType.value));return}e.write("new Date("),e.writeNode(s.string(this.internalType.value)),e.write(")");break}case"number":{e.write(this.internalType.value.toString());break}case"object":{this.writeObject({writer:e,object:this.internalType});break}case"record":{this.writeRecord({writer:e,record:this.internalType});break}case"reference":{e.writeNode(this.internalType.value);break}case"set":{if(i||this.isSetOfObjects()){e.writeNode(s.array({values:this.internalType.values}));return}e.write("new Set("),this.writeIterable({writer:e,iterable:this.internalType}),e.write(")");break}case"string":{this.internalType.value.includes(`
21
- `)?this.writeStringWithBackticks({writer:e,value:this.internalType.value}):e.write(`"${this.internalType.value.replaceAll('"','\\"')}"`);break}case"tuple":{this.writeIterable({writer:e,iterable:this.internalType});break}case"unknown":{this.writeUnknown({writer:e,value:this.internalType.value});break}case"null":{e.write("null");break}case"nop":break;default:P(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(e=>e.isObject())}writeStringWithBackticks({writer:e,value:i}){e.write("`");let p=i.split(`
22
- `),d=p[0]+`
23
- `,u=p.slice(1).join(`
24
- `);e.write(d.replaceAll("`","\\`")),e.writeNoIndent(u.replaceAll("`","\\`")),e.write("`")}writeIterable({writer:e,iterable:i}){let p=Da({values:i.values});if(p.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let d of p)d.write(e),e.writeLine(",");e.dedent(),e.write("]")}writeRecord({writer:e,record:i}){let p=_a({entries:i.entries});if(p.length===0){e.write("{}");return}e.writeLine("{"),e.indent();for(let d of p)d.key.write(e),e.write(": "),d.value.write(e),e.writeLine(",");e.dedent(),e.write("}")}writeObject({writer:e,object:i}){let p=ja({fields:i.fields});if(p.length===0){e.write("{}");return}e.writeLine("{"),e.indent();for(let d of p)e.write(`${d.name}: `),d.value.write(e),e.writeLine(",");e.dedent(),e.write("}")}static array({values:e}){return new this({type:"array",values:e})}static bigint(e){return new this({type:"bigint",value:e})}static blob(e){return new this({type:"blob",value:e})}static boolean(e){return new this({type:"boolean",value:e})}static datetime(e){return new this({type:"datetime",value:e})}static number(e){return new this({type:"number",value:e})}static object({fields:e}){return new this({type:"object",fields:e})}static record({entries:e}){return new this({type:"record",entries:e})}static reference(e){return new this({type:"reference",value:e})}static set({values:e}){return new this({type:"set",values:e})}static string(e){return new this({type:"string",value:e})}static tuple({values:e}){return new this({type:"tuple",values:e})}static unknown(e){return new this({type:"unknown",value:e})}static null(){return new this({type:"null"})}static nop(){return new this({type:"nop"})}static isNop(e){return e.internalType.type==="nop"}writeUnknown({writer:e,value:i}){switch(typeof i){case"boolean":e.write(i.toString());return;case"string":e.write(i.includes('"')?`\`${i}\``:`"${i}"`);return;case"number":e.write(i.toString());return;case"object":if(i==null){e.write("null");return}if(Array.isArray(i)){this.writeUnknownArray({writer:e,value:i});return}this.writeUnknownObject({writer:e,value:i});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof i}`)}}writeUnknownArray({writer:e,value:i}){if(i.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let p of i)e.writeNode(s.unknown(p)),e.writeLine(",");e.dedent(),e.write("]")}writeUnknownObject({writer:e,value:i}){let p=Object.entries(i);if(p.length===0){e.write("{}");return}e.writeLine("{"),e.indent();for(let[d,u]of p)e.write(`${d}: `),e.writeNode(s.unknown(u)),e.writeLine(",");e.dedent(),e.write("}")}};function ja({fields:s}){return s.filter(t=>!re.isNop(t.value))}function _a({entries:s}){return s.filter(t=>!re.isNop(t.key)&&!re.isNop(t.value))}function Da({values:s}){return s.filter(t=>!re.isNop(t))}l();f();c();var Re=class extends k{constructor(e){super();v(this,"args");this.args=e}write(e){this.args.export&&e.write("export "),this.args.const?e.write("const "):e.write("let "),e.write(`${this.args.name} = `),e.writeNode(this.args.initializer)}};function Va(s){return new be(s)}function qa(s){return new Ee(s)}function Ga(s){return new ve(s)}function za(s){return new Ie(s)}function Ha(s){return new Te(s)}function Ya(s){return new Ae(s)}function Ja(s){return new de(s)}function Za(s){return new Re(s)}l();f();c();l();f();c();function si({generatorConfig:s,isPackagePrivate:t}){let e=s.output.mode;switch(e.type){case"downloadFiles":return;case"publish":return{packageName:e.registriesV2.npm.packageName,version:e.version,private:t,publishInfo:{registryUrl:e.registriesV2.npm.registryUrl,token:e.registriesV2.npm.token},license:ai(s.license),repoUrl:void 0};case"github":if(e.publishInfo!=null&&e.publishInfo.type!=="npm")throw new Error(`Expected to receive npm publish info but received ${e.publishInfo.type} instead`);return{packageName:e.publishInfo!=null?e.publishInfo.packageName:"",version:e.version,private:t,publishInfo:void 0,repoUrl:Ka(e.repoUrl),license:ai(s.license)};default:throw new Error(`Encountered unknown output mode: ${e}`)}}function Ka(s){if(s!=null)return s.startsWith("https://github.com/")?`git+${s}`:s.startsWith("ssh://github.com/")?`github:${De(s).replace("ssh://github.com/","")}`:s.startsWith("https://bitbucket.org/")?`bitbucket:${De(s).replace("https://bitbucket.org/","")}`:s.startsWith("ssh://bitbucket.org/")?`bitbucket:${De(s).replace("ssh://bitbucket.org/","")}`:s.startsWith("https://gitlab.com/")?`gitlab:${De(s).replace("https://gitlab.com/","")}`:s.startsWith("ssh://gitlab.com/")?`gitlab:${De(s).replace("ssh://gitlab.com/","")}`:(s.startsWith("git+")||(s=`git+${s}`),s.endsWith(".git")||(s=`${s}.git`),s)}function De(s){return s.endsWith(".git")?s.slice(0,-4):s}function ai(s){return s?._visit({basic:t=>t.id,custom:t=>`See ${t.filename}`,_other:()=>{}})}l();f();c();function ht({organization:s,workspaceName:t,namespaceExport:e,naming:i}){return(typeof i=="string"?i:i?.namespace)??e??`${le(Se(s))}${le(Se(t))}`}function yt({namespaceExport:s,naming:t}){let e=typeof t=="string"?{}:t,i=t!=null?le(Se(s)):s;return{namespace:s,client:e?.client??`${i}Client`,error:e?.error??`${i}Error`,timeoutError:e?.timeoutError??`${i}TimeoutError`,environment:e?.environment??`${i}Environment`,environmentUrls:e?.environmentUrls??`${i}EnvironmentUrls`,version:e?.version??`${i}Version`}}l();f();c();l();f();c();var We={};K(We,{commons:()=>ui,dynamic:()=>vt,generatorExec:()=>Et});l();f();c();l();f();c();var ui={};l();f();c();var vt={};K(vt,{ErrorSeverity:()=>yi,HttpMethod:()=>mi,ObjectPropertyAccess:()=>xi,PrimitiveTypeV1:()=>gi,auth:()=>pi,commons:()=>li,declaration:()=>ci,endpoints:()=>fi,environment:()=>di,http:()=>xt,ir:()=>hi,snippets:()=>gt,types:()=>wt,variables:()=>wi});l();f();c();l();f();c();var pi={};l();f();c();var li={};l();f();c();var ci={};l();f();c();var fi={};l();f();c();var di={};l();f();c();var xt={};K(xt,{HttpMethod:()=>mi});l();f();c();l();f();c();var mi={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD"};var hi={};l();f();c();var gt={};K(gt,{ErrorSeverity:()=>yi});l();f();c();l();f();c();var yi={Critical:"CRITICAL",Warning:"WARNING"};var wt={};K(wt,{ObjectPropertyAccess:()=>xi,PrimitiveTypeV1:()=>gi});l();f();c();l();f();c();var xi={ReadOnly:"READ_ONLY",WriteOnly:"WRITE_ONLY"};l();f();c();var gi={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 wi={};l();f();c();var Et={};K(Et,{LicenseId:()=>vi,config:()=>bt});l();f();c();l();f();c();var bt={};K(bt,{LicenseId:()=>vi});l();f();c();l();f();c();var vi={Mit:"MIT",Apache2:"Apache-2.0"};var Xa="value",Qe=class{constructor({context:t}){v(this,"context");this.context=t}convert(t){let e=t.convertOpts;if(t.value===null)return this.context.isNullable(t.typeReference)?b.TypeLiteral.null():(this.context.errors.add({severity:B.Critical,message:"Expected non-null value, but got null"}),b.TypeLiteral.nop());if(t.value===void 0)return b.TypeLiteral.nop();switch(t.typeReference.type){case"list":return this.convertList({list:t.typeReference.value,value:t.value,convertOpts:e});case"literal":return this.convertLiteral({literalType:t.typeReference.value,value:t.value,convertOpts:e});case"map":return this.convertMap({map:t.typeReference,value:t.value,convertOpts:e});case"named":{let i=this.context.resolveNamedType({typeId:t.typeReference.value});return i==null?b.TypeLiteral.nop():this.convertNamed({named:i,value:t.value,as:t.as,convertOpts:e})}case"optional":return this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as,convertOpts:e});case"nullable":return this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as,convertOpts:e});case"primitive":return this.convertPrimitive({primitive:t.typeReference.value,value:t.value,as:t.as,convertOpts:e});case"set":return this.convertSet({set:t.typeReference.value,value:t.value,convertOpts:e});case"unknown":return this.convertUnknown({value:t.value,convertOpts:e});default:P(t.typeReference)}}convertLiteral({literalType:t,value:e}){switch(t.type){case"boolean":{let i=this.context.getValueAsBoolean({value:e});return i==null?b.TypeLiteral.nop():b.TypeLiteral.boolean(i)}case"string":{let i=this.context.getValueAsString({value:e});return i==null?b.TypeLiteral.nop():b.TypeLiteral.string(i)}default:P(t)}}convertList({list:t,value:e,convertOpts:i}){return Array.isArray(e)?b.TypeLiteral.array({values:e.map((p,d)=>{this.context.errors.scope({index:d});try{return this.convert({typeReference:t,value:p,convertOpts:i})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:B.Critical,message:`Expected array but got: ${typeof e}`}),b.TypeLiteral.nop())}convertSet({set:t,value:e,convertOpts:i}){return Array.isArray(e)?b.TypeLiteral.set({values:e.map((p,d)=>{this.context.errors.scope({index:d});try{return this.convert({typeReference:t,value:p,convertOpts:i})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:B.Critical,message:`Expected array but got: ${typeof e}`}),b.TypeLiteral.nop())}convertMap({map:t,value:e,convertOpts:i}){return typeof e!="object"||e==null?(this.context.errors.add({severity:B.Critical,message:`Expected object but got: ${e==null?"null":typeof e}`}),b.TypeLiteral.nop()):b.TypeLiteral.record({entries:Object.entries(e).map(([p,d])=>{this.context.errors.scope(p);try{return{key:this.convert({typeReference:t.key,value:p,as:"key",convertOpts:i}),value:this.convert({typeReference:t.value,value:d,convertOpts:i})}}finally{this.context.errors.unscope()}})})}convertNamed({named:t,value:e,as:i,convertOpts:p}){switch(t.type){case"alias":return this.context.customConfig?.useBrandedStringAliases?b.TypeLiteral.reference(b.codeblock(d=>{d.writeNode(b.reference({name:this.context.namespaceExport,importFrom:this.context.getModuleImport(),memberName:this.context.getFullyQualifiedReference({declaration:t.declaration})})),d.write("("),d.writeNode(this.convert({typeReference:t.typeReference,value:e,as:i,convertOpts:p})),d.write(")")})):this.convert({typeReference:t.typeReference,value:e,as:i,convertOpts:p});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:t,value:e,convertOpts:p});case"enum":return this.convertEnum({enum_:t,value:e,convertOpts:p});case"object":return this.convertObject({object_:t,value:e,convertOpts:p});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e,convertOpts:p});default:P(t)}}convertDiscriminatedUnion({discriminatedUnion:t,value:e,convertOpts:i}){let p=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e});if(p==null)return b.TypeLiteral.nop();let d=p.singleDiscriminatedUnionType,u=this.convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:p,unionVariant:d,convertOpts:i});if(u==null)return b.TypeLiteral.nop();if(this.context.customConfig?.includeUtilsOnUnionMembers)return b.TypeLiteral.reference(b.codeblock(I=>{I.writeNode(b.invokeMethod({on:b.reference({name:this.context.namespaceExport,importFrom:this.context.getModuleImport(),memberName:this.context.getFullyQualifiedReference({declaration:t.declaration})}),method:this.context.getMethodName(d.discriminantValue.name),arguments_:this.convertDiscriminatedUnionUtilsArgs({discriminatedUnionTypeInstance:p,unionVariant:d,unionProperties:u,convertOpts:i})}))}));let E={name:this.context.getPropertyName(t.discriminant.name),value:b.TypeLiteral.string(d.discriminantValue.wireValue)};return b.TypeLiteral.object({fields:[E,...u]})}convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:t,unionVariant:e,convertOpts:i}){let p=this.getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:e});switch(e.type){case"samePropertiesAsObject":{let d=this.context.resolveNamedType({typeId:e.typeId});if(d==null)return;let u=this.convertNamed({named:d,value:t.value,convertOpts:i});if(!u.isObject()){this.context.errors.add({severity:B.Critical,message:"Internal error; expected union value to be an object"});return}let E=u.asObjectOrThrow();return[...p,...E.fields]}case"singleProperty":try{this.context.errors.scope(e.discriminantValue.wireValue);let d=this.context.getRecord(t.value);return d==null?[...p,{name:Xa,value:this.convert({typeReference:e.typeReference,value:t.value,convertOpts:i})}]:[...p,{name:this.context.getPropertyName(e.discriminantValue.name),value:this.convert({typeReference:e.typeReference,value:d[e.discriminantValue.wireValue],convertOpts:i})}]}finally{this.context.errors.unscope()}case"noProperties":return p;default:P(e)}}convertDiscriminatedUnionUtilsArgs({discriminatedUnionTypeInstance:t,unionVariant:e,unionProperties:i,convertOpts:p}){return e.type==="singleProperty"&&this.context.getRecord(t.value)==null&&i.length===1?[this.convert({typeReference:e.typeReference,value:t.value,convertOpts:p})]:i.length>0?[b.TypeLiteral.object({fields:i})]:[]}getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:e,convertOpts:i}){return this.context.associateByWireValue({parameters:e.properties??[],values:this.context.getRecord(t.value)??{},ignoreMissingParameters:!0}).map(d=>{this.context.errors.scope(d.name.wireValue);try{return{name:this.context.getPropertyName(d.name.name),value:this.convert({...d,convertOpts:i})}}finally{this.context.errors.unscope()}})}convertObject({object_:t,value:e,convertOpts:i}){let p=this.context.associateByWireValue({parameters:this.filterReadWriteProperties(t.properties,i),values:this.context.getRecord(e)??{}});return b.TypeLiteral.object({fields:p.map(d=>{this.context.errors.scope(d.name.wireValue);try{return{name:this.context.getPropertyName(d.name.name),value:this.convert({...d,convertOpts:i})}}finally{this.context.errors.unscope()}})})}filterReadWriteProperties(t,e){return this.context.customConfig?.experimentalGenerateReadWriteOnlyTypes!==!0||typeof e>"u"||(e.isForRequest&&(t=t.filter(i=>i.propertyAccess!==We.dynamic.ObjectPropertyAccess.ReadOnly)),e.isForResponse&&(t=t.filter(i=>i.propertyAccess!==We.dynamic.ObjectPropertyAccess.WriteOnly))),t}convertEnum({enum_:t,value:e}){let i=this.getEnumValue({enum_:t,value:e});return i==null?b.TypeLiteral.nop():b.TypeLiteral.string(i)}getEnumValue({enum_:t,value:e}){if(typeof e!="string"){this.context.errors.add({severity:B.Critical,message:`Expected enum value string, got: ${typeof e}`});return}if(t.values.find(p=>p.wireValue===e)==null){this.context.errors.add({severity:B.Critical,message:`An enum value named "${e}" does not exist in this context`});return}return e}convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e,convertOpts:i}){let p=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e,convertOpts:i});return p??b.TypeLiteral.nop()}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e,convertOpts:i}){for(let p of t.types){let d=this.context.errors.size();try{let u=this.convert({typeReference:p,value:e,convertOpts:i});if(b.TypeLiteral.isNop(u)||this.context.errors.size()>d){this.context.errors.truncate(d);continue}return u}catch{this.context.errors.truncate(d);continue}}this.context.errors.add({severity:B.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof e}" value`})}convertUnknown({value:t,convertOpts:e}){return b.TypeLiteral.unknown(t)}convertPrimitive({primitive:t,value:e,as:i,convertOpts:p}){switch(t){case"INTEGER":case"UINT":{let d=this.getValueAsNumber({value:e,as:i});return d==null?b.TypeLiteral.nop():b.TypeLiteral.number(d)}case"LONG":case"UINT_64":{let d=this.getValueAsNumber({value:e,as:i});return d==null?b.TypeLiteral.nop():this.context.customConfig?.useBigInt?b.TypeLiteral.bigint(BigInt(d)):b.TypeLiteral.number(d)}case"FLOAT":case"DOUBLE":{let d=this.getValueAsNumber({value:e});return d==null?b.TypeLiteral.nop():b.TypeLiteral.number(d)}case"BOOLEAN":{let d=this.getValueAsBoolean({value:e,as:i});return d==null?b.TypeLiteral.nop():b.TypeLiteral.boolean(d)}case"BASE_64":case"DATE":case"UUID":case"STRING":{let d=this.context.getValueAsString({value:e});return d==null?b.TypeLiteral.nop():b.TypeLiteral.string(d)}case"DATE_TIME":case"DATE_TIME_RFC_2822":{let d=this.context.getValueAsString({value:e});return d==null?b.TypeLiteral.nop():b.TypeLiteral.datetime(d)}case"BIG_INTEGER":{let d=this.context.getValueAsString({value:e});return d==null?b.TypeLiteral.nop():this.context.customConfig?.useBigInt?b.TypeLiteral.bigint(BigInt(d)):b.TypeLiteral.string(d)}default:P(t)}}getValueAsNumber({value:t,as:e}){let i=e==="key"&&typeof t=="string"?Number(t):t;return this.context.getValueAsNumber({value:i})}getValueAsBoolean({value:t,as:e}){let i=e==="key"?typeof t=="string"?t==="true":t==="false"?!1:t:t;return this.context.getValueAsBoolean({value:i})}};l();f();c();var et=class{constructor({context:t}){v(this,"context");this.context=t}getFilePropertyInfo({body:t,value:e}){let i={fileFields:[],bodyPropertyFields:[]},p=this.context.getRecord(e)??{};for(let d of t.properties)switch(d.type){case"file":i.fileFields.push({name:this.context.getPropertyName(d.name),value:this.getSingleFileProperty({property:d,record:p})});break;case"fileArray":i.fileFields.push({name:this.context.getPropertyName(d.name),value:this.getArrayFileProperty({property:d,record:p})});break;case"bodyProperty":i.bodyPropertyFields.push({name:this.context.getPropertyName(d.name.name),value:this.getBodyProperty({property:d,record:p})});break;default:P(d)}return i}getSingleFileProperty({property:t,record:e}){let i=this.context.getSingleFileValue({property:t,record:e});return i==null?b.TypeLiteral.nop():b.TypeLiteral.blob(i)}getArrayFileProperty({property:t,record:e}){let i=this.context.getFileArrayValues({property:t,record:e});return i==null?b.TypeLiteral.nop():b.TypeLiteral.array({values:i.map(p=>b.TypeLiteral.blob(p))})}getBodyProperty({property:t,record:e}){let i=e[t.name.wireValue];return i==null?b.TypeLiteral.nop():this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:i})}};var tt=class s extends je{constructor({ir:e,config:i}){super({ir:e,config:i});v(this,"ir");v(this,"customConfig");v(this,"dynamicTypeLiteralMapper");v(this,"filePropertyMapper");v(this,"moduleName");v(this,"namespaceExport");v(this,"resolvedClientName");v(this,"resolvedEnvironmentName");this.ir=e,this.customConfig=i.customConfig!=null?i.customConfig:void 0,this.dynamicTypeLiteralMapper=new Qe({context:this}),this.filePropertyMapper=new et({context:this}),this.moduleName=Qa({config:i,customConfig:this.customConfig}),this.namespaceExport=ht({organization:i.organization,workspaceName:i.workspaceName,namespaceExport:this.customConfig?.namespaceExport,naming:this.customConfig?.naming});let p=yt({namespaceExport:this.namespaceExport,naming:this.customConfig?.naming});this.resolvedClientName=p.client,this.resolvedEnvironmentName=p.environment}clone(){return new s({ir:this.ir,config:this.config})}getModuleImport(){return{type:"named",moduleName:this.moduleName}}getRootClientName(){return this.resolvedClientName}getPropertyName(e){return this.customConfig?.retainOriginalCasing||this.customConfig?.noSerdeLayer?this.formatOriginalPropertyName(e.originalName):e.camelCase.unsafeName}getMethodName(e){return e.camelCase.unsafeName}getTypeName(e){return e.pascalCase.unsafeName}getEnvironmentTypeReferenceFromID(e){let i=this.resolveEnvironmentName(e);if(i!=null)return this.getEnvironmentsTypeReference(i)}getFullyQualifiedReference({declaration:e}){return e.fernFilepath.allParts.length>0?`${e.fernFilepath.allParts.map(i=>i.camelCase.unsafeName).join(".")}.${this.getTypeName(e.name)}`:`${this.getTypeName(e.name)}`}getEnvironmentsTypeReference(e){return b.reference({name:this.resolvedEnvironmentName,importFrom:this.getModuleImport(),memberName:this.getTypeName(e)})}formatOriginalPropertyName(e){return e.includes("-")?`"${e}"`:e}};function Qa({config:s,customConfig:t}){return si({generatorConfig:s,isPackagePrivate:t?.private??!1})?.packageName??s.organization}l();f();c();var bi="client",Ei="main",es={type:"primitive",value:"STRING"},rt=class{constructor({context:t}){v(this,"context");this.context=t}async generateSnippet({endpoint:t,request:e}){return await this.buildCodeBlock({endpoint:t,snippet:e}).toStringAsync({customConfig:this.context.customConfig})}generateSnippetSync({endpoint:t,request:e}){return this.buildCodeBlock({endpoint:t,snippet:e}).toString({customConfig:this.context.customConfig})}async generateSnippetAst({endpoint:t,request:e}){return this.buildCodeBlock({endpoint:t,snippet:e})}buildCodeBlock({endpoint:t,snippet:e}){return b.codeblock(i=>{i.writeNode(b.function_({name:Ei,async:!0,parameters:[],body:b.codeblock(p=>{p.writeNodeStatement(this.constructClient({endpoint:t,snippet:e})),p.writeNodeStatement(this.callMethod({endpoint:t,snippet:e}))})})),i.writeNodeStatement(b.invokeFunction({function_:b.reference({name:Ei}),arguments_:[]}))})}constructClient({endpoint:t,snippet:e}){return b.variable({name:bi,const:!0,initializer:b.instantiateClass({class_:b.reference({name:this.context.getRootClientName(),importFrom:this.context.getModuleImport()}),arguments_:[this.getConstructorArgs({endpoint:t,snippet:e})]})})}getConstructorArgs({endpoint:t,snippet:e}){let i=[],p=this.getConstructorEnvironmentArgs({baseUrl:e.baseURL,environment:e.environment});return p.length>0&&i.push(...p),t.auth!=null&&(e.auth!=null?i.push(...this.getConstructorAuthArgs({auth:t.auth,values:e.auth})):this.context.errors.add({severity:B.Warning,message:`Auth with ${t.auth.type} configuration is required for this endpoint`})),this.context.errors.scope(J.PathParameters),this.context.ir.pathParameters!=null&&i.push(...this.getPathParameters({namedParameters:this.context.ir.pathParameters,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(J.Headers),this.context.ir.headers!=null&&e.headers!=null&&i.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:e.headers})),this.context.errors.unscope(),i.length===0?b.TypeLiteral.nop():b.TypeLiteral.object({fields:i})}getConstructorEnvironmentArgs({baseUrl:t,environment:e}){let i=this.getEnvironmentValue({baseUrl:t,environment:e});return i==null?[]:[{name:"environment",value:i}]}getEnvironmentValue({baseUrl:t,environment:e}){if(t!=null&&e!=null){this.context.errors.add({severity:B.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(t!=null)return b.TypeLiteral.string(t);if(e!=null){if(this.context.isSingleEnvironmentID(e)){let i=this.context.getEnvironmentTypeReferenceFromID(e);if(i==null){this.context.errors.add({severity:B.Warning,message:`Environment ${JSON.stringify(e)} was not found`});return}return b.TypeLiteral.reference(i)}if(this.context.isMultiEnvironmentValues(e))return this.context.validateMultiEnvironmentUrlValues(e)?b.TypeLiteral.object({fields:Object.entries(e).map(([i,p])=>({name:i,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:es,value:p})}))}):void 0}}getConstructorAuthArgs({auth:t,values:e}){switch(t.type){case"basic":return e.type!=="basic"?(this.addAuthMismatchError(t,e),[]):this.getConstructorBasicAuthArg({auth:t,values:e});case"bearer":return e.type!=="bearer"?(this.addAuthMismatchError(t,e),[]):this.getConstructorBearerAuthArgs({auth:t,values:e});case"header":return e.type!=="header"?(this.addAuthMismatchError(t,e),[]):this.getConstructorHeaderAuthArgs({auth:t,values:e});case"oauth":return e.type!=="oauth"?(this.addAuthMismatchError(t,e),[]):this.getConstructorOAuthArgs({auth:t,values:e});case"inferred":return e.type!=="inferred"?(this.addAuthMismatchError(t,e),[]):(this.addWarning("The TypeScript SDK v2 Generator does not support Inferred auth scheme yet"),[]);default:P(t)}}addAuthMismatchError(t,e){this.context.errors.add({severity:B.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message})}addWarning(t){this.context.errors.add({severity:B.Warning,message:t})}getConstructorBasicAuthArg({auth:t,values:e}){return[{name:this.context.getPropertyName(t.username),value:b.TypeLiteral.string(e.username)},{name:this.context.getPropertyName(t.password),value:b.TypeLiteral.string(e.password)}]}getConstructorBearerAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.token),value:b.TypeLiteral.string(e.token)}]}getConstructorHeaderAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.header.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:t.header.typeReference,value:e.value})}]}getConstructorOAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.clientId),value:b.TypeLiteral.string(e.clientId)},{name:this.context.getPropertyName(t.clientSecret),value:b.TypeLiteral.string(e.clientSecret)}]}getConstructorHeaderArgs({headers:t,values:e}){let i=[];for(let p of t){let d=e[p.name.wireValue],u=this.getConstructorHeaderArg({header:p,value:d});u!=null&&i.push(u)}return i}getConstructorHeaderArg({header:t,value:e}){let i=this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:e});if(!b.TypeLiteral.isNop(i))return{name:this.context.getPropertyName(t.name.name),value:i}}callMethod({endpoint:t,snippet:e}){return b.invokeMethod({on:b.reference({name:bi}),method:this.getMethod({endpoint:t}),async:!0,arguments_:this.getMethodArgs({endpoint:t,snippet:e})})}getMethodArgs({endpoint:t,snippet:e}){switch(t.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:t.request,snippet:e});case"body":return this.getMethodArgsForBodyRequest({request:t.request,snippet:e});default:P(t.request)}}getMethodArgsForBodyRequest({request:t,snippet:e}){let i=[];this.context.errors.scope(J.PathParameters);let p=[...this.context.ir.pathParameters??[],...t.pathParameters??[]];return p.length>0&&i.push(...this.getPathParameters({namedParameters:p,snippet:e}).map(d=>d.value)),this.context.errors.unscope(),this.context.errors.scope(J.RequestBody),t.body!=null&&i.push(this.getBodyRequestArg({body:t.body,value:e.requestBody})),this.context.errors.unscope(),i}getBodyRequestArg({body:t,value:e}){switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:t.value,value:e,convertOpts:{isForRequest:!0}});default:P(t)}}getBytesBodyRequestArg({value:t}){return typeof t!="string"?(this.context.errors.add({severity:B.Critical,message:`Expected bytes value to be a string, got ${typeof t}`}),b.TypeLiteral.nop()):b.TypeLiteral.blob(t)}getMethodArgsForInlinedRequest({request:t,snippet:e}){let i=[],{inlinePathParameters:p,inlineFileProperties:d}={inlinePathParameters:this.context.customConfig?.inlinePathParameters??!0,inlineFileProperties:this.context.customConfig?.inlineFileProperties??!0};this.context.errors.scope(J.PathParameters);let u=[];t.pathParameters!=null&&u.push(...this.getPathParameters({namedParameters:t.pathParameters,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(J.RequestBody);let E=this.getFilePropertyInfo({request:t,snippet:e});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:p})||i.push(...u.map(I=>I.value)),d||i.push(...E.fileFields.map(I=>I.value)),this.context.needsRequestParameter({request:t,inlinePathParameters:p,inlineFileProperties:d})&&i.push(this.getInlinedRequestArg({request:t,snippet:e,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:p})?u:[],filePropertyInfo:E})),i}getFilePropertyInfo({request:t,snippet:e}){return t.body==null||!this.context.isFileUploadRequestBody(t.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:t.body,value:e.requestBody})}getInlinedRequestArg({request:t,snippet:e,pathParameterFields:i,filePropertyInfo:p}){this.context.errors.scope(J.QueryParameters);let u=this.context.associateQueryParametersByWireValue({parameters:t.queryParameters??[],values:e.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(J.Headers);let I=this.context.associateByWireValue({parameters:t.headers??[],values:e.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(J.RequestBody);let F=t.body!=null?this.getInlinedRequestBodyObjectFields({body:t.body,value:e.requestBody,filePropertyInfo:p}):[];return this.context.errors.unscope(),b.TypeLiteral.object({fields:[...i,...u,...I,...F]})}getInlinedRequestBodyObjectFields({body:t,value:e,filePropertyInfo:i}){switch(t.type){case"properties":return this.getInlinedRequestBodyPropertyObjectFields({parameters:t.value,value:e});case"referenced":return[this.getReferencedRequestBodyPropertyObjectField({body:t,value:e})];case"fileUpload":return this.getFileUploadRequestBodyObjectFields({filePropertyInfo:i});default:P(t)}}getFileUploadRequestBodyObjectFields({filePropertyInfo:t}){return this.context.customConfig?.inlineFileProperties??!0?[...t.fileFields,...t.bodyPropertyFields]:t.bodyPropertyFields}getReferencedRequestBodyPropertyObjectField({body:t,value:e}){return{name:this.context.getPropertyName(t.bodyKey),value:this.getReferencedRequestBodyPropertyTypeLiteral({body:t.bodyType,value:e})}}getReferencedRequestBodyPropertyTypeLiteral({body:t,value:e}){switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:t.value,value:e,convertOpts:{isForRequest:!0}});default:P(t)}}getInlinedRequestBodyPropertyObjectFields({parameters:t,value:e}){let i=[],p=this.context.associateByWireValue({parameters:t,values:this.context.getRecord(e)??{}});for(let d of p)i.push({name:this.context.getPropertyName(d.name.name),value:this.context.dynamicTypeLiteralMapper.convert({...d,convertOpts:{isForRequest:!0}})});return i}getPathParameters({namedParameters:t,snippet:e}){let i=[],p=this.context.associateByWireValue({parameters:t,values:e.pathParameters??{},ignoreMissingParameters:!0});for(let d of p)i.push({name:this.context.getPropertyName(d.name.name),value:this.context.dynamicTypeLiteralMapper.convert({...d,convertOpts:{isForRequest:!0}})});return i}getMethod({endpoint:t}){return t.declaration.fernFilepath.allParts.length>0?`${t.declaration.fernFilepath.allParts.map(e=>this.context.getMethodName(e)).join(".")}.${this.context.getMethodName(t.declaration.name)}`:this.context.getMethodName(t.declaration.name)}};var nt=class extends Ue{constructor({ir:t,config:e}){super(new tt({ir:t,config:e}))}async generate(t,e={}){return super.generate(t,e)}generateSync(t){return super.generateSync(t)}async generateSnippetAst(t){return super.generateSnippetAst(t)}createSnippetGenerator(t){return new rt({context:t})}};0&&(module.exports={DynamicSnippetsGenerator});
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
+ `),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(er({maxFrames:15,skip:3}))),...this.formatStack(this.filterStack(this.nodeStackFrames),"node")];switch(this.nodeStackFrames.length=0,br){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 lu}};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 fe={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
+ ${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
+ ${e}`)}return e}getContent(){let e=this.stringifyImports();return e.length>0?e+`
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={};pe(y,{BRAND:()=>Pu,DIRTY:()=>De,EMPTY_PATH:()=>mu,INVALID:()=>F,NEVER:()=>bc,OK:()=>ee,ParseStatus:()=>K,Schema:()=>L,ZodAny:()=>Be,ZodArray:()=>Ie,ZodBigInt:()=>We,ZodBoolean:()=>qe,ZodBranded:()=>Dt,ZodCatch:()=>tt,ZodDate:()=>ze,ZodDefault:()=>et,ZodDiscriminatedUnion:()=>ir,ZodEffects:()=>le,ZodEnum:()=>Ke,ZodError:()=>ae,ZodFirstPartyTypeKind:()=>B,ZodFunction:()=>sr,ZodIntersection:()=>Je,ZodIssueCode:()=>T,ZodLazy:()=>Ye,ZodLiteral:()=>Xe,ZodMap:()=>yt,ZodNaN:()=>xt,ZodNativeEnum:()=>Qe,ZodNever:()=>me,ZodNull:()=>Ge,ZodNullable:()=>ve,ZodNumber:()=>Ve,ZodObject:()=>se,ZodOptional:()=>ue,ZodParsedType:()=>S,ZodPipeline:()=>Vt,ZodPromise:()=>Oe,ZodReadonly:()=>rt,ZodRecord:()=>ar,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:()=>zu,array:()=>Ju,bigint:()=>$u,boolean:()=>Aa,coerce:()=>vc,custom:()=>ka,date:()=>Du,datetimeRegex:()=>_a,defaultErrorMap:()=>Te,discriminatedUnion:()=>Qu,effect:()=>pc,enum:()=>uc,function:()=>ac,getErrorMap:()=>pt,getParsedType:()=>ge,instanceof:()=>Mu,intersection:()=>ec,isAborted:()=>rr,isAsync:()=>dt,isDirty:()=>nr,isValid:()=>Ce,late:()=>ju,lazy:()=>sc,literal:()=>oc,makeIssue:()=>$t,map:()=>nc,nan:()=>Uu,nativeEnum:()=>cc,never:()=>Gu,null:()=>qu,nullable:()=>fc,number:()=>Ia,object:()=>Yu,objectUtil:()=>Tr,oboolean:()=>xc,onumber:()=>gc,optional:()=>dc,ostring:()=>yc,pipeline:()=>hc,preprocess:()=>mc,promise:()=>lc,quotelessJson:()=>pu,record:()=>rc,set:()=>ic,setErrorMap:()=>fu,strictObject:()=>Xu,string:()=>Ea,symbol:()=>Vu,transformer:()=>pc,tuple:()=>tc,undefined:()=>Wu,union:()=>Ku,unknown:()=>Zu,util:()=>U,void:()=>Hu});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 Tr;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(Tr||(Tr={}));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"]),pu=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 du=(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=du;var ga=Te;function fu(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}},mu=[];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}),rr=n=>n.status==="aborted",nr=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}},hu=/^c[^\s-]{8,}$/i,yu=/^[0-9a-z]+$/,gu=/^[0-9A-HJKMNP-TV-Z]{26}$/i,xu=/^[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,vu=/^[a-z0-9_-]{21}$/i,bu=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,wu=/^[-+]?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)?)??$/,_u=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Tu="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",kr,ku=/^(?:(?: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])$/,Eu=/^(?:(?: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])$/,Iu=/^(([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]))$/,Au=/^(([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])$/,Ru=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Su=/^([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])))",Nu=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 Cu(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 Fu(n,e){return!!((e==="v4"||!e)&&ku.test(n)||(e==="v6"||!e)&&Iu.test(n))}function Bu(n,e){if(!bu.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 Ou(n,e){return!!((e==="v4"||!e)&&Eu.test(n)||(e==="v6"||!e)&&Au.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")_u.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")kr||(kr=new RegExp(Tu,"u")),kr.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")xu.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")vu.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")hu.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")yu.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")gu.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"?Nu.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{code:T.invalid_string,validation:"date",message:o.message}),r.dirty()):o.kind==="time"?Cu(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"?wu.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"duration",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="ip"?Fu(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"?Bu(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"?Ou(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"?Ru.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"base64",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="base64url"?Su.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 Lu(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"?Lu(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 me=class extends L{_parse(e){let t=this._getOrReturnCtx(e);return A(t,{code:T.invalid_type,expected:S.never,received:t.parsedType}),F}};me.create=n=>new me({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 me&&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 me){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:me.create(),typeName:B.ZodObject,...O(e)});se.strictCreate=(n,e)=>new se({shape:()=>n,unknownKeys:"strict",catchall:me.create(),typeName:B.ZodObject,...O(e)});se.lazycreate=(n,e)=>new se({shape:n,unknownKeys:"strip",catchall:me.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):[],ir=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 Er(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=Er(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=Er(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(rr(o)||rr(u))return F;let m=Er(o.value,u.value);return m.valid?((nr(o)||nr(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 ar=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 sr=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 Pu=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 ju={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 Mu=(n,e={message:`Input not instance of ${n.name}`})=>ka(t=>t instanceof n,e),Ea=Fe.create,Ia=Ve.create,Uu=xt.create,$u=We.create,Aa=qe.create,Du=ze.create,Vu=mt.create,Wu=Ze.create,qu=Ge.create,zu=Be.create,Zu=Ee.create,Gu=me.create,Hu=ht.create,Ju=Ie.create,Yu=se.create,Xu=se.strictCreate,Ku=He.create,Qu=ir.create,ec=Je.create,tc=xe.create,rc=ar.create,nc=yt.create,ic=gt.create,ac=sr.create,sc=Ye.create,oc=Xe.create,uc=Ke.create,cc=Qe.create,lc=Oe.create,pc=le.create,dc=ue.create,fc=ve.create,mc=le.createWithPreprocess,hc=Vt.create,yc=()=>Ea().optional(),gc=()=>Ia().optional(),xc=()=>Aa().optional(),vc={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 bc=F;p();f();d();var Ra=y.strictObject({title:y.string(),content:y.string()});var wc=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,Sa=y.string().refine(n=>wc.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]),_c=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={};pe(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:()=>Ac,function_:()=>Rc,instantiateClass:()=>Sc,invokeFunction:()=>Nc,invokeMethod:()=>Cc,parameter:()=>Fc,reference:()=>Bc,variable:()=>Oc});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 de(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
+ `).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
+ `)?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
+ `),o=a[0]+`
23
+ `,u=a.slice(1).join(`
24
+ `);t.write(o.replaceAll("`","\\`")),t.writeNoIndent(u.replaceAll("`","\\`")),t.write("`")}writeIterable({writer:t,iterable:r}){let a=Ec({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=kc({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=Tc({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 Tc({fields:n}){return n.filter(e=>!Ae.isNop(e.value))}function kc({entries:n}){return n.filter(e=>!Ae.isNop(e.key)&&!Ae.isNop(e.value))}function Ec({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 Ac(n){return new bt(n)}function Rc(n){return new wt(n)}function Sc(n){return new vt(n)}function Nc(n){return new _t(n)}function Cc(n){return new Tt(n)}function Fc(n){return new kt(n)}function Bc(n){return new it(n)}function Oc(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:Lc(t.repoUrl),license:Fa(n.license)};default:throw new Error(`Encountered unknown output mode: ${t}`)}}function Lc(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 Ir({organization:n,workspaceName:e,namespaceExport:t,naming:r}){return(typeof r=="string"?r:r?.namespace)??t??`${Ue(St(n))}${Ue(St(e))}`}function Ar({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={};pe(zt,{commons:()=>Oa,dynamic:()=>Cr,generatorExec:()=>Br});p();f();d();p();f();d();var Oa={};p();f();d();var Cr={};pe(Cr,{ErrorSeverity:()=>Va,HttpMethod:()=>$a,ObjectPropertyAccess:()=>Wa,PrimitiveTypeV1:()=>qa,auth:()=>La,commons:()=>Pa,declaration:()=>ja,endpoints:()=>Ma,environment:()=>Ua,http:()=>Rr,ir:()=>Da,snippets:()=>Sr,types:()=>Nr,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 Rr={};pe(Rr,{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 Sr={};pe(Sr,{ErrorSeverity:()=>Va});p();f();d();p();f();d();var Va={Critical:"CRITICAL",Warning:"WARNING"};var Nr={};pe(Nr,{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 Br={};pe(Br,{LicenseId:()=>Za,config:()=>Fr});p();f();d();p();f();d();var Fr={};pe(Fr,{LicenseId:()=>Za});p();f();d();p();f();d();var Za={Mit:"MIT",Apache2:"Apache-2.0"};var Pc="value",or=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:Pc,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 ur=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 cr=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 or({context:this}),this.filePropertyMapper=new ur({context:this}),this.moduleName=jc({config:r,customConfig:this.customConfig}),this.namespaceExport=Ir({organization:r.organization,workspaceName:r.workspaceName,namespaceExport:this.customConfig?.namespaceExport,naming:this.customConfig?.naming});let a=Ar({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 jc({config:n,customConfig:e}){return Ba({generatorConfig:n,isPackagePrivate:e?.private??!1})?.packageName??n.organization}p();f();d();var Ga="client",Ha="main",Mc={type:"primitive",value:"STRING"},lr=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(fe.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(fe.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:Mc,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(fe.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(fe.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(fe.PathParameters);let u=[];e.pathParameters!=null&&u.push(...this.getPathParameters({namedParameters:e.pathParameters,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(fe.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(fe.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(fe.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(fe.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 pr=class extends Lt{constructor({ir:e,config:t}){super(new cr({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 lr({context:e})}};0&&(module.exports={DynamicSnippetsGenerator});
25
25
  /*! Bundled license information:
26
26
 
27
27
  @jspm/core/nodelibs/browser/chunk-DtuTasat.js: