@fern-api/java-dynamic-snippets 0.0.4 → 0.0.5
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/cjs/Config.cjs.map +1 -1
- package/cjs/DynamicSnippetsGenerator.cjs +18 -9
- package/cjs/DynamicSnippetsGenerator.cjs.map +1 -1
- package/cjs/DynamicSnippetsGenerator.d.cts +1 -1
- package/cjs/{DynamicSnippetsGeneratorContext-FbVOZ8Go.d.cts → DynamicSnippetsGeneratorContext-DGzYoCz3.d.cts} +11 -1
- package/cjs/EndpointSnippetGenerator.cjs +14 -11
- package/cjs/EndpointSnippetGenerator.cjs.map +1 -1
- package/cjs/EndpointSnippetGenerator.d.cts +1 -1
- package/cjs/context/DynamicSnippetsGeneratorContext.cjs +18 -9
- package/cjs/context/DynamicSnippetsGeneratorContext.cjs.map +1 -1
- package/cjs/context/DynamicSnippetsGeneratorContext.d.cts +1 -1
- package/cjs/context/DynamicTypeLiteralMapper.cjs +18 -9
- package/cjs/context/DynamicTypeLiteralMapper.cjs.map +1 -1
- package/cjs/context/DynamicTypeLiteralMapper.d.cts +1 -1
- package/cjs/context/DynamicTypeMapper.cjs +12 -9
- package/cjs/context/DynamicTypeMapper.cjs.map +1 -1
- package/cjs/context/DynamicTypeMapper.d.cts +1 -1
- package/cjs/context/FilePropertyMapper.cjs +14 -11
- package/cjs/context/FilePropertyMapper.cjs.map +1 -1
- package/cjs/context/FilePropertyMapper.d.cts +1 -1
- package/cjs/index.cjs +20 -23
- package/cjs/index.cjs.map +1 -1
- package/cjs/index.d.cts +1 -1
- package/esm/Config.js +1 -1
- package/esm/DynamicSnippetsGenerator.d.ts +1 -1
- package/esm/DynamicSnippetsGenerator.js +1 -1
- package/esm/{DynamicSnippetsGeneratorContext-FbVOZ8Go.d.ts → DynamicSnippetsGeneratorContext-DGzYoCz3.d.ts} +11 -1
- package/esm/EndpointSnippetGenerator.d.ts +1 -1
- package/esm/EndpointSnippetGenerator.js +1 -1
- package/esm/chunk-2U3YQWRZ.js +12 -0
- package/esm/chunk-2U3YQWRZ.js.map +1 -0
- package/esm/chunk-3X524Y2I.js +23 -0
- package/esm/chunk-3X524Y2I.js.map +1 -0
- package/esm/chunk-5CTXVUPZ.js +8 -0
- package/esm/chunk-5CTXVUPZ.js.map +1 -0
- package/esm/{chunk-3LOINSB3.js → chunk-EOZMORS3.js} +2 -2
- package/esm/chunk-JFD4YVTW.js +15 -0
- package/esm/chunk-JFD4YVTW.js.map +1 -0
- package/esm/chunk-KQE3JYZ2.js +2 -0
- package/esm/chunk-KQE3JYZ2.js.map +1 -0
- package/esm/chunk-N3AIOPEV.js +2 -0
- package/esm/chunk-PBNDQMXA.js +2 -0
- package/esm/{chunk-PUPEW5QI.js.map → chunk-PBNDQMXA.js.map} +1 -1
- package/esm/{chunk-6YM2QG7U.js → chunk-QH22Z5KY.js} +2 -2
- package/esm/{chunk-JZBCQWQN.js → chunk-VYJE6STI.js} +2 -2
- package/esm/context/DynamicSnippetsGeneratorContext.d.ts +1 -1
- package/esm/context/DynamicSnippetsGeneratorContext.js +1 -1
- package/esm/context/DynamicTypeLiteralMapper.d.ts +1 -1
- package/esm/context/DynamicTypeLiteralMapper.js +1 -1
- package/esm/context/DynamicTypeMapper.d.ts +1 -1
- package/esm/context/DynamicTypeMapper.js +1 -1
- package/esm/context/FilePropertyMapper.d.ts +1 -1
- package/esm/context/FilePropertyMapper.js +1 -1
- package/esm/index.d.ts +1 -1
- package/esm/index.js +1 -13
- package/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/esm/chunk-3JSOCWNQ.js +0 -20
- package/esm/chunk-3JSOCWNQ.js.map +0 -1
- package/esm/chunk-E6GFFTKW.js +0 -12
- package/esm/chunk-E6GFFTKW.js.map +0 -1
- package/esm/chunk-JZ2FDMYI.js +0 -15
- package/esm/chunk-JZ2FDMYI.js.map +0 -1
- package/esm/chunk-PUPEW5QI.js +0 -2
- package/esm/chunk-SQKACQJK.js +0 -2
- package/esm/chunk-SQKACQJK.js.map +0 -1
- package/esm/chunk-WBGWLNLI.js +0 -2
- package/esm/chunk-ZYVZJBJN.js +0 -2
- package/esm/chunk-ZYVZJBJN.js.map +0 -1
- /package/esm/{chunk-3LOINSB3.js.map → chunk-EOZMORS3.js.map} +0 -0
- /package/esm/{chunk-WBGWLNLI.js.map → chunk-N3AIOPEV.js.map} +0 -0
- /package/esm/{chunk-6YM2QG7U.js.map → chunk-QH22Z5KY.js.map} +0 -0
- /package/esm/{chunk-JZBCQWQN.js.map → chunk-VYJE6STI.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbstractDynamicSnippetsGenerator, FernGeneratorExec, Options } from '@fern-api/browser-compatible-base-generator';
|
|
2
2
|
import { FernIr } from '@fern-api/dynamic-ir-sdk';
|
|
3
|
-
import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-
|
|
3
|
+
import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-DGzYoCz3.cjs';
|
|
4
4
|
import { EndpointSnippetGenerator } from './EndpointSnippetGenerator.cjs';
|
|
5
5
|
import '@fern-api/java-ast';
|
|
6
6
|
|
|
@@ -9,7 +9,7 @@ declare namespace DynamicTypeLiteralMapper {
|
|
|
9
9
|
as?: ConvertedAs;
|
|
10
10
|
inUndiscriminatedUnion?: boolean;
|
|
11
11
|
}
|
|
12
|
-
type ConvertedAs = "mapKey" | "mapValue";
|
|
12
|
+
type ConvertedAs = "mapKey" | "mapValue" | "request";
|
|
13
13
|
}
|
|
14
14
|
declare class DynamicTypeLiteralMapper {
|
|
15
15
|
private context;
|
|
@@ -110,6 +110,16 @@ declare class DynamicSnippetsGeneratorContext extends AbstractDynamicSnippetsGen
|
|
|
110
110
|
getByteArrayInputStreamClassReference(): java.ClassReference;
|
|
111
111
|
getStandardCharsetsClassReference(): java.ClassReference;
|
|
112
112
|
isPrimitive(typeReference: FernIr.dynamic.TypeReference): boolean;
|
|
113
|
+
isDirectLiteral(typeReference: FernIr.dynamic.TypeReference): boolean;
|
|
114
|
+
sortTypeInstancesByRequiredFirst(instances: Array<{
|
|
115
|
+
name: FernIr.dynamic.NameAndWireValue;
|
|
116
|
+
typeReference: FernIr.dynamic.TypeReference;
|
|
117
|
+
value: unknown;
|
|
118
|
+
}>, parameters: FernIr.dynamic.NamedParameter[]): Array<{
|
|
119
|
+
name: FernIr.dynamic.NameAndWireValue;
|
|
120
|
+
typeReference: FernIr.dynamic.TypeReference;
|
|
121
|
+
value: unknown;
|
|
122
|
+
}>;
|
|
113
123
|
getRootPackageName(): string;
|
|
114
124
|
getCorePackageName(): string;
|
|
115
125
|
getTypesPackageName(fernFilepath: FernIr.dynamic.FernFilepath): string;
|
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
"use strict";var te=Object.defineProperty;var Xe=Object.getOwnPropertyDescriptor;var Ze=Object.getOwnPropertyNames;var et=Object.prototype.hasOwnProperty;var tt=(n,t,e)=>t in n?te(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var me=(n,t)=>()=>(n&&(t=n(n=0)),t);var Ie=(n,t)=>{for(var e in t)te(n,e,{get:t[e],enumerable:!0})},rt=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ze(t))!et.call(n,i)&&i!==e&&te(n,i,{get:()=>t[i],enumerable:!(r=Xe(t,i))||r.enumerable});return n};var nt=n=>rt(te({},"__esModule",{value:!0}),n);var y=(n,t,e)=>tt(n,typeof t!="symbol"?t+"":t,e);function Ne(){throw new Error("setTimeout has not been defined")}function Ee(){throw new Error("clearTimeout has not been defined")}function be(n){if(_===setTimeout)return setTimeout(n,0);if((_===Ne||!_)&&setTimeout)return _=setTimeout,setTimeout(n,0);try{return _(n,0)}catch(t){try{return _.call(null,n,0)}catch(e){return _.call(this,n,0)}}}function it(n){if(F===clearTimeout)return clearTimeout(n);if((F===Ee||!F)&&clearTimeout)return F=clearTimeout,clearTimeout(n);try{return F(n)}catch(t){try{return F.call(null,n)}catch(e){return F.call(this,n)}}}function at(){!z||!U||(z=!1,U.length?C=U.concat(C):re=-1,C.length&&ke())}function ke(){if(!z){var n=be(at);z=!0;for(var t=C.length;t;){for(U=C,C=[];++re<t;)U&&U[re].run();re=-1,t=C.length}U=null,z=!1,it(n)}}function st(n){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];C.push(new Pe(n,t)),C.length===1&&!z&&be(ke)}function Pe(n,t){this.fun=n,this.array=t}function O(){}function It(n){throw new Error("process.binding is not supported")}function Rt(){return"/"}function Nt(n){throw new Error("process.chdir is not supported")}function Et(){return 0}function kt(n){var t=bt.call(K)*.001,e=Math.floor(t),r=Math.floor(t%1*1e9);return n&&(e=e-n[0],r=r-n[1],r<0&&(e--,r+=1e9)),[e,r]}function Bt(){var n=new Date,t=n-Pt;return t/1e3}var _,F,C,z,U,re,ot,ut,ct,lt,pt,ht,ft,mt,dt,yt,gt,wt,xt,vt,Tt,At,K,bt,Pt,g,Re,l=me(()=>{"use strict";_=Ne,F=Ee;typeof globalThis.setTimeout=="function"&&(_=setTimeout);typeof globalThis.clearTimeout=="function"&&(F=clearTimeout);C=[],z=!1,re=-1;Pe.prototype.run=function(){this.fun.apply(null,this.array)};ot="browser",ut="browser",ct=!0,lt={},pt=[],ht="",ft={},mt={},dt={};yt=O,gt=O,wt=O,xt=O,vt=O,Tt=O,At=O;K=globalThis.performance||{},bt=K.now||K.mozNow||K.msNow||K.oNow||K.webkitNow||function(){return new Date().getTime()};Pt=new Date;g={nextTick:st,title:ot,browser:ct,env:lt,argv:pt,version:ht,versions:ft,on:yt,addListener:gt,once:wt,off:xt,removeListener:vt,removeAllListeners:Tt,emit:At,binding:It,cwd:Rt,chdir:Nt,umask:Et,hrtime:kt,platform:ut,release:mt,config:dt,uptime:Bt},Re={};Object.keys(Re).forEach(n=>{let t=n.split("."),e=g;for(let r=0;r<t.length;r++){let i=t[r];r===t.length-1?e[i]=Re[n]:e=e[i]||(e[i]={})}})});function Le(){ye=!0;for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=n.length;t<e;++t)B[t]=n[t],b[n.charCodeAt(t)]=t;b[45]=62,b[95]=63}function Ct(n){ye||Le();var t,e,r,i,a,s,u=n.length;if(u%4>0)throw new Error("Invalid string. Length must be a multiple of 4");a=n[u-2]==="="?2:n[u-1]==="="?1:0,s=new St(u*3/4-a),r=a>0?u-4:u;var c=0;for(t=0,e=0;t<r;t+=4,e+=3)i=b[n.charCodeAt(t)]<<18|b[n.charCodeAt(t+1)]<<12|b[n.charCodeAt(t+2)]<<6|b[n.charCodeAt(t+3)],s[c++]=i>>16&255,s[c++]=i>>8&255,s[c++]=i&255;return a===2?(i=b[n.charCodeAt(t)]<<2|b[n.charCodeAt(t+1)]>>4,s[c++]=i&255):a===1&&(i=b[n.charCodeAt(t)]<<10|b[n.charCodeAt(t+1)]<<4|b[n.charCodeAt(t+2)]>>2,s[c++]=i>>8&255,s[c++]=i&255),s}function Lt(n){return B[n>>18&63]+B[n>>12&63]+B[n>>6&63]+B[n&63]}function Mt(n,t,e){for(var r,i=[],a=t;a<e;a+=3)r=(n[a]<<16)+(n[a+1]<<8)+n[a+2],i.push(Lt(r));return i.join("")}function Be(n){ye||Le();for(var t,e=n.length,r=e%3,i="",a=[],s=16383,u=0,c=e-r;u<c;u+=s)a.push(Mt(n,u,u+s>c?c:u+s));return r===1?(t=n[e-1],i+=B[t>>2],i+=B[t<<4&63],i+="=="):r===2&&(t=(n[e-2]<<8)+n[e-1],i+=B[t>>10],i+=B[t>>4&63],i+=B[t<<2&63],i+="="),a.push(i),a.join("")}function ne(){return o.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function L(n,t){if(ne()<t)throw new RangeError("Invalid typed array length");return o.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(t),n.__proto__=o.prototype):(n===null&&(n=new o(t)),n.length=t),n}function o(n,t,e){if(!o.TYPED_ARRAY_SUPPORT&&!(this instanceof o))return new o(n,t,e);if(typeof n=="number"){if(typeof t=="string")throw new Error("If encoding is specified then the first argument must be a string");return ge(this,n)}return Me(this,n,t,e)}function Me(n,t,e,r){if(typeof t=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer!="undefined"&&t instanceof ArrayBuffer?Ut(n,t,e,r):typeof t=="string"?Ft(n,t,e):Ot(n,t)}function _e(n){if(typeof n!="number")throw new TypeError('"size" argument must be a number');if(n<0)throw new RangeError('"size" argument must not be negative')}function _t(n,t,e,r){return _e(t),t<=0?L(n,t):e!==void 0?typeof r=="string"?L(n,t).fill(e,r):L(n,t).fill(e):L(n,t)}function ge(n,t){if(_e(t),n=L(n,t<0?0:we(t)|0),!o.TYPED_ARRAY_SUPPORT)for(var e=0;e<t;++e)n[e]=0;return n}function Ft(n,t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!o.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=Fe(t,e)|0;n=L(n,r);var i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function de(n,t){var e=t.length<0?0:we(t.length)|0;n=L(n,e);for(var r=0;r<e;r+=1)n[r]=t[r]&255;return n}function Ut(n,t,e,r){if(t.byteLength,e<0||t.byteLength<e)throw new RangeError("'offset' is out of bounds");if(t.byteLength<e+(r||0))throw new RangeError("'length' is out of bounds");return e===void 0&&r===void 0?t=new Uint8Array(t):r===void 0?t=new Uint8Array(t,e):t=new Uint8Array(t,e,r),o.TYPED_ARRAY_SUPPORT?(n=t,n.__proto__=o.prototype):n=de(n,t),n}function Ot(n,t){if(S(t)){var e=we(t.length)|0;return n=L(n,e),n.length===0||t.copy(n,0,0,e),n}if(t){if(typeof ArrayBuffer!="undefined"&&t.buffer instanceof ArrayBuffer||"length"in t)return typeof t.length!="number"||nr(t.length)?L(n,0):de(n,t);if(t.type==="Buffer"&&Array.isArray(t.data))return de(n,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function we(n){if(n>=ne())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ne().toString(16)+" bytes");return n|0}function S(n){return!!(n!=null&&n._isBuffer)}function Fe(n,t){if(S(n))return n.length;if(typeof ArrayBuffer!="undefined"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(n)||n instanceof ArrayBuffer))return n.byteLength;typeof n!="string"&&(n=""+n);var e=n.length;if(e===0)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return ie(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return $e(n).length;default:if(r)return ie(n).length;t=(""+t).toLowerCase(),r=!0}}function jt(n,t,e){var r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,t>>>=0,e<=t))return"";for(n||(n="utf8");;)switch(n){case"hex":return Kt(this,t,e);case"utf8":case"utf-8":return je(this,t,e);case"ascii":return Gt(this,t,e);case"latin1":case"binary":return Jt(this,t,e);case"base64":return Vt(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return zt(this,t,e);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),r=!0}}function j(n,t,e){var r=n[t];n[t]=n[e],n[e]=r}function Ue(n,t,e,r,i){if(n.length===0)return-1;if(typeof e=="string"?(r=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:n.length-1),e<0&&(e=n.length+e),e>=n.length){if(i)return-1;e=n.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof t=="string"&&(t=o.from(t,r)),S(t))return t.length===0?-1:Se(n,t,e,r,i);if(typeof t=="number")return t=t&255,o.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(n,t,e):Uint8Array.prototype.lastIndexOf.call(n,t,e):Se(n,[t],e,r,i);throw new TypeError("val must be string, number or Buffer")}function Se(n,t,e,r,i){var a=1,s=n.length,u=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(n.length<2||t.length<2)return-1;a=2,s/=2,u/=2,e/=2}function c(A,E){return a===1?A[E]:A.readUInt16BE(E*a)}var h;if(i){var m=-1;for(h=e;h<s;h++)if(c(n,h)===c(t,m===-1?0:h-m)){if(m===-1&&(m=h),h-m+1===u)return m*a}else m!==-1&&(h-=h-m),m=-1}else for(e+u>s&&(e=s-u),h=e;h>=0;h--){for(var d=!0,v=0;v<u;v++)if(c(n,h+v)!==c(t,v)){d=!1;break}if(d)return h}return-1}function qt(n,t,e,r){e=Number(e)||0;var i=n.length-e;r?(r=Number(r),r>i&&(r=i)):r=i;var a=t.length;if(a%2!==0)throw new TypeError("Invalid hex string");r>a/2&&(r=a/2);for(var s=0;s<r;++s){var u=parseInt(t.substr(s*2,2),16);if(isNaN(u))return s;n[e+s]=u}return s}function Dt(n,t,e,r){return oe(ie(t,n.length-e),n,e,r)}function Oe(n,t,e,r){return oe(tr(t),n,e,r)}function Yt(n,t,e,r){return Oe(n,t,e,r)}function $t(n,t,e,r){return oe($e(t),n,e,r)}function Wt(n,t,e,r){return oe(rr(t,n.length-e),n,e,r)}function Vt(n,t,e){return t===0&&e===n.length?Be(n):Be(n.slice(t,e))}function je(n,t,e){e=Math.min(n.length,e);for(var r=[],i=t;i<e;){var a=n[i],s=null,u=a>239?4:a>223?3:a>191?2:1;if(i+u<=e){var c,h,m,d;switch(u){case 1:a<128&&(s=a);break;case 2:c=n[i+1],(c&192)===128&&(d=(a&31)<<6|c&63,d>127&&(s=d));break;case 3:c=n[i+1],h=n[i+2],(c&192)===128&&(h&192)===128&&(d=(a&15)<<12|(c&63)<<6|h&63,d>2047&&(d<55296||d>57343)&&(s=d));break;case 4:c=n[i+1],h=n[i+2],m=n[i+3],(c&192)===128&&(h&192)===128&&(m&192)===128&&(d=(a&15)<<18|(c&63)<<12|(h&63)<<6|m&63,d>65535&&d<1114112&&(s=d))}}s===null?(s=65533,u=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|s&1023),r.push(s),i+=u}return Ht(r)}function Ht(n){var t=n.length;if(t<=Ce)return String.fromCharCode.apply(String,n);for(var e="",r=0;r<t;)e+=String.fromCharCode.apply(String,n.slice(r,r+=Ce));return e}function Gt(n,t,e){var r="";e=Math.min(n.length,e);for(var i=t;i<e;++i)r+=String.fromCharCode(n[i]&127);return r}function Jt(n,t,e){var r="";e=Math.min(n.length,e);for(var i=t;i<e;++i)r+=String.fromCharCode(n[i]);return r}function Kt(n,t,e){var r=n.length;(!t||t<0)&&(t=0),(!e||e<0||e>r)&&(e=r);for(var i="",a=t;a<e;++a)i+=er(n[a]);return i}function zt(n,t,e){for(var r=n.slice(t,e),i="",a=0;a<r.length;a+=2)i+=String.fromCharCode(r[a]+r[a+1]*256);return i}function T(n,t,e){if(n%1!==0||n<0)throw new RangeError("offset is not uint");if(n+t>e)throw new RangeError("Trying to access beyond buffer length")}function I(n,t,e,r,i,a){if(!S(n))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw new RangeError('"value" argument is out of bounds');if(e+r>n.length)throw new RangeError("Index out of range")}function ae(n,t,e,r){t<0&&(t=65535+t+1);for(var i=0,a=Math.min(n.length-e,2);i<a;++i)n[e+i]=(t&255<<8*(r?i:1-i))>>>(r?i:1-i)*8}function se(n,t,e,r){t<0&&(t=4294967295+t+1);for(var i=0,a=Math.min(n.length-e,4);i<a;++i)n[e+i]=t>>>(r?i:3-i)*8&255}function qe(n,t,e,r,i,a){if(e+r>n.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function De(n,t,e,r,i){return i||qe(n,t,e,4,34028234663852886e22,-34028234663852886e22),Ve(n,t,e,r,23,4),e+4}function Ye(n,t,e,r,i){return i||qe(n,t,e,8,17976931348623157e292,-17976931348623157e292),Ve(n,t,e,r,52,8),e+8}function Xt(n){if(n=Zt(n).replace(Qt,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}function Zt(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}function er(n){return n<16?"0"+n.toString(16):n.toString(16)}function ie(n,t){t=t||1/0;for(var e,r=n.length,i=null,a=[],s=0;s<r;++s){if(e=n.charCodeAt(s),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&a.push(239,191,189);continue}else if(s+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&a.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;a.push(e)}else if(e<2048){if((t-=2)<0)break;a.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;a.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;a.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return a}function tr(n){for(var t=[],e=0;e<n.length;++e)t.push(n.charCodeAt(e)&255);return t}function rr(n,t){for(var e,r,i,a=[],s=0;s<n.length&&!((t-=2)<0);++s)e=n.charCodeAt(s),r=e>>8,i=e%256,a.push(i),a.push(r);return a}function $e(n){return Ct(Xt(n))}function oe(n,t,e,r){for(var i=0;i<r&&!(i+e>=t.length||i>=n.length);++i)t[i+e]=n[i];return i}function nr(n){return n!==n}function ir(n){return n!=null&&(!!n._isBuffer||We(n)||ar(n))}function We(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function ar(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&We(n.slice(0,0))}function ue(n,t,e,r,i){var a,s,u=i*8-r-1,c=(1<<u)-1,h=c>>1,m=-7,d=e?i-1:0,v=e?-1:1,A=n[t+d];for(d+=v,a=A&(1<<-m)-1,A>>=-m,m+=u;m>0;a=a*256+n[t+d],d+=v,m-=8);for(s=a&(1<<-m)-1,a>>=-m,m+=r;m>0;s=s*256+n[t+d],d+=v,m-=8);if(a===0)a=1-h;else{if(a===c)return s?NaN:(A?-1:1)*(1/0);s=s+Math.pow(2,r),a=a-h}return(A?-1:1)*s*Math.pow(2,a-r)}function Ve(n,t,e,r,i,a){var s,u,c,h=a*8-i-1,m=(1<<h)-1,d=m>>1,v=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=r?0:a-1,E=r?1:-1,Qe=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,s=m):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),s+d>=1?t+=v/c:t+=v*Math.pow(2,1-d),t*c>=2&&(s++,c/=2),s+d>=m?(u=0,s=m):s+d>=1?(u=(t*c-1)*Math.pow(2,i),s=s+d):(u=t*Math.pow(2,d-1)*Math.pow(2,i),s=0));i>=8;n[e+A]=u&255,A+=E,u/=256,i-=8);for(s=s<<i|u,h+=i;h>0;n[e+A]=s&255,A+=E,s/=256,h-=8);n[e+A-E]|=Qe*128}var B,b,St,ye,Ce,Qt,He=me(()=>{"use strict";l();p();B=[],b=[],St=typeof Uint8Array!="undefined"?Uint8Array:Array,ye=!1;o.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;o.poolSize=8192;o._augment=function(n){return n.__proto__=o.prototype,n};o.from=function(n,t,e){return Me(null,n,t,e)};o.kMaxLength=ne();o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&o[Symbol.species]);o.alloc=function(n,t,e){return _t(null,n,t,e)};o.allocUnsafe=function(n){return ge(null,n)};o.allocUnsafeSlow=function(n){return ge(null,n)};o.isBuffer=ir;o.compare=function(t,e){if(!S(t)||!S(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,i=e.length,a=0,s=Math.min(r,i);a<s;++a)if(t[a]!==e[a]){r=t[a],i=e[a];break}return r<i?-1:i<r?1:0};o.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};o.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return o.alloc(0);var r;if(e===void 0)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var i=o.allocUnsafe(e),a=0;for(r=0;r<t.length;++r){var s=t[r];if(!S(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(i,a),a+=s.length}return i};o.byteLength=Fe;o.prototype._isBuffer=!0;o.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)j(this,e,e+1);return this};o.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)j(this,e,e+3),j(this,e+1,e+2);return this};o.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)j(this,e,e+7),j(this,e+1,e+6),j(this,e+2,e+5),j(this,e+3,e+4);return this};o.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?je(this,0,t):jt.apply(this,arguments)};o.prototype.equals=function(t){if(!S(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:o.compare(this,t)===0};o.prototype.compare=function(t,e,r,i,a){if(!S(t))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),r===void 0&&(r=t?t.length:0),i===void 0&&(i=0),a===void 0&&(a=this.length),e<0||r>t.length||i<0||a>this.length)throw new RangeError("out of range index");if(i>=a&&e>=r)return 0;if(i>=a)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,i>>>=0,a>>>=0,this===t)return 0;for(var s=a-i,u=r-e,c=Math.min(s,u),h=this.slice(i,a),m=t.slice(e,r),d=0;d<c;++d)if(h[d]!==m[d]){s=h[d],u=m[d];break}return s<u?-1:u<s?1:0};o.prototype.includes=function(t,e,r){return this.indexOf(t,e,r)!==-1};o.prototype.indexOf=function(t,e,r){return Ue(this,t,e,r,!0)};o.prototype.lastIndexOf=function(t,e,r){return Ue(this,t,e,r,!1)};o.prototype.write=function(t,e,r,i){if(e===void 0)i="utf8",r=this.length,e=0;else if(r===void 0&&typeof e=="string")i=e,r=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(r)?(r=r|0,i===void 0&&(i="utf8")):(i=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var a=this.length-e;if((r===void 0||r>a)&&(r=a),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return qt(this,t,e,r);case"utf8":case"utf-8":return Dt(this,t,e,r);case"ascii":return Oe(this,t,e,r);case"latin1":case"binary":return Yt(this,t,e,r);case"base64":return $t(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Wt(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};Ce=4096;o.prototype.slice=function(t,e){var r=this.length;t=~~t,e=e===void 0?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e<t&&(e=t);var i;if(o.TYPED_ARRAY_SUPPORT)i=this.subarray(t,e),i.__proto__=o.prototype;else{var a=e-t;i=new o(a,void 0);for(var s=0;s<a;++s)i[s]=this[s+t]}return i};o.prototype.readUIntLE=function(t,e,r){t=t|0,e=e|0,r||T(t,e,this.length);for(var i=this[t],a=1,s=0;++s<e&&(a*=256);)i+=this[t+s]*a;return i};o.prototype.readUIntBE=function(t,e,r){t=t|0,e=e|0,r||T(t,e,this.length);for(var i=this[t+--e],a=1;e>0&&(a*=256);)i+=this[t+--e]*a;return i};o.prototype.readUInt8=function(t,e){return e||T(t,1,this.length),this[t]};o.prototype.readUInt16LE=function(t,e){return e||T(t,2,this.length),this[t]|this[t+1]<<8};o.prototype.readUInt16BE=function(t,e){return e||T(t,2,this.length),this[t]<<8|this[t+1]};o.prototype.readUInt32LE=function(t,e){return e||T(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};o.prototype.readUInt32BE=function(t,e){return e||T(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};o.prototype.readIntLE=function(t,e,r){t=t|0,e=e|0,r||T(t,e,this.length);for(var i=this[t],a=1,s=0;++s<e&&(a*=256);)i+=this[t+s]*a;return a*=128,i>=a&&(i-=Math.pow(2,8*e)),i};o.prototype.readIntBE=function(t,e,r){t=t|0,e=e|0,r||T(t,e,this.length);for(var i=e,a=1,s=this[t+--i];i>0&&(a*=256);)s+=this[t+--i]*a;return a*=128,s>=a&&(s-=Math.pow(2,8*e)),s};o.prototype.readInt8=function(t,e){return e||T(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};o.prototype.readInt16LE=function(t,e){e||T(t,2,this.length);var r=this[t]|this[t+1]<<8;return r&32768?r|4294901760:r};o.prototype.readInt16BE=function(t,e){e||T(t,2,this.length);var r=this[t+1]|this[t]<<8;return r&32768?r|4294901760:r};o.prototype.readInt32LE=function(t,e){return e||T(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};o.prototype.readInt32BE=function(t,e){return e||T(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};o.prototype.readFloatLE=function(t,e){return e||T(t,4,this.length),ue(this,t,!0,23,4)};o.prototype.readFloatBE=function(t,e){return e||T(t,4,this.length),ue(this,t,!1,23,4)};o.prototype.readDoubleLE=function(t,e){return e||T(t,8,this.length),ue(this,t,!0,52,8)};o.prototype.readDoubleBE=function(t,e){return e||T(t,8,this.length),ue(this,t,!1,52,8)};o.prototype.writeUIntLE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var a=Math.pow(2,8*r)-1;I(this,t,e,r,a,0)}var s=1,u=0;for(this[e]=t&255;++u<r&&(s*=256);)this[e+u]=t/s&255;return e+r};o.prototype.writeUIntBE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var a=Math.pow(2,8*r)-1;I(this,t,e,r,a,0)}var s=r-1,u=1;for(this[e+s]=t&255;--s>=0&&(u*=256);)this[e+s]=t/u&255;return e+r};o.prototype.writeUInt8=function(t,e,r){return t=+t,e=e|0,r||I(this,t,e,1,255,0),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=t&255,e+1};o.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=e|0,r||I(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):ae(this,t,e,!0),e+2};o.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=e|0,r||I(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):ae(this,t,e,!1),e+2};o.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=e|0,r||I(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255):se(this,t,e,!0),e+4};o.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=e|0,r||I(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):se(this,t,e,!1),e+4};o.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e=e|0,!i){var a=Math.pow(2,8*r-1);I(this,t,e,r,a-1,-a)}var s=0,u=1,c=0;for(this[e]=t&255;++s<r&&(u*=256);)t<0&&c===0&&this[e+s-1]!==0&&(c=1),this[e+s]=(t/u>>0)-c&255;return e+r};o.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e=e|0,!i){var a=Math.pow(2,8*r-1);I(this,t,e,r,a-1,-a)}var s=r-1,u=1,c=0;for(this[e+s]=t&255;--s>=0&&(u*=256);)t<0&&c===0&&this[e+s+1]!==0&&(c=1),this[e+s]=(t/u>>0)-c&255;return e+r};o.prototype.writeInt8=function(t,e,r){return t=+t,e=e|0,r||I(this,t,e,1,127,-128),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=t&255,e+1};o.prototype.writeInt16LE=function(t,e,r){return t=+t,e=e|0,r||I(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):ae(this,t,e,!0),e+2};o.prototype.writeInt16BE=function(t,e,r){return t=+t,e=e|0,r||I(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):ae(this,t,e,!1),e+2};o.prototype.writeInt32LE=function(t,e,r){return t=+t,e=e|0,r||I(this,t,e,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):se(this,t,e,!0),e+4};o.prototype.writeInt32BE=function(t,e,r){return t=+t,e=e|0,r||I(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):se(this,t,e,!1),e+4};o.prototype.writeFloatLE=function(t,e,r){return De(this,t,e,!0,r)};o.prototype.writeFloatBE=function(t,e,r){return De(this,t,e,!1,r)};o.prototype.writeDoubleLE=function(t,e,r){return Ye(this,t,e,!0,r)};o.prototype.writeDoubleBE=function(t,e,r){return Ye(this,t,e,!1,r)};o.prototype.copy=function(t,e,r,i){if(r||(r=0),!i&&i!==0&&(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<r&&(i=r),i===r||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);var a=i-r,s;if(this===t&&r<e&&e<i)for(s=a-1;s>=0;--s)t[s+e]=this[s+r];else if(a<1e3||!o.TYPED_ARRAY_SUPPORT)for(s=0;s<a;++s)t[s+e]=this[s+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+a),e);return a};o.prototype.fill=function(t,e,r,i){if(typeof t=="string"){if(typeof e=="string"?(i=e,e=0,r=this.length):typeof r=="string"&&(i=r,r=this.length),t.length===1){var a=t.charCodeAt(0);a<256&&(t=a)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!o.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof t=="number"&&(t=t&255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;e=e>>>0,r=r===void 0?this.length:r>>>0,t||(t=0);var s;if(typeof t=="number")for(s=e;s<r;++s)this[s]=t;else{var u=S(t)?t:ie(new o(t,i).toString()),c=u.length;for(s=0;s<r-e;++s)this[s+e]=u[s%c]}return this};Qt=/[^+\/0-9A-Za-z-_]/g});var p=me(()=>{"use strict";He()});var _r={};Ie(_r,{EndpointSnippetGenerator:()=>Ae});module.exports=nt(_r);l();p();l();p();l();p();function N(n){throw new Error("Unexpected value: "+JSON.stringify(n))}l();p();l();p();var q=class{};l();p();var ce=class{formatMultiple(t){return Promise.all(t.map(e=>this.format(e)))}formatMultipleSync(t){return t.map(e=>this.formatSync(e))}},Q=class extends ce{async format(t){return t}formatSync(t){return t}};l();p();l();p();var k=class extends q{constructor(e){super();y(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 sr=4,Ge=!!g.env.FERN_STACK_TRACK;Ge&&(Error.stackTraceLimit=50);var X=class{constructor(){y(this,"buffer","");y(this,"indentLevel",0);y(this,"hasWrittenAnything",!1);y(this,"lastCharacterIsSemicolon",!1);y(this,"lastCharacterIsNewline",!1)}write(...t){for(let e of t)if(e!=null)if(typeof e=="string"){let r=e.length>0&&e.endsWith(`
|
|
2
|
-
`),i
|
|
1
|
+
"use strict";var oe=Object.defineProperty;var ft=Object.getOwnPropertyDescriptor;var mt=Object.getOwnPropertyNames;var dt=Object.prototype.hasOwnProperty;var yt=(n,t,e)=>t in n?oe(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var Re=(n,t)=>()=>(n&&(t=n(n=0)),t);var _e=(n,t)=>{for(var e in t)oe(n,e,{get:t[e],enumerable:!0})},gt=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of mt(t))!dt.call(n,i)&&i!==e&&oe(n,i,{get:()=>t[i],enumerable:!(r=ft(t,i))||r.enumerable});return n};var wt=n=>gt(oe({},"__esModule",{value:!0}),n);var h=(n,t,e)=>yt(n,typeof t!="symbol"?t+"":t,e);function qe(){throw new Error("setTimeout has not been defined")}function Oe(){throw new Error("clearTimeout has not been defined")}function je(n){if(q===setTimeout)return setTimeout(n,0);if((q===qe||!q)&&setTimeout)return q=setTimeout,setTimeout(n,0);try{return q(n,0)}catch(t){try{return q.call(null,n,0)}catch(e){return q.call(this,n,0)}}}function xt(n){if(O===clearTimeout)return clearTimeout(n);if((O===Oe||!O)&&clearTimeout)return O=clearTimeout,clearTimeout(n);try{return O(n)}catch(t){try{return O.call(null,n)}catch(e){return O.call(this,n)}}}function vt(){!ee||!D||(ee=!1,D.length?F=D.concat(F):ce=-1,F.length&&De())}function De(){if(!ee){var n=je(vt);ee=!0;for(var t=F.length;t;){for(D=F,F=[];++ce<t;)D&&D[ce].run();ce=-1,t=F.length}D=null,ee=!1,xt(n)}}function Tt(n){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];F.push(new $e(n,t)),F.length===1&&!ee&&je(De)}function $e(n,t){this.fun=n,this.array=t}function $(){}function qt(n){throw new Error("process.binding is not supported")}function Ot(){return"/"}function jt(n){throw new Error("process.chdir is not supported")}function Dt(){return 0}function Yt(n){var t=$t.call(Z)*.001,e=Math.floor(t),r=Math.floor(t%1*1e9);return n&&(e=e-n[0],r=r-n[1],r<0&&(e--,r+=1e9)),[e,r]}function Vt(){var n=new Date,t=n-Wt;return t/1e3}var q,O,F,ee,D,ce,Rt,It,Nt,At,kt,Et,bt,St,Pt,Bt,Ct,Lt,Ft,Mt,_t,Ut,Z,$t,Wt,g,Ue,l=Re(()=>{"use strict";q=qe,O=Oe;typeof globalThis.setTimeout=="function"&&(q=setTimeout);typeof globalThis.clearTimeout=="function"&&(O=clearTimeout);F=[],ee=!1,ce=-1;$e.prototype.run=function(){this.fun.apply(null,this.array)};Rt="browser",It="browser",Nt=!0,At={},kt=[],Et="",bt={},St={},Pt={};Bt=$,Ct=$,Lt=$,Ft=$,Mt=$,_t=$,Ut=$;Z=globalThis.performance||{},$t=Z.now||Z.mozNow||Z.msNow||Z.oNow||Z.webkitNow||function(){return new Date().getTime()};Wt=new Date;g={nextTick:Tt,title:Rt,browser:Nt,env:At,argv:kt,version:Et,versions:bt,on:Bt,addListener:Ct,once:Lt,off:Ft,removeListener:Mt,removeAllListeners:_t,emit:Ut,binding:qt,cwd:Ot,chdir:jt,umask:Dt,hrtime:Yt,platform:It,release:St,config:Pt,uptime:Vt},Ue={};Object.keys(Ue).forEach(n=>{let t=n.split("."),e=g;for(let r=0;r<t.length;r++){let i=t[r];r===t.length-1?e[i]=Ue[n]:e=e[i]||(e[i]={})}})});function He(){Ne=!0;for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=n.length;t<e;++t)B[t]=n[t],E[n.charCodeAt(t)]=t;E[45]=62,E[95]=63}function Gt(n){Ne||He();var t,e,r,i,s,a,c=n.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");s=n[c-2]==="="?2:n[c-1]==="="?1:0,a=new Ht(c*3/4-s),r=s>0?c-4:c;var u=0;for(t=0,e=0;t<r;t+=4,e+=3)i=E[n.charCodeAt(t)]<<18|E[n.charCodeAt(t+1)]<<12|E[n.charCodeAt(t+2)]<<6|E[n.charCodeAt(t+3)],a[u++]=i>>16&255,a[u++]=i>>8&255,a[u++]=i&255;return s===2?(i=E[n.charCodeAt(t)]<<2|E[n.charCodeAt(t+1)]>>4,a[u++]=i&255):s===1&&(i=E[n.charCodeAt(t)]<<10|E[n.charCodeAt(t+1)]<<4|E[n.charCodeAt(t+2)]>>2,a[u++]=i>>8&255,a[u++]=i&255),a}function Jt(n){return B[n>>18&63]+B[n>>12&63]+B[n>>6&63]+B[n&63]}function Qt(n,t,e){for(var r,i=[],s=t;s<e;s+=3)r=(n[s]<<16)+(n[s+1]<<8)+n[s+2],i.push(Jt(r));return i.join("")}function Ye(n){Ne||He();for(var t,e=n.length,r=e%3,i="",s=[],a=16383,c=0,u=e-r;c<u;c+=a)s.push(Qt(n,c,c+a>u?u:c+a));return r===1?(t=n[e-1],i+=B[t>>2],i+=B[t<<4&63],i+="=="):r===2&&(t=(n[e-2]<<8)+n[e-1],i+=B[t>>10],i+=B[t>>4&63],i+=B[t<<2&63],i+="="),s.push(i),s.join("")}function ue(){return o.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function M(n,t){if(ue()<t)throw new RangeError("Invalid typed array length");return o.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(t),n.__proto__=o.prototype):(n===null&&(n=new o(t)),n.length=t),n}function o(n,t,e){if(!o.TYPED_ARRAY_SUPPORT&&!(this instanceof o))return new o(n,t,e);if(typeof n=="number"){if(typeof t=="string")throw new Error("If encoding is specified then the first argument must be a string");return Ae(this,n)}return Ge(this,n,t,e)}function Ge(n,t,e,r){if(typeof t=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer!="undefined"&&t instanceof ArrayBuffer?Xt(n,t,e,r):typeof t=="string"?zt(n,t,e):Zt(n,t)}function Je(n){if(typeof n!="number")throw new TypeError('"size" argument must be a number');if(n<0)throw new RangeError('"size" argument must not be negative')}function Kt(n,t,e,r){return Je(t),t<=0?M(n,t):e!==void 0?typeof r=="string"?M(n,t).fill(e,r):M(n,t).fill(e):M(n,t)}function Ae(n,t){if(Je(t),n=M(n,t<0?0:ke(t)|0),!o.TYPED_ARRAY_SUPPORT)for(var e=0;e<t;++e)n[e]=0;return n}function zt(n,t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!o.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=Qe(t,e)|0;n=M(n,r);var i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function Ie(n,t){var e=t.length<0?0:ke(t.length)|0;n=M(n,e);for(var r=0;r<e;r+=1)n[r]=t[r]&255;return n}function Xt(n,t,e,r){if(t.byteLength,e<0||t.byteLength<e)throw new RangeError("'offset' is out of bounds");if(t.byteLength<e+(r||0))throw new RangeError("'length' is out of bounds");return e===void 0&&r===void 0?t=new Uint8Array(t):r===void 0?t=new Uint8Array(t,e):t=new Uint8Array(t,e,r),o.TYPED_ARRAY_SUPPORT?(n=t,n.__proto__=o.prototype):n=Ie(n,t),n}function Zt(n,t){if(C(t)){var e=ke(t.length)|0;return n=M(n,e),n.length===0||t.copy(n,0,0,e),n}if(t){if(typeof ArrayBuffer!="undefined"&&t.buffer instanceof ArrayBuffer||"length"in t)return typeof t.length!="number"||wr(t.length)?M(n,0):Ie(n,t);if(t.type==="Buffer"&&Array.isArray(t.data))return Ie(n,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function ke(n){if(n>=ue())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ue().toString(16)+" bytes");return n|0}function C(n){return!!(n!=null&&n._isBuffer)}function Qe(n,t){if(C(n))return n.length;if(typeof ArrayBuffer!="undefined"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(n)||n instanceof ArrayBuffer))return n.byteLength;typeof n!="string"&&(n=""+n);var e=n.length;if(e===0)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return le(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return rt(n).length;default:if(r)return le(n).length;t=(""+t).toLowerCase(),r=!0}}function er(n,t,e){var r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,t>>>=0,e<=t))return"";for(n||(n="utf8");;)switch(n){case"hex":return lr(this,t,e);case"utf8":case"utf-8":return Xe(this,t,e);case"ascii":return cr(this,t,e);case"latin1":case"binary":return ur(this,t,e);case"base64":return sr(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return pr(this,t,e);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),r=!0}}function Y(n,t,e){var r=n[t];n[t]=n[e],n[e]=r}function Ke(n,t,e,r,i){if(n.length===0)return-1;if(typeof e=="string"?(r=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:n.length-1),e<0&&(e=n.length+e),e>=n.length){if(i)return-1;e=n.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof t=="string"&&(t=o.from(t,r)),C(t))return t.length===0?-1:We(n,t,e,r,i);if(typeof t=="number")return t=t&255,o.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(n,t,e):Uint8Array.prototype.lastIndexOf.call(n,t,e):We(n,[t],e,r,i);throw new TypeError("val must be string, number or Buffer")}function We(n,t,e,r,i){var s=1,a=n.length,c=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(n.length<2||t.length<2)return-1;s=2,a/=2,c/=2,e/=2}function u(T,k){return s===1?T[k]:T.readUInt16BE(k*s)}var m;if(i){var f=-1;for(m=e;m<a;m++)if(u(n,m)===u(t,f===-1?0:m-f)){if(f===-1&&(f=m),m-f+1===c)return f*s}else f!==-1&&(m-=m-f),f=-1}else for(e+c>a&&(e=a-c),m=e;m>=0;m--){for(var y=!0,x=0;x<c;x++)if(u(n,m+x)!==u(t,x)){y=!1;break}if(y)return m}return-1}function tr(n,t,e,r){e=Number(e)||0;var i=n.length-e;r?(r=Number(r),r>i&&(r=i)):r=i;var s=t.length;if(s%2!==0)throw new TypeError("Invalid hex string");r>s/2&&(r=s/2);for(var a=0;a<r;++a){var c=parseInt(t.substr(a*2,2),16);if(isNaN(c))return a;n[e+a]=c}return a}function rr(n,t,e,r){return fe(le(t,n.length-e),n,e,r)}function ze(n,t,e,r){return fe(yr(t),n,e,r)}function nr(n,t,e,r){return ze(n,t,e,r)}function ir(n,t,e,r){return fe(rt(t),n,e,r)}function ar(n,t,e,r){return fe(gr(t,n.length-e),n,e,r)}function sr(n,t,e){return t===0&&e===n.length?Ye(n):Ye(n.slice(t,e))}function Xe(n,t,e){e=Math.min(n.length,e);for(var r=[],i=t;i<e;){var s=n[i],a=null,c=s>239?4:s>223?3:s>191?2:1;if(i+c<=e){var u,m,f,y;switch(c){case 1:s<128&&(a=s);break;case 2:u=n[i+1],(u&192)===128&&(y=(s&31)<<6|u&63,y>127&&(a=y));break;case 3:u=n[i+1],m=n[i+2],(u&192)===128&&(m&192)===128&&(y=(s&15)<<12|(u&63)<<6|m&63,y>2047&&(y<55296||y>57343)&&(a=y));break;case 4:u=n[i+1],m=n[i+2],f=n[i+3],(u&192)===128&&(m&192)===128&&(f&192)===128&&(y=(s&15)<<18|(u&63)<<12|(m&63)<<6|f&63,y>65535&&y<1114112&&(a=y))}}a===null?(a=65533,c=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=c}return or(r)}function or(n){var t=n.length;if(t<=Ve)return String.fromCharCode.apply(String,n);for(var e="",r=0;r<t;)e+=String.fromCharCode.apply(String,n.slice(r,r+=Ve));return e}function cr(n,t,e){var r="";e=Math.min(n.length,e);for(var i=t;i<e;++i)r+=String.fromCharCode(n[i]&127);return r}function ur(n,t,e){var r="";e=Math.min(n.length,e);for(var i=t;i<e;++i)r+=String.fromCharCode(n[i]);return r}function lr(n,t,e){var r=n.length;(!t||t<0)&&(t=0),(!e||e<0||e>r)&&(e=r);for(var i="",s=t;s<e;++s)i+=dr(n[s]);return i}function pr(n,t,e){for(var r=n.slice(t,e),i="",s=0;s<r.length;s+=2)i+=String.fromCharCode(r[s]+r[s+1]*256);return i}function R(n,t,e){if(n%1!==0||n<0)throw new RangeError("offset is not uint");if(n+t>e)throw new RangeError("Trying to access beyond buffer length")}function I(n,t,e,r,i,s){if(!C(n))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(e+r>n.length)throw new RangeError("Index out of range")}function pe(n,t,e,r){t<0&&(t=65535+t+1);for(var i=0,s=Math.min(n.length-e,2);i<s;++i)n[e+i]=(t&255<<8*(r?i:1-i))>>>(r?i:1-i)*8}function he(n,t,e,r){t<0&&(t=4294967295+t+1);for(var i=0,s=Math.min(n.length-e,4);i<s;++i)n[e+i]=t>>>(r?i:3-i)*8&255}function Ze(n,t,e,r,i,s){if(e+r>n.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function et(n,t,e,r,i){return i||Ze(n,t,e,4,34028234663852886e22,-34028234663852886e22),it(n,t,e,r,23,4),e+4}function tt(n,t,e,r,i){return i||Ze(n,t,e,8,17976931348623157e292,-17976931348623157e292),it(n,t,e,r,52,8),e+8}function fr(n){if(n=mr(n).replace(hr,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}function mr(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}function dr(n){return n<16?"0"+n.toString(16):n.toString(16)}function le(n,t){t=t||1/0;for(var e,r=n.length,i=null,s=[],a=0;a<r;++a){if(e=n.charCodeAt(a),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&s.push(239,191,189);continue}else if(a+1===r){(t-=3)>-1&&s.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&s.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;s.push(e)}else if(e<2048){if((t-=2)<0)break;s.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;s.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;s.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return s}function yr(n){for(var t=[],e=0;e<n.length;++e)t.push(n.charCodeAt(e)&255);return t}function gr(n,t){for(var e,r,i,s=[],a=0;a<n.length&&!((t-=2)<0);++a)e=n.charCodeAt(a),r=e>>8,i=e%256,s.push(i),s.push(r);return s}function rt(n){return Gt(fr(n))}function fe(n,t,e,r){for(var i=0;i<r&&!(i+e>=t.length||i>=n.length);++i)t[i+e]=n[i];return i}function wr(n){return n!==n}function xr(n){return n!=null&&(!!n._isBuffer||nt(n)||vr(n))}function nt(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function vr(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&nt(n.slice(0,0))}function me(n,t,e,r,i){var s,a,c=i*8-r-1,u=(1<<c)-1,m=u>>1,f=-7,y=e?i-1:0,x=e?-1:1,T=n[t+y];for(y+=x,s=T&(1<<-f)-1,T>>=-f,f+=c;f>0;s=s*256+n[t+y],y+=x,f-=8);for(a=s&(1<<-f)-1,s>>=-f,f+=r;f>0;a=a*256+n[t+y],y+=x,f-=8);if(s===0)s=1-m;else{if(s===u)return a?NaN:(T?-1:1)*(1/0);a=a+Math.pow(2,r),s=s-m}return(T?-1:1)*a*Math.pow(2,s-r)}function it(n,t,e,r,i,s){var a,c,u,m=s*8-i-1,f=(1<<m)-1,y=f>>1,x=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,T=r?0:s-1,k=r?1:-1,j=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(c=isNaN(t)?1:0,a=f):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+y>=1?t+=x/u:t+=x*Math.pow(2,1-y),t*u>=2&&(a++,u/=2),a+y>=f?(c=0,a=f):a+y>=1?(c=(t*u-1)*Math.pow(2,i),a=a+y):(c=t*Math.pow(2,y-1)*Math.pow(2,i),a=0));i>=8;n[e+T]=c&255,T+=k,c/=256,i-=8);for(a=a<<i|c,m+=i;m>0;n[e+T]=a&255,T+=k,a/=256,m-=8);n[e+T-k]|=j*128}var B,E,Ht,Ne,Ve,hr,at=Re(()=>{"use strict";l();p();B=[],E=[],Ht=typeof Uint8Array!="undefined"?Uint8Array:Array,Ne=!1;o.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;o.poolSize=8192;o._augment=function(n){return n.__proto__=o.prototype,n};o.from=function(n,t,e){return Ge(null,n,t,e)};o.kMaxLength=ue();o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&o[Symbol.species]);o.alloc=function(n,t,e){return Kt(null,n,t,e)};o.allocUnsafe=function(n){return Ae(null,n)};o.allocUnsafeSlow=function(n){return Ae(null,n)};o.isBuffer=xr;o.compare=function(t,e){if(!C(t)||!C(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,i=e.length,s=0,a=Math.min(r,i);s<a;++s)if(t[s]!==e[s]){r=t[s],i=e[s];break}return r<i?-1:i<r?1:0};o.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};o.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return o.alloc(0);var r;if(e===void 0)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var i=o.allocUnsafe(e),s=0;for(r=0;r<t.length;++r){var a=t[r];if(!C(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(i,s),s+=a.length}return i};o.byteLength=Qe;o.prototype._isBuffer=!0;o.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)Y(this,e,e+1);return this};o.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)Y(this,e,e+3),Y(this,e+1,e+2);return this};o.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)Y(this,e,e+7),Y(this,e+1,e+6),Y(this,e+2,e+5),Y(this,e+3,e+4);return this};o.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?Xe(this,0,t):er.apply(this,arguments)};o.prototype.equals=function(t){if(!C(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:o.compare(this,t)===0};o.prototype.compare=function(t,e,r,i,s){if(!C(t))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),r===void 0&&(r=t?t.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),e<0||r>t.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&e>=r)return 0;if(i>=s)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,i>>>=0,s>>>=0,this===t)return 0;for(var a=s-i,c=r-e,u=Math.min(a,c),m=this.slice(i,s),f=t.slice(e,r),y=0;y<u;++y)if(m[y]!==f[y]){a=m[y],c=f[y];break}return a<c?-1:c<a?1:0};o.prototype.includes=function(t,e,r){return this.indexOf(t,e,r)!==-1};o.prototype.indexOf=function(t,e,r){return Ke(this,t,e,r,!0)};o.prototype.lastIndexOf=function(t,e,r){return Ke(this,t,e,r,!1)};o.prototype.write=function(t,e,r,i){if(e===void 0)i="utf8",r=this.length,e=0;else if(r===void 0&&typeof e=="string")i=e,r=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(r)?(r=r|0,i===void 0&&(i="utf8")):(i=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-e;if((r===void 0||r>s)&&(r=s),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return tr(this,t,e,r);case"utf8":case"utf-8":return rr(this,t,e,r);case"ascii":return ze(this,t,e,r);case"latin1":case"binary":return nr(this,t,e,r);case"base64":return ir(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ar(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}};o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};Ve=4096;o.prototype.slice=function(t,e){var r=this.length;t=~~t,e=e===void 0?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e<t&&(e=t);var i;if(o.TYPED_ARRAY_SUPPORT)i=this.subarray(t,e),i.__proto__=o.prototype;else{var s=e-t;i=new o(s,void 0);for(var a=0;a<s;++a)i[a]=this[a+t]}return i};o.prototype.readUIntLE=function(t,e,r){t=t|0,e=e|0,r||R(t,e,this.length);for(var i=this[t],s=1,a=0;++a<e&&(s*=256);)i+=this[t+a]*s;return i};o.prototype.readUIntBE=function(t,e,r){t=t|0,e=e|0,r||R(t,e,this.length);for(var i=this[t+--e],s=1;e>0&&(s*=256);)i+=this[t+--e]*s;return i};o.prototype.readUInt8=function(t,e){return e||R(t,1,this.length),this[t]};o.prototype.readUInt16LE=function(t,e){return e||R(t,2,this.length),this[t]|this[t+1]<<8};o.prototype.readUInt16BE=function(t,e){return e||R(t,2,this.length),this[t]<<8|this[t+1]};o.prototype.readUInt32LE=function(t,e){return e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};o.prototype.readUInt32BE=function(t,e){return e||R(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};o.prototype.readIntLE=function(t,e,r){t=t|0,e=e|0,r||R(t,e,this.length);for(var i=this[t],s=1,a=0;++a<e&&(s*=256);)i+=this[t+a]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*e)),i};o.prototype.readIntBE=function(t,e,r){t=t|0,e=e|0,r||R(t,e,this.length);for(var i=e,s=1,a=this[t+--i];i>0&&(s*=256);)a+=this[t+--i]*s;return s*=128,a>=s&&(a-=Math.pow(2,8*e)),a};o.prototype.readInt8=function(t,e){return e||R(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};o.prototype.readInt16LE=function(t,e){e||R(t,2,this.length);var r=this[t]|this[t+1]<<8;return r&32768?r|4294901760:r};o.prototype.readInt16BE=function(t,e){e||R(t,2,this.length);var r=this[t+1]|this[t]<<8;return r&32768?r|4294901760:r};o.prototype.readInt32LE=function(t,e){return e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};o.prototype.readInt32BE=function(t,e){return e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};o.prototype.readFloatLE=function(t,e){return e||R(t,4,this.length),me(this,t,!0,23,4)};o.prototype.readFloatBE=function(t,e){return e||R(t,4,this.length),me(this,t,!1,23,4)};o.prototype.readDoubleLE=function(t,e){return e||R(t,8,this.length),me(this,t,!0,52,8)};o.prototype.readDoubleBE=function(t,e){return e||R(t,8,this.length),me(this,t,!1,52,8)};o.prototype.writeUIntLE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var s=Math.pow(2,8*r)-1;I(this,t,e,r,s,0)}var a=1,c=0;for(this[e]=t&255;++c<r&&(a*=256);)this[e+c]=t/a&255;return e+r};o.prototype.writeUIntBE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var s=Math.pow(2,8*r)-1;I(this,t,e,r,s,0)}var a=r-1,c=1;for(this[e+a]=t&255;--a>=0&&(c*=256);)this[e+a]=t/c&255;return e+r};o.prototype.writeUInt8=function(t,e,r){return t=+t,e=e|0,r||I(this,t,e,1,255,0),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=t&255,e+1};o.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=e|0,r||I(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):pe(this,t,e,!0),e+2};o.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=e|0,r||I(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):pe(this,t,e,!1),e+2};o.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=e|0,r||I(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255):he(this,t,e,!0),e+4};o.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=e|0,r||I(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):he(this,t,e,!1),e+4};o.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e=e|0,!i){var s=Math.pow(2,8*r-1);I(this,t,e,r,s-1,-s)}var a=0,c=1,u=0;for(this[e]=t&255;++a<r&&(c*=256);)t<0&&u===0&&this[e+a-1]!==0&&(u=1),this[e+a]=(t/c>>0)-u&255;return e+r};o.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e=e|0,!i){var s=Math.pow(2,8*r-1);I(this,t,e,r,s-1,-s)}var a=r-1,c=1,u=0;for(this[e+a]=t&255;--a>=0&&(c*=256);)t<0&&u===0&&this[e+a+1]!==0&&(u=1),this[e+a]=(t/c>>0)-u&255;return e+r};o.prototype.writeInt8=function(t,e,r){return t=+t,e=e|0,r||I(this,t,e,1,127,-128),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=t&255,e+1};o.prototype.writeInt16LE=function(t,e,r){return t=+t,e=e|0,r||I(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):pe(this,t,e,!0),e+2};o.prototype.writeInt16BE=function(t,e,r){return t=+t,e=e|0,r||I(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):pe(this,t,e,!1),e+2};o.prototype.writeInt32LE=function(t,e,r){return t=+t,e=e|0,r||I(this,t,e,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):he(this,t,e,!0),e+4};o.prototype.writeInt32BE=function(t,e,r){return t=+t,e=e|0,r||I(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):he(this,t,e,!1),e+4};o.prototype.writeFloatLE=function(t,e,r){return et(this,t,e,!0,r)};o.prototype.writeFloatBE=function(t,e,r){return et(this,t,e,!1,r)};o.prototype.writeDoubleLE=function(t,e,r){return tt(this,t,e,!0,r)};o.prototype.writeDoubleBE=function(t,e,r){return tt(this,t,e,!1,r)};o.prototype.copy=function(t,e,r,i){if(r||(r=0),!i&&i!==0&&(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<r&&(i=r),i===r||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);var s=i-r,a;if(this===t&&r<e&&e<i)for(a=s-1;a>=0;--a)t[a+e]=this[a+r];else if(s<1e3||!o.TYPED_ARRAY_SUPPORT)for(a=0;a<s;++a)t[a+e]=this[a+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+s),e);return s};o.prototype.fill=function(t,e,r,i){if(typeof t=="string"){if(typeof e=="string"?(i=e,e=0,r=this.length):typeof r=="string"&&(i=r,r=this.length),t.length===1){var s=t.charCodeAt(0);s<256&&(t=s)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!o.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof t=="number"&&(t=t&255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;e=e>>>0,r=r===void 0?this.length:r>>>0,t||(t=0);var a;if(typeof t=="number")for(a=e;a<r;++a)this[a]=t;else{var c=C(t)?t:le(new o(t,i).toString()),u=c.length;for(a=0;a<r-e;++a)this[a+e]=c[a%u]}return this};hr=/[^+\/0-9A-Za-z-_]/g});var p=Re(()=>{"use strict";at()});var Xr={};_e(Xr,{EndpointSnippetGenerator:()=>Ce});module.exports=wt(Xr);l();p();l();p();l();p();function A(n){throw new Error("Unexpected value: "+JSON.stringify(n))}l();p();l();p();l();p();var st,ot,te=(ot=(st=g.env.FERN_STACK_TRACK)==null?void 0:st.toLowerCase())!=null?ot:"",L=te!==""&&te!=="0"&&te!=="false",Ee=["single","multiline","box"].includes(te)?te:"single";L&&(Error.stackTraceLimit=50);var Tr=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),Rr=new Set(["stacktrace"]);function ye({maxFrames:n=50,skip:t=0,filterPaths:e=[],filterFunctions:r=[],stopOn:i=[],filterNode:s=!0,filterJs:a=!0,formatFilename:c=u=>u}={}){var m;if(!L)return[];r=[...r,...Tr],e=[...e,...Rr],i=[...i,"runInteractiveTask"];let u=!1;return((m=new Error().stack)!=null?m:"").split(`
|
|
2
|
+
`).map(f=>{let y=f.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(y&&y.length===5){let[,x,T,k,j]=y;if(!x||!T||!k||!j)return;if(u||i.some(se=>x==null?void 0:x.includes(se))){u=!0;return}switch(x){case"Object.<anonymous>":x="";break;case"Object.object":case"Object.alias":case"Object.union":case"Object.enum":case"Object.undiscriminatedUnion":x=`${x.substring(x.indexOf(".")+1)}()=> { ... }`;break}return{fn:x,path:c(T),position:`${k}:${j}`}}}).filter(f=>{var y,x;return f&&!r.some(T=>f.fn.includes(T))&&!(s&&((y=f.path)!=null&&y.startsWith("node:")))&&!(a&&((x=f.path)!=null&&x.endsWith(".js")))&&!e.some(T=>f.path.includes(T))}).slice(t,t+n)}var de=class{constructor({maxFrames:t=50,skip:e=0,filterPaths:r=[],filterFunctions:i=[],stopOn:s=[],filterNode:a=!0,filterJs:c=!0,multiline:u=!1,formatFilename:m=f=>f}={}){h(this,"maxFrames");h(this,"skip");h(this,"filterPaths");h(this,"filterFunctions");h(this,"stopOn");h(this,"filterNode");h(this,"filterJs");h(this,"multiline");h(this,"formatFilename");h(this,"tracking",new WeakMap);this.maxFrames=t,this.skip=e,this.filterPaths=r,this.filterFunctions=i,this.stopOn=s,this.filterNode=a,this.filterJs=c,this.multiline=u,this.formatFilename=m}tag(t){let e=this.tracking.get(t)||new Set;ye({maxFrames:this.maxFrames,skip:this.skip,filterPaths:this.filterPaths,filterFunctions:this.filterFunctions,stopOn:this.stopOn,filterNode:this.filterNode,filterJs:this.filterJs,formatFilename:this.formatFilename}).forEach(r=>e.add(r)),this.tracking.set(t,e)}trace(t){if(!L)return"";let e=this.tracking.get(t);return e?[...e].map(r=>`${this.multiline?`
|
|
3
|
+
`:""}${r.fn} - ${r.path}:${r.position}`).join(""):""}frames(t){let e=this.tracking.get(t);return e?[...e]:[]}free(t){this.tracking.delete(t)}clear(){this.tracking=new WeakMap}},_;function ct({maxFrames:n=50,skip:t=0,filterPaths:e=[],filterFunctions:r=[],stopOn:i=[],filterNode:s=!0,filterJs:a=!0,multiline:c=!1,formatFilename:u=m=>m}={}){L&&(_!=null||(_=new de({maxFrames:n,skip:t,filterPaths:e,filterFunctions:r,stopOn:i,filterNode:s,filterJs:a,multiline:c,formatFilename:u})))}function ut(n){_==null||_.tag(n)}function be(n){var t;return(t=_==null?void 0:_.frames(n))!=null?t:[]}var W=class{constructor(){ut(this)}};l();p();var ge=class{formatMultiple(t){return Promise.all(t.map(e=>this.format(e)))}formatMultipleSync(t){return t.map(e=>this.formatSync(e))}},re=class extends ge{async format(t){return t}formatSync(t){return t}};l();p();l();p();l();p();var P=class extends W{constructor(e){super();h(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 Ir=4;ct({skip:0,maxFrames:15,filterFunctions:["Abstract"]});var ne=class{constructor(){h(this,"lineBuffer",[]);h(this,"indentLevel",0);h(this,"hasWrittenAnything",!1);h(this,"lastCharacterIsSemicolon",!1);h(this,"lastCharacterIsNewline",!1);h(this,"nodeStackFrames",[])}get buffer(){return L&&this.nodeStackFrames.length>0&&this.writeInternal(`
|
|
4
|
+
`),this.lineBuffer.join(`
|
|
5
|
+
`)+(this.lastCharacterIsNewline?`
|
|
6
|
+
`:"")}write(...t){for(let e of t)if(e!=null)if(typeof e=="string"){let r=e.length>0&&e.endsWith(`
|
|
7
|
+
`),i=r?e.substring(0,e.length-1):e,s=this.getIndentString(),a=i.replaceAll(`
|
|
3
8
|
`,`
|
|
4
|
-
${
|
|
5
|
-
`),this.writeInternal(
|
|
9
|
+
${s}`);this.isAtStartOfLine()&&(a=s+a),r&&(a+=`
|
|
10
|
+
`),this.writeInternal(a)}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){L&&this.nodeStackFrames.push(...be(t)),t.write(this),L&&Ee!=="single"&&this.writeInternal(`
|
|
11
|
+
`)}writeNodeOrString(t){if(typeof t=="string"){this.write(t);return}this.writeNode(t)}writeNodeStatement(t){this.writeNode(t),this.write(";"),this.writeNewLineIfLastLineNot()}writeTextStatement(t){new P(t).write(this),t.endsWith(";")||this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(t,e){new P(t).write(this),this.write(" (",e,")"),this.pushScope()}controlFlowWithoutStatement(t){new P(t).write(this),this.pushScope()}endControlFlow(){this.popScope()}contiguousControlFlow(t,e){this.dedent(),this.write("} "),new P(t).write(this),this.write(" (",e,")"),this.pushScope()}alternativeControlFlow(t){this.dedent(),this.write("} "),new P(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(`
|
|
6
12
|
`)}writeSemicolonIfLastCharacterIsNot(){this.lastCharacterIsSemicolon||this.writeInternal(";")}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
|
|
7
|
-
`)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:t,delimiter:e,writeFunction:r}){if(t.length>0){let i=t[0];i!=null&&r(i);for(let
|
|
8
|
-
`),this.lastCharacterIsSemicolon=t.endsWith(";")
|
|
9
|
-
`)&&!this.
|
|
10
|
-
`)){let e=this.stacktrace(15).map(r=>`${r.fn} - ${r.path}:${r.position}`).join(" ");e&&(this.buffer=this.buffer.slice(0,-1),this.buffer+=`//@@ ${e}
|
|
11
|
-
`)}return this.buffer}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*this.getTabSize())}getTabSize(){return sr}stacktrace(t=50){var r;let e=!1;return((r=new Error().stack)!=null?r:"").split(`
|
|
12
|
-
`).map(i=>{var s;let a=i.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(a&&a.length===5){let[,u,c,h,m]=a;if(e||u!=null&&u.includes("runInteractiveTask")){e=!0;return}switch(u){case"Object.<anonymous>":u="";break;case"Object.object":case"Object.alias":case"Object.union":case"Object.enum":case"Object.undiscriminatedUnion":u=`${u.substring(u.indexOf(".")+1)}()=> { ... }`;break}return{fn:u,path:(s=c==null?void 0:c.replace(/^.*?fern.*?\//,""))!=null?s:"",position:`${h}:${m}`}}}).filter(i=>{var a,s,u,c,h,m,d;return i&&!((a=i.path)!=null&&a.startsWith("node:"))&&!((s=i.path)!=null&&s.endsWith(".js"))&&!((u=i.path)!=null&&u.includes("AbstractWriter"))&&!((c=i.fn)!=null&&c.includes("stacktrace"))&&!((h=i.fn)!=null&&h.includes("stackLine"))&&!((m=i.fn)!=null&&m.includes("SdkGeneratorCLI"))&&!((d=i.fn)!=null&&d.includes("runCli"))}).slice(0,t)}};l();p();function xe(n){return(n==null?void 0:n.name)!=null}l();p();l();p();var M={Critical:"CRITICAL",Warning:"WARNING"};l();p();var D;(function(n){n.Concise="concise",n.Full="full"})(D||(D={}));l();p();var P={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};l();p();l();p();l();p();var Y=class extends X{constructor({packageName:e,customConfig:r,formatter:i}){super();y(this,"packageName");y(this,"customConfig");y(this,"formatter");y(this,"imports",new Set);this.packageName=e,this.customConfig=r,this.formatter=i!=null?i:new Q}addImport(e){this.imports.add(e)}getImports(){return new Set(this.imports)}};var Z=class extends Y{constructor({packageName:t,customConfig:e,formatter:r}){super({packageName:t,customConfig:e,formatter:r})}async toStringAsync(){let t=this.getContent();if(this.formatter!=null)try{return this.formatter.format(t)}catch(e){throw new Error(`Failed to format Java file: ${e}
|
|
13
|
+
`)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:t,delimiter:e,writeFunction:r}){if(t.length>0){let i=t[0];i!=null&&r(i);for(let s=1;s<t.length;s++){this.write(e);let a=t[s];a!=null&&r(a)}}}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 r=t.split(`
|
|
15
|
+
`),i=L&&!this.shouldSkipTracking(r)&&this.lastCharacterIsNewline;e&&(this.lastLine=`${this.lastLine}${r.shift()||""}`),this.lastCharacterIsNewline&&r.pop(),this.lineBuffer.push(...r),i&&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(r=>`${e?`(${e}) `:""} ${r.fn} - ${r.path} : ${r.position}`)}filterStack(t){return t.filter(e=>!e.fn.startsWith(`${this.constructor.name}.`))}appendTrackingComment(){let t=[...this.formatStack(this.filterStack(ye({maxFrames:15,skip:3}))),...this.formatStack(this.filterStack(this.nodeStackFrames),"node")];switch(this.nodeStackFrames.length=0,Ee){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 Ir}};l();p();function Se(n){return(n==null?void 0:n.name)!=null&&(n==null?void 0:n.assignment)!=null}l();p();l();p();var U={Critical:"CRITICAL",Warning:"WARNING"};l();p();var V;(function(n){n.Concise="concise",n.Full="full"})(V||(V={}));l();p();var b={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};l();p();l();p();l();p();var H=class extends ne{constructor({packageName:e,customConfig:r,formatter:i}){super();h(this,"packageName");h(this,"customConfig");h(this,"formatter");h(this,"imports",new Set);this.packageName=e,this.customConfig=r,this.formatter=i!=null?i:new re}addImport(e){this.imports.add(e)}getImports(){return new Set(this.imports)}};var ie=class extends H{constructor({packageName:t,customConfig:e,formatter:r}){super({packageName:t,customConfig:e,formatter:r})}async toStringAsync(){let t=this.getContent();if(this.formatter!=null)try{return this.formatter.format(t)}catch(e){throw new Error(`Failed to format Java file: ${e}
|
|
13
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 Java file: ${e}
|
|
14
17
|
${t}`)}return t}getContent(){let t=`package ${this.packageName};
|
|
15
18
|
|
|
16
19
|
`,e=this.stringifyImports();return e.length>0?`${t}${e}
|
|
17
20
|
|
|
18
21
|
${this.buffer}`:t+this.buffer}stringifyImports(){return Array.from(this.imports).filter(t=>t!==this.packageName).map(t=>`import ${t};`).sort().join(`
|
|
19
|
-
`)}};var f={};Ie(f,{Access:()=>ve,AstNode:()=>x,Class:()=>$,ClassInstantiation:()=>W,ClassReference:()=>w,CodeBlock:()=>V,Method:()=>H,MethodInvocation:()=>G,Parameter:()=>J,Type:()=>ee,TypeLiteral:()=>R,Writer:()=>Y,classReference:()=>Er,class_:()=>Nr,codeblock:()=>Rr,instantiateClass:()=>br,invokeMethod:()=>kr,method:()=>Pr,parameter:()=>Br});l();p();l();p();l();p();var ve={Public:"public",Protected:"protected",Private:"private"};l();p();l();p();var x=class extends q{async toStringAsync({packageName:t,customConfig:e,formatter:r}){let i=new Z({packageName:t,customConfig:e,formatter:r});return this.write(i),i.toStringAsync()}toString({packageName:t,customConfig:e,formatter:r}){let i=new Z({packageName:t,customConfig:e,formatter:r});return this.write(i),i.toString()}};var $=class extends x{constructor({name:e,access:r}){super();y(this,"name");y(this,"access");y(this,"methods",[]);this.name=e,this.access=r}write(e){if(e.write(`${this.access} class ${this.name}`),this.isEmpty()){e.writeLine(" {}");return}e.writeLine(" {"),e.indent();for(let r of this.methods)e.writeNode(r),e.newLine();e.dedent(),e.write("}")}addMethod(e){this.methods.push(e)}isEmpty(){return this.methods.length===0}};l();p();l();p();l();p();l();p();var w=class extends x{constructor({name:e,packageName:r,fullyQualified:i}){super();y(this,"name");y(this,"packageName");y(this,"fullyQualified");this.name=e,this.packageName=r,this.fullyQualified=i!=null?i:!1}write(e){if(e.addImport(`${this.packageName}.${this.name}`),this.fullyQualified){e.write(`${this.packageName}.${this.name}`);return}e.write(this.name)}};l();p();var ee=class extends x{constructor(e){super();y(this,"internalType");this.internalType=e}write(e){switch(this.internalType.type){case"array":e.writeNode(this.internalType.value),e.write("[]");break;case"bigInteger":e.writeNode(or);break;case"boolean":e.write("Boolean");break;case"bytes":e.write("byte[]");break;case"date":e.write("String");break;case"dateTime":e.writeNode(lr);break;case"double":e.write("Double");break;case"float":e.write("Float");break;case"generic":e.writeNode(this.internalType.value),e.write("<");for(let[r,i]of this.internalType.parameters.entries())e.writeNode(i),r<this.internalType.parameters.length-1&&e.write(", ");e.write(">");break;case"inputStream":e.writeNode(fr);break;case"integer":e.write("Integer");break;case"iterable":this.writeIterable({writer:e,iterable:this.internalType});break;case"list":{this.writeList({writer:e,list:this.internalType});break}case"long":{e.write("Long");break}case"map":{this.writeMap({writer:e,map:this.internalType});break}case"object":{e.write("Object");break}case"optional":{this.writeOptional({writer:e,optional:this.internalType});break}case"reference":e.writeNode(this.internalType.value);break;case"set":{this.writeSet({writer:e,set:this.internalType});break}case"string":e.write("String");break;case"uuid":e.writeNode(hr);break;case"void":e.write("Void");break;default:N(this.internalType)}}isOptional(){return this.internalType.type==="optional"}static array(e){return new this({type:"array",value:e})}static bigInteger(){return new this({type:"bigInteger"})}static boolean(){return new this({type:"boolean"})}static bytes(){return new this({type:"bytes"})}static date(){return new this({type:"date"})}static dateTime(){return new this({type:"dateTime"})}static double(){return new this({type:"double"})}static float(){return new this({type:"float"})}static integer(){return new this({type:"integer"})}static list(e){return new this({type:"list",value:e})}static long(){return new this({type:"long"})}static map(e,r){return new this({type:"map",keyType:e,valueType:r})}static object(){return new this({type:"object"})}static optional(e){return this.isAlreadyOptional(e)?e:new this({type:"optional",value:e})}static reference(e){return new this({type:"reference",value:e})}static generic(e,r){return new this({type:"generic",value:e,parameters:r})}static set(e){return new this({type:"set",value:e})}static string(){return new this({type:"string"})}static uuid(){return new this({type:"uuid"})}static void(){return new this({type:"void"})}static iterable(e){return new this({type:"iterable",value:e})}static inputStream(){return new this({type:"inputStream"})}writeList({writer:e,list:r}){e.writeNode(ur),e.write("<"),r.value.write(e),e.write(">")}writeMap({writer:e,map:r}){e.writeNode(cr),e.write("<"),r.keyType.write(e),e.write(", "),r.valueType.write(e),e.write(">")}writeOptional({writer:e,optional:r}){e.writeNode(le),e.write("<"),r.value.write(e),e.write(">")}writeIterable({writer:e,iterable:r}){e.writeNode(le),e.write("<"),r.value.write(e),e.write(">")}writeSet({writer:e,set:r}){e.writeNode(pr),e.write("<"),r.value.write(e),e.write(">")}static isAlreadyOptional(e){return e.internalType.type==="optional"}},pe=new w({name:"Arrays",packageName:"java.util"}),or=new w({name:"BigInteger",packageName:"java.math"}),Ti=new w({name:"HashMap",packageName:"java.util"}),ur=new w({name:"List",packageName:"java.util"}),cr=new w({name:"Map",packageName:"java.util"}),lr=new w({name:"OffsetDateTime",packageName:"java.time"}),le=new w({name:"Optional",packageName:"java.util"}),pr=new w({name:"Set",packageName:"java.util"}),hr=new w({name:"UUID",packageName:"java.util"}),fr=new w({name:"InputStream",packageName:"java.io"});var R=class n extends x{constructor(e){super();y(this,"internalType");this.internalType=e}write(e){switch(this.internalType.type){case"bigInteger":this.writeBigInteger({writer:e,bigInteger:this.internalType});break;case"boolean":e.write(this.internalType.value.toString());break;case"builder":this.writeBuilder({writer:e,builder:this.internalType});break;case"bytes":e.write(`"${this.internalType.value}".getBytes()`);break;case"class":{this.writeClass({writer:e,class_:this.internalType});break}case"date":e.write(`"${this.internalType.value}"`);break;case"dateTime":this.writeDateTime({writer:e,dateTime:this.internalType});break;case"double":{let r=this.internalType.value.toString();!r.includes(".")&&!r.includes("e")&&!r.includes("E")?e.write(`${r}.0`):e.write(r);break}case"enum":this.writeEnum({writer:e,enum_:this.internalType});break;case"float":e.write(`${this.internalType.value}f`);break;case"integer":e.write(Math.floor(this.internalType.value).toString());break;case"list":{this.writeList({writer:e,list:this.internalType});break}case"long":{e.write(`${Math.floor(this.internalType.value)}L`);break}case"map":{this.writeMap({writer:e,map:this.internalType});break}case"optional":{this.writeOptional({writer:e,optional:this.internalType});break}case"raw":{this.internalType.value instanceof x?e.writeNode(this.internalType.value):e.write(this.internalType.value);break}case"reference":e.writeNode(this.internalType.value);break;case"set":{this.writeSet({writer:e,set:this.internalType});break}case"string":e.write(`"${this.escapeString(this.internalType.value)}"`);break;case"unknown":this.writeUnknown({writer:e,value:this.internalType.value});break;case"uuid":this.writeUUID({writer:e,uuid:this.internalType});break;case"nop":break;default:N(this.internalType)}}isOptional(){return this.internalType.type==="optional"}static bigInteger(e){return new this({type:"bigInteger",value:e})}static boolean(e){return new this({type:"boolean",value:e})}static builder({classReference:e,parameters:r}){return new this({type:"builder",classReference:e,parameters:r})}static bytes(e){return new this({type:"bytes",value:e})}static class_({reference:e,parameters:r}){return new this({type:"class",reference:e,parameters:r})}static date(e){return new this({type:"date",value:e})}static dateTime(e){return new this({type:"dateTime",value:e})}static double(e){return new this({type:"double",value:e})}static enum_({classReference:e,value:r}){return new this({type:"enum",classReference:e,value:r})}static float(e){return new this({type:"float",value:e})}static integer(e){return new this({type:"integer",value:e})}static list({valueType:e,values:r,isParameter:i}){return new this({type:"list",valueType:e,values:r,isParameter:i})}static long(e){return new this({type:"long",value:e})}static map({keyType:e,valueType:r,entries:i}){return new this({type:"map",keyType:e,valueType:r,entries:i})}static optional({value:e,useOf:r}){return this.isAlreadyOptional(e)?e:new this({type:"optional",value:e,useOf:r})}static raw(e){return new this({type:"raw",value:e})}static reference(e){return new this({type:"reference",value:e})}static set({valueType:e,values:r}){return new this({type:"set",valueType:e,values:r})}static string(e){return new this({type:"string",value:e})}static unknown(e){return new this({type:"unknown",value:e})}static uuid(e){return new this({type:"uuid",value:e})}static nop(){return new this({type:"nop"})}static isNop(e){return e.internalType.type==="nop"}shouldWriteInLine(){switch(this.internalType.type){case"bigInteger":case"boolean":case"bytes":case"date":case"dateTime":case"double":case"enum":case"float":case"integer":case"long":case"nop":case"raw":case"string":case"unknown":case"uuid":return!0;case"optional":return this.internalType.value.shouldWriteInLine();case"builder":case"class":case"list":case"map":case"reference":case"set":return!1;default:N(this.internalType)}}writeBigInteger({writer:e,bigInteger:r}){e.write("new "),e.writeNode(f.instantiateClass({classReference:mr,arguments_:[n.string(r.value)]}))}writeBuilder({writer:e,builder:r}){e.writeNode(r.classReference),e.writeNewLineIfLastLineNot(),e.indent(),this.writeBuilderParameters({writer:e,parameters:this.orderBuilderParameters(xr({parameters:r.parameters}))}),e.dedent()}writeBuilderParameters({writer:e,parameters:r}){e.writeLine(".builder()");for(let i of r)e.write(`.${i.name}(`),i.value.shouldWriteInLine()||e.newLine(),e.indent(),e.writeNode(i.value),e.dedent(),i.value.shouldWriteInLine()||e.newLine(),e.writeLine(")");e.writeNewLineIfLastLineNot(),e.write(".build()")}orderBuilderParameters(e){return e.sort((r,i)=>r.value.isOptional()&&!i.value.isOptional()?1:!r.value.isOptional()&&i.value.isOptional()?-1:0)}writeClass({writer:e,class_:r}){let i=wr({parameters:r.parameters});e.writeNode(f.instantiateClass({classReference:r.reference,arguments_:i.map(a=>a.value)}))}writeDateTime({writer:e,dateTime:r}){e.writeNode(f.invokeMethod({on:yr,method:"parse",arguments_:[n.string(r.value)]}))}writeEnum({writer:e,enum_:r}){e.writeNode(r.classReference),e.write("."+r.value)}writeList({writer:e,list:r}){this.writeIterable({writer:e,iterable:r})}writeMap({writer:e,map:r}){let i=vr({entries:r.entries});if(i.length===0){e.write("new "),e.writeNode(he),e.write("<"),e.writeNode(r.keyType),e.write(", "),e.writeNode(r.valueType),e.write(">()");return}e.write("new "),e.writeNode(he),e.write("<"),e.writeNode(r.keyType),e.write(", "),e.writeNode(r.valueType),e.writeLine(">() {{"),e.indent();for(let a of i)e.write("put("),e.writeNode(a.key),e.write(", "),e.writeNode(a.value),e.writeLine(");");e.dedent(),e.write("}}")}writeOptional({writer:e,optional:r}){if(!r.useOf){e.writeNode(r.value);return}e.writeNode(f.invokeMethod({on:le,method:"of",arguments_:[r.value]}))}writeSet({writer:e,set:r}){this.writeIterable({writer:e,iterable:r})}writeIterable({writer:e,iterable:r}){let i=r.type==="list"?Te:dr,a=Tr({values:r.values});if(r.type==="list"&&r.isParameter&&a.length>0){e.writeNode(f.invokeMethod({on:pe,method:"asList",arguments_:a}));return}if(a.length===0){e.write(`new ${i.name}<`),e.writeNode(r.valueType),e.write(">()");return}e.write("new "),e.writeNode(i),e.write("<"),e.writeNode(r.valueType),e.writeLine(">("),e.indent(),e.writeNode(f.invokeMethod({on:pe,method:"asList",arguments_:a})),e.writeNewLineIfLastLineNot(),e.dedent(),e.write(")")}writeUnknown({writer:e,value:r}){switch(typeof r){case"boolean":e.write(r.toString());return;case"string":e.write(`"${this.escapeString(r)}"`);return;case"number":e.write(r.toString());return;case"object":if(r==null){e.write("null");return}if(Array.isArray(r)){this.writeUnknownArray({writer:e,value:r});return}this.writeUnknownMap({writer:e,value:r});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof r}`)}}writeUnknownArray({writer:e,value:r}){if(r.length===0){e.write("new "),e.writeNode(Te),e.write("<Object>()");return}e.write("new "),e.writeNode(Te),e.write("<Object>("),e.writeNode(f.invokeMethod({on:pe,method:"asList",arguments_:r.map(i=>n.unknown(i))})),e.write(")")}writeUnknownMap({writer:e,value:r}){let i=Object.entries(r);if(i.length===0){e.write("new "),e.writeNode(he),e.write("<String, Object>()");return}e.writeLine("new "),e.writeNode(he),e.write("<String, Object>() {{"),e.indent();for(let[a,s]of i)e.write(`put("${a}", `),e.writeNode(n.unknown(s)),e.writeLine(");");e.dedent(),e.write("}}")}writeUUID({writer:e,uuid:r}){e.writeNode(f.invokeMethod({on:gr,method:"fromString",arguments_:[n.string(r.value)]}))}escapeString(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}static isAlreadyOptional(e){return e.internalType.type==="optional"}},Te=new w({name:"ArrayList",packageName:"java.util"}),mr=new w({name:"BigInteger",packageName:"java.math"}),he=new w({name:"HashMap",packageName:"java.util"}),dr=new w({name:"HashSet",packageName:"java.util"}),Si=new w({name:"List",packageName:"java.util"}),Ci=new w({name:"Map",packageName:"java.util"}),yr=new w({name:"OffsetDateTime",packageName:"java.time"}),Li=new w({name:"Set",packageName:"java.util"}),gr=new w({name:"UUID",packageName:"java.util"});function wr({parameters:n}){return n.filter(t=>!R.isNop(t.value))}function xr({parameters:n}){return n.filter(t=>!R.isNop(t.value))}function vr({entries:n}){return n.filter(t=>!R.isNop(t.key)&&!R.isNop(t.value))}function Tr({values:n}){return n.filter(t=>!R.isNop(t))}function fe({writer:n,arguments_:t}){let e=Ir(t);if(e.length===0){n.write("()");return}if(e.some(i=>i instanceof R&&!i.shouldWriteInLine())){Ar({writer:n,arguments_:e});return}n.write("("),e.forEach((i,a)=>{a>0&&n.write(", "),Je({writer:n,argument:i})}),n.write(")")}function Ar({writer:n,arguments_:t}){n.writeLine("("),n.indent(),t.forEach((e,r)=>{r>0&&n.writeLine(","),Je({writer:n,argument:e})}),n.dedent(),t.length>0&&n.newLine(),n.write(")")}function Je({writer:n,argument:t}){xe(t)?n.writeNodeOrString(t.assignment):t.write(n)}function Ir(n){return n.filter(t=>!(t instanceof R&&R.isNop(t)))}var W=class extends x{constructor({classReference:e,arguments_:r}){super();y(this,"classReference");y(this,"arguments_");this.classReference=e,this.arguments_=r}write(e){e.writeNode(this.classReference),fe({writer:e,arguments_:this.arguments_})}};l();p();var V=class extends x{constructor(e){super();y(this,"arg");this.arg=e}write(e){return new k(this.arg).write(e)}};l();p();var H=class extends x{constructor({name:e,access:r,parameters:i,body:a,static_:s,return_:u}){super();y(this,"name");y(this,"access");y(this,"parameters");y(this,"body");y(this,"return_");y(this,"static_");this.name=e,this.access=r,this.parameters=i,this.body=a,this.return_=u,this.static_=s!=null?s:!1}write(e){if(e.write(`${this.access} `),this.static_&&e.write("static "),this.return_!=null?e.writeNode(this.return_):e.write("void"),e.write(` ${this.name}`),this.parameters.length===0)e.write("()");else if(this.parameters.length===1){if(e.write("("),this.parameters[0]==null)throw new Error("Cannot render parameter "+this.parameters[0]);e.writeNode(this.parameters[0]),e.write(")")}else e.writeLine("("),e.indent(),this.parameters.forEach((r,i)=>{i>0&&e.writeLine(", "),e.writeNode(r)}),e.dedent(),e.write(")");if(this.body==null){e.write(";");return}e.writeLine(" {"),e.indent(),e.writeNode(this.body),e.writeNewLineIfLastLineNot(),e.dedent(),e.write("}")}};l();p();var G=class extends x{constructor({method:e,arguments_:r,on:i}){super();y(this,"on");y(this,"method");y(this,"arguments_");this.on=i,this.method=e,this.arguments_=r}write(e){this.on.write(e),e.write("."),e.write(this.method),fe({writer:e,arguments_:this.arguments_})}};l();p();var J=class extends x{constructor({name:e,type:r}){super();y(this,"name");y(this,"type");this.name=e,this.type=r}write(e){e.writeNode(this.type),e.write(` ${this.name}`)}};function Rr(n){return new V(n)}function Nr(n){return new $(n)}function Er(n){return new w(n)}function br(n){return new W(n)}function kr(n){return new G(n)}function Pr(n){return new H(n)}function Br(n){return new J(n)}var Ke="com.example.usage",Sr="Example",Cr="main",Lr="args",ze="client",Mr={type:"primitive",value:"STRING"},Ae=class{constructor({context:t,formatter:e}){y(this,"context");y(this,"formatter");this.context=t,this.formatter=e}async generateSnippet({endpoint:t,request:e,options:r}){var s;let i=this.getConfig(r);return await this.buildCodeBlock({endpoint:t,snippet:e,options:r}).toStringAsync({packageName:(s=i.fullStylePackageName)!=null?s:Ke,customConfig:this.context.customConfig,formatter:this.formatter})}generateSnippetSync({endpoint:t,request:e,options:r}){var s;let i=this.getConfig(r);return this.buildCodeBlock({endpoint:t,snippet:e,options:r}).toString({packageName:(s=i.fullStylePackageName)!=null?s:Ke,customConfig:this.context.customConfig,formatter:this.formatter})}buildCodeBlock({endpoint:t,snippet:e,options:r}){let i=f.codeblock(s=>{s.writeNodeStatement(this.constructClient({endpoint:t,snippet:e})),s.newLine(),s.writeNodeStatement(this.callMethod({endpoint:t,snippet:e}))}),a=this.getStyle(r);switch(a){case D.Concise:return i;case D.Full:return this.buildFullCodeBlock({body:i,options:r});default:N(a)}}constructClient({endpoint:t,snippet:e}){return f.codeblock(r=>{r.writeNode(this.context.getRootClientClassReference()),r.write(` ${ze} = `),r.writeNode(f.TypeLiteral.builder({classReference:this.context.getRootClientClassReference(),parameters:this.getRootClientBuilderArgs({endpoint:t,snippet:e})}))})}buildFullCodeBlock({body:t,options:e}){var s;let r=this.getConfig(e),i=f.class_({name:(s=r.fullStyleClassName)!=null?s:Sr,access:f.Access.Public}),a=f.parameter({name:Lr,type:f.Type.array(f.Type.string())});return i.addMethod(f.method({name:Cr,access:f.Access.Public,static_:!0,parameters:[a],body:t})),i}getRootClientBuilderArgs({endpoint:t,snippet:e}){var u,c;let r=[];t.auth!=null&&(e.auth!=null?r.push(...this.getRootClientAuthArgs({auth:t.auth,values:e.auth})):this.context.errors.add({severity:M.Warning,message:`Auth with ${t.auth.type} configuration is required for this endpoint`}));let i=this.getRootClientBaseUrlArg({baseUrl:e.baseURL,environment:e.environment});i!=null&&r.push(i),this.context.errors.scope(P.Headers),this.context.ir.headers!=null&&e.headers!=null&&r.push(...this.getRootClientHeaderArgs({headers:this.context.ir.headers,values:e.headers})),this.context.errors.unscope();let a=new Set;if([...(u=this.context.ir.pathParameters)!=null?u:[],...(c=t.request.pathParameters)!=null?c:[]].forEach(h=>{h.variable!=null&&a.add(h.variable)}),this.context.ir.variables!=null&&this.context.ir.variables.length>0){for(let h of this.context.ir.variables)if(a.has(h.id)){let m=h.name.camelCase.unsafeName;r.push({name:m,value:f.TypeLiteral.string(`YOUR_${h.name.screamingSnakeCase.unsafeName}`)})}}return r}getRootClientBaseUrlArg({baseUrl:t,environment:e}){var r;if(t!=null&&e!=null){this.context.errors.add({severity:M.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(t!=null){if(((r=this.context.ir.environments)==null?void 0:r.environments.type)==="multipleBaseUrls"){this.context.errors.add({severity:M.Critical,message:"The Java SDK doesn't support a baseUrl when multiple URL environments are configured"});return}return{name:"url",value:f.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:M.Warning,message:`Environment ${JSON.stringify(e)} was not found`});return}return{name:"environment",value:f.TypeLiteral.reference(i)}}if(this.context.isMultiEnvironmentValues(e))return this.context.validateMultiEnvironmentUrlValues(e)?{name:"environment",value:f.TypeLiteral.reference(f.instantiateClass({classReference:this.context.getEnvironmentClassReference(),arguments_:Object.values(e).map(i=>this.context.dynamicTypeLiteralMapper.convert({typeReference:Mr,value:i}))}))}:void 0}}getRootClientAuthArgs({auth:t,values:e}){if(e.type!==t.type)return this.addError(this.context.newAuthMismatchError({auth:t,values:e}).message),[];switch(t.type){case"basic":return e.type==="basic"?this.getRootClientBasicAuthArgs({auth:t,values:e}):[];case"bearer":return e.type==="bearer"?this.getRootClientBearerAuthArgs({auth:t,values:e}):[];case"header":return e.type==="header"?this.getRootClientHeaderAuthArgs({auth:t,values:e}):[];case"oauth":return e.type==="oauth"?this.getRootClientOAuthArgs({auth:t,values:e}):[];case"inferred":return this.addWarning("The Java SDK Generator does not support Inferred auth scheme yet"),[];default:N(t)}}addError(t){this.context.errors.add({severity:M.Critical,message:t})}addWarning(t){this.context.errors.add({severity:M.Warning,message:t})}getRootClientBasicAuthArgs({auth:t,values:e}){return[{name:"credentials",value:f.TypeLiteral.raw(`"${e.username}", "${e.password}"`)}]}getRootClientBearerAuthArgs({auth:t,values:e}){return[{name:this.context.getMethodName(t.token),value:f.TypeLiteral.string(e.token)}]}getRootClientHeaderAuthArgs({auth:t,values:e}){return[{name:this.context.getMethodName(t.header.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:t.header.typeReference,value:e.value})}]}getRootClientOAuthArgs({auth:t,values:e}){return[{name:this.context.getMethodName(t.clientId),value:f.TypeLiteral.string(e.clientId)},{name:this.context.getMethodName(t.clientSecret),value:f.TypeLiteral.string(e.clientSecret)}]}getRootClientHeaderArgs({headers:t,values:e}){let r=[];for(let i of t){let a=this.getRootClientHeaderArg({header:i,value:e.value});a!=null&&r.push({name:this.context.getMethodName(i.name.name),value:a})}return r}getRootClientHeaderArg({header:t,value:e}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:e});if(!f.TypeLiteral.isNop(r))return r}callMethod({endpoint:t,snippet:e}){return f.invokeMethod({on:f.codeblock(ze),method:this.getMethod({endpoint:t}),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:N(t.request)}}getMethodArgsForBodyRequest({request:t,snippet:e}){var u,c;let r=[];this.context.errors.scope(P.PathParameters);let a=[...(u=this.context.ir.pathParameters)!=null?u:[],...(c=t.pathParameters)!=null?c:[]].filter(h=>h.variable==null);a.length>0&&r.push(...this.getPathParameters({namedParameters:a,snippet:e}).map(h=>h.value)),this.context.errors.unscope(),this.context.errors.scope(P.RequestBody),t.body!=null&&r.push(this.getBodyRequestArg({body:t.body,value:e.requestBody})),this.context.errors.unscope();let s=this.getRequestOptionsArg({request:t,snippet:e});return s!=null&&r.push(s),r}getBodyRequestArg({body:t,value:e}){switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":return t.value.type==="optional"?e==null?f.TypeLiteral.reference(f.invokeMethod({on:f.classReference({name:"Optional",packageName:"java.util"}),method:"empty",arguments_:[]})):f.TypeLiteral.optional({value:this.context.dynamicTypeLiteralMapper.convert({typeReference:t.value.value,value:e}),useOf:!0}):this.context.dynamicTypeLiteralMapper.convert({typeReference:t.value,value:e});default:N(t)}}getBytesBodyRequestArg({value:t}){return typeof t!="string"?(this.context.errors.add({severity:M.Critical,message:`Expected bytes value to be a string, got ${typeof t}`}),f.TypeLiteral.nop()):f.TypeLiteral.bytes(t)}getMethodArgsForInlinedRequest({request:t,snippet:e}){var m,d;let r=[],{inlinePathParameters:i,inlineFileProperties:a}={inlinePathParameters:this.context.shouldInlinePathParameters(),inlineFileProperties:this.context.shouldInlineFileProperties()};this.context.errors.scope(P.PathParameters);let s=[],c=[...(m=this.context.ir.pathParameters)!=null?m:[],...(d=t.pathParameters)!=null?d:[]].filter(v=>v.variable==null);c.length>0&&s.push(...this.getPathParameters({namedParameters:c,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(P.RequestBody);let h=this.getFilePropertyInfo({request:t,snippet:e});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})||r.push(...s.map(v=>v.value)),a||r.push(...h.fileFields.map(v=>v.value)),r.push(this.getInlinedRequestArg({request:t,snippet:e,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})?s:[],filePropertyInfo:h})),r}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:r,filePropertyInfo:i}){var m,d,v,A;this.context.errors.scope(P.QueryParameters);let s=this.context.associateQueryParametersByWireValue({parameters:(m=t.queryParameters)!=null?m:[],values:(d=e.queryParameters)!=null?d:{}}).map(E=>({name:this.context.getMethodName(E.name.name),value:this.context.dynamicTypeLiteralMapper.convert(E)}));this.context.errors.unscope(),this.context.errors.scope(P.Headers);let c=this.context.associateByWireValue({parameters:(v=t.headers)!=null?v:[],values:(A=e.headers)!=null?A:{}}).map(E=>({name:this.context.getMethodName(E.name.name),value:this.context.dynamicTypeLiteralMapper.convert(E)}));this.context.errors.unscope(),this.context.errors.scope(P.RequestBody);let h=t.body!=null?this.getInlinedRequestBodyBuilderParameters({body:t.body,value:e.requestBody,filePropertyInfo:i}):[];return this.context.errors.unscope(),f.TypeLiteral.builder({classReference:f.classReference({name:this.context.getClassName(t.declaration.name),packageName:this.context.getRequestsPackageName(t.declaration.fernFilepath)}),parameters:[...r,...c,...s,...h]})}getRequestOptionsArg({request:t,snippet:e}){var c,h,m;let r="headers"in t?(c=t.headers)!=null?c:[]:[];if(r.length===0||Object.keys((h=e.headers)!=null?h:{}).length===0)return;this.context.errors.scope(P.Headers);let i=this.context.associateByWireValue({parameters:r,values:(m=e.headers)!=null?m:{}});if(this.context.errors.unscope(),i.length===0)return;let a=f.classReference({name:"RequestOptions",packageName:this.context.getCorePackageName()}),s=f.invokeMethod({on:a,method:"builder",arguments_:[]});for(let d of i)s=f.invokeMethod({on:s,method:"addHeader",arguments_:[f.TypeLiteral.string(d.name.wireValue),this.context.dynamicTypeLiteralMapper.convert(d)]});let u=f.invokeMethod({on:s,method:"build",arguments_:[]});return f.TypeLiteral.reference(u)}getInlinedRequestBodyBuilderParameters({body:t,value:e,filePropertyInfo:r}){switch(t.type){case"properties":return this.getInlinedRequestBodyPropertyBuilderParameters({parameters:t.value,value:e});case"referenced":return[this.getReferencedRequestBodyPropertyBuilderParameter({body:t,value:e})];case"fileUpload":return this.getFileUploadRequestBodyBuilderParameters({filePropertyInfo:r});default:N(t)}}getFileUploadRequestBodyBuilderParameters({filePropertyInfo:t}){return this.context.shouldInlineFileProperties()?[...t.fileFields,...t.bodyPropertyFields]:t.bodyPropertyFields}getReferencedRequestBodyPropertyBuilderParameter({body:t,value:e}){return{name:this.context.getMethodName(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});default:N(t)}}getInlinedRequestBodyPropertyBuilderParameters({parameters:t,value:e}){var a;let r=[],i=this.context.associateByWireValue({parameters:t,values:(a=this.context.getRecord(e))!=null?a:{}});for(let s of i)r.push({name:this.context.getMethodName(s.name.name),value:this.context.dynamicTypeLiteralMapper.convert(s)});return r}getPathParameters({namedParameters:t,snippet:e}){var a;let r=[],i=this.context.associateByWireValue({parameters:t,values:(a=e.pathParameters)!=null?a:{}});for(let s of i)r.push({name:this.context.getMethodName(s.name.name),value:this.context.dynamicTypeLiteralMapper.convert(s)});return r}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)}getStyle(t){var e,r;return(r=(e=t.style)!=null?e:this.context.options.style)!=null?r:D.Full}getConfig(t){var e,r;return(r=(e=t.config)!=null?e:this.context.options.config)!=null?r:{}}};0&&(module.exports={EndpointSnippetGenerator});
|
|
22
|
+
`)}};var d={};_e(d,{Access:()=>Pe,AstNode:()=>v,Class:()=>G,ClassInstantiation:()=>J,ClassReference:()=>w,CodeBlock:()=>Q,Method:()=>K,MethodInvocation:()=>z,Parameter:()=>X,Type:()=>ae,TypeLiteral:()=>N,Writer:()=>H,classReference:()=>Yr,class_:()=>$r,codeblock:()=>Dr,instantiateClass:()=>Wr,invokeMethod:()=>Vr,method:()=>Hr,parameter:()=>Gr});l();p();l();p();l();p();var Pe={Public:"public",Protected:"protected",Private:"private"};l();p();l();p();var v=class extends W{async toStringAsync({packageName:t,customConfig:e,formatter:r}){let i=new ie({packageName:t,customConfig:e,formatter:r});return this.write(i),i.toStringAsync()}toString({packageName:t,customConfig:e,formatter:r}){let i=new ie({packageName:t,customConfig:e,formatter:r});return this.write(i),i.toString()}};var G=class extends v{constructor({name:e,access:r}){super();h(this,"name");h(this,"access");h(this,"methods",[]);this.name=e,this.access=r}write(e){if(e.write(`${this.access} class ${this.name}`),this.isEmpty()){e.writeLine(" {}");return}e.writeLine(" {"),e.indent();for(let r of this.methods)e.writeNode(r),e.newLine();e.dedent(),e.write("}")}addMethod(e){this.methods.push(e)}isEmpty(){return this.methods.length===0}};l();p();l();p();l();p();l();p();var w=class extends v{constructor({name:e,packageName:r,fullyQualified:i}){super();h(this,"name");h(this,"packageName");h(this,"fullyQualified");this.name=e,this.packageName=r,this.fullyQualified=i!=null?i:!1}write(e){if(e.addImport(`${this.packageName}.${this.name}`),this.fullyQualified){e.write(`${this.packageName}.${this.name}`);return}e.write(this.name)}};l();p();var ae=class extends v{constructor(e){super();h(this,"internalType");this.internalType=e}write(e){switch(this.internalType.type){case"array":e.writeNode(this.internalType.value),e.write("[]");break;case"bigInteger":e.writeNode(Nr);break;case"boolean":e.write("Boolean");break;case"bytes":e.write("byte[]");break;case"date":e.write("String");break;case"dateTime":e.writeNode(Er);break;case"double":e.write("Double");break;case"float":e.write("Float");break;case"generic":e.writeNode(this.internalType.value),e.write("<");for(let[r,i]of this.internalType.parameters.entries())e.writeNode(i),r<this.internalType.parameters.length-1&&e.write(", ");e.write(">");break;case"inputStream":e.writeNode(Pr);break;case"integer":e.write("Integer");break;case"iterable":this.writeIterable({writer:e,iterable:this.internalType});break;case"list":{this.writeList({writer:e,list:this.internalType});break}case"long":{e.write("Long");break}case"map":{this.writeMap({writer:e,map:this.internalType});break}case"object":{e.write("Object");break}case"optional":{this.writeOptional({writer:e,optional:this.internalType});break}case"reference":e.writeNode(this.internalType.value);break;case"set":{this.writeSet({writer:e,set:this.internalType});break}case"string":e.write("String");break;case"uuid":e.writeNode(Sr);break;case"void":e.write("Void");break;default:A(this.internalType)}}isOptional(){return this.internalType.type==="optional"}static array(e){return new this({type:"array",value:e})}static bigInteger(){return new this({type:"bigInteger"})}static boolean(){return new this({type:"boolean"})}static bytes(){return new this({type:"bytes"})}static date(){return new this({type:"date"})}static dateTime(){return new this({type:"dateTime"})}static double(){return new this({type:"double"})}static float(){return new this({type:"float"})}static integer(){return new this({type:"integer"})}static list(e){return new this({type:"list",value:e})}static long(){return new this({type:"long"})}static map(e,r){return new this({type:"map",keyType:e,valueType:r})}static object(){return new this({type:"object"})}static optional(e){return this.isAlreadyOptional(e)?e:new this({type:"optional",value:e})}static reference(e){return new this({type:"reference",value:e})}static generic(e,r){return new this({type:"generic",value:e,parameters:r})}static set(e){return new this({type:"set",value:e})}static string(){return new this({type:"string"})}static uuid(){return new this({type:"uuid"})}static void(){return new this({type:"void"})}static iterable(e){return new this({type:"iterable",value:e})}static inputStream(){return new this({type:"inputStream"})}writeList({writer:e,list:r}){e.writeNode(Ar),e.write("<"),r.value.write(e),e.write(">")}writeMap({writer:e,map:r}){e.writeNode(kr),e.write("<"),r.keyType.write(e),e.write(", "),r.valueType.write(e),e.write(">")}writeOptional({writer:e,optional:r}){e.writeNode(we),e.write("<"),r.value.write(e),e.write(">")}writeIterable({writer:e,iterable:r}){e.writeNode(we),e.write("<"),r.value.write(e),e.write(">")}writeSet({writer:e,set:r}){e.writeNode(br),e.write("<"),r.value.write(e),e.write(">")}static isAlreadyOptional(e){return e.internalType.type==="optional"}},xe=new w({name:"Arrays",packageName:"java.util"}),Nr=new w({name:"BigInteger",packageName:"java.math"}),ra=new w({name:"HashMap",packageName:"java.util"}),Ar=new w({name:"List",packageName:"java.util"}),kr=new w({name:"Map",packageName:"java.util"}),Er=new w({name:"OffsetDateTime",packageName:"java.time"}),we=new w({name:"Optional",packageName:"java.util"}),br=new w({name:"Set",packageName:"java.util"}),Sr=new w({name:"UUID",packageName:"java.util"}),Pr=new w({name:"InputStream",packageName:"java.io"});var N=class n extends v{constructor(e){super();h(this,"internalType");this.internalType=e}write(e){switch(this.internalType.type){case"bigInteger":this.writeBigInteger({writer:e,bigInteger:this.internalType});break;case"boolean":e.write(this.internalType.value.toString());break;case"builder":this.writeBuilder({writer:e,builder:this.internalType});break;case"bytes":e.write(`"${this.internalType.value}".getBytes()`);break;case"class":{this.writeClass({writer:e,class_:this.internalType});break}case"date":e.write(`"${this.internalType.value}"`);break;case"dateTime":this.writeDateTime({writer:e,dateTime:this.internalType});break;case"double":{let r=this.internalType.value.toString();!r.includes(".")&&!r.includes("e")&&!r.includes("E")?e.write(`${r}.0`):e.write(r);break}case"enum":this.writeEnum({writer:e,enum_:this.internalType});break;case"float":e.write(`${this.internalType.value}f`);break;case"integer":e.write(Math.floor(this.internalType.value).toString());break;case"list":{this.writeList({writer:e,list:this.internalType});break}case"long":{e.write(`${Math.floor(this.internalType.value)}L`);break}case"map":{this.writeMap({writer:e,map:this.internalType});break}case"optional":{this.writeOptional({writer:e,optional:this.internalType});break}case"raw":{this.internalType.value instanceof v?e.writeNode(this.internalType.value):e.write(this.internalType.value);break}case"reference":e.writeNode(this.internalType.value);break;case"set":{this.writeSet({writer:e,set:this.internalType});break}case"string":e.write(`"${this.escapeString(this.internalType.value)}"`);break;case"unknown":this.writeUnknown({writer:e,value:this.internalType.value});break;case"uuid":this.writeUUID({writer:e,uuid:this.internalType});break;case"nop":break;default:A(this.internalType)}}isOptional(){return this.internalType.type==="optional"}static bigInteger(e){return new this({type:"bigInteger",value:e})}static boolean(e){return new this({type:"boolean",value:e})}static builder({classReference:e,parameters:r}){return new this({type:"builder",classReference:e,parameters:r})}static bytes(e){return new this({type:"bytes",value:e})}static class_({reference:e,parameters:r}){return new this({type:"class",reference:e,parameters:r})}static date(e){return new this({type:"date",value:e})}static dateTime(e){return new this({type:"dateTime",value:e})}static double(e){return new this({type:"double",value:e})}static enum_({classReference:e,value:r}){return new this({type:"enum",classReference:e,value:r})}static float(e){return new this({type:"float",value:e})}static integer(e){return new this({type:"integer",value:e})}static list({valueType:e,values:r,isParameter:i}){return new this({type:"list",valueType:e,values:r,isParameter:i})}static long(e){return new this({type:"long",value:e})}static map({keyType:e,valueType:r,entries:i}){return new this({type:"map",keyType:e,valueType:r,entries:i})}static optional({value:e,useOf:r}){return this.isAlreadyOptional(e)?e:new this({type:"optional",value:e,useOf:r})}static raw(e){return new this({type:"raw",value:e})}static reference(e){return new this({type:"reference",value:e})}static set({valueType:e,values:r}){return new this({type:"set",valueType:e,values:r})}static string(e){return new this({type:"string",value:e})}static unknown(e){return new this({type:"unknown",value:e})}static uuid(e){return new this({type:"uuid",value:e})}static nop(){return new this({type:"nop"})}static isNop(e){return e.internalType.type==="nop"}shouldWriteInLine(){switch(this.internalType.type){case"bigInteger":case"boolean":case"bytes":case"date":case"dateTime":case"double":case"enum":case"float":case"integer":case"long":case"nop":case"raw":case"string":case"unknown":case"uuid":return!0;case"optional":return this.internalType.value.shouldWriteInLine();case"builder":case"class":case"list":case"map":case"reference":case"set":return!1;default:A(this.internalType)}}writeBigInteger({writer:e,bigInteger:r}){e.write("new "),e.writeNode(d.instantiateClass({classReference:Br,arguments_:[n.string(r.value)]}))}writeBuilder({writer:e,builder:r}){e.writeNode(r.classReference),e.writeNewLineIfLastLineNot(),e.indent(),this.writeBuilderParameters({writer:e,parameters:this.orderBuilderParameters(_r({parameters:r.parameters}))}),e.dedent()}writeBuilderParameters({writer:e,parameters:r}){e.writeLine(".builder()");for(let i of r)e.write(`.${i.name}(`),i.value.shouldWriteInLine()||e.newLine(),e.indent(),e.writeNode(i.value),e.dedent(),i.value.shouldWriteInLine()||e.newLine(),e.writeLine(")");e.writeNewLineIfLastLineNot(),e.write(".build()")}orderBuilderParameters(e){return e.some(i=>!i.value.isOptional()&&!this.isCollection(i.value))?e.sort((i,s)=>{let a=this.isNonRequired(i.value),c=this.isNonRequired(s.value);return a&&!c?1:!a&&c?-1:0}):e.sort((i,s)=>{let a=i.value.isOptional(),c=s.value.isOptional();return a&&!c?1:!a&&c?-1:0})}isCollection(e){let r=e.internalType.type;return r==="list"||r==="set"||r==="map"}isNonRequired(e){return e.isOptional()||this.isCollection(e)}writeClass({writer:e,class_:r}){let i=Mr({parameters:r.parameters});e.writeNode(d.instantiateClass({classReference:r.reference,arguments_:i.map(s=>s.value)}))}writeDateTime({writer:e,dateTime:r}){e.writeNode(d.invokeMethod({on:Lr,method:"parse",arguments_:[n.string(r.value)]}))}writeEnum({writer:e,enum_:r}){e.writeNode(r.classReference),e.write("."+r.value)}writeList({writer:e,list:r}){this.writeIterable({writer:e,iterable:r})}writeMap({writer:e,map:r}){let i=Ur({entries:r.entries});if(i.length===0){e.write("new "),e.writeNode(ve),e.write("<"),e.writeNode(r.keyType),e.write(", "),e.writeNode(r.valueType),e.write(">()");return}e.write("new "),e.writeNode(ve),e.write("<"),e.writeNode(r.keyType),e.write(", "),e.writeNode(r.valueType),e.writeLine(">() {{"),e.indent();for(let s of i)e.write("put("),e.writeNode(s.key),e.write(", "),e.writeNode(s.value),e.writeLine(");");e.dedent(),e.write("}}")}writeOptional({writer:e,optional:r}){if(!r.useOf){e.writeNode(r.value);return}e.writeNode(d.invokeMethod({on:we,method:"of",arguments_:[r.value]}))}writeSet({writer:e,set:r}){this.writeIterable({writer:e,iterable:r})}writeIterable({writer:e,iterable:r}){let i=r.type==="list"?Be:Cr,s=qr({values:r.values});if(r.type==="list"&&r.isParameter&&s.length>0){e.writeNode(d.invokeMethod({on:xe,method:"asList",arguments_:s}));return}if(s.length===0){e.write(`new ${i.name}<`),e.writeNode(r.valueType),e.write(">()");return}e.write("new "),e.writeNode(i),e.write("<"),e.writeNode(r.valueType),e.writeLine(">("),e.indent(),e.writeNode(d.invokeMethod({on:xe,method:"asList",arguments_:s})),e.writeNewLineIfLastLineNot(),e.dedent(),e.write(")")}writeUnknown({writer:e,value:r}){switch(typeof r){case"boolean":e.write(r.toString());return;case"string":e.write(`"${this.escapeString(r)}"`);return;case"number":e.write(r.toString());return;case"object":if(r==null){e.write("null");return}if(Array.isArray(r)){this.writeUnknownArray({writer:e,value:r});return}this.writeUnknownMap({writer:e,value:r});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof r}`)}}writeUnknownArray({writer:e,value:r}){if(r.length===0){e.write("new "),e.writeNode(Be),e.write("<Object>()");return}e.write("new "),e.writeNode(Be),e.write("<Object>("),e.writeNode(d.invokeMethod({on:xe,method:"asList",arguments_:r.map(i=>n.unknown(i))})),e.write(")")}writeUnknownMap({writer:e,value:r}){let i=Object.entries(r);if(i.length===0){e.write("new "),e.writeNode(ve),e.write("<String, Object>()");return}e.writeLine("new "),e.writeNode(ve),e.write("<String, Object>() {{"),e.indent();for(let[s,a]of i)e.write(`put("${s}", `),e.writeNode(n.unknown(a)),e.writeLine(");");e.dedent(),e.write("}}")}writeUUID({writer:e,uuid:r}){e.writeNode(d.invokeMethod({on:Fr,method:"fromString",arguments_:[n.string(r.value)]}))}escapeString(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}static isAlreadyOptional(e){return e.internalType.type==="optional"}},Be=new w({name:"ArrayList",packageName:"java.util"}),Br=new w({name:"BigInteger",packageName:"java.math"}),ve=new w({name:"HashMap",packageName:"java.util"}),Cr=new w({name:"HashSet",packageName:"java.util"}),ha=new w({name:"List",packageName:"java.util"}),fa=new w({name:"Map",packageName:"java.util"}),Lr=new w({name:"OffsetDateTime",packageName:"java.time"}),ma=new w({name:"Set",packageName:"java.util"}),Fr=new w({name:"UUID",packageName:"java.util"});function Mr({parameters:n}){return n.filter(t=>!N.isNop(t.value))}function _r({parameters:n}){return n.filter(t=>!N.isNop(t.value))}function Ur({entries:n}){return n.filter(t=>!N.isNop(t.key)&&!N.isNop(t.value))}function qr({values:n}){return n.filter(t=>!N.isNop(t))}function Te({writer:n,arguments_:t}){let e=jr(t);if(e.length===0){n.write("()");return}if(e.some(i=>i instanceof N&&!i.shouldWriteInLine())){Or({writer:n,arguments_:e});return}n.write("("),e.forEach((i,s)=>{s>0&&n.write(", "),lt({writer:n,argument:i})}),n.write(")")}function Or({writer:n,arguments_:t}){n.writeLine("("),n.indent(),t.forEach((e,r)=>{r>0&&n.writeLine(","),lt({writer:n,argument:e})}),n.dedent(),t.length>0&&n.newLine(),n.write(")")}function lt({writer:n,argument:t}){Se(t)?n.writeNodeOrString(t.assignment):t.write(n)}function jr(n){return n.filter(t=>!(t instanceof N&&N.isNop(t)))}var J=class extends v{constructor({classReference:e,arguments_:r}){super();h(this,"classReference");h(this,"arguments_");this.classReference=e,this.arguments_=r}write(e){e.writeNode(this.classReference),Te({writer:e,arguments_:this.arguments_})}};l();p();var Q=class extends v{constructor(e){super();h(this,"arg");this.arg=e}write(e){return new P(this.arg).write(e)}};l();p();var K=class extends v{constructor({name:e,access:r,parameters:i,body:s,static_:a,return_:c}){super();h(this,"name");h(this,"access");h(this,"parameters");h(this,"body");h(this,"return_");h(this,"static_");this.name=e,this.access=r,this.parameters=i,this.body=s,this.return_=c,this.static_=a!=null?a:!1}write(e){if(e.write(`${this.access} `),this.static_&&e.write("static "),this.return_!=null?e.writeNode(this.return_):e.write("void"),e.write(` ${this.name}`),this.parameters.length===0)e.write("()");else if(this.parameters.length===1){if(e.write("("),this.parameters[0]==null)throw new Error("Cannot render parameter "+this.parameters[0]);e.writeNode(this.parameters[0]),e.write(")")}else e.writeLine("("),e.indent(),this.parameters.forEach((r,i)=>{i>0&&e.writeLine(", "),e.writeNode(r)}),e.dedent(),e.write(")");if(this.body==null){e.write(";");return}e.writeLine(" {"),e.indent(),e.writeNode(this.body),e.writeNewLineIfLastLineNot(),e.dedent(),e.write("}")}};l();p();var z=class extends v{constructor({method:e,arguments_:r,on:i}){super();h(this,"on");h(this,"method");h(this,"arguments_");this.on=i,this.method=e,this.arguments_=r}write(e){this.on.write(e),e.write("."),e.write(this.method),Te({writer:e,arguments_:this.arguments_})}};l();p();var X=class extends v{constructor({name:e,type:r}){super();h(this,"name");h(this,"type");this.name=e,this.type=r}write(e){e.writeNode(this.type),e.write(` ${this.name}`)}};function Dr(n){return new Q(n)}function $r(n){return new G(n)}function Yr(n){return new w(n)}function Wr(n){return new J(n)}function Vr(n){return new z(n)}function Hr(n){return new K(n)}function Gr(n){return new X(n)}var pt="com.example.usage",Jr="Example",Qr="main",Kr="args",ht="client",zr={type:"primitive",value:"STRING"},Ce=class{constructor({context:t,formatter:e}){h(this,"context");h(this,"formatter");this.context=t,this.formatter=e}async generateSnippet({endpoint:t,request:e,options:r}){var a;let i=this.getConfig(r);return await this.buildCodeBlock({endpoint:t,snippet:e,options:r}).toStringAsync({packageName:(a=i.fullStylePackageName)!=null?a:pt,customConfig:this.context.customConfig,formatter:this.formatter})}generateSnippetSync({endpoint:t,request:e,options:r}){var a;let i=this.getConfig(r);return this.buildCodeBlock({endpoint:t,snippet:e,options:r}).toString({packageName:(a=i.fullStylePackageName)!=null?a:pt,customConfig:this.context.customConfig,formatter:this.formatter})}buildCodeBlock({endpoint:t,snippet:e,options:r}){let i=d.codeblock(a=>{a.writeNodeStatement(this.constructClient({endpoint:t,snippet:e})),a.newLine(),a.writeNodeStatement(this.callMethod({endpoint:t,snippet:e}))}),s=this.getStyle(r);switch(s){case V.Concise:return i;case V.Full:return this.buildFullCodeBlock({body:i,options:r});default:A(s)}}constructClient({endpoint:t,snippet:e}){return d.codeblock(r=>{r.writeNode(this.context.getRootClientClassReference()),r.write(` ${ht} = `),r.writeNode(d.TypeLiteral.builder({classReference:this.context.getRootClientClassReference(),parameters:this.getRootClientBuilderArgs({endpoint:t,snippet:e})}))})}buildFullCodeBlock({body:t,options:e}){var a;let r=this.getConfig(e),i=d.class_({name:(a=r.fullStyleClassName)!=null?a:Jr,access:d.Access.Public}),s=d.parameter({name:Kr,type:d.Type.array(d.Type.string())});return i.addMethod(d.method({name:Qr,access:d.Access.Public,static_:!0,parameters:[s],body:t})),i}getRootClientBuilderArgs({endpoint:t,snippet:e}){var c,u;let r=[];t.auth!=null&&(e.auth!=null?r.push(...this.getRootClientAuthArgs({auth:t.auth,values:e.auth})):this.context.errors.add({severity:U.Warning,message:`Auth with ${t.auth.type} configuration is required for this endpoint`}));let i=this.getRootClientBaseUrlArg({baseUrl:e.baseURL,environment:e.environment});i!=null&&r.push(i),this.context.errors.scope(b.Headers),this.context.ir.headers!=null&&e.headers!=null&&r.push(...this.getRootClientHeaderArgs({headers:this.context.ir.headers,values:e.headers})),this.context.errors.unscope();let s=new Set;if([...(c=this.context.ir.pathParameters)!=null?c:[],...(u=t.request.pathParameters)!=null?u:[]].forEach(m=>{m.variable!=null&&s.add(m.variable)}),this.context.ir.variables!=null&&this.context.ir.variables.length>0){for(let m of this.context.ir.variables)if(s.has(m.id)){let f=m.name.camelCase.unsafeName;r.push({name:f,value:d.TypeLiteral.string(`YOUR_${m.name.screamingSnakeCase.unsafeName}`)})}}if(this.context.errors.scope(b.PathParameters),this.context.ir.pathParameters!=null&&this.context.ir.pathParameters.length>0){let m=this.context.ir.pathParameters.filter(f=>f.variable==null);m.length>0&&r.push(...this.getPathParameters({namedParameters:m,snippet:e}))}return this.context.errors.unscope(),r}getRootClientBaseUrlArg({baseUrl:t,environment:e}){var r;if(t!=null&&e!=null){this.context.errors.add({severity:U.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(t!=null){if(((r=this.context.ir.environments)==null?void 0:r.environments.type)==="multipleBaseUrls"){this.context.errors.add({severity:U.Critical,message:"The Java SDK doesn't support a baseUrl when multiple URL environments are configured"});return}return{name:"url",value:d.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:U.Warning,message:`Environment ${JSON.stringify(e)} was not found`});return}return{name:"environment",value:d.TypeLiteral.reference(i)}}if(this.context.isMultiEnvironmentValues(e))return this.context.validateMultiEnvironmentUrlValues(e)?{name:"environment",value:d.TypeLiteral.reference(d.instantiateClass({classReference:this.context.getEnvironmentClassReference(),arguments_:Object.values(e).map(i=>this.context.dynamicTypeLiteralMapper.convert({typeReference:zr,value:i}))}))}:void 0}}getRootClientAuthArgs({auth:t,values:e}){if(e.type!==t.type)return this.addError(this.context.newAuthMismatchError({auth:t,values:e}).message),[];switch(t.type){case"basic":return e.type==="basic"?this.getRootClientBasicAuthArgs({auth:t,values:e}):[];case"bearer":return e.type==="bearer"?this.getRootClientBearerAuthArgs({auth:t,values:e}):[];case"header":return e.type==="header"?this.getRootClientHeaderAuthArgs({auth:t,values:e}):[];case"oauth":return e.type==="oauth"?this.getRootClientOAuthArgs({auth:t,values:e}):[];case"inferred":return this.addWarning("The Java SDK Generator does not support Inferred auth scheme yet"),[];default:A(t)}}addError(t){this.context.errors.add({severity:U.Critical,message:t})}addWarning(t){this.context.errors.add({severity:U.Warning,message:t})}getRootClientBasicAuthArgs({auth:t,values:e}){return[{name:"credentials",value:d.TypeLiteral.raw(`"${e.username}", "${e.password}"`)}]}getRootClientBearerAuthArgs({auth:t,values:e}){return[{name:this.context.getMethodName(t.token),value:d.TypeLiteral.string(e.token)}]}getRootClientHeaderAuthArgs({auth:t,values:e}){return[{name:this.context.getMethodName(t.header.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:t.header.typeReference,value:e.value})}]}getRootClientOAuthArgs({auth:t,values:e}){return[{name:this.context.getMethodName(t.clientId),value:d.TypeLiteral.string(e.clientId)},{name:this.context.getMethodName(t.clientSecret),value:d.TypeLiteral.string(e.clientSecret)}]}getRootClientHeaderArgs({headers:t,values:e}){let r=[];for(let i of t){let s=this.getRootClientHeaderArg({header:i,value:e.value});s!=null&&r.push({name:this.context.getMethodName(i.name.name),value:s})}return r}getRootClientHeaderArg({header:t,value:e}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:e});if(!d.TypeLiteral.isNop(r))return r}callMethod({endpoint:t,snippet:e}){return d.invokeMethod({on:d.codeblock(ht),method:this.getMethod({endpoint:t}),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:A(t.request)}}getMethodArgsForBodyRequest({request:t,snippet:e}){var a;let r=[];this.context.errors.scope(b.PathParameters);let i=((a=t.pathParameters)!=null?a:[]).filter(c=>c.variable==null);i.length>0&&r.push(...this.getPathParameters({namedParameters:i,snippet:e}).map(c=>c.value)),this.context.errors.unscope(),this.context.errors.scope(b.RequestBody),t.body!=null&&r.push(this.getBodyRequestArg({body:t.body,value:e.requestBody})),this.context.errors.unscope();let s=this.getRequestOptionsArg({request:t,snippet:e});return s!=null&&r.push(s),r}getBodyRequestArg({body:t,value:e}){switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":{if(t.value.type==="optional"){if(e==null)return d.TypeLiteral.reference(d.invokeMethod({on:d.classReference({name:"Optional",packageName:"java.util"}),method:"empty",arguments_:[]}));let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:t.value.value,value:e,as:"request"});return r.toString({packageName:"com.example",customConfig:this.context.customConfig}).includes("Optional.empty()")?r:d.TypeLiteral.optional({value:r,useOf:!0})}return this.context.dynamicTypeLiteralMapper.convert({typeReference:t.value,value:e,as:"request"})}default:A(t)}}getBytesBodyRequestArg({value:t}){return t==null?d.TypeLiteral.bytes(""):typeof t!="string"?(this.context.errors.add({severity:U.Critical,message:`Expected bytes value to be a string, got ${typeof t}`}),d.TypeLiteral.nop()):d.TypeLiteral.bytes(t)}getMethodArgsForInlinedRequest({request:t,snippet:e}){var m;let r=[],{inlinePathParameters:i,inlineFileProperties:s}={inlinePathParameters:this.context.shouldInlinePathParameters(),inlineFileProperties:this.context.shouldInlineFileProperties()};this.context.errors.scope(b.PathParameters);let a=[],c=((m=t.pathParameters)!=null?m:[]).filter(f=>f.variable==null);c.length>0&&a.push(...this.getPathParameters({namedParameters:c,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(b.RequestBody);let u=this.getFilePropertyInfo({request:t,snippet:e});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})||r.push(...a.map(f=>f.value)),s||r.push(...u.fileFields.map(f=>f.value)),r.push(this.getInlinedRequestArg({request:t,snippet:e,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})?a:[],filePropertyInfo:u})),r}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:r,filePropertyInfo:i}){var k,j,se,Le,Fe,Me;this.context.errors.scope(b.QueryParameters);let a=this.context.associateQueryParametersByWireValue({parameters:(k=t.queryParameters)!=null?k:[],values:(j=e.queryParameters)!=null?j:{}}).filter(S=>!this.context.isDirectLiteral(S.typeReference)),u=this.context.sortTypeInstancesByRequiredFirst(a,(se=t.queryParameters)!=null?se:[]).map(S=>({name:this.context.getMethodName(S.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:S.typeReference,value:S.value,as:"request"})}));this.context.errors.unscope(),this.context.errors.scope(b.Headers);let f=this.context.associateByWireValue({parameters:(Le=t.headers)!=null?Le:[],values:(Fe=e.headers)!=null?Fe:{}}).filter(S=>!this.context.isDirectLiteral(S.typeReference)),x=this.context.sortTypeInstancesByRequiredFirst(f,(Me=t.headers)!=null?Me:[]).map(S=>({name:this.context.getMethodName(S.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:S.typeReference,value:S.value,as:"request"})}));this.context.errors.unscope(),this.context.errors.scope(b.RequestBody);let T=t.body!=null?this.getInlinedRequestBodyBuilderParameters({body:t.body,value:e.requestBody,filePropertyInfo:i}):[];return this.context.errors.unscope(),d.TypeLiteral.builder({classReference:d.classReference({name:this.context.getClassName(t.declaration.name),packageName:this.context.getRequestsPackageName(t.declaration.fernFilepath)}),parameters:[...r,...x,...u,...T]})}getRequestOptionsArg({request:t,snippet:e}){var u,m,f;let r="headers"in t?(u=t.headers)!=null?u:[]:[];if(r.length===0||Object.keys((m=e.headers)!=null?m:{}).length===0)return;this.context.errors.scope(b.Headers);let i=this.context.associateByWireValue({parameters:r,values:(f=e.headers)!=null?f:{}});if(this.context.errors.unscope(),i.length===0)return;let s=d.classReference({name:"RequestOptions",packageName:this.context.getCorePackageName()}),a=d.invokeMethod({on:s,method:"builder",arguments_:[]});for(let y of i)a=d.invokeMethod({on:a,method:"addHeader",arguments_:[d.TypeLiteral.string(y.name.wireValue),this.context.dynamicTypeLiteralMapper.convert(y)]});let c=d.invokeMethod({on:a,method:"build",arguments_:[]});return d.TypeLiteral.reference(c)}getInlinedRequestBodyBuilderParameters({body:t,value:e,filePropertyInfo:r}){switch(t.type){case"properties":return this.getInlinedRequestBodyPropertyBuilderParameters({parameters:t.value,value:e});case"referenced":return[this.getReferencedRequestBodyPropertyBuilderParameter({body:t,value:e})];case"fileUpload":return this.getFileUploadRequestBodyBuilderParameters({filePropertyInfo:r});default:A(t)}}getFileUploadRequestBodyBuilderParameters({filePropertyInfo:t}){return this.context.shouldInlineFileProperties()?[...t.fileFields,...t.bodyPropertyFields]:t.bodyPropertyFields}getReferencedRequestBodyPropertyBuilderParameter({body:t,value:e}){return{name:this.context.getMethodName(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,as:"request"});default:A(t)}}getInlinedRequestBodyPropertyBuilderParameters({parameters:t,value:e}){var a;let i=this.context.associateByWireValue({parameters:t,values:(a=this.context.getRecord(e))!=null?a:{}}).filter(c=>!this.context.isDirectLiteral(c.typeReference));return this.context.sortTypeInstancesByRequiredFirst(i,t).map(c=>({name:this.context.getMethodName(c.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:c.typeReference,value:c.value,as:"request"})}))}getPathParameters({namedParameters:t,snippet:e}){var s;let r=[],i=this.context.associateByWireValue({parameters:t,values:(s=e.pathParameters)!=null?s:{}});for(let a of i)r.push({name:this.context.getMethodName(a.name.name),value:this.context.dynamicTypeLiteralMapper.convert(a)});return r}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)}getStyle(t){var e,r;return(r=(e=t.style)!=null?e:this.context.options.style)!=null?r:V.Full}getConfig(t){var e,r;return(r=(e=t.config)!=null?e:this.context.options.config)!=null?r:{}}};0&&(module.exports={EndpointSnippetGenerator});
|
|
20
23
|
/*! Bundled license information:
|
|
21
24
|
|
|
22
25
|
@esbuild-plugins/node-globals-polyfill/Buffer.js:
|