@fern-api/java-dynamic-snippets 0.0.3 → 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.
Files changed (78) hide show
  1. package/cjs/Config.cjs +1 -0
  2. package/cjs/Config.cjs.map +1 -0
  3. package/cjs/DynamicSnippetsGenerator.cjs +25 -11
  4. package/cjs/DynamicSnippetsGenerator.cjs.map +1 -0
  5. package/cjs/DynamicSnippetsGenerator.d.cts +1 -1
  6. package/cjs/{DynamicSnippetsGeneratorContext-B2BA5MLv.d.cts → DynamicSnippetsGeneratorContext-DGzYoCz3.d.cts} +19 -6
  7. package/cjs/EndpointSnippetGenerator.cjs +15 -7
  8. package/cjs/EndpointSnippetGenerator.cjs.map +1 -0
  9. package/cjs/EndpointSnippetGenerator.d.cts +4 -1
  10. package/cjs/context/DynamicSnippetsGeneratorContext.cjs +25 -11
  11. package/cjs/context/DynamicSnippetsGeneratorContext.cjs.map +1 -0
  12. package/cjs/context/DynamicSnippetsGeneratorContext.d.cts +1 -1
  13. package/cjs/context/DynamicTypeLiteralMapper.cjs +21 -7
  14. package/cjs/context/DynamicTypeLiteralMapper.cjs.map +1 -0
  15. package/cjs/context/DynamicTypeLiteralMapper.d.cts +1 -1
  16. package/cjs/context/DynamicTypeMapper.cjs +15 -7
  17. package/cjs/context/DynamicTypeMapper.cjs.map +1 -0
  18. package/cjs/context/DynamicTypeMapper.d.cts +1 -1
  19. package/cjs/context/FilePropertyMapper.cjs +15 -7
  20. package/cjs/context/FilePropertyMapper.cjs.map +1 -0
  21. package/cjs/context/FilePropertyMapper.d.cts +1 -1
  22. package/cjs/index.cjs +23 -21
  23. package/cjs/index.cjs.map +1 -0
  24. package/cjs/index.d.cts +2 -2
  25. package/esm/Config.js +2 -1
  26. package/esm/Config.js.map +1 -0
  27. package/esm/DynamicSnippetsGenerator.d.ts +1 -1
  28. package/esm/DynamicSnippetsGenerator.js +2 -1
  29. package/esm/DynamicSnippetsGenerator.js.map +1 -0
  30. package/esm/{DynamicSnippetsGeneratorContext-B2BA5MLv.d.ts → DynamicSnippetsGeneratorContext-DGzYoCz3.d.ts} +19 -6
  31. package/esm/EndpointSnippetGenerator.d.ts +4 -1
  32. package/esm/EndpointSnippetGenerator.js +2 -1
  33. package/esm/EndpointSnippetGenerator.js.map +1 -0
  34. package/esm/chunk-2U3YQWRZ.js +12 -0
  35. package/esm/chunk-2U3YQWRZ.js.map +1 -0
  36. package/esm/chunk-3X524Y2I.js +23 -0
  37. package/esm/chunk-3X524Y2I.js.map +1 -0
  38. package/esm/chunk-5CTXVUPZ.js +8 -0
  39. package/esm/chunk-5CTXVUPZ.js.map +1 -0
  40. package/esm/chunk-EOZMORS3.js +2 -0
  41. package/esm/chunk-EOZMORS3.js.map +1 -0
  42. package/esm/chunk-JFD4YVTW.js +15 -0
  43. package/esm/chunk-JFD4YVTW.js.map +1 -0
  44. package/esm/chunk-KQE3JYZ2.js +2 -0
  45. package/esm/chunk-KQE3JYZ2.js.map +1 -0
  46. package/esm/chunk-N3AIOPEV.js +2 -0
  47. package/esm/chunk-N3AIOPEV.js.map +1 -0
  48. package/esm/chunk-PBNDQMXA.js +2 -0
  49. package/esm/chunk-PBNDQMXA.js.map +1 -0
  50. package/esm/chunk-QH22Z5KY.js +2 -0
  51. package/esm/chunk-QH22Z5KY.js.map +1 -0
  52. package/esm/{chunk-452HWDL4.js → chunk-VYJE6STI.js} +2 -1
  53. package/esm/chunk-VYJE6STI.js.map +1 -0
  54. package/esm/context/DynamicSnippetsGeneratorContext.d.ts +1 -1
  55. package/esm/context/DynamicSnippetsGeneratorContext.js +2 -1
  56. package/esm/context/DynamicSnippetsGeneratorContext.js.map +1 -0
  57. package/esm/context/DynamicTypeLiteralMapper.d.ts +1 -1
  58. package/esm/context/DynamicTypeLiteralMapper.js +2 -1
  59. package/esm/context/DynamicTypeLiteralMapper.js.map +1 -0
  60. package/esm/context/DynamicTypeMapper.d.ts +1 -1
  61. package/esm/context/DynamicTypeMapper.js +2 -1
  62. package/esm/context/DynamicTypeMapper.js.map +1 -0
  63. package/esm/context/FilePropertyMapper.d.ts +1 -1
  64. package/esm/context/FilePropertyMapper.js +2 -1
  65. package/esm/context/FilePropertyMapper.js.map +1 -0
  66. package/esm/index.d.ts +2 -2
  67. package/esm/index.js +2 -13
  68. package/esm/index.js.map +1 -0
  69. package/package.json +1 -1
  70. package/esm/chunk-2AZXIWKY.js +0 -11
  71. package/esm/chunk-7CY27UU7.js +0 -1
  72. package/esm/chunk-AASPH6YC.js +0 -15
  73. package/esm/chunk-BKM7JFLZ.js +0 -1
  74. package/esm/chunk-HN67B7VQ.js +0 -1
  75. package/esm/chunk-JSEUWNSK.js +0 -1
  76. package/esm/chunk-N3DIPQCT.js +0 -14
  77. package/esm/chunk-TTNRR5YY.js +0 -1
  78. package/esm/chunk-WFKWXM7L.js +0 -1
@@ -1,7 +1,7 @@
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-DGzYoCz3.cjs';
3
4
  import { EndpointSnippetGenerator } from './EndpointSnippetGenerator.cjs';
4
- import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-B2BA5MLv.cjs';
5
5
  import '@fern-api/java-ast';
6
6
 
7
7
  declare class DynamicSnippetsGenerator extends AbstractDynamicSnippetsGenerator<DynamicSnippetsGeneratorContext, EndpointSnippetGenerator> {
@@ -7,14 +7,17 @@ declare namespace DynamicTypeLiteralMapper {
7
7
  typeReference: FernIr.dynamic.TypeReference;
8
8
  value: unknown;
9
9
  as?: ConvertedAs;
10
+ inUndiscriminatedUnion?: boolean;
10
11
  }
11
- type ConvertedAs = "mapKey" | "mapValue";
12
+ type ConvertedAs = "mapKey" | "mapValue" | "request";
12
13
  }
13
14
  declare class DynamicTypeLiteralMapper {
14
15
  private context;
15
16
  constructor({ context }: {
16
17
  context: DynamicSnippetsGeneratorContext;
17
18
  });
19
+ private isNopTypeLiteral;
20
+ private wrapInOptionalIfNotNop;
18
21
  convert(args: DynamicTypeLiteralMapper.Args): java.TypeLiteral;
19
22
  private convertList;
20
23
  private convertLiteral;
@@ -78,7 +81,7 @@ declare class FilePropertyMapper {
78
81
 
79
82
  declare class DynamicSnippetsGeneratorContext extends AbstractDynamicSnippetsGeneratorContext {
80
83
  ir: FernIr.dynamic.DynamicIntermediateRepresentation;
81
- customConfig: BaseJavaCustomConfigSchema | undefined;
84
+ customConfig: BaseJavaCustomConfigSchema;
82
85
  dynamicTypeMapper: DynamicTypeMapper;
83
86
  dynamicTypeLiteralMapper: DynamicTypeLiteralMapper;
84
87
  filePropertyMapper: FilePropertyMapper;
@@ -107,12 +110,22 @@ declare class DynamicSnippetsGeneratorContext extends AbstractDynamicSnippetsGen
107
110
  getByteArrayInputStreamClassReference(): java.ClassReference;
108
111
  getStandardCharsetsClassReference(): java.ClassReference;
109
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
+ }>;
110
123
  getRootPackageName(): string;
111
124
  getCorePackageName(): string;
112
- getTypesPackageName(fernFilepath: FernIr.FernFilepath): string;
113
- getRequestsPackageName(fernFilepath: FernIr.FernFilepath): string;
114
- protected getResourcesPackage(fernFilepath: FernIr.FernFilepath, suffix?: string): string;
115
- getPackageName(fernFilepath: FernIr.FernFilepath, suffix?: string): string;
125
+ getTypesPackageName(fernFilepath: FernIr.dynamic.FernFilepath): string;
126
+ getRequestsPackageName(fernFilepath: FernIr.dynamic.FernFilepath): string;
127
+ protected getResourcesPackage(fernFilepath: FernIr.dynamic.FernFilepath, suffix?: string): string;
128
+ getPackageName(fernFilepath: FernIr.dynamic.FernFilepath, suffix?: string): string;
116
129
  getPackageLayout(): string;
117
130
  shouldInlinePathParameters(): boolean;
118
131
  shouldInlineFileProperties(): boolean;
@@ -1,18 +1,25 @@
1
- "use strict";var te=Object.defineProperty;var Ke=Object.getOwnPropertyDescriptor;var Xe=Object.getOwnPropertyNames;var Ze=Object.prototype.hasOwnProperty;var et=(n,t,e)=>t in n?te(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var he=(n,t)=>()=>(n&&(t=n(n=0)),t);var Re=(n,t)=>{for(var e in t)te(n,e,{get:t[e],enumerable:!0})},tt=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Xe(t))!Ze.call(n,i)&&i!==e&&te(n,i,{get:()=>t[i],enumerable:!(r=Ke(t,i))||r.enumerable});return n};var rt=n=>tt(te({},"__esModule",{value:!0}),n);var h=(n,t,e)=>et(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 nt(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 it(){!z||!U||(z=!1,U.length?C=U.concat(C):re=-1,C.length&&Pe())}function Pe(){if(!z){var n=Be(it);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,nt(n)}}function at(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 ke(n,t)),C.length===1&&!z&&Be(Pe)}function ke(n,t){this.fun=n,this.array=t}function D(){}function It(n){throw new Error("process.binding is not supported")}function Rt(){return"/"}function Tt(n){throw new Error("process.chdir is not supported")}function Nt(){return 0}function Bt(n){var t=Et.call(Q)*.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 kt(){var n=new Date,t=n-Pt;return t/1e3}var _,F,C,z,U,re,st,ot,ut,ct,lt,pt,ht,ft,mt,dt,yt,wt,gt,xt,vt,At,Q,Et,Pt,w,Te,c=he(()=>{"use strict";_=Ne,F=Ee;typeof globalThis.setTimeout=="function"&&(_=setTimeout);typeof globalThis.clearTimeout=="function"&&(F=clearTimeout);C=[],z=!1,re=-1;ke.prototype.run=function(){this.fun.apply(null,this.array)};st="browser",ot="browser",ut=!0,ct={},lt=[],pt="",ht={},ft={},mt={};dt=D,yt=D,wt=D,gt=D,xt=D,vt=D,At=D;Q=globalThis.performance||{},Et=Q.now||Q.mozNow||Q.msNow||Q.oNow||Q.webkitNow||function(){return new Date().getTime()};Pt=new Date;w={nextTick:at,title:st,browser:ut,env:ct,argv:lt,version:pt,versions:ht,on:dt,addListener:yt,once:wt,off:gt,removeListener:xt,removeAllListeners:vt,emit:At,binding:It,cwd:Rt,chdir:Tt,umask:Nt,hrtime:Bt,platform:ot,release:ft,config:mt,uptime:kt},Te={};Object.keys(Te).forEach(n=>{let t=n.split("."),e=w;for(let r=0;r<t.length;r++){let i=t[r];r===t.length-1?e[i]=Te[n]:e=e[i]||(e[i]={})}})});function Ce(){me=!0;for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=n.length;t<e;++t)k[t]=n[t],B[n.charCodeAt(t)]=t;B[45]=62,B[95]=63}function St(n){me||Ce();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 Lt(u*3/4-a),r=a>0?u-4:u;var p=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[p++]=i>>16&255,s[p++]=i>>8&255,s[p++]=i&255;return a===2?(i=B[n.charCodeAt(t)]<<2|B[n.charCodeAt(t+1)]>>4,s[p++]=i&255):a===1&&(i=B[n.charCodeAt(t)]<<10|B[n.charCodeAt(t+1)]<<4|B[n.charCodeAt(t+2)]>>2,s[p++]=i>>8&255,s[p++]=i&255),s}function bt(n){return k[n>>18&63]+k[n>>12&63]+k[n>>6&63]+k[n&63]}function Ct(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(bt(r));return i.join("")}function Le(n){me||Ce();for(var t,e=n.length,r=e%3,i="",a=[],s=16383,u=0,p=e-r;u<p;u+=s)a.push(Ct(n,u,u+s>p?p:u+s));return r===1?(t=n[e-1],i+=k[t>>2],i+=k[t<<4&63],i+="=="):r===2&&(t=(n[e-2]<<8)+n[e-1],i+=k[t>>10],i+=k[t>>4&63],i+=k[t<<2&63],i+="="),a.push(i),a.join("")}function ne(){return o.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function M(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 de(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?Ft(n,t,e,r):typeof t=="string"?_t(n,t,e):Ut(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 Mt(n,t,e,r){return _e(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 de(n,t){if(_e(t),n=M(n,t<0?0:ye(t)|0),!o.TYPED_ARRAY_SUPPORT)for(var e=0;e<t;++e)n[e]=0;return n}function _t(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=M(n,r);var i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function fe(n,t){var e=t.length<0?0:ye(t.length)|0;n=M(n,e);for(var r=0;r<e;r+=1)n[r]=t[r]&255;return n}function Ft(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=fe(n,t),n}function Ut(n,t){if(L(t)){var e=ye(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"||rr(t.length)?M(n,0):fe(n,t);if(t.type==="Buffer"&&Array.isArray(t.data))return fe(n,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function ye(n){if(n>=ne())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ne().toString(16)+" bytes");return n|0}function L(n){return!!(n!=null&&n._isBuffer)}function Fe(n,t){if(L(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 Dt(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 Gt(this,t,e);case"utf8":case"utf-8":return qe(this,t,e);case"ascii":return Vt(this,t,e);case"latin1":case"binary":return Jt(this,t,e);case"base64":return Wt(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Qt(this,t,e);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),r=!0}}function q(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)),L(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 p(A,E){return a===1?A[E]:A.readUInt16BE(E*a)}var y;if(i){var m=-1;for(y=e;y<s;y++)if(p(n,y)===p(t,m===-1?0:y-m)){if(m===-1&&(m=y),y-m+1===u)return m*a}else m!==-1&&(y-=y-m),m=-1}else for(e+u>s&&(e=s-u),y=e;y>=0;y--){for(var f=!0,I=0;I<u;I++)if(p(n,y+I)!==p(t,I)){f=!1;break}if(f)return y}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 jt(n,t,e,r){return oe(ie(t,n.length-e),n,e,r)}function De(n,t,e,r){return oe(er(t),n,e,r)}function Ot(n,t,e,r){return De(n,t,e,r)}function Yt(n,t,e,r){return oe($e(t),n,e,r)}function $t(n,t,e,r){return oe(tr(t,n.length-e),n,e,r)}function Wt(n,t,e){return t===0&&e===n.length?Le(n):Le(n.slice(t,e))}function qe(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 p,y,m,f;switch(u){case 1:a<128&&(s=a);break;case 2:p=n[i+1],(p&192)===128&&(f=(a&31)<<6|p&63,f>127&&(s=f));break;case 3:p=n[i+1],y=n[i+2],(p&192)===128&&(y&192)===128&&(f=(a&15)<<12|(p&63)<<6|y&63,f>2047&&(f<55296||f>57343)&&(s=f));break;case 4:p=n[i+1],y=n[i+2],m=n[i+3],(p&192)===128&&(y&192)===128&&(m&192)===128&&(f=(a&15)<<18|(p&63)<<12|(y&63)<<6|m&63,f>65535&&f<1114112&&(s=f))}}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<=be)return String.fromCharCode.apply(String,n);for(var e="",r=0;r<t;)e+=String.fromCharCode.apply(String,n.slice(r,r+=be));return e}function Vt(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 Gt(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+=Zt(n[a]);return i}function Qt(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 v(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 R(n,t,e,r,i,a){if(!L(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 je(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 Oe(n,t,e,r,i){return i||je(n,t,e,4,34028234663852886e22,-34028234663852886e22),He(n,t,e,r,23,4),e+4}function Ye(n,t,e,r,i){return i||je(n,t,e,8,17976931348623157e292,-17976931348623157e292),He(n,t,e,r,52,8),e+8}function Kt(n){if(n=Xt(n).replace(zt,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}function Xt(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}function Zt(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 er(n){for(var t=[],e=0;e<n.length;++e)t.push(n.charCodeAt(e)&255);return t}function tr(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 St(Kt(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 rr(n){return n!==n}function nr(n){return n!=null&&(!!n._isBuffer||We(n)||ir(n))}function We(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function ir(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,p=(1<<u)-1,y=p>>1,m=-7,f=e?i-1:0,I=e?-1:1,A=n[t+f];for(f+=I,a=A&(1<<-m)-1,A>>=-m,m+=u;m>0;a=a*256+n[t+f],f+=I,m-=8);for(s=a&(1<<-m)-1,a>>=-m,m+=r;m>0;s=s*256+n[t+f],f+=I,m-=8);if(a===0)a=1-y;else{if(a===p)return s?NaN:(A?-1:1)*(1/0);s=s+Math.pow(2,r),a=a-y}return(A?-1:1)*s*Math.pow(2,a-r)}function He(n,t,e,r,i,a){var s,u,p,y=a*8-i-1,m=(1<<y)-1,f=m>>1,I=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=r?0:a-1,E=r?1:-1,ze=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*(p=Math.pow(2,-s))<1&&(s--,p*=2),s+f>=1?t+=I/p:t+=I*Math.pow(2,1-f),t*p>=2&&(s++,p/=2),s+f>=m?(u=0,s=m):s+f>=1?(u=(t*p-1)*Math.pow(2,i),s=s+f):(u=t*Math.pow(2,f-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,y+=i;y>0;n[e+A]=s&255,A+=E,s/=256,y-=8);n[e+A-E]|=ze*128}var k,B,Lt,me,be,zt,Ve=he(()=>{"use strict";c();l();k=[],B=[],Lt=typeof Uint8Array!="undefined"?Uint8Array:Array,me=!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 Mt(null,n,t,e)};o.allocUnsafe=function(n){return de(null,n)};o.allocUnsafeSlow=function(n){return de(null,n)};o.isBuffer=nr;o.compare=function(t,e){if(!L(t)||!L(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(!L(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)q(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)q(this,e,e+3),q(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)q(this,e,e+7),q(this,e+1,e+6),q(this,e+2,e+5),q(this,e+3,e+4);return this};o.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?qe(this,0,t):Dt.apply(this,arguments)};o.prototype.equals=function(t){if(!L(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(!L(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,p=Math.min(s,u),y=this.slice(i,a),m=t.slice(e,r),f=0;f<p;++f)if(y[f]!==m[f]){s=y[f],u=m[f];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 jt(this,t,e,r);case"ascii":return De(this,t,e,r);case"latin1":case"binary":return Ot(this,t,e,r);case"base64":return Yt(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $t(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)}};be=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||v(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||v(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||v(t,1,this.length),this[t]};o.prototype.readUInt16LE=function(t,e){return e||v(t,2,this.length),this[t]|this[t+1]<<8};o.prototype.readUInt16BE=function(t,e){return e||v(t,2,this.length),this[t]<<8|this[t+1]};o.prototype.readUInt32LE=function(t,e){return e||v(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||v(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||v(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||v(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||v(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};o.prototype.readInt16LE=function(t,e){e||v(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||v(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||v(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||v(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||v(t,4,this.length),ue(this,t,!0,23,4)};o.prototype.readFloatBE=function(t,e){return e||v(t,4,this.length),ue(this,t,!1,23,4)};o.prototype.readDoubleLE=function(t,e){return e||v(t,8,this.length),ue(this,t,!0,52,8)};o.prototype.readDoubleBE=function(t,e){return e||v(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;R(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;R(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||R(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||R(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||R(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||R(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||R(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);R(this,t,e,r,a-1,-a)}var s=0,u=1,p=0;for(this[e]=t&255;++s<r&&(u*=256);)t<0&&p===0&&this[e+s-1]!==0&&(p=1),this[e+s]=(t/u>>0)-p&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);R(this,t,e,r,a-1,-a)}var s=r-1,u=1,p=0;for(this[e+s]=t&255;--s>=0&&(u*=256);)t<0&&p===0&&this[e+s+1]!==0&&(p=1),this[e+s]=(t/u>>0)-p&255;return e+r};o.prototype.writeInt8=function(t,e,r){return t=+t,e=e|0,r||R(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||R(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||R(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||R(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||R(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 Oe(this,t,e,!0,r)};o.prototype.writeFloatBE=function(t,e,r){return Oe(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=L(t)?t:ie(new o(t,i).toString()),p=u.length;for(s=0;s<r-e;++s)this[s+e]=u[s%p]}return this};zt=/[^+\/0-9A-Za-z-_]/g});var l=he(()=>{"use strict";Ve()});var br={};Re(br,{EndpointSnippetGenerator:()=>Ie});module.exports=rt(br);c();l();c();l();c();l();function N(n){throw new Error("Unexpected value: "+JSON.stringify(n))}c();l();c();l();var j=class{};c();l();c();l();var S=class extends j{constructor(e){super();h(this,"value");this.value=e}write(e){typeof this.value=="string"?e.write(this.value):this.value(e)}};var ar=4,K=class{constructor(){h(this,"buffer","");h(this,"indentLevel",0);h(this,"hasWrittenAnything",!1);h(this,"lastCharacterIsSemicolon",!1);h(this,"lastCharacterIsNewline",!1)}write(t){let e=t.length>0&&t.endsWith(`
2
- `),r=e?t.substring(0,t.length-1):t,i=this.getIndentString(),a=r.replaceAll(`
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
- ${i}`);this.isAtStartOfLine()&&(a=i+a),e&&(a+=`
5
- `),this.writeInternal(a)}writeNoIndent(t){let e=this.indentLevel;this.indentLevel=0,this.write(t),this.indentLevel=e}writeNode(t){t.write(this)}writeNodeOrString(t){if(typeof t=="string"){this.write(t);return}this.writeNode(t)}writeNodeStatement(t){t.write(this),this.write(";"),this.writeNewLineIfLastLineNot()}writeTextStatement(t){new S(t).write(this),this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(t,e){new S(t).write(this),this.write(" ("),this.writeNode(e),this.write(") {"),this.writeNewLineIfLastLineNot(),this.indent()}endControlFlow(){this.dedent(),this.writeLine("}")}contiguousControlFlow(t,e){this.dedent(),this.write("} "),new S(t).write(this),this.write(" ("),this.writeNode(e),this.write(") {"),this.writeNewLineIfLastLineNot(),this.indent()}alternativeControlFlow(t){this.dedent(),this.write("} "),new S(t).write(this),this.write(" {"),this.writeNewLineIfLastLineNot(),this.indent()}openBlock(t,e="{",r,i="}"){let a=t.filter(s=>s!==void 0).join(" ");a?this.write(`${a} ${e!=null?e:""}`):this.write(e!=null?e:"");try{this.indent(),r(),this.dedent()}finally{this.write(i!=null?i:"")}}writeLine(t=""){this.write(t),this.writeNewLineIfLastLineNot()}newLine(){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 a=1;a<t.length;a++){this.write(e);let s=t[a];s!=null&&r(s)}}}toString(){return this.buffer}writeInternal(t){return t.length>0&&(this.hasWrittenAnything=!0,this.lastCharacterIsNewline=t.endsWith(`
8
- `),this.lastCharacterIsSemicolon=t.endsWith(";")),this.buffer+=t}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*ar)}};c();l();var ce=class{},X=class extends ce{async format(t){return t}formatSync(t){return t}};c();l();function we(n){return(n==null?void 0:n.name)!=null}c();l();c();l();var P={Critical:"CRITICAL",Warning:"WARNING"};c();l();var O;(function(n){n.Concise="concise",n.Full="full"})(O||(O={}));c();l();var b={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};c();l();var d={};Re(d,{Access:()=>ge,AstNode:()=>x,Class:()=>$,ClassInstantiation:()=>W,ClassReference:()=>g,CodeBlock:()=>H,Method:()=>V,MethodInvocation:()=>J,Parameter:()=>G,Type:()=>ee,TypeLiteral:()=>T,Writer:()=>Y,classReference:()=>Tr,class_:()=>Rr,codeblock:()=>Ir,instantiateClass:()=>Nr,invokeMethod:()=>Er,method:()=>Br,parameter:()=>Pr});c();l();c();l();c();l();var ge={Public:"public",Protected:"protected",Private:"private"};c();l();c();l();c();l();var Y=class extends K{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 X}addImport(e){this.imports.add(e)}};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}
9
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}
10
17
  ${t}`)}return t}getContent(){let t=`package ${this.packageName};
11
18
 
12
19
  `,e=this.stringifyImports();return e.length>0?`${t}${e}
13
20
 
14
21
  ${this.buffer}`:t+this.buffer}stringifyImports(){return Array.from(this.imports).filter(t=>t!==this.packageName).map(t=>`import ${t};`).sort().join(`
15
- `)}};var x=class extends j{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()}};c();l();var $=class extends x{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}};c();l();var g=class extends x{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)}};c();l();c();l();c();l();c();l();var ee=class extends x{constructor(e){super();h(this,"internalType");this.internalType=e}write(e){switch(this.internalType.type){case"bigInteger":e.writeNode(sr);break;case"boolean":e.write("Boolean");break;case"bytes":e.write("byte[]");break;case"float":e.write("Float");break;case"date":e.write("String");break;case"dateTime":e.writeNode(cr);break;case"double":e.write("Double");break;case"integer":e.write("Integer");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(pr);break;default:N(this.internalType)}}isOptional(){return this.internalType.type==="optional"}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 set(e){return new this({type:"set",value:e})}static string(){return new this({type:"string"})}static uuid(){return new this({type:"uuid"})}writeList({writer:e,list:r}){e.writeNode(or),e.write("<"),r.value.write(e),e.write(">")}writeMap({writer:e,map:r}){e.writeNode(ur),e.write("<"),r.keyType.write(e),e.write(", "),r.valueType.write(e),e.write(">")}writeOptional({writer:e,optional:r}){e.writeNode(ve),e.write("<"),r.value.write(e),e.write(">")}writeSet({writer:e,set:r}){e.writeNode(lr),e.write("<"),r.value.write(e),e.write(">")}static isAlreadyOptional(e){return e.internalType.type==="optional"}},xe=new g({name:"Arrays",packageName:"java.util"}),sr=new g({name:"BigInteger",packageName:"java.math"}),gi=new g({name:"HashMap",packageName:"java.util"}),or=new g({name:"List",packageName:"java.util"}),ur=new g({name:"Map",packageName:"java.util"}),cr=new g({name:"OffsetDateTime",packageName:"java.time"}),ve=new g({name:"Optional",packageName:"java.util"}),lr=new g({name:"Set",packageName:"java.util"}),pr=new g({name:"UUID",packageName:"java.util"});var T=class n extends x{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":e.write(this.internalType.value.toString());break;case"enum":this.writeEnum({writer:e,enum_:this.internalType});break;case"float":e.write(`${this.internalType.value}f`);break;case"integer":e.write(this.internalType.value.toString());break;case"list":{this.writeList({writer:e,list:this.internalType});break}case"long":{e.write(`${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":{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}){return new this({type:"list",valueType:e,values:r})}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(d.instantiateClass({classReference:hr,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(wr({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=yr({parameters:r.parameters});e.writeNode(d.instantiateClass({classReference:r.reference,arguments_:i.map(a=>a.value)}))}writeDateTime({writer:e,dateTime:r}){e.writeNode(d.invokeMethod({on:mr,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=gr({entries:r.entries});if(i.length===0){e.write("new "),e.writeNode(le),e.write("<"),e.writeNode(r.keyType),e.write(", "),e.writeNode(r.valueType),e.write(">()");return}e.write("new "),e.writeNode(le),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(d.invokeMethod({on:ve,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"?Ae:fr,a=xr({values:r.values});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(d.invokeMethod({on:xe,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(Ae),e.write("<Object>()");return}e.writeLine("new"),e.writeNode(Ae),e.write("<Object>() {"),e.indent(),e.writeNode(d.invokeMethod({on:xe,method:"asList",arguments_:r.map(i=>n.unknown(i))})),e.writeNewLineIfLastLineNot(),e.dedent(),e.write("}")}writeUnknownMap({writer:e,value:r}){let i=Object.entries(r);if(i.length===0){e.write("new "),e.writeNode(le),e.write("<String, Object>()");return}e.writeLine("new "),e.writeNode(le),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(d.invokeMethod({on:dr,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"}},Ae=new g({name:"ArrayList",packageName:"java.util"}),hr=new g({name:"BigInteger",packageName:"java.math"}),le=new g({name:"HashMap",packageName:"java.util"}),fr=new g({name:"HashSet",packageName:"java.util"}),Pi=new g({name:"List",packageName:"java.util"}),ki=new g({name:"Map",packageName:"java.util"}),mr=new g({name:"OffsetDateTime",packageName:"java.time"}),Li=new g({name:"Set",packageName:"java.util"}),dr=new g({name:"UUID",packageName:"java.util"});function yr({parameters:n}){return n.filter(t=>!T.isNop(t.value))}function wr({parameters:n}){return n.filter(t=>!T.isNop(t.value))}function gr({entries:n}){return n.filter(t=>!T.isNop(t.key)&&!T.isNop(t.value))}function xr({values:n}){return n.filter(t=>!T.isNop(t))}function pe({writer:n,arguments_:t}){let e=Ar(t);if(e.length===0){n.write("()");return}if(e.some(i=>i instanceof T&&!i.shouldWriteInLine())){vr({writer:n,arguments_:e});return}n.write("("),e.forEach((i,a)=>{a>0&&n.write(", "),Je({writer:n,argument:i})}),n.write(")")}function vr({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}){we(t)?n.writeNodeOrString(t.assignment):t.write(n)}function Ar(n){return n.filter(t=>!(t instanceof T&&T.isNop(t)))}var W=class extends x{constructor({classReference:e,arguments_:r}){super();h(this,"classReference");h(this,"arguments_");this.classReference=e,this.arguments_=r}write(e){e.writeNode(this.classReference),pe({writer:e,arguments_:this.arguments_})}};c();l();var H=class extends x{constructor(e){super();h(this,"arg");this.arg=e}write(e){return new S(this.arg).write(e)}};c();l();var V=class extends x{constructor({name:e,access:r,parameters:i,body:a,static_:s,return_:u}){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=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("()"):(e.writeLine("("),e.indent(),this.parameters.forEach((r,i)=>{i>0&&e.writeLine(", "),e.writeNode(r)}),e.dedent(),e.write(")")),this.body==null){e.write(";");return}e.writeLine(" {"),e.indent(),e.writeNode(this.body),e.writeNewLineIfLastLineNot(),e.dedent(),e.write("}")}};c();l();var J=class extends x{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),pe({writer:e,arguments_:this.arguments_})}};c();l();var G=class extends x{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 Ir(n){return new H(n)}function Rr(n){return new $(n)}function Tr(n){return new g(n)}function Nr(n){return new W(n)}function Er(n){return new J(n)}function Br(n){return new V(n)}function Pr(n){return new G(n)}var Ge="com.example.usage",kr="Example",Lr="run",Qe="client",Sr={type:"primitive",value:"STRING"},Ie=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 s,u;let i=this.getConfig(r);return await this.buildCodeBlock({endpoint:t,snippet:e,options:r}).toStringAsync({packageName:(s=i.fullStylePackageName)!=null?s:Ge,customConfig:(u=this.context.customConfig)!=null?u:{},formatter:this.formatter})}generateSnippetSync({endpoint:t,request:e,options:r}){var s,u;let i=this.getConfig(r);return this.buildCodeBlock({endpoint:t,snippet:e,options:r}).toString({packageName:(s=i.fullStylePackageName)!=null?s:Ge,customConfig:(u=this.context.customConfig)!=null?u:{},formatter:this.formatter})}buildCodeBlock({endpoint:t,snippet:e,options:r}){let i=d.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 O.Concise:return i;case O.Full:return this.buildFullCodeBlock({body:i,options:r});default:N(a)}}constructClient({endpoint:t,snippet:e}){return d.codeblock(r=>{r.writeNode(this.context.getRootClientClassReference()),r.write(` ${Qe} = `),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:kr,access:d.Access.Public});return i.addMethod(d.method({name:Lr,access:d.Access.Public,static_:!0,parameters:[],body:t})),i}getRootClientBuilderArgs({endpoint:t,snippet:e}){let r=[];t.auth!=null&&(e.auth!=null?r.push(...this.getRootClientAuthArgs({auth:t.auth,values:e.auth})):this.context.errors.add({severity:P.Warning,message:`Auth with ${t.auth.type} configuration is required for this endpoint`}));let i=this.getRootClientBaseUrlArg({baseUrl:e.baseURL,environment:e.environment});return 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(),r}getRootClientBaseUrlArg({baseUrl:t,environment:e}){var r;if(t!=null&&e!=null){this.context.errors.add({severity:P.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:P.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:P.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:Sr,value:i}))}))}:void 0}}getRootClientAuthArgs({auth:t,values:e}){switch(t.type){case"basic":return e.type!=="basic"?(this.context.errors.add({severity:P.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message}),[]):this.getRootClientBasicAuthArgs({auth:t,values:e});case"bearer":return e.type!=="bearer"?(this.context.errors.add({severity:P.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message}),[]):this.getRootClientBearerAuthArgs({auth:t,values:e});case"header":return e.type!=="header"?(this.context.errors.add({severity:P.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message}),[]):this.getRootClientHeaderAuthArgs({auth:t,values:e});case"oauth":return e.type!=="oauth"?(this.context.errors.add({severity:P.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message}),[]):this.getRootClientOAuthArgs({auth:t,values:e});default:N(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 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(!d.TypeLiteral.isNop(r))return r}callMethod({endpoint:t,snippet:e}){return d.invokeMethod({on:d.codeblock(Qe),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 a,s;let r=[];this.context.errors.scope(b.PathParameters);let i=[...(a=this.context.ir.pathParameters)!=null?a:[],...(s=t.pathParameters)!=null?s:[]];return i.length>0&&r.push(...this.getPathParameters({namedParameters:i,snippet:e}).map(u=>u.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(),r}getBodyRequestArg({body:t,value:e}){switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":return t.value.type==="optional"?d.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:P.Critical,message:`Expected bytes value to be a string, got ${typeof t}`}),d.TypeLiteral.nop()):d.TypeLiteral.bytes(t)}getMethodArgsForInlinedRequest({request:t,snippet:e}){let r=[],{inlinePathParameters:i,inlineFileProperties:a}={inlinePathParameters:this.context.shouldInlinePathParameters(),inlineFileProperties:this.context.shouldInlineFileProperties()};this.context.errors.scope(b.PathParameters);let s=[];t.pathParameters!=null&&s.push(...this.getPathParameters({namedParameters:t.pathParameters,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(...s.map(p=>p.value)),a||r.push(...u.fileFields.map(p=>p.value)),r.push(this.getInlinedRequestArg({request:t,snippet:e,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})?s:[],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 m,f,I,A;this.context.errors.scope(b.QueryParameters);let s=this.context.associateQueryParametersByWireValue({parameters:(m=t.queryParameters)!=null?m:[],values:(f=e.queryParameters)!=null?f:{}}).map(E=>({name:this.context.getMethodName(E.name.name),value:this.context.dynamicTypeLiteralMapper.convert(E)}));this.context.errors.unscope(),this.context.errors.scope(b.Headers);let p=this.context.associateByWireValue({parameters:(I=t.headers)!=null?I:[],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(b.RequestBody);let y=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,...p,...s,...y]})}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:O.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});
16
23
  /*! Bundled license information:
17
24
 
18
25
  @esbuild-plugins/node-globals-polyfill/Buffer.js:
@@ -23,3 +30,4 @@ ${this.buffer}`:t+this.buffer}stringifyImports(){return Array.from(this.imports)
23
30
  * @license MIT
24
31
  *)
25
32
  */
33
+ //# sourceMappingURL=EndpointSnippetGenerator.cjs.map