@fern-api/java-dynamic-snippets 0.0.2 → 0.0.3

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.
@@ -1,8 +1,8 @@
1
- "use strict";var ce=Object.defineProperty,Ar=Object.defineProperties,Ir=Object.getOwnPropertyDescriptor,Er=Object.getOwnPropertyDescriptors,Cr=Object.getOwnPropertyNames,fe=Object.getOwnPropertySymbols;var ke=Object.prototype.hasOwnProperty,Ge=Object.prototype.propertyIsEnumerable;var Pe=(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={}))ke.call(t,e)&&Pe(n,e,t[e]);if(fe)for(var e of fe(t))Ge.call(t,e)&&Pe(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)ke.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 Le=(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})},Pr=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Cr(t))!ke.call(n,a)&&a!==e&&ce(n,a,{get:()=>t[a],enumerable:!(r=Ir(t,a))||r.enumerable});return n};var kr=n=>Pr(ce({},"__esModule",{value:!0}),n);var c=(n,t,e)=>Pe(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 Lr(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 Sr(){!X||!_||(X=!1,_.length?F=_.concat(F):de=-1,F.length&&tt())}function tt(){if(!X){var n=et(Sr);X=!0;for(var t=F.length;t;){for(_=F,F=[];++de<t;)_&&_[de].run();de=-1,t=F.length}_=null,X=!1,Lr(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=Le(()=>{"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)P[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 P[n>>18&63]+P[n>>12&63]+P[n>>6&63]+P[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+=P[t>>2],a+=P[t<<4&63],a+="=="):r===2&&(t=(n[e-2]<<8)+n[e-1],a+=P[t>>10],a+=P[t>>4&63],a+=P[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 Se(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=Se(n,t),n}function cn(n,t){if(k(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"||Ln(t.length)?U(n,0):Se(n,t);if(t.type==="Buffer"&&Array.isArray(t.data))return Se(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 k(n){return!!(n!=null&&n._isBuffer)}function lt(n,t){if(k(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)),k(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 y;if(a){var v=-1;for(y=e;y<o;y++)if(m(n,y)===m(t,v===-1?0:y-v)){if(v===-1&&(v=y),y-v+1===f)return v*i}else v!==-1&&(y-=y-v),v=-1}else for(e+f>o&&(e=o-f),y=e;y>=0;y--){for(var h=!0,b=0;b<f;b++)if(m(n,y+b)!==m(t,b)){h=!1;break}if(h)return y}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(Pn(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(kn(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,y,v,h;switch(f){case 1:i<128&&(o=i);break;case 2:m=n[a+1],(m&192)===128&&(h=(i&31)<<6|m&63,h>127&&(o=h));break;case 3:m=n[a+1],y=n[a+2],(m&192)===128&&(y&192)===128&&(h=(i&15)<<12|(m&63)<<6|y&63,h>2047&&(h<55296||h>57343)&&(o=h));break;case 4:m=n[a+1],y=n[a+2],v=n[a+3],(m&192)===128&&(y&192)===128&&(v&192)===128&&(h=(i&15)<<18|(m&63)<<12|(y&63)<<6|v&63,h>65535&&h<1114112&&(o=h))}}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(!k(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 Pn(n){for(var t=[],e=0;e<n.length;++e)t.push(n.charCodeAt(e)&255);return t}function kn(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 Ln(n){return n!==n}function Sn(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,y=m>>1,v=-7,h=e?a-1:0,b=e?-1:1,N=n[t+h];for(h+=b,i=N&(1<<-v)-1,N>>=-v,v+=f;v>0;i=i*256+n[t+h],h+=b,v-=8);for(o=i&(1<<-v)-1,i>>=-v,v+=r;v>0;o=o*256+n[t+h],h+=b,v-=8);if(i===0)i=1-y;else{if(i===m)return o?NaN:(N?-1:1)*(1/0);o=o+Math.pow(2,r),i=i-y}return(N?-1:1)*o*Math.pow(2,i-r)}function gt(n,t,e,r,a,i){var o,f,m,y=i*8-a-1,v=(1<<y)-1,h=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+h>=1?t+=b/m:t+=b*Math.pow(2,1-h),t*m>=2&&(o++,m/=2),o+h>=v?(f=0,o=v):o+h>=1?(f=(t*m-1)*Math.pow(2,a),o=o+h):(f=t*Math.pow(2,h-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,y+=a;y>0;n[e+N]=o&255,N+=E,o/=256,y-=8);n[e+N-E]|=br*128}var P,C,an,Fe,it,An,vt=Le(()=>{"use strict";u();l();P=[],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=Sn;s.compare=function(t,e){if(!k(t)||!k(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(!k(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(!k(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(!k(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),y=this.slice(a,i),v=t.slice(e,r),h=0;h<m;++h)if(y[h]!==v[h]){o=y[h],f=v[h];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=k(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=Le(()=>{"use strict";vt()});var zi={};Ze(zi,{DynamicSnippetsGenerator:()=>qe});module.exports=kr(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 Pt=Zn;u();l();var Kn=Array.isArray,kt=Kn;var Xn=1/0,Lt=B?B.prototype:void 0,St=Lt?Lt.toString:void 0;function Ft(n){if(typeof n=="string")return n;if(kt(n))return Pt(n,Ft)+"";if(Ct(n))return St?St.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 Pa(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=Pa;u();l();u();l();u();l();function ka(n){return function(t){return n==null?void 0:n[t]}}var Zt=ka;var La={\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"},Sa=Zt(La),Kt=Sa;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 L=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(`
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 Pe=(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)&&Pe(n,e,t[e]);if(fe)for(var e of fe(t))Ge.call(t,e)&&Pe(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 ke=(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})},Pr=(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=>Pr(ce({},"__esModule",{value:!0}),n);var c=(n,t,e)=>Pe(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 kr(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 Sr(){!X||!_||(X=!1,_.length?F=_.concat(F):de=-1,F.length&&tt())}function tt(){if(!X){var n=et(Sr);X=!0;for(var t=F.length;t;){for(_=F,F=[];++de<t;)_&&_[de].run();de=-1,t=F.length}_=null,X=!1,kr(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=ke(()=>{"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)P[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 P[n>>18&63]+P[n>>12&63]+P[n>>6&63]+P[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+=P[t>>2],a+=P[t<<4&63],a+="=="):r===2&&(t=(n[e-2]<<8)+n[e-1],a+=P[t>>10],a+=P[t>>4&63],a+=P[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 Se(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=Se(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"||kn(t.length)?U(n,0):Se(n,t);if(t.type==="Buffer"&&Array.isArray(t.data))return Se(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 y;if(a){var v=-1;for(y=e;y<o;y++)if(m(n,y)===m(t,v===-1?0:y-v)){if(v===-1&&(v=y),y-v+1===f)return v*i}else v!==-1&&(y-=y-v),v=-1}else for(e+f>o&&(e=o-f),y=e;y>=0;y--){for(var h=!0,b=0;b<f;b++)if(m(n,y+b)!==m(t,b)){h=!1;break}if(h)return y}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(Pn(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,y,v,h;switch(f){case 1:i<128&&(o=i);break;case 2:m=n[a+1],(m&192)===128&&(h=(i&31)<<6|m&63,h>127&&(o=h));break;case 3:m=n[a+1],y=n[a+2],(m&192)===128&&(y&192)===128&&(h=(i&15)<<12|(m&63)<<6|y&63,h>2047&&(h<55296||h>57343)&&(o=h));break;case 4:m=n[a+1],y=n[a+2],v=n[a+3],(m&192)===128&&(y&192)===128&&(v&192)===128&&(h=(i&15)<<18|(m&63)<<12|(y&63)<<6|v&63,h>65535&&h<1114112&&(o=h))}}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 Pn(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 kn(n){return n!==n}function Sn(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,y=m>>1,v=-7,h=e?a-1:0,b=e?-1:1,N=n[t+h];for(h+=b,i=N&(1<<-v)-1,N>>=-v,v+=f;v>0;i=i*256+n[t+h],h+=b,v-=8);for(o=i&(1<<-v)-1,i>>=-v,v+=r;v>0;o=o*256+n[t+h],h+=b,v-=8);if(i===0)i=1-y;else{if(i===m)return o?NaN:(N?-1:1)*(1/0);o=o+Math.pow(2,r),i=i-y}return(N?-1:1)*o*Math.pow(2,i-r)}function gt(n,t,e,r,a,i){var o,f,m,y=i*8-a-1,v=(1<<y)-1,h=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+h>=1?t+=b/m:t+=b*Math.pow(2,1-h),t*m>=2&&(o++,m/=2),o+h>=v?(f=0,o=v):o+h>=1?(f=(t*m-1)*Math.pow(2,a),o=o+h):(f=t*Math.pow(2,h-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,y+=a;y>0;n[e+N]=o&255,N+=E,o/=256,y-=8);n[e+N-E]|=br*128}var P,C,an,Fe,it,An,vt=ke(()=>{"use strict";u();l();P=[],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=Sn;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),y=this.slice(a,i),v=t.slice(e,r),h=0;h<m;++h)if(y[h]!==v[h]){o=y[h],f=v[h];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=ke(()=>{"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 Pt=Zn;u();l();var Kn=Array.isArray,Lt=Kn;var Xn=1/0,kt=B?B.prototype:void 0,St=kt?kt.toString:void 0;function Ft(n){if(typeof n=="string")return n;if(Lt(n))return Pt(n,Ft)+"";if(Ct(n))return St?St.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 Pa(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=Pa;u();l();u();l();u();l();function La(n){return function(t){return n==null?void 0:n[t]}}var Zt=La;var ka={\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"},Sa=Zt(ka),Kt=Sa;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 k=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
2
  `),r=e?t.substring(0,t.length-1):t,a=this.getIndentString(),i=r.replaceAll(`
3
3
  `,`
4
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 L(t).write(this),this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(t,e){new L(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 L(t).write(this),this.write(" ("),this.writeNode(e),this.write(") {"),this.writeNewLineIfLastLineNot(),this.indent()}alternativeControlFlow(t){this.dedent(),this.write("} "),new L(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(`
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 k(t).write(this),this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(t,e){new k(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 k(t).write(this),this.write(" ("),this.writeNode(e),this.write(") {"),this.writeNewLineIfLastLineNot(),this.indent()}alternativeControlFlow(t){this.dedent(),this.write("} "),new k(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
6
  `)}writeSemicolonIfLastCharacterIsNot(){this.lastCharacterIsSemicolon||this.writeInternal(";")}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
7
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
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 y=r,{[a]:f}=y,m=Je(y,[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 S={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}
@@ -12,7 +12,7 @@ ${t}`)}return t}getContent(){let t=`package ${this.packageName};
12
12
  `,e=this.stringifyImports();return e.length>0?`${t}${e}
13
13
 
14
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(Li({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=ki({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=Si({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:Pi,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"}),Pi=new w({name:"UUID",packageName:"java.util"});function ki({parameters:n}){return n.filter(t=>!I.isNop(t.value))}function Li({parameters:n}){return n.filter(t=>!I.isNop(t.value))}function Si({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 L(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(S.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(S.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(S.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}){let r=[],{inlinePathParameters:a,inlineFileProperties:i}={inlinePathParameters:this.context.shouldInlinePathParameters(),inlineFileProperties:this.context.shouldInlineFileProperties()};this.context.errors.scope(S.PathParameters);let o=[];t.pathParameters!=null&&o.push(...this.getPathParameters({namedParameters:t.pathParameters,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(S.RequestBody);let f=this.getFilePropertyInfo({request:t,snippet:e});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:a})||r.push(...o.map(m=>m.value)),i||r.push(...f.fileFields.map(m=>m.value)),r.push(this.getInlinedRequestArg({request:t,snippet:e,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:a})?o:[],filePropertyInfo:f})),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,h,b,N;this.context.errors.scope(S.QueryParameters);let o=this.context.associateQueryParametersByWireValue({parameters:(v=t.queryParameters)!=null?v:[],values:(h=e.queryParameters)!=null?h:{}}).map(E=>({name:this.context.getMethodName(E.name.name),value:this.context.dynamicTypeLiteralMapper.convert(E)}));this.context.errors.unscope(),this.context.errors.scope(S.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(S.RequestBody);let y=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,...y]})}getInlinedRequestBodyBuilderParameters({body:t,value:e,filePropertyInfo:r}){switch(t.type){case"properties":return this.getInlinedRequestBodyPropertyBuilderParameters({parameters:t.value,value:e});case"referenced":return[this.getReferencedRequestBodyPropertyBuilderParameter({body:t,value:e})];case"fileUpload":return this.getFileUploadRequestBodyBuilderParameters({filePropertyInfo:r});default:x(t)}}getFileUploadRequestBodyBuilderParameters({filePropertyInfo:t}){return this.context.shouldInlineFileProperties()?[...t.fileFields,...t.bodyPropertyFields]:t.bodyPropertyFields}getReferencedRequestBodyPropertyBuilderParameter({body:t,value:e}){return{name:this.context.getMethodName(t.bodyKey),value:this.getReferencedRequestBodyPropertyTypeLiteral({body:t.bodyType,value:e})}}getReferencedRequestBodyPropertyTypeLiteral({body:t,value:e}){switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:t.value,value:e});default: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"}shouldInlinePathParameters(){var e,r;return(r=(e=this.customConfig)==null?void 0:e["inline-path-parameters"])!=null?r:!1}shouldInlineFileProperties(){var e,r;return(r=(e=this.customConfig)==null?void 0:e["inline-file-properties"])!=null?r:!1}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});
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(ki({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=Si({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:Pi,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"}),Pi=new w({name:"UUID",packageName:"java.util"});function Li({parameters:n}){return n.filter(t=>!I.isNop(t.value))}function ki({parameters:n}){return n.filter(t=>!I.isNop(t.value))}function Si({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 k(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(S.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(S.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(S.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}){let r=[],{inlinePathParameters:a,inlineFileProperties:i}={inlinePathParameters:this.context.shouldInlinePathParameters(),inlineFileProperties:this.context.shouldInlineFileProperties()};this.context.errors.scope(S.PathParameters);let o=[];t.pathParameters!=null&&o.push(...this.getPathParameters({namedParameters:t.pathParameters,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(S.RequestBody);let f=this.getFilePropertyInfo({request:t,snippet:e});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:a})||r.push(...o.map(m=>m.value)),i||r.push(...f.fileFields.map(m=>m.value)),r.push(this.getInlinedRequestArg({request:t,snippet:e,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:a})?o:[],filePropertyInfo:f})),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,h,b,N;this.context.errors.scope(S.QueryParameters);let o=this.context.associateQueryParametersByWireValue({parameters:(v=t.queryParameters)!=null?v:[],values:(h=e.queryParameters)!=null?h:{}}).map(E=>({name:this.context.getMethodName(E.name.name),value:this.context.dynamicTypeLiteralMapper.convert(E)}));this.context.errors.unscope(),this.context.errors.scope(S.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(S.RequestBody);let y=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,...y]})}getInlinedRequestBodyBuilderParameters({body:t,value:e,filePropertyInfo:r}){switch(t.type){case"properties":return this.getInlinedRequestBodyPropertyBuilderParameters({parameters:t.value,value:e});case"referenced":return[this.getReferencedRequestBodyPropertyBuilderParameter({body:t,value:e})];case"fileUpload":return this.getFileUploadRequestBodyBuilderParameters({filePropertyInfo:r});default:x(t)}}getFileUploadRequestBodyBuilderParameters({filePropertyInfo:t}){return this.context.shouldInlineFileProperties()?[...t.fileFields,...t.bodyPropertyFields]:t.bodyPropertyFields}getReferencedRequestBodyPropertyBuilderParameter({body:t,value:e}){return{name:this.context.getMethodName(t.bodyKey),value:this.getReferencedRequestBodyPropertyTypeLiteral({body:t.bodyType,value:e})}}getReferencedRequestBodyPropertyTypeLiteral({body:t,value:e}){switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:t.value,value:e});default: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 p.codeblock(a=>{a.writeNode(this.getEnvironmentClassReference()),a.write("."),a.write(this.getEnumName(r))})}getEnvironmentClassReference(){return p.classReference({name:this.getEnvironmentClassName(),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"}shouldInlinePathParameters(){var e,r;return(r=(e=this.customConfig)==null?void 0:e["inline-path-parameters"])!=null?r:!1}shouldInlineFileProperties(){var e,r;return(r=(e=this.customConfig)==null?void 0:e["inline-file-properties"])!=null?r:!1}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
16
  /*! Bundled license information:
17
17
 
18
18
  @esbuild-plugins/node-globals-polyfill/Buffer.js:
@@ -1,7 +1,7 @@
1
1
  import { AbstractDynamicSnippetsGenerator, FernGeneratorExec, Options } from '@fern-api/browser-compatible-base-generator';
2
2
  import { FernIr } from '@fern-api/dynamic-ir-sdk';
3
3
  import { EndpointSnippetGenerator } from './EndpointSnippetGenerator.cjs';
4
- import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-D5kyHx_O.cjs';
4
+ import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-B2BA5MLv.cjs';
5
5
  import '@fern-api/java-ast';
6
6
 
7
7
  declare class DynamicSnippetsGenerator extends AbstractDynamicSnippetsGenerator<DynamicSnippetsGeneratorContext, EndpointSnippetGenerator> {
@@ -95,9 +95,8 @@ declare class DynamicSnippetsGeneratorContext extends AbstractDynamicSnippetsGen
95
95
  getRootClientClassReference(): java.ClassReference;
96
96
  getRootClientClassName(): string;
97
97
  getEnvironmentClassName(): string;
98
- getEnvironmentTypeReferenceFromID(environmentID: string): java.ClassReference | undefined;
98
+ getEnvironmentTypeReferenceFromID(environmentID: string): java.AstNode | undefined;
99
99
  getEnvironmentClassReference(): java.ClassReference;
100
- private getEnvironmentClassReferenceForEnumName;
101
100
  getJavaClassReferenceFromDeclaration({ declaration }: {
102
101
  declaration: FernIr.dynamic.Declaration;
103
102
  }): java.ClassReference;
@@ -1,6 +1,6 @@
1
1
  import { AbstractFormatter, Options } from '@fern-api/browser-compatible-base-generator';
2
2
  import { FernIr } from '@fern-api/dynamic-ir-sdk';
3
- import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-D5kyHx_O.cjs';
3
+ import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-B2BA5MLv.cjs';
4
4
  import '@fern-api/java-ast';
5
5
 
6
6
  declare class EndpointSnippetGenerator {