@fern-api/typescript-dynamic-snippets 3.55.0 → 3.56.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +14 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +14 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
"use strict";var Ve=Object.defineProperty;var ji=Object.getOwnPropertyDescriptor;var _i=Object.getOwnPropertyNames;var Di=Object.prototype.hasOwnProperty;var Wi=(s,t,e)=>t in s?Ve(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var he=(s,t)=>()=>(s&&(t=s(s=0)),t);var K=(s,t)=>{for(var e in t)Ve(s,e,{get:t[e],enumerable:!0})},Vi=(s,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let p of _i(t))!Di.call(s,p)&&p!==e&&Ve(s,p,{get:()=>t[p],enumerable:!(o=ji(t,p))||o.enumerable});return s};var qi=s=>Vi(Ve({},"__esModule",{value:!0}),s);var b=(s,t,e)=>Wi(s,typeof t!="symbol"?t+"":t,e);var l=he(()=>{"use strict"});var x={};K(x,{_debugEnd:()=>vr,_debugProcess:()=>br,_events:()=>Mr,_eventsCount:()=>$r,_exiting:()=>tr,_fatalExceptions:()=>yr,_getActiveHandles:()=>or,_getActiveRequests:()=>ir,_kill:()=>sr,_linkedBinding:()=>Qt,_maxListeners:()=>Ur,_preload_modules:()=>Cr,_rawDebug:()=>Kt,_startProfilerIdleNotifier:()=>Ir,_stopProfilerIdleNotifier:()=>Tr,_tickCallback:()=>wr,abort:()=>Br,addListener:()=>jr,allowedNodeEnvironmentFlags:()=>dr,arch:()=>Mt,argv:()=>_t,argv0:()=>kr,assert:()=>mr,binding:()=>Gt,browser:()=>Zt,chdir:()=>Yt,config:()=>rr,cpuUsage:()=>ze,cwd:()=>Ht,debugPort:()=>Lr,default:()=>Yr,dlopen:()=>nr,domain:()=>er,emit:()=>qr,emitWarning:()=>qt,env:()=>jt,execArgv:()=>Dt,execPath:()=>Sr,exit:()=>cr,features:()=>hr,hasUncaughtExceptionCaptureCallback:()=>gr,hrtime:()=>Ge,kill:()=>lr,listeners:()=>Hr,memoryUsage:()=>pr,moduleLoadList:()=>Xt,nextTick:()=>Pt,off:()=>Dr,on:()=>ee,once:()=>_r,openStdin:()=>fr,pid:()=>Fr,platform:()=>$t,ppid:()=>Nr,prependListener:()=>Gr,prependOnceListener:()=>zr,reallyExit:()=>ar,release:()=>Jt,removeAllListeners:()=>Vr,removeListener:()=>Wr,resourceUsage:()=>ur,setSourceMapsEnabled:()=>Pr,setUncaughtExceptionCaptureCallback:()=>xr,stderr:()=>Ar,stdin:()=>Rr,stdout:()=>Er,title:()=>Ut,umask:()=>zt,uptime:()=>Or,version:()=>Wt,versions:()=>Vt});function pt(s){throw new Error("Node.js process "+s+" is not supported by JSPM core outside of Node.js")}function Gi(){!ye||!se||(ye=!1,se.length?Q=se.concat(Q):qe=-1,Q.length&&Ct())}function Ct(){if(!ye){var s=setTimeout(Gi,0);ye=!0;for(var t=Q.length;t;){for(se=Q,Q=[];++qe<t;)se&&se[qe].run();qe=-1,t=Q.length}se=null,ye=!1,clearTimeout(s)}}function Pt(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 Ot(s,t)),Q.length===1&&!ye&&setTimeout(Ct,0)}function Ot(s,t){this.fun=s,this.array=t}function D(){}function Qt(s){pt("_linkedBinding")}function nr(s){pt("dlopen")}function ir(){return[]}function or(){return[]}function mr(s,t){if(!s)throw new Error(t||"assertion error")}function gr(){return!1}function Or(){return ie.now()/1e3}function Ge(s){var t=Math.floor((Date.now()-ie.now())*.001),e=ie.now()*.001,o=Math.floor(e)+t,p=Math.floor(e%1*1e9);return s&&(o=o-s[0],p=p-s[1],p<0&&(o--,p+=ut)),[o,p]}function ee(){return Yr}function Hr(s){return[]}var Q,ye,se,qe,Ut,Mt,$t,jt,_t,Dt,Wt,Vt,qt,Gt,zt,Ht,Yt,Jt,Zt,Kt,Xt,er,tr,rr,ar,sr,ze,ur,pr,lr,cr,fr,dr,hr,yr,xr,wr,br,vr,Ir,Tr,Er,Ar,Rr,Br,Fr,Nr,Sr,Lr,kr,Cr,Pr,ie,st,ut,Ur,Mr,$r,jr,_r,Dr,Wr,Vr,qr,Gr,zr,Yr,Jr=he(()=>{"use strict";l();f();c();Q=[],ye=!1,qe=-1;Ot.prototype.run=function(){this.fun.apply(null,this.array)};Ut="browser",Mt="x64",$t="browser",jt={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},_t=["/usr/bin/node"],Dt=[],Wt="v16.8.0",Vt={},qt=function(s,t){console.warn((t?t+": ":"")+s)},Gt=function(s){pt("binding")},zt=function(s){return 0},Ht=function(){return"/"},Yt=function(s){},Jt={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};Zt=!0,Kt=D,Xt=[];er={},tr=!1,rr={};ar=D,sr=D,ze=function(){return{}},ur=ze,pr=ze,lr=D,cr=D,fr=D,dr={};hr={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},yr=D,xr=D;wr=D,br=D,vr=D,Ir=D,Tr=D,Er=void 0,Ar=void 0,Rr=void 0,Br=D,Fr=2,Nr=1,Sr="/bin/usr/node",Lr=9229,kr="node",Cr=[],Pr=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;Ge.bigint=function(s){var t=Ge(s);return typeof BigInt>"u"?t[0]*ut+t[1]:BigInt(t[0]*ut)+BigInt(t[1])};Ur=10,Mr={},$r=0;jr=ee,_r=ee,Dr=ee,Wr=ee,Vr=ee,qr=D,Gr=ee,zr=ee;Yr={version:Wt,versions:Vt,arch:Mt,platform:$t,browser:Zt,release:Jt,_rawDebug:Kt,moduleLoadList:Xt,binding:Gt,_linkedBinding:Qt,_events:Mr,_eventsCount:$r,_maxListeners:Ur,on:ee,addListener:jr,once:_r,off:Dr,removeListener:Wr,removeAllListeners:Vr,emit:qr,prependListener:Gr,prependOnceListener:zr,listeners:Hr,domain:er,_exiting:tr,config:rr,dlopen:nr,uptime:Or,_getActiveRequests:ir,_getActiveHandles:or,reallyExit:ar,_kill:sr,cpuUsage:ze,resourceUsage:ur,memoryUsage:pr,kill:lr,exit:cr,openStdin:fr,allowedNodeEnvironmentFlags:dr,assert:mr,features:hr,_fatalExceptions:yr,setUncaughtExceptionCaptureCallback:xr,hasUncaughtExceptionCaptureCallback:gr,emitWarning:qt,nextTick:Pt,_tickCallback:wr,_debugProcess:br,_debugEnd:vr,_startProfilerIdleNotifier:Ir,_stopProfilerIdleNotifier:Tr,stdout:Er,stdin:Rr,stderr:Ar,abort:Br,umask:zt,chdir:Yt,cwd:Ht,env:jt,title:Ut,argv:_t,execArgv:Dt,pid:Fr,ppid:Nr,execPath:Sr,debugPort:Lr,hrtime:Ge,argv0:kr,_preload_modules:Cr,setSourceMapsEnabled:Pr}});var c=he(()=>{"use strict";Jr()});function zi(){if(Zr)return Fe;Zr=!0,Fe.byteLength=I,Fe.toByteArray=N,Fe.fromByteArray=W;for(var s=[],t=[],e=typeof Uint8Array<"u"?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,d=o.length;p<d;++p)s[p]=o[p],t[o.charCodeAt(p)]=p;t[45]=62,t[95]=63;function u(E){var A=E.length;if(A%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var S=E.indexOf("=");S===-1&&(S=A);var j=S===A?0:4-S%4;return[S,j]}function I(E){var A=u(E),S=A[0],j=A[1];return(S+j)*3/4-j}function T(E,A,S){return(A+S)*3/4-S}function N(E){var A,S=u(E),j=S[0],q=S[1],$=new e(T(E,j,q)),G=0,H=q>0?j-4:j,V;for(V=0;V<H;V+=4)A=t[E.charCodeAt(V)]<<18|t[E.charCodeAt(V+1)]<<12|t[E.charCodeAt(V+2)]<<6|t[E.charCodeAt(V+3)],$[G++]=A>>16&255,$[G++]=A>>8&255,$[G++]=A&255;return q===2&&(A=t[E.charCodeAt(V)]<<2|t[E.charCodeAt(V+1)]>>4,$[G++]=A&255),q===1&&(A=t[E.charCodeAt(V)]<<10|t[E.charCodeAt(V+1)]<<4|t[E.charCodeAt(V+2)]>>2,$[G++]=A>>8&255,$[G++]=A&255),$}function R(E){return s[E>>18&63]+s[E>>12&63]+s[E>>6&63]+s[E&63]}function k(E,A,S){for(var j,q=[],$=A;$<S;$+=3)j=(E[$]<<16&16711680)+(E[$+1]<<8&65280)+(E[$+2]&255),q.push(R(j));return q.join("")}function W(E){for(var A,S=E.length,j=S%3,q=[],$=16383,G=0,H=S-j;G<H;G+=$)q.push(k(E,G,G+$>H?H:G+$));return j===1?(A=E[S-1],q.push(s[A>>2]+s[A<<4&63]+"==")):j===2&&(A=(E[S-2]<<8)+E[S-1],q.push(s[A>>10]+s[A>>4&63]+s[A<<2&63]+"=")),q.join("")}return Fe}function Hi(){if(Kr)return He;Kr=!0;return He.read=function(s,t,e,o,p){var d,u,I=p*8-o-1,T=(1<<I)-1,N=T>>1,R=-7,k=e?p-1:0,W=e?-1:1,E=s[t+k];for(k+=W,d=E&(1<<-R)-1,E>>=-R,R+=I;R>0;d=d*256+s[t+k],k+=W,R-=8);for(u=d&(1<<-R)-1,d>>=-R,R+=o;R>0;u=u*256+s[t+k],k+=W,R-=8);if(d===0)d=1-N;else{if(d===T)return u?NaN:(E?-1:1)*(1/0);u=u+Math.pow(2,o),d=d-N}return(E?-1:1)*u*Math.pow(2,d-o)},He.write=function(s,t,e,o,p,d){var u,I,T,N=d*8-p-1,R=(1<<N)-1,k=R>>1,W=p===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=o?0:d-1,A=o?1:-1,S=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(I=isNaN(t)?1:0,u=R):(u=Math.floor(Math.log(t)/Math.LN2),t*(T=Math.pow(2,-u))<1&&(u--,T*=2),u+k>=1?t+=W/T:t+=W*Math.pow(2,1-k),t*T>=2&&(u++,T/=2),u+k>=R?(I=0,u=R):u+k>=1?(I=(t*T-1)*Math.pow(2,p),u=u+k):(I=t*Math.pow(2,k-1)*Math.pow(2,p),u=0));p>=8;s[e+E]=I&255,E+=A,I/=256,p-=8);for(u=u<<p|I,N+=p;N>0;s[e+E]=u&255,E+=A,u/=256,N-=8);s[e+E-A]|=S*128},He}function Qr(){if(Xr)return ue;Xr=!0;let s=zi(),t=Hi(),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 o=2147483647;ue.kMaxLength=o,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 i=new Uint8Array(1),r={foo:function(){return 42}};return Object.setPrototypeOf(r,Uint8Array.prototype),Object.setPrototypeOf(i,r),i.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(i){if(i>o)throw new RangeError('The value "'+i+'" is invalid for option "size"');let r=new Uint8Array(i);return Object.setPrototypeOf(r,u.prototype),r}function u(i,r,n){if(typeof i=="number"){if(typeof r=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return R(i)}return I(i,r,n)}u.poolSize=8192;function I(i,r,n){if(typeof i=="string")return k(i,r);if(ArrayBuffer.isView(i))return E(i);if(i==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i);if(Z(i,ArrayBuffer)||i&&Z(i.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Z(i,SharedArrayBuffer)||i&&Z(i.buffer,SharedArrayBuffer)))return A(i,r,n);if(typeof i=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let a=i.valueOf&&i.valueOf();if(a!=null&&a!==i)return u.from(a,r,n);let m=S(i);if(m)return m;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof i[Symbol.toPrimitive]=="function")return u.from(i[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 i)}u.from=function(i,r,n){return I(i,r,n)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array);function T(i){if(typeof i!="number")throw new TypeError('"size" argument must be of type number');if(i<0)throw new RangeError('The value "'+i+'" is invalid for option "size"')}function N(i,r,n){return T(i),i<=0?d(i):r!==void 0?typeof n=="string"?d(i).fill(r,n):d(i).fill(r):d(i)}u.alloc=function(i,r,n){return N(i,r,n)};function R(i){return T(i),d(i<0?0:j(i)|0)}u.allocUnsafe=function(i){return R(i)},u.allocUnsafeSlow=function(i){return R(i)};function k(i,r){if((typeof r!="string"||r==="")&&(r="utf8"),!u.isEncoding(r))throw new TypeError("Unknown encoding: "+r);let n=$(i,r)|0,a=d(n),m=a.write(i,r);return m!==n&&(a=a.slice(0,m)),a}function W(i){let r=i.length<0?0:j(i.length)|0,n=d(r);for(let a=0;a<r;a+=1)n[a]=i[a]&255;return n}function E(i){if(Z(i,Uint8Array)){let r=new Uint8Array(i);return A(r.buffer,r.byteOffset,r.byteLength)}return W(i)}function A(i,r,n){if(r<0||i.byteLength<r)throw new RangeError('"offset" is outside of buffer bounds');if(i.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(i):n===void 0?a=new Uint8Array(i,r):a=new Uint8Array(i,r,n),Object.setPrototypeOf(a,u.prototype),a}function S(i){if(u.isBuffer(i)){let r=j(i.length)|0,n=d(r);return n.length===0||i.copy(n,0,0,r),n}if(i.length!==void 0)return typeof i.length!="number"||at(i.length)?d(0):W(i);if(i.type==="Buffer"&&Array.isArray(i.data))return W(i.data)}function j(i){if(i>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return i|0}function q(i){return+i!=i&&(i=0),u.alloc(+i)}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 $(i,r){if(u.isBuffer(i))return i.length;if(ArrayBuffer.isView(i)||Z(i,ArrayBuffer))return i.byteLength;if(typeof i!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof i);let n=i.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(i).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return kt(i).length;default:if(m)return a?-1:ot(i).length;r=(""+r).toLowerCase(),m=!0}}u.byteLength=$;function G(i,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(i||(i="utf8");;)switch(i){case"hex":return Si(this,r,n);case"utf8":case"utf-8":return Tt(this,r,n);case"ascii":return Fi(this,r,n);case"latin1":case"binary":return Ni(this,r,n);case"base64":return Ri(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Li(this,r,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(i+"").toLowerCase(),a=!0}}u.prototype._isBuffer=!0;function H(i,r,n){let a=i[r];i[r]=i[n],i[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,B=a-n,U=Math.min(y,B),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],B=M[L];break}return y<B?-1:B<y?1:0};function V(i,r,n,a,m){if(i.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:i.length-1),n<0&&(n=i.length+n),n>=i.length){if(m)return-1;n=i.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(i,r,n,a,m);if(typeof r=="number")return r=r&255,typeof Uint8Array.prototype.indexOf=="function"?m?Uint8Array.prototype.indexOf.call(i,r,n):Uint8Array.prototype.lastIndexOf.call(i,r,n):It(i,[r],n,a,m);throw new TypeError("val must be string, number or Buffer")}function It(i,r,n,a,m){let h=1,y=i.length,B=r.length;if(a!==void 0&&(a=String(a).toLowerCase(),a==="ucs2"||a==="ucs-2"||a==="utf16le"||a==="utf-16le")){if(i.length<2||r.length<2)return-1;h=2,y/=2,B/=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(i,O)===U(r,M===-1?0:O-M)){if(M===-1&&(M=O),O-M+1===B)return M*h}else M!==-1&&(O-=O-M),M=-1}else for(n+B>y&&(n=y-B),O=n;O>=0;O--){let M=!0;for(let L=0;L<B;L++)if(U(i,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 vi(i,r,n,a){n=Number(n)||0;let m=i.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 B=parseInt(r.substr(y*2,2),16);if(at(B))return y;i[n+y]=B}return y}function Ii(i,r,n,a){return We(ot(r,i.length-n),i,n,a)}function Ti(i,r,n,a){return We(Oi(r),i,n,a)}function Ei(i,r,n,a){return We(kt(r),i,n,a)}function Ai(i,r,n,a){return We(Ui(r,i.length-n),i,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 vi(this,r,n,a);case"utf8":case"utf-8":return Ii(this,r,n,a);case"ascii":case"latin1":case"binary":return Ti(this,r,n,a);case"base64":return Ei(this,r,n,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ai(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 Ri(i,r,n){return r===0&&n===i.length?s.fromByteArray(i):s.fromByteArray(i.slice(r,n))}function Tt(i,r,n){n=Math.min(i.length,n);let a=[],m=r;for(;m<n;){let h=i[m],y=null,B=h>239?4:h>223?3:h>191?2:1;if(m+B<=n){let U,O,M,L;switch(B){case 1:h<128&&(y=h);break;case 2:U=i[m+1],(U&192)===128&&(L=(h&31)<<6|U&63,L>127&&(y=L));break;case 3:U=i[m+1],O=i[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=i[m+1],O=i[m+2],M=i[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,B=1):y>65535&&(y-=65536,a.push(y>>>10&1023|55296),y=56320|y&1023),a.push(y),m+=B}return Bi(a)}let Et=4096;function Bi(i){let r=i.length;if(r<=Et)return String.fromCharCode.apply(String,i);let n="",a=0;for(;a<r;)n+=String.fromCharCode.apply(String,i.slice(a,a+=Et));return n}function Fi(i,r,n){let a="";n=Math.min(i.length,n);for(let m=r;m<n;++m)a+=String.fromCharCode(i[m]&127);return a}function Ni(i,r,n){let a="";n=Math.min(i.length,n);for(let m=r;m<n;++m)a+=String.fromCharCode(i[m]);return a}function Si(i,r,n){let a=i.length;(!r||r<0)&&(r=0),(!n||n<0||n>a)&&(n=a);let m="";for(let h=r;h<n;++h)m+=Mi[i[h]];return m}function Li(i,r,n){let a=i.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 _(i,r,n){if(i%1!==0||i<0)throw new RangeError("offset is not uint");if(i+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,me(r,"offset");let n=this[r],a=this[r+7];(n===void 0||a===void 0)&&Be(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,me(r,"offset");let n=this[r],a=this[r+7];(n===void 0||a===void 0)&&Be(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,me(r,"offset");let n=this[r],a=this[r+7];(n===void 0||a===void 0)&&Be(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,me(r,"offset");let n=this[r],a=this[r+7];(n===void 0||a===void 0)&&Be(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(i,r,n,a,m,h){if(!u.isBuffer(i))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>i.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 B=Math.pow(2,8*a)-1;z(this,r,n,a,B,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 B=Math.pow(2,8*a)-1;z(this,r,n,a,B,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 At(i,r,n,a,m){Lt(r,a,m,i,n,7);let h=Number(r&BigInt(4294967295));i[n++]=h,h=h>>8,i[n++]=h,h=h>>8,i[n++]=h,h=h>>8,i[n++]=h;let y=Number(r>>BigInt(32)&BigInt(4294967295));return i[n++]=y,y=y>>8,i[n++]=y,y=y>>8,i[n++]=y,y=y>>8,i[n++]=y,n}function Rt(i,r,n,a,m){Lt(r,a,m,i,n,7);let h=Number(r&BigInt(4294967295));i[n+7]=h,h=h>>8,i[n+6]=h,h=h>>8,i[n+5]=h,h=h>>8,i[n+4]=h;let y=Number(r>>BigInt(32)&BigInt(4294967295));return i[n+3]=y,y=y>>8,i[n+2]=y,y=y>>8,i[n+1]=y,y=y>>8,i[n]=y,n+8}u.prototype.writeBigUInt64LE=ne(function(r,n=0){return At(this,r,n,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeBigUInt64BE=ne(function(r,n=0){return Rt(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,B=0;for(this[n]=r&255;++h<a&&(y*=256);)r<0&&B===0&&this[n+h-1]!==0&&(B=1),this[n+h]=(r/y>>0)-B&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,B=0;for(this[n+h]=r&255;--h>=0&&(y*=256);)r<0&&B===0&&this[n+h+1]!==0&&(B=1),this[n+h]=(r/y>>0)-B&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 At(this,r,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeBigInt64BE=ne(function(r,n=0){return Rt(this,r,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Bt(i,r,n,a,m,h){if(n+a>i.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Ft(i,r,n,a,m){return r=+r,n=n>>>0,m||Bt(i,r,n,4),t.write(i,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 Nt(i,r,n,a,m){return r=+r,n=n>>>0,m||Bt(i,r,n,8),t.write(i,r,n,a,52,8),n+8}u.prototype.writeDoubleLE=function(r,n,a){return Nt(this,r,n,!0,a)},u.prototype.writeDoubleBE=function(r,n,a){return Nt(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),B=y.length;if(B===0)throw new TypeError('The value "'+r+'" is invalid for argument "value"');for(h=0;h<a-n;++h)this[h+n]=y[h%B]}return this};let de={};function it(i,r,n){de[i]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:r.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${i}]`,this.stack,delete this.name}get code(){return i}set code(m){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:m,writable:!0})}toString(){return`${this.name} [${i}]: ${this.message}`}}}it("ERR_BUFFER_OUT_OF_BOUNDS",function(i){return i?`${i} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),it("ERR_INVALID_ARG_TYPE",function(i,r){return`The "${i}" argument must be of type number. Received type ${typeof r}`},TypeError),it("ERR_OUT_OF_RANGE",function(i,r,n){let a=`The value of "${i}" is out of range.`,m=n;return Number.isInteger(n)&&Math.abs(n)>2**32?m=St(String(n)):typeof n=="bigint"&&(m=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(m=St(m)),m+="n"),a+=` It must be ${r}. Received ${m}`,a},RangeError);function St(i){let r="",n=i.length,a=i[0]==="-"?1:0;for(;n>=a+4;n-=3)r=`_${i.slice(n-3,n)}${r}`;return`${i.slice(0,n)}${r}`}function ki(i,r,n){me(r,"offset"),(i[r]===void 0||i[r+n]===void 0)&&Be(r,i.length-(n+1))}function Lt(i,r,n,a,m,h){if(i>n||i<r){let y=typeof r=="bigint"?"n":"",B;throw r===0||r===BigInt(0)?B=`>= 0${y} and < 2${y} ** ${(h+1)*8}${y}`:B=`>= -(2${y} ** ${(h+1)*8-1}${y}) and < 2 ** ${(h+1)*8-1}${y}`,new de.ERR_OUT_OF_RANGE("value",B,i)}ki(a,m,h)}function me(i,r){if(typeof i!="number")throw new de.ERR_INVALID_ARG_TYPE(r,"number",i)}function Be(i,r,n){throw Math.floor(i)!==i?(me(i,n),new de.ERR_OUT_OF_RANGE("offset","an integer",i)):r<0?new de.ERR_BUFFER_OUT_OF_BOUNDS:new de.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${r}`,i)}let Ci=/[^+/0-9A-Za-z-_]/g;function Pi(i){if(i=i.split("=")[0],i=i.trim().replace(Ci,""),i.length<2)return"";for(;i.length%4!==0;)i=i+"=";return i}function ot(i,r){r=r||1/0;let n,a=i.length,m=null,h=[];for(let y=0;y<a;++y){if(n=i.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 Oi(i){let r=[];for(let n=0;n<i.length;++n)r.push(i.charCodeAt(n)&255);return r}function Ui(i,r){let n,a,m,h=[];for(let y=0;y<i.length&&!((r-=2)<0);++y)n=i.charCodeAt(y),a=n>>8,m=n%256,h.push(m),h.push(a);return h}function kt(i){return s.toByteArray(Pi(i))}function We(i,r,n,a){let m;for(m=0;m<a&&!(m+n>=r.length||m>=i.length);++m)r[m+n]=i[m];return m}function Z(i,r){return i instanceof r||i!=null&&i.constructor!=null&&i.constructor.name!=null&&i.constructor.name===r.name}function at(i){return i!==i}let Mi=(function(){let i="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]=i[n]+i[m]}return r})();function ne(i){return typeof BigInt>"u"?$i:i}function $i(){throw new Error("BigInt not supported")}return ue}var Fe,Zr,He,Kr,ue,Xr,en=he(()=>{"use strict";l();f();c();Fe={},Zr=!1;He={},Kr=!1;ue={},Xr=!1});var pe,g,fs,ds,tn=he(()=>{"use strict";l();f();c();en();pe=Qr();pe.Buffer;pe.SlowBuffer;pe.INSPECT_MAX_BYTES;pe.kMaxLength;g=pe.Buffer,fs=pe.INSPECT_MAX_BYTES,ds=pe.kMaxLength});var f=he(()=>{"use strict";tn()});var Qa={};K(Qa,{DynamicSnippetsGenerator:()=>nt});module.exports=qi(Qa);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 Yi=typeof global=="object"&&global&&global.Object===Object&&global,rn=Yi;var Ji=typeof self=="object"&&self&&self.Object===Object&&self,Zi=rn||Ji||Function("return this")(),nn=Zi;var Ki=nn.Symbol,te=Ki;l();f();c();var on=Object.prototype,Xi=on.hasOwnProperty,Qi=on.toString,Ne=te?te.toStringTag:void 0;function eo(s){var t=Xi.call(s,Ne),e=s[Ne];try{s[Ne]=void 0;var o=!0}catch{}var p=Qi.call(s);return o&&(t?s[Ne]=e:delete s[Ne]),p}var an=eo;l();f();c();var to=Object.prototype,ro=to.toString;function no(s){return ro.call(s)}var sn=no;var io="[object Null]",oo="[object Undefined]",un=te?te.toStringTag:void 0;function ao(s){return s==null?s===void 0?oo:io:un&&un in Object(s)?an(s):sn(s)}var pn=ao;l();f();c();function so(s){return s!=null&&typeof s=="object"}var ln=so;var uo="[object Symbol]";function po(s){return typeof s=="symbol"||ln(s)&&pn(s)==uo}var cn=po;l();f();c();l();f();c();function lo(s,t){for(var e=-1,o=s==null?0:s.length,p=Array(o);++e<o;)p[e]=t(s[e],e,s);return p}var fn=lo;l();f();c();var co=Array.isArray,dn=co;var fo=1/0,mn=te?te.prototype:void 0,hn=mn?mn.toString:void 0;function yn(s){if(typeof s=="string")return s;if(dn(s))return fn(s,yn)+"";if(cn(s))return hn?hn.call(s):"";var t=s+"";return t=="0"&&1/s==-fo?"-0":t}var xn=yn;l();f();c();function mo(s){return s==null?"":xn(s)}var oe=mo;l();f();c();l();f();c();l();f();c();l();f();c();l();f();c();l();f();c();function ho(s,t,e){var o=-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);++o<p;)d[o]=s[o+t];return d}var gn=ho;function yo(s,t,e){var o=s.length;return e=e===void 0?o:e,!t&&e>=o?s:gn(s,t,e)}var wn=yo;l();f();c();var xo="\\ud800-\\udfff",go="\\u0300-\\u036f",wo="\\ufe20-\\ufe2f",bo="\\u20d0-\\u20ff",vo=go+wo+bo,Io="\\ufe0e\\ufe0f",To="\\u200d",Eo=RegExp("["+To+xo+vo+Io+"]");function Ao(s){return Eo.test(s)}var Ye=Ao;l();f();c();l();f();c();function Ro(s){return s.split("")}var bn=Ro;l();f();c();var vn="\\ud800-\\udfff",Bo="\\u0300-\\u036f",Fo="\\ufe20-\\ufe2f",No="\\u20d0-\\u20ff",So=Bo+Fo+No,Lo="\\ufe0e\\ufe0f",ko="["+vn+"]",lt="["+So+"]",ct="\\ud83c[\\udffb-\\udfff]",Co="(?:"+lt+"|"+ct+")",In="[^"+vn+"]",Tn="(?:\\ud83c[\\udde6-\\uddff]){2}",En="[\\ud800-\\udbff][\\udc00-\\udfff]",Po="\\u200d",An=Co+"?",Rn="["+Lo+"]?",Oo="(?:"+Po+"(?:"+[In,Tn,En].join("|")+")"+Rn+An+")*",Uo=Rn+An+Oo,Mo="(?:"+[In+lt+"?",lt,Tn,En,ko].join("|")+")",$o=RegExp(ct+"(?="+ct+")|"+Mo+Uo,"g");function jo(s){return s.match($o)||[]}var Bn=jo;function _o(s){return Ye(s)?Bn(s):bn(s)}var Fn=_o;function Do(s){return function(t){t=oe(t);var e=Ye(t)?Fn(t):void 0,o=e?e[0]:t.charAt(0),p=e?wn(e,1).join(""):t.slice(1);return o[s]()+p}}var Nn=Do;var Wo=Nn("toUpperCase"),xe=Wo;function Vo(s){return xe(oe(s).toLowerCase())}var Sn=Vo;l();f();c();l();f();c();function qo(s,t,e,o){var p=-1,d=s==null?0:s.length;for(o&&d&&(e=s[++p]);++p<d;)e=t(e,s[p],p,s);return e}var Ln=qo;l();f();c();l();f();c();l();f();c();function Go(s){return function(t){return s?.[t]}}var kn=Go;var zo={\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"},Ho=kn(zo),Cn=Ho;var Yo=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Jo="\\u0300-\\u036f",Zo="\\ufe20-\\ufe2f",Ko="\\u20d0-\\u20ff",Xo=Jo+Zo+Ko,Qo="["+Xo+"]",ea=RegExp(Qo,"g");function ta(s){return s=oe(s),s&&s.replace(Yo,Cn).replace(ea,"")}var Pn=ta;l();f();c();l();f();c();var ra=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function na(s){return s.match(ra)||[]}var On=na;l();f();c();var ia=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function oa(s){return ia.test(s)}var Un=oa;l();f();c();var Dn="\\ud800-\\udfff",aa="\\u0300-\\u036f",sa="\\ufe20-\\ufe2f",ua="\\u20d0-\\u20ff",pa=aa+sa+ua,Wn="\\u2700-\\u27bf",Vn="a-z\\xdf-\\xf6\\xf8-\\xff",la="\\xac\\xb1\\xd7\\xf7",ca="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",fa="\\u2000-\\u206f",da=" \\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",qn="A-Z\\xc0-\\xd6\\xd8-\\xde",ma="\\ufe0e\\ufe0f",Gn=la+ca+fa+da,zn="['\u2019]",Mn="["+Gn+"]",ha="["+pa+"]",Hn="\\d+",ya="["+Wn+"]",Yn="["+Vn+"]",Jn="[^"+Dn+Gn+Hn+Wn+Vn+qn+"]",xa="\\ud83c[\\udffb-\\udfff]",ga="(?:"+ha+"|"+xa+")",wa="[^"+Dn+"]",Zn="(?:\\ud83c[\\udde6-\\uddff]){2}",Kn="[\\ud800-\\udbff][\\udc00-\\udfff]",ge="["+qn+"]",ba="\\u200d",$n="(?:"+Yn+"|"+Jn+")",va="(?:"+ge+"|"+Jn+")",jn="(?:"+zn+"(?:d|ll|m|re|s|t|ve))?",_n="(?:"+zn+"(?:D|LL|M|RE|S|T|VE))?",Xn=ga+"?",Qn="["+ma+"]?",Ia="(?:"+ba+"(?:"+[wa,Zn,Kn].join("|")+")"+Qn+Xn+")*",Ta="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ea="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Aa=Qn+Xn+Ia,Ra="(?:"+[ya,Zn,Kn].join("|")+")"+Aa,Ba=RegExp([ge+"?"+Yn+"+"+jn+"(?="+[Mn,ge,"$"].join("|")+")",va+"+"+_n+"(?="+[Mn,ge+$n,"$"].join("|")+")",ge+"?"+$n+"+"+jn,ge+"+"+_n,Ea,Ta,Hn,Ra].join("|"),"g");function Fa(s){return s.match(Ba)||[]}var ei=Fa;function Na(s,t,e){return s=oe(s),t=e?void 0:t,t===void 0?Un(s)?ei(s):On(s):s.match(t)||[]}var ti=Na;var Sa="['\u2019]",La=RegExp(Sa,"g");function ka(s){return function(t){return Ln(ti(Pn(t).replace(La,"")),s,"")}}var ri=ka;var Ca=ri(function(s,t,e){return t=t.toLowerCase(),s+(e?Sn(t):t)}),Je=Ca;l();f();c();function P(s){throw new Error("Unexpected value: "+JSON.stringify(s))}l();f();c();function Se(s){return Object.keys(s)}l();f();c();l();f();c();l();f();c();var Le=x.env.FERN_STACK_TRACK?.toLowerCase()??"",X=Le!==""&&Le!=="0"&&Le!=="false",ft=["single","multiline","box"].includes(Le)?Le:"single";X&&(Error.stackTraceLimit=50);var Pa=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),Oa=new Set(["stacktrace"]);function Ke({maxFrames:s=50,skip:t=0,filterPaths:e=[],filterFunctions:o=[],stopOn:p=[],filterNode:d=!0,filterJs:u=!0,formatFilename:I=T=>T}={}){if(!X)return[];o=[...o,...Pa],e=[...e,...Oa],p=[...p,"runInteractiveTask"];let T=!1;return(new Error().stack??"").split(`
|
|
2
|
-
`).map(
|
|
3
|
-
`:""}${
|
|
1
|
+
"use strict";var qe=Object.defineProperty;var _i=Object.getOwnPropertyDescriptor;var Di=Object.getOwnPropertyNames;var Wi=Object.prototype.hasOwnProperty;var Vi=(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})},qi=(s,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let p of Di(t))!Wi.call(s,p)&&p!==e&&qe(s,p,{get:()=>t[p],enumerable:!(i=_i(t,p))||i.enumerable});return s};var Gi=s=>qi(qe({},"__esModule",{value:!0}),s);var v=(s,t,e)=>Vi(s,typeof t!="symbol"?t+"":t,e);var l=ye(()=>{"use strict"});var x={};K(x,{_debugEnd:()=>Ir,_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:()=>Er,_stopProfilerIdleNotifier:()=>Tr,_tickCallback:()=>vr,abort:()=>Nr,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:()=>Br,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 zi(){!xe||!se||(xe=!1,se.length?Q=se.concat(Q):Ge=-1,Q.length&&Pt())}function Pt(){if(!xe){var s=setTimeout(zi,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,Ir,Er,Tr,Ar,Rr,Br,Nr,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,Ir=D,Er=D,Tr=D,Ar=void 0,Rr=void 0,Br=void 0,Nr=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:Ir,_startProfilerIdleNotifier:Er,_stopProfilerIdleNotifier:Tr,stdout:Ar,stdin:Br,stderr:Rr,abort:Nr,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 Hi(){if(Kr)return Ne;Kr=!0,Ne.byteLength=I,Ne.toByteArray=F,Ne.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 I(T){var A=u(T),S=A[0],j=A[1];return(S+j)*3/4-j}function E(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(E(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 Ne}function Yi(){if(Xr)return Ye;Xr=!0;return Ye.read=function(s,t,e,i,p){var d,u,I=p*8-i-1,E=(1<<I)-1,F=E>>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+=I;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===E)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,I,E,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?(I=isNaN(t)?1:0,u=R):(u=Math.floor(Math.log(t)/Math.LN2),t*(E=Math.pow(2,-u))<1&&(u--,E*=2),u+C>=1?t+=W/E:t+=W*Math.pow(2,1-C),t*E>=2&&(u++,E/=2),u+C>=R?(I=0,u=R):u+C>=1?(I=(t*E-1)*Math.pow(2,p),u=u+C):(I=t*Math.pow(2,C-1)*Math.pow(2,p),u=0));p>=8;s[e+T]=I&255,T+=A,I/=256,p-=8);for(u=u<<p|I,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=Hi(),t=Yi(),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 I(o,r,n)}u.poolSize=8192;function I(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 I(o,r,n)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array);function E(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 E(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 E(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 Li(this,r,n);case"utf8":case"utf-8":return Tt(this,r,n);case"ascii":return Fi(this,r,n);case"latin1":case"binary":return Si(this,r,n);case"base64":return Bi(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ci(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,B=a-n,U=Math.min(y,B),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],B=M[L];break}return y<B?-1:B<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:Et(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):Et(o,[r],n,a,m);throw new TypeError("val must be string, number or Buffer")}function Et(o,r,n,a,m){let h=1,y=o.length,B=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,B/=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===B)return M*h}else M!==-1&&(O-=O-M),M=-1}else for(n+B>y&&(n=y-B),O=n;O>=0;O--){let M=!0;for(let L=0;L<B;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 B=parseInt(r.substr(y*2,2),16);if(at(B))return y;o[n+y]=B}return y}function Ei(o,r,n,a){return Ve(ot(r,o.length-n),o,n,a)}function Ti(o,r,n,a){return Ve(Ui(r),o,n,a)}function Ai(o,r,n,a){return Ve(kt(r),o,n,a)}function Ri(o,r,n,a){return Ve(Mi(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 Ei(this,r,n,a);case"ascii":case"latin1":case"binary":return Ti(this,r,n,a);case"base64":return Ai(this,r,n,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ri(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,B=h>239?4:h>223?3:h>191?2:1;if(m+B<=n){let U,O,M,L;switch(B){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,B=1):y>65535&&(y-=65536,a.push(y>>>10&1023|55296),y=56320|y&1023),a.push(y),m+=B}return Ni(a)}let At=4096;function Ni(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 Fi(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 Si(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 Li(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+=$i[o[h]];return m}function Ci(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)&&Be(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)&&Be(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)&&Be(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)&&Be(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 B=Math.pow(2,8*a)-1;z(this,r,n,a,B,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 B=Math.pow(2,8*a)-1;z(this,r,n,a,B,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 Bt(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 Bt(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,B=0;for(this[n]=r&255;++h<a&&(y*=256);)r<0&&B===0&&this[n+h-1]!==0&&(B=1),this[n+h]=(r/y>>0)-B&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,B=0;for(this[n+h]=r&255;--h>=0&&(y*=256);)r<0&&B===0&&this[n+h+1]!==0&&(B=1),this[n+h]=(r/y>>0)-B&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 Bt(this,r,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Nt(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||Nt(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||Nt(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),B=y.length;if(B===0)throw new TypeError('The value "'+r+'" is invalid for argument "value"');for(h=0;h<a-n;++h)this[h+n]=y[h%B]}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 ki(o,r,n){he(r,"offset"),(o[r]===void 0||o[r+n]===void 0)&&Be(r,o.length-(n+1))}function Ct(o,r,n,a,m,h){if(o>n||o<r){let y=typeof r=="bigint"?"n":"",B;throw r===0||r===BigInt(0)?B=`>= 0${y} and < 2${y} ** ${(h+1)*8}${y}`:B=`>= -(2${y} ** ${(h+1)*8-1}${y}) and < 2 ** ${(h+1)*8-1}${y}`,new me.ERR_OUT_OF_RANGE("value",B,o)}ki(a,m,h)}function he(o,r){if(typeof o!="number")throw new me.ERR_INVALID_ARG_TYPE(r,"number",o)}function Be(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 Pi=/[^+/0-9A-Za-z-_]/g;function Oi(o){if(o=o.split("=")[0],o=o.trim().replace(Pi,""),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 Ui(o){let r=[];for(let n=0;n<o.length;++n)r.push(o.charCodeAt(n)&255);return r}function Mi(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(Oi(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 $i=(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"?ji:o}function ji(){throw new Error("BigInt not supported")}return ue}var Ne,Kr,Ye,Xr,ue,Qr,tn=ye(()=>{"use strict";l();f();c();Ne={},Kr=!1;Ye={},Xr=!1;ue={},Qr=!1});var pe,g,ds,ms,rn=ye(()=>{"use strict";l();f();c();tn();pe=en();pe.Buffer;pe.SlowBuffer;pe.INSPECT_MAX_BYTES;pe.kMaxLength;g=pe.Buffer,ds=pe.INSPECT_MAX_BYTES,ms=pe.kMaxLength});var f=ye(()=>{"use strict";rn()});var es={};K(es,{DynamicSnippetsGenerator:()=>nt});module.exports=Gi(es);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 Ji=typeof global=="object"&&global&&global.Object===Object&&global,nn=Ji;var Zi=typeof self=="object"&&self&&self.Object===Object&&self,Ki=nn||Zi||Function("return this")(),on=Ki;var Xi=on.Symbol,te=Xi;l();f();c();var an=Object.prototype,Qi=an.hasOwnProperty,eo=an.toString,Fe=te?te.toStringTag:void 0;function to(s){var t=Qi.call(s,Fe),e=s[Fe];try{s[Fe]=void 0;var i=!0}catch{}var p=eo.call(s);return i&&(t?s[Fe]=e:delete s[Fe]),p}var sn=to;l();f();c();var ro=Object.prototype,no=ro.toString;function io(s){return no.call(s)}var un=io;var oo="[object Null]",ao="[object Undefined]",pn=te?te.toStringTag:void 0;function so(s){return s==null?s===void 0?ao:oo:pn&&pn in Object(s)?sn(s):un(s)}var ln=so;l();f();c();function uo(s){return s!=null&&typeof s=="object"}var cn=uo;var po="[object Symbol]";function lo(s){return typeof s=="symbol"||cn(s)&&ln(s)==po}var fn=lo;l();f();c();l();f();c();function co(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=co;l();f();c();var fo=Array.isArray,mn=fo;var mo=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==-mo?"-0":t}var gn=xn;l();f();c();function ho(s){return s==null?"":gn(s)}var oe=ho;l();f();c();l();f();c();l();f();c();l();f();c();l();f();c();l();f();c();function yo(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=yo;function xo(s,t,e){var i=s.length;return e=e===void 0?i:e,!t&&e>=i?s:wn(s,t,e)}var vn=xo;l();f();c();var go="\\ud800-\\udfff",wo="\\u0300-\\u036f",vo="\\ufe20-\\ufe2f",bo="\\u20d0-\\u20ff",Io=wo+vo+bo,Eo="\\ufe0e\\ufe0f",To="\\u200d",Ao=RegExp("["+To+go+Io+Eo+"]");function Ro(s){return Ao.test(s)}var Je=Ro;l();f();c();l();f();c();function Bo(s){return s.split("")}var bn=Bo;l();f();c();var In="\\ud800-\\udfff",No="\\u0300-\\u036f",Fo="\\ufe20-\\ufe2f",So="\\u20d0-\\u20ff",Lo=No+Fo+So,Co="\\ufe0e\\ufe0f",ko="["+In+"]",lt="["+Lo+"]",ct="\\ud83c[\\udffb-\\udfff]",Po="(?:"+lt+"|"+ct+")",En="[^"+In+"]",Tn="(?:\\ud83c[\\udde6-\\uddff]){2}",An="[\\ud800-\\udbff][\\udc00-\\udfff]",Oo="\\u200d",Rn=Po+"?",Bn="["+Co+"]?",Uo="(?:"+Oo+"(?:"+[En,Tn,An].join("|")+")"+Bn+Rn+")*",Mo=Bn+Rn+Uo,$o="(?:"+[En+lt+"?",lt,Tn,An,ko].join("|")+")",jo=RegExp(ct+"(?="+ct+")|"+$o+Mo,"g");function _o(s){return s.match(jo)||[]}var Nn=_o;function Do(s){return Je(s)?Nn(s):bn(s)}var Fn=Do;function Wo(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=Wo;var Vo=Sn("toUpperCase"),le=Vo;function qo(s){return le(oe(s).toLowerCase())}var Ln=qo;l();f();c();l();f();c();function Go(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=Go;l();f();c();l();f();c();l();f();c();function zo(s){return function(t){return s?.[t]}}var kn=zo;var Ho={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},Yo=kn(Ho),Pn=Yo;var Jo=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Zo="\\u0300-\\u036f",Ko="\\ufe20-\\ufe2f",Xo="\\u20d0-\\u20ff",Qo=Zo+Ko+Xo,ea="["+Qo+"]",ta=RegExp(ea,"g");function ra(s){return s=oe(s),s&&s.replace(Jo,Pn).replace(ta,"")}var On=ra;l();f();c();l();f();c();var na=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function ia(s){return s.match(na)||[]}var Un=ia;l();f();c();var oa=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function aa(s){return oa.test(s)}var Mn=aa;l();f();c();var Wn="\\ud800-\\udfff",sa="\\u0300-\\u036f",ua="\\ufe20-\\ufe2f",pa="\\u20d0-\\u20ff",la=sa+ua+pa,Vn="\\u2700-\\u27bf",qn="a-z\\xdf-\\xf6\\xf8-\\xff",ca="\\xac\\xb1\\xd7\\xf7",fa="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",da="\\u2000-\\u206f",ma=" \\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",ha="\\ufe0e\\ufe0f",zn=ca+fa+da+ma,Hn="['\u2019]",$n="["+zn+"]",ya="["+la+"]",Yn="\\d+",xa="["+Vn+"]",Jn="["+qn+"]",Zn="[^"+Wn+zn+Yn+Vn+qn+Gn+"]",ga="\\ud83c[\\udffb-\\udfff]",wa="(?:"+ya+"|"+ga+")",va="[^"+Wn+"]",Kn="(?:\\ud83c[\\udde6-\\uddff]){2}",Xn="[\\ud800-\\udbff][\\udc00-\\udfff]",ge="["+Gn+"]",ba="\\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=wa+"?",ei="["+ha+"]?",Ea="(?:"+ba+"(?:"+[va,Kn,Xn].join("|")+")"+ei+Qn+")*",Ta="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Aa="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Ra=ei+Qn+Ea,Ba="(?:"+[xa,Kn,Xn].join("|")+")"+Ra,Na=RegExp([ge+"?"+Jn+"+"+_n+"(?="+[$n,ge,"$"].join("|")+")",Ia+"+"+Dn+"(?="+[$n,ge+jn,"$"].join("|")+")",ge+"?"+jn+"+"+_n,ge+"+"+Dn,Aa,Ta,Yn,Ba].join("|"),"g");function Fa(s){return s.match(Na)||[]}var ti=Fa;function Sa(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=Sa;var La="['\u2019]",Ca=RegExp(La,"g");function ka(s){return function(t){return Cn(ri(On(t).replace(Ca,"")),s,"")}}var ni=ka;var Pa=ni(function(s,t,e){return t=t.toLowerCase(),s+(e?Ln(t):t)}),Se=Pa;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 Oa=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),Ua=new Set(["stacktrace"]);function Ke({maxFrames:s=50,skip:t=0,filterPaths:e=[],filterFunctions:i=[],stopOn:p=[],filterNode:d=!0,filterJs:u=!0,formatFilename:I=E=>E}={}){if(!X)return[];i=[...i,...Oa],e=[...e,...Ua],p=[...p,"runInteractiveTask"];let E=!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(E||p.some(S=>C?.includes(S))){E=!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:I(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:I=!0,multiline:E=!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=I,this.multiline=E,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:I=!1,formatFilename:E=F=>F}={}){X&&(dt??(dt=new Ze({maxFrames:s,skip:t,filterPaths:e,filterFunctions:i,stopOn:p,filterNode:d,filterJs:u,multiline:I,formatFilename:E})))}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))}},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 Ma=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(`
|
|
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
|
|
7
|
-
`),p=
|
|
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(`
|
|
8
8
|
`,`
|
|
9
|
-
${d}`);this.isAtStartOfLine()&&(u=d+u),
|
|
9
|
+
${d}`);this.isAtStartOfLine()&&(u=d+u),i&&(u+=`
|
|
10
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
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(`
|
|
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:
|
|
14
|
-
`),this.lastCharacterIsSemicolon=t.endsWith(";");let
|
|
15
|
-
`),p=X&&!this.shouldSkipTracking(o)&&this.lastCharacterIsNewline;e&&(this.lastLine=`${this.lastLine}${o.shift()||""}`),this.lastCharacterIsNewline&&o.pop(),this.lineBuffer.push(...o),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(o=>`${e?`(${e}) `:""} ${o.fn} - ${o.path} : ${o.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 Ua}};l();f();c();l();f();c();l();f();c();var Pe=class{constructor(){b(this,"reporter");b(this,"snippet");b(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 Oe=class{constructor(t){b(this,"context");this.context=t}async generate(t,e={}){let o=this.resolveEndpoints({request:t,options:e});if(o.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let p=new Pe;for(let d of o){let u=this.context.clone(),I=this.createSnippetGenerator(u);try{let T=await I.generateSnippet({endpoint:d,request:t,options:e});if(u.errors.empty())return{snippet:T,errors:void 0};p.update({context:u,snippet:T})}catch(T){p.err==null&&(p.err=T)}}return p.getResponseOrThrow({endpoint:t.endpoint})}async generateSnippetAst(t,e={}){let o=this.resolveEndpoints({request:t,options:e});if(o.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let p;for(let d of o){let u=this.context.clone(),I=this.createSnippetGenerator(u);try{return await I.generateSnippetAst({endpoint:d,request:t,options:e})}catch(T){p=T}}throw p??new Error(`Failed to generate snippet AST for endpoint: ${t.endpoint.method} ${t.endpoint.path}`)}generateSync(t,e={}){let o=this.resolveEndpoints({request:t,options:e});if(o.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let p=new Pe;for(let d of o){let u=this.context.clone(),I=this.createSnippetGenerator(u);try{let T=I.generateSnippetSync({endpoint:d,request:t,options:e});if(u.errors.empty())return{snippet:T,errors:void 0};p.update({context:u,snippet:T})}catch(T){p.err==null&&(p.err=T)}}return p.getResponseOrThrow({endpoint:t.endpoint})}resolveEndpoints({request:t,options:e}){if(e.endpointId!=null){let o=this.context.resolveEndpointById(e.endpointId);if(o==null)throw new Error(`No endpoint found with ID "${e.endpointId}"`);return[o]}return this.context.resolveEndpointLocationOrThrow(t.endpoint)}};l();f();c();l();f();c();l();f();c();var Ue=class{constructor(){b(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 o=t.match(this.REFERENCE_REGEX);if(!(o==null||o[2]==null||o[3]==null))return{namespace:o[1],method:o[2],path:o[3]}}};l();f();c();var F={Critical:"CRITICAL",Warning:"WARNING"},Me=class s{constructor(){b(this,"errors");b(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 o of t){if(typeof o=="string"){e.push(o);continue}e[e.length-1]+=`[${o.index}]`}return e}};var $e=class{constructor({ir:t,config:e,options:o={}}){b(this,"config");b(this,"options");b(this,"errors");b(this,"_ir");b(this,"httpEndpointReferenceParser");this._ir=t,this.config=e,this.options=o,this.errors=new Me,this.httpEndpointReferenceParser=new Ue}associateQueryParametersByWireValue({parameters:t,values:e}){let o=[];for(let[p,d]of Object.entries(e))if(d!==void 0){this.errors.scope(p);try{let u=t.find(T=>T.name.wireValue===p);if(u==null)throw this.newParameterNotRecognizedError(p);let I=this.isListTypeReference(u.typeReference)&&!Array.isArray(d)?[d]:d;o.push({name:u.name,typeReference:u.typeReference,value:I})}finally{this.errors.unscope()}}return o}associateByWireValueOrDefault({parameters:t,values:e}){let o=[];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:F.Critical,message:this.newParameterNotRecognizedError(p.name.wireValue).message});continue}o.push({name:p.name,typeReference:p.typeReference,value:d})}finally{this.errors.unscope()}}return o}associateByWireValue({parameters:t,values:e,ignoreMissingParameters:o}){let p=[];for(let[d,u]of Object.entries(e))if(u!==void 0){this.errors.scope(d);try{let I=t.find(T=>T.name.wireValue===d);if(I==null){if(o)continue;this.errors.add({severity:F.Critical,message:this.newParameterNotRecognizedError(d).message});continue}p.push({name:I.name,typeReference:I.typeReference,value:u})}finally{this.errors.unscope()}}return p}getExampleObjectProperties({parameters:t,snippetObject:e}){let o=typeof e=="object"&&e!==null&&!Array.isArray(e)?e:{},p=[];for(let d of t){let u=o[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 o=e[t.wireValue];if(o!=null){if(typeof o!="string"){this.errors.add({severity:F.Critical,message:`Expected file value to be a string, got ${typeof o}`});return}return o}}getFileArrayValues({property:t,record:e}){let o=e[t.wireValue];if(o==null)return;if(!Array.isArray(o)){this.errors.add({severity:F.Critical,message:`Expected file array value to be an array of strings, got ${typeof o}`});return}let p=[];for(let d of o){if(typeof d!="string"){this.errors.add({severity:F.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:F.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:F.Critical,message:`Type identified by "${t}" could not be found`});return}return e}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e}){let o=this.getRecord(e);if(o==null)return;let p=t.discriminant.wireValue,d=o[p];if(d==null){this.errors.add({severity:F.Critical,message:this.newParameterNotRecognizedError(p).message});return}if(typeof d!="string"){this.errors.add({severity:F.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:F.Critical,message:`No type found for discriminant value "${d}"`});return}let{[p]:I,...T}=o;return{singleDiscriminatedUnionType:u,discriminantValue:u.discriminantValue,value:T}}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 o of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:o,parsedEndpoint:t})&&e.push(o);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:o}){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:o}):!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 o=e.environments.find(p=>p.id===t);return o?.name}case"multipleBaseUrls":{let o=e.environments.find(p=>p.id===t);return o?.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:F.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:F.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let o=e.environments[0];if(o==null)return this.errors.add({severity:F.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let p=new Set(Se(o.urls));for(let d of Se(t))p.has(d)&&p.delete(d);return p.size>0?(this.errors.add({severity:F.Critical,message:`The provided environments are invalid; got: [${Object.keys(t).join(", ")}], expected: [${Se(o.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:t}){if(typeof t!="number"){this.errors.add({severity:F.Critical,message:this.newTypeMismatchError({expected:"number",value:t}).message});return}return t}getValueAsBoolean({value:t}){if(typeof t!="boolean"){this.errors.add({severity:F.Critical,message:this.newTypeMismatchError({expected:"boolean",value:t}).message});return}return t}getValueAsString({value:t}){if(typeof t!="string"){this.errors.add({severity:F.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 Ce{constructor({customConfig:e,formatter:o}){super();b(this,"customConfig");b(this,"formatter");b(this,"imports",{});b(this,"defaultImports",{});b(this,"starImportAliases",{});b(this,"starImportAliasesInverse",{});this.customConfig=e,this.formatter=o??new ke}addImport(e){var o,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=(o=this.imports)[p=e.importFrom.moduleName]??(o[p]=[]);d.map(I=>I.name).includes(e.name)||d.push(e)}}validateDefault(e){var p,d;if(e.importFrom?.type!=="default")return;let o=(p=this.defaultImports)[d=e.importFrom.moduleName]??(p[d]=e);if(o.name!==e.name)throw new Error(`Cannot have multiple default imports for module ${e.importFrom.moduleName}: got ${e.name} but already had ${o.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 I of u)I.importFrom?.type==="named"&&I.importFrom.moduleName!==e.importFrom.moduleName&&I.name===e.name&&d.push(I);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,I,T;if(e.importFrom?.type!=="star")return;let o=(d=this.starImportAliases)[u=e.importFrom.moduleName]??(d[u]=e.importFrom.starImportAlias);if(o!==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 ${o}.`);if(((I=this.starImportAliasesInverse)[T=e.importFrom.starImportAlias]??(I[T]=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 je=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}
|
|
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 Ma}};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(),I=this.createSnippetGenerator(u);try{let E=await I.generateSnippet({endpoint:d,request:t,options:e});if(u.errors.empty())return{snippet:E,errors:void 0};p.update({context:u,snippet:E})}catch(E){p.err==null&&(p.err=E)}}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(),I=this.createSnippetGenerator(u);try{return await I.generateSnippetAst({endpoint:d,request:t,options:e})}catch(E){p=E}}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(),I=this.createSnippetGenerator(u);try{let E=I.generateSnippetSync({endpoint:d,request:t,options:e});if(u.errors.empty())return{snippet:E,errors:void 0};p.update({context:u,snippet:E})}catch(E){p.err==null&&(p.err=E)}}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 N={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(E=>E.name.wireValue===p);if(u==null)throw this.newParameterNotRecognizedError(p);let I=this.isListTypeReference(u.typeReference)&&!Array.isArray(d)?[d]:d;i.push({name:u.name,typeReference:u.typeReference,value:I})}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:N.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=[];for(let[d,u]of Object.entries(e))if(u!==void 0){this.errors.scope(d);try{let I=t.find(E=>E.name.wireValue===d);if(I==null){if(i)continue;this.errors.add({severity:N.Critical,message:this.newParameterNotRecognizedError(d).message});continue}p.push({name:I.name,typeReference:I.typeReference,value:u})}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:N.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:N.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:N.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:N.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:N.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:N.Critical,message:this.newParameterNotRecognizedError(p).message});return}if(typeof d!="string"){this.errors.add({severity:N.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:N.Critical,message:`No type found for discriminant value "${d}"`});return}let{[p]:I,...E}=i;return{singleDiscriminatedUnionType:u,discriminantValue:u.discriminantValue,value:E}}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:N.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:N.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:N.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:N.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:N.Critical,message:this.newTypeMismatchError({expected:"number",value:t}).message});return}return t}getValueAsBoolean({value:t}){if(typeof t!="boolean"){this.errors.add({severity:N.Critical,message:this.newTypeMismatchError({expected:"boolean",value:t}).message});return}return t}getValueAsString({value:t}){if(typeof t!="string"){this.errors.add({severity:N.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(I=>I.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 I of u)I.importFrom?.type==="named"&&I.importFrom.moduleName!==e.importFrom.moduleName&&I.name===e.name&&d.push(I);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,I,E;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(((I=this.starImportAliasesInverse)[E=e.importFrom.starImportAlias]??(I[E]=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
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
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,
|
|
19
|
-
`}}return t}};var
|
|
20
|
-
`).forEach(
|
|
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:
|
|
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(E=>E.importFrom?.type==="named"),I=this.starImportAliases[e];if(u.length>0||p!=null||I!=null){if(t+="import",p!=null&&(t+=` ${p.name}`),u.length>0){for(let F of u.slice(0,-1))d+=`${F.name}, `;let E=u[u.length-1];E!=null&&(d+=`${E.name}`),p!=null&&(t+=","),t+=` { ${d} }`}I!=null&&((p!=null||u.length>0)&&(t+=", "),t+=` * as ${I}`),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:()=>Ie,FunctionInvocation:()=>Ee,MethodInvocation:()=>Te,Parameter:()=>Ae,Reference:()=>de,Type:()=>fe,TypeLiteral:()=>re,Types:()=>fe,Variable:()=>Re,Writer:()=>we,codeblock:()=>Wa,function_:()=>Va,instantiateClass:()=>qa,invokeFunction:()=>Ga,invokeMethod:()=>za,parameter:()=>Ha,reference:()=>Ya,variable:()=>Ja});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 Ie=class extends k{constructor({name:e,parameters:i,async:p,body:d,return_:u,docs:I}){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=I}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 Ee=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
22
|
`),d=p[0]+`
|
|
23
23
|
`,u=p.slice(1).join(`
|
|
24
|
-
`);e.write(d.replaceAll("`","\\`")),e.writeNoIndent(u.replaceAll("`","\\`")),e.write("`")}writeIterable({writer:e,iterable:o}){let p=ja({values:o.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:o}){let p=$a({entries:o.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:o}){let p=Ma({fields:o.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:o}){switch(typeof o){case"boolean":e.write(o.toString());return;case"string":e.write(o.includes('"')?`\`${o}\``:`"${o}"`);return;case"number":e.write(o.toString());return;case"object":if(o==null){e.write("null");return}if(Array.isArray(o)){this.writeUnknownArray({writer:e,value:o});return}this.writeUnknownObject({writer:e,value:o});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof o}`)}}writeUnknownArray({writer:e,value:o}){if(o.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let p of o)e.writeNode(s.unknown(p)),e.writeLine(",");e.dedent(),e.write("]")}writeUnknownObject({writer:e,value:o}){let p=Object.entries(o);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 Ma({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 ja({values:s}){return s.filter(t=>!re.isNop(t))}l();f();c();var Re=class extends C{constructor(e){super();b(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 Da(s){return new ve(s)}function Wa(s){return new Ie(s)}function Va(s){return new be(s)}function qa(s){return new Te(s)}function Ga(s){return new Ee(s)}function za(s){return new Ae(s)}function Ha(s){return new fe(s)}function Ya(s){return new Re(s)}l();f();c();l();f();c();function oi({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:void 0,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:Ja(e.repoUrl),license:s.license?._visit({basic:o=>o.id,custom:o=>`See ${o.filename}`,_other:()=>{}})};default:throw new Error(`Encountered unknown output mode: ${e}`)}}function Ja(s){if(s!=null)return s.startsWith("https://github.com/")?`git+${s}`:s.startsWith("ssh://github.com/")?`github:${_e(s).replace("ssh://github.com/","")}`:s.startsWith("https://bitbucket.org/")?`bitbucket:${_e(s).replace("https://bitbucket.org/","")}`:s.startsWith("ssh://bitbucket.org/")?`bitbucket:${_e(s).replace("ssh://bitbucket.org/","")}`:s.startsWith("https://gitlab.com/")?`gitlab:${_e(s).replace("https://gitlab.com/","")}`:s.startsWith("ssh://gitlab.com/")?`gitlab:${_e(s).replace("ssh://gitlab.com/","")}`:(s.startsWith("git+")||(s=`git+${s}`),s.endsWith(".git")||(s=`${s}.git`),s)}function _e(s){return s.endsWith(".git")?s.slice(0,-4):s}l();f();c();function ht({organization:s,workspaceName:t,namespaceExport:e}){return e??`${xe(Je(s))}${xe(Je(t))}`}l();f();c();l();f();c();var De={};K(De,{commons:()=>ai,dynamic:()=>wt,generatorExec:()=>vt});l();f();c();l();f();c();var ai={};l();f();c();var wt={};K(wt,{ErrorSeverity:()=>mi,HttpMethod:()=>fi,ObjectPropertyAccess:()=>hi,PrimitiveTypeV1:()=>yi,auth:()=>si,commons:()=>ui,declaration:()=>pi,endpoints:()=>li,environment:()=>ci,http:()=>yt,ir:()=>di,snippets:()=>xt,types:()=>gt,variables:()=>xi});l();f();c();l();f();c();var si={};l();f();c();var ui={};l();f();c();var pi={};l();f();c();var li={};l();f();c();var ci={};l();f();c();var yt={};K(yt,{HttpMethod:()=>fi});l();f();c();l();f();c();var fi={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD"};var di={};l();f();c();var xt={};K(xt,{ErrorSeverity:()=>mi});l();f();c();l();f();c();var mi={Critical:"CRITICAL",Warning:"WARNING"};var gt={};K(gt,{ObjectPropertyAccess:()=>hi,PrimitiveTypeV1:()=>yi});l();f();c();l();f();c();var hi={ReadOnly:"READ_ONLY",WriteOnly:"WRITE_ONLY"};l();f();c();var yi={Integer:"INTEGER",Long:"LONG",Uint:"UINT",Uint64:"UINT_64",Float:"FLOAT",Double:"DOUBLE",Boolean:"BOOLEAN",String:"STRING",Date:"DATE",DateTime:"DATE_TIME",Uuid:"UUID",Base64:"BASE_64",BigInteger:"BIG_INTEGER"};var xi={};l();f();c();var vt={};K(vt,{LicenseId:()=>gi,config:()=>bt});l();f();c();l();f();c();var bt={};K(bt,{LicenseId:()=>gi});l();f();c();l();f();c();var gi={Mit:"MIT",Apache2:"Apache-2.0"};var Za="value",Qe=class{constructor({context:t}){b(this,"context");this.context=t}convert(t){let e=t.convertOpts;if(t.value===null)return this.context.isNullable(t.typeReference)?v.TypeLiteral.null():(this.context.errors.add({severity:F.Critical,message:"Expected non-null value, but got null"}),v.TypeLiteral.nop());if(t.value===void 0)return v.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 o=this.context.resolveNamedType({typeId:t.typeReference.value});return o==null?v.TypeLiteral.nop():this.convertNamed({named:o,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 o=this.context.getValueAsBoolean({value:e});return o==null?v.TypeLiteral.nop():v.TypeLiteral.boolean(o)}case"string":{let o=this.context.getValueAsString({value:e});return o==null?v.TypeLiteral.nop():v.TypeLiteral.string(o)}default:P(t)}}convertList({list:t,value:e,convertOpts:o}){return Array.isArray(e)?v.TypeLiteral.array({values:e.map((p,d)=>{this.context.errors.scope({index:d});try{return this.convert({typeReference:t,value:p,convertOpts:o})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:F.Critical,message:`Expected array but got: ${typeof e}`}),v.TypeLiteral.nop())}convertSet({set:t,value:e,convertOpts:o}){return Array.isArray(e)?v.TypeLiteral.set({values:e.map((p,d)=>{this.context.errors.scope({index:d});try{return this.convert({typeReference:t,value:p,convertOpts:o})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:F.Critical,message:`Expected array but got: ${typeof e}`}),v.TypeLiteral.nop())}convertMap({map:t,value:e,convertOpts:o}){return typeof e!="object"||e==null?(this.context.errors.add({severity:F.Critical,message:`Expected object but got: ${e==null?"null":typeof e}`}),v.TypeLiteral.nop()):v.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:o}),value:this.convert({typeReference:t.value,value:d,convertOpts:o})}}finally{this.context.errors.unscope()}})})}convertNamed({named:t,value:e,as:o,convertOpts:p}){switch(t.type){case"alias":return this.context.customConfig?.useBrandedStringAliases?v.TypeLiteral.reference(v.codeblock(d=>{d.writeNode(v.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:o,convertOpts:p})),d.write(")")})):this.convert({typeReference:t.typeReference,value:e,as:o,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:o}){let p=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e});if(p==null)return v.TypeLiteral.nop();let d=p.singleDiscriminatedUnionType,u=this.convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:p,unionVariant:d,convertOpts:o});if(u==null)return v.TypeLiteral.nop();if(this.context.customConfig?.includeUtilsOnUnionMembers)return v.TypeLiteral.reference(v.codeblock(T=>{T.writeNode(v.invokeMethod({on:v.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:o})}))}));let I={name:this.context.getPropertyName(t.discriminant.name),value:v.TypeLiteral.string(d.discriminantValue.wireValue)};return v.TypeLiteral.object({fields:[I,...u]})}convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:t,unionVariant:e,convertOpts:o}){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:o});if(!u.isObject()){this.context.errors.add({severity:F.Critical,message:"Internal error; expected union value to be an object"});return}let I=u.asObjectOrThrow();return[...p,...I.fields]}case"singleProperty":try{this.context.errors.scope(e.discriminantValue.wireValue);let d=this.context.getRecord(t.value);return d==null?[...p,{name:Za,value:this.convert({typeReference:e.typeReference,value:t.value,convertOpts:o})}]:[...p,{name:this.context.getPropertyName(e.discriminantValue.name),value:this.convert({typeReference:e.typeReference,value:d[e.discriminantValue.wireValue],convertOpts:o})}]}finally{this.context.errors.unscope()}case"noProperties":return p;default:P(e)}}convertDiscriminatedUnionUtilsArgs({discriminatedUnionTypeInstance:t,unionVariant:e,unionProperties:o,convertOpts:p}){return e.type==="singleProperty"&&this.context.getRecord(t.value)==null&&o.length===1?[this.convert({typeReference:e.typeReference,value:t.value,convertOpts:p})]:o.length>0?[v.TypeLiteral.object({fields:o})]:[]}getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:e,convertOpts:o}){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:o})}}finally{this.context.errors.unscope()}})}convertObject({object_:t,value:e,convertOpts:o}){let p=this.context.associateByWireValue({parameters:this.filterReadWriteProperties(t.properties,o),values:this.context.getRecord(e)??{}});return v.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:o})}}finally{this.context.errors.unscope()}})})}filterReadWriteProperties(t,e){return this.context.customConfig?.experimentalGenerateReadWriteOnlyTypes!==!0||typeof e>"u"||(e.isForRequest&&(t=t.filter(o=>o.propertyAccess!==De.dynamic.ObjectPropertyAccess.ReadOnly)),e.isForResponse&&(t=t.filter(o=>o.propertyAccess!==De.dynamic.ObjectPropertyAccess.WriteOnly))),t}convertEnum({enum_:t,value:e}){let o=this.getEnumValue({enum_:t,value:e});return o==null?v.TypeLiteral.nop():v.TypeLiteral.string(o)}getEnumValue({enum_:t,value:e}){if(typeof e!="string"){this.context.errors.add({severity:F.Critical,message:`Expected enum value string, got: ${typeof e}`});return}if(t.values.find(p=>p.wireValue===e)==null){this.context.errors.add({severity:F.Critical,message:`An enum value named "${e}" does not exist in this context`});return}return e}convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e,convertOpts:o}){let p=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e,convertOpts:o});return p??v.TypeLiteral.nop()}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e,convertOpts:o}){for(let p of t.types){let d=this.context.errors.size();try{let u=this.convert({typeReference:p,value:e,convertOpts:o});if(v.TypeLiteral.isNop(u)){this.context.errors.truncate(d);continue}return u}catch{this.context.errors.truncate(d);continue}}this.context.errors.add({severity:F.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof e}" value`})}convertUnknown({value:t,convertOpts:e}){return v.TypeLiteral.unknown(t)}convertPrimitive({primitive:t,value:e,as:o,convertOpts:p}){switch(t){case"INTEGER":case"UINT":{let d=this.getValueAsNumber({value:e,as:o});return d==null?v.TypeLiteral.nop():v.TypeLiteral.number(d)}case"LONG":case"UINT_64":{let d=this.getValueAsNumber({value:e,as:o});return d==null?v.TypeLiteral.nop():this.context.customConfig?.useBigInt?v.TypeLiteral.bigint(BigInt(d)):v.TypeLiteral.number(d)}case"FLOAT":case"DOUBLE":{let d=this.getValueAsNumber({value:e});return d==null?v.TypeLiteral.nop():v.TypeLiteral.number(d)}case"BOOLEAN":{let d=this.getValueAsBoolean({value:e,as:o});return d==null?v.TypeLiteral.nop():v.TypeLiteral.boolean(d)}case"BASE_64":case"DATE":case"UUID":case"STRING":{let d=this.context.getValueAsString({value:e});return d==null?v.TypeLiteral.nop():v.TypeLiteral.string(d)}case"DATE_TIME":{let d=this.context.getValueAsString({value:e});return d==null?v.TypeLiteral.nop():v.TypeLiteral.datetime(d)}case"BIG_INTEGER":{let d=this.context.getValueAsString({value:e});return d==null?v.TypeLiteral.nop():this.context.customConfig?.useBigInt?v.TypeLiteral.bigint(BigInt(d)):v.TypeLiteral.string(d)}default:P(t)}}getValueAsNumber({value:t,as:e}){let o=e==="key"&&typeof t=="string"?Number(t):t;return this.context.getValueAsNumber({value:o})}getValueAsBoolean({value:t,as:e}){let o=e==="key"?typeof t=="string"?t==="true":t==="false"?!1:t:t;return this.context.getValueAsBoolean({value:o})}};l();f();c();var et=class{constructor({context:t}){b(this,"context");this.context=t}getFilePropertyInfo({body:t,value:e}){let o={fileFields:[],bodyPropertyFields:[]},p=this.context.getRecord(e)??{};for(let d of t.properties)switch(d.type){case"file":o.fileFields.push({name:this.context.getPropertyName(d.name),value:this.getSingleFileProperty({property:d,record:p})});break;case"fileArray":o.fileFields.push({name:this.context.getPropertyName(d.name),value:this.getArrayFileProperty({property:d,record:p})});break;case"bodyProperty":o.bodyPropertyFields.push({name:this.context.getPropertyName(d.name.name),value:this.getBodyProperty({property:d,record:p})});break;default:P(d)}return o}getSingleFileProperty({property:t,record:e}){let o=this.context.getSingleFileValue({property:t,record:e});return o==null?v.TypeLiteral.nop():v.TypeLiteral.blob(o)}getArrayFileProperty({property:t,record:e}){let o=this.context.getFileArrayValues({property:t,record:e});return o==null?v.TypeLiteral.nop():v.TypeLiteral.array({values:o.map(p=>v.TypeLiteral.blob(p))})}getBodyProperty({property:t,record:e}){let o=e[t.name.wireValue];return o==null?v.TypeLiteral.nop():this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:o})}};var tt=class s extends $e{constructor({ir:e,config:o}){super({ir:e,config:o});b(this,"ir");b(this,"customConfig");b(this,"dynamicTypeLiteralMapper");b(this,"filePropertyMapper");b(this,"moduleName");b(this,"namespaceExport");this.ir=e,this.customConfig=o.customConfig!=null?o.customConfig:void 0,this.dynamicTypeLiteralMapper=new Qe({context:this}),this.filePropertyMapper=new et({context:this}),this.moduleName=Ka({config:o,customConfig:this.customConfig}),this.namespaceExport=ht({organization:o.organization,workspaceName:o.workspaceName,namespaceExport:this.customConfig?.namespaceExport})}clone(){return new s({ir:this.ir,config:this.config})}getModuleImport(){return{type:"named",moduleName:this.moduleName}}getRootClientName(){return`${this.namespaceExport}Client`}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 o=this.resolveEnvironmentName(e);if(o!=null)return this.getEnvironmentsTypeReference(o)}getFullyQualifiedReference({declaration:e}){return e.fernFilepath.allParts.length>0?`${e.fernFilepath.allParts.map(o=>o.camelCase.unsafeName).join(".")}.${this.getTypeName(e.name)}`:`${this.getTypeName(e.name)}`}getEnvironmentsTypeReference(e){return v.reference({name:`${this.namespaceExport}Environment`,importFrom:this.getModuleImport(),memberName:this.getTypeName(e)})}formatOriginalPropertyName(e){return e.includes("-")?`"${e}"`:e}};function Ka({config:s,customConfig:t}){return oi({generatorConfig:s,isPackagePrivate:t?.private??!1})?.packageName??s.organization}l();f();c();var wi="client",bi="main",Xa={type:"primitive",value:"STRING"},rt=class{constructor({context:t}){b(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 v.codeblock(o=>{o.writeNode(v.function_({name:bi,async:!0,parameters:[],body:v.codeblock(p=>{p.writeNodeStatement(this.constructClient({endpoint:t,snippet:e})),p.writeNodeStatement(this.callMethod({endpoint:t,snippet:e}))})})),o.writeNodeStatement(v.invokeFunction({function_:v.reference({name:bi}),arguments_:[]}))})}constructClient({endpoint:t,snippet:e}){return v.variable({name:wi,const:!0,initializer:v.instantiateClass({class_:v.reference({name:this.context.getRootClientName(),importFrom:this.context.getModuleImport()}),arguments_:[this.getConstructorArgs({endpoint:t,snippet:e})]})})}getConstructorArgs({endpoint:t,snippet:e}){let o=[],p=this.getConstructorEnvironmentArgs({baseUrl:e.baseURL,environment:e.environment});return p.length>0&&o.push(...p),t.auth!=null&&(e.auth!=null?o.push(...this.getConstructorAuthArgs({auth:t.auth,values:e.auth})):this.context.errors.add({severity:F.Warning,message:`Auth with ${t.auth.type} configuration is required for this endpoint`})),this.context.errors.scope(J.PathParameters),this.context.ir.pathParameters!=null&&o.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&&o.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:e.headers})),this.context.errors.unscope(),o.length===0?v.TypeLiteral.nop():v.TypeLiteral.object({fields:o})}getConstructorEnvironmentArgs({baseUrl:t,environment:e}){let o=this.getEnvironmentValue({baseUrl:t,environment:e});return o==null?[]:[{name:"environment",value:o}]}getEnvironmentValue({baseUrl:t,environment:e}){if(t!=null&&e!=null){this.context.errors.add({severity:F.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(t!=null)return v.TypeLiteral.string(t);if(e!=null){if(this.context.isSingleEnvironmentID(e)){let o=this.context.getEnvironmentTypeReferenceFromID(e);if(o==null){this.context.errors.add({severity:F.Warning,message:`Environment ${JSON.stringify(e)} was not found`});return}return v.TypeLiteral.reference(o)}if(this.context.isMultiEnvironmentValues(e))return this.context.validateMultiEnvironmentUrlValues(e)?v.TypeLiteral.object({fields:Object.entries(e).map(([o,p])=>({name:o,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:Xa,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:F.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message})}addWarning(t){this.context.errors.add({severity:F.Warning,message:t})}getConstructorBasicAuthArg({auth:t,values:e}){return[{name:this.context.getPropertyName(t.username),value:v.TypeLiteral.string(e.username)},{name:this.context.getPropertyName(t.password),value:v.TypeLiteral.string(e.password)}]}getConstructorBearerAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.token),value:v.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:v.TypeLiteral.string(e.clientId)},{name:this.context.getPropertyName(t.clientSecret),value:v.TypeLiteral.string(e.clientSecret)}]}getConstructorHeaderArgs({headers:t,values:e}){let o=[];for(let p of t){let d=e[p.name.wireValue],u=this.getConstructorHeaderArg({header:p,value:d});u!=null&&o.push(u)}return o}getConstructorHeaderArg({header:t,value:e}){let o=this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:e});if(!v.TypeLiteral.isNop(o))return{name:this.context.getPropertyName(t.name.name),value:o}}callMethod({endpoint:t,snippet:e}){return v.invokeMethod({on:v.reference({name:wi}),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 o=[];this.context.errors.scope(J.PathParameters);let p=[...this.context.ir.pathParameters??[],...t.pathParameters??[]];return p.length>0&&o.push(...this.getPathParameters({namedParameters:p,snippet:e}).map(d=>d.value)),this.context.errors.unscope(),this.context.errors.scope(J.RequestBody),t.body!=null&&o.push(this.getBodyRequestArg({body:t.body,value:e.requestBody})),this.context.errors.unscope(),o}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:F.Critical,message:`Expected bytes value to be a string, got ${typeof t}`}),v.TypeLiteral.nop()):v.TypeLiteral.blob(t)}getMethodArgsForInlinedRequest({request:t,snippet:e}){let o=[],{inlinePathParameters:p,inlineFileProperties:d}={inlinePathParameters:this.context.customConfig?.inlinePathParameters??!1,inlineFileProperties:this.context.customConfig?.inlineFileProperties??!1};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 I=this.getFilePropertyInfo({request:t,snippet:e});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:p})||o.push(...u.map(T=>T.value)),d||o.push(...I.fileFields.map(T=>T.value)),this.context.needsRequestParameter({request:t,inlinePathParameters:p,inlineFileProperties:d})&&o.push(this.getInlinedRequestArg({request:t,snippet:e,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:p})?u:[],filePropertyInfo:I})),o}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:o,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 T=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 N=t.body!=null?this.getInlinedRequestBodyObjectFields({body:t.body,value:e.requestBody,filePropertyInfo:p}):[];return this.context.errors.unscope(),v.TypeLiteral.object({fields:[...o,...u,...T,...N]})}getInlinedRequestBodyObjectFields({body:t,value:e,filePropertyInfo:o}){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:o});default:P(t)}}getFileUploadRequestBodyObjectFields({filePropertyInfo:t}){return this.context.customConfig?.inlineFileProperties?[...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 o=[],p=this.context.associateByWireValue({parameters:t,values:this.context.getRecord(e)??{}});for(let d of p)o.push({name:this.context.getPropertyName(d.name.name),value:this.context.dynamicTypeLiteralMapper.convert({...d,convertOpts:{isForRequest:!0}})});return o}getPathParameters({namedParameters:t,snippet:e}){let o=[],p=this.context.associateByWireValue({parameters:t,values:e.pathParameters??{},ignoreMissingParameters:!0});for(let d of p)o.push({name:this.context.getPropertyName(d.name.name),value:this.context.dynamicTypeLiteralMapper.convert({...d,convertOpts:{isForRequest:!0}})});return o}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 Oe{constructor({ir:t,config:e}){super(new tt({ir:t,config:e}))}async generate(t){return super.generate(t)}generateSync(t){return super.generateSync(t)}async generateSnippetAst(t){return super.generateSnippetAst(t)}createSnippetGenerator(t){return new rt({context:t})}};0&&(module.exports={DynamicSnippetsGenerator});
|
|
24
|
+
`);e.write(d.replaceAll("`","\\`")),e.writeNoIndent(u.replaceAll("`","\\`")),e.write("`")}writeIterable({writer:e,iterable:i}){let p=_a({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=ja({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=$a({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 $a({fields:s}){return s.filter(t=>!re.isNop(t.value))}function ja({entries:s}){return s.filter(t=>!re.isNop(t.key)&&!re.isNop(t.value))}function _a({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 Wa(s){return new be(s)}function Va(s){return new Ie(s)}function qa(s){return new ve(s)}function Ga(s){return new Ee(s)}function za(s){return new Te(s)}function Ha(s){return new Ae(s)}function Ya(s){return new de(s)}function Ja(s){return new Re(s)}l();f();c();l();f();c();function ai({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:void 0,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:Za(e.repoUrl),license:s.license?._visit({basic:i=>i.id,custom:i=>`See ${i.filename}`,_other:()=>{}})};default:throw new Error(`Encountered unknown output mode: ${e}`)}}function Za(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}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:()=>si,dynamic:()=>vt,generatorExec:()=>It});l();f();c();l();f();c();var si={};l();f();c();var vt={};K(vt,{ErrorSeverity:()=>hi,HttpMethod:()=>di,ObjectPropertyAccess:()=>yi,PrimitiveTypeV1:()=>xi,auth:()=>ui,commons:()=>pi,declaration:()=>li,endpoints:()=>ci,environment:()=>fi,http:()=>xt,ir:()=>mi,snippets:()=>gt,types:()=>wt,variables:()=>gi});l();f();c();l();f();c();var ui={};l();f();c();var pi={};l();f();c();var li={};l();f();c();var ci={};l();f();c();var fi={};l();f();c();var xt={};K(xt,{HttpMethod:()=>di});l();f();c();l();f();c();var di={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD"};var mi={};l();f();c();var gt={};K(gt,{ErrorSeverity:()=>hi});l();f();c();l();f();c();var hi={Critical:"CRITICAL",Warning:"WARNING"};var wt={};K(wt,{ObjectPropertyAccess:()=>yi,PrimitiveTypeV1:()=>xi});l();f();c();l();f();c();var yi={ReadOnly:"READ_ONLY",WriteOnly:"WRITE_ONLY"};l();f();c();var xi={Integer:"INTEGER",Long:"LONG",Uint:"UINT",Uint64:"UINT_64",Float:"FLOAT",Double:"DOUBLE",Boolean:"BOOLEAN",String:"STRING",Date:"DATE",DateTime:"DATE_TIME",Uuid:"UUID",Base64:"BASE_64",BigInteger:"BIG_INTEGER"};var gi={};l();f();c();var It={};K(It,{LicenseId:()=>wi,config:()=>bt});l();f();c();l();f();c();var bt={};K(bt,{LicenseId:()=>wi});l();f();c();l();f();c();var wi={Mit:"MIT",Apache2:"Apache-2.0"};var Ka="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:N.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:N.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:N.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:N.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(E=>{E.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 I={name:this.context.getPropertyName(t.discriminant.name),value:b.TypeLiteral.string(d.discriminantValue.wireValue)};return b.TypeLiteral.object({fields:[I,...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:N.Critical,message:"Internal error; expected union value to be an object"});return}let I=u.asObjectOrThrow();return[...p,...I.fields]}case"singleProperty":try{this.context.errors.scope(e.discriminantValue.wireValue);let d=this.context.getRecord(t.value);return d==null?[...p,{name:Ka,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:N.Critical,message:`Expected enum value string, got: ${typeof e}`});return}if(t.values.find(p=>p.wireValue===e)==null){this.context.errors.add({severity:N.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.truncate(d);continue}return u}catch{this.context.errors.truncate(d);continue}}this.context.errors.add({severity:N.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":{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=Xa({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 Xa({config:s,customConfig:t}){return ai({generatorConfig:s,isPackagePrivate:t?.private??!1})?.packageName??s.organization}l();f();c();var vi="client",bi="main",Qa={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:bi,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:bi}),arguments_:[]}))})}constructClient({endpoint:t,snippet:e}){return b.variable({name:vi,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:N.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:N.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:N.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:Qa,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:N.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message})}addWarning(t){this.context.errors.add({severity:N.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:vi}),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:N.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??!1,inlineFileProperties:this.context.customConfig?.inlineFileProperties??!1};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 I=this.getFilePropertyInfo({request:t,snippet:e});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:p})||i.push(...u.map(E=>E.value)),d||i.push(...I.fileFields.map(E=>E.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:I})),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 E=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,...E,...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?[...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){return super.generate(t)}generateSync(t){return super.generateSync(t)}async generateSnippetAst(t){return super.generateSnippetAst(t)}createSnippetGenerator(t){return new rt({context:t})}};0&&(module.exports={DynamicSnippetsGenerator});
|
|
25
25
|
/*! Bundled license information:
|
|
26
26
|
|
|
27
27
|
@jspm/core/nodelibs/browser/chunk-DtuTasat.js:
|