@fern-api/java-dynamic-snippets 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/Config.cjs +11 -0
- package/cjs/Config.d.cts +6 -0
- package/cjs/DynamicSnippetsGenerator.cjs +36 -0
- package/cjs/DynamicSnippetsGenerator.d.cts +19 -0
- package/cjs/DynamicSnippetsGeneratorContext-CjKFdkU7.d.cts +131 -0
- package/cjs/EndpointSnippetGenerator.cjs +25 -0
- package/cjs/EndpointSnippetGenerator.d.cts +54 -0
- package/cjs/context/DynamicSnippetsGeneratorContext.cjs +36 -0
- package/cjs/context/DynamicSnippetsGeneratorContext.d.cts +4 -0
- package/cjs/context/DynamicTypeLiteralMapper.cjs +25 -0
- package/cjs/context/DynamicTypeLiteralMapper.d.cts +4 -0
- package/cjs/context/DynamicTypeMapper.cjs +25 -0
- package/cjs/context/DynamicTypeMapper.d.cts +4 -0
- package/cjs/context/FilePropertyMapper.cjs +25 -0
- package/cjs/context/FilePropertyMapper.d.cts +4 -0
- package/cjs/index.cjs +48 -0
- package/cjs/index.d.cts +7 -0
- package/esm/Config.d.ts +6 -0
- package/esm/Config.js +1 -0
- package/esm/DynamicSnippetsGenerator.d.ts +19 -0
- package/esm/DynamicSnippetsGenerator.js +1 -0
- package/esm/DynamicSnippetsGeneratorContext-CjKFdkU7.d.ts +131 -0
- package/esm/EndpointSnippetGenerator.d.ts +54 -0
- package/esm/EndpointSnippetGenerator.js +1 -0
- package/esm/chunk-2AZXIWKY.js +11 -0
- package/esm/chunk-3DDUCXS2.js +1 -0
- package/esm/chunk-452HWDL4.js +1 -0
- package/esm/chunk-7CY27UU7.js +1 -0
- package/esm/chunk-AASPH6YC.js +15 -0
- package/esm/chunk-FOUIYX4V.js +1 -0
- package/esm/chunk-GHM3YOPV.js +14 -0
- package/esm/chunk-HN67B7VQ.js +1 -0
- package/esm/chunk-JSEUWNSK.js +1 -0
- package/esm/chunk-WFKWXM7L.js +1 -0
- package/esm/context/DynamicSnippetsGeneratorContext.d.ts +4 -0
- package/esm/context/DynamicSnippetsGeneratorContext.js +1 -0
- package/esm/context/DynamicTypeLiteralMapper.d.ts +4 -0
- package/esm/context/DynamicTypeLiteralMapper.js +1 -0
- package/esm/context/DynamicTypeMapper.d.ts +4 -0
- package/esm/context/DynamicTypeMapper.js +1 -0
- package/esm/context/FilePropertyMapper.d.ts +4 -0
- package/esm/context/FilePropertyMapper.js +1 -0
- package/esm/index.d.ts +7 -0
- package/esm/index.js +13 -0
- package/package.json +27 -0
package/cjs/Config.cjs
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";var z=Object.defineProperty;var pr=Object.getOwnPropertyDescriptor;var sr=Object.getOwnPropertyNames;var wr=Object.prototype.hasOwnProperty;var xr=(n,r,i,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of sr(r))!wr.call(n,t)&&t!==i&&z(n,t,{get:()=>r[t],enumerable:!(e=pr(r,t))||e.enumerable});return n};var Er=n=>xr(z({},"__esModule",{value:!0}),n);var gi={};module.exports=Er(gi);function J(){throw new Error("setTimeout has not been defined")}function O(){throw new Error("clearTimeout has not been defined")}var R=J,_=O;typeof globalThis.setTimeout=="function"&&(R=setTimeout);typeof globalThis.clearTimeout=="function"&&(_=clearTimeout);function Q(n){if(R===setTimeout)return setTimeout(n,0);if((R===J||!R)&&setTimeout)return R=setTimeout,setTimeout(n,0);try{return R(n,0)}catch(r){try{return R.call(null,n,0)}catch(i){return R.call(this,n,0)}}}function mr(n){if(_===clearTimeout)return clearTimeout(n);if((_===O||!_)&&clearTimeout)return _=clearTimeout,clearTimeout(n);try{return _(n)}catch(r){try{return _.call(null,n)}catch(i){return _.call(this,n)}}}var y=[],S=!1,I,Y=-1;function Ar(){!S||!I||(S=!1,I.length?y=I.concat(y):Y=-1,y.length&&X())}function X(){if(!S){var n=Q(Ar);S=!0;for(var r=y.length;r;){for(I=y,y=[];++Y<r;)I&&I[Y].run();Y=-1,r=y.length}I=null,S=!1,mr(n)}}function gr(n){var r=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)r[i-1]=arguments[i];y.push(new q(n,r)),y.length===1&&!S&&Q(X)}function q(n,r){this.fun=n,this.array=r}q.prototype.run=function(){this.fun.apply(null,this.array)};var yr="browser",Tr="browser",Rr=!0,_r={},Ir=[],vr="",Ur={},Br={},dr={};function v(){}var Sr=v,Yr=v,Pr=v,Mr=v,Dr=v,Cr=v,kr=v;function Nr(n){throw new Error("process.binding is not supported")}function Lr(){return"/"}function Fr(n){throw new Error("process.chdir is not supported")}function Wr(){return 0}var d=globalThis.performance||{},Hr=d.now||d.mozNow||d.msNow||d.oNow||d.webkitNow||function(){return new Date().getTime()};function Vr(n){var r=Hr.call(d)*.001,i=Math.floor(r),e=Math.floor(r%1*1e9);return n&&(i=i-n[0],e=e-n[1],e<0&&(i--,e+=1e9)),[i,e]}var zr=new Date;function Gr(){var n=new Date,r=n-zr;return r/1e3}var L={nextTick:gr,title:yr,browser:Rr,env:_r,argv:Ir,version:vr,versions:Ur,on:Sr,addListener:Yr,once:Pr,off:Mr,removeListener:Dr,removeAllListeners:Cr,emit:kr,binding:Nr,cwd:Lr,chdir:Fr,umask:Wr,hrtime:Vr,platform:Tr,release:Br,config:dr,uptime:Gr},G={};Object.keys(G).forEach(n=>{let r=n.split("."),i=L;for(let e=0;e<r.length;e++){let t=r[e];e===r.length-1?i[t]=G[n]:i=i[t]||(i[t]={})}});var A=[],E=[],Jr=typeof Uint8Array!="undefined"?Uint8Array:Array,W=!1;function b(){W=!0;for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,i=n.length;r<i;++r)A[r]=n[r],E[n.charCodeAt(r)]=r;E[45]=62,E[95]=63}function Or(n){W||b();var r,i,e,t,f,u,a=n.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");f=n[a-2]==="="?2:n[a-1]==="="?1:0,u=new Jr(a*3/4-f),e=f>0?a-4:a;var h=0;for(r=0,i=0;r<e;r+=4,i+=3)t=E[n.charCodeAt(r)]<<18|E[n.charCodeAt(r+1)]<<12|E[n.charCodeAt(r+2)]<<6|E[n.charCodeAt(r+3)],u[h++]=t>>16&255,u[h++]=t>>8&255,u[h++]=t&255;return f===2?(t=E[n.charCodeAt(r)]<<2|E[n.charCodeAt(r+1)]>>4,u[h++]=t&255):f===1&&(t=E[n.charCodeAt(r)]<<10|E[n.charCodeAt(r+1)]<<4|E[n.charCodeAt(r+2)]>>2,u[h++]=t>>8&255,u[h++]=t&255),u}function Qr(n){return A[n>>18&63]+A[n>>12&63]+A[n>>6&63]+A[n&63]}function Xr(n,r,i){for(var e,t=[],f=r;f<i;f+=3)e=(n[f]<<16)+(n[f+1]<<8)+n[f+2],t.push(Qr(e));return t.join("")}function Z(n){W||b();for(var r,i=n.length,e=i%3,t="",f=[],u=16383,a=0,h=i-e;a<h;a+=u)f.push(Xr(n,a,a+u>h?h:a+u));return e===1?(r=n[i-1],t+=A[r>>2],t+=A[r<<4&63],t+="=="):e===2&&(r=(n[i-2]<<8)+n[i-1],t+=A[r>>10],t+=A[r>>4&63],t+=A[r<<2&63],t+="="),f.push(t),f.join("")}o.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;function P(){return o.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function T(n,r){if(P()<r)throw new RangeError("Invalid typed array length");return o.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(r),n.__proto__=o.prototype):(n===null&&(n=new o(r)),n.length=r),n}function o(n,r,i){if(!o.TYPED_ARRAY_SUPPORT&&!(this instanceof o))return new o(n,r,i);if(typeof n=="number"){if(typeof r=="string")throw new Error("If encoding is specified then the first argument must be a string");return H(this,n)}return j(this,n,r,i)}o.poolSize=8192;o._augment=function(n){return n.__proto__=o.prototype,n};function j(n,r,i,e){if(typeof r=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer!="undefined"&&r instanceof ArrayBuffer?Kr(n,r,i,e):typeof r=="string"?Zr(n,r,i):$r(n,r)}o.from=function(n,r,i){return j(null,n,r,i)};o.kMaxLength=P();o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&o[Symbol.species]);function rr(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 qr(n,r,i,e){return rr(r),r<=0?T(n,r):i!==void 0?typeof e=="string"?T(n,r).fill(i,e):T(n,r).fill(i):T(n,r)}o.alloc=function(n,r,i){return qr(null,n,r,i)};function H(n,r){if(rr(r),n=T(n,r<0?0:V(r)|0),!o.TYPED_ARRAY_SUPPORT)for(var i=0;i<r;++i)n[i]=0;return n}o.allocUnsafe=function(n){return H(null,n)};o.allocUnsafeSlow=function(n){return H(null,n)};function Zr(n,r,i){if((typeof i!="string"||i==="")&&(i="utf8"),!o.isEncoding(i))throw new TypeError('"encoding" must be a valid string encoding');var e=ir(r,i)|0;n=T(n,e);var t=n.write(r,i);return t!==e&&(n=n.slice(0,t)),n}function F(n,r){var i=r.length<0?0:V(r.length)|0;n=T(n,i);for(var e=0;e<i;e+=1)n[e]=r[e]&255;return n}function Kr(n,r,i,e){if(r.byteLength,i<0||r.byteLength<i)throw new RangeError("'offset' is out of bounds");if(r.byteLength<i+(e||0))throw new RangeError("'length' is out of bounds");return i===void 0&&e===void 0?r=new Uint8Array(r):e===void 0?r=new Uint8Array(r,i):r=new Uint8Array(r,i,e),o.TYPED_ARRAY_SUPPORT?(n=r,n.__proto__=o.prototype):n=F(n,r),n}function $r(n,r){if(g(r)){var i=V(r.length)|0;return n=T(n,i),n.length===0||r.copy(n,0,0,i),n}if(r){if(typeof ArrayBuffer!="undefined"&&r.buffer instanceof ArrayBuffer||"length"in r)return typeof r.length!="number"||Ei(r.length)?T(n,0):F(n,r);if(r.type==="Buffer"&&Array.isArray(r.data))return F(n,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function V(n){if(n>=P())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+P().toString(16)+" bytes");return n|0}o.isBuffer=mi;function g(n){return!!(n!=null&&n._isBuffer)}o.compare=function(r,i){if(!g(r)||!g(i))throw new TypeError("Arguments must be Buffers");if(r===i)return 0;for(var e=r.length,t=i.length,f=0,u=Math.min(e,t);f<u;++f)if(r[f]!==i[f]){e=r[f],t=i[f];break}return e<t?-1:t<e?1:0};o.isEncoding=function(r){switch(String(r).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};o.concat=function(r,i){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return o.alloc(0);var e;if(i===void 0)for(i=0,e=0;e<r.length;++e)i+=r[e].length;var t=o.allocUnsafe(i),f=0;for(e=0;e<r.length;++e){var u=r[e];if(!g(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(t,f),f+=u.length}return t};function ir(n,r){if(g(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 i=n.length;if(i===0)return 0;for(var e=!1;;)switch(r){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":case void 0:return M(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return i*2;case"hex":return i>>>1;case"base64":return ar(n).length;default:if(e)return M(n).length;r=(""+r).toLowerCase(),e=!0}}o.byteLength=ir;function br(n,r,i){var e=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((i===void 0||i>this.length)&&(i=this.length),i<=0)||(i>>>=0,r>>>=0,i<=r))return"";for(n||(n="utf8");;)switch(n){case"hex":return ai(this,r,i);case"utf8":case"utf-8":return tr(this,r,i);case"ascii":return ui(this,r,i);case"latin1":case"binary":return oi(this,r,i);case"base64":return ti(this,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return hi(this,r,i);default:if(e)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),e=!0}}o.prototype._isBuffer=!0;function U(n,r,i){var e=n[r];n[r]=n[i],n[i]=e}o.prototype.swap16=function(){var r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var i=0;i<r;i+=2)U(this,i,i+1);return this};o.prototype.swap32=function(){var r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var i=0;i<r;i+=4)U(this,i,i+3),U(this,i+1,i+2);return this};o.prototype.swap64=function(){var r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var i=0;i<r;i+=8)U(this,i,i+7),U(this,i+1,i+6),U(this,i+2,i+5),U(this,i+3,i+4);return this};o.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?tr(this,0,r):br.apply(this,arguments)};o.prototype.equals=function(r){if(!g(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:o.compare(this,r)===0};o.prototype.compare=function(r,i,e,t,f){if(!g(r))throw new TypeError("Argument must be a Buffer");if(i===void 0&&(i=0),e===void 0&&(e=r?r.length:0),t===void 0&&(t=0),f===void 0&&(f=this.length),i<0||e>r.length||t<0||f>this.length)throw new RangeError("out of range index");if(t>=f&&i>=e)return 0;if(t>=f)return-1;if(i>=e)return 1;if(i>>>=0,e>>>=0,t>>>=0,f>>>=0,this===r)return 0;for(var u=f-t,a=e-i,h=Math.min(u,a),l=this.slice(t,f),p=r.slice(i,e),c=0;c<h;++c)if(l[c]!==p[c]){u=l[c],a=p[c];break}return u<a?-1:a<u?1:0};function nr(n,r,i,e,t){if(n.length===0)return-1;if(typeof i=="string"?(e=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,isNaN(i)&&(i=t?0:n.length-1),i<0&&(i=n.length+i),i>=n.length){if(t)return-1;i=n.length-1}else if(i<0)if(t)i=0;else return-1;if(typeof r=="string"&&(r=o.from(r,e)),g(r))return r.length===0?-1:K(n,r,i,e,t);if(typeof r=="number")return r=r&255,o.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?t?Uint8Array.prototype.indexOf.call(n,r,i):Uint8Array.prototype.lastIndexOf.call(n,r,i):K(n,[r],i,e,t);throw new TypeError("val must be string, number or Buffer")}function K(n,r,i,e,t){var f=1,u=n.length,a=r.length;if(e!==void 0&&(e=String(e).toLowerCase(),e==="ucs2"||e==="ucs-2"||e==="utf16le"||e==="utf-16le")){if(n.length<2||r.length<2)return-1;f=2,u/=2,a/=2,i/=2}function h(x,B){return f===1?x[B]:x.readUInt16BE(B*f)}var l;if(t){var p=-1;for(l=i;l<u;l++)if(h(n,l)===h(r,p===-1?0:l-p)){if(p===-1&&(p=l),l-p+1===a)return p*f}else p!==-1&&(l-=l-p),p=-1}else for(i+a>u&&(i=u-a),l=i;l>=0;l--){for(var c=!0,m=0;m<a;m++)if(h(n,l+m)!==h(r,m)){c=!1;break}if(c)return l}return-1}o.prototype.includes=function(r,i,e){return this.indexOf(r,i,e)!==-1};o.prototype.indexOf=function(r,i,e){return nr(this,r,i,e,!0)};o.prototype.lastIndexOf=function(r,i,e){return nr(this,r,i,e,!1)};function jr(n,r,i,e){i=Number(i)||0;var t=n.length-i;e?(e=Number(e),e>t&&(e=t)):e=t;var f=r.length;if(f%2!==0)throw new TypeError("Invalid hex string");e>f/2&&(e=f/2);for(var u=0;u<e;++u){var a=parseInt(r.substr(u*2,2),16);if(isNaN(a))return u;n[i+u]=a}return u}function ri(n,r,i,e){return k(M(r,n.length-i),n,i,e)}function er(n,r,i,e){return k(wi(r),n,i,e)}function ii(n,r,i,e){return er(n,r,i,e)}function ni(n,r,i,e){return k(ar(r),n,i,e)}function ei(n,r,i,e){return k(xi(r,n.length-i),n,i,e)}o.prototype.write=function(r,i,e,t){if(i===void 0)t="utf8",e=this.length,i=0;else if(e===void 0&&typeof i=="string")t=i,e=this.length,i=0;else if(isFinite(i))i=i|0,isFinite(e)?(e=e|0,t===void 0&&(t="utf8")):(t=e,e=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var f=this.length-i;if((e===void 0||e>f)&&(e=f),r.length>0&&(e<0||i<0)||i>this.length)throw new RangeError("Attempt to write outside buffer bounds");t||(t="utf8");for(var u=!1;;)switch(t){case"hex":return jr(this,r,i,e);case"utf8":case"utf-8":return ri(this,r,i,e);case"ascii":return er(this,r,i,e);case"latin1":case"binary":return ii(this,r,i,e);case"base64":return ni(this,r,i,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ei(this,r,i,e);default:if(u)throw new TypeError("Unknown encoding: "+t);t=(""+t).toLowerCase(),u=!0}};o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ti(n,r,i){return r===0&&i===n.length?Z(n):Z(n.slice(r,i))}function tr(n,r,i){i=Math.min(n.length,i);for(var e=[],t=r;t<i;){var f=n[t],u=null,a=f>239?4:f>223?3:f>191?2:1;if(t+a<=i){var h,l,p,c;switch(a){case 1:f<128&&(u=f);break;case 2:h=n[t+1],(h&192)===128&&(c=(f&31)<<6|h&63,c>127&&(u=c));break;case 3:h=n[t+1],l=n[t+2],(h&192)===128&&(l&192)===128&&(c=(f&15)<<12|(h&63)<<6|l&63,c>2047&&(c<55296||c>57343)&&(u=c));break;case 4:h=n[t+1],l=n[t+2],p=n[t+3],(h&192)===128&&(l&192)===128&&(p&192)===128&&(c=(f&15)<<18|(h&63)<<12|(l&63)<<6|p&63,c>65535&&c<1114112&&(u=c))}}u===null?(u=65533,a=1):u>65535&&(u-=65536,e.push(u>>>10&1023|55296),u=56320|u&1023),e.push(u),t+=a}return fi(e)}var $=4096;function fi(n){var r=n.length;if(r<=$)return String.fromCharCode.apply(String,n);for(var i="",e=0;e<r;)i+=String.fromCharCode.apply(String,n.slice(e,e+=$));return i}function ui(n,r,i){var e="";i=Math.min(n.length,i);for(var t=r;t<i;++t)e+=String.fromCharCode(n[t]&127);return e}function oi(n,r,i){var e="";i=Math.min(n.length,i);for(var t=r;t<i;++t)e+=String.fromCharCode(n[t]);return e}function ai(n,r,i){var e=n.length;(!r||r<0)&&(r=0),(!i||i<0||i>e)&&(i=e);for(var t="",f=r;f<i;++f)t+=si(n[f]);return t}function hi(n,r,i){for(var e=n.slice(r,i),t="",f=0;f<e.length;f+=2)t+=String.fromCharCode(e[f]+e[f+1]*256);return t}o.prototype.slice=function(r,i){var e=this.length;r=~~r,i=i===void 0?e:~~i,r<0?(r+=e,r<0&&(r=0)):r>e&&(r=e),i<0?(i+=e,i<0&&(i=0)):i>e&&(i=e),i<r&&(i=r);var t;if(o.TYPED_ARRAY_SUPPORT)t=this.subarray(r,i),t.__proto__=o.prototype;else{var f=i-r;t=new o(f,void 0);for(var u=0;u<f;++u)t[u]=this[u+r]}return t};function s(n,r,i){if(n%1!==0||n<0)throw new RangeError("offset is not uint");if(n+r>i)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUIntLE=function(r,i,e){r=r|0,i=i|0,e||s(r,i,this.length);for(var t=this[r],f=1,u=0;++u<i&&(f*=256);)t+=this[r+u]*f;return t};o.prototype.readUIntBE=function(r,i,e){r=r|0,i=i|0,e||s(r,i,this.length);for(var t=this[r+--i],f=1;i>0&&(f*=256);)t+=this[r+--i]*f;return t};o.prototype.readUInt8=function(r,i){return i||s(r,1,this.length),this[r]};o.prototype.readUInt16LE=function(r,i){return i||s(r,2,this.length),this[r]|this[r+1]<<8};o.prototype.readUInt16BE=function(r,i){return i||s(r,2,this.length),this[r]<<8|this[r+1]};o.prototype.readUInt32LE=function(r,i){return i||s(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};o.prototype.readUInt32BE=function(r,i){return i||s(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};o.prototype.readIntLE=function(r,i,e){r=r|0,i=i|0,e||s(r,i,this.length);for(var t=this[r],f=1,u=0;++u<i&&(f*=256);)t+=this[r+u]*f;return f*=128,t>=f&&(t-=Math.pow(2,8*i)),t};o.prototype.readIntBE=function(r,i,e){r=r|0,i=i|0,e||s(r,i,this.length);for(var t=i,f=1,u=this[r+--t];t>0&&(f*=256);)u+=this[r+--t]*f;return f*=128,u>=f&&(u-=Math.pow(2,8*i)),u};o.prototype.readInt8=function(r,i){return i||s(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};o.prototype.readInt16LE=function(r,i){i||s(r,2,this.length);var e=this[r]|this[r+1]<<8;return e&32768?e|4294901760:e};o.prototype.readInt16BE=function(r,i){i||s(r,2,this.length);var e=this[r+1]|this[r]<<8;return e&32768?e|4294901760:e};o.prototype.readInt32LE=function(r,i){return i||s(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};o.prototype.readInt32BE=function(r,i){return i||s(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};o.prototype.readFloatLE=function(r,i){return i||s(r,4,this.length),N(this,r,!0,23,4)};o.prototype.readFloatBE=function(r,i){return i||s(r,4,this.length),N(this,r,!1,23,4)};o.prototype.readDoubleLE=function(r,i){return i||s(r,8,this.length),N(this,r,!0,52,8)};o.prototype.readDoubleBE=function(r,i){return i||s(r,8,this.length),N(this,r,!1,52,8)};function w(n,r,i,e,t,f){if(!g(n))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>t||r<f)throw new RangeError('"value" argument is out of bounds');if(i+e>n.length)throw new RangeError("Index out of range")}o.prototype.writeUIntLE=function(r,i,e,t){if(r=+r,i=i|0,e=e|0,!t){var f=Math.pow(2,8*e)-1;w(this,r,i,e,f,0)}var u=1,a=0;for(this[i]=r&255;++a<e&&(u*=256);)this[i+a]=r/u&255;return i+e};o.prototype.writeUIntBE=function(r,i,e,t){if(r=+r,i=i|0,e=e|0,!t){var f=Math.pow(2,8*e)-1;w(this,r,i,e,f,0)}var u=e-1,a=1;for(this[i+u]=r&255;--u>=0&&(a*=256);)this[i+u]=r/a&255;return i+e};o.prototype.writeUInt8=function(r,i,e){return r=+r,i=i|0,e||w(this,r,i,1,255,0),o.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[i]=r&255,i+1};function D(n,r,i,e){r<0&&(r=65535+r+1);for(var t=0,f=Math.min(n.length-i,2);t<f;++t)n[i+t]=(r&255<<8*(e?t:1-t))>>>(e?t:1-t)*8}o.prototype.writeUInt16LE=function(r,i,e){return r=+r,i=i|0,e||w(this,r,i,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[i]=r&255,this[i+1]=r>>>8):D(this,r,i,!0),i+2};o.prototype.writeUInt16BE=function(r,i,e){return r=+r,i=i|0,e||w(this,r,i,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[i]=r>>>8,this[i+1]=r&255):D(this,r,i,!1),i+2};function C(n,r,i,e){r<0&&(r=4294967295+r+1);for(var t=0,f=Math.min(n.length-i,4);t<f;++t)n[i+t]=r>>>(e?t:3-t)*8&255}o.prototype.writeUInt32LE=function(r,i,e){return r=+r,i=i|0,e||w(this,r,i,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[i+3]=r>>>24,this[i+2]=r>>>16,this[i+1]=r>>>8,this[i]=r&255):C(this,r,i,!0),i+4};o.prototype.writeUInt32BE=function(r,i,e){return r=+r,i=i|0,e||w(this,r,i,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[i]=r>>>24,this[i+1]=r>>>16,this[i+2]=r>>>8,this[i+3]=r&255):C(this,r,i,!1),i+4};o.prototype.writeIntLE=function(r,i,e,t){if(r=+r,i=i|0,!t){var f=Math.pow(2,8*e-1);w(this,r,i,e,f-1,-f)}var u=0,a=1,h=0;for(this[i]=r&255;++u<e&&(a*=256);)r<0&&h===0&&this[i+u-1]!==0&&(h=1),this[i+u]=(r/a>>0)-h&255;return i+e};o.prototype.writeIntBE=function(r,i,e,t){if(r=+r,i=i|0,!t){var f=Math.pow(2,8*e-1);w(this,r,i,e,f-1,-f)}var u=e-1,a=1,h=0;for(this[i+u]=r&255;--u>=0&&(a*=256);)r<0&&h===0&&this[i+u+1]!==0&&(h=1),this[i+u]=(r/a>>0)-h&255;return i+e};o.prototype.writeInt8=function(r,i,e){return r=+r,i=i|0,e||w(this,r,i,1,127,-128),o.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),r<0&&(r=255+r+1),this[i]=r&255,i+1};o.prototype.writeInt16LE=function(r,i,e){return r=+r,i=i|0,e||w(this,r,i,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[i]=r&255,this[i+1]=r>>>8):D(this,r,i,!0),i+2};o.prototype.writeInt16BE=function(r,i,e){return r=+r,i=i|0,e||w(this,r,i,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[i]=r>>>8,this[i+1]=r&255):D(this,r,i,!1),i+2};o.prototype.writeInt32LE=function(r,i,e){return r=+r,i=i|0,e||w(this,r,i,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[i]=r&255,this[i+1]=r>>>8,this[i+2]=r>>>16,this[i+3]=r>>>24):C(this,r,i,!0),i+4};o.prototype.writeInt32BE=function(r,i,e){return r=+r,i=i|0,e||w(this,r,i,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),o.TYPED_ARRAY_SUPPORT?(this[i]=r>>>24,this[i+1]=r>>>16,this[i+2]=r>>>8,this[i+3]=r&255):C(this,r,i,!1),i+4};function fr(n,r,i,e,t,f){if(i+e>n.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function ur(n,r,i,e,t){return t||fr(n,r,i,4,34028234663852886e22,-34028234663852886e22),cr(n,r,i,e,23,4),i+4}o.prototype.writeFloatLE=function(r,i,e){return ur(this,r,i,!0,e)};o.prototype.writeFloatBE=function(r,i,e){return ur(this,r,i,!1,e)};function or(n,r,i,e,t){return t||fr(n,r,i,8,17976931348623157e292,-17976931348623157e292),cr(n,r,i,e,52,8),i+8}o.prototype.writeDoubleLE=function(r,i,e){return or(this,r,i,!0,e)};o.prototype.writeDoubleBE=function(r,i,e){return or(this,r,i,!1,e)};o.prototype.copy=function(r,i,e,t){if(e||(e=0),!t&&t!==0&&(t=this.length),i>=r.length&&(i=r.length),i||(i=0),t>0&&t<e&&(t=e),t===e||r.length===0||this.length===0)return 0;if(i<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=this.length)throw new RangeError("sourceStart out of bounds");if(t<0)throw new RangeError("sourceEnd out of bounds");t>this.length&&(t=this.length),r.length-i<t-e&&(t=r.length-i+e);var f=t-e,u;if(this===r&&e<i&&i<t)for(u=f-1;u>=0;--u)r[u+i]=this[u+e];else if(f<1e3||!o.TYPED_ARRAY_SUPPORT)for(u=0;u<f;++u)r[u+i]=this[u+e];else Uint8Array.prototype.set.call(r,this.subarray(e,e+f),i);return f};o.prototype.fill=function(r,i,e,t){if(typeof r=="string"){if(typeof i=="string"?(t=i,i=0,e=this.length):typeof e=="string"&&(t=e,e=this.length),r.length===1){var f=r.charCodeAt(0);f<256&&(r=f)}if(t!==void 0&&typeof t!="string")throw new TypeError("encoding must be a string");if(typeof t=="string"&&!o.isEncoding(t))throw new TypeError("Unknown encoding: "+t)}else typeof r=="number"&&(r=r&255);if(i<0||this.length<i||this.length<e)throw new RangeError("Out of range index");if(e<=i)return this;i=i>>>0,e=e===void 0?this.length:e>>>0,r||(r=0);var u;if(typeof r=="number")for(u=i;u<e;++u)this[u]=r;else{var a=g(r)?r:M(new o(r,t).toString()),h=a.length;for(u=0;u<e-i;++u)this[u+i]=a[u%h]}return this};var ci=/[^+\/0-9A-Za-z-_]/g;function li(n){if(n=pi(n).replace(ci,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}function pi(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}function si(n){return n<16?"0"+n.toString(16):n.toString(16)}function M(n,r){r=r||1/0;for(var i,e=n.length,t=null,f=[],u=0;u<e;++u){if(i=n.charCodeAt(u),i>55295&&i<57344){if(!t){if(i>56319){(r-=3)>-1&&f.push(239,191,189);continue}else if(u+1===e){(r-=3)>-1&&f.push(239,191,189);continue}t=i;continue}if(i<56320){(r-=3)>-1&&f.push(239,191,189),t=i;continue}i=(t-55296<<10|i-56320)+65536}else t&&(r-=3)>-1&&f.push(239,191,189);if(t=null,i<128){if((r-=1)<0)break;f.push(i)}else if(i<2048){if((r-=2)<0)break;f.push(i>>6|192,i&63|128)}else if(i<65536){if((r-=3)<0)break;f.push(i>>12|224,i>>6&63|128,i&63|128)}else if(i<1114112){if((r-=4)<0)break;f.push(i>>18|240,i>>12&63|128,i>>6&63|128,i&63|128)}else throw new Error("Invalid code point")}return f}function wi(n){for(var r=[],i=0;i<n.length;++i)r.push(n.charCodeAt(i)&255);return r}function xi(n,r){for(var i,e,t,f=[],u=0;u<n.length&&!((r-=2)<0);++u)i=n.charCodeAt(u),e=i>>8,t=i%256,f.push(t),f.push(e);return f}function ar(n){return Or(li(n))}function k(n,r,i,e){for(var t=0;t<e&&!(t+i>=r.length||t>=n.length);++t)r[t+i]=n[t];return t}function Ei(n){return n!==n}function mi(n){return n!=null&&(!!n._isBuffer||hr(n)||Ai(n))}function hr(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function Ai(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&hr(n.slice(0,0))}function N(n,r,i,e,t){var f,u,a=t*8-e-1,h=(1<<a)-1,l=h>>1,p=-7,c=i?t-1:0,m=i?-1:1,x=n[r+c];for(c+=m,f=x&(1<<-p)-1,x>>=-p,p+=a;p>0;f=f*256+n[r+c],c+=m,p-=8);for(u=f&(1<<-p)-1,f>>=-p,p+=e;p>0;u=u*256+n[r+c],c+=m,p-=8);if(f===0)f=1-l;else{if(f===h)return u?NaN:(x?-1:1)*(1/0);u=u+Math.pow(2,e),f=f-l}return(x?-1:1)*u*Math.pow(2,f-e)}function cr(n,r,i,e,t,f){var u,a,h,l=f*8-t-1,p=(1<<l)-1,c=p>>1,m=t===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=e?0:f-1,B=e?1:-1,lr=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(a=isNaN(r)?1:0,u=p):(u=Math.floor(Math.log(r)/Math.LN2),r*(h=Math.pow(2,-u))<1&&(u--,h*=2),u+c>=1?r+=m/h:r+=m*Math.pow(2,1-c),r*h>=2&&(u++,h/=2),u+c>=p?(a=0,u=p):u+c>=1?(a=(r*h-1)*Math.pow(2,t),u=u+c):(a=r*Math.pow(2,c-1)*Math.pow(2,t),u=0));t>=8;n[i+x]=a&255,x+=B,a/=256,t-=8);for(u=u<<t|a,l+=t;l>0;n[i+x]=u&255,x+=B,u/=256,l-=8);n[i+x-B]|=lr*128}
|
|
2
|
+
/*! Bundled license information:
|
|
3
|
+
|
|
4
|
+
@esbuild-plugins/node-globals-polyfill/Buffer.js:
|
|
5
|
+
(*!
|
|
6
|
+
* The buffer module from node.js, for the browser.
|
|
7
|
+
*
|
|
8
|
+
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|
9
|
+
* @license MIT
|
|
10
|
+
*)
|
|
11
|
+
*/
|
package/cjs/Config.d.cts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";var ce=Object.defineProperty,Ar=Object.defineProperties,Ir=Object.getOwnPropertyDescriptor,Er=Object.getOwnPropertyDescriptors,Cr=Object.getOwnPropertyNames,fe=Object.getOwnPropertySymbols;var Le=Object.prototype.hasOwnProperty,Ge=Object.prototype.propertyIsEnumerable;var ke=(n,t,e)=>t in n?ce(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Ye=(n,t)=>{for(var e in t||(t={}))Le.call(t,e)&&ke(n,e,t[e]);if(fe)for(var e of fe(t))Ge.call(t,e)&&ke(n,e,t[e]);return n},ze=(n,t)=>Ar(n,Er(t));var He=n=>typeof n=="symbol"?n:n+"",Je=(n,t)=>{var e={};for(var r in n)Le.call(n,r)&&t.indexOf(r)<0&&(e[r]=n[r]);if(n!=null&&fe)for(var r of fe(n))t.indexOf(r)<0&&Ge.call(n,r)&&(e[r]=n[r]);return e};var Se=(n,t)=>()=>(n&&(t=n(n=0)),t);var Ze=(n,t)=>{for(var e in t)ce(n,e,{get:t[e],enumerable:!0})},kr=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Cr(t))!Le.call(n,a)&&a!==e&&ce(n,a,{get:()=>t[a],enumerable:!(r=Ir(t,a))||r.enumerable});return n};var Lr=n=>kr(ce({},"__esModule",{value:!0}),n);var c=(n,t,e)=>ke(n,typeof t!="symbol"?t+"":t,e);function Xe(){throw new Error("setTimeout has not been defined")}function Qe(){throw new Error("clearTimeout has not been defined")}function et(n){if(M===setTimeout)return setTimeout(n,0);if((M===Xe||!M)&&setTimeout)return M=setTimeout,setTimeout(n,0);try{return M(n,0)}catch(t){try{return M.call(null,n,0)}catch(e){return M.call(this,n,0)}}}function Sr(n){if(O===clearTimeout)return clearTimeout(n);if((O===Qe||!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 Pr(){!X||!_||(X=!1,_.length?F=_.concat(F):de=-1,F.length&&tt())}function tt(){if(!X){var n=et(Pr);X=!0;for(var t=F.length;t;){for(_=F,F=[];++de<t;)_&&_[de].run();de=-1,t=F.length}_=null,X=!1,Sr(n)}}function Fr(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 rt(n,t)),F.length===1&&!X&&et(tt)}function rt(n,t){this.fun=n,this.array=t}function D(){}function Zr(n){throw new Error("process.binding is not supported")}function Kr(){return"/"}function Xr(n){throw new Error("process.chdir is not supported")}function Qr(){return 0}function tn(n){var t=en.call(K)*.001,e=Math.floor(t),r=Math.floor(t%1*1e9);return n&&(e=e-n[0],r=r-n[1],r<0&&(e--,r+=1e9)),[e,r]}function nn(){var n=new Date,t=n-rn;return t/1e3}var M,O,F,X,_,de,Ur,Br,Mr,Or,jr,_r,Dr,Vr,Wr,$r,qr,Gr,Yr,zr,Hr,Jr,K,en,rn,d,Ke,u=Se(()=>{"use strict";M=Xe,O=Qe;typeof globalThis.setTimeout=="function"&&(M=setTimeout);typeof globalThis.clearTimeout=="function"&&(O=clearTimeout);F=[],X=!1,de=-1;rt.prototype.run=function(){this.fun.apply(null,this.array)};Ur="browser",Br="browser",Mr=!0,Or={},jr=[],_r="",Dr={},Vr={},Wr={};$r=D,qr=D,Gr=D,Yr=D,zr=D,Hr=D,Jr=D;K=globalThis.performance||{},en=K.now||K.mozNow||K.msNow||K.oNow||K.webkitNow||function(){return new Date().getTime()};rn=new Date;d={nextTick:Fr,title:Ur,browser:Mr,env:Or,argv:jr,version:_r,versions:Dr,on:$r,addListener:qr,once:Gr,off:Yr,removeListener:zr,removeAllListeners:Hr,emit:Jr,binding:Zr,cwd:Kr,chdir:Xr,umask:Qr,hrtime:tn,platform:Br,release:Vr,config:Wr,uptime:nn},Ke={};Object.keys(Ke).forEach(n=>{let t=n.split("."),e=d;for(let r=0;r<t.length;r++){let a=t[r];r===t.length-1?e[a]=Ke[n]:e=e[a]||(e[a]={})}})});function ot(){Fe=!0;for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=n.length;t<e;++t)k[t]=n[t],C[n.charCodeAt(t)]=t;C[45]=62,C[95]=63}function on(n){Fe||ot();var t,e,r,a,i,o,f=n.length;if(f%4>0)throw new Error("Invalid string. Length must be a multiple of 4");i=n[f-2]==="="?2:n[f-1]==="="?1:0,o=new an(f*3/4-i),r=i>0?f-4:f;var m=0;for(t=0,e=0;t<r;t+=4,e+=3)a=C[n.charCodeAt(t)]<<18|C[n.charCodeAt(t+1)]<<12|C[n.charCodeAt(t+2)]<<6|C[n.charCodeAt(t+3)],o[m++]=a>>16&255,o[m++]=a>>8&255,o[m++]=a&255;return i===2?(a=C[n.charCodeAt(t)]<<2|C[n.charCodeAt(t+1)]>>4,o[m++]=a&255):i===1&&(a=C[n.charCodeAt(t)]<<10|C[n.charCodeAt(t+1)]<<4|C[n.charCodeAt(t+2)]>>2,o[m++]=a>>8&255,o[m++]=a&255),o}function sn(n){return k[n>>18&63]+k[n>>12&63]+k[n>>6&63]+k[n&63]}function un(n,t,e){for(var r,a=[],i=t;i<e;i+=3)r=(n[i]<<16)+(n[i+1]<<8)+n[i+2],a.push(sn(r));return a.join("")}function nt(n){Fe||ot();for(var t,e=n.length,r=e%3,a="",i=[],o=16383,f=0,m=e-r;f<m;f+=o)i.push(un(n,f,f+o>m?m:f+o));return r===1?(t=n[e-1],a+=k[t>>2],a+=k[t<<4&63],a+="=="):r===2&&(t=(n[e-2]<<8)+n[e-1],a+=k[t>>10],a+=k[t>>4&63],a+=k[t<<2&63],a+="="),i.push(a),i.join("")}function me(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function U(n,t){if(me()<t)throw new RangeError("Invalid typed array length");return s.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(t),n.__proto__=s.prototype):(n===null&&(n=new s(t)),n.length=t),n}function s(n,t,e){if(!s.TYPED_ARRAY_SUPPORT&&!(this instanceof s))return new s(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 Ue(this,n)}return st(this,n,t,e)}function st(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?fn(n,t,e,r):typeof t=="string"?pn(n,t,e):cn(n,t)}function ut(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 ln(n,t,e,r){return ut(t),t<=0?U(n,t):e!==void 0?typeof r=="string"?U(n,t).fill(e,r):U(n,t).fill(e):U(n,t)}function Ue(n,t){if(ut(t),n=U(n,t<0?0:Be(t)|0),!s.TYPED_ARRAY_SUPPORT)for(var e=0;e<t;++e)n[e]=0;return n}function pn(n,t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!s.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=lt(t,e)|0;n=U(n,r);var a=n.write(t,e);return a!==r&&(n=n.slice(0,a)),n}function Pe(n,t){var e=t.length<0?0:Be(t.length)|0;n=U(n,e);for(var r=0;r<e;r+=1)n[r]=t[r]&255;return n}function fn(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),s.TYPED_ARRAY_SUPPORT?(n=t,n.__proto__=s.prototype):n=Pe(n,t),n}function cn(n,t){if(L(t)){var e=Be(t.length)|0;return n=U(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"||Sn(t.length)?U(n,0):Pe(n,t);if(t.type==="Buffer"&&Array.isArray(t.data))return Pe(n,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function Be(n){if(n>=me())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+me().toString(16)+" bytes");return n|0}function L(n){return!!(n!=null&&n._isBuffer)}function lt(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 he(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return yt(n).length;default:if(r)return he(n).length;t=(""+t).toLowerCase(),r=!0}}function dn(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 Nn(this,t,e);case"utf8":case"utf-8":return ct(this,t,e);case"ascii":return Tn(this,t,e);case"latin1":case"binary":return Rn(this,t,e);case"base64":return vn(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return bn(this,t,e);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),r=!0}}function V(n,t,e){var r=n[t];n[t]=n[e],n[e]=r}function pt(n,t,e,r,a){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=a?0:n.length-1),e<0&&(e=n.length+e),e>=n.length){if(a)return-1;e=n.length-1}else if(e<0)if(a)e=0;else return-1;if(typeof t=="string"&&(t=s.from(t,r)),L(t))return t.length===0?-1:at(n,t,e,r,a);if(typeof t=="number")return t=t&255,s.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?a?Uint8Array.prototype.indexOf.call(n,t,e):Uint8Array.prototype.lastIndexOf.call(n,t,e):at(n,[t],e,r,a);throw new TypeError("val must be string, number or Buffer")}function at(n,t,e,r,a){var i=1,o=n.length,f=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;i=2,o/=2,f/=2,e/=2}function m(N,E){return i===1?N[E]:N.readUInt16BE(E*i)}var h;if(a){var v=-1;for(h=e;h<o;h++)if(m(n,h)===m(t,v===-1?0:h-v)){if(v===-1&&(v=h),h-v+1===f)return v*i}else v!==-1&&(h-=h-v),v=-1}else for(e+f>o&&(e=o-f),h=e;h>=0;h--){for(var y=!0,b=0;b<f;b++)if(m(n,h+b)!==m(t,b)){y=!1;break}if(y)return h}return-1}function mn(n,t,e,r){e=Number(e)||0;var a=n.length-e;r?(r=Number(r),r>a&&(r=a)):r=a;var i=t.length;if(i%2!==0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var o=0;o<r;++o){var f=parseInt(t.substr(o*2,2),16);if(isNaN(f))return o;n[e+o]=f}return o}function hn(n,t,e,r){return ge(he(t,n.length-e),n,e,r)}function ft(n,t,e,r){return ge(kn(t),n,e,r)}function yn(n,t,e,r){return ft(n,t,e,r)}function xn(n,t,e,r){return ge(yt(t),n,e,r)}function gn(n,t,e,r){return ge(Ln(t,n.length-e),n,e,r)}function vn(n,t,e){return t===0&&e===n.length?nt(n):nt(n.slice(t,e))}function ct(n,t,e){e=Math.min(n.length,e);for(var r=[],a=t;a<e;){var i=n[a],o=null,f=i>239?4:i>223?3:i>191?2:1;if(a+f<=e){var m,h,v,y;switch(f){case 1:i<128&&(o=i);break;case 2:m=n[a+1],(m&192)===128&&(y=(i&31)<<6|m&63,y>127&&(o=y));break;case 3:m=n[a+1],h=n[a+2],(m&192)===128&&(h&192)===128&&(y=(i&15)<<12|(m&63)<<6|h&63,y>2047&&(y<55296||y>57343)&&(o=y));break;case 4:m=n[a+1],h=n[a+2],v=n[a+3],(m&192)===128&&(h&192)===128&&(v&192)===128&&(y=(i&15)<<18|(m&63)<<12|(h&63)<<6|v&63,y>65535&&y<1114112&&(o=y))}}o===null?(o=65533,f=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|o&1023),r.push(o),a+=f}return wn(r)}function wn(n){var t=n.length;if(t<=it)return String.fromCharCode.apply(String,n);for(var e="",r=0;r<t;)e+=String.fromCharCode.apply(String,n.slice(r,r+=it));return e}function Tn(n,t,e){var r="";e=Math.min(n.length,e);for(var a=t;a<e;++a)r+=String.fromCharCode(n[a]&127);return r}function Rn(n,t,e){var r="";e=Math.min(n.length,e);for(var a=t;a<e;++a)r+=String.fromCharCode(n[a]);return r}function Nn(n,t,e){var r=n.length;(!t||t<0)&&(t=0),(!e||e<0||e>r)&&(e=r);for(var a="",i=t;i<e;++i)a+=Cn(n[i]);return a}function bn(n,t,e){for(var r=n.slice(t,e),a="",i=0;i<r.length;i+=2)a+=String.fromCharCode(r[i]+r[i+1]*256);return a}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 A(n,t,e,r,a,i){if(!L(n))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>a||t<i)throw new RangeError('"value" argument is out of bounds');if(e+r>n.length)throw new RangeError("Index out of range")}function ye(n,t,e,r){t<0&&(t=65535+t+1);for(var a=0,i=Math.min(n.length-e,2);a<i;++a)n[e+a]=(t&255<<8*(r?a:1-a))>>>(r?a:1-a)*8}function xe(n,t,e,r){t<0&&(t=4294967295+t+1);for(var a=0,i=Math.min(n.length-e,4);a<i;++a)n[e+a]=t>>>(r?a:3-a)*8&255}function dt(n,t,e,r,a,i){if(e+r>n.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function mt(n,t,e,r,a){return a||dt(n,t,e,4,34028234663852886e22,-34028234663852886e22),gt(n,t,e,r,23,4),e+4}function ht(n,t,e,r,a){return a||dt(n,t,e,8,17976931348623157e292,-17976931348623157e292),gt(n,t,e,r,52,8),e+8}function In(n){if(n=En(n).replace(An,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}function En(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}function Cn(n){return n<16?"0"+n.toString(16):n.toString(16)}function he(n,t){t=t||1/0;for(var e,r=n.length,a=null,i=[],o=0;o<r;++o){if(e=n.charCodeAt(o),e>55295&&e<57344){if(!a){if(e>56319){(t-=3)>-1&&i.push(239,191,189);continue}else if(o+1===r){(t-=3)>-1&&i.push(239,191,189);continue}a=e;continue}if(e<56320){(t-=3)>-1&&i.push(239,191,189),a=e;continue}e=(a-55296<<10|e-56320)+65536}else a&&(t-=3)>-1&&i.push(239,191,189);if(a=null,e<128){if((t-=1)<0)break;i.push(e)}else if(e<2048){if((t-=2)<0)break;i.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;i.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;i.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return i}function kn(n){for(var t=[],e=0;e<n.length;++e)t.push(n.charCodeAt(e)&255);return t}function Ln(n,t){for(var e,r,a,i=[],o=0;o<n.length&&!((t-=2)<0);++o)e=n.charCodeAt(o),r=e>>8,a=e%256,i.push(a),i.push(r);return i}function yt(n){return on(In(n))}function ge(n,t,e,r){for(var a=0;a<r&&!(a+e>=t.length||a>=n.length);++a)t[a+e]=n[a];return a}function Sn(n){return n!==n}function Pn(n){return n!=null&&(!!n._isBuffer||xt(n)||Fn(n))}function xt(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function Fn(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&xt(n.slice(0,0))}function ve(n,t,e,r,a){var i,o,f=a*8-r-1,m=(1<<f)-1,h=m>>1,v=-7,y=e?a-1:0,b=e?-1:1,N=n[t+y];for(y+=b,i=N&(1<<-v)-1,N>>=-v,v+=f;v>0;i=i*256+n[t+y],y+=b,v-=8);for(o=i&(1<<-v)-1,i>>=-v,v+=r;v>0;o=o*256+n[t+y],y+=b,v-=8);if(i===0)i=1-h;else{if(i===m)return o?NaN:(N?-1:1)*(1/0);o=o+Math.pow(2,r),i=i-h}return(N?-1:1)*o*Math.pow(2,i-r)}function gt(n,t,e,r,a,i){var o,f,m,h=i*8-a-1,v=(1<<h)-1,y=v>>1,b=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,N=r?0:i-1,E=r?1:-1,br=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(f=isNaN(t)?1:0,o=v):(o=Math.floor(Math.log(t)/Math.LN2),t*(m=Math.pow(2,-o))<1&&(o--,m*=2),o+y>=1?t+=b/m:t+=b*Math.pow(2,1-y),t*m>=2&&(o++,m/=2),o+y>=v?(f=0,o=v):o+y>=1?(f=(t*m-1)*Math.pow(2,a),o=o+y):(f=t*Math.pow(2,y-1)*Math.pow(2,a),o=0));a>=8;n[e+N]=f&255,N+=E,f/=256,a-=8);for(o=o<<a|f,h+=a;h>0;n[e+N]=o&255,N+=E,o/=256,h-=8);n[e+N-E]|=br*128}var k,C,an,Fe,it,An,vt=Se(()=>{"use strict";u();l();k=[],C=[],an=typeof Uint8Array!="undefined"?Uint8Array:Array,Fe=!1;s.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;s.poolSize=8192;s._augment=function(n){return n.__proto__=s.prototype,n};s.from=function(n,t,e){return st(null,n,t,e)};s.kMaxLength=me();s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&s[Symbol.species]);s.alloc=function(n,t,e){return ln(null,n,t,e)};s.allocUnsafe=function(n){return Ue(null,n)};s.allocUnsafeSlow=function(n){return Ue(null,n)};s.isBuffer=Pn;s.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,a=e.length,i=0,o=Math.min(r,a);i<o;++i)if(t[i]!==e[i]){r=t[i],a=e[i];break}return r<a?-1:a<r?1:0};s.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}};s.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return s.alloc(0);var r;if(e===void 0)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var a=s.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var o=t[r];if(!L(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(a,i),i+=o.length}return a};s.byteLength=lt;s.prototype._isBuffer=!0;s.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)V(this,e,e+1);return this};s.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)V(this,e,e+3),V(this,e+1,e+2);return this};s.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)V(this,e,e+7),V(this,e+1,e+6),V(this,e+2,e+5),V(this,e+3,e+4);return this};s.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?ct(this,0,t):dn.apply(this,arguments)};s.prototype.equals=function(t){if(!L(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:s.compare(this,t)===0};s.prototype.compare=function(t,e,r,a,i){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),a===void 0&&(a=0),i===void 0&&(i=this.length),e<0||r>t.length||a<0||i>this.length)throw new RangeError("out of range index");if(a>=i&&e>=r)return 0;if(a>=i)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,a>>>=0,i>>>=0,this===t)return 0;for(var o=i-a,f=r-e,m=Math.min(o,f),h=this.slice(a,i),v=t.slice(e,r),y=0;y<m;++y)if(h[y]!==v[y]){o=h[y],f=v[y];break}return o<f?-1:f<o?1:0};s.prototype.includes=function(t,e,r){return this.indexOf(t,e,r)!==-1};s.prototype.indexOf=function(t,e,r){return pt(this,t,e,r,!0)};s.prototype.lastIndexOf=function(t,e,r){return pt(this,t,e,r,!1)};s.prototype.write=function(t,e,r,a){if(e===void 0)a="utf8",r=this.length,e=0;else if(r===void 0&&typeof e=="string")a=e,r=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(r)?(r=r|0,a===void 0&&(a="utf8")):(a=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i=this.length-e;if((r===void 0||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");a||(a="utf8");for(var o=!1;;)switch(a){case"hex":return mn(this,t,e,r);case"utf8":case"utf-8":return hn(this,t,e,r);case"ascii":return ft(this,t,e,r);case"latin1":case"binary":return yn(this,t,e,r);case"base64":return xn(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return gn(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+a);a=(""+a).toLowerCase(),o=!0}};s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};it=4096;s.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 a;if(s.TYPED_ARRAY_SUPPORT)a=this.subarray(t,e),a.__proto__=s.prototype;else{var i=e-t;a=new s(i,void 0);for(var o=0;o<i;++o)a[o]=this[o+t]}return a};s.prototype.readUIntLE=function(t,e,r){t=t|0,e=e|0,r||R(t,e,this.length);for(var a=this[t],i=1,o=0;++o<e&&(i*=256);)a+=this[t+o]*i;return a};s.prototype.readUIntBE=function(t,e,r){t=t|0,e=e|0,r||R(t,e,this.length);for(var a=this[t+--e],i=1;e>0&&(i*=256);)a+=this[t+--e]*i;return a};s.prototype.readUInt8=function(t,e){return e||R(t,1,this.length),this[t]};s.prototype.readUInt16LE=function(t,e){return e||R(t,2,this.length),this[t]|this[t+1]<<8};s.prototype.readUInt16BE=function(t,e){return e||R(t,2,this.length),this[t]<<8|this[t+1]};s.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};s.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])};s.prototype.readIntLE=function(t,e,r){t=t|0,e=e|0,r||R(t,e,this.length);for(var a=this[t],i=1,o=0;++o<e&&(i*=256);)a+=this[t+o]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*e)),a};s.prototype.readIntBE=function(t,e,r){t=t|0,e=e|0,r||R(t,e,this.length);for(var a=e,i=1,o=this[t+--a];a>0&&(i*=256);)o+=this[t+--a]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o};s.prototype.readInt8=function(t,e){return e||R(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};s.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};s.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};s.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};s.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]};s.prototype.readFloatLE=function(t,e){return e||R(t,4,this.length),ve(this,t,!0,23,4)};s.prototype.readFloatBE=function(t,e){return e||R(t,4,this.length),ve(this,t,!1,23,4)};s.prototype.readDoubleLE=function(t,e){return e||R(t,8,this.length),ve(this,t,!0,52,8)};s.prototype.readDoubleBE=function(t,e){return e||R(t,8,this.length),ve(this,t,!1,52,8)};s.prototype.writeUIntLE=function(t,e,r,a){if(t=+t,e=e|0,r=r|0,!a){var i=Math.pow(2,8*r)-1;A(this,t,e,r,i,0)}var o=1,f=0;for(this[e]=t&255;++f<r&&(o*=256);)this[e+f]=t/o&255;return e+r};s.prototype.writeUIntBE=function(t,e,r,a){if(t=+t,e=e|0,r=r|0,!a){var i=Math.pow(2,8*r)-1;A(this,t,e,r,i,0)}var o=r-1,f=1;for(this[e+o]=t&255;--o>=0&&(f*=256);)this[e+o]=t/f&255;return e+r};s.prototype.writeUInt8=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,1,255,0),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=t&255,e+1};s.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):ye(this,t,e,!0),e+2};s.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):ye(this,t,e,!1),e+2};s.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255):xe(this,t,e,!0),e+4};s.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):xe(this,t,e,!1),e+4};s.prototype.writeIntLE=function(t,e,r,a){if(t=+t,e=e|0,!a){var i=Math.pow(2,8*r-1);A(this,t,e,r,i-1,-i)}var o=0,f=1,m=0;for(this[e]=t&255;++o<r&&(f*=256);)t<0&&m===0&&this[e+o-1]!==0&&(m=1),this[e+o]=(t/f>>0)-m&255;return e+r};s.prototype.writeIntBE=function(t,e,r,a){if(t=+t,e=e|0,!a){var i=Math.pow(2,8*r-1);A(this,t,e,r,i-1,-i)}var o=r-1,f=1,m=0;for(this[e+o]=t&255;--o>=0&&(f*=256);)t<0&&m===0&&this[e+o+1]!==0&&(m=1),this[e+o]=(t/f>>0)-m&255;return e+r};s.prototype.writeInt8=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,1,127,-128),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=t&255,e+1};s.prototype.writeInt16LE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):ye(this,t,e,!0),e+2};s.prototype.writeInt16BE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):ye(this,t,e,!1),e+2};s.prototype.writeInt32LE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):xe(this,t,e,!0),e+4};s.prototype.writeInt32BE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):xe(this,t,e,!1),e+4};s.prototype.writeFloatLE=function(t,e,r){return mt(this,t,e,!0,r)};s.prototype.writeFloatBE=function(t,e,r){return mt(this,t,e,!1,r)};s.prototype.writeDoubleLE=function(t,e,r){return ht(this,t,e,!0,r)};s.prototype.writeDoubleBE=function(t,e,r){return ht(this,t,e,!1,r)};s.prototype.copy=function(t,e,r,a){if(r||(r=0),!a&&a!==0&&(a=this.length),e>=t.length&&(e=t.length),e||(e=0),a>0&&a<r&&(a=r),a===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(a<0)throw new RangeError("sourceEnd out of bounds");a>this.length&&(a=this.length),t.length-e<a-r&&(a=t.length-e+r);var i=a-r,o;if(this===t&&r<e&&e<a)for(o=i-1;o>=0;--o)t[o+e]=this[o+r];else if(i<1e3||!s.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+i),e);return i};s.prototype.fill=function(t,e,r,a){if(typeof t=="string"){if(typeof e=="string"?(a=e,e=0,r=this.length):typeof r=="string"&&(a=r,r=this.length),t.length===1){var i=t.charCodeAt(0);i<256&&(t=i)}if(a!==void 0&&typeof a!="string")throw new TypeError("encoding must be a string");if(typeof a=="string"&&!s.isEncoding(a))throw new TypeError("Unknown encoding: "+a)}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 o;if(typeof t=="number")for(o=e;o<r;++o)this[o]=t;else{var f=L(t)?t:he(new s(t,a).toString()),m=f.length;for(o=0;o<r-e;++o)this[o+e]=f[o%m]}return this};An=/[^+\/0-9A-Za-z-_]/g});var l=Se(()=>{"use strict";vt()});var zi={};Ze(zi,{DynamicSnippetsGenerator:()=>qe});module.exports=Lr(zi);u();l();u();l();u();l();function x(n){throw new Error("Unexpected value: "+JSON.stringify(n))}u();l();function ee(n){return Object.keys(n)}u();l();u();l();u();l();u();l();u();l();u();l();var Un=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis,wt=Un;var Bn=typeof self=="object"&&self&&self.Object===Object&&self,Mn=wt||Bn||Function("return this")(),Tt=Mn;var On=Tt.Symbol,B=On;u();l();var Rt=Object.prototype,jn=Rt.hasOwnProperty,_n=Rt.toString,te=B?B.toStringTag:void 0;function Dn(n){var t=jn.call(n,te),e=n[te];try{n[te]=void 0;var r=!0}catch(i){}var a=_n.call(n);return r&&(t?n[te]=e:delete n[te]),a}var Nt=Dn;u();l();var Vn=Object.prototype,Wn=Vn.toString;function $n(n){return Wn.call(n)}var bt=$n;var qn="[object Null]",Gn="[object Undefined]",At=B?B.toStringTag:void 0;function Yn(n){return n==null?n===void 0?Gn:qn:At&&At in Object(n)?Nt(n):bt(n)}var It=Yn;u();l();function zn(n){return n!=null&&typeof n=="object"}var Et=zn;var Hn="[object Symbol]";function Jn(n){return typeof n=="symbol"||Et(n)&&It(n)==Hn}var Ct=Jn;u();l();u();l();function Zn(n,t){for(var e=-1,r=n==null?0:n.length,a=Array(r);++e<r;)a[e]=t(n[e],e,n);return a}var kt=Zn;u();l();var Kn=Array.isArray,Lt=Kn;var Xn=1/0,St=B?B.prototype:void 0,Pt=St?St.toString:void 0;function Ft(n){if(typeof n=="string")return n;if(Lt(n))return kt(n,Ft)+"";if(Ct(n))return Pt?Pt.call(n):"";var t=n+"";return t=="0"&&1/n==-Xn?"-0":t}var Ut=Ft;u();l();function Qn(n){return n==null?"":Ut(n)}var j=Qn;u();l();u();l();u();l();u();l();u();l();u();l();function ea(n,t,e){var r=-1,a=n.length;t<0&&(t=-t>a?0:a+t),e=e>a?a:e,e<0&&(e+=a),a=t>e?0:e-t>>>0,t>>>=0;for(var i=Array(a);++r<a;)i[r]=n[r+t];return i}var Bt=ea;function ta(n,t,e){var r=n.length;return e=e===void 0?r:e,!t&&e>=r?n:Bt(n,t,e)}var Mt=ta;u();l();var ra="\\ud800-\\udfff",na="\\u0300-\\u036f",aa="\\ufe20-\\ufe2f",ia="\\u20d0-\\u20ff",oa=na+aa+ia,sa="\\ufe0e\\ufe0f",ua="\\u200d",la=RegExp("["+ua+ra+oa+sa+"]");function pa(n){return la.test(n)}var we=pa;u();l();u();l();function fa(n){return n.split("")}var Ot=fa;u();l();var jt="\\ud800-\\udfff",ca="\\u0300-\\u036f",da="\\ufe20-\\ufe2f",ma="\\u20d0-\\u20ff",ha=ca+da+ma,ya="\\ufe0e\\ufe0f",xa="["+jt+"]",Me="["+ha+"]",Oe="\\ud83c[\\udffb-\\udfff]",ga="(?:"+Me+"|"+Oe+")",_t="[^"+jt+"]",Dt="(?:\\ud83c[\\udde6-\\uddff]){2}",Vt="[\\ud800-\\udbff][\\udc00-\\udfff]",va="\\u200d",Wt=ga+"?",$t="["+ya+"]?",wa="(?:"+va+"(?:"+[_t,Dt,Vt].join("|")+")"+$t+Wt+")*",Ta=$t+Wt+wa,Ra="(?:"+[_t+Me+"?",Me,Dt,Vt,xa].join("|")+")",Na=RegExp(Oe+"(?="+Oe+")|"+Ra+Ta,"g");function ba(n){return n.match(Na)||[]}var qt=ba;function Aa(n){return we(n)?qt(n):Ot(n)}var Gt=Aa;function Ia(n){return function(t){t=j(t);var e=we(t)?Gt(t):void 0,r=e?e[0]:t.charAt(0),a=e?Mt(e,1).join(""):t.slice(1);return r[n]()+a}}var Yt=Ia;var Ea=Yt("toUpperCase"),zt=Ea;function Ca(n){return zt(j(n).toLowerCase())}var Ht=Ca;u();l();u();l();function ka(n,t,e,r){var a=-1,i=n==null?0:n.length;for(r&&i&&(e=n[++a]);++a<i;)e=t(e,n[a],a,n);return e}var Jt=ka;u();l();u();l();u();l();function La(n){return function(t){return n==null?void 0:n[t]}}var Zt=La;var Sa={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},Pa=Zt(Sa),Kt=Pa;var Fa=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ua="\\u0300-\\u036f",Ba="\\ufe20-\\ufe2f",Ma="\\u20d0-\\u20ff",Oa=Ua+Ba+Ma,ja="["+Oa+"]",_a=RegExp(ja,"g");function Da(n){return n=j(n),n&&n.replace(Fa,Kt).replace(_a,"")}var Xt=Da;u();l();u();l();var Va=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Wa(n){return n.match(Va)||[]}var Qt=Wa;u();l();var $a=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function qa(n){return $a.test(n)}var er=qa;u();l();var ir="\\ud800-\\udfff",Ga="\\u0300-\\u036f",Ya="\\ufe20-\\ufe2f",za="\\u20d0-\\u20ff",Ha=Ga+Ya+za,or="\\u2700-\\u27bf",sr="a-z\\xdf-\\xf6\\xf8-\\xff",Ja="\\xac\\xb1\\xd7\\xf7",Za="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ka="\\u2000-\\u206f",Xa=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ur="A-Z\\xc0-\\xd6\\xd8-\\xde",Qa="\\ufe0e\\ufe0f",lr=Ja+Za+Ka+Xa,pr="['\u2019]",tr="["+lr+"]",ei="["+Ha+"]",fr="\\d+",ti="["+or+"]",cr="["+sr+"]",dr="[^"+ir+lr+fr+or+sr+ur+"]",ri="\\ud83c[\\udffb-\\udfff]",ni="(?:"+ei+"|"+ri+")",ai="[^"+ir+"]",mr="(?:\\ud83c[\\udde6-\\uddff]){2}",hr="[\\ud800-\\udbff][\\udc00-\\udfff]",Q="["+ur+"]",ii="\\u200d",rr="(?:"+cr+"|"+dr+")",oi="(?:"+Q+"|"+dr+")",nr="(?:"+pr+"(?:d|ll|m|re|s|t|ve))?",ar="(?:"+pr+"(?:D|LL|M|RE|S|T|VE))?",yr=ni+"?",xr="["+Qa+"]?",si="(?:"+ii+"(?:"+[ai,mr,hr].join("|")+")"+xr+yr+")*",ui="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",li="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",pi=xr+yr+si,fi="(?:"+[ti,mr,hr].join("|")+")"+pi,ci=RegExp([Q+"?"+cr+"+"+nr+"(?="+[tr,Q,"$"].join("|")+")",oi+"+"+ar+"(?="+[tr,Q+rr,"$"].join("|")+")",Q+"?"+rr+"+"+nr,Q+"+"+ar,li,ui,fr,fi].join("|"),"g");function di(n){return n.match(ci)||[]}var gr=di;function mi(n,t,e){return n=j(n),t=e?void 0:t,t===void 0?er(n)?gr(n):Qt(n):n.match(t)||[]}var vr=mi;var hi="['\u2019]",yi=RegExp(hi,"g");function xi(n){return function(t){return Jt(vr(Xt(t).replace(yi,"")),n,"")}}var wr=xi;var gi=wr(function(n,t,e){return t=t.toLowerCase(),n+(e?Ht(t):t)}),je=gi;u();l();u();l();var W=class{};u();l();u();l();var S=class extends W{constructor(e){super();c(this,"value");this.value=e}write(e){typeof this.value=="string"?e.write(this.value):this.value(e)}};var vi=4,re=class{constructor(){c(this,"buffer","");c(this,"indentLevel",0);c(this,"hasWrittenAnything",!1);c(this,"lastCharacterIsSemicolon",!1);c(this,"lastCharacterIsNewline",!1)}write(t){let e=t.length>0&&t.endsWith(`
|
|
2
|
+
`),r=e?t.substring(0,t.length-1):t,a=this.getIndentString(),i=r.replaceAll(`
|
|
3
|
+
`,`
|
|
4
|
+
${a}`);this.isAtStartOfLine()&&(i=a+i),e&&(i+=`
|
|
5
|
+
`),this.writeInternal(i)}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,a="}"){let i=t.filter(o=>o!==void 0).join(" ");i?this.write(`${i} ${e!=null?e:""}`):this.write(e!=null?e:"");try{this.indent(),r(),this.dedent()}finally{this.write(a!=null?a:"")}}writeLine(t=""){this.write(t),this.writeNewLineIfLastLineNot()}newLine(){this.writeInternal(`
|
|
6
|
+
`)}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 a=t[0];a!=null&&r(a);for(let i=1;i<t.length;i++){this.write(e);let o=t[i];o!=null&&r(o)}}}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*vi)}};u();l();var Te=class{},ne=class extends Te{async format(t){return t}formatSync(t){return t}};u();l();function _e(n){return(n==null?void 0:n.name)!=null}u();l();u();l();u();l();var ae=class{constructor(){c(this,"reporter");c(this,"snippet");c(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:t,snippet:e}){this.shouldUpdate({snippet:e,reporter:t.errors})&&(this.reporter=t.errors.clone(),this.snippet=e)}getResponseOrThrow({endpoint:t}){var e;if(this.snippet!=null&&this.reporter!=null)return{snippet:this.snippet,errors:this.reporter.toDynamicSnippetErrors()};throw(e=this.err)!=null?e:new Error(`Failed to generate snippet for endpoint "${t.method} ${t.path}"`)}shouldUpdate({snippet:t,reporter:e}){var r,a;return this.reporter==null||this.reporter.size()>0&&e.size()===0?!0:t.length>((a=(r=this.snippet)==null?void 0:r.length)!=null?a:0)}};var ie=class{constructor(t){c(this,"context");this.context=t}async generate(t,e={}){let r=this.context.resolveEndpointLocationOrThrow(t.endpoint);if(r.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let a=new ae;for(let i of r){let o=this.context.clone(),f=this.createSnippetGenerator(o);try{let m=await f.generateSnippet({endpoint:i,request:t,options:e});if(o.errors.empty())return{snippet:m,errors:void 0};a.update({context:o,snippet:m})}catch(m){a.err==null&&(a.err=m)}}return a.getResponseOrThrow({endpoint:t.endpoint})}generateSync(t,e={}){let r=this.context.resolveEndpointLocationOrThrow(t.endpoint);if(r.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let a=new ae;for(let i of r){let o=this.context.clone(),f=this.createSnippetGenerator(o);try{let m=f.generateSnippetSync({endpoint:i,request:t,options:e});if(o.errors.empty())return{snippet:m,errors:void 0};a.update({context:o,snippet:m})}catch(m){a.err==null&&(a.err=m)}}return a.getResponseOrThrow({endpoint:t.endpoint})}};u();l();u();l();u();l();var oe=class{constructor(){c(this,"REFERENCE_REGEX",/^(GET|POST|PUT|DELETE|PATCH)\s(\/[a-zA-Z0-9\/{}_-]*)$/)}validate(t){return this.REFERENCE_REGEX.test(t)?{type:"valid"}:{type:"invalid"}}tryParse(t){if(this.validate(t).type==="invalid")return;let r=t.match(this.REFERENCE_REGEX);if(!(r==null||r[1]==null||r[2]==null))return{method:r[1],path:r[2]}}};u();l();var g={Critical:"CRITICAL",Warning:"WARNING"},se=class n{constructor(){c(this,"errors");c(this,"path");this.errors=[],this.path=[]}add(t){this.errors.push(ze(Ye({},t),{path:[...this.path]}))}scope(t){this.path.push(t)}unscope(){this.path.pop()}getBySeverity(t){return this.errors.filter(e=>e.severity===t)}empty(){return this.errors.length===0}size(){return this.errors.length}clone(){let t=new n;return t.errors=[...this.errors],t.path=[...this.path],t}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(t=>({severity:t.severity,path:t.path!=null?this.pathToStringArray(t.path):void 0,message:t.message}))}pathToStringArray(t){let e=[];for(let r of t){if(typeof r=="string"){e.push(r);continue}e[e.length-1]+=`[${r.index}]`}return e}};var ue=class{constructor({ir:t,config:e,options:r={}}){c(this,"config");c(this,"options");c(this,"errors");c(this,"_ir");c(this,"httpEndpointReferenceParser");this._ir=t,this.config=e,this.options=r,this.errors=new se,this.httpEndpointReferenceParser=new oe}associateQueryParametersByWireValue({parameters:t,values:e}){let r=[];for(let[a,i]of Object.entries(e)){this.errors.scope(a);try{let o=t.find(m=>m.name.wireValue===a);if(o==null)throw this.newParameterNotRecognizedError(a);let f=this.isListTypeReference(o.typeReference)&&!Array.isArray(i)?[i]:i;r.push({name:o.name,typeReference:o.typeReference,value:f})}finally{this.errors.unscope()}}return r}associateByWireValue({parameters:t,values:e,ignoreMissingParameters:r}){let a=[];for(let[i,o]of Object.entries(e)){this.errors.scope(i);try{let f=t.find(m=>m.name.wireValue===i);if(f==null){if(r)continue;this.errors.add({severity:g.Critical,message:this.newParameterNotRecognizedError(i).message});continue}a.push({name:f.name,typeReference:f.typeReference,value:o})}finally{this.errors.unscope()}}return a}getSingleFileValue({property:t,record:e}){let r=e[t.wireValue];if(r!=null){if(typeof r!="string"){this.errors.add({severity:g.Critical,message:`Expected file value to be a string, got ${typeof r}`});return}return r}}getFileArrayValues({property:t,record:e}){let r=e[t.wireValue];if(r==null)return;if(!Array.isArray(r)){this.errors.add({severity:g.Critical,message:`Expected file array value to be an array of strings, got ${typeof r}`});return}let a=[];for(let i of r){if(typeof i!="string"){this.errors.add({severity:g.Critical,message:`Expected file array value to be an array of strings, got ${typeof i}`});return}a.push(i)}return a}getRecord(t){if(typeof t!="object"||Array.isArray(t)){this.errors.add({severity:g.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(t)?"array":typeof t}`});return}return t==null?{}:t}resolveNamedType({typeId:t}){let e=this._ir.types[t];if(e==null){this.errors.add({severity:g.Critical,message:`Type identified by "${t}" could not be found`});return}return e}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e}){let r=this.getRecord(e);if(r==null)return;let a=t.discriminant.wireValue,i=r[a];if(i==null){this.errors.add({severity:g.Critical,message:this.newParameterNotRecognizedError(a).message});return}if(typeof i!="string"){this.errors.add({severity:g.Critical,message:`Expected discriminant value to be a string but got: ${typeof i}`});return}let o=t.types[i];if(o==null){this.errors.add({severity:g.Critical,message:`No type found for discriminant value "${i}"`});return}let h=r,{[a]:f}=h,m=Je(h,[He(a)]);return{singleDiscriminatedUnionType:o,discriminantValue:o.discriminantValue,value:m}}resolveEndpointOrThrow(t){let e=this.httpEndpointReferenceParser.tryParse(t);if(e==null)throw new Error(`Failed to parse endpoint reference "${t}"`);return this.resolveEndpointLocationOrThrow(e)}resolveEndpointLocationOrThrow(t){let e=[];for(let r of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:r,parsedEndpoint:t})&&e.push(r);if(e.length===0)throw new Error(`Failed to find endpoint identified by "${t.method} ${t.path}"`);return e}needsRequestParameter({request:t,inlinePathParameters:e,inlineFileProperties:r}){var a;return this.includePathParametersInWrappedRequest({request:t,inlinePathParameters:e})||t.queryParameters!=null&&t.queryParameters.length>0||t.headers!=null&&t.headers.length>0?!0:t.body!=null?this.includeRequestBodyInWrappedRequest({body:t.body,inlineFileProperties:r}):!((a=t.metadata)!=null&&a.onlyPathParameters)}includePathParametersInWrappedRequest({request:t,inlinePathParameters:e}){var r,a;return e&&((a=(r=t.metadata)==null?void 0:r.includePathParameters)!=null?a:!1)}isFileUploadRequestBody(t){switch(t.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:x(t)}}resolveEnvironmentName(t){if(this._ir.environments==null)return;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":{let r=e.environments.find(a=>a.id===t);return r==null?void 0:r.name}case"multipleBaseUrls":{let r=e.environments.find(a=>a.id===t);return r==null?void 0:r.name}default:x(e)}}isSingleEnvironmentID(t){return typeof t=="string"}isMultiEnvironmentValues(t){return typeof t=="object"}validateMultiEnvironmentUrlValues(t){if(this._ir.environments==null)return this.errors.add({severity:g.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":return this.errors.add({severity:g.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let r=e.environments[0];if(r==null)return this.errors.add({severity:g.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let a=new Set(ee(r.urls));for(let i of ee(t))a.has(i)&&a.delete(i);return a.size>0?(this.errors.add({severity:g.Critical,message:`The provided environments are invalid; got: [${Object.keys(t).join(", ")}], expected: [${ee(r.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:t}){if(typeof t!="number"){this.errors.add({severity:g.Critical,message:this.newTypeMismatchError({expected:"number",value:t}).message});return}return t}getValueAsBoolean({value:t}){if(typeof t!="boolean"){this.errors.add({severity:g.Critical,message:this.newTypeMismatchError({expected:"boolean",value:t}).message});return}return t}getValueAsString({value:t}){if(typeof t!="string"){this.errors.add({severity:g.Critical,message:this.newTypeMismatchError({expected:"string",value:t}).message});return}return t}isOptional(t){switch(t.type){case"nullable":return this.isOptional(t.value);case"optional":return!0;case"named":{let e=this.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}isNullable(t){switch(t.type){case"nullable":return!0;case"optional":return this.isNullable(t.value);case"named":{let e=this.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}newAuthMismatchError({auth:t,values:e}){return new Error(`Expected auth type ${t.type}, got ${e.type}`)}newParameterNotRecognizedError(t){return new Error(`"${t}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:t,value:e}){return new Error(`Expected ${t}, got ${typeof e}`)}includeRequestBodyInWrappedRequest({body:t,inlineFileProperties:e}){switch(t.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:t,inlineFileProperties:e});default:x(t)}}includeFileUploadBodyInWrappedRequest({fileUpload:t,inlineFileProperties:e}){return this.fileUploadHasBodyProperties({fileUpload:t})||e&&this.fileUploadHasFileProperties({fileUpload:t})}fileUploadHasBodyProperties({fileUpload:t}){return t.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:x(e)}})}fileUploadHasFileProperties({fileUpload:t}){return t.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:x(e)}})}isListTypeReference(t){return t.type==="optional"?this.isListTypeReference(t.value):t.type==="list"||t.type==="set"}parsedEndpointMatches({endpoint:t,parsedEndpoint:e}){return t.location.method===e.method&&t.location.path===e.path}};u();l();var $;(function(n){n.Concise="concise",n.Full="full"})($||($={}));u();l();var P={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};u();l();u();l();var p={};Ze(p,{Access:()=>De,AstNode:()=>T,Class:()=>G,ClassInstantiation:()=>Y,ClassReference:()=>w,CodeBlock:()=>z,Method:()=>H,MethodInvocation:()=>J,Parameter:()=>Z,Type:()=>pe,TypeLiteral:()=>I,Writer:()=>q,classReference:()=>ji,class_:()=>Oi,codeblock:()=>Mi,instantiateClass:()=>_i,invokeMethod:()=>Di,method:()=>Vi,parameter:()=>Wi});u();l();u();l();u();l();var De={Public:"public",Protected:"protected",Private:"private"};u();l();u();l();u();l();var q=class extends re{constructor({packageName:e,customConfig:r,formatter:a}){super();c(this,"packageName");c(this,"customConfig");c(this,"formatter");c(this,"imports",new Set);this.packageName=e,this.customConfig=r,this.formatter=a!=null?a:new ne}addImport(e){this.imports.add(e)}};var le=class extends q{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
|
+
${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
|
+
${t}`)}return t}getContent(){let t=`package ${this.packageName};
|
|
11
|
+
|
|
12
|
+
`,e=this.stringifyImports();return e.length>0?`${t}${e}
|
|
13
|
+
|
|
14
|
+
${this.buffer}`:t+this.buffer}stringifyImports(){return Array.from(this.imports).filter(t=>t!==this.packageName).map(t=>`import ${t};`).sort().join(`
|
|
15
|
+
`)}};var T=class extends W{async toStringAsync({packageName:t,customConfig:e,formatter:r}){let a=new le({packageName:t,customConfig:e,formatter:r});return this.write(a),a.toStringAsync()}toString({packageName:t,customConfig:e,formatter:r}){let a=new le({packageName:t,customConfig:e,formatter:r});return this.write(a),a.toString()}};u();l();var G=class extends T{constructor({name:e,access:r}){super();c(this,"name");c(this,"access");c(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}};u();l();var w=class extends T{constructor({name:e,packageName:r,fullyQualified:a}){super();c(this,"name");c(this,"packageName");c(this,"fullyQualified");this.name=e,this.packageName=r,this.fullyQualified=a!=null?a:!1}write(e){if(e.addImport(`${this.packageName}.${this.name}`),this.fullyQualified){e.write(`${this.packageName}.${this.name}`);return}e.write(this.name)}};u();l();u();l();u();l();u();l();var pe=class extends T{constructor(e){super();c(this,"internalType");this.internalType=e}write(e){switch(this.internalType.type){case"bigInteger":e.writeNode(wi);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(Ni);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(Ai);break;default:x(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(Ti),e.write("<"),r.value.write(e),e.write(">")}writeMap({writer:e,map:r}){e.writeNode(Ri),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(">")}writeSet({writer:e,set:r}){e.writeNode(bi),e.write("<"),r.value.write(e),e.write(">")}static isAlreadyOptional(e){return e.internalType.type==="optional"}},Ve=new w({name:"Arrays",packageName:"java.util"}),wi=new w({name:"BigInteger",packageName:"java.math"}),Fp=new w({name:"HashMap",packageName:"java.util"}),Ti=new w({name:"List",packageName:"java.util"}),Ri=new w({name:"Map",packageName:"java.util"}),Ni=new w({name:"OffsetDateTime",packageName:"java.time"}),We=new w({name:"Optional",packageName:"java.util"}),bi=new w({name:"Set",packageName:"java.util"}),Ai=new w({name:"UUID",packageName:"java.util"});var I=class n extends T{constructor(e){super();c(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:x(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:a}){return new this({type:"map",keyType:e,valueType:r,entries:a})}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:x(this.internalType)}}writeBigInteger({writer:e,bigInteger:r}){e.write("new "),e.writeNode(p.instantiateClass({classReference:Ii,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(Si({parameters:r.parameters}))}),e.dedent()}writeBuilderParameters({writer:e,parameters:r}){e.writeLine(".builder()");for(let a of r)e.write(`.${a.name}(`),a.value.shouldWriteInLine()||e.newLine(),e.indent(),e.writeNode(a.value),e.dedent(),a.value.shouldWriteInLine()||e.newLine(),e.writeLine(")");e.writeNewLineIfLastLineNot(),e.write(".build()")}orderBuilderParameters(e){return e.sort((r,a)=>r.value.isOptional()&&!a.value.isOptional()?1:!r.value.isOptional()&&a.value.isOptional()?-1:0)}writeClass({writer:e,class_:r}){let a=Li({parameters:r.parameters});e.writeNode(p.instantiateClass({classReference:r.reference,arguments_:a.map(i=>i.value)}))}writeDateTime({writer:e,dateTime:r}){e.writeNode(p.invokeMethod({on:Ci,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 a=Pi({entries:r.entries});if(a.length===0){e.write("new "),e.writeNode(Re),e.write("<"),e.writeNode(r.keyType),e.write(", "),e.writeNode(r.valueType),e.write(">()");return}e.write("new "),e.writeNode(Re),e.write("<"),e.writeNode(r.keyType),e.write(", "),e.writeNode(r.valueType),e.writeLine(">() {{"),e.indent();for(let i of a)e.write("put("),e.writeNode(i.key),e.write(", "),e.writeNode(i.value),e.writeLine(");");e.dedent(),e.write("}}")}writeOptional({writer:e,optional:r}){if(!r.useOf){e.writeNode(r.value);return}e.writeNode(p.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 a=r.type==="list"?$e:Ei,i=Fi({values:r.values});if(i.length===0){e.write(`new ${a.name}<`),e.writeNode(r.valueType),e.write(">()");return}e.write("new "),e.writeNode(a),e.write("<"),e.writeNode(r.valueType),e.writeLine(">("),e.indent(),e.writeNode(p.invokeMethod({on:Ve,method:"asList",arguments_:i})),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($e),e.write("<Object>()");return}e.writeLine("new"),e.writeNode($e),e.write("<Object>() {"),e.indent(),e.writeNode(p.invokeMethod({on:Ve,method:"asList",arguments_:r.map(a=>n.unknown(a))})),e.writeNewLineIfLastLineNot(),e.dedent(),e.write("}")}writeUnknownMap({writer:e,value:r}){let a=Object.entries(r);if(a.length===0){e.write("new "),e.writeNode(Re),e.write("<String, Object>()");return}e.writeLine("new "),e.writeNode(Re),e.write("<String, Object>() {{"),e.indent();for(let[i,o]of a)e.write(`put("${i}", `),e.writeNode(n.unknown(o)),e.writeLine(");");e.dedent(),e.write("}}")}writeUUID({writer:e,uuid:r}){e.writeNode(p.invokeMethod({on:ki,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"}},$e=new w({name:"ArrayList",packageName:"java.util"}),Ii=new w({name:"BigInteger",packageName:"java.math"}),Re=new w({name:"HashMap",packageName:"java.util"}),Ei=new w({name:"HashSet",packageName:"java.util"}),$p=new w({name:"List",packageName:"java.util"}),qp=new w({name:"Map",packageName:"java.util"}),Ci=new w({name:"OffsetDateTime",packageName:"java.time"}),Gp=new w({name:"Set",packageName:"java.util"}),ki=new w({name:"UUID",packageName:"java.util"});function Li({parameters:n}){return n.filter(t=>!I.isNop(t.value))}function Si({parameters:n}){return n.filter(t=>!I.isNop(t.value))}function Pi({entries:n}){return n.filter(t=>!I.isNop(t.key)&&!I.isNop(t.value))}function Fi({values:n}){return n.filter(t=>!I.isNop(t))}function Ne({writer:n,arguments_:t}){let e=Bi(t);if(e.length===0){n.write("()");return}if(e.some(a=>a instanceof I&&!a.shouldWriteInLine())){Ui({writer:n,arguments_:e});return}n.write("("),e.forEach((a,i)=>{i>0&&n.write(", "),Tr({writer:n,argument:a})}),n.write(")")}function Ui({writer:n,arguments_:t}){n.writeLine("("),n.indent(),t.forEach((e,r)=>{r>0&&n.writeLine(","),Tr({writer:n,argument:e})}),n.dedent(),t.length>0&&n.newLine(),n.write(")")}function Tr({writer:n,argument:t}){_e(t)?n.writeNodeOrString(t.assignment):t.write(n)}function Bi(n){return n.filter(t=>!(t instanceof I&&I.isNop(t)))}var Y=class extends T{constructor({classReference:e,arguments_:r}){super();c(this,"classReference");c(this,"arguments_");this.classReference=e,this.arguments_=r}write(e){e.writeNode(this.classReference),Ne({writer:e,arguments_:this.arguments_})}};u();l();var z=class extends T{constructor(e){super();c(this,"arg");this.arg=e}write(e){return new S(this.arg).write(e)}};u();l();var H=class extends T{constructor({name:e,access:r,parameters:a,body:i,static_:o,return_:f}){super();c(this,"name");c(this,"access");c(this,"parameters");c(this,"body");c(this,"return_");c(this,"static_");this.name=e,this.access=r,this.parameters=a,this.body=i,this.return_=f,this.static_=o!=null?o:!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,a)=>{a>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("}")}};u();l();var J=class extends T{constructor({method:e,arguments_:r,on:a}){super();c(this,"on");c(this,"method");c(this,"arguments_");this.on=a,this.method=e,this.arguments_=r}write(e){this.on.write(e),e.write("."),e.write(this.method),Ne({writer:e,arguments_:this.arguments_})}};u();l();var Z=class extends T{constructor({name:e,type:r}){super();c(this,"name");c(this,"type");this.name=e,this.type=r}write(e){e.writeNode(this.type),e.write(` ${this.name}`)}};function Mi(n){return new z(n)}function Oi(n){return new G(n)}function ji(n){return new w(n)}function _i(n){return new Y(n)}function Di(n){return new J(n)}function Vi(n){return new H(n)}function Wi(n){return new Z(n)}var Rr="com.example.usage",$i="Example",qi="run",Nr="client",Gi={type:"primitive",value:"STRING"},be=class{constructor({context:t,formatter:e}){c(this,"context");c(this,"formatter");this.context=t,this.formatter=e}async generateSnippet({endpoint:t,request:e,options:r}){var o,f;let a=this.getConfig(r);return await this.buildCodeBlock({endpoint:t,snippet:e,options:r}).toStringAsync({packageName:(o=a.fullStylePackageName)!=null?o:Rr,customConfig:(f=this.context.customConfig)!=null?f:{},formatter:this.formatter})}generateSnippetSync({endpoint:t,request:e,options:r}){var o,f;let a=this.getConfig(r);return this.buildCodeBlock({endpoint:t,snippet:e,options:r}).toString({packageName:(o=a.fullStylePackageName)!=null?o:Rr,customConfig:(f=this.context.customConfig)!=null?f:{},formatter:this.formatter})}buildCodeBlock({endpoint:t,snippet:e,options:r}){let a=p.codeblock(o=>{o.writeNodeStatement(this.constructClient({endpoint:t,snippet:e})),o.newLine(),o.writeNodeStatement(this.callMethod({endpoint:t,snippet:e}))}),i=this.getStyle(r);switch(i){case $.Concise:return a;case $.Full:return this.buildFullCodeBlock({body:a,options:r});default:x(i)}}constructClient({endpoint:t,snippet:e}){return p.codeblock(r=>{r.writeNode(this.context.getRootClientClassReference()),r.write(` ${Nr} = `),r.writeNode(p.TypeLiteral.builder({classReference:this.context.getRootClientClassReference(),parameters:this.getRootClientBuilderArgs({endpoint:t,snippet:e})}))})}buildFullCodeBlock({body:t,options:e}){var i;let r=this.getConfig(e),a=p.class_({name:(i=r.fullStyleClassName)!=null?i:$i,access:p.Access.Public});return a.addMethod(p.method({name:qi,access:p.Access.Public,static_:!0,parameters:[],body:t})),a}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:g.Warning,message:`Auth with ${t.auth.type} configuration is required for this endpoint`}));let a=this.getRootClientBaseUrlArg({baseUrl:e.baseURL,environment:e.environment});return a!=null&&r.push(a),this.context.errors.scope(P.Headers),this.context.ir.headers!=null&&e.headers!=null&&r.push(...this.getRootClientHeaderArgs({headers:this.context.ir.headers,values:e.headers})),this.context.errors.unscope(),r}getRootClientBaseUrlArg({baseUrl:t,environment:e}){var r;if(t!=null&&e!=null){this.context.errors.add({severity:g.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:g.Critical,message:"The Java SDK doesn't support a baseUrl when multiple URL environments are configured"});return}return{name:"url",value:p.TypeLiteral.string(t)}}if(e!=null){if(this.context.isSingleEnvironmentID(e)){let a=this.context.getEnvironmentTypeReferenceFromID(e);if(a==null){this.context.errors.add({severity:g.Warning,message:`Environment ${JSON.stringify(e)} was not found`});return}return{name:"environment",value:p.TypeLiteral.reference(a)}}if(this.context.isMultiEnvironmentValues(e))return this.context.validateMultiEnvironmentUrlValues(e)?{name:"environment",value:p.TypeLiteral.reference(p.instantiateClass({classReference:this.context.getEnvironmentClassReference(),arguments_:Object.values(e).map(a=>this.context.dynamicTypeLiteralMapper.convert({typeReference:Gi,value:a}))}))}:void 0}}getRootClientAuthArgs({auth:t,values:e}){switch(t.type){case"basic":return e.type!=="basic"?(this.context.errors.add({severity:g.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:g.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:g.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:g.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message}),[]):this.getRootClientOAuthArgs({auth:t,values:e});default:x(t)}}getRootClientBasicAuthArgs({auth:t,values:e}){return[{name:"credentials",value:p.TypeLiteral.raw(`"${e.username}", "${e.password}"`)}]}getRootClientBearerAuthArgs({auth:t,values:e}){return[{name:this.context.getMethodName(t.token),value:p.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:p.TypeLiteral.string(e.clientId)},{name:this.context.getMethodName(t.clientSecret),value:p.TypeLiteral.string(e.clientSecret)}]}getRootClientHeaderArgs({headers:t,values:e}){let r=[];for(let a of t){let i=this.getRootClientHeaderArg({header:a,value:e.value});i!=null&&r.push({name:this.context.getMethodName(a.name.name),value:i})}return r}getRootClientHeaderArg({header:t,value:e}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:e});if(!p.TypeLiteral.isNop(r))return r}callMethod({endpoint:t,snippet:e}){return p.invokeMethod({on:p.codeblock(Nr),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:x(t.request)}}getMethodArgsForBodyRequest({request:t,snippet:e}){var i,o;let r=[];this.context.errors.scope(P.PathParameters);let a=[...(i=this.context.ir.pathParameters)!=null?i:[],...(o=t.pathParameters)!=null?o:[]];return a.length>0&&r.push(...this.getPathParameters({namedParameters:a,snippet:e}).map(f=>f.value)),this.context.errors.unscope(),this.context.errors.scope(P.RequestBody),t.body!=null&&r.push(this.getBodyRequestArg({body:t.body,value:e.requestBody})),this.context.errors.unscope(),r}getBodyRequestArg({body:t,value:e}){switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":return t.value.type==="optional"?p.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:x(t)}}getBytesBodyRequestArg({value:t}){return typeof t!="string"?(this.context.errors.add({severity:g.Critical,message:`Expected bytes value to be a string, got ${typeof t}`}),p.TypeLiteral.nop()):p.TypeLiteral.bytes(t)}getMethodArgsForInlinedRequest({request:t,snippet:e}){var f,m;let r=[],a=(m=(f=this.context.customConfig)==null?void 0:f["inline-path-parameters"])!=null?m:!1;this.context.errors.scope(P.PathParameters);let i=[];t.pathParameters!=null&&i.push(...this.getPathParameters({namedParameters:t.pathParameters,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(P.RequestBody);let o=this.getFilePropertyInfo({request:t,snippet:e});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:a})||r.push(...i.map(h=>h.value)),r.push(...o.fileFields.map(h=>h.value)),r.push(this.getInlinedRequestArg({request:t,snippet:e,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:a})?i:[],filePropertyInfo:o})),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:a}){var v,y,b,N;this.context.errors.scope(P.QueryParameters);let o=this.context.associateQueryParametersByWireValue({parameters:(v=t.queryParameters)!=null?v:[],values:(y=e.queryParameters)!=null?y:{}}).map(E=>({name:this.context.getMethodName(E.name.name),value:this.context.dynamicTypeLiteralMapper.convert(E)}));this.context.errors.unscope(),this.context.errors.scope(P.Headers);let m=this.context.associateByWireValue({parameters:(b=t.headers)!=null?b:[],values:(N=e.headers)!=null?N:{}}).map(E=>({name:this.context.getMethodName(E.name.name),value:this.context.dynamicTypeLiteralMapper.convert(E)}));this.context.errors.unscope(),this.context.errors.scope(P.RequestBody);let h=t.body!=null?this.getInlinedRequestBodyBuilderParameters({body:t.body,value:e.requestBody,filePropertyInfo:a}):[];return this.context.errors.unscope(),p.TypeLiteral.builder({classReference:p.classReference({name:this.context.getClassName(t.declaration.name),packageName:this.context.getRequestsPackageName(t.declaration.fernFilepath)}),parameters:[...r,...m,...o,...h]})}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:x(t)}}getFileUploadRequestBodyBuilderParameters({filePropertyInfo:t}){return 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:x(t)}}getInlinedRequestBodyPropertyBuilderParameters({parameters:t,value:e}){var i;let r=[],a=this.context.associateByWireValue({parameters:t,values:(i=this.context.getRecord(e))!=null?i:{}});for(let o of a)r.push({name:this.context.getMethodName(o.name.name),value:this.context.dynamicTypeLiteralMapper.convert(o)});return r}getPathParameters({namedParameters:t,snippet:e}){var i;let r=[],a=this.context.associateByWireValue({parameters:t,values:(i=e.pathParameters)!=null?i:{}});for(let o of a)r.push({name:this.context.getMethodName(o.name.name),value:this.context.dynamicTypeLiteralMapper.convert(o)});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:$.Full}getConfig(t){var e,r;return(r=(e=t.config)!=null?e:this.context.options.config)!=null?r:{}}};u();l();u();l();var Ae=class{constructor({context:t}){c(this,"context");this.context=t}convert(t){if(t.value===null)return this.context.isNullable(t.typeReference)?this.context.getNullableOfNull():(this.context.errors.add({severity:g.Critical,message:"Expected non-null value, but got null"}),p.TypeLiteral.nop());if(t.value===void 0)return p.TypeLiteral.nop();switch(t.typeReference.type){case"list":return this.convertList({list:t.typeReference.value,value:t.value});case"literal":return this.convertLiteral({literal:t.typeReference.value,value:t.value});case"map":return this.convertMap({map:t.typeReference,value:t.value});case"named":{let e=this.context.resolveNamedType({typeId:t.typeReference.value});return e==null?p.TypeLiteral.nop():this.convertNamed({named:e,value:t.value,as:t.as})}case"nullable":case"optional":return p.TypeLiteral.optional({value:this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as}),useOf:t.as==="mapValue"});case"primitive":return this.convertPrimitive({primitive:t.typeReference.value,value:t.value,as:t.as});case"set":return this.convertSet({set:t.typeReference.value,value:t.value});case"unknown":return this.convertUnknown({value:t.value});default:x(t.typeReference)}}convertList({list:t,value:e}){return Array.isArray(e)?p.TypeLiteral.list({valueType:this.context.dynamicTypeMapper.convert({typeReference:t}),values:e.map((r,a)=>{this.context.errors.scope({index:a});try{return this.convert({typeReference:t,value:r})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:g.Critical,message:`Expected array but got: ${typeof e}`}),p.TypeLiteral.nop())}convertLiteral({literal:t,value:e}){switch(t.type){case"boolean":{let r=this.context.getValueAsBoolean({value:e});return r==null?p.TypeLiteral.nop():p.TypeLiteral.boolean(r)}case"string":{let r=this.context.getValueAsString({value:e});return r==null?p.TypeLiteral.nop():p.TypeLiteral.string(r)}default:x(t)}}convertSet({set:t,value:e}){return Array.isArray(e)?p.TypeLiteral.set({valueType:this.context.dynamicTypeMapper.convert({typeReference:t}),values:e.map((r,a)=>{this.context.errors.scope({index:a});try{return this.convert({typeReference:t,value:r})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:g.Critical,message:`Expected array but got: ${typeof e}`}),p.TypeLiteral.nop())}convertMap({map:t,value:e}){return typeof e!="object"||e==null?(this.context.errors.add({severity:g.Critical,message:`Expected object but got: ${e==null?"null":typeof e}`}),p.TypeLiteral.nop()):p.TypeLiteral.map({keyType:this.context.dynamicTypeMapper.convert({typeReference:t.key}),valueType:this.context.dynamicTypeMapper.convert({typeReference:t.value}),entries:Object.entries(e).map(([r,a])=>{this.context.errors.scope(r);try{return{key:this.convert({typeReference:t.key,value:r,as:"mapKey"}),value:this.convert({typeReference:t.value,value:a,as:"mapValue"})}}finally{this.context.errors.unscope()}})})}convertNamed({named:t,value:e,as:r}){switch(t.type){case"alias":return this.convert({typeReference:t.typeReference,value:e,as:r});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:t,value:e});case"enum":return this.convertEnum({enum_:t,value:e});case"object":return this.convertObject({object_:t,value:e,as:r});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e});default:x(t)}}convertDiscriminatedUnion({discriminatedUnion:t,value:e}){let r=this.context.getJavaClassReferenceFromDeclaration({declaration:t.declaration}),a=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e});if(a==null)return p.TypeLiteral.nop();let i=a.singleDiscriminatedUnionType;switch(i.type){case"samePropertiesAsObject":{let o=this.context.resolveNamedType({typeId:i.typeId});return o==null?p.TypeLiteral.nop():p.TypeLiteral.reference(p.invokeMethod({on:r,method:this.context.getPropertyName(i.discriminantValue.name),arguments_:[this.convertNamed({named:o,value:a.value})]}))}case"singleProperty":{let o=this.context.getRecord(a.value);if(o==null)return p.TypeLiteral.nop();try{return this.context.errors.scope(i.discriminantValue.wireValue),p.TypeLiteral.reference(p.invokeMethod({on:r,method:this.context.getPropertyName(i.discriminantValue.name),arguments_:[this.convert({typeReference:i.typeReference,value:o[i.discriminantValue.wireValue]})]}))}finally{this.context.errors.unscope()}}case"noProperties":return p.TypeLiteral.reference(p.invokeMethod({on:r,method:this.context.getPropertyName(i.discriminantValue.name),arguments_:[]}));default:x(i)}}convertObject({object_:t,value:e,as:r}){var i;let a=this.context.associateByWireValue({parameters:t.properties,values:(i=this.context.getRecord(e))!=null?i:{}});return p.TypeLiteral.builder({classReference:this.context.getJavaClassReferenceFromDeclaration({declaration:t.declaration}),parameters:a.map(o=>{this.context.errors.scope(o.name.wireValue);try{return{name:this.context.getMethodName(o.name.name),value:this.convert({typeReference:o.typeReference,value:o.value,as:r})}}finally{this.context.errors.unscope()}})})}convertEnum({enum_:t,value:e}){let r=this.getEnumValueName({enum_:t,value:e});return r==null?p.TypeLiteral.nop():p.TypeLiteral.enum_({classReference:this.context.getJavaClassReferenceFromDeclaration({declaration:t.declaration}),value:r})}getEnumValueName({enum_:t,value:e}){if(typeof e!="string"){this.context.errors.add({severity:g.Critical,message:`Expected enum value string, got: ${typeof e}`});return}let r=t.values.find(a=>a.wireValue===e);if(r==null){this.context.errors.add({severity:g.Critical,message:`An enum value named "${e}" does not exist in this context`});return}return this.context.getEnumName(r.name)}convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e}){let r=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e});if(r==null)return p.TypeLiteral.nop();if(this.context.isPrimitive(r.valueTypeReference))return p.TypeLiteral.reference(p.invokeMethod({on:this.context.getJavaClassReferenceFromDeclaration({declaration:t.declaration}),method:"of",arguments_:[r.typeInstantiation]}));let a=this.getUndiscriminatedUnionFieldName({typeReference:r.valueTypeReference});return a==null?p.TypeLiteral.nop():p.TypeLiteral.reference(p.invokeMethod({on:this.context.getJavaClassReferenceFromDeclaration({declaration:t.declaration}),method:`of${a}`,arguments_:[r.typeInstantiation]}))}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e}){for(let r of t.types)try{let a=this.convert({typeReference:r,value:e});return{valueTypeReference:r,typeInstantiation:a}}catch(a){continue}this.context.errors.add({severity:g.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof e}" value`})}getUndiscriminatedUnionFieldName({typeReference:t}){switch(t.type){case"list":return this.getUndiscriminatedUnionFieldNameForList({list:t});case"literal":return this.getUndiscriminatedUnionFieldNameForLiteral({literal:t.value});case"map":return this.getUndiscriminatedUnionFieldNameForMap({map:t});case"named":{let e=this.context.resolveNamedType({typeId:t.value});return e==null?void 0:this.context.getClassName(e.declaration.name)}case"optional":return this.getUndiscriminatedUnionFieldNameForOptional({typeReference:t});case"nullable":return this.getUndiscriminatedUnionFieldNameForNullable({typeReference:t});case"primitive":return this.getUndiscriminatedUnionFieldNameForPrimitive({primitive:t.value});case"set":return this.getUndiscriminatedUnionFieldNameForSet({set:t});case"unknown":return"Unknown";default:x(t)}}getUndiscriminatedUnionFieldNameForList({list:t}){let e=this.getUndiscriminatedUnionFieldName({typeReference:t});if(e!=null)return`ListOf${e}`}getUndiscriminatedUnionFieldNameForMap({map:t}){let e=this.getUndiscriminatedUnionFieldName({typeReference:t.key});if(e==null)return;let r=this.getUndiscriminatedUnionFieldName({typeReference:t.value});if(r!=null)return`MapOf${e}To${r}`}getUndiscriminatedUnionFieldNameForOptional({typeReference:t}){let e=this.getUndiscriminatedUnionFieldName({typeReference:t});if(e!=null)return`Optional${e}`}getUndiscriminatedUnionFieldNameForNullable({typeReference:t}){let e=this.getUndiscriminatedUnionFieldName({typeReference:t});if(e!=null)return`Nullable${e}`}getUndiscriminatedUnionFieldNameForSet({set:t}){let e=this.getUndiscriminatedUnionFieldName({typeReference:t});if(e!=null)return`SetOf${e}`}getUndiscriminatedUnionFieldNameForLiteral({literal:t}){}getUndiscriminatedUnionFieldNameForPrimitive({primitive:t}){switch(t){case"INTEGER":case"UINT":return"Integer";case"LONG":case"UINT_64":return"Long";case"FLOAT":return"Float";case"DOUBLE":return"Double";case"BOOLEAN":return"Boolean";case"BIG_INTEGER":return"BigInteger";case"STRING":return"String";case"UUID":return"Uuid";case"DATE":return"Date";case"DATE_TIME":return"DateTime";case"BASE_64":return"Base64";default:x(t)}}convertUnknown({value:t}){return p.TypeLiteral.unknown(t)}convertPrimitive({primitive:t,value:e,as:r}){switch(t){case"INTEGER":case"UINT":{let a=this.getValueAsNumber({value:e,as:r});return a==null?p.TypeLiteral.nop():p.TypeLiteral.integer(a)}case"LONG":case"UINT_64":{let a=this.getValueAsNumber({value:e,as:r});return a==null?p.TypeLiteral.nop():p.TypeLiteral.long(a)}case"FLOAT":{let a=this.getValueAsNumber({value:e,as:r});return a==null?p.TypeLiteral.nop():p.TypeLiteral.float(a)}case"DOUBLE":{let a=this.getValueAsNumber({value:e,as:r});return a==null?p.TypeLiteral.nop():p.TypeLiteral.double(a)}case"BOOLEAN":{let a=this.getValueAsBoolean({value:e,as:r});return a==null?p.TypeLiteral.nop():p.TypeLiteral.boolean(a)}case"STRING":{let a=this.context.getValueAsString({value:e});return a==null?p.TypeLiteral.nop():p.TypeLiteral.string(a)}case"DATE":{let a=this.context.getValueAsString({value:e});return a==null?p.TypeLiteral.nop():p.TypeLiteral.string(a)}case"DATE_TIME":{let a=this.context.getValueAsString({value:e});return a==null?p.TypeLiteral.nop():p.TypeLiteral.dateTime(a)}case"UUID":{let a=this.context.getValueAsString({value:e});return a==null?p.TypeLiteral.nop():p.TypeLiteral.uuid(a)}case"BASE_64":{let a=this.context.getValueAsString({value:e});return a==null?p.TypeLiteral.nop():p.TypeLiteral.bytes(a)}case"BIG_INTEGER":{let a=this.context.getValueAsString({value:e});return a==null?p.TypeLiteral.nop():p.TypeLiteral.bigInteger(a)}default:x(t)}}getValueAsNumber({value:t,as:e}){let r=e==="mapKey"&&typeof t=="string"?Number(t):t;return this.context.getValueAsNumber({value:r})}getValueAsBoolean({value:t,as:e}){let r=e==="mapKey"?typeof t=="string"?t==="true":t==="false"?!1:t:t;return this.context.getValueAsBoolean({value:r})}};u();l();var Ie=class{constructor({context:t}){c(this,"context");this.context=t}convert(t){switch(t.typeReference.type){case"list":return p.Type.list(this.convert({typeReference:t.typeReference}));case"literal":return this.convertLiteral({literal:t.typeReference.value});case"map":return p.Type.map(this.convert({typeReference:t.typeReference.key}),this.convert({typeReference:t.typeReference.value}));case"named":{let e=this.context.resolveNamedType({typeId:t.typeReference.value});return e==null?this.convertUnknown():this.convertNamed({named:e})}case"optional":case"nullable":return p.Type.optional(this.convert({typeReference:t.typeReference.value}));case"primitive":return this.convertPrimitive({primitive:t.typeReference.value});case"set":return p.Type.set(this.convert({typeReference:t.typeReference}));case"unknown":return this.convertUnknown();default:x(t.typeReference)}}convertNamed({named:t}){switch(t.type){case"alias":return this.convert({typeReference:t.typeReference});case"enum":case"discriminatedUnion":case"object":case"undiscriminatedUnion":return p.Type.reference(p.classReference({name:this.context.getClassName(t.declaration.name),packageName:this.context.getTypesPackageName(t.declaration.fernFilepath)}));default:x(t)}}convertLiteral({literal:t}){switch(t.type){case"boolean":return p.Type.boolean();case"string":return p.Type.string()}}convertUnknown(){return p.Type.object()}convertPrimitive({primitive:t}){switch(t){case"INTEGER":return p.Type.integer();case"UINT":return p.Type.integer();case"LONG":return p.Type.long();case"UINT_64":return p.Type.long();case"FLOAT":return p.Type.float();case"DOUBLE":return p.Type.double();case"BOOLEAN":return p.Type.boolean();case"STRING":return p.Type.string();case"DATE":return p.Type.date();case"DATE_TIME":return p.Type.dateTime();case"UUID":return p.Type.uuid();case"BASE_64":return p.Type.bytes();case"BIG_INTEGER":return p.Type.bigInteger();default:x(t)}}};u();l();var Ee=class{constructor({context:t}){c(this,"context");this.context=t}getFilePropertyInfo({body:t,value:e}){var i;let r={fileFields:[],bodyPropertyFields:[]},a=(i=this.context.getRecord(e))!=null?i:{};for(let o of t.properties)switch(o.type){case"file":r.fileFields.push({name:this.context.getMethodName(o.name),value:this.getSingleFileProperty({property:o,record:a})});break;case"fileArray":r.fileFields.push({name:this.context.getMethodName(o.name),value:this.getArrayFileProperty({property:o,record:a})});break;case"bodyProperty":r.bodyPropertyFields.push({name:this.context.getMethodName(o.name.name),value:this.getBodyProperty({property:o,record:a})});break;default:x(o)}return r}getSingleFileProperty({property:t,record:e}){let r=this.context.getSingleFileValue({property:t,record:e});return r==null?p.TypeLiteral.nop():p.TypeLiteral.reference(this.context.getFileStreamFromString(r))}getArrayFileProperty({property:t,record:e}){let r=this.context.getFileArrayValues({property:t,record:e});if(r==null)return p.TypeLiteral.nop();for(let a of r)return p.TypeLiteral.reference(this.context.getFileStreamFromString(a));return p.TypeLiteral.nop()}getBodyProperty({property:t,record:e}){let r=e[t.name.wireValue];return r==null?p.TypeLiteral.nop():this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:r})}};var Yi=new Set(["enum","extends","package","void","short","class","abstract","return","import","for","assert","switch","getClass"]),Ce=class n extends ue{constructor({ir:e,config:r,options:a}){super({ir:e,config:r,options:a});c(this,"ir");c(this,"customConfig");c(this,"dynamicTypeMapper");c(this,"dynamicTypeLiteralMapper");c(this,"filePropertyMapper");this.ir=e,this.customConfig=r.customConfig!=null?r.customConfig:void 0,this.dynamicTypeMapper=new Ie({context:this}),this.dynamicTypeLiteralMapper=new Ae({context:this}),this.filePropertyMapper=new Ee({context:this})}clone(){return new n({ir:this.ir,config:this.config,options:this.options})}getClassName(e){return this.getName(e.pascalCase.safeName)}getEnumName(e){return this.getName(e.screamingSnakeCase.safeName)}getPropertyName(e){return this.getName(e.camelCase.safeName)}getMethodName(e){return this.getName(e.camelCase.safeName)}getRootClientClassReference(){return p.classReference({name:this.getRootClientClassName(),packageName:this.getRootPackageName()})}getRootClientClassName(){var e,r;return(r=(e=this.customConfig)==null?void 0:e["client-class-name"])!=null?r:`${this.getBaseNamePrefix()}Client`}getEnvironmentClassName(){return"Environment"}getEnvironmentTypeReferenceFromID(e){let r=this.resolveEnvironmentName(e);if(r!=null)return this.getEnvironmentClassReferenceForEnumName(r)}getEnvironmentClassReference(){return p.classReference({name:this.getEnvironmentClassName(),packageName:this.getCorePackageName()})}getEnvironmentClassReferenceForEnumName(e){return p.classReference({name:`${this.getEnvironmentClassName()}.${this.getEnumName(e)}`,packageName:this.getCorePackageName()})}getJavaClassReferenceFromDeclaration({declaration:e}){return p.classReference({name:e.name.pascalCase.unsafeName,packageName:this.getTypesPackageName(e.fernFilepath)})}getNullableClassReference(){return p.classReference({name:"Nullable",packageName:this.getCorePackageName()})}getNullableOfNull(){return p.TypeLiteral.reference(p.invokeMethod({on:this.getNullableClassReference(),method:"ofNull",arguments_:[]}))}getFileStreamFromString(e){return p.TypeLiteral.reference(p.codeblock(r=>{r.write("new "),r.writeNode(this.getFileStreamClassReference()),r.write("("),r.writeNode(this.getByteArrayInputStreamClassReference()),r.write("("),r.writeNode(p.TypeLiteral.string(e)),r.write(".getBytes("),r.writeNode(this.getStandardCharsetsClassReference()),r.write(".UTF_8)))")}))}getFileStreamClassReference(){return p.classReference({name:"FileStream",packageName:this.getCorePackageName()})}getByteArrayInputStreamClassReference(){return p.classReference({name:"ByteArrayInputStream",packageName:"java.io"})}getStandardCharsetsClassReference(){return p.classReference({name:"StandardCharsets",packageName:"java.nio.charset"})}isPrimitive(e){switch(e.type){case"primitive":return!0;case"optional":case"nullable":return this.isPrimitive(e.value);case"named":{let r=this.resolveNamedType({typeId:e.value});if(r==null)return!1;switch(r.type){case"alias":return this.isPrimitive(r.typeReference);case"discriminatedUnion":case"undiscriminatedUnion":case"object":case"enum":return!1;default:x(r)}break}case"list":case"set":case"map":case"literal":case"unknown":return!1;default:x(e)}}getRootPackageName(){let e=this.getPackagePrefixTokens();return this.joinPackageTokens(e)}getCorePackageName(){let e=this.getPackagePrefixTokens();return e.push("core"),this.joinPackageTokens(e)}getTypesPackageName(e){return this.getResourcesPackage(e,"types")}getRequestsPackageName(e){return this.getPackageLayout()==="flat"?this.getTypesPackageName(e):this.getResourcesPackage(e,"requests")}getResourcesPackage(e,r){let a=this.getPackagePrefixTokens();switch(this.getPackageLayout()){case"flat":e!=null&&a.push(...e.packagePath.map(i=>this.getPackageNameSegment(i)));break;case"nested":default:e!=null&&e.allParts.length>0&&a.push("resources"),e!=null&&a.push(...e.allParts.map(i=>this.getPackageNameSegment(i)))}return r!=null&&a.push(r),this.joinPackageTokens(a)}getPackageName(e,r){let a=this.getPackageNameSegments(e);return a=r!=null?[...a,r]:a,[...this.getPackagePrefixTokens(),...a].join(".")}getPackageLayout(){var e,r;return(r=(e=this.customConfig)==null?void 0:e["package-layout"])!=null?r:"nested"}getPackageNameSegments(e){return e.packagePath.map(r=>this.getPackageNameSegment(r))}getPackageNameSegment(e){return e.camelCase.safeName.toLowerCase()}getPackagePrefixTokens(){var r;if(((r=this.customConfig)==null?void 0:r["package-prefix"])!=null)return this.customConfig["package-prefix"].split(".");let e=[];return e.push("com"),e.push(...this.splitOnNonAlphaNumericChar(this.config.organization)),e.push(...this.splitOnNonAlphaNumericChar(this.getApiName())),e}getBaseNamePrefix(){return this.convertKebabCaseToUpperCamelCase(this.config.organization)+this.convertKebabCaseToUpperCamelCase(this.getApiName())}getApiName(){return je(this.config.workspaceName)}startsWithNumber(e){return/^\d/.test(e)}splitOnNonAlphaNumericChar(e){return e.split(/[^a-zA-Z0-9]/)}convertKebabCaseToUpperCamelCase(e){return e.replace(/-([a-z])/g,(r,a)=>a.toUpperCase()).replace(/^[a-z]/,r=>r.toUpperCase())}joinPackageTokens(e){return e.map(a=>this.startsWithNumber(a)?"_"+a:a).join(".")}getName(e){return this.isReservedName(e)?"_"+e:e}isReservedName(e){return Yi.has(e)}};var qe=class extends ie{constructor({ir:e,config:r,options:a={}}){super(new Ce({ir:e,config:r,options:a}));c(this,"formatter")}async generate(e,r={}){return super.generate(e,r)}generateSync(e,r={}){return super.generateSync(e,r)}createSnippetGenerator(e){return new be({context:e})}};0&&(module.exports={DynamicSnippetsGenerator});
|
|
16
|
+
/*! Bundled license information:
|
|
17
|
+
|
|
18
|
+
@esbuild-plugins/node-globals-polyfill/Buffer.js:
|
|
19
|
+
(*!
|
|
20
|
+
* The buffer module from node.js, for the browser.
|
|
21
|
+
*
|
|
22
|
+
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|
23
|
+
* @license MIT
|
|
24
|
+
*)
|
|
25
|
+
|
|
26
|
+
lodash-es/lodash.js:
|
|
27
|
+
(**
|
|
28
|
+
* @license
|
|
29
|
+
* Lodash (Custom Build) <https://lodash.com/>
|
|
30
|
+
* Build: `lodash modularize exports="es" -o ./`
|
|
31
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
32
|
+
* Released under MIT license <https://lodash.com/license>
|
|
33
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
34
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
35
|
+
*)
|
|
36
|
+
*/
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AbstractDynamicSnippetsGenerator, FernGeneratorExec, Options } from '@fern-api/browser-compatible-base-generator';
|
|
2
|
+
import { FernIr } from '@fern-api/dynamic-ir-sdk';
|
|
3
|
+
import { EndpointSnippetGenerator } from './EndpointSnippetGenerator.cjs';
|
|
4
|
+
import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-CjKFdkU7.cjs';
|
|
5
|
+
import '@fern-api/java-ast';
|
|
6
|
+
|
|
7
|
+
declare class DynamicSnippetsGenerator extends AbstractDynamicSnippetsGenerator<DynamicSnippetsGeneratorContext, EndpointSnippetGenerator> {
|
|
8
|
+
private formatter;
|
|
9
|
+
constructor({ ir, config, options }: {
|
|
10
|
+
ir: FernIr.dynamic.DynamicIntermediateRepresentation;
|
|
11
|
+
config: FernGeneratorExec.GeneratorConfig;
|
|
12
|
+
options?: Options;
|
|
13
|
+
});
|
|
14
|
+
generate(request: FernIr.dynamic.EndpointSnippetRequest, options?: Options): Promise<FernIr.dynamic.EndpointSnippetResponse>;
|
|
15
|
+
generateSync(request: FernIr.dynamic.EndpointSnippetRequest, options?: Options): FernIr.dynamic.EndpointSnippetResponse;
|
|
16
|
+
protected createSnippetGenerator(context: DynamicSnippetsGeneratorContext): EndpointSnippetGenerator;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { DynamicSnippetsGenerator };
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { AbstractDynamicSnippetsGeneratorContext, FernGeneratorExec, Options } from '@fern-api/browser-compatible-base-generator';
|
|
2
|
+
import { FernIr } from '@fern-api/dynamic-ir-sdk';
|
|
3
|
+
import { java, BaseJavaCustomConfigSchema } from '@fern-api/java-ast';
|
|
4
|
+
|
|
5
|
+
declare namespace DynamicTypeLiteralMapper {
|
|
6
|
+
interface Args {
|
|
7
|
+
typeReference: FernIr.dynamic.TypeReference;
|
|
8
|
+
value: unknown;
|
|
9
|
+
as?: ConvertedAs;
|
|
10
|
+
}
|
|
11
|
+
type ConvertedAs = "mapKey" | "mapValue";
|
|
12
|
+
}
|
|
13
|
+
declare class DynamicTypeLiteralMapper {
|
|
14
|
+
private context;
|
|
15
|
+
constructor({ context }: {
|
|
16
|
+
context: DynamicSnippetsGeneratorContext;
|
|
17
|
+
});
|
|
18
|
+
convert(args: DynamicTypeLiteralMapper.Args): java.TypeLiteral;
|
|
19
|
+
private convertList;
|
|
20
|
+
private convertLiteral;
|
|
21
|
+
private convertSet;
|
|
22
|
+
private convertMap;
|
|
23
|
+
private convertNamed;
|
|
24
|
+
private convertDiscriminatedUnion;
|
|
25
|
+
private convertObject;
|
|
26
|
+
private convertEnum;
|
|
27
|
+
private getEnumValueName;
|
|
28
|
+
private convertUndiscriminatedUnion;
|
|
29
|
+
private findMatchingUndiscriminatedUnionType;
|
|
30
|
+
private getUndiscriminatedUnionFieldName;
|
|
31
|
+
private getUndiscriminatedUnionFieldNameForList;
|
|
32
|
+
private getUndiscriminatedUnionFieldNameForMap;
|
|
33
|
+
private getUndiscriminatedUnionFieldNameForOptional;
|
|
34
|
+
private getUndiscriminatedUnionFieldNameForNullable;
|
|
35
|
+
private getUndiscriminatedUnionFieldNameForSet;
|
|
36
|
+
private getUndiscriminatedUnionFieldNameForLiteral;
|
|
37
|
+
private getUndiscriminatedUnionFieldNameForPrimitive;
|
|
38
|
+
private convertUnknown;
|
|
39
|
+
private convertPrimitive;
|
|
40
|
+
private getValueAsNumber;
|
|
41
|
+
private getValueAsBoolean;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
declare namespace DynamicTypeMapper {
|
|
45
|
+
interface Args {
|
|
46
|
+
typeReference: FernIr.dynamic.TypeReference;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
declare class DynamicTypeMapper {
|
|
50
|
+
private context;
|
|
51
|
+
constructor({ context }: {
|
|
52
|
+
context: DynamicSnippetsGeneratorContext;
|
|
53
|
+
});
|
|
54
|
+
convert(args: DynamicTypeMapper.Args): java.Type;
|
|
55
|
+
private convertNamed;
|
|
56
|
+
private convertLiteral;
|
|
57
|
+
private convertUnknown;
|
|
58
|
+
private convertPrimitive;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
interface FilePropertyInfo {
|
|
62
|
+
fileFields: java.BuilderParameter[];
|
|
63
|
+
bodyPropertyFields: java.BuilderParameter[];
|
|
64
|
+
}
|
|
65
|
+
declare class FilePropertyMapper {
|
|
66
|
+
private context;
|
|
67
|
+
constructor({ context }: {
|
|
68
|
+
context: DynamicSnippetsGeneratorContext;
|
|
69
|
+
});
|
|
70
|
+
getFilePropertyInfo({ body, value }: {
|
|
71
|
+
body: FernIr.dynamic.FileUploadRequestBody;
|
|
72
|
+
value: unknown;
|
|
73
|
+
}): FilePropertyInfo;
|
|
74
|
+
private getSingleFileProperty;
|
|
75
|
+
private getArrayFileProperty;
|
|
76
|
+
private getBodyProperty;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
declare class DynamicSnippetsGeneratorContext extends AbstractDynamicSnippetsGeneratorContext {
|
|
80
|
+
ir: FernIr.dynamic.DynamicIntermediateRepresentation;
|
|
81
|
+
customConfig: BaseJavaCustomConfigSchema | undefined;
|
|
82
|
+
dynamicTypeMapper: DynamicTypeMapper;
|
|
83
|
+
dynamicTypeLiteralMapper: DynamicTypeLiteralMapper;
|
|
84
|
+
filePropertyMapper: FilePropertyMapper;
|
|
85
|
+
constructor({ ir, config, options }: {
|
|
86
|
+
ir: FernIr.dynamic.DynamicIntermediateRepresentation;
|
|
87
|
+
config: FernGeneratorExec.GeneratorConfig;
|
|
88
|
+
options?: Options;
|
|
89
|
+
});
|
|
90
|
+
clone(): DynamicSnippetsGeneratorContext;
|
|
91
|
+
getClassName(name: FernIr.Name): string;
|
|
92
|
+
getEnumName(name: FernIr.Name): string;
|
|
93
|
+
getPropertyName(name: FernIr.Name): string;
|
|
94
|
+
getMethodName(name: FernIr.Name): string;
|
|
95
|
+
getRootClientClassReference(): java.ClassReference;
|
|
96
|
+
getRootClientClassName(): string;
|
|
97
|
+
getEnvironmentClassName(): string;
|
|
98
|
+
getEnvironmentTypeReferenceFromID(environmentID: string): java.ClassReference | undefined;
|
|
99
|
+
getEnvironmentClassReference(): java.ClassReference;
|
|
100
|
+
private getEnvironmentClassReferenceForEnumName;
|
|
101
|
+
getJavaClassReferenceFromDeclaration({ declaration }: {
|
|
102
|
+
declaration: FernIr.dynamic.Declaration;
|
|
103
|
+
}): java.ClassReference;
|
|
104
|
+
getNullableClassReference(): java.ClassReference;
|
|
105
|
+
getNullableOfNull(): java.TypeLiteral;
|
|
106
|
+
getFileStreamFromString(content: string): java.TypeLiteral;
|
|
107
|
+
getFileStreamClassReference(): java.ClassReference;
|
|
108
|
+
getByteArrayInputStreamClassReference(): java.ClassReference;
|
|
109
|
+
getStandardCharsetsClassReference(): java.ClassReference;
|
|
110
|
+
isPrimitive(typeReference: FernIr.dynamic.TypeReference): boolean;
|
|
111
|
+
getRootPackageName(): string;
|
|
112
|
+
getCorePackageName(): string;
|
|
113
|
+
getTypesPackageName(fernFilepath: FernIr.FernFilepath): string;
|
|
114
|
+
getRequestsPackageName(fernFilepath: FernIr.FernFilepath): string;
|
|
115
|
+
protected getResourcesPackage(fernFilepath: FernIr.FernFilepath, suffix?: string): string;
|
|
116
|
+
getPackageName(fernFilepath: FernIr.FernFilepath, suffix?: string): string;
|
|
117
|
+
getPackageLayout(): string;
|
|
118
|
+
private getPackageNameSegments;
|
|
119
|
+
private getPackageNameSegment;
|
|
120
|
+
private getPackagePrefixTokens;
|
|
121
|
+
private getBaseNamePrefix;
|
|
122
|
+
private getApiName;
|
|
123
|
+
private startsWithNumber;
|
|
124
|
+
private splitOnNonAlphaNumericChar;
|
|
125
|
+
private convertKebabCaseToUpperCamelCase;
|
|
126
|
+
private joinPackageTokens;
|
|
127
|
+
private getName;
|
|
128
|
+
private isReservedName;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export { DynamicSnippetsGeneratorContext as D, type FilePropertyInfo as F, DynamicTypeLiteralMapper as a, DynamicTypeMapper as b, FilePropertyMapper as c };
|