@fern-api/php-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,21 +1,21 @@
1
- "use strict";var le=Object.defineProperty,ft=Object.defineProperties,pt=Object.getOwnPropertyDescriptor,lt=Object.getOwnPropertyDescriptors,ht=Object.getOwnPropertyNames,Ce=Object.getOwnPropertySymbols;var Se=Object.prototype.hasOwnProperty,mt=Object.prototype.propertyIsEnumerable;var Ee=(n,t,e)=>t in n?le(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,ce=(n,t)=>{for(var e in t||(t={}))Se.call(t,e)&&Ee(n,e,t[e]);if(Ce)for(var e of Ce(t))mt.call(t,e)&&Ee(n,e,t[e]);return n},ue=(n,t)=>ft(n,lt(t));var Le=(n,t)=>()=>(n&&(t=n(n=0)),t);var Ue=(n,t)=>{for(var e in t)le(n,e,{get:t[e],enumerable:!0})},dt=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ht(t))!Se.call(n,i)&&i!==e&&le(n,i,{get:()=>t[i],enumerable:!(r=pt(t,i))||r.enumerable});return n};var yt=n=>dt(le({},"__esModule",{value:!0}),n);var c=(n,t,e)=>Ee(n,typeof t!="symbol"?t+"":t,e);function Me(){throw new Error("setTimeout has not been defined")}function Pe(){throw new Error("clearTimeout has not been defined")}function De(n){if(F===setTimeout)return setTimeout(n,0);if((F===Me||!F)&&setTimeout)return F=setTimeout,setTimeout(n,0);try{return F(n,0)}catch(t){try{return F.call(null,n,0)}catch(e){return F.call(this,n,0)}}}function wt(n){if(O===clearTimeout)return clearTimeout(n);if((O===Pe||!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 xt(){!se||!J||(se=!1,J.length?S=J.concat(S):he=-1,S.length&&$e())}function $e(){if(!se){var n=De(xt);se=!0;for(var t=S.length;t;){for(J=S,S=[];++he<t;)J&&J[he].run();he=-1,t=S.length}J=null,se=!1,wt(n)}}function Tt(n){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];S.push(new Fe(n,t)),S.length===1&&!se&&De($e)}function Fe(n,t){this.fun=n,this.array=t}function q(){}function Pt(n){throw new Error("process.binding is not supported")}function Dt(){return"/"}function $t(n){throw new Error("process.chdir is not supported")}function Ft(){return 0}function Yt(n){var t=Ot.call(oe)*.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 Wt(){var n=new Date,t=n-Vt;return t/1e3}var F,O,S,se,J,he,gt,vt,At,Et,Lt,Nt,Rt,It,kt,bt,_t,Ct,St,Ut,Bt,Mt,oe,Ot,Vt,h,Be,u=Le(()=>{"use strict";F=Me,O=Pe;typeof globalThis.setTimeout=="function"&&(F=setTimeout);typeof globalThis.clearTimeout=="function"&&(O=clearTimeout);S=[],se=!1,he=-1;Fe.prototype.run=function(){this.fun.apply(null,this.array)};gt="browser",vt="browser",At=!0,Et={},Lt=[],Nt="",Rt={},It={},kt={};bt=q,_t=q,Ct=q,St=q,Ut=q,Bt=q,Mt=q;oe=globalThis.performance||{},Ot=oe.now||oe.mozNow||oe.msNow||oe.oNow||oe.webkitNow||function(){return new Date().getTime()};Vt=new Date;h={nextTick:Tt,title:gt,browser:At,env:Et,argv:Lt,version:Nt,versions:Rt,on:bt,addListener:_t,once:Ct,off:St,removeListener:Ut,removeAllListeners:Bt,emit:Mt,binding:Pt,cwd:Dt,chdir:$t,umask:Ft,hrtime:Yt,platform:vt,release:It,config:kt,uptime:Wt},Be={};Object.keys(Be).forEach(n=>{let t=n.split("."),e=h;for(let r=0;r<t.length;r++){let i=t[r];r===t.length-1?e[i]=Be[n]:e=e[i]||(e[i]={})}})});function We(){Re=!0;for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=n.length;t<e;++t)k[t]=n[t],N[n.charCodeAt(t)]=t;N[45]=62,N[95]=63}function zt(n){Re||We();var t,e,r,i,o,s,p=n.length;if(p%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=n[p-2]==="="?2:n[p-1]==="="?1:0,s=new Gt(p*3/4-o),r=o>0?p-4:p;var l=0;for(t=0,e=0;t<r;t+=4,e+=3)i=N[n.charCodeAt(t)]<<18|N[n.charCodeAt(t+1)]<<12|N[n.charCodeAt(t+2)]<<6|N[n.charCodeAt(t+3)],s[l++]=i>>16&255,s[l++]=i>>8&255,s[l++]=i&255;return o===2?(i=N[n.charCodeAt(t)]<<2|N[n.charCodeAt(t+1)]>>4,s[l++]=i&255):o===1&&(i=N[n.charCodeAt(t)]<<10|N[n.charCodeAt(t+1)]<<4|N[n.charCodeAt(t+2)]>>2,s[l++]=i>>8&255,s[l++]=i&255),s}function jt(n){return k[n>>18&63]+k[n>>12&63]+k[n>>6&63]+k[n&63]}function Jt(n,t,e){for(var r,i=[],o=t;o<e;o+=3)r=(n[o]<<16)+(n[o+1]<<8)+n[o+2],i.push(jt(r));return i.join("")}function Oe(n){Re||We();for(var t,e=n.length,r=e%3,i="",o=[],s=16383,p=0,l=e-r;p<l;p+=s)o.push(Jt(n,p,p+s>l?l:p+s));return r===1?(t=n[e-1],i+=k[t>>2],i+=k[t<<4&63],i+="=="):r===2&&(t=(n[e-2]<<8)+n[e-1],i+=k[t>>10],i+=k[t>>4&63],i+=k[t<<2&63],i+="="),o.push(i),o.join("")}function me(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function U(n,t){if(me()<t)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(t),n.__proto__=a.prototype):(n===null&&(n=new a(t)),n.length=t),n}function a(n,t,e){if(!a.TYPED_ARRAY_SUPPORT&&!(this instanceof a))return new a(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 Ie(this,n)}return Ge(this,n,t,e)}function Ge(n,t,e,r){if(typeof t=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer!="undefined"&&t instanceof ArrayBuffer?Qt(n,t,e,r):typeof t=="string"?Ht(n,t,e):Xt(n,t)}function ze(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 qt(n,t,e,r){return ze(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 Ie(n,t){if(ze(t),n=U(n,t<0?0:ke(t)|0),!a.TYPED_ARRAY_SUPPORT)for(var e=0;e<t;++e)n[e]=0;return n}function Ht(n,t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!a.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=je(t,e)|0;n=U(n,r);var i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function Ne(n,t){var e=t.length<0?0:ke(t.length)|0;n=U(n,e);for(var r=0;r<e;r+=1)n[r]=t[r]&255;return n}function Qt(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),a.TYPED_ARRAY_SUPPORT?(n=t,n.__proto__=a.prototype):n=Ne(n,t),n}function Xt(n,t){if(b(t)){var e=ke(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"||yr(t.length)?U(n,0):Ne(n,t);if(t.type==="Buffer"&&Array.isArray(t.data))return Ne(n,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function ke(n){if(n>=me())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+me().toString(16)+" bytes");return n|0}function b(n){return!!(n!=null&&n._isBuffer)}function je(n,t){if(b(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 de(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return Ke(n).length;default:if(r)return de(n).length;t=(""+t).toLowerCase(),r=!0}}function Zt(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 cr(this,t,e);case"utf8":case"utf-8":return He(this,t,e);case"ascii":return sr(this,t,e);case"latin1":case"binary":return ar(this,t,e);case"base64":return ir(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ur(this,t,e);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),r=!0}}function H(n,t,e){var r=n[t];n[t]=n[e],n[e]=r}function Je(n,t,e,r,i){if(n.length===0)return-1;if(typeof e=="string"?(r=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:n.length-1),e<0&&(e=n.length+e),e>=n.length){if(i)return-1;e=n.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof t=="string"&&(t=a.from(t,r)),b(t))return t.length===0?-1:Ye(n,t,e,r,i);if(typeof t=="number")return t=t&255,a.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(n,t,e):Uint8Array.prototype.lastIndexOf.call(n,t,e):Ye(n,[t],e,r,i);throw new TypeError("val must be string, number or Buffer")}function Ye(n,t,e,r,i){var o=1,s=n.length,p=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;o=2,s/=2,p/=2,e/=2}function l(E,ie){return o===1?E[ie]:E.readUInt16BE(ie*o)}var d;if(i){var w=-1;for(d=e;d<s;d++)if(l(n,d)===l(t,w===-1?0:d-w)){if(w===-1&&(w=d),d-w+1===p)return w*o}else w!==-1&&(d-=d-w),w=-1}else for(e+p>s&&(e=s-p),d=e;d>=0;d--){for(var x=!0,R=0;R<p;R++)if(l(n,d+R)!==l(t,R)){x=!1;break}if(x)return d}return-1}function Kt(n,t,e,r){e=Number(e)||0;var i=n.length-e;r?(r=Number(r),r>i&&(r=i)):r=i;var o=t.length;if(o%2!==0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s<r;++s){var p=parseInt(t.substr(s*2,2),16);if(isNaN(p))return s;n[e+s]=p}return s}function er(n,t,e,r){return xe(de(t,n.length-e),n,e,r)}function qe(n,t,e,r){return xe(mr(t),n,e,r)}function tr(n,t,e,r){return qe(n,t,e,r)}function rr(n,t,e,r){return xe(Ke(t),n,e,r)}function nr(n,t,e,r){return xe(dr(t,n.length-e),n,e,r)}function ir(n,t,e){return t===0&&e===n.length?Oe(n):Oe(n.slice(t,e))}function He(n,t,e){e=Math.min(n.length,e);for(var r=[],i=t;i<e;){var o=n[i],s=null,p=o>239?4:o>223?3:o>191?2:1;if(i+p<=e){var l,d,w,x;switch(p){case 1:o<128&&(s=o);break;case 2:l=n[i+1],(l&192)===128&&(x=(o&31)<<6|l&63,x>127&&(s=x));break;case 3:l=n[i+1],d=n[i+2],(l&192)===128&&(d&192)===128&&(x=(o&15)<<12|(l&63)<<6|d&63,x>2047&&(x<55296||x>57343)&&(s=x));break;case 4:l=n[i+1],d=n[i+2],w=n[i+3],(l&192)===128&&(d&192)===128&&(w&192)===128&&(x=(o&15)<<18|(l&63)<<12|(d&63)<<6|w&63,x>65535&&x<1114112&&(s=x))}}s===null?(s=65533,p=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|s&1023),r.push(s),i+=p}return or(r)}function or(n){var t=n.length;if(t<=Ve)return String.fromCharCode.apply(String,n);for(var e="",r=0;r<t;)e+=String.fromCharCode.apply(String,n.slice(r,r+=Ve));return e}function sr(n,t,e){var r="";e=Math.min(n.length,e);for(var i=t;i<e;++i)r+=String.fromCharCode(n[i]&127);return r}function ar(n,t,e){var r="";e=Math.min(n.length,e);for(var i=t;i<e;++i)r+=String.fromCharCode(n[i]);return r}function cr(n,t,e){var r=n.length;(!t||t<0)&&(t=0),(!e||e<0||e>r)&&(e=r);for(var i="",o=t;o<e;++o)i+=hr(n[o]);return i}function ur(n,t,e){for(var r=n.slice(t,e),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+r[o+1]*256);return i}function T(n,t,e){if(n%1!==0||n<0)throw new RangeError("offset is not uint");if(n+t>e)throw new RangeError("Trying to access beyond buffer length")}function A(n,t,e,r,i,o){if(!b(n))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)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 i=0,o=Math.min(n.length-e,2);i<o;++i)n[e+i]=(t&255<<8*(r?i:1-i))>>>(r?i:1-i)*8}function we(n,t,e,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(n.length-e,4);i<o;++i)n[e+i]=t>>>(r?i:3-i)*8&255}function Qe(n,t,e,r,i,o){if(e+r>n.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function Xe(n,t,e,r,i){return i||Qe(n,t,e,4,34028234663852886e22,-34028234663852886e22),tt(n,t,e,r,23,4),e+4}function Ze(n,t,e,r,i){return i||Qe(n,t,e,8,17976931348623157e292,-17976931348623157e292),tt(n,t,e,r,52,8),e+8}function pr(n){if(n=lr(n).replace(fr,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}function lr(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}function hr(n){return n<16?"0"+n.toString(16):n.toString(16)}function de(n,t){t=t||1/0;for(var e,r=n.length,i=null,o=[],s=0;s<r;++s){if(e=n.charCodeAt(s),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&o.push(239,191,189);continue}else if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&o.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;o.push(e)}else if(e<2048){if((t-=2)<0)break;o.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;o.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return o}function mr(n){for(var t=[],e=0;e<n.length;++e)t.push(n.charCodeAt(e)&255);return t}function dr(n,t){for(var e,r,i,o=[],s=0;s<n.length&&!((t-=2)<0);++s)e=n.charCodeAt(s),r=e>>8,i=e%256,o.push(i),o.push(r);return o}function Ke(n){return zt(pr(n))}function xe(n,t,e,r){for(var i=0;i<r&&!(i+e>=t.length||i>=n.length);++i)t[i+e]=n[i];return i}function yr(n){return n!==n}function wr(n){return n!=null&&(!!n._isBuffer||et(n)||xr(n))}function et(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function xr(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&et(n.slice(0,0))}function Te(n,t,e,r,i){var o,s,p=i*8-r-1,l=(1<<p)-1,d=l>>1,w=-7,x=e?i-1:0,R=e?-1:1,E=n[t+x];for(x+=R,o=E&(1<<-w)-1,E>>=-w,w+=p;w>0;o=o*256+n[t+x],x+=R,w-=8);for(s=o&(1<<-w)-1,o>>=-w,w+=r;w>0;s=s*256+n[t+x],x+=R,w-=8);if(o===0)o=1-d;else{if(o===l)return s?NaN:(E?-1:1)*(1/0);s=s+Math.pow(2,r),o=o-d}return(E?-1:1)*s*Math.pow(2,o-r)}function tt(n,t,e,r,i,o){var s,p,l,d=o*8-i-1,w=(1<<d)-1,x=w>>1,R=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=r?0:o-1,ie=r?1:-1,ut=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(p=isNaN(t)?1:0,s=w):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+x>=1?t+=R/l:t+=R*Math.pow(2,1-x),t*l>=2&&(s++,l/=2),s+x>=w?(p=0,s=w):s+x>=1?(p=(t*l-1)*Math.pow(2,i),s=s+x):(p=t*Math.pow(2,x-1)*Math.pow(2,i),s=0));i>=8;n[e+E]=p&255,E+=ie,p/=256,i-=8);for(s=s<<i|p,d+=i;d>0;n[e+E]=s&255,E+=ie,s/=256,d-=8);n[e+E-ie]|=ut*128}var k,N,Gt,Re,Ve,fr,rt=Le(()=>{"use strict";u();f();k=[],N=[],Gt=typeof Uint8Array!="undefined"?Uint8Array:Array,Re=!1;a.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;a.poolSize=8192;a._augment=function(n){return n.__proto__=a.prototype,n};a.from=function(n,t,e){return Ge(null,n,t,e)};a.kMaxLength=me();a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&a[Symbol.species]);a.alloc=function(n,t,e){return qt(null,n,t,e)};a.allocUnsafe=function(n){return Ie(null,n)};a.allocUnsafeSlow=function(n){return Ie(null,n)};a.isBuffer=wr;a.compare=function(t,e){if(!b(t)||!b(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,i=e.length,o=0,s=Math.min(r,i);o<s;++o)if(t[o]!==e[o]){r=t[o],i=e[o];break}return r<i?-1:i<r?1:0};a.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}};a.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return a.alloc(0);var r;if(e===void 0)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var i=a.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var s=t[r];if(!b(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(i,o),o+=s.length}return i};a.byteLength=je;a.prototype._isBuffer=!0;a.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)H(this,e,e+1);return this};a.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)H(this,e,e+3),H(this,e+1,e+2);return this};a.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)H(this,e,e+7),H(this,e+1,e+6),H(this,e+2,e+5),H(this,e+3,e+4);return this};a.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?He(this,0,t):Zt.apply(this,arguments)};a.prototype.equals=function(t){if(!b(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:a.compare(this,t)===0};a.prototype.compare=function(t,e,r,i,o){if(!b(t))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),r===void 0&&(r=t?t.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),e<0||r>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&e>=r)return 0;if(i>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,i>>>=0,o>>>=0,this===t)return 0;for(var s=o-i,p=r-e,l=Math.min(s,p),d=this.slice(i,o),w=t.slice(e,r),x=0;x<l;++x)if(d[x]!==w[x]){s=d[x],p=w[x];break}return s<p?-1:p<s?1:0};a.prototype.includes=function(t,e,r){return this.indexOf(t,e,r)!==-1};a.prototype.indexOf=function(t,e,r){return Je(this,t,e,r,!0)};a.prototype.lastIndexOf=function(t,e,r){return Je(this,t,e,r,!1)};a.prototype.write=function(t,e,r,i){if(e===void 0)i="utf8",r=this.length,e=0;else if(r===void 0&&typeof e=="string")i=e,r=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(r)?(r=r|0,i===void 0&&(i="utf8")):(i=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-e;if((r===void 0||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return Kt(this,t,e,r);case"utf8":case"utf-8":return er(this,t,e,r);case"ascii":return qe(this,t,e,r);case"latin1":case"binary":return tr(this,t,e,r);case"base64":return rr(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return nr(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};Ve=4096;a.prototype.slice=function(t,e){var r=this.length;t=~~t,e=e===void 0?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e<t&&(e=t);var i;if(a.TYPED_ARRAY_SUPPORT)i=this.subarray(t,e),i.__proto__=a.prototype;else{var o=e-t;i=new a(o,void 0);for(var s=0;s<o;++s)i[s]=this[s+t]}return i};a.prototype.readUIntLE=function(t,e,r){t=t|0,e=e|0,r||T(t,e,this.length);for(var i=this[t],o=1,s=0;++s<e&&(o*=256);)i+=this[t+s]*o;return i};a.prototype.readUIntBE=function(t,e,r){t=t|0,e=e|0,r||T(t,e,this.length);for(var i=this[t+--e],o=1;e>0&&(o*=256);)i+=this[t+--e]*o;return i};a.prototype.readUInt8=function(t,e){return e||T(t,1,this.length),this[t]};a.prototype.readUInt16LE=function(t,e){return e||T(t,2,this.length),this[t]|this[t+1]<<8};a.prototype.readUInt16BE=function(t,e){return e||T(t,2,this.length),this[t]<<8|this[t+1]};a.prototype.readUInt32LE=function(t,e){return e||T(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};a.prototype.readUInt32BE=function(t,e){return e||T(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};a.prototype.readIntLE=function(t,e,r){t=t|0,e=e|0,r||T(t,e,this.length);for(var i=this[t],o=1,s=0;++s<e&&(o*=256);)i+=this[t+s]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i};a.prototype.readIntBE=function(t,e,r){t=t|0,e=e|0,r||T(t,e,this.length);for(var i=e,o=1,s=this[t+--i];i>0&&(o*=256);)s+=this[t+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*e)),s};a.prototype.readInt8=function(t,e){return e||T(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};a.prototype.readInt16LE=function(t,e){e||T(t,2,this.length);var r=this[t]|this[t+1]<<8;return r&32768?r|4294901760:r};a.prototype.readInt16BE=function(t,e){e||T(t,2,this.length);var r=this[t+1]|this[t]<<8;return r&32768?r|4294901760:r};a.prototype.readInt32LE=function(t,e){return e||T(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};a.prototype.readInt32BE=function(t,e){return e||T(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};a.prototype.readFloatLE=function(t,e){return e||T(t,4,this.length),Te(this,t,!0,23,4)};a.prototype.readFloatBE=function(t,e){return e||T(t,4,this.length),Te(this,t,!1,23,4)};a.prototype.readDoubleLE=function(t,e){return e||T(t,8,this.length),Te(this,t,!0,52,8)};a.prototype.readDoubleBE=function(t,e){return e||T(t,8,this.length),Te(this,t,!1,52,8)};a.prototype.writeUIntLE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var o=Math.pow(2,8*r)-1;A(this,t,e,r,o,0)}var s=1,p=0;for(this[e]=t&255;++p<r&&(s*=256);)this[e+p]=t/s&255;return e+r};a.prototype.writeUIntBE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var o=Math.pow(2,8*r)-1;A(this,t,e,r,o,0)}var s=r-1,p=1;for(this[e+s]=t&255;--s>=0&&(p*=256);)this[e+s]=t/p&255;return e+r};a.prototype.writeUInt8=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,1,255,0),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=t&255,e+1};a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):ye(this,t,e,!0),e+2};a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):ye(this,t,e,!1),e+2};a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255):we(this,t,e,!0),e+4};a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):we(this,t,e,!1),e+4};a.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e=e|0,!i){var o=Math.pow(2,8*r-1);A(this,t,e,r,o-1,-o)}var s=0,p=1,l=0;for(this[e]=t&255;++s<r&&(p*=256);)t<0&&l===0&&this[e+s-1]!==0&&(l=1),this[e+s]=(t/p>>0)-l&255;return e+r};a.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e=e|0,!i){var o=Math.pow(2,8*r-1);A(this,t,e,r,o-1,-o)}var s=r-1,p=1,l=0;for(this[e+s]=t&255;--s>=0&&(p*=256);)t<0&&l===0&&this[e+s+1]!==0&&(l=1),this[e+s]=(t/p>>0)-l&255;return e+r};a.prototype.writeInt8=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,1,127,-128),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=t&255,e+1};a.prototype.writeInt16LE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):ye(this,t,e,!0),e+2};a.prototype.writeInt16BE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):ye(this,t,e,!1),e+2};a.prototype.writeInt32LE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):we(this,t,e,!0),e+4};a.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),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):we(this,t,e,!1),e+4};a.prototype.writeFloatLE=function(t,e,r){return Xe(this,t,e,!0,r)};a.prototype.writeFloatBE=function(t,e,r){return Xe(this,t,e,!1,r)};a.prototype.writeDoubleLE=function(t,e,r){return Ze(this,t,e,!0,r)};a.prototype.writeDoubleBE=function(t,e,r){return Ze(this,t,e,!1,r)};a.prototype.copy=function(t,e,r,i){if(r||(r=0),!i&&i!==0&&(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<r&&(i=r),i===r||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);var o=i-r,s;if(this===t&&r<e&&e<i)for(s=o-1;s>=0;--s)t[s+e]=this[s+r];else if(o<1e3||!a.TYPED_ARRAY_SUPPORT)for(s=0;s<o;++s)t[s+e]=this[s+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o};a.prototype.fill=function(t,e,r,i){if(typeof t=="string"){if(typeof e=="string"?(i=e,e=0,r=this.length):typeof r=="string"&&(i=r,r=this.length),t.length===1){var o=t.charCodeAt(0);o<256&&(t=o)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!a.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof t=="number"&&(t=t&255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;e=e>>>0,r=r===void 0?this.length:r>>>0,t||(t=0);var s;if(typeof t=="number")for(s=e;s<r;++s)this[s]=t;else{var p=b(t)?t:de(new a(t,i).toString()),l=p.length;for(s=0;s<r-e;++s)this[s+e]=p[s%l]}return this};fr=/[^+\/0-9A-Za-z-_]/g});var f=Le(()=>{"use strict";rt()});var jr={};Ue(jr,{DynamicTypeLiteralMapper:()=>_e});module.exports=yt(jr);u();f();u();f();u();f();function _(n){throw new Error("Unexpected value: "+JSON.stringify(n))}u();f();u();f();var B=class{};u();f();u();f();var Y=class extends B{constructor(e){super();c(this,"value");this.value=e}write(e){typeof this.value=="string"?e.write(this.value):this.value(e)}};var Tr=4,fe=class{constructor(){c(this,"buffer","");c(this,"indentLevel",0);c(this,"hasWrittenAnything",!1);c(this,"lastCharacterIsNewline",!1)}write(t){let e=t.length>0&&t.endsWith(`
1
+ "use strict";var he=Object.defineProperty,pt=Object.defineProperties,lt=Object.getOwnPropertyDescriptor,ht=Object.getOwnPropertyDescriptors,mt=Object.getOwnPropertyNames,Se=Object.getOwnPropertySymbols;var Ce=Object.prototype.hasOwnProperty,dt=Object.prototype.propertyIsEnumerable;var Ee=(n,t,e)=>t in n?he(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,ue=(n,t)=>{for(var e in t||(t={}))Ce.call(t,e)&&Ee(n,e,t[e]);if(Se)for(var e of Se(t))dt.call(t,e)&&Ee(n,e,t[e]);return n},fe=(n,t)=>pt(n,ht(t));var Le=(n,t)=>()=>(n&&(t=n(n=0)),t);var Ue=(n,t)=>{for(var e in t)he(n,e,{get:t[e],enumerable:!0})},yt=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of mt(t))!Ce.call(n,i)&&i!==e&&he(n,i,{get:()=>t[i],enumerable:!(r=lt(t,i))||r.enumerable});return n};var wt=n=>yt(he({},"__esModule",{value:!0}),n);var c=(n,t,e)=>Ee(n,typeof t!="symbol"?t+"":t,e);function Me(){throw new Error("setTimeout has not been defined")}function Pe(){throw new Error("clearTimeout has not been defined")}function De(n){if(F===setTimeout)return setTimeout(n,0);if((F===Me||!F)&&setTimeout)return F=setTimeout,setTimeout(n,0);try{return F(n,0)}catch(t){try{return F.call(null,n,0)}catch(e){return F.call(this,n,0)}}}function xt(n){if(O===clearTimeout)return clearTimeout(n);if((O===Pe||!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 Tt(){!ae||!q||(ae=!1,q.length?C=q.concat(C):me=-1,C.length&&$e())}function $e(){if(!ae){var n=De(Tt);ae=!0;for(var t=C.length;t;){for(q=C,C=[];++me<t;)q&&q[me].run();me=-1,t=C.length}q=null,ae=!1,xt(n)}}function gt(n){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];C.push(new Fe(n,t)),C.length===1&&!ae&&De($e)}function Fe(n,t){this.fun=n,this.array=t}function H(){}function Dt(n){throw new Error("process.binding is not supported")}function $t(){return"/"}function Ft(n){throw new Error("process.chdir is not supported")}function Ot(){return 0}function Vt(n){var t=Yt.call(se)*.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 Gt(){var n=new Date,t=n-Wt;return t/1e3}var F,O,C,ae,q,me,vt,At,Et,Lt,Nt,Rt,It,bt,kt,_t,St,Ct,Ut,Bt,Mt,Pt,se,Yt,Wt,h,Be,u=Le(()=>{"use strict";F=Me,O=Pe;typeof globalThis.setTimeout=="function"&&(F=setTimeout);typeof globalThis.clearTimeout=="function"&&(O=clearTimeout);C=[],ae=!1,me=-1;Fe.prototype.run=function(){this.fun.apply(null,this.array)};vt="browser",At="browser",Et=!0,Lt={},Nt=[],Rt="",It={},bt={},kt={};_t=H,St=H,Ct=H,Ut=H,Bt=H,Mt=H,Pt=H;se=globalThis.performance||{},Yt=se.now||se.mozNow||se.msNow||se.oNow||se.webkitNow||function(){return new Date().getTime()};Wt=new Date;h={nextTick:gt,title:vt,browser:Et,env:Lt,argv:Nt,version:Rt,versions:It,on:_t,addListener:St,once:Ct,off:Ut,removeListener:Bt,removeAllListeners:Mt,emit:Pt,binding:Dt,cwd:$t,chdir:Ft,umask:Ot,hrtime:Vt,platform:At,release:bt,config:kt,uptime:Gt},Be={};Object.keys(Be).forEach(n=>{let t=n.split("."),e=h;for(let r=0;r<t.length;r++){let i=t[r];r===t.length-1?e[i]=Be[n]:e=e[i]||(e[i]={})}})});function We(){Re=!0;for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=n.length;t<e;++t)b[t]=n[t],N[n.charCodeAt(t)]=t;N[45]=62,N[95]=63}function jt(n){Re||We();var t,e,r,i,o,s,p=n.length;if(p%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=n[p-2]==="="?2:n[p-1]==="="?1:0,s=new zt(p*3/4-o),r=o>0?p-4:p;var l=0;for(t=0,e=0;t<r;t+=4,e+=3)i=N[n.charCodeAt(t)]<<18|N[n.charCodeAt(t+1)]<<12|N[n.charCodeAt(t+2)]<<6|N[n.charCodeAt(t+3)],s[l++]=i>>16&255,s[l++]=i>>8&255,s[l++]=i&255;return o===2?(i=N[n.charCodeAt(t)]<<2|N[n.charCodeAt(t+1)]>>4,s[l++]=i&255):o===1&&(i=N[n.charCodeAt(t)]<<10|N[n.charCodeAt(t+1)]<<4|N[n.charCodeAt(t+2)]>>2,s[l++]=i>>8&255,s[l++]=i&255),s}function Jt(n){return b[n>>18&63]+b[n>>12&63]+b[n>>6&63]+b[n&63]}function qt(n,t,e){for(var r,i=[],o=t;o<e;o+=3)r=(n[o]<<16)+(n[o+1]<<8)+n[o+2],i.push(Jt(r));return i.join("")}function Oe(n){Re||We();for(var t,e=n.length,r=e%3,i="",o=[],s=16383,p=0,l=e-r;p<l;p+=s)o.push(qt(n,p,p+s>l?l:p+s));return r===1?(t=n[e-1],i+=b[t>>2],i+=b[t<<4&63],i+="=="):r===2&&(t=(n[e-2]<<8)+n[e-1],i+=b[t>>10],i+=b[t>>4&63],i+=b[t<<2&63],i+="="),o.push(i),o.join("")}function de(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function U(n,t){if(de()<t)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(t),n.__proto__=a.prototype):(n===null&&(n=new a(t)),n.length=t),n}function a(n,t,e){if(!a.TYPED_ARRAY_SUPPORT&&!(this instanceof a))return new a(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 Ie(this,n)}return Ge(this,n,t,e)}function Ge(n,t,e,r){if(typeof t=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer!="undefined"&&t instanceof ArrayBuffer?Xt(n,t,e,r):typeof t=="string"?Qt(n,t,e):Zt(n,t)}function ze(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 Ht(n,t,e,r){return ze(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 Ie(n,t){if(ze(t),n=U(n,t<0?0:be(t)|0),!a.TYPED_ARRAY_SUPPORT)for(var e=0;e<t;++e)n[e]=0;return n}function Qt(n,t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!a.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=je(t,e)|0;n=U(n,r);var i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function Ne(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 Xt(n,t,e,r){if(t.byteLength,e<0||t.byteLength<e)throw new RangeError("'offset' is out of bounds");if(t.byteLength<e+(r||0))throw new RangeError("'length' is out of bounds");return e===void 0&&r===void 0?t=new Uint8Array(t):r===void 0?t=new Uint8Array(t,e):t=new Uint8Array(t,e,r),a.TYPED_ARRAY_SUPPORT?(n=t,n.__proto__=a.prototype):n=Ne(n,t),n}function Zt(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"||wr(t.length)?U(n,0):Ne(n,t);if(t.type==="Buffer"&&Array.isArray(t.data))return Ne(n,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function be(n){if(n>=de())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+de().toString(16)+" bytes");return n|0}function k(n){return!!(n!=null&&n._isBuffer)}function je(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 ye(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return Ke(n).length;default:if(r)return ye(n).length;t=(""+t).toLowerCase(),r=!0}}function Kt(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 ur(this,t,e);case"utf8":case"utf-8":return He(this,t,e);case"ascii":return ar(this,t,e);case"latin1":case"binary":return cr(this,t,e);case"base64":return or(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return fr(this,t,e);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),r=!0}}function Q(n,t,e){var r=n[t];n[t]=n[e],n[e]=r}function Je(n,t,e,r,i){if(n.length===0)return-1;if(typeof e=="string"?(r=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:n.length-1),e<0&&(e=n.length+e),e>=n.length){if(i)return-1;e=n.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof t=="string"&&(t=a.from(t,r)),k(t))return t.length===0?-1:Ye(n,t,e,r,i);if(typeof t=="number")return t=t&255,a.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(n,t,e):Uint8Array.prototype.lastIndexOf.call(n,t,e):Ye(n,[t],e,r,i);throw new TypeError("val must be string, number or Buffer")}function Ye(n,t,e,r,i){var o=1,s=n.length,p=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;o=2,s/=2,p/=2,e/=2}function l(E,oe){return o===1?E[oe]:E.readUInt16BE(oe*o)}var d;if(i){var w=-1;for(d=e;d<s;d++)if(l(n,d)===l(t,w===-1?0:d-w)){if(w===-1&&(w=d),d-w+1===p)return w*o}else w!==-1&&(d-=d-w),w=-1}else for(e+p>s&&(e=s-p),d=e;d>=0;d--){for(var x=!0,R=0;R<p;R++)if(l(n,d+R)!==l(t,R)){x=!1;break}if(x)return d}return-1}function er(n,t,e,r){e=Number(e)||0;var i=n.length-e;r?(r=Number(r),r>i&&(r=i)):r=i;var o=t.length;if(o%2!==0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s<r;++s){var p=parseInt(t.substr(s*2,2),16);if(isNaN(p))return s;n[e+s]=p}return s}function tr(n,t,e,r){return Te(ye(t,n.length-e),n,e,r)}function qe(n,t,e,r){return Te(dr(t),n,e,r)}function rr(n,t,e,r){return qe(n,t,e,r)}function nr(n,t,e,r){return Te(Ke(t),n,e,r)}function ir(n,t,e,r){return Te(yr(t,n.length-e),n,e,r)}function or(n,t,e){return t===0&&e===n.length?Oe(n):Oe(n.slice(t,e))}function He(n,t,e){e=Math.min(n.length,e);for(var r=[],i=t;i<e;){var o=n[i],s=null,p=o>239?4:o>223?3:o>191?2:1;if(i+p<=e){var l,d,w,x;switch(p){case 1:o<128&&(s=o);break;case 2:l=n[i+1],(l&192)===128&&(x=(o&31)<<6|l&63,x>127&&(s=x));break;case 3:l=n[i+1],d=n[i+2],(l&192)===128&&(d&192)===128&&(x=(o&15)<<12|(l&63)<<6|d&63,x>2047&&(x<55296||x>57343)&&(s=x));break;case 4:l=n[i+1],d=n[i+2],w=n[i+3],(l&192)===128&&(d&192)===128&&(w&192)===128&&(x=(o&15)<<18|(l&63)<<12|(d&63)<<6|w&63,x>65535&&x<1114112&&(s=x))}}s===null?(s=65533,p=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|s&1023),r.push(s),i+=p}return sr(r)}function sr(n){var t=n.length;if(t<=Ve)return String.fromCharCode.apply(String,n);for(var e="",r=0;r<t;)e+=String.fromCharCode.apply(String,n.slice(r,r+=Ve));return e}function ar(n,t,e){var r="";e=Math.min(n.length,e);for(var i=t;i<e;++i)r+=String.fromCharCode(n[i]&127);return r}function cr(n,t,e){var r="";e=Math.min(n.length,e);for(var i=t;i<e;++i)r+=String.fromCharCode(n[i]);return r}function ur(n,t,e){var r=n.length;(!t||t<0)&&(t=0),(!e||e<0||e>r)&&(e=r);for(var i="",o=t;o<e;++o)i+=mr(n[o]);return i}function fr(n,t,e){for(var r=n.slice(t,e),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+r[o+1]*256);return i}function T(n,t,e){if(n%1!==0||n<0)throw new RangeError("offset is not uint");if(n+t>e)throw new RangeError("Trying to access beyond buffer length")}function A(n,t,e,r,i,o){if(!k(n))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(e+r>n.length)throw new RangeError("Index out of range")}function we(n,t,e,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(n.length-e,2);i<o;++i)n[e+i]=(t&255<<8*(r?i:1-i))>>>(r?i:1-i)*8}function xe(n,t,e,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(n.length-e,4);i<o;++i)n[e+i]=t>>>(r?i:3-i)*8&255}function Qe(n,t,e,r,i,o){if(e+r>n.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function Xe(n,t,e,r,i){return i||Qe(n,t,e,4,34028234663852886e22,-34028234663852886e22),tt(n,t,e,r,23,4),e+4}function Ze(n,t,e,r,i){return i||Qe(n,t,e,8,17976931348623157e292,-17976931348623157e292),tt(n,t,e,r,52,8),e+8}function lr(n){if(n=hr(n).replace(pr,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}function hr(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}function mr(n){return n<16?"0"+n.toString(16):n.toString(16)}function ye(n,t){t=t||1/0;for(var e,r=n.length,i=null,o=[],s=0;s<r;++s){if(e=n.charCodeAt(s),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&o.push(239,191,189);continue}else if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&o.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;o.push(e)}else if(e<2048){if((t-=2)<0)break;o.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;o.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return o}function dr(n){for(var t=[],e=0;e<n.length;++e)t.push(n.charCodeAt(e)&255);return t}function yr(n,t){for(var e,r,i,o=[],s=0;s<n.length&&!((t-=2)<0);++s)e=n.charCodeAt(s),r=e>>8,i=e%256,o.push(i),o.push(r);return o}function Ke(n){return jt(lr(n))}function Te(n,t,e,r){for(var i=0;i<r&&!(i+e>=t.length||i>=n.length);++i)t[i+e]=n[i];return i}function wr(n){return n!==n}function xr(n){return n!=null&&(!!n._isBuffer||et(n)||Tr(n))}function et(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function Tr(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&et(n.slice(0,0))}function ge(n,t,e,r,i){var o,s,p=i*8-r-1,l=(1<<p)-1,d=l>>1,w=-7,x=e?i-1:0,R=e?-1:1,E=n[t+x];for(x+=R,o=E&(1<<-w)-1,E>>=-w,w+=p;w>0;o=o*256+n[t+x],x+=R,w-=8);for(s=o&(1<<-w)-1,o>>=-w,w+=r;w>0;s=s*256+n[t+x],x+=R,w-=8);if(o===0)o=1-d;else{if(o===l)return s?NaN:(E?-1:1)*(1/0);s=s+Math.pow(2,r),o=o-d}return(E?-1:1)*s*Math.pow(2,o-r)}function tt(n,t,e,r,i,o){var s,p,l,d=o*8-i-1,w=(1<<d)-1,x=w>>1,R=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=r?0:o-1,oe=r?1:-1,ft=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(p=isNaN(t)?1:0,s=w):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+x>=1?t+=R/l:t+=R*Math.pow(2,1-x),t*l>=2&&(s++,l/=2),s+x>=w?(p=0,s=w):s+x>=1?(p=(t*l-1)*Math.pow(2,i),s=s+x):(p=t*Math.pow(2,x-1)*Math.pow(2,i),s=0));i>=8;n[e+E]=p&255,E+=oe,p/=256,i-=8);for(s=s<<i|p,d+=i;d>0;n[e+E]=s&255,E+=oe,s/=256,d-=8);n[e+E-oe]|=ft*128}var b,N,zt,Re,Ve,pr,rt=Le(()=>{"use strict";u();f();b=[],N=[],zt=typeof Uint8Array!="undefined"?Uint8Array:Array,Re=!1;a.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;a.poolSize=8192;a._augment=function(n){return n.__proto__=a.prototype,n};a.from=function(n,t,e){return Ge(null,n,t,e)};a.kMaxLength=de();a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&a[Symbol.species]);a.alloc=function(n,t,e){return Ht(null,n,t,e)};a.allocUnsafe=function(n){return Ie(null,n)};a.allocUnsafeSlow=function(n){return Ie(null,n)};a.isBuffer=xr;a.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,i=e.length,o=0,s=Math.min(r,i);o<s;++o)if(t[o]!==e[o]){r=t[o],i=e[o];break}return r<i?-1:i<r?1:0};a.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}};a.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return a.alloc(0);var r;if(e===void 0)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var i=a.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var s=t[r];if(!k(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(i,o),o+=s.length}return i};a.byteLength=je;a.prototype._isBuffer=!0;a.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)Q(this,e,e+1);return this};a.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)Q(this,e,e+3),Q(this,e+1,e+2);return this};a.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)Q(this,e,e+7),Q(this,e+1,e+6),Q(this,e+2,e+5),Q(this,e+3,e+4);return this};a.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?He(this,0,t):Kt.apply(this,arguments)};a.prototype.equals=function(t){if(!k(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:a.compare(this,t)===0};a.prototype.compare=function(t,e,r,i,o){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),i===void 0&&(i=0),o===void 0&&(o=this.length),e<0||r>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&e>=r)return 0;if(i>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,i>>>=0,o>>>=0,this===t)return 0;for(var s=o-i,p=r-e,l=Math.min(s,p),d=this.slice(i,o),w=t.slice(e,r),x=0;x<l;++x)if(d[x]!==w[x]){s=d[x],p=w[x];break}return s<p?-1:p<s?1:0};a.prototype.includes=function(t,e,r){return this.indexOf(t,e,r)!==-1};a.prototype.indexOf=function(t,e,r){return Je(this,t,e,r,!0)};a.prototype.lastIndexOf=function(t,e,r){return Je(this,t,e,r,!1)};a.prototype.write=function(t,e,r,i){if(e===void 0)i="utf8",r=this.length,e=0;else if(r===void 0&&typeof e=="string")i=e,r=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(r)?(r=r|0,i===void 0&&(i="utf8")):(i=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-e;if((r===void 0||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return er(this,t,e,r);case"utf8":case"utf-8":return tr(this,t,e,r);case"ascii":return qe(this,t,e,r);case"latin1":case"binary":return rr(this,t,e,r);case"base64":return nr(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ir(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};Ve=4096;a.prototype.slice=function(t,e){var r=this.length;t=~~t,e=e===void 0?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e<t&&(e=t);var i;if(a.TYPED_ARRAY_SUPPORT)i=this.subarray(t,e),i.__proto__=a.prototype;else{var o=e-t;i=new a(o,void 0);for(var s=0;s<o;++s)i[s]=this[s+t]}return i};a.prototype.readUIntLE=function(t,e,r){t=t|0,e=e|0,r||T(t,e,this.length);for(var i=this[t],o=1,s=0;++s<e&&(o*=256);)i+=this[t+s]*o;return i};a.prototype.readUIntBE=function(t,e,r){t=t|0,e=e|0,r||T(t,e,this.length);for(var i=this[t+--e],o=1;e>0&&(o*=256);)i+=this[t+--e]*o;return i};a.prototype.readUInt8=function(t,e){return e||T(t,1,this.length),this[t]};a.prototype.readUInt16LE=function(t,e){return e||T(t,2,this.length),this[t]|this[t+1]<<8};a.prototype.readUInt16BE=function(t,e){return e||T(t,2,this.length),this[t]<<8|this[t+1]};a.prototype.readUInt32LE=function(t,e){return e||T(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};a.prototype.readUInt32BE=function(t,e){return e||T(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};a.prototype.readIntLE=function(t,e,r){t=t|0,e=e|0,r||T(t,e,this.length);for(var i=this[t],o=1,s=0;++s<e&&(o*=256);)i+=this[t+s]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i};a.prototype.readIntBE=function(t,e,r){t=t|0,e=e|0,r||T(t,e,this.length);for(var i=e,o=1,s=this[t+--i];i>0&&(o*=256);)s+=this[t+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*e)),s};a.prototype.readInt8=function(t,e){return e||T(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};a.prototype.readInt16LE=function(t,e){e||T(t,2,this.length);var r=this[t]|this[t+1]<<8;return r&32768?r|4294901760:r};a.prototype.readInt16BE=function(t,e){e||T(t,2,this.length);var r=this[t+1]|this[t]<<8;return r&32768?r|4294901760:r};a.prototype.readInt32LE=function(t,e){return e||T(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};a.prototype.readInt32BE=function(t,e){return e||T(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};a.prototype.readFloatLE=function(t,e){return e||T(t,4,this.length),ge(this,t,!0,23,4)};a.prototype.readFloatBE=function(t,e){return e||T(t,4,this.length),ge(this,t,!1,23,4)};a.prototype.readDoubleLE=function(t,e){return e||T(t,8,this.length),ge(this,t,!0,52,8)};a.prototype.readDoubleBE=function(t,e){return e||T(t,8,this.length),ge(this,t,!1,52,8)};a.prototype.writeUIntLE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var o=Math.pow(2,8*r)-1;A(this,t,e,r,o,0)}var s=1,p=0;for(this[e]=t&255;++p<r&&(s*=256);)this[e+p]=t/s&255;return e+r};a.prototype.writeUIntBE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var o=Math.pow(2,8*r)-1;A(this,t,e,r,o,0)}var s=r-1,p=1;for(this[e+s]=t&255;--s>=0&&(p*=256);)this[e+s]=t/p&255;return e+r};a.prototype.writeUInt8=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,1,255,0),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=t&255,e+1};a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):we(this,t,e,!0),e+2};a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):we(this,t,e,!1),e+2};a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,4,4294967295,0),a.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};a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,4,4294967295,0),a.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};a.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e=e|0,!i){var o=Math.pow(2,8*r-1);A(this,t,e,r,o-1,-o)}var s=0,p=1,l=0;for(this[e]=t&255;++s<r&&(p*=256);)t<0&&l===0&&this[e+s-1]!==0&&(l=1),this[e+s]=(t/p>>0)-l&255;return e+r};a.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e=e|0,!i){var o=Math.pow(2,8*r-1);A(this,t,e,r,o-1,-o)}var s=r-1,p=1,l=0;for(this[e+s]=t&255;--s>=0&&(p*=256);)t<0&&l===0&&this[e+s+1]!==0&&(l=1),this[e+s]=(t/p>>0)-l&255;return e+r};a.prototype.writeInt8=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,1,127,-128),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=t&255,e+1};a.prototype.writeInt16LE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):we(this,t,e,!0),e+2};a.prototype.writeInt16BE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):we(this,t,e,!1),e+2};a.prototype.writeInt32LE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,4,2147483647,-2147483648),a.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};a.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),a.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};a.prototype.writeFloatLE=function(t,e,r){return Xe(this,t,e,!0,r)};a.prototype.writeFloatBE=function(t,e,r){return Xe(this,t,e,!1,r)};a.prototype.writeDoubleLE=function(t,e,r){return Ze(this,t,e,!0,r)};a.prototype.writeDoubleBE=function(t,e,r){return Ze(this,t,e,!1,r)};a.prototype.copy=function(t,e,r,i){if(r||(r=0),!i&&i!==0&&(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<r&&(i=r),i===r||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);var o=i-r,s;if(this===t&&r<e&&e<i)for(s=o-1;s>=0;--s)t[s+e]=this[s+r];else if(o<1e3||!a.TYPED_ARRAY_SUPPORT)for(s=0;s<o;++s)t[s+e]=this[s+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o};a.prototype.fill=function(t,e,r,i){if(typeof t=="string"){if(typeof e=="string"?(i=e,e=0,r=this.length):typeof r=="string"&&(i=r,r=this.length),t.length===1){var o=t.charCodeAt(0);o<256&&(t=o)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!a.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof t=="number"&&(t=t&255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;e=e>>>0,r=r===void 0?this.length:r>>>0,t||(t=0);var s;if(typeof t=="number")for(s=e;s<r;++s)this[s]=t;else{var p=k(t)?t:ye(new a(t,i).toString()),l=p.length;for(s=0;s<r-e;++s)this[s+e]=p[s%l]}return this};pr=/[^+\/0-9A-Za-z-_]/g});var f=Le(()=>{"use strict";rt()});var Jr={};Ue(Jr,{DynamicTypeLiteralMapper:()=>_e});module.exports=wt(Jr);u();f();u();f();u();f();function _(n){throw new Error("Unexpected value: "+JSON.stringify(n))}u();f();u();f();var B=class{};u();f();u();f();var Y=class extends B{constructor(e){super();c(this,"value");this.value=e}write(e){typeof this.value=="string"?e.write(this.value):this.value(e)}};var gr=4,pe=class{constructor(){c(this,"buffer","");c(this,"indentLevel",0);c(this,"hasWrittenAnything",!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,i=this.getIndentString(),o=r.replaceAll(`
3
3
  `,`
4
4
  ${i}`);this.isAtStartOfLine()&&(o=i+o),e&&(o+=`
5
5
  `),this.writeInternal(o)}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 Y(t).write(this),this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(t,e){new Y(t).write(this),this.write(" ("),this.writeNode(e),this.write(") {"),this.writeNewLineIfLastLineNot(),this.indent()}endControlFlow(){this.dedent(),this.writeLine("}")}openBlock(t,e="{",r,i="}"){let o=t.filter(s=>s!==void 0).join(" ");o?this.write(`${o} ${e!=null?e:""}`):this.write(e!=null?e:"");try{this.indent(),r(),this.dedent()}finally{this.write(i!=null?i:"")}}writeLine(t=""){this.write(t),this.writeNewLineIfLastLineNot()}newLine(){this.writeInternal(`
6
6
  `)}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 i=t[0];i!=null&&r(i);for(let o=1;o<t.length;o++){this.write(e);let s=t[o];s!=null&&r(s)}}}toString(){return this.buffer}writeInternal(t){return t.length>0&&(this.hasWrittenAnything=!0,this.lastCharacterIsNewline=t.endsWith(`
8
- `)),this.buffer+=t}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*Tr)}};u();f();function be(n){return(n==null?void 0:n.name)!=null}u();f();var pe=class extends B{constructor({condition:e,true_:r,false_:i}){super();c(this,"condition");c(this,"true_");c(this,"false_");this.condition=e,this.true_=r,this.false_=i}write(e){e.writeNode(this.condition),e.write(" ? "),e.writeNode(this.true_),e.write(" : "),e.writeNode(this.false_)}};u();f();u();f();var V={Critical:"CRITICAL",Warning:"WARNING"};u();f();u();f();var ge="";var y={};Ue(y,{Array:()=>Q,AstNode:()=>m,Attribute:()=>X,Class:()=>M,ClassInstantiation:()=>C,ClassReference:()=>g,CodeBlock:()=>v,DataClass:()=>K,Enum:()=>ee,Field:()=>te,Map:()=>re,Method:()=>D,MethodInvocation:()=>$,Parameter:()=>P,Trait:()=>Z,Type:()=>I,TypeLiteral:()=>j,Writer:()=>W,array:()=>Ir,assignVariable:()=>Yr,attribute:()=>kr,classReference:()=>Cr,class_:()=>br,codeblock:()=>ne,dataClass:()=>Sr,enum_:()=>Ur,field:()=>Br,instantiateClass:()=>ct,invokeMethod:()=>Mr,map:()=>Dr,mergeArrays:()=>Gr,method:()=>$r,parameter:()=>Fr,string:()=>Wr,ternary:()=>Or,this_:()=>zr,throwException:()=>Pr,trait:()=>_r,variable:()=>Vr});u();f();u();f();u();f();u();f();u();f();function nt(n){return{namespace:n.substring(0,n.lastIndexOf("\\")),name:n.substring(n.lastIndexOf("\\")+1)}}var W=class extends fe{constructor({namespace:e,rootNamespace:r,customConfig:i}){super();c(this,"namespace");c(this,"rootNamespace");c(this,"customConfig");c(this,"references",{});this.namespace=e,this.rootNamespace=r,this.customConfig=i}addReference(e){var s,p;if(e.namespace==null)return;if(Object.keys(this.references).filter(l=>{let d=nt(l);return d.namespace!==e.namespace&&d.name===e.name}).length>0){e.requireFullyQualified();return}let i=e.namespace===ge?e.name:`${e.namespace}\\${e.name}`;((p=(s=this.references)[i])!=null?p:s[i]=[]).push(e)}toString(){let e=`namespace ${this.namespace};`,r=this.stringifyImports();return r.length>0?`${e}
8
+ `)),this.buffer+=t}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*gr)}};u();f();function ke(n){return(n==null?void 0:n.name)!=null}u();f();var le=class extends B{constructor({condition:e,true_:r,false_:i}){super();c(this,"condition");c(this,"true_");c(this,"false_");this.condition=e,this.true_=r,this.false_=i}write(e){e.writeNode(this.condition),e.write(" ? "),e.writeNode(this.true_),e.write(" : "),e.writeNode(this.false_)}};u();f();u();f();var V={Critical:"CRITICAL",Warning:"WARNING"};u();f();u();f();var ve="",nt="self";var y={};Ue(y,{Access:()=>W,Array:()=>X,AstNode:()=>m,Attribute:()=>Z,Class:()=>M,ClassInstantiation:()=>S,ClassReference:()=>g,CodeBlock:()=>v,DataClass:()=>ee,Enum:()=>te,Field:()=>re,Map:()=>ne,Method:()=>D,MethodInvocation:()=>$,Parameter:()=>P,Trait:()=>K,Type:()=>I,TypeLiteral:()=>J,Writer:()=>G,array:()=>br,assignVariable:()=>Vr,attribute:()=>kr,classReference:()=>Cr,class_:()=>_r,codeblock:()=>ie,dataClass:()=>Ur,enum_:()=>Br,field:()=>Mr,instantiateClass:()=>ut,invokeMethod:()=>Pr,map:()=>$r,mergeArrays:()=>zr,method:()=>Fr,parameter:()=>Or,string:()=>Gr,ternary:()=>Yr,this_:()=>jr,throwException:()=>Dr,trait:()=>Sr,variable:()=>Wr});u();f();u();f();u();f();var W={Public:"public",PublicReadonly:"public readonly",Protected:"protected",Private:"private"};u();f();u();f();u();f();function it(n){return{namespace:n.substring(0,n.lastIndexOf("\\")),name:n.substring(n.lastIndexOf("\\")+1)}}var G=class extends pe{constructor({namespace:e,rootNamespace:r,customConfig:i}){super();c(this,"namespace");c(this,"rootNamespace");c(this,"customConfig");c(this,"references",{});this.namespace=e,this.rootNamespace=r,this.customConfig=i}addReference(e){var s,p;if(e.namespace==null)return;if(Object.keys(this.references).filter(l=>{let d=it(l);return d.namespace!==e.namespace&&d.name===e.name}).length>0){e.requireFullyQualified();return}let i=e.namespace===ve?e.name:`${e.namespace}\\${e.name}`;((p=(s=this.references)[i])!=null?p:s[i]=[]).push(e)}toString(){let e=`namespace ${this.namespace};`,r=this.stringifyImports();return r.length>0?`${e}
9
9
 
10
10
  ${r}
11
11
 
12
12
  ${this.buffer}`:e+`
13
13
 
14
- `+this.buffer}stringifyImports(){let e=Object.keys(this.references);return e.length===0?"":e.filter(r=>nt(r).namespace!==this.namespace).map(r=>`use ${r};`).join(`
15
- `)}};var m=class extends B{toString(t){if(t==null)throw new Error("Internal error; AstNode.toString method called incorrectly.");let{namespace:e,rootNamespace:r,customConfig:i}=t,o=new W({namespace:e,rootNamespace:r,customConfig:i});return this.write(o),o.toString()}async toStringAsync({namespace:t,rootNamespace:e,customConfig:r}){let i=new W({namespace:t,rootNamespace:e,customConfig:r});return this.write(i),i.toString()}};var Q=class extends m{constructor({entries:e}){super();c(this,"entries");this.entries=e!=null?e:[]}write(e){e.write("["),this.entries.forEach((r,i)=>{i>0&&e.write(", "),r.write(e)}),e.write("]")}};u();f();var X=class extends m{constructor(e){var r;super();c(this,"reference");c(this,"arguments");this.reference=e.reference,this.arguments=(r=e.arguments)!=null?r:[]}write(e){e.addReference(this.reference),e.write(`${this.reference.name}`),this.arguments.length>0&&(e.write("("),this.arguments.forEach((r,i)=>{i>0&&e.write(","),typeof r=="string"?e.write(r):r.write(e)}),e.write(")"))}};u();f();u();f();var g=class extends m{constructor({name:e,namespace:r}){super();c(this,"name");c(this,"namespace");c(this,"fullyQualified");this.name=e,this.namespace=r,this.fullyQualified=!1}requireFullyQualified(){this.fullyQualified=!0}write(e){e.addReference(this);let r=this.fullyQualified?`\\${this.namespace}\\${this.name}`:this.name;e.write(`${r}`)}};u();f();u();f();function G(n){return n.startsWith("$")?n:`$${n}`}var L=class extends m{constructor({docs:e}={}){super();c(this,"docs");c(this,"tags",[]);this.docs=e}addTag(e){this.tags.push(ue(ce({},e),{name:e.name!=null?G(e.name):void 0}))}write(e){e.writeLine("/**"),this.docs!=null&&(this.docs.split(`
14
+ `+this.buffer}stringifyImports(){let e=Object.keys(this.references);return e.length===0?"":e.filter(r=>it(r).namespace!==this.namespace).map(r=>`use ${r};`).join(`
15
+ `)}};var m=class extends B{toString(t){if(t==null)throw new Error("Internal error; AstNode.toString method called incorrectly.");let{namespace:e,rootNamespace:r,customConfig:i}=t,o=new G({namespace:e,rootNamespace:r,customConfig:i});return this.write(o),o.toString()}async toStringAsync({namespace:t,rootNamespace:e,customConfig:r}){let i=new G({namespace:t,rootNamespace:e,customConfig:r});return this.write(i),i.toString()}};var X=class extends m{constructor({entries:e}){super();c(this,"entries");this.entries=e!=null?e:[]}write(e){e.write("["),this.entries.forEach((r,i)=>{i>0&&e.write(", "),r.write(e)}),e.write("]")}};u();f();var Z=class extends m{constructor(e){var r;super();c(this,"reference");c(this,"arguments");this.reference=e.reference,this.arguments=(r=e.arguments)!=null?r:[]}write(e){e.addReference(this.reference),e.write(`${this.reference.name}`),this.arguments.length>0&&(e.write("("),this.arguments.forEach((r,i)=>{i>0&&e.write(","),typeof r=="string"?e.write(r):r.write(e)}),e.write(")"))}};u();f();u();f();var g=class extends m{constructor({name:e,namespace:r}){super();c(this,"name");c(this,"namespace");c(this,"fullyQualified");this.name=e,this.namespace=r,this.fullyQualified=!1}requireFullyQualified(){this.fullyQualified=!0}write(e){e.addReference(this);let r=this.fullyQualified?`\\${this.namespace}\\${this.name}`:this.name;e.write(`${r}`)}};u();f();u();f();function z(n){return n.startsWith("$")?n:`$${n}`}var L=class extends m{constructor({docs:e}={}){super();c(this,"docs");c(this,"tags",[]);this.docs=e}addTag(e){this.tags.push(fe(ue({},e),{name:e.name!=null?z(e.name):void 0}))}write(e){e.writeLine("/**"),this.docs!=null&&(this.docs.split(`
16
16
  `).forEach(r=>{e.writeLine(` * ${r}`)}),this.tags.length>0&&e.writeLine(" *"));for(let r of this.tags)this.writeTag({writer:e,tag:r});e.writeLine(" */")}writeTag({writer:e,tag:r}){let i=r.docs!=null?r.docs.split(`
17
- `):void 0;i!=null&&i.length>1&&(i.forEach(o=>{e.writeLine(` * ${o}`)}),e.writeLine(" *")),e.write(` * @${r.tagType} `),r.type.write(e,{comment:!0}),r.name!=null&&e.write(` ${r.name}`),i!=null&&i.length===1&&e.write(` ${i[0]}`),e.newLine()}};u();f();u();f();var ve={Public:"public",Private:"private",Protected:"protected"};function z(n){return gr(n,[ve.Public,ve.Protected,ve.Private])}function gr(n,t){return t.reduce((e,r)=>[...e,...n.filter(i=>i.access===r)],[])}var M=class extends m{constructor({name:e,namespace:r,abstract:i,docs:o,parentClassReference:s,traits:p}){super();c(this,"name");c(this,"namespace");c(this,"abstract");c(this,"docs");c(this,"parentClassReference");c(this,"traits");c(this,"fields",[]);c(this,"methods",[]);c(this,"constructor_");this.name=e,this.namespace=r,this.abstract=i!=null?i:!1,this.docs=o,this.parentClassReference=s,this.traits=p!=null?p:[]}addConstructor(e){this.constructor_=e}addField(e){this.fields.push(e)}addMethod(e){this.methods.push(e)}addTrait(e){this.traits.push(e)}write(e){e.addReference(new g({name:this.name,namespace:this.namespace})),this.abstract&&e.write("abstract "),this.writeComment(e),e.write(`class ${this.name} `),this.parentClassReference!=null&&(e.write("extends "),this.parentClassReference.write(e)),e.newLine(),e.writeLine("{"),e.indent(),this.traits.length>0&&(e.write("use "),this.traits.forEach((r,i)=>{i>0&&e.write(","),e.writeNode(r)}),e.writeTextStatement(""),e.newLine()),this.writeFields({writer:e,fields:z(this.fields)}),(this.constructor!=null||this.methods.length>0)&&e.newLine(),this.constructor_!=null&&(this.writeConstructor({writer:e,constructor:this.constructor_}),this.methods.length>0&&e.newLine()),this.writeMethods({writer:e,methods:z(this.methods)}),e.dedent(),e.writeLine("}")}writeComment(e){if(this.docs==null)return;new L({docs:this.docs}).write(e)}writeConstructor({writer:e,constructor:r}){var i;this.writeConstructorComment({writer:e,constructor:r}),r.access!=null&&e.write(`${r.access} `),e.write("function __construct("),e.indent(),r.parameters.forEach((o,s)=>{s===0&&e.newLine(),o.write(e),e.writeLine(",")}),e.dedent(),e.writeLine(")"),e.writeLine("{"),e.indent(),(i=r.body)==null||i.write(e),e.writeNewLineIfLastLineNot(),e.dedent(),e.writeLine("}")}writeConstructorComment({writer:e,constructor:r}){if(r.parameters.length===0)return;let i=new L;for(let o of r.parameters)i.addTag(o.getCommentTag());i.write(e)}writeFields({writer:e,fields:r}){r.filter(i=>!i.inherited).forEach((i,o)=>{o>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}writeMethods({writer:e,methods:r}){r.forEach((i,o)=>{o>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}};u();f();var Z=class extends m{constructor({name:e,namespace:r,docs:i,traits:o}){super();c(this,"name");c(this,"namespace");c(this,"docs");c(this,"traits");c(this,"fields",[]);c(this,"methods",[]);this.name=e,this.namespace=r,this.docs=i,this.traits=o!=null?o:[]}addField(e){this.fields.push(e)}addMethod(e){this.methods.push(e)}write(e){this.writeComment(e),e.write(`trait ${this.name} `),e.newLine(),e.writeLine("{"),e.indent(),this.traits.length>0&&(e.write("use "),this.traits.forEach((r,i)=>{i>0&&e.write(","),e.writeNode(r)}),e.writeTextStatement(""),e.newLine()),this.writeFields({writer:e,fields:z(this.fields)}),this.writeMethods({writer:e,methods:z(this.methods)}),e.dedent(),e.writeLine("}")}writeComment(e){if(this.docs==null)return;new L({docs:this.docs}).write(e)}writeFields({writer:e,fields:r}){r.forEach((i,o)=>{o>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}writeMethods({writer:e,methods:r}){r.forEach((i,o)=>{o>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}};u();f();u();f();function ae({writer:n,arguments_:t,multiline:e}){if(t.length===0){n.write("()");return}if(e){vr({writer:n,arguments_:t});return}Ar({writer:n,arguments_:t})}function vr({writer:n,arguments_:t}){n.writeLine("("),n.indent();for(let e of t)it({writer:n,argument:e}),n.writeLine(",");n.dedent(),n.write(")")}function Ar({writer:n,arguments_:t}){n.write("("),t.forEach((e,r)=>{r>0&&n.write(", "),it({writer:n,argument:e})}),n.write(")")}function it({writer:n,argument:t}){be(t)?(n.write(`${t.name}: `),n.writeNodeOrString(t.assignment)):t.write(n)}var C=class extends m{constructor({classReference:e,arguments_:r,multiline:i}){super();c(this,"classReference");c(this,"arguments_");c(this,"multiline");this.classReference=e,this.arguments_=r,this.multiline=i!=null?i:!1}write(e){e.write("new "),e.writeNode(this.classReference),ae({writer:e,arguments_:this.arguments_,multiline:this.multiline})}};u();f();var v=class extends m{constructor(e){super();c(this,"arg");this.arg=e}write(e){return new Y(this.arg).write(e)}};u();f();u();f();var P=class extends m{constructor({name:e,type:r,docs:i,initializer:o,access:s,readonly_:p}){super();c(this,"name");c(this,"type");c(this,"docs");c(this,"initializer");c(this,"access");c(this,"readonly_");this.name=G(e),this.type=r,this.docs=i,this.initializer=o,this.access=s,this.readonly_=p!=null?p:!1}getCommentTag(){return{tagType:"param",type:this.type,name:this.name,docs:this.docs}}write(e){this.access!=null&&e.write(`${this.access} `),this.readonly_&&e.write("readonly "),this.type.write(e),e.write(` ${this.name}`),this.initializer!=null?(e.write(" = "),this.initializer.write(e)):this.type.isOptional()&&e.write(" = null")}};u();f();var I=class n extends m{constructor(e){super();c(this,"internalType");this.internalType=e}write(e,{comment:r}={}){switch(this.internalType.type){case"int":e.write("int");break;case"string":e.write("string");break;case"bool":e.write("bool");break;case"float":e.write("float");break;case"date":e.addReference(ot),e.write("DateTime");break;case"dateTime":e.addReference(ot),e.write("DateTime");break;case"mixed":e.write("mixed");break;case"object":e.write("object");break;case"array":if(!r){e.write("array");break}e.write("array<"),this.internalType.value.write(e,{comment:r}),e.write(">");break;case"map":{if(!r){e.write("array");break}e.write("array<"),this.internalType.keyType.write(e,{comment:r}),e.write(", "),this.internalType.valueType.write(e,{comment:r}),e.write(">");break}case"null":{e.write("null");break}case"typeDict":{if(!r){e.write("array");break}if(this.internalType.multiline){e.writeLine("array{");for(let i of this.internalType.entries)e.write(" * "),this.writeTypeDictEntry({writer:e,entry:i,comment:r}),e.writeLine(",");e.write(" * }");break}e.write("array{"),this.internalType.entries.forEach((i,o)=>{o>0&&e.write(", "),this.writeTypeDictEntry({writer:e,entry:i,comment:r})}),e.write("}");break}case"union":{this.getUniqueTypes({types:this.internalType.types,comment:r,writer:e}).forEach((o,s)=>{s>0&&e.write("|"),o.write(e,{comment:r}),s++});break}case"optional":{let i=this.internalType.value.internalType.type==="mixed",o=this.internalType.value.internalType.type==="union";!o&&!i&&e.write("?"),this.internalType.value.write(e,{comment:r}),o&&(e.write("|"),e.writeNode(n.null()));break}case"reference":e.writeNode(this.internalType.value);break;case"enumString":r?(e.write("value-of<"),e.writeNode(this.internalType.value),e.write(">")):e.write("string");break;default:_(this.internalType)}}toOptionalIfNotAlready(){return this.internalType.type==="optional"?this:n.optional(this)}underlyingTypeIfOptional(){if(this.internalType.type==="optional")return this.internalType.value}underlyingType(){var e;return(e=this.underlyingTypeIfOptional())!=null?e:this}isOptional(){return this.internalType.type==="optional"}static int(){return new this({type:"int"})}static string(){return new this({type:"string"})}static bool(){return new this({type:"bool"})}static float(){return new this({type:"float"})}static date(){return new this({type:"date"})}static dateTime(){return new this({type:"dateTime"})}static mixed(){return new this({type:"mixed"})}static object(){return new this({type:"object"})}static array(e){return new this({type:"array",value:e})}static map(e,r){return new this({type:"map",keyType:e,valueType:r})}static typeDict(e,{multiline:r}={}){return new this({type:"typeDict",entries:e,multiline:r})}static union(e){return new this({type:"union",types:e})}static optional(e){return this.isAlreadyOptional(e)?e:new this({type:"optional",value:e})}static null(){return new this({type:"null"})}static reference(e){return new this({type:"reference",value:e})}static enumString(e){return new this({type:"enumString",value:e})}static isAlreadyOptional(e){return e.internalType.type==="optional"}writeTypeDictEntry({writer:e,entry:r,comment:i}){e.write(r.key),r.optional&&e.write("?"),e.write(": "),r.valueType.write(e,{comment:i})}getUniqueTypes({writer:e,types:r,comment:i}){let o=new Set;return r.filter(s=>{if(i)return!0;let p=s.toString({namespace:e.namespace,rootNamespace:e.rootNamespace,customConfig:e.customConfig});return o.has(p)?!1:(o.add(p),!0)})}},ot=new g({namespace:ge,name:"DateTime"});u();f();function st(n){return n.startsWith("$")?n.slice(1):n}var at="values",K=class extends m{constructor({name:e,namespace:r,abstract:i,docs:o,parentClassReference:s,traits:p}){super();c(this,"name");c(this,"namespace");c(this,"class_");this.name=e,this.namespace=r,this.class_=new M({name:e,namespace:r,abstract:i,docs:o,parentClassReference:s,traits:p})}addField(e){this.class_.addField(e)}addMethod(e){this.class_.addMethod(e)}addTrait(e){this.class_.addTrait(e)}write(e){let r=z(this.class_.fields).map(i=>ue(ce({},i),{name:st(i.name)}));r.length>0&&this.class_.addConstructor({access:"public",parameters:this.getConstructorParameters({orderedFields:r}),body:y.codeblock(i=>{for(let o of r)i.write(`$this->${o.name} = $${at}['${o.name}']`),o.type.isOptional()&&i.write(" ?? null"),i.write(";")})}),this.class_.write(e)}allFieldsAreOptional(){return this.class_.fields.every(e=>e.type.isOptional())}getConstructorParameters({orderedFields:e}){return[new P({name:at,type:I.typeDict(e.map(r=>({key:r.name,valueType:r.type,optional:r.type.isOptional()})),{multiline:!0}),initializer:this.allFieldsAreOptional()?new v("[]"):void 0})]}};u();f();u();f();var D=class extends m{constructor({name:e,access:r,parameters:i,throws:o,return_:s,body:p,docs:l,classReference:d}){super();c(this,"name");c(this,"access");c(this,"parameters");c(this,"throws");c(this,"return_");c(this,"body");c(this,"docs");c(this,"classReference");this.name=e,this.access=r,this.parameters=i,this.throws=o!=null?o:[],this.return_=s,this.body=p,this.docs=l,this.classReference=d}write(e){var r;this.writeComment(e),e.write(`${this.access} function ${this.name}(`),this.parameters.forEach((i,o)=>{o>0&&e.write(", "),i.write(e)}),e.write("): "),this.return_!=null?this.return_.write(e):e.write("void"),e.writeLine(" {"),e.indent(),(r=this.body)==null||r.write(e),e.dedent(),e.writeLine("}")}writeComment(e){let r=new L({docs:this.docs});for(let i of this.parameters)r.addTag({tagType:"param",type:i.type,name:i.name,docs:i.docs});this.return_!=null&&r.addTag({tagType:"return",type:this.return_});for(let i of this.throws)r.addTag({tagType:"throws",type:I.reference(i)});e.writeNode(r)}};var ee=class extends m{constructor({name:e,namespace:r,backing:i,docs:o,serializable:s}){super();c(this,"name");c(this,"namespace");c(this,"backing");c(this,"docs");c(this,"members",[]);c(this,"serializable");this.name=e,this.namespace=r,this.backing=i,this.docs=o,this.serializable=s!=null?s:!1}addMember(e){this.members.push(e)}write(e){this.writeComment(e),e.write("enum "),e.writeLine(`${this.name}`),this.backing!=null&&e.write(` : ${this.backing}`),this.serializable&&(e.addReference(new g({name:"JsonSerializable",namespace:""})),e.writeLine(" implements JsonSerializable")),e.writeLine(" {"),e.indent();for(let r of this.members)e.write(`case ${r.name}`),r.value!=null&&(typeof r.value=="string"?e.write(` = "${r.value}"`):e.write(` = ${r.value}`)),e.writeTextStatement("");this.serializable&&(e.newLine(),e.writeNode(new D({name:"jsonSerialize",return_:I.string(),access:"public",parameters:[],body:new v("return $this->value;")}))),e.writeNewLineIfLastLineNot(),e.dedent(),e.writeLine("}")}writeComment(e){if(this.docs==null)return;new L({docs:this.docs}).write(e)}};u();f();var te=class extends m{constructor({name:e,type:r,access:i,readonly_:o,initializer:s,docs:p,inlineDocs:l,attributes:d,inherited:w}){super();c(this,"name");c(this,"type");c(this,"access");c(this,"readonly_");c(this,"initializer");c(this,"docs");c(this,"inlineDocs");c(this,"attributes");c(this,"inherited");this.name=G(e),this.type=r,this.access=i,this.readonly_=o!=null?o:!1,this.initializer=s,this.docs=p,this.inlineDocs=l,this.attributes=d!=null?d:[],this.inherited=w!=null?w:!1}write(e){this.writeComment(e),this.writeAttributesIfPresent(e),e.write(`${this.access} `),this.readonly_&&e.write("readonly "),this.type.write(e),e.write(` ${this.name}`),this.initializer!=null&&(e.write(" = "),this.initializer.write(e)),e.write(";"),this.inlineDocs!=null&&e.write(` // ${this.inlineDocs}`),e.newLine()}writeComment(e){let r=new L;r.addTag({tagType:"var",type:this.type,name:this.name,docs:this.docs}),r.write(e)}writeAttributesIfPresent(e){this.attributes.length>0&&(e.write("#["),this.attributes.forEach((r,i)=>{i>0&&e.write(", "),r.write(e)}),e.writeLine("]"))}};u();f();var re=class extends m{constructor({entries:e,multiline:r}){super();c(this,"entries");c(this,"multiline");this.entries=e!=null?e:[],this.multiline=r!=null?r:!1}write(e){if(this.multiline){this.writeMultiline(e);return}this.writeCompact(e)}writeMultiline(e){e.writeLine("["),e.indent();for(let{key:r,value:i}of this.entries)r.write(e),e.write(" => "),i.write(e),e.writeLine(",");e.dedent(),e.write("]")}writeCompact(e){e.write("[");for(let[r,{key:i,value:o}]of this.entries.entries())r>0&&e.write(", "),i.write(e),e.write(" => "),o.write(e);e.write("]")}};u();f();var $=class extends m{constructor({method:e,arguments_:r,static_:i,multiline:o,on:s}){super();c(this,"method");c(this,"arguments_");c(this,"multiline");c(this,"static_");c(this,"on");this.method=e,this.arguments_=r,this.static_=i!=null?i:!1,this.multiline=o!=null?o:!1,this.on=s}write(e){this.on!=null&&(this.on.write(e),e.write(this.getMethodAccessor())),e.write(this.method),ae({writer:e,arguments_:this.arguments_,multiline:this.multiline})}getMethodAccessor(){return this.static_?"::":"->"}};u();f();u();f();var j=class n extends m{constructor(e){super();c(this,"internalType");this.internalType=e}write(e){switch(this.internalType.type){case"list":{this.writeList({writer:e,list:this.internalType});break}case"boolean":{e.write(this.internalType.value.toString());break}case"class":{this.writeClass({writer:e,class_:this.internalType});break}case"file":{e.writeNode(Lr({writer:e,value:this.internalType.value}));break}case"float":{e.write(this.internalType.value.toString());break}case"number":{e.write(this.internalType.value.toString());break}case"map":{this.writeMap({writer:e,map:this.internalType});break}case"reference":{e.writeNode(this.internalType.value);break}case"datetime":{e.writeNode(Er({writer:e,value:this.internalType.value}));break}case"string":{if(this.internalType.value.includes(`
18
- `)){this.writeStringWithHeredoc({writer:e,value:this.internalType.value});break}e.write(`'${this.internalType.value.replaceAll("'","\\'")}'`);break}case"unknown":{this.writeUnknown({writer:e,value:this.internalType.value});break}case"null":{e.write("null");break}case"nop":break;default:_(this.internalType)}}writeStringWithHeredoc({writer:e,value:r}){e.writeLine("<<<EOT"),e.writeNoIndent(r),e.newLine(),e.writeNoIndent("EOT")}writeClass({writer:e,class_:r}){e.writeNode(new C({classReference:r.reference,arguments_:[n.map({entries:r.fields.map(i=>({key:n.string(i.name),value:i.value}))})]}))}writeList({writer:e,list:r}){let i=Rr({values:r.values});if(i.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let o of i)o.write(e),e.writeLine(",");e.dedent(),e.write("]")}writeMap({writer:e,map:r}){let i=Nr({entries:r.entries});if(i.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let o of i)o.key.write(e),e.write(" => "),o.value.write(e),e.writeLine(",");e.dedent(),e.write("]")}static list({values:e}){return new this({type:"list",values:e})}static boolean(e){return new this({type:"boolean",value:e})}static class_({reference:e,fields:r}){return new this({type:"class",reference:e,fields:r})}static file(e){return new this({type:"file",value:e})}static float(e){return new this({type:"float",value:e})}static datetime(e){return new this({type:"datetime",value:e})}static number(e){return new this({type:"number",value:e})}static map({entries:e}){return new this({type:"map",entries:e})}static reference(e){return new this({type:"reference",value:e})}static string(e){return new this({type:"string",value:e})}static unknown(e){return new this({type:"unknown",value:e})}static null(){return new this({type:"null"})}static nop(){return new this({type:"nop"})}static isNop(e){return e.internalType.type==="nop"}writeUnknown({writer:e,value:r}){switch(typeof r){case"boolean":e.write(r.toString());return;case"string":e.write(r.includes('"')?`\`${r}\``:`"${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("[]");return}e.writeLine("["),e.indent();for(let i of r)e.writeNode(n.unknown(i)),e.writeLine(",");e.dedent(),e.write("]")}writeUnknownMap({writer:e,value:r}){let i=Object.entries(r);if(i.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let[o,s]of i)e.write(`'${o}' => `),e.writeNode(n.unknown(s)),e.writeLine(",");e.dedent(),e.write("]")}};function Er({writer:n,value:t}){return new C({classReference:new g({name:"DateTime",namespace:""}),arguments_:[new v(`'${t}'`)]})}function Lr({writer:n,value:t}){return new $({on:new g({name:"File",namespace:`${n.rootNamespace}\\Utils`}),method:"createFromString",arguments_:[new v(`"${t}"`)]})}function Nr({entries:n}){return n.filter(t=>!j.isNop(t.key)&&!j.isNop(t.value))}function Rr({values:n}){return n.filter(t=>!j.isNop(t))}u();f();var Ae=class extends m{constructor(e){super();c(this,"arrays");this.arrays=e}write(e){e.write("array_merge"),ae({writer:e,arguments_:this.arrays.map(r=>ne(i=>{if(typeof r=="string"||r instanceof m){i.writeNodeOrString(r);return}i.writeNodeOrString(r.ref),r.fallback&&(i.write(" ?? "),i.writeNodeOrString(r.fallback))}))})}};function Ir(n){return new Q(n)}function kr(n){return new X(n)}function br(n){return new M(n)}function _r(n){return new Z(n)}function Cr(n){return new g(n)}function ne(n){return new v(n)}function Sr(n){return new K(n)}function Ur(n){return new ee(n)}function Br(n){return new te(n)}function ct(n){return new C(n)}function Mr(n){return new $(n)}function Pr(n){return ne(t=>{t.write("throw "),t.writeNode(ct(n))})}function Dr(n){return new re(n)}function $r(n){return new D(n)}function Fr(n){return new P(n)}function Or(n){return new pe(n)}function Yr(n,t){return ne(e=>{e.writeNodeOrString(n),e.write(" = "),e.writeNodeOrString(t)})}function Vr(n){return ne(G(n))}function Wr(n){return ne(`"${n}"`)}function Gr(...n){return new Ae(n)}function zr(){return new v(n=>{n.write("$this")})}var _e=class{constructor({context:t}){c(this,"context");this.context=t}convert(t){if(t.value===null)return this.context.isNullable(t.typeReference)?y.TypeLiteral.null():(this.context.errors.add({severity:V.Critical,message:"Expected non-null value, but got null"}),y.TypeLiteral.nop());if(t.value===void 0)return y.TypeLiteral.nop();switch(t.typeReference.type){case"list":case"set":return this.convertList({list:t.typeReference.value,value:t.value});case"literal":return this.convertLiteral({literalType: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?y.TypeLiteral.nop():this.convertNamed({named:e,value:t.value,as:t.as})}case"optional":return this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as});case"nullable":return this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as});case"primitive":return this.convertPrimitive({primitive:t.typeReference.value,value:t.value,as:t.as});case"unknown":return this.convertUnknown({value:t.value});default:_(t.typeReference)}}convertLiteral({literalType:t,value:e}){switch(t.type){case"boolean":{let r=this.context.getValueAsBoolean({value:e});return r==null?y.TypeLiteral.nop():y.TypeLiteral.boolean(r)}case"string":{let r=this.context.getValueAsString({value:e});return r==null?y.TypeLiteral.nop():y.TypeLiteral.string(r)}default:_(t)}}convertList({list:t,value:e}){return Array.isArray(e)?y.TypeLiteral.list({values:e.map((r,i)=>{this.context.errors.scope({index:i});try{return this.convert({typeReference:t,value:r})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:V.Critical,message:`Expected array but got: ${typeof e}`}),y.TypeLiteral.nop())}convertMap({map:t,value:e}){return typeof e!="object"||e==null?(this.context.errors.add({severity:V.Critical,message:`Expected object but got: ${e==null?"null":typeof e}`}),y.TypeLiteral.nop()):y.TypeLiteral.map({entries:Object.entries(e).map(([r,i])=>{this.context.errors.scope(r);try{return{key:this.convert({typeReference:t.key,value:r,as:"key"}),value:this.convert({typeReference:t.value,value:i})}}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});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e});default:_(t)}}convertDiscriminatedUnion({discriminatedUnion:t,value:e}){return y.TypeLiteral.string("todo")}convertObject({object_:t,value:e}){var i;let r=this.context.associateByWireValue({parameters:t.properties,values:(i=this.context.getRecord(e))!=null?i:{}});return y.TypeLiteral.class_({reference:y.classReference({name:this.context.getClassName(t.declaration.name),namespace:this.context.getTypesNamespace(t.declaration.fernFilepath)}),fields:r.map(o=>{this.context.errors.scope(o.name.wireValue);try{return{name:this.context.getPropertyName(o.name.name),value:this.convert(o)}}finally{this.context.errors.unscope()}})})}convertEnum({enum_:t,value:e}){let r=this.getEnumValueName({enum_:t,value:e});return r==null?y.TypeLiteral.nop():y.TypeLiteral.reference(y.codeblock(i=>{i.writeNode(y.classReference({name:this.context.getClassName(t.declaration.name),namespace:this.context.getTypesNamespace(t.declaration.fernFilepath)})),i.write("::"),i.write(r),i.write("->value")}))}getEnumValueName({enum_:t,value:e}){if(typeof e!="string"){this.context.errors.add({severity:V.Critical,message:`Expected enum value string, got: ${typeof e}`});return}let r=t.values.find(i=>i.wireValue===e);if(r==null){this.context.errors.add({severity:V.Critical,message:`An enum value named "${e}" does not exist in this context`});return}return this.context.getClassName(r.name)}convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e}){let r=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e});return r==null?y.TypeLiteral.nop():r}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e}){for(let r of t.types)try{return this.convert({typeReference:r,value:e})}catch(i){continue}this.context.errors.add({severity:V.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof e}" value`})}convertUnknown({value:t}){return y.TypeLiteral.unknown(t)}convertPrimitive({primitive:t,value:e,as:r}){switch(t){case"INTEGER":case"LONG":case"UINT":case"UINT_64":{let i=this.getValueAsNumber({value:e,as:r});return i==null?y.TypeLiteral.nop():y.TypeLiteral.number(i)}case"FLOAT":case"DOUBLE":{let i=this.getValueAsNumber({value:e});return i==null?y.TypeLiteral.nop():y.TypeLiteral.float(i)}case"BOOLEAN":{let i=this.getValueAsBoolean({value:e,as:r});return i==null?y.TypeLiteral.nop():y.TypeLiteral.boolean(i)}case"DATE":case"DATE_TIME":{let i=this.context.getValueAsString({value:e});return i==null?y.TypeLiteral.nop():y.TypeLiteral.datetime(i)}case"BASE_64":case"UUID":case"BIG_INTEGER":case"STRING":{let i=this.context.getValueAsString({value:e});return i==null?y.TypeLiteral.nop():y.TypeLiteral.string(i)}default:_(t)}}getValueAsNumber({value:t,as:e}){let r=e==="key"&&typeof t=="string"?Number(t):t;return this.context.getValueAsNumber({value:r})}getValueAsBoolean({value:t,as:e}){let r=e==="key"?typeof t=="string"?t==="true":t==="false"?!1:t:t;return this.context.getValueAsBoolean({value:r})}};0&&(module.exports={DynamicTypeLiteralMapper});
17
+ `):void 0;i!=null&&i.length>1&&(i.forEach(o=>{e.writeLine(` * ${o}`)}),e.writeLine(" *")),e.write(` * @${r.tagType} `),r.type.write(e,{comment:!0}),r.name!=null&&e.write(` ${r.name}`),i!=null&&i.length===1&&e.write(` ${i[0]}`),e.newLine()}};u();f();function j(n){return vr(n,[W.Public,W.PublicReadonly,W.Protected,W.Private])}function vr(n,t){return t.reduce((e,r)=>[...e,...n.filter(i=>i.access===r)],[])}var M=class extends m{constructor({name:e,namespace:r,abstract:i,docs:o,parentClassReference:s,traits:p}){super();c(this,"name");c(this,"namespace");c(this,"abstract");c(this,"docs");c(this,"parentClassReference");c(this,"traits");c(this,"fields",[]);c(this,"methods",[]);c(this,"constructor_");this.name=e,this.namespace=r,this.abstract=i!=null?i:!1,this.docs=o,this.parentClassReference=s,this.traits=p!=null?p:[]}addConstructor(e){this.constructor_=e}addField(e){this.fields.push(e)}addMethod(e){this.methods.push(e)}addTrait(e){this.traits.push(e)}write(e){e.addReference(new g({name:this.name,namespace:this.namespace})),this.abstract&&e.write("abstract "),this.writeComment(e),e.write(`class ${this.name} `),this.parentClassReference!=null&&(e.write("extends "),this.parentClassReference.write(e)),e.newLine(),e.writeLine("{"),e.indent(),this.traits.length>0&&(e.write("use "),this.traits.forEach((r,i)=>{i>0&&e.write(","),e.writeNode(r)}),e.writeTextStatement(""),e.newLine()),this.writeFields({writer:e,fields:j(this.fields)}),(this.constructor!=null||this.methods.length>0)&&e.newLine(),this.constructor_!=null&&(this.writeConstructor({writer:e,constructor:this.constructor_}),this.methods.length>0&&e.newLine()),this.writeMethods({writer:e,methods:j(this.methods)}),e.dedent(),e.writeLine("}")}writeComment(e){if(this.docs==null)return;new L({docs:this.docs}).write(e)}writeConstructor({writer:e,constructor:r}){var i;this.writeConstructorComment({writer:e,constructor:r}),r.access!=null&&e.write(`${r.access} `),e.write("function __construct("),e.indent(),r.parameters.forEach((o,s)=>{s===0&&e.newLine(),o.write(e),e.writeLine(",")}),e.dedent(),e.writeLine(")"),e.writeLine("{"),e.indent(),(i=r.body)==null||i.write(e),e.writeNewLineIfLastLineNot(),e.dedent(),e.writeLine("}")}writeConstructorComment({writer:e,constructor:r}){if(r.parameters.length===0)return;let i=new L;for(let o of r.parameters)i.addTag(o.getCommentTag());i.write(e)}writeFields({writer:e,fields:r}){r.filter(i=>!i.inherited).forEach((i,o)=>{o>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}writeMethods({writer:e,methods:r}){r.forEach((i,o)=>{o>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}};u();f();var K=class extends m{constructor({name:e,namespace:r,docs:i,traits:o}){super();c(this,"name");c(this,"namespace");c(this,"docs");c(this,"traits");c(this,"fields",[]);c(this,"methods",[]);this.name=e,this.namespace=r,this.docs=i,this.traits=o!=null?o:[]}addField(e){this.fields.push(e)}addMethod(e){this.methods.push(e)}write(e){this.writeComment(e),e.write(`trait ${this.name} `),e.newLine(),e.writeLine("{"),e.indent(),this.traits.length>0&&(e.write("use "),this.traits.forEach((r,i)=>{i>0&&e.write(","),e.writeNode(r)}),e.writeTextStatement(""),e.newLine()),this.writeFields({writer:e,fields:j(this.fields)}),this.fields.length>0&&this.methods.length>0&&e.newLine(),this.writeMethods({writer:e,methods:j(this.methods)}),e.dedent(),e.writeLine("}")}writeComment(e){let r=new L({docs:this.docs});for(let i of this.fields)r.addTag({tagType:"property",type:i.type,name:i.name});r.write(e)}writeFields({writer:e,fields:r}){r.forEach((i,o)=>{o>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}writeMethods({writer:e,methods:r}){r.forEach((i,o)=>{o>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}};u();f();u();f();function ce({writer:n,arguments_:t,multiline:e}){if(t.length===0){n.write("()");return}if(e){Ar({writer:n,arguments_:t});return}Er({writer:n,arguments_:t})}function Ar({writer:n,arguments_:t}){n.writeLine("("),n.indent();for(let e of t)ot({writer:n,argument:e}),n.writeLine(",");n.dedent(),n.write(")")}function Er({writer:n,arguments_:t}){n.write("("),t.forEach((e,r)=>{r>0&&n.write(", "),ot({writer:n,argument:e})}),n.write(")")}function ot({writer:n,argument:t}){ke(t)?(n.write(`${t.name}: `),n.writeNodeOrString(t.assignment)):t.write(n)}var S=class extends m{constructor({classReference:e,arguments_:r,multiline:i}){super();c(this,"classReference");c(this,"arguments_");c(this,"multiline");this.classReference=e,this.arguments_=r,this.multiline=i!=null?i:!1}write(e){e.write("new "),e.writeNode(this.classReference),ce({writer:e,arguments_:this.arguments_,multiline:this.multiline})}};u();f();var v=class extends m{constructor(e){super();c(this,"arg");this.arg=e}write(e){return new Y(this.arg).write(e)}};u();f();u();f();var P=class extends m{constructor({name:e,type:r,docs:i,initializer:o,access:s,readonly_:p}){super();c(this,"name");c(this,"type");c(this,"docs");c(this,"initializer");c(this,"access");c(this,"readonly_");this.name=z(e),this.type=r,this.docs=i,this.initializer=o,this.access=s,this.readonly_=p!=null?p:!1}getCommentTag(){return{tagType:"param",type:this.type,name:this.name,docs:this.docs}}write(e){this.access!=null&&e.write(`${this.access} `),this.readonly_&&e.write("readonly "),this.type.write(e),e.write(` ${this.name}`),this.initializer!=null?(e.write(" = "),this.initializer.write(e)):this.type.isOptional()&&e.write(" = null")}};u();f();var I=class n extends m{constructor(e){super();c(this,"internalType");this.internalType=e}write(e,{comment:r}={}){switch(this.internalType.type){case"int":e.write("int");break;case"string":e.write("string");break;case"bool":e.write("bool");break;case"float":e.write("float");break;case"date":e.addReference(st),e.write("DateTime");break;case"dateTime":e.addReference(st),e.write("DateTime");break;case"mixed":e.write("mixed");break;case"object":e.write("object");break;case"array":if(!r){e.write("array");break}e.write("array<"),this.internalType.value.write(e,{comment:r}),e.write(">");break;case"map":{if(!r){e.write("array");break}e.write("array<"),this.internalType.keyType.write(e,{comment:r}),e.write(", "),this.internalType.valueType.write(e,{comment:r}),e.write(">");break}case"null":{e.write("null");break}case"typeDict":{if(!r){e.write("array");break}if(this.internalType.multiline){e.writeLine("array{");for(let i of this.internalType.entries)e.write(" * "),this.writeTypeDictEntry({writer:e,entry:i,comment:r}),e.writeLine(",");e.write(" * }");break}e.write("array{"),this.internalType.entries.forEach((i,o)=>{o>0&&e.write(", "),this.writeTypeDictEntry({writer:e,entry:i,comment:r})}),e.write("}");break}case"union":{this.getUniqueTypes({types:this.internalType.types,comment:r,writer:e}).forEach((o,s)=>{s>0&&e.write("|"),o.write(e,{comment:r}),s++});break}case"optional":{let i=this.internalType.value.internalType.type==="mixed",o=this.internalType.value.internalType.type==="union";!o&&!i&&e.write("?"),this.internalType.value.write(e,{comment:r}),o&&(e.write("|"),e.writeNode(n.null()));break}case"reference":e.writeNode(this.internalType.value);break;case"enumString":r?(e.write("value-of<"),e.writeNode(this.internalType.value),e.write(">")):e.write("string");break;default:_(this.internalType)}}toOptionalIfNotAlready(){return this.internalType.type==="optional"?this:n.optional(this)}underlyingTypeIfOptional(){if(this.internalType.type==="optional")return this.internalType.value}underlyingType(){var e;return(e=this.underlyingTypeIfOptional())!=null?e:this}isOptional(){return this.internalType.type==="optional"}static int(){return new this({type:"int"})}static string(){return new this({type:"string"})}static bool(){return new this({type:"bool"})}static float(){return new this({type:"float"})}static date(){return new this({type:"date"})}static dateTime(){return new this({type:"dateTime"})}static mixed(){return new this({type:"mixed"})}static object(){return new this({type:"object"})}static array(e){return new this({type:"array",value:e})}static map(e,r){return new this({type:"map",keyType:e,valueType:r})}static typeDict(e,{multiline:r}={}){return new this({type:"typeDict",entries:e,multiline:r})}static union(e){return new this({type:"union",types:e})}static optional(e){return this.isAlreadyOptional(e)?e:new this({type:"optional",value:e})}static null(){return new this({type:"null"})}static reference(e){return new this({type:"reference",value:e})}static enumString(e){return new this({type:"enumString",value:e})}static isAlreadyOptional(e){return e.internalType.type==="optional"}writeTypeDictEntry({writer:e,entry:r,comment:i}){e.write(r.key),r.optional&&e.write("?"),e.write(": "),r.valueType.write(e,{comment:i})}getUniqueTypes({writer:e,types:r,comment:i}){let o=new Set;return r.filter(s=>{if(i)return!0;let p=s.toString({namespace:e.namespace,rootNamespace:e.rootNamespace,customConfig:e.customConfig});return o.has(p)?!1:(o.add(p),!0)})}},st=new g({namespace:ve,name:"DateTime"});u();f();function at(n){return n.startsWith("$")?n.slice(1):n}var ct="values",ee=class extends m{constructor({name:e,namespace:r,abstract:i,docs:o,parentClassReference:s,traits:p}){super();c(this,"name");c(this,"namespace");c(this,"class_");this.name=e,this.namespace=r,this.class_=new M({name:e,namespace:r,abstract:i,docs:o,parentClassReference:s,traits:p})}addField(e){this.class_.addField(e)}addMethod(e){this.class_.addMethod(e)}addTrait(e){this.class_.addTrait(e)}write(e){let r=j(this.class_.fields).map(i=>fe(ue({},i),{name:at(i.name)}));r.length>0&&this.class_.addConstructor({access:"public",parameters:this.getConstructorParameters({orderedFields:r}),body:y.codeblock(i=>{for(let o of r)i.write(`$this->${o.name} = $${ct}['${o.name}']`),o.type.isOptional()&&i.write(" ?? null"),i.write(";")})}),this.class_.write(e)}allFieldsAreOptional(){return this.class_.fields.every(e=>e.type.isOptional())}getConstructorParameters({orderedFields:e}){return[new P({name:ct,type:I.typeDict(e.map(r=>({key:r.name,valueType:r.type,optional:r.type.isOptional()})),{multiline:!0}),initializer:this.allFieldsAreOptional()?new v("[]"):void 0})]}};u();f();u();f();var D=class extends m{constructor({name:e,access:r,parameters:i,throws:o,return_:s,body:p,docs:l,classReference:d}){super();c(this,"name");c(this,"access");c(this,"parameters");c(this,"throws");c(this,"return_");c(this,"body");c(this,"docs");c(this,"classReference");this.name=e,this.access=r,this.parameters=i,this.throws=o!=null?o:[],this.return_=s,this.body=p,this.docs=l,this.classReference=d}write(e){var r;this.writeComment(e),e.write(`${this.access} function ${this.name}(`),this.parameters.forEach((i,o)=>{o>0&&e.write(", "),i.write(e)}),e.write("): "),this.return_!=null?e.writeNodeOrString(this.return_):e.write("void"),e.writeLine(" {"),e.indent(),(r=this.body)==null||r.write(e),e.dedent(),e.writeLine("}")}writeComment(e){let r=new L({docs:this.docs});for(let i of this.parameters)r.addTag({tagType:"param",type:i.type,name:i.name,docs:i.docs});this.return_!=null&&this.return_!==nt&&r.addTag({tagType:"return",type:this.return_});for(let i of this.throws)r.addTag({tagType:"throws",type:I.reference(i)});e.writeNode(r)}};var te=class extends m{constructor({name:e,namespace:r,backing:i,docs:o,serializable:s}){super();c(this,"name");c(this,"namespace");c(this,"backing");c(this,"docs");c(this,"members",[]);c(this,"serializable");this.name=e,this.namespace=r,this.backing=i,this.docs=o,this.serializable=s!=null?s:!1}addMember(e){this.members.push(e)}write(e){this.writeComment(e),e.write("enum "),e.writeLine(`${this.name}`),this.backing!=null&&e.write(` : ${this.backing}`),this.serializable&&(e.addReference(new g({name:"JsonSerializable",namespace:""})),e.writeLine(" implements JsonSerializable")),e.writeLine(" {"),e.indent();for(let r of this.members)e.write(`case ${r.name}`),r.value!=null&&(typeof r.value=="string"?e.write(` = "${r.value}"`):e.write(` = ${r.value}`)),e.writeTextStatement("");this.serializable&&(e.newLine(),e.writeNode(new D({name:"jsonSerialize",return_:I.string(),access:"public",parameters:[],body:new v("return $this->value;")}))),e.writeNewLineIfLastLineNot(),e.dedent(),e.writeLine("}")}writeComment(e){if(this.docs==null)return;new L({docs:this.docs}).write(e)}};u();f();var re=class extends m{constructor({name:e,type:r,access:i,readonly_:o,initializer:s,docs:p,inlineDocs:l,attributes:d,inherited:w}){super();c(this,"name");c(this,"type");c(this,"access");c(this,"readonly_");c(this,"initializer");c(this,"docs");c(this,"inlineDocs");c(this,"attributes");c(this,"inherited");this.name=z(e),this.type=r,this.access=i,this.readonly_=o!=null?o:!1,this.initializer=s,this.docs=p,this.inlineDocs=l,this.attributes=d!=null?d:[],this.inherited=w!=null?w:!1}write(e){this.writeComment(e),this.writeAttributesIfPresent(e),e.write(`${this.access} `),this.readonly_&&e.write("readonly "),this.type.write(e),e.write(` ${this.name}`),this.initializer!=null&&(e.write(" = "),this.initializer.write(e)),e.write(";"),this.inlineDocs!=null&&e.write(` // ${this.inlineDocs}`),e.newLine()}writeComment(e){let r=new L;r.addTag({tagType:"var",type:this.type,name:this.name,docs:this.docs}),r.write(e)}writeAttributesIfPresent(e){this.attributes.length>0&&(e.write("#["),this.attributes.forEach((r,i)=>{i>0&&e.write(", "),r.write(e)}),e.writeLine("]"))}};u();f();var ne=class extends m{constructor({entries:e,multiline:r}){super();c(this,"entries");c(this,"multiline");this.entries=e!=null?e:[],this.multiline=r!=null?r:!1}write(e){if(this.multiline){this.writeMultiline(e);return}this.writeCompact(e)}writeMultiline(e){e.writeLine("["),e.indent();for(let{key:r,value:i}of this.entries)r.write(e),e.write(" => "),i.write(e),e.writeLine(",");e.dedent(),e.write("]")}writeCompact(e){e.write("[");for(let[r,{key:i,value:o}]of this.entries.entries())r>0&&e.write(", "),i.write(e),e.write(" => "),o.write(e);e.write("]")}};u();f();var $=class extends m{constructor({method:e,arguments_:r,static_:i,multiline:o,on:s}){super();c(this,"method");c(this,"arguments_");c(this,"multiline");c(this,"static_");c(this,"on");this.method=e,this.arguments_=r,this.static_=i!=null?i:!1,this.multiline=o!=null?o:!1,this.on=s}write(e){this.on!=null&&(this.on.write(e),e.write(this.getMethodAccessor())),e.write(this.method),ce({writer:e,arguments_:this.arguments_,multiline:this.multiline})}getMethodAccessor(){return this.static_?"::":"->"}};u();f();u();f();var J=class n extends m{constructor(e){super();c(this,"internalType");this.internalType=e}write(e){switch(this.internalType.type){case"list":{this.writeList({writer:e,list:this.internalType});break}case"boolean":{e.write(this.internalType.value.toString());break}case"class":{this.writeClass({writer:e,class_:this.internalType});break}case"file":{e.writeNode(Nr({writer:e,value:this.internalType.value}));break}case"float":{e.write(this.internalType.value.toString());break}case"number":{e.write(this.internalType.value.toString());break}case"map":{this.writeMap({writer:e,map:this.internalType});break}case"reference":{e.writeNode(this.internalType.value);break}case"datetime":{e.writeNode(Lr({writer:e,value:this.internalType.value}));break}case"string":{if(this.internalType.value.includes(`
18
+ `)){this.writeStringWithHeredoc({writer:e,value:this.internalType.value});break}e.write(`'${this.internalType.value.replaceAll("'","\\'")}'`);break}case"unknown":{this.writeUnknown({writer:e,value:this.internalType.value});break}case"null":{e.write("null");break}case"nop":break;default:_(this.internalType)}}writeStringWithHeredoc({writer:e,value:r}){e.writeLine("<<<EOT"),e.writeNoIndent(r),e.newLine(),e.writeNoIndent("EOT")}writeClass({writer:e,class_:r}){e.writeNode(new S({classReference:r.reference,arguments_:[n.map({entries:r.fields.map(i=>({key:n.string(i.name),value:i.value}))})]}))}writeList({writer:e,list:r}){let i=Ir({values:r.values});if(i.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let o of i)o.write(e),e.writeLine(",");e.dedent(),e.write("]")}writeMap({writer:e,map:r}){let i=Rr({entries:r.entries});if(i.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let o of i)o.key.write(e),e.write(" => "),o.value.write(e),e.writeLine(",");e.dedent(),e.write("]")}static list({values:e}){return new this({type:"list",values:e})}static boolean(e){return new this({type:"boolean",value:e})}static class_({reference:e,fields:r}){return new this({type:"class",reference:e,fields:r})}static file(e){return new this({type:"file",value:e})}static float(e){return new this({type:"float",value:e})}static datetime(e){return new this({type:"datetime",value:e})}static number(e){return new this({type:"number",value:e})}static map({entries:e}){return new this({type:"map",entries:e})}static reference(e){return new this({type:"reference",value:e})}static string(e){return new this({type:"string",value:e})}static unknown(e){return new this({type:"unknown",value:e})}static null(){return new this({type:"null"})}static nop(){return new this({type:"nop"})}static isNop(e){return e.internalType.type==="nop"}writeUnknown({writer:e,value:r}){switch(typeof r){case"boolean":e.write(r.toString());return;case"string":e.write(r.includes('"')?`\`${r}\``:`"${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("[]");return}e.writeLine("["),e.indent();for(let i of r)e.writeNode(n.unknown(i)),e.writeLine(",");e.dedent(),e.write("]")}writeUnknownMap({writer:e,value:r}){let i=Object.entries(r);if(i.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let[o,s]of i)e.write(`'${o}' => `),e.writeNode(n.unknown(s)),e.writeLine(",");e.dedent(),e.write("]")}};function Lr({writer:n,value:t}){return new S({classReference:new g({name:"DateTime",namespace:""}),arguments_:[new v(`'${t}'`)]})}function Nr({writer:n,value:t}){return new $({on:new g({name:"File",namespace:`${n.rootNamespace}\\Utils`}),method:"createFromString",arguments_:[new v(`"${t}"`)]})}function Rr({entries:n}){return n.filter(t=>!J.isNop(t.key)&&!J.isNop(t.value))}function Ir({values:n}){return n.filter(t=>!J.isNop(t))}u();f();var Ae=class extends m{constructor(e){super();c(this,"arrays");this.arrays=e}write(e){e.write("array_merge"),ce({writer:e,arguments_:this.arrays.map(r=>ie(i=>{if(typeof r=="string"||r instanceof m){i.writeNodeOrString(r);return}i.writeNodeOrString(r.ref),r.fallback&&(i.write(" ?? "),i.writeNodeOrString(r.fallback))}))})}};function br(n){return new X(n)}function kr(n){return new Z(n)}function _r(n){return new M(n)}function Sr(n){return new K(n)}function Cr(n){return new g(n)}function ie(n){return new v(n)}function Ur(n){return new ee(n)}function Br(n){return new te(n)}function Mr(n){return new re(n)}function ut(n){return new S(n)}function Pr(n){return new $(n)}function Dr(n){return ie(t=>{t.write("throw "),t.writeNode(ut(n))})}function $r(n){return new ne(n)}function Fr(n){return new D(n)}function Or(n){return new P(n)}function Yr(n){return new le(n)}function Vr(n,t){return ie(e=>{e.writeNodeOrString(n),e.write(" = "),e.writeNodeOrString(t)})}function Wr(n){return ie(z(n))}function Gr(n){return ie(`"${n}"`)}function zr(...n){return new Ae(n)}function jr(){return new v(n=>{n.write("$this")})}var _e=class{constructor({context:t}){c(this,"context");this.context=t}convert(t){if(t.value===null)return this.context.isNullable(t.typeReference)?y.TypeLiteral.null():(this.context.errors.add({severity:V.Critical,message:"Expected non-null value, but got null"}),y.TypeLiteral.nop());if(t.value===void 0)return y.TypeLiteral.nop();switch(t.typeReference.type){case"list":case"set":return this.convertList({list:t.typeReference.value,value:t.value});case"literal":return this.convertLiteral({literalType: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?y.TypeLiteral.nop():this.convertNamed({named:e,value:t.value,as:t.as})}case"optional":return this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as});case"nullable":return this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as});case"primitive":return this.convertPrimitive({primitive:t.typeReference.value,value:t.value,as:t.as});case"unknown":return this.convertUnknown({value:t.value});default:_(t.typeReference)}}convertLiteral({literalType:t,value:e}){switch(t.type){case"boolean":{let r=this.context.getValueAsBoolean({value:e});return r==null?y.TypeLiteral.nop():y.TypeLiteral.boolean(r)}case"string":{let r=this.context.getValueAsString({value:e});return r==null?y.TypeLiteral.nop():y.TypeLiteral.string(r)}default:_(t)}}convertList({list:t,value:e}){return Array.isArray(e)?y.TypeLiteral.list({values:e.map((r,i)=>{this.context.errors.scope({index:i});try{return this.convert({typeReference:t,value:r})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:V.Critical,message:`Expected array but got: ${typeof e}`}),y.TypeLiteral.nop())}convertMap({map:t,value:e}){return typeof e!="object"||e==null?(this.context.errors.add({severity:V.Critical,message:`Expected object but got: ${e==null?"null":typeof e}`}),y.TypeLiteral.nop()):y.TypeLiteral.map({entries:Object.entries(e).map(([r,i])=>{this.context.errors.scope(r);try{return{key:this.convert({typeReference:t.key,value:r,as:"key"}),value:this.convert({typeReference:t.value,value:i})}}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});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e});default:_(t)}}convertDiscriminatedUnion({discriminatedUnion:t,value:e}){return y.TypeLiteral.string("todo")}convertObject({object_:t,value:e}){var i;let r=this.context.associateByWireValue({parameters:t.properties,values:(i=this.context.getRecord(e))!=null?i:{}});return y.TypeLiteral.class_({reference:y.classReference({name:this.context.getClassName(t.declaration.name),namespace:this.context.getTypesNamespace(t.declaration.fernFilepath)}),fields:r.map(o=>{this.context.errors.scope(o.name.wireValue);try{return{name:this.context.getPropertyName(o.name.name),value:this.convert(o)}}finally{this.context.errors.unscope()}})})}convertEnum({enum_:t,value:e}){let r=this.getEnumValueName({enum_:t,value:e});return r==null?y.TypeLiteral.nop():y.TypeLiteral.reference(y.codeblock(i=>{i.writeNode(y.classReference({name:this.context.getClassName(t.declaration.name),namespace:this.context.getTypesNamespace(t.declaration.fernFilepath)})),i.write("::"),i.write(r),i.write("->value")}))}getEnumValueName({enum_:t,value:e}){if(typeof e!="string"){this.context.errors.add({severity:V.Critical,message:`Expected enum value string, got: ${typeof e}`});return}let r=t.values.find(i=>i.wireValue===e);if(r==null){this.context.errors.add({severity:V.Critical,message:`An enum value named "${e}" does not exist in this context`});return}return this.context.getClassName(r.name)}convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e}){let r=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e});return r==null?y.TypeLiteral.nop():r}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e}){for(let r of t.types)try{return this.convert({typeReference:r,value:e})}catch(i){continue}this.context.errors.add({severity:V.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof e}" value`})}convertUnknown({value:t}){return y.TypeLiteral.unknown(t)}convertPrimitive({primitive:t,value:e,as:r}){switch(t){case"INTEGER":case"LONG":case"UINT":case"UINT_64":{let i=this.getValueAsNumber({value:e,as:r});return i==null?y.TypeLiteral.nop():y.TypeLiteral.number(i)}case"FLOAT":case"DOUBLE":{let i=this.getValueAsNumber({value:e});return i==null?y.TypeLiteral.nop():y.TypeLiteral.float(i)}case"BOOLEAN":{let i=this.getValueAsBoolean({value:e,as:r});return i==null?y.TypeLiteral.nop():y.TypeLiteral.boolean(i)}case"DATE":case"DATE_TIME":{let i=this.context.getValueAsString({value:e});return i==null?y.TypeLiteral.nop():y.TypeLiteral.datetime(i)}case"BASE_64":case"UUID":case"BIG_INTEGER":case"STRING":{let i=this.context.getValueAsString({value:e});return i==null?y.TypeLiteral.nop():y.TypeLiteral.string(i)}default:_(t)}}getValueAsNumber({value:t,as:e}){let r=e==="key"&&typeof t=="string"?Number(t):t;return this.context.getValueAsNumber({value:r})}getValueAsBoolean({value:t,as:e}){let r=e==="key"?typeof t=="string"?t==="true":t==="false"?!1:t:t;return this.context.getValueAsBoolean({value:r})}};0&&(module.exports={DynamicTypeLiteralMapper});
19
19
  /*! Bundled license information:
20
20
 
21
21
  @esbuild-plugins/node-globals-polyfill/Buffer.js: