@fern-api/php-dynamic-snippets 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/DynamicSnippetsGenerator.cjs +16 -15
- package/cjs/DynamicSnippetsGenerator.cjs.map +1 -0
- package/cjs/DynamicSnippetsGenerator.d.cts +1 -1
- package/cjs/EndpointSnippetGenerator.cjs +27 -15
- package/cjs/EndpointSnippetGenerator.cjs.map +1 -0
- package/cjs/EndpointSnippetGenerator.d.cts +2 -0
- package/cjs/context/DynamicSnippetsGeneratorContext.cjs +15 -14
- package/cjs/context/DynamicSnippetsGeneratorContext.cjs.map +1 -0
- package/cjs/context/DynamicTypeLiteralMapper.cjs +26 -14
- package/cjs/context/DynamicTypeLiteralMapper.cjs.map +1 -0
- package/cjs/context/FilePropertyMapper.cjs +26 -14
- package/cjs/context/FilePropertyMapper.cjs.map +1 -0
- package/cjs/index.cjs +28 -27
- package/cjs/index.cjs.map +1 -0
- package/cjs/index.d.cts +1 -1
- package/esm/DynamicSnippetsGenerator.d.ts +1 -1
- package/esm/DynamicSnippetsGenerator.js +2 -1
- package/esm/DynamicSnippetsGenerator.js.map +1 -0
- package/esm/EndpointSnippetGenerator.d.ts +2 -0
- package/esm/EndpointSnippetGenerator.js +2 -1
- package/esm/EndpointSnippetGenerator.js.map +1 -0
- package/esm/{chunk-KF5FVQY4.js → chunk-625QSFAH.js} +2 -1
- package/esm/chunk-625QSFAH.js.map +1 -0
- package/esm/chunk-7MI6WLZG.js +2 -0
- package/esm/chunk-7MI6WLZG.js.map +1 -0
- package/esm/chunk-BYNT7UJT.js +2 -0
- package/esm/chunk-BYNT7UJT.js.map +1 -0
- package/esm/chunk-J4Y3S6QS.js +40 -0
- package/esm/chunk-J4Y3S6QS.js.map +1 -0
- package/esm/{chunk-OBW623PQ.js → chunk-KU3OGJUU.js} +2 -1
- package/esm/chunk-KU3OGJUU.js.map +1 -0
- package/esm/chunk-YKXTGZL6.js +4 -0
- package/esm/chunk-YKXTGZL6.js.map +1 -0
- package/esm/chunk-ZYT6M32A.js +2 -0
- package/esm/chunk-ZYT6M32A.js.map +1 -0
- package/esm/context/DynamicSnippetsGeneratorContext.js +2 -1
- package/esm/context/DynamicSnippetsGeneratorContext.js.map +1 -0
- package/esm/context/DynamicTypeLiteralMapper.js +2 -1
- package/esm/context/DynamicTypeLiteralMapper.js.map +1 -0
- package/esm/context/FilePropertyMapper.js +2 -1
- package/esm/context/FilePropertyMapper.js.map +1 -0
- package/esm/index.d.ts +1 -1
- package/esm/index.js +12 -11
- package/esm/index.js.map +1 -0
- package/package.json +1 -1
- package/esm/chunk-4GDAMWPH.js +0 -1
- package/esm/chunk-LVYU2VDV.js +0 -28
- package/esm/chunk-MKUTGATJ.js +0 -1
- package/esm/chunk-RLJ7N42G.js +0 -3
- package/esm/chunk-TSABAZOR.js +0 -14
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
"use strict";var Ce=Object.defineProperty,Dr=Object.defineProperties,Or=Object.getOwnPropertyDescriptor,$r=Object.getOwnPropertyDescriptors,Vr=Object.getOwnPropertyNames,Ne=Object.getOwnPropertySymbols;var je=Object.prototype.hasOwnProperty,et=Object.prototype.propertyIsEnumerable;var We=(n,t,e)=>t in n?Ce(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,pe=(n,t)=>{for(var e in t||(t={}))je.call(t,e)&&We(n,e,t[e]);if(Ne)for(var e of Ne(t))et.call(t,e)&&We(n,e,t[e]);return n},fe=(n,t)=>Dr(n,$r(t));var tt=n=>typeof n=="symbol"?n:n+"",rt=(n,t)=>{var e={};for(var r in n)je.call(n,r)&&t.indexOf(r)<0&&(e[r]=n[r]);if(n!=null&&Ne)for(var r of Ne(n))t.indexOf(r)<0&&et.call(n,r)&&(e[r]=n[r]);return e};var ze=(n,t)=>()=>(n&&(t=n(n=0)),t);var nt=(n,t)=>{for(var e in t)Ce(n,e,{get:t[e],enumerable:!0})},qr=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Vr(t))!je.call(n,i)&&i!==e&&Ce(n,i,{get:()=>t[i],enumerable:!(r=Or(t,i))||r.enumerable});return n};var Wr=n=>qr(Ce({},"__esModule",{value:!0}),n);var f=(n,t,e)=>We(n,typeof t!="symbol"?t+"":t,e);function ot(){throw new Error("setTimeout has not been defined")}function at(){throw new Error("clearTimeout has not been defined")}function st(n){if(z===setTimeout)return setTimeout(n,0);if((z===ot||!z)&&setTimeout)return z=setTimeout,setTimeout(n,0);try{return z(n,0)}catch(t){try{return z.call(null,n,0)}catch(e){return z.call(this,n,0)}}}function jr(n){if(Y===clearTimeout)return clearTimeout(n);if((Y===at||!Y)&&clearTimeout)return Y=clearTimeout,clearTimeout(n);try{return Y(n)}catch(t){try{return Y.call(null,n)}catch(e){return Y.call(this,n)}}}function zr(){!ce||!Q||(ce=!1,Q.length?_=Q.concat(_):Ie=-1,_.length&&ut())}function ut(){if(!ce){var n=st(zr);ce=!0;for(var t=_.length;t;){for(Q=_,_=[];++Ie<t;)Q&&Q[Ie].run();Ie=-1,t=_.length}Q=null,ce=!1,jr(n)}}function Yr(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];_.push(new pt(n,t)),_.length===1&&!ce&&st(ut)}function pt(n,t){this.fun=n,this.array=t}function X(){}function fn(n){throw new Error("process.binding is not supported")}function ln(){return"/"}function cn(n){throw new Error("process.chdir is not supported")}function dn(){return 0}function hn(n){var t=mn.call(le)*.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 xn(){var n=new Date,t=n-yn;return t/1e3}var z,Y,_,ce,Q,Ie,Gr,Hr,Zr,Jr,Kr,Qr,Xr,en,tn,rn,nn,on,an,sn,un,pn,le,mn,yn,c,it,u=ze(()=>{"use strict";z=ot,Y=at;typeof globalThis.setTimeout=="function"&&(z=setTimeout);typeof globalThis.clearTimeout=="function"&&(Y=clearTimeout);_=[],ce=!1,Ie=-1;pt.prototype.run=function(){this.fun.apply(null,this.array)};Gr="browser",Hr="browser",Zr=!0,Jr={},Kr=[],Qr="",Xr={},en={},tn={};rn=X,nn=X,on=X,an=X,sn=X,un=X,pn=X;le=globalThis.performance||{},mn=le.now||le.mozNow||le.msNow||le.oNow||le.webkitNow||function(){return new Date().getTime()};yn=new Date;c={nextTick:Yr,title:Gr,browser:Zr,env:Jr,argv:Kr,version:Qr,versions:Xr,on:rn,addListener:nn,once:on,off:an,removeListener:sn,removeAllListeners:un,emit:pn,binding:fn,cwd:ln,chdir:cn,umask:dn,hrtime:hn,platform:Hr,release:en,config:tn,uptime:xn},it={};Object.keys(it).forEach(n=>{let t=n.split("."),e=c;for(let r=0;r<t.length;r++){let i=t[r];r===t.length-1?e[i]=it[n]:e=e[i]||(e[i]={})}})});function dt(){Ge=!0;for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=n.length;t<e;++t)P[t]=n[t],L[n.charCodeAt(t)]=t;L[45]=62,L[95]=63}function wn(n){Ge||dt();var t,e,r,i,o,a,l=n.length;if(l%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=n[l-2]==="="?2:n[l-1]==="="?1:0,a=new gn(l*3/4-o),r=o>0?l-4:l;var m=0;for(t=0,e=0;t<r;t+=4,e+=3)i=L[n.charCodeAt(t)]<<18|L[n.charCodeAt(t+1)]<<12|L[n.charCodeAt(t+2)]<<6|L[n.charCodeAt(t+3)],a[m++]=i>>16&255,a[m++]=i>>8&255,a[m++]=i&255;return o===2?(i=L[n.charCodeAt(t)]<<2|L[n.charCodeAt(t+1)]>>4,a[m++]=i&255):o===1&&(i=L[n.charCodeAt(t)]<<10|L[n.charCodeAt(t+1)]<<4|L[n.charCodeAt(t+2)]>>2,a[m++]=i>>8&255,a[m++]=i&255),a}function vn(n){return P[n>>18&63]+P[n>>12&63]+P[n>>6&63]+P[n&63]}function Tn(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(vn(r));return i.join("")}function ft(n){Ge||dt();for(var t,e=n.length,r=e%3,i="",o=[],a=16383,l=0,m=e-r;l<m;l+=a)o.push(Tn(n,l,l+a>m?m:l+a));return r===1?(t=n[e-1],i+=P[t>>2],i+=P[t<<4&63],i+="=="):r===2&&(t=(n[e-2]<<8)+n[e-1],i+=P[t>>10],i+=P[t>>4&63],i+=P[t<<2&63],i+="="),o.push(i),o.join("")}function Le(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function D(n,t){if(Le()<t)throw new RangeError("Invalid typed array length");return s.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(t),n.__proto__=s.prototype):(n===null&&(n=new s(t)),n.length=t),n}function s(n,t,e){if(!s.TYPED_ARRAY_SUPPORT&&!(this instanceof s))return new s(n,t,e);if(typeof n=="number"){if(typeof t=="string")throw new Error("If encoding is specified then the first argument must be a string");return He(this,n)}return mt(this,n,t,e)}function mt(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?En(n,t,e,r):typeof t=="string"?Rn(n,t,e):bn(n,t)}function ht(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 An(n,t,e,r){return ht(t),t<=0?D(n,t):e!==void 0?typeof r=="string"?D(n,t).fill(e,r):D(n,t).fill(e):D(n,t)}function He(n,t){if(ht(t),n=D(n,t<0?0:Ze(t)|0),!s.TYPED_ARRAY_SUPPORT)for(var e=0;e<t;++e)n[e]=0;return n}function Rn(n,t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!s.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=yt(t,e)|0;n=D(n,r);var i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function Ye(n,t){var e=t.length<0?0:Ze(t.length)|0;n=D(n,e);for(var r=0;r<e;r+=1)n[r]=t[r]&255;return n}function En(n,t,e,r){if(t.byteLength,e<0||t.byteLength<e)throw new RangeError("'offset' is out of bounds");if(t.byteLength<e+(r||0))throw new RangeError("'length' is out of bounds");return e===void 0&&r===void 0?t=new Uint8Array(t):r===void 0?t=new Uint8Array(t,e):t=new Uint8Array(t,e,r),s.TYPED_ARRAY_SUPPORT?(n=t,n.__proto__=s.prototype):n=Ye(n,t),n}function bn(n,t){if(F(t)){var e=Ze(t.length)|0;return n=D(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"||jn(t.length)?D(n,0):Ye(n,t);if(t.type==="Buffer"&&Array.isArray(t.data))return Ye(n,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function Ze(n){if(n>=Le())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Le().toString(16)+" bytes");return n|0}function F(n){return!!(n!=null&&n._isBuffer)}function yt(n,t){if(F(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 Se(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return Rt(n).length;default:if(r)return Se(n).length;t=(""+t).toLowerCase(),r=!0}}function Nn(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 Mn(this,t,e);case"utf8":case"utf-8":return wt(this,t,e);case"ascii":return kn(this,t,e);case"latin1":case"binary":return Un(this,t,e);case"base64":return Fn(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _n(this,t,e);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),r=!0}}function ee(n,t,e){var r=n[t];n[t]=n[e],n[e]=r}function xt(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=s.from(t,r)),F(t))return t.length===0?-1:lt(n,t,e,r,i);if(typeof t=="number")return t=t&255,s.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(n,t,e):Uint8Array.prototype.lastIndexOf.call(n,t,e):lt(n,[t],e,r,i);throw new TypeError("val must be string, number or Buffer")}function lt(n,t,e,r,i){var o=1,a=n.length,l=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,a/=2,l/=2,e/=2}function m(R,I){return o===1?R[I]:R.readUInt16BE(I*o)}var h;if(i){var y=-1;for(h=e;h<a;h++)if(m(n,h)===m(t,y===-1?0:h-y)){if(y===-1&&(y=h),h-y+1===l)return y*o}else y!==-1&&(h-=h-y),y=-1}else for(e+l>a&&(e=a-l),h=e;h>=0;h--){for(var g=!0,b=0;b<l;b++)if(m(n,h+b)!==m(t,b)){g=!1;break}if(g)return h}return-1}function Cn(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 a=0;a<r;++a){var l=parseInt(t.substr(a*2,2),16);if(isNaN(l))return a;n[e+a]=l}return a}function In(n,t,e,r){return Be(Se(t,n.length-e),n,e,r)}function gt(n,t,e,r){return Be(qn(t),n,e,r)}function Ln(n,t,e,r){return gt(n,t,e,r)}function Sn(n,t,e,r){return Be(Rt(t),n,e,r)}function Pn(n,t,e,r){return Be(Wn(t,n.length-e),n,e,r)}function Fn(n,t,e){return t===0&&e===n.length?ft(n):ft(n.slice(t,e))}function wt(n,t,e){e=Math.min(n.length,e);for(var r=[],i=t;i<e;){var o=n[i],a=null,l=o>239?4:o>223?3:o>191?2:1;if(i+l<=e){var m,h,y,g;switch(l){case 1:o<128&&(a=o);break;case 2:m=n[i+1],(m&192)===128&&(g=(o&31)<<6|m&63,g>127&&(a=g));break;case 3:m=n[i+1],h=n[i+2],(m&192)===128&&(h&192)===128&&(g=(o&15)<<12|(m&63)<<6|h&63,g>2047&&(g<55296||g>57343)&&(a=g));break;case 4:m=n[i+1],h=n[i+2],y=n[i+3],(m&192)===128&&(h&192)===128&&(y&192)===128&&(g=(o&15)<<18|(m&63)<<12|(h&63)<<6|y&63,g>65535&&g<1114112&&(a=g))}}a===null?(a=65533,l=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=l}return Bn(r)}function Bn(n){var t=n.length;if(t<=ct)return String.fromCharCode.apply(String,n);for(var e="",r=0;r<t;)e+=String.fromCharCode.apply(String,n.slice(r,r+=ct));return e}function kn(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 Un(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 Mn(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+=Vn(n[o]);return i}function _n(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 N(n,t,e,r,i,o){if(!F(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 Pe(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 Fe(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 vt(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 Tt(n,t,e,r,i){return i||vt(n,t,e,4,34028234663852886e22,-34028234663852886e22),bt(n,t,e,r,23,4),e+4}function At(n,t,e,r,i){return i||vt(n,t,e,8,17976931348623157e292,-17976931348623157e292),bt(n,t,e,r,52,8),e+8}function On(n){if(n=$n(n).replace(Dn,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}function $n(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}function Vn(n){return n<16?"0"+n.toString(16):n.toString(16)}function Se(n,t){t=t||1/0;for(var e,r=n.length,i=null,o=[],a=0;a<r;++a){if(e=n.charCodeAt(a),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&o.push(239,191,189);continue}else if(a+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 qn(n){for(var t=[],e=0;e<n.length;++e)t.push(n.charCodeAt(e)&255);return t}function Wn(n,t){for(var e,r,i,o=[],a=0;a<n.length&&!((t-=2)<0);++a)e=n.charCodeAt(a),r=e>>8,i=e%256,o.push(i),o.push(r);return o}function Rt(n){return wn(On(n))}function Be(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 jn(n){return n!==n}function zn(n){return n!=null&&(!!n._isBuffer||Et(n)||Yn(n))}function Et(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function Yn(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&Et(n.slice(0,0))}function ke(n,t,e,r,i){var o,a,l=i*8-r-1,m=(1<<l)-1,h=m>>1,y=-7,g=e?i-1:0,b=e?-1:1,R=n[t+g];for(g+=b,o=R&(1<<-y)-1,R>>=-y,y+=l;y>0;o=o*256+n[t+g],g+=b,y-=8);for(a=o&(1<<-y)-1,o>>=-y,y+=r;y>0;a=a*256+n[t+g],g+=b,y-=8);if(o===0)o=1-h;else{if(o===m)return a?NaN:(R?-1:1)*(1/0);a=a+Math.pow(2,r),o=o-h}return(R?-1:1)*a*Math.pow(2,o-r)}function bt(n,t,e,r,i,o){var a,l,m,h=o*8-i-1,y=(1<<h)-1,g=y>>1,b=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,R=r?0:o-1,I=r?1:-1,_r=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(l=isNaN(t)?1:0,a=y):(a=Math.floor(Math.log(t)/Math.LN2),t*(m=Math.pow(2,-a))<1&&(a--,m*=2),a+g>=1?t+=b/m:t+=b*Math.pow(2,1-g),t*m>=2&&(a++,m/=2),a+g>=y?(l=0,a=y):a+g>=1?(l=(t*m-1)*Math.pow(2,i),a=a+g):(l=t*Math.pow(2,g-1)*Math.pow(2,i),a=0));i>=8;n[e+R]=l&255,R+=I,l/=256,i-=8);for(a=a<<i|l,h+=i;h>0;n[e+R]=a&255,R+=I,a/=256,h-=8);n[e+R-I]|=_r*128}var P,L,gn,Ge,ct,Dn,Nt=ze(()=>{"use strict";u();p();P=[],L=[],gn=typeof Uint8Array!="undefined"?Uint8Array:Array,Ge=!1;s.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;s.poolSize=8192;s._augment=function(n){return n.__proto__=s.prototype,n};s.from=function(n,t,e){return mt(null,n,t,e)};s.kMaxLength=Le();s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&s[Symbol.species]);s.alloc=function(n,t,e){return An(null,n,t,e)};s.allocUnsafe=function(n){return He(null,n)};s.allocUnsafeSlow=function(n){return He(null,n)};s.isBuffer=zn;s.compare=function(t,e){if(!F(t)||!F(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,i=e.length,o=0,a=Math.min(r,i);o<a;++o)if(t[o]!==e[o]){r=t[o],i=e[o];break}return r<i?-1:i<r?1:0};s.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};s.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return s.alloc(0);var r;if(e===void 0)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var i=s.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var a=t[r];if(!F(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(i,o),o+=a.length}return i};s.byteLength=yt;s.prototype._isBuffer=!0;s.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)ee(this,e,e+1);return this};s.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)ee(this,e,e+3),ee(this,e+1,e+2);return this};s.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)ee(this,e,e+7),ee(this,e+1,e+6),ee(this,e+2,e+5),ee(this,e+3,e+4);return this};s.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?wt(this,0,t):Nn.apply(this,arguments)};s.prototype.equals=function(t){if(!F(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:s.compare(this,t)===0};s.prototype.compare=function(t,e,r,i,o){if(!F(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 a=o-i,l=r-e,m=Math.min(a,l),h=this.slice(i,o),y=t.slice(e,r),g=0;g<m;++g)if(h[g]!==y[g]){a=h[g],l=y[g];break}return a<l?-1:l<a?1:0};s.prototype.includes=function(t,e,r){return this.indexOf(t,e,r)!==-1};s.prototype.indexOf=function(t,e,r){return xt(this,t,e,r,!0)};s.prototype.lastIndexOf=function(t,e,r){return xt(this,t,e,r,!1)};s.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 a=!1;;)switch(i){case"hex":return Cn(this,t,e,r);case"utf8":case"utf-8":return In(this,t,e,r);case"ascii":return gt(this,t,e,r);case"latin1":case"binary":return Ln(this,t,e,r);case"base64":return Sn(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Pn(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}};s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};ct=4096;s.prototype.slice=function(t,e){var r=this.length;t=~~t,e=e===void 0?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e<t&&(e=t);var i;if(s.TYPED_ARRAY_SUPPORT)i=this.subarray(t,e),i.__proto__=s.prototype;else{var o=e-t;i=new s(o,void 0);for(var a=0;a<o;++a)i[a]=this[a+t]}return i};s.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,a=0;++a<e&&(o*=256);)i+=this[t+a]*o;return i};s.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};s.prototype.readUInt8=function(t,e){return e||T(t,1,this.length),this[t]};s.prototype.readUInt16LE=function(t,e){return e||T(t,2,this.length),this[t]|this[t+1]<<8};s.prototype.readUInt16BE=function(t,e){return e||T(t,2,this.length),this[t]<<8|this[t+1]};s.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};s.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])};s.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,a=0;++a<e&&(o*=256);)i+=this[t+a]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i};s.prototype.readIntBE=function(t,e,r){t=t|0,e=e|0,r||T(t,e,this.length);for(var i=e,o=1,a=this[t+--i];i>0&&(o*=256);)a+=this[t+--i]*o;return o*=128,a>=o&&(a-=Math.pow(2,8*e)),a};s.prototype.readInt8=function(t,e){return e||T(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};s.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};s.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};s.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};s.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]};s.prototype.readFloatLE=function(t,e){return e||T(t,4,this.length),ke(this,t,!0,23,4)};s.prototype.readFloatBE=function(t,e){return e||T(t,4,this.length),ke(this,t,!1,23,4)};s.prototype.readDoubleLE=function(t,e){return e||T(t,8,this.length),ke(this,t,!0,52,8)};s.prototype.readDoubleBE=function(t,e){return e||T(t,8,this.length),ke(this,t,!1,52,8)};s.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;N(this,t,e,r,o,0)}var a=1,l=0;for(this[e]=t&255;++l<r&&(a*=256);)this[e+l]=t/a&255;return e+r};s.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;N(this,t,e,r,o,0)}var a=r-1,l=1;for(this[e+a]=t&255;--a>=0&&(l*=256);)this[e+a]=t/l&255;return e+r};s.prototype.writeUInt8=function(t,e,r){return t=+t,e=e|0,r||N(this,t,e,1,255,0),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=t&255,e+1};s.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=e|0,r||N(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):Pe(this,t,e,!0),e+2};s.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=e|0,r||N(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):Pe(this,t,e,!1),e+2};s.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=e|0,r||N(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255):Fe(this,t,e,!0),e+4};s.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=e|0,r||N(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):Fe(this,t,e,!1),e+4};s.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e=e|0,!i){var o=Math.pow(2,8*r-1);N(this,t,e,r,o-1,-o)}var a=0,l=1,m=0;for(this[e]=t&255;++a<r&&(l*=256);)t<0&&m===0&&this[e+a-1]!==0&&(m=1),this[e+a]=(t/l>>0)-m&255;return e+r};s.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e=e|0,!i){var o=Math.pow(2,8*r-1);N(this,t,e,r,o-1,-o)}var a=r-1,l=1,m=0;for(this[e+a]=t&255;--a>=0&&(l*=256);)t<0&&m===0&&this[e+a+1]!==0&&(m=1),this[e+a]=(t/l>>0)-m&255;return e+r};s.prototype.writeInt8=function(t,e,r){return t=+t,e=e|0,r||N(this,t,e,1,127,-128),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=t&255,e+1};s.prototype.writeInt16LE=function(t,e,r){return t=+t,e=e|0,r||N(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):Pe(this,t,e,!0),e+2};s.prototype.writeInt16BE=function(t,e,r){return t=+t,e=e|0,r||N(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):Pe(this,t,e,!1),e+2};s.prototype.writeInt32LE=function(t,e,r){return t=+t,e=e|0,r||N(this,t,e,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):Fe(this,t,e,!0),e+4};s.prototype.writeInt32BE=function(t,e,r){return t=+t,e=e|0,r||N(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):Fe(this,t,e,!1),e+4};s.prototype.writeFloatLE=function(t,e,r){return Tt(this,t,e,!0,r)};s.prototype.writeFloatBE=function(t,e,r){return Tt(this,t,e,!1,r)};s.prototype.writeDoubleLE=function(t,e,r){return At(this,t,e,!0,r)};s.prototype.writeDoubleBE=function(t,e,r){return At(this,t,e,!1,r)};s.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,a;if(this===t&&r<e&&e<i)for(a=o-1;a>=0;--a)t[a+e]=this[a+r];else if(o<1e3||!s.TYPED_ARRAY_SUPPORT)for(a=0;a<o;++a)t[a+e]=this[a+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o};s.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"&&!s.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof t=="number"&&(t=t&255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;e=e>>>0,r=r===void 0?this.length:r>>>0,t||(t=0);var a;if(typeof t=="number")for(a=e;a<r;++a)this[a]=t;else{var l=F(t)?t:Se(new s(t,i).toString()),m=l.length;for(a=0;a<r-e;++a)this[a+e]=l[a%m]}return this};Dn=/[^+\/0-9A-Za-z-_]/g});var p=ze(()=>{"use strict";Nt()});var fa={};nt(fa,{DynamicSnippetsGenerator:()=>Xe});module.exports=Wr(fa);u();p();u();p();u();p();function v(n){throw new Error("Unexpected value: "+JSON.stringify(n))}u();p();function ye(n){return Object.keys(n)}u();p();u();p();u();p();u();p();u();p();u();p();var Gn=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis,Ct=Gn;var Hn=typeof self=="object"&&self&&self.Object===Object&&self,Zn=Ct||Hn||Function("return this")(),It=Zn;var Jn=It.Symbol,O=Jn;u();p();var Lt=Object.prototype,Kn=Lt.hasOwnProperty,Qn=Lt.toString,xe=O?O.toStringTag:void 0;function Xn(n){var t=Kn.call(n,xe),e=n[xe];try{n[xe]=void 0;var r=!0}catch(o){}var i=Qn.call(n);return r&&(t?n[xe]=e:delete n[xe]),i}var St=Xn;u();p();var ei=Object.prototype,ti=ei.toString;function ri(n){return ti.call(n)}var Pt=ri;var ni="[object Null]",ii="[object Undefined]",Ft=O?O.toStringTag:void 0;function oi(n){return n==null?n===void 0?ii:ni:Ft&&Ft in Object(n)?St(n):Pt(n)}var Bt=oi;u();p();function ai(n){return n!=null&&typeof n=="object"}var kt=ai;var si="[object Symbol]";function ui(n){return typeof n=="symbol"||kt(n)&&Bt(n)==si}var Ut=ui;u();p();u();p();function pi(n,t){for(var e=-1,r=n==null?0:n.length,i=Array(r);++e<r;)i[e]=t(n[e],e,n);return i}var Mt=pi;u();p();var fi=Array.isArray,_t=fi;var li=1/0,Dt=O?O.prototype:void 0,Ot=Dt?Dt.toString:void 0;function $t(n){if(typeof n=="string")return n;if(_t(n))return Mt(n,$t)+"";if(Ut(n))return Ot?Ot.call(n):"";var t=n+"";return t=="0"&&1/n==-li?"-0":t}var Vt=$t;u();p();function ci(n){return n==null?"":Vt(n)}var G=ci;u();p();u();p();u();p();u();p();u();p();u();p();function di(n,t,e){var r=-1,i=n.length;t<0&&(t=-t>i?0:i+t),e=e>i?i:e,e<0&&(e+=i),i=t>e?0:e-t>>>0,t>>>=0;for(var o=Array(i);++r<i;)o[r]=n[r+t];return o}var qt=di;function mi(n,t,e){var r=n.length;return e=e===void 0?r:e,!t&&e>=r?n:qt(n,t,e)}var Wt=mi;u();p();var hi="\\ud800-\\udfff",yi="\\u0300-\\u036f",xi="\\ufe20-\\ufe2f",gi="\\u20d0-\\u20ff",wi=yi+xi+gi,vi="\\ufe0e\\ufe0f",Ti="\\u200d",Ai=RegExp("["+Ti+hi+wi+vi+"]");function Ri(n){return Ai.test(n)}var Ue=Ri;u();p();u();p();function Ei(n){return n.split("")}var jt=Ei;u();p();var zt="\\ud800-\\udfff",bi="\\u0300-\\u036f",Ni="\\ufe20-\\ufe2f",Ci="\\u20d0-\\u20ff",Ii=bi+Ni+Ci,Li="\\ufe0e\\ufe0f",Si="["+zt+"]",Je="["+Ii+"]",Ke="\\ud83c[\\udffb-\\udfff]",Pi="(?:"+Je+"|"+Ke+")",Yt="[^"+zt+"]",Gt="(?:\\ud83c[\\udde6-\\uddff]){2}",Ht="[\\ud800-\\udbff][\\udc00-\\udfff]",Fi="\\u200d",Zt=Pi+"?",Jt="["+Li+"]?",Bi="(?:"+Fi+"(?:"+[Yt,Gt,Ht].join("|")+")"+Jt+Zt+")*",ki=Jt+Zt+Bi,Ui="(?:"+[Yt+Je+"?",Je,Gt,Ht,Si].join("|")+")",Mi=RegExp(Ke+"(?="+Ke+")|"+Ui+ki,"g");function _i(n){return n.match(Mi)||[]}var Kt=_i;function Di(n){return Ue(n)?Kt(n):jt(n)}var Qt=Di;function Oi(n){return function(t){t=G(t);var e=Ue(t)?Qt(t):void 0,r=e?e[0]:t.charAt(0),i=e?Wt(e,1).join(""):t.slice(1);return r[n]()+i}}var Xt=Oi;var $i=Xt("toUpperCase"),de=$i;function Vi(n){return de(G(n).toLowerCase())}var er=Vi;u();p();u();p();function qi(n,t,e,r){var i=-1,o=n==null?0:n.length;for(r&&o&&(e=n[++i]);++i<o;)e=t(e,n[i],i,n);return e}var tr=qi;u();p();u();p();u();p();function Wi(n){return function(t){return n==null?void 0:n[t]}}var rr=Wi;var ji={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},zi=rr(ji),nr=zi;var Yi=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Gi="\\u0300-\\u036f",Hi="\\ufe20-\\ufe2f",Zi="\\u20d0-\\u20ff",Ji=Gi+Hi+Zi,Ki="["+Ji+"]",Qi=RegExp(Ki,"g");function Xi(n){return n=G(n),n&&n.replace(Yi,nr).replace(Qi,"")}var ir=Xi;u();p();u();p();var eo=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function to(n){return n.match(eo)||[]}var or=to;u();p();var ro=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function no(n){return ro.test(n)}var ar=no;u();p();var lr="\\ud800-\\udfff",io="\\u0300-\\u036f",oo="\\ufe20-\\ufe2f",ao="\\u20d0-\\u20ff",so=io+oo+ao,cr="\\u2700-\\u27bf",dr="a-z\\xdf-\\xf6\\xf8-\\xff",uo="\\xac\\xb1\\xd7\\xf7",po="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",fo="\\u2000-\\u206f",lo=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",mr="A-Z\\xc0-\\xd6\\xd8-\\xde",co="\\ufe0e\\ufe0f",hr=uo+po+fo+lo,yr="['\u2019]",sr="["+hr+"]",mo="["+so+"]",xr="\\d+",ho="["+cr+"]",gr="["+dr+"]",wr="[^"+lr+hr+xr+cr+dr+mr+"]",yo="\\ud83c[\\udffb-\\udfff]",xo="(?:"+mo+"|"+yo+")",go="[^"+lr+"]",vr="(?:\\ud83c[\\udde6-\\uddff]){2}",Tr="[\\ud800-\\udbff][\\udc00-\\udfff]",me="["+mr+"]",wo="\\u200d",ur="(?:"+gr+"|"+wr+")",vo="(?:"+me+"|"+wr+")",pr="(?:"+yr+"(?:d|ll|m|re|s|t|ve))?",fr="(?:"+yr+"(?:D|LL|M|RE|S|T|VE))?",Ar=xo+"?",Rr="["+co+"]?",To="(?:"+wo+"(?:"+[go,vr,Tr].join("|")+")"+Rr+Ar+")*",Ao="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ro="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Eo=Rr+Ar+To,bo="(?:"+[ho,vr,Tr].join("|")+")"+Eo,No=RegExp([me+"?"+gr+"+"+pr+"(?="+[sr,me,"$"].join("|")+")",vo+"+"+fr+"(?="+[sr,me+ur,"$"].join("|")+")",me+"?"+ur+"+"+pr,me+"+"+fr,Ro,Ao,xr,bo].join("|"),"g");function Co(n){return n.match(No)||[]}var Er=Co;function Io(n,t,e){return n=G(n),t=e?void 0:t,t===void 0?ar(n)?Er(n):or(n):n.match(t)||[]}var br=Io;var Lo="['\u2019]",So=RegExp(Lo,"g");function Po(n){return function(t){return tr(br(ir(t).replace(So,"")),n,"")}}var Nr=Po;var Fo=Nr(function(n,t,e){return t=t.toLowerCase(),n+(e?er(t):t)}),Me=Fo;u();p();u();p();var $=class{};u();p();u();p();var B=class extends ${constructor(e){super();f(this,"value");this.value=e}write(e){typeof this.value=="string"?e.write(this.value):this.value(e)}};var Bo=4,ge=class{constructor(){f(this,"buffer","");f(this,"indentLevel",0);f(this,"hasWrittenAnything",!1);f(this,"lastCharacterIsNewline",!1)}write(t){let e=t.length>0&&t.endsWith(`
|
|
2
|
-
`),
|
|
1
|
+
"use strict";var Xe=Object.defineProperty,no=Object.defineProperties,io=Object.getOwnPropertyDescriptor,oo=Object.getOwnPropertyDescriptors,ao=Object.getOwnPropertyNames,Qe=Object.getOwnPropertySymbols;var Ut=Object.prototype.hasOwnProperty,er=Object.prototype.propertyIsEnumerable;var Bt=(r,t,e)=>t in r?Xe(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ie=(r,t)=>{for(var e in t||(t={}))Ut.call(t,e)&&Bt(r,e,t[e]);if(Qe)for(var e of Qe(t))er.call(t,e)&&Bt(r,e,t[e]);return r},Ne=(r,t)=>no(r,oo(t));var tr=r=>typeof r=="symbol"?r:r+"",rr=(r,t)=>{var e={};for(var n in r)Ut.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&Qe)for(var n of Qe(r))t.indexOf(n)<0&&er.call(r,n)&&(e[n]=r[n]);return e};var Ot=(r,t)=>()=>(r&&(t=r(r=0)),t);var nr=(r,t)=>{for(var e in t)Xe(r,e,{get:t[e],enumerable:!0})},so=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ao(t))!Ut.call(r,i)&&i!==e&&Xe(r,i,{get:()=>t[i],enumerable:!(n=io(t,i))||n.enumerable});return r};var po=r=>so(Xe({},"__esModule",{value:!0}),r);var l=(r,t,e)=>Bt(r,typeof t!="symbol"?t+"":t,e);function or(){throw new Error("setTimeout has not been defined")}function ar(){throw new Error("clearTimeout has not been defined")}function sr(r){if(re===setTimeout)return setTimeout(r,0);if((re===or||!re)&&setTimeout)return re=setTimeout,setTimeout(r,0);try{return re(r,0)}catch(t){try{return re.call(null,r,0)}catch(e){return re.call(this,r,0)}}}function fo(r){if(ne===clearTimeout)return clearTimeout(r);if((ne===ar||!ne)&&clearTimeout)return ne=clearTimeout,clearTimeout(r);try{return ne(r)}catch(t){try{return ne.call(null,r)}catch(e){return ne.call(this,r)}}}function uo(){!Le||!he||(Le=!1,he.length?G=he.concat(G):et=-1,G.length&&pr())}function pr(){if(!Le){var r=sr(uo);Le=!0;for(var t=G.length;t;){for(he=G,G=[];++et<t;)he&&he[et].run();et=-1,t=G.length}he=null,Le=!1,fo(r)}}function lo(r){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];G.push(new fr(r,t)),G.length===1&&!Le&&sr(pr)}function fr(r,t){this.fun=r,this.array=t}function ye(){}function So(r){throw new Error("process.binding is not supported")}function Lo(){return"/"}function Po(r){throw new Error("process.chdir is not supported")}function _o(){return 0}function Bo(r){var t=Fo.call(Se)*.001,e=Math.floor(t),n=Math.floor(t%1*1e9);return r&&(e=e-r[0],n=n-r[1],n<0&&(e--,n+=1e9)),[e,n]}function Oo(){var r=new Date,t=r-Uo;return t/1e3}var re,ne,G,Le,he,et,co,mo,ho,yo,xo,go,wo,vo,To,Ao,bo,Eo,Ro,Co,Io,No,Se,Fo,Uo,u,ir,o=Ot(()=>{"use strict";re=or,ne=ar;typeof globalThis.setTimeout=="function"&&(re=setTimeout);typeof globalThis.clearTimeout=="function"&&(ne=clearTimeout);G=[],Le=!1,et=-1;fr.prototype.run=function(){this.fun.apply(null,this.array)};co="browser",mo="browser",ho=!0,yo={},xo=[],go="",wo={},vo={},To={};Ao=ye,bo=ye,Eo=ye,Ro=ye,Co=ye,Io=ye,No=ye;Se=globalThis.performance||{},Fo=Se.now||Se.mozNow||Se.msNow||Se.oNow||Se.webkitNow||function(){return new Date().getTime()};Uo=new Date;u={nextTick:lo,title:co,browser:ho,env:yo,argv:xo,version:go,versions:wo,on:Ao,addListener:bo,once:Eo,off:Ro,removeListener:Co,removeAllListeners:Io,emit:No,binding:So,cwd:Lo,chdir:Po,umask:_o,hrtime:Bo,platform:mo,release:vo,config:To,uptime:Oo},ir={};Object.keys(ir).forEach(r=>{let t=r.split("."),e=u;for(let n=0;n<t.length;n++){let i=t[n];n===t.length-1?e[i]=ir[r]:e=e[i]||(e[i]={})}})});function mr(){kt=!0;for(var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=r.length;t<e;++t)j[t]=r[t],_[r.charCodeAt(t)]=t;_[45]=62,_[95]=63}function ko(r){kt||mr();var t,e,n,i,s,f,c=r.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");s=r[c-2]==="="?2:r[c-1]==="="?1:0,f=new Mo(c*3/4-s),n=s>0?c-4:c;var m=0;for(t=0,e=0;t<n;t+=4,e+=3)i=_[r.charCodeAt(t)]<<18|_[r.charCodeAt(t+1)]<<12|_[r.charCodeAt(t+2)]<<6|_[r.charCodeAt(t+3)],f[m++]=i>>16&255,f[m++]=i>>8&255,f[m++]=i&255;return s===2?(i=_[r.charCodeAt(t)]<<2|_[r.charCodeAt(t+1)]>>4,f[m++]=i&255):s===1&&(i=_[r.charCodeAt(t)]<<10|_[r.charCodeAt(t+1)]<<4|_[r.charCodeAt(t+2)]>>2,f[m++]=i>>8&255,f[m++]=i&255),f}function Do(r){return j[r>>18&63]+j[r>>12&63]+j[r>>6&63]+j[r&63]}function jo(r,t,e){for(var n,i=[],s=t;s<e;s+=3)n=(r[s]<<16)+(r[s+1]<<8)+r[s+2],i.push(Do(n));return i.join("")}function ur(r){kt||mr();for(var t,e=r.length,n=e%3,i="",s=[],f=16383,c=0,m=e-n;c<m;c+=f)s.push(jo(r,c,c+f>m?m:c+f));return n===1?(t=r[e-1],i+=j[t>>2],i+=j[t<<4&63],i+="=="):n===2&&(t=(r[e-2]<<8)+r[e-1],i+=j[t>>10],i+=j[t>>4&63],i+=j[t<<2&63],i+="="),s.push(i),s.join("")}function tt(){return p.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function z(r,t){if(tt()<t)throw new RangeError("Invalid typed array length");return p.TYPED_ARRAY_SUPPORT?(r=new Uint8Array(t),r.__proto__=p.prototype):(r===null&&(r=new p(t)),r.length=t),r}function p(r,t,e){if(!p.TYPED_ARRAY_SUPPORT&&!(this instanceof p))return new p(r,t,e);if(typeof r=="number"){if(typeof t=="string")throw new Error("If encoding is specified then the first argument must be a string");return Dt(this,r)}return dr(this,r,t,e)}function dr(r,t,e,n){if(typeof t=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer!="undefined"&&t instanceof ArrayBuffer?Wo(r,t,e,n):typeof t=="string"?$o(r,t,e):Vo(r,t)}function hr(r){if(typeof r!="number")throw new TypeError('"size" argument must be a number');if(r<0)throw new RangeError('"size" argument must not be negative')}function qo(r,t,e,n){return hr(t),t<=0?z(r,t):e!==void 0?typeof n=="string"?z(r,t).fill(e,n):z(r,t).fill(e):z(r,t)}function Dt(r,t){if(hr(t),r=z(r,t<0?0:jt(t)|0),!p.TYPED_ARRAY_SUPPORT)for(var e=0;e<t;++e)r[e]=0;return r}function $o(r,t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!p.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=yr(t,e)|0;r=z(r,n);var i=r.write(t,e);return i!==n&&(r=r.slice(0,i)),r}function Mt(r,t){var e=t.length<0?0:jt(t.length)|0;r=z(r,e);for(var n=0;n<e;n+=1)r[n]=t[n]&255;return r}function Wo(r,t,e,n){if(t.byteLength,e<0||t.byteLength<e)throw new RangeError("'offset' is out of bounds");if(t.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");return e===void 0&&n===void 0?t=new Uint8Array(t):n===void 0?t=new Uint8Array(t,e):t=new Uint8Array(t,e,n),p.TYPED_ARRAY_SUPPORT?(r=t,r.__proto__=p.prototype):r=Mt(r,t),r}function Vo(r,t){if(q(t)){var e=jt(t.length)|0;return r=z(r,e),r.length===0||t.copy(r,0,0,e),r}if(t){if(typeof ArrayBuffer!="undefined"&&t.buffer instanceof ArrayBuffer||"length"in t)return typeof t.length!="number"||fa(t.length)?z(r,0):Mt(r,t);if(t.type==="Buffer"&&Array.isArray(t.data))return Mt(r,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function jt(r){if(r>=tt())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+tt().toString(16)+" bytes");return r|0}function q(r){return!!(r!=null&&r._isBuffer)}function yr(r,t){if(q(r))return r.length;if(typeof ArrayBuffer!="undefined"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(r)||r instanceof ArrayBuffer))return r.byteLength;typeof r!="string"&&(r=""+r);var e=r.length;if(e===0)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return rt(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return br(r).length;default:if(n)return rt(r).length;t=(""+t).toLowerCase(),n=!0}}function Go(r,t,e){var n=!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(r||(r="utf8");;)switch(r){case"hex":return ta(this,t,e);case"utf8":case"utf-8":return wr(this,t,e);case"ascii":return Xo(this,t,e);case"latin1":case"binary":return ea(this,t,e);case"base64":return Zo(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ra(this,t,e);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}function xe(r,t,e){var n=r[t];r[t]=r[e],r[e]=n}function xr(r,t,e,n,i){if(r.length===0)return-1;if(typeof e=="string"?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:r.length-1),e<0&&(e=r.length+e),e>=r.length){if(i)return-1;e=r.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof t=="string"&&(t=p.from(t,n)),q(t))return t.length===0?-1:lr(r,t,e,n,i);if(typeof t=="number")return t=t&255,p.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(r,t,e):Uint8Array.prototype.lastIndexOf.call(r,t,e):lr(r,[t],e,n,i);throw new TypeError("val must be string, number or Buffer")}function lr(r,t,e,n,i){var s=1,f=r.length,c=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||t.length<2)return-1;s=2,f/=2,c/=2,e/=2}function m(A,b){return s===1?A[b]:A.readUInt16BE(b*s)}var d;if(i){var y=-1;for(d=e;d<f;d++)if(m(r,d)===m(t,y===-1?0:d-y)){if(y===-1&&(y=d),d-y+1===c)return y*s}else y!==-1&&(d-=d-y),y=-1}else for(e+c>f&&(e=f-c),d=e;d>=0;d--){for(var x=!0,w=0;w<c;w++)if(m(r,d+w)!==m(t,w)){x=!1;break}if(x)return d}return-1}function zo(r,t,e,n){e=Number(e)||0;var i=r.length-e;n?(n=Number(n),n>i&&(n=i)):n=i;var s=t.length;if(s%2!==0)throw new TypeError("Invalid hex string");n>s/2&&(n=s/2);for(var f=0;f<n;++f){var c=parseInt(t.substr(f*2,2),16);if(isNaN(c))return f;r[e+f]=c}return f}function Ho(r,t,e,n){return ot(rt(t,r.length-e),r,e,n)}function gr(r,t,e,n){return ot(sa(t),r,e,n)}function Yo(r,t,e,n){return gr(r,t,e,n)}function Ko(r,t,e,n){return ot(br(t),r,e,n)}function Jo(r,t,e,n){return ot(pa(t,r.length-e),r,e,n)}function Zo(r,t,e){return t===0&&e===r.length?ur(r):ur(r.slice(t,e))}function wr(r,t,e){e=Math.min(r.length,e);for(var n=[],i=t;i<e;){var s=r[i],f=null,c=s>239?4:s>223?3:s>191?2:1;if(i+c<=e){var m,d,y,x;switch(c){case 1:s<128&&(f=s);break;case 2:m=r[i+1],(m&192)===128&&(x=(s&31)<<6|m&63,x>127&&(f=x));break;case 3:m=r[i+1],d=r[i+2],(m&192)===128&&(d&192)===128&&(x=(s&15)<<12|(m&63)<<6|d&63,x>2047&&(x<55296||x>57343)&&(f=x));break;case 4:m=r[i+1],d=r[i+2],y=r[i+3],(m&192)===128&&(d&192)===128&&(y&192)===128&&(x=(s&15)<<18|(m&63)<<12|(d&63)<<6|y&63,x>65535&&x<1114112&&(f=x))}}f===null?(f=65533,c=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|f&1023),n.push(f),i+=c}return Qo(n)}function Qo(r){var t=r.length;if(t<=cr)return String.fromCharCode.apply(String,r);for(var e="",n=0;n<t;)e+=String.fromCharCode.apply(String,r.slice(n,n+=cr));return e}function Xo(r,t,e){var n="";e=Math.min(r.length,e);for(var i=t;i<e;++i)n+=String.fromCharCode(r[i]&127);return n}function ea(r,t,e){var n="";e=Math.min(r.length,e);for(var i=t;i<e;++i)n+=String.fromCharCode(r[i]);return n}function ta(r,t,e){var n=r.length;(!t||t<0)&&(t=0),(!e||e<0||e>n)&&(e=n);for(var i="",s=t;s<e;++s)i+=aa(r[s]);return i}function ra(r,t,e){for(var n=r.slice(t,e),i="",s=0;s<n.length;s+=2)i+=String.fromCharCode(n[s]+n[s+1]*256);return i}function R(r,t,e){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+t>e)throw new RangeError("Trying to access beyond buffer length")}function S(r,t,e,n,i,s){if(!q(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(e+n>r.length)throw new RangeError("Index out of range")}function nt(r,t,e,n){t<0&&(t=65535+t+1);for(var i=0,s=Math.min(r.length-e,2);i<s;++i)r[e+i]=(t&255<<8*(n?i:1-i))>>>(n?i:1-i)*8}function it(r,t,e,n){t<0&&(t=4294967295+t+1);for(var i=0,s=Math.min(r.length-e,4);i<s;++i)r[e+i]=t>>>(n?i:3-i)*8&255}function vr(r,t,e,n,i,s){if(e+n>r.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function Tr(r,t,e,n,i){return i||vr(r,t,e,4,34028234663852886e22,-34028234663852886e22),Rr(r,t,e,n,23,4),e+4}function Ar(r,t,e,n,i){return i||vr(r,t,e,8,17976931348623157e292,-17976931348623157e292),Rr(r,t,e,n,52,8),e+8}function ia(r){if(r=oa(r).replace(na,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function oa(r){return r.trim?r.trim():r.replace(/^\s+|\s+$/g,"")}function aa(r){return r<16?"0"+r.toString(16):r.toString(16)}function rt(r,t){t=t||1/0;for(var e,n=r.length,i=null,s=[],f=0;f<n;++f){if(e=r.charCodeAt(f),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&s.push(239,191,189);continue}else if(f+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&s.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;s.push(e)}else if(e<2048){if((t-=2)<0)break;s.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;s.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;s.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return s}function sa(r){for(var t=[],e=0;e<r.length;++e)t.push(r.charCodeAt(e)&255);return t}function pa(r,t){for(var e,n,i,s=[],f=0;f<r.length&&!((t-=2)<0);++f)e=r.charCodeAt(f),n=e>>8,i=e%256,s.push(i),s.push(n);return s}function br(r){return ko(ia(r))}function ot(r,t,e,n){for(var i=0;i<n&&!(i+e>=t.length||i>=r.length);++i)t[i+e]=r[i];return i}function fa(r){return r!==r}function ua(r){return r!=null&&(!!r._isBuffer||Er(r)||la(r))}function Er(r){return!!r.constructor&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function la(r){return typeof r.readFloatLE=="function"&&typeof r.slice=="function"&&Er(r.slice(0,0))}function at(r,t,e,n,i){var s,f,c=i*8-n-1,m=(1<<c)-1,d=m>>1,y=-7,x=e?i-1:0,w=e?-1:1,A=r[t+x];for(x+=w,s=A&(1<<-y)-1,A>>=-y,y+=c;y>0;s=s*256+r[t+x],x+=w,y-=8);for(f=s&(1<<-y)-1,s>>=-y,y+=n;y>0;f=f*256+r[t+x],x+=w,y-=8);if(s===0)s=1-d;else{if(s===m)return f?NaN:(A?-1:1)*(1/0);f=f+Math.pow(2,n),s=s-d}return(A?-1:1)*f*Math.pow(2,s-n)}function Rr(r,t,e,n,i,s){var f,c,m,d=s*8-i-1,y=(1<<d)-1,x=y>>1,w=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=n?0:s-1,b=n?1:-1,L=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(c=isNaN(t)?1:0,f=y):(f=Math.floor(Math.log(t)/Math.LN2),t*(m=Math.pow(2,-f))<1&&(f--,m*=2),f+x>=1?t+=w/m:t+=w*Math.pow(2,1-x),t*m>=2&&(f++,m/=2),f+x>=y?(c=0,f=y):f+x>=1?(c=(t*m-1)*Math.pow(2,i),f=f+x):(c=t*Math.pow(2,x-1)*Math.pow(2,i),f=0));i>=8;r[e+A]=c&255,A+=b,c/=256,i-=8);for(f=f<<i|c,d+=i;d>0;r[e+A]=f&255,A+=b,f/=256,d-=8);r[e+A-b]|=L*128}var j,_,Mo,kt,cr,na,Cr=Ot(()=>{"use strict";o();a();j=[],_=[],Mo=typeof Uint8Array!="undefined"?Uint8Array:Array,kt=!1;p.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;p.poolSize=8192;p._augment=function(r){return r.__proto__=p.prototype,r};p.from=function(r,t,e){return dr(null,r,t,e)};p.kMaxLength=tt();p.TYPED_ARRAY_SUPPORT&&(p.prototype.__proto__=Uint8Array.prototype,p.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&p[Symbol.species]);p.alloc=function(r,t,e){return qo(null,r,t,e)};p.allocUnsafe=function(r){return Dt(null,r)};p.allocUnsafeSlow=function(r){return Dt(null,r)};p.isBuffer=ua;p.compare=function(t,e){if(!q(t)||!q(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,i=e.length,s=0,f=Math.min(n,i);s<f;++s)if(t[s]!==e[s]){n=t[s],i=e[s];break}return n<i?-1:i<n?1:0};p.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}};p.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return p.alloc(0);var n;if(e===void 0)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var i=p.allocUnsafe(e),s=0;for(n=0;n<t.length;++n){var f=t[n];if(!q(f))throw new TypeError('"list" argument must be an Array of Buffers');f.copy(i,s),s+=f.length}return i};p.byteLength=yr;p.prototype._isBuffer=!0;p.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)xe(this,e,e+1);return this};p.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)xe(this,e,e+3),xe(this,e+1,e+2);return this};p.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)xe(this,e,e+7),xe(this,e+1,e+6),xe(this,e+2,e+5),xe(this,e+3,e+4);return this};p.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?wr(this,0,t):Go.apply(this,arguments)};p.prototype.equals=function(t){if(!q(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:p.compare(this,t)===0};p.prototype.compare=function(t,e,n,i,s){if(!q(t))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),n===void 0&&(n=t?t.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),e<0||n>t.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&e>=n)return 0;if(i>=s)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,i>>>=0,s>>>=0,this===t)return 0;for(var f=s-i,c=n-e,m=Math.min(f,c),d=this.slice(i,s),y=t.slice(e,n),x=0;x<m;++x)if(d[x]!==y[x]){f=d[x],c=y[x];break}return f<c?-1:c<f?1:0};p.prototype.includes=function(t,e,n){return this.indexOf(t,e,n)!==-1};p.prototype.indexOf=function(t,e,n){return xr(this,t,e,n,!0)};p.prototype.lastIndexOf=function(t,e,n){return xr(this,t,e,n,!1)};p.prototype.write=function(t,e,n,i){if(e===void 0)i="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")i=e,n=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(n)?(n=n|0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-e;if((n===void 0||n>s)&&(n=s),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var f=!1;;)switch(i){case"hex":return zo(this,t,e,n);case"utf8":case"utf-8":return Ho(this,t,e,n);case"ascii":return gr(this,t,e,n);case"latin1":case"binary":return Yo(this,t,e,n);case"base64":return Ko(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Jo(this,t,e,n);default:if(f)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),f=!0}};p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};cr=4096;p.prototype.slice=function(t,e){var n=this.length;t=~~t,e=e===void 0?n:~~e,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<t&&(e=t);var i;if(p.TYPED_ARRAY_SUPPORT)i=this.subarray(t,e),i.__proto__=p.prototype;else{var s=e-t;i=new p(s,void 0);for(var f=0;f<s;++f)i[f]=this[f+t]}return i};p.prototype.readUIntLE=function(t,e,n){t=t|0,e=e|0,n||R(t,e,this.length);for(var i=this[t],s=1,f=0;++f<e&&(s*=256);)i+=this[t+f]*s;return i};p.prototype.readUIntBE=function(t,e,n){t=t|0,e=e|0,n||R(t,e,this.length);for(var i=this[t+--e],s=1;e>0&&(s*=256);)i+=this[t+--e]*s;return i};p.prototype.readUInt8=function(t,e){return e||R(t,1,this.length),this[t]};p.prototype.readUInt16LE=function(t,e){return e||R(t,2,this.length),this[t]|this[t+1]<<8};p.prototype.readUInt16BE=function(t,e){return e||R(t,2,this.length),this[t]<<8|this[t+1]};p.prototype.readUInt32LE=function(t,e){return e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};p.prototype.readUInt32BE=function(t,e){return e||R(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};p.prototype.readIntLE=function(t,e,n){t=t|0,e=e|0,n||R(t,e,this.length);for(var i=this[t],s=1,f=0;++f<e&&(s*=256);)i+=this[t+f]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*e)),i};p.prototype.readIntBE=function(t,e,n){t=t|0,e=e|0,n||R(t,e,this.length);for(var i=e,s=1,f=this[t+--i];i>0&&(s*=256);)f+=this[t+--i]*s;return s*=128,f>=s&&(f-=Math.pow(2,8*e)),f};p.prototype.readInt8=function(t,e){return e||R(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};p.prototype.readInt16LE=function(t,e){e||R(t,2,this.length);var n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n};p.prototype.readInt16BE=function(t,e){e||R(t,2,this.length);var n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n};p.prototype.readInt32LE=function(t,e){return e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};p.prototype.readInt32BE=function(t,e){return e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};p.prototype.readFloatLE=function(t,e){return e||R(t,4,this.length),at(this,t,!0,23,4)};p.prototype.readFloatBE=function(t,e){return e||R(t,4,this.length),at(this,t,!1,23,4)};p.prototype.readDoubleLE=function(t,e){return e||R(t,8,this.length),at(this,t,!0,52,8)};p.prototype.readDoubleBE=function(t,e){return e||R(t,8,this.length),at(this,t,!1,52,8)};p.prototype.writeUIntLE=function(t,e,n,i){if(t=+t,e=e|0,n=n|0,!i){var s=Math.pow(2,8*n)-1;S(this,t,e,n,s,0)}var f=1,c=0;for(this[e]=t&255;++c<n&&(f*=256);)this[e+c]=t/f&255;return e+n};p.prototype.writeUIntBE=function(t,e,n,i){if(t=+t,e=e|0,n=n|0,!i){var s=Math.pow(2,8*n)-1;S(this,t,e,n,s,0)}var f=n-1,c=1;for(this[e+f]=t&255;--f>=0&&(c*=256);)this[e+f]=t/c&255;return e+n};p.prototype.writeUInt8=function(t,e,n){return t=+t,e=e|0,n||S(this,t,e,1,255,0),p.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=t&255,e+1};p.prototype.writeUInt16LE=function(t,e,n){return t=+t,e=e|0,n||S(this,t,e,2,65535,0),p.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):nt(this,t,e,!0),e+2};p.prototype.writeUInt16BE=function(t,e,n){return t=+t,e=e|0,n||S(this,t,e,2,65535,0),p.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):nt(this,t,e,!1),e+2};p.prototype.writeUInt32LE=function(t,e,n){return t=+t,e=e|0,n||S(this,t,e,4,4294967295,0),p.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255):it(this,t,e,!0),e+4};p.prototype.writeUInt32BE=function(t,e,n){return t=+t,e=e|0,n||S(this,t,e,4,4294967295,0),p.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):it(this,t,e,!1),e+4};p.prototype.writeIntLE=function(t,e,n,i){if(t=+t,e=e|0,!i){var s=Math.pow(2,8*n-1);S(this,t,e,n,s-1,-s)}var f=0,c=1,m=0;for(this[e]=t&255;++f<n&&(c*=256);)t<0&&m===0&&this[e+f-1]!==0&&(m=1),this[e+f]=(t/c>>0)-m&255;return e+n};p.prototype.writeIntBE=function(t,e,n,i){if(t=+t,e=e|0,!i){var s=Math.pow(2,8*n-1);S(this,t,e,n,s-1,-s)}var f=n-1,c=1,m=0;for(this[e+f]=t&255;--f>=0&&(c*=256);)t<0&&m===0&&this[e+f+1]!==0&&(m=1),this[e+f]=(t/c>>0)-m&255;return e+n};p.prototype.writeInt8=function(t,e,n){return t=+t,e=e|0,n||S(this,t,e,1,127,-128),p.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=t&255,e+1};p.prototype.writeInt16LE=function(t,e,n){return t=+t,e=e|0,n||S(this,t,e,2,32767,-32768),p.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):nt(this,t,e,!0),e+2};p.prototype.writeInt16BE=function(t,e,n){return t=+t,e=e|0,n||S(this,t,e,2,32767,-32768),p.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):nt(this,t,e,!1),e+2};p.prototype.writeInt32LE=function(t,e,n){return t=+t,e=e|0,n||S(this,t,e,4,2147483647,-2147483648),p.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):it(this,t,e,!0),e+4};p.prototype.writeInt32BE=function(t,e,n){return t=+t,e=e|0,n||S(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),p.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):it(this,t,e,!1),e+4};p.prototype.writeFloatLE=function(t,e,n){return Tr(this,t,e,!0,n)};p.prototype.writeFloatBE=function(t,e,n){return Tr(this,t,e,!1,n)};p.prototype.writeDoubleLE=function(t,e,n){return Ar(this,t,e,!0,n)};p.prototype.writeDoubleBE=function(t,e,n){return Ar(this,t,e,!1,n)};p.prototype.copy=function(t,e,n,i){if(n||(n=0),!i&&i!==0&&(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<n&&(i=n),i===n||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=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-n&&(i=t.length-e+n);var s=i-n,f;if(this===t&&n<e&&e<i)for(f=s-1;f>=0;--f)t[f+e]=this[f+n];else if(s<1e3||!p.TYPED_ARRAY_SUPPORT)for(f=0;f<s;++f)t[f+e]=this[f+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+s),e);return s};p.prototype.fill=function(t,e,n,i){if(typeof t=="string"){if(typeof e=="string"?(i=e,e=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),t.length===1){var s=t.charCodeAt(0);s<256&&(t=s)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!p.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof t=="number"&&(t=t&255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e=e>>>0,n=n===void 0?this.length:n>>>0,t||(t=0);var f;if(typeof t=="number")for(f=e;f<n;++f)this[f]=t;else{var c=q(t)?t:rt(new p(t,i).toString()),m=c.length;for(f=0;f<n-e;++f)this[f+e]=c[f%m]}return this};na=/[^+\/0-9A-Za-z-_]/g});var a=Ot(()=>{"use strict";Cr()});var $l={};nr($l,{DynamicSnippetsGenerator:()=>Qt});module.exports=po($l);o();a();o();a();o();a();function T(r){throw new Error("Unexpected value: "+JSON.stringify(r))}o();a();o();a();o();a();o();a();o();a();o();a();var ca=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis,st=ca;var ma=typeof self=="object"&&self&&self.Object===Object&&self,da=st||ma||Function("return this")(),C=da;var ha=C.Symbol,F=ha;o();a();var Ir=Object.prototype,ya=Ir.hasOwnProperty,xa=Ir.toString,De=F?F.toStringTag:void 0;function ga(r){var t=ya.call(r,De),e=r[De];try{r[De]=void 0;var n=!0}catch(s){}var i=xa.call(r);return n&&(t?r[De]=e:delete r[De]),i}var Nr=ga;o();a();var wa=Object.prototype,va=wa.toString;function Ta(r){return va.call(r)}var Sr=Ta;var Aa="[object Null]",ba="[object Undefined]",Lr=F?F.toStringTag:void 0;function Ea(r){return r==null?r===void 0?ba:Aa:Lr&&Lr in Object(r)?Nr(r):Sr(r)}var U=Ea;o();a();function Ra(r){return r!=null&&typeof r=="object"}var O=Ra;var Ca="[object Symbol]";function Ia(r){return typeof r=="symbol"||O(r)&&U(r)==Ca}var Pr=Ia;o();a();o();a();function Na(r,t){for(var e=-1,n=r==null?0:r.length,i=Array(n);++e<n;)i[e]=t(r[e],e,r);return i}var _r=Na;o();a();var Sa=Array.isArray,H=Sa;var La=1/0,Fr=F?F.prototype:void 0,Br=Fr?Fr.toString:void 0;function Ur(r){if(typeof r=="string")return r;if(H(r))return _r(r,Ur)+"";if(Pr(r))return Br?Br.call(r):"";var t=r+"";return t=="0"&&1/r==-La?"-0":t}var Or=Ur;o();a();function Pa(r){var t=typeof r;return r!=null&&(t=="object"||t=="function")}var pt=Pa;o();a();o();a();o();a();o();a();var _a="[object AsyncFunction]",Fa="[object Function]",Ba="[object GeneratorFunction]",Ua="[object Proxy]";function Oa(r){if(!pt(r))return!1;var t=U(r);return t==Fa||t==Ba||t==_a||t==Ua}var ft=Oa;o();a();o();a();var Ma=C["__core-js_shared__"],ut=Ma;var Mr=(function(){var r=/[^.]+$/.exec(ut&&ut.keys&&ut.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""})();function ka(r){return!!Mr&&Mr in r}var kr=ka;o();a();var Da=Function.prototype,ja=Da.toString;function qa(r){if(r!=null){try{return ja.call(r)}catch(t){}try{return r+""}catch(t){}}return""}var Y=qa;var $a=/[\\^$.*+?()[\]{}|]/g,Wa=/^\[object .+?Constructor\]$/,Va=Function.prototype,Ga=Object.prototype,za=Va.toString,Ha=Ga.hasOwnProperty,Ya=RegExp("^"+za.call(Ha).replace($a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ka(r){if(!pt(r)||kr(r))return!1;var t=ft(r)?Ya:Wa;return t.test(Y(r))}var Dr=Ka;o();a();function Ja(r,t){return r==null?void 0:r[t]}var jr=Ja;function Za(r,t){var e=jr(r,t);return Dr(e)?e:void 0}var B=Za;var Qa=B(C,"WeakMap"),lt=Qa;o();a();function Xa(){}var qr=Xa;o();a();o();a();o();a();function es(r,t,e,n){for(var i=r.length,s=e+(n?1:-1);n?s--:++s<i;)if(t(r[s],s,r))return s;return-1}var $r=es;o();a();function ts(r){return r!==r}var Wr=ts;o();a();function rs(r,t,e){for(var n=e-1,i=r.length;++n<i;)if(r[n]===t)return n;return-1}var Vr=rs;function ns(r,t,e){return t===t?Vr(r,t,e):$r(r,Wr,e)}var Gr=ns;function is(r,t){var e=r==null?0:r.length;return!!e&&Gr(r,t,0)>-1}var zr=is;o();a();var os=9007199254740991,as=/^(?:0|[1-9]\d*)$/;function ss(r,t){var e=typeof r;return t=t==null?os:t,!!t&&(e=="number"||e!="symbol"&&as.test(r))&&r>-1&&r%1==0&&r<t}var Hr=ss;o();a();function ps(r,t){return r===t||r!==r&&t!==t}var ct=ps;o();a();o();a();var fs=9007199254740991;function us(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=fs}var mt=us;function ls(r){return r!=null&&mt(r.length)&&!ft(r)}var Yr=ls;o();a();var cs=Object.prototype;function ms(r){var t=r&&r.constructor,e=typeof t=="function"&&t.prototype||cs;return r===e}var Kr=ms;o();a();o();a();o();a();function ds(r,t){for(var e=-1,n=Array(r);++e<r;)n[e]=t(e);return n}var Jr=ds;o();a();o();a();var hs="[object Arguments]";function ys(r){return O(r)&&U(r)==hs}var qt=ys;var Zr=Object.prototype,xs=Zr.hasOwnProperty,gs=Zr.propertyIsEnumerable,ws=qt((function(){return arguments})())?qt:function(r){return O(r)&&xs.call(r,"callee")&&!gs.call(r,"callee")},Qr=ws;o();a();o();a();function vs(){return!1}var Xr=vs;var rn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,en=rn&&typeof module=="object"&&module&&!module.nodeType&&module,Ts=en&&en.exports===rn,tn=Ts?C.Buffer:void 0,As=tn?tn.isBuffer:void 0,bs=As||Xr,je=bs;o();a();o();a();var Es="[object Arguments]",Rs="[object Array]",Cs="[object Boolean]",Is="[object Date]",Ns="[object Error]",Ss="[object Function]",Ls="[object Map]",Ps="[object Number]",_s="[object Object]",Fs="[object RegExp]",Bs="[object Set]",Us="[object String]",Os="[object WeakMap]",Ms="[object ArrayBuffer]",ks="[object DataView]",Ds="[object Float32Array]",js="[object Float64Array]",qs="[object Int8Array]",$s="[object Int16Array]",Ws="[object Int32Array]",Vs="[object Uint8Array]",Gs="[object Uint8ClampedArray]",zs="[object Uint16Array]",Hs="[object Uint32Array]",E={};E[Ds]=E[js]=E[qs]=E[$s]=E[Ws]=E[Vs]=E[Gs]=E[zs]=E[Hs]=!0;E[Es]=E[Rs]=E[Ms]=E[Cs]=E[ks]=E[Is]=E[Ns]=E[Ss]=E[Ls]=E[Ps]=E[_s]=E[Fs]=E[Bs]=E[Us]=E[Os]=!1;function Ys(r){return O(r)&&mt(r.length)&&!!E[U(r)]}var nn=Ys;o();a();function Ks(r){return function(t){return r(t)}}var on=Ks;o();a();var an=typeof exports=="object"&&exports&&!exports.nodeType&&exports,qe=an&&typeof module=="object"&&module&&!module.nodeType&&module,Js=qe&&qe.exports===an,$t=Js&&st.process,Zs=(function(){try{var r=qe&&qe.require&&qe.require("util").types;return r||$t&&$t.binding&&$t.binding("util")}catch(t){}})(),Wt=Zs;var sn=Wt&&Wt.isTypedArray,Qs=sn?on(sn):nn,dt=Qs;var Xs=Object.prototype,ep=Xs.hasOwnProperty;function tp(r,t){var e=H(r),n=!e&&Qr(r),i=!e&&!n&&je(r),s=!e&&!n&&!i&&dt(r),f=e||n||i||s,c=f?Jr(r.length,String):[],m=c.length;for(var d in r)(t||ep.call(r,d))&&!(f&&(d=="length"||i&&(d=="offset"||d=="parent")||s&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||Hr(d,m)))&&c.push(d);return c}var pn=tp;o();a();o();a();o();a();function rp(r,t){return function(e){return r(t(e))}}var fn=rp;var np=fn(Object.keys,Object),un=np;var ip=Object.prototype,op=ip.hasOwnProperty;function ap(r){if(!Kr(r))return un(r);var t=[];for(var e in Object(r))op.call(r,e)&&e!="constructor"&&t.push(e);return t}var ln=ap;function sp(r){return Yr(r)?pn(r):ln(r)}var cn=sp;o();a();o();a();o();a();o();a();o();a();var pp=B(Object,"create"),K=pp;function fp(){this.__data__=K?K(null):{},this.size=0}var mn=fp;o();a();function up(r){var t=this.has(r)&&delete this.__data__[r];return this.size-=t?1:0,t}var dn=up;o();a();var lp="__lodash_hash_undefined__",cp=Object.prototype,mp=cp.hasOwnProperty;function dp(r){var t=this.__data__;if(K){var e=t[r];return e===lp?void 0:e}return mp.call(t,r)?t[r]:void 0}var hn=dp;o();a();var hp=Object.prototype,yp=hp.hasOwnProperty;function xp(r){var t=this.__data__;return K?t[r]!==void 0:yp.call(t,r)}var yn=xp;o();a();var gp="__lodash_hash_undefined__";function wp(r,t){var e=this.__data__;return this.size+=this.has(r)?0:1,e[r]=K&&t===void 0?gp:t,this}var xn=wp;function Pe(r){var t=-1,e=r==null?0:r.length;for(this.clear();++t<e;){var n=r[t];this.set(n[0],n[1])}}Pe.prototype.clear=mn;Pe.prototype.delete=dn;Pe.prototype.get=hn;Pe.prototype.has=yn;Pe.prototype.set=xn;var Vt=Pe;o();a();o();a();function vp(){this.__data__=[],this.size=0}var gn=vp;o();a();o();a();function Tp(r,t){for(var e=r.length;e--;)if(ct(r[e][0],t))return e;return-1}var ie=Tp;var Ap=Array.prototype,bp=Ap.splice;function Ep(r){var t=this.__data__,e=ie(t,r);if(e<0)return!1;var n=t.length-1;return e==n?t.pop():bp.call(t,e,1),--this.size,!0}var wn=Ep;o();a();function Rp(r){var t=this.__data__,e=ie(t,r);return e<0?void 0:t[e][1]}var vn=Rp;o();a();function Cp(r){return ie(this.__data__,r)>-1}var Tn=Cp;o();a();function Ip(r,t){var e=this.__data__,n=ie(e,r);return n<0?(++this.size,e.push([r,t])):e[n][1]=t,this}var An=Ip;function _e(r){var t=-1,e=r==null?0:r.length;for(this.clear();++t<e;){var n=r[t];this.set(n[0],n[1])}}_e.prototype.clear=gn;_e.prototype.delete=wn;_e.prototype.get=vn;_e.prototype.has=Tn;_e.prototype.set=An;var oe=_e;o();a();var Np=B(C,"Map"),ae=Np;function Sp(){this.size=0,this.__data__={hash:new Vt,map:new(ae||oe),string:new Vt}}var bn=Sp;o();a();o();a();o();a();function Lp(r){var t=typeof r;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?r!=="__proto__":r===null}var En=Lp;function Pp(r,t){var e=r.__data__;return En(t)?e[typeof t=="string"?"string":"hash"]:e.map}var se=Pp;function _p(r){var t=se(this,r).delete(r);return this.size-=t?1:0,t}var Rn=_p;o();a();function Fp(r){return se(this,r).get(r)}var Cn=Fp;o();a();function Bp(r){return se(this,r).has(r)}var In=Bp;o();a();function Up(r,t){var e=se(this,r),n=e.size;return e.set(r,t),this.size+=e.size==n?0:1,this}var Nn=Up;function Fe(r){var t=-1,e=r==null?0:r.length;for(this.clear();++t<e;){var n=r[t];this.set(n[0],n[1])}}Fe.prototype.clear=bn;Fe.prototype.delete=Rn;Fe.prototype.get=Cn;Fe.prototype.has=In;Fe.prototype.set=Nn;var ht=Fe;o();a();function Op(r){return r==null?"":Or(r)}var pe=Op;o();a();function Mp(r,t){for(var e=-1,n=t.length,i=r.length;++e<n;)r[i+e]=t[e];return r}var Sn=Mp;o();a();o();a();o();a();o();a();o();a();o();a();function kp(r,t,e){var n=-1,i=r.length;t<0&&(t=-t>i?0:i+t),e=e>i?i:e,e<0&&(e+=i),i=t>e?0:e-t>>>0,t>>>=0;for(var s=Array(i);++n<i;)s[n]=r[n+t];return s}var Ln=kp;function Dp(r,t,e){var n=r.length;return e=e===void 0?n:e,!t&&e>=n?r:Ln(r,t,e)}var Pn=Dp;o();a();var jp="\\ud800-\\udfff",qp="\\u0300-\\u036f",$p="\\ufe20-\\ufe2f",Wp="\\u20d0-\\u20ff",Vp=qp+$p+Wp,Gp="\\ufe0e\\ufe0f",zp="\\u200d",Hp=RegExp("["+zp+jp+Vp+Gp+"]");function Yp(r){return Hp.test(r)}var yt=Yp;o();a();o();a();function Kp(r){return r.split("")}var _n=Kp;o();a();var Fn="\\ud800-\\udfff",Jp="\\u0300-\\u036f",Zp="\\ufe20-\\ufe2f",Qp="\\u20d0-\\u20ff",Xp=Jp+Zp+Qp,ef="\\ufe0e\\ufe0f",tf="["+Fn+"]",Gt="["+Xp+"]",zt="\\ud83c[\\udffb-\\udfff]",rf="(?:"+Gt+"|"+zt+")",Bn="[^"+Fn+"]",Un="(?:\\ud83c[\\udde6-\\uddff]){2}",On="[\\ud800-\\udbff][\\udc00-\\udfff]",nf="\\u200d",Mn=rf+"?",kn="["+ef+"]?",of="(?:"+nf+"(?:"+[Bn,Un,On].join("|")+")"+kn+Mn+")*",af=kn+Mn+of,sf="(?:"+[Bn+Gt+"?",Gt,Un,On,tf].join("|")+")",pf=RegExp(zt+"(?="+zt+")|"+sf+af,"g");function ff(r){return r.match(pf)||[]}var Dn=ff;function uf(r){return yt(r)?Dn(r):_n(r)}var jn=uf;function lf(r){return function(t){t=pe(t);var e=yt(t)?jn(t):void 0,n=e?e[0]:t.charAt(0),i=e?Pn(e,1).join(""):t.slice(1);return n[r]()+i}}var qn=lf;var cf=qn("toUpperCase"),Be=cf;function mf(r){return Be(pe(r).toLowerCase())}var $n=mf;o();a();o();a();function df(r,t,e,n){var i=-1,s=r==null?0:r.length;for(n&&s&&(e=r[++i]);++i<s;)e=t(e,r[i],i,r);return e}var Wn=df;o();a();o();a();o();a();function hf(r){return function(t){return r==null?void 0:r[t]}}var Vn=hf;var yf={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},xf=Vn(yf),Gn=xf;var gf=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,wf="\\u0300-\\u036f",vf="\\ufe20-\\ufe2f",Tf="\\u20d0-\\u20ff",Af=wf+vf+Tf,bf="["+Af+"]",Ef=RegExp(bf,"g");function Rf(r){return r=pe(r),r&&r.replace(gf,Gn).replace(Ef,"")}var zn=Rf;o();a();o();a();var Cf=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function If(r){return r.match(Cf)||[]}var Hn=If;o();a();var Nf=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function Sf(r){return Nf.test(r)}var Yn=Sf;o();a();var Xn="\\ud800-\\udfff",Lf="\\u0300-\\u036f",Pf="\\ufe20-\\ufe2f",_f="\\u20d0-\\u20ff",Ff=Lf+Pf+_f,ei="\\u2700-\\u27bf",ti="a-z\\xdf-\\xf6\\xf8-\\xff",Bf="\\xac\\xb1\\xd7\\xf7",Uf="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Of="\\u2000-\\u206f",Mf=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ri="A-Z\\xc0-\\xd6\\xd8-\\xde",kf="\\ufe0e\\ufe0f",ni=Bf+Uf+Of+Mf,ii="['\u2019]",Kn="["+ni+"]",Df="["+Ff+"]",oi="\\d+",jf="["+ei+"]",ai="["+ti+"]",si="[^"+Xn+ni+oi+ei+ti+ri+"]",qf="\\ud83c[\\udffb-\\udfff]",$f="(?:"+Df+"|"+qf+")",Wf="[^"+Xn+"]",pi="(?:\\ud83c[\\udde6-\\uddff]){2}",fi="[\\ud800-\\udbff][\\udc00-\\udfff]",Ue="["+ri+"]",Vf="\\u200d",Jn="(?:"+ai+"|"+si+")",Gf="(?:"+Ue+"|"+si+")",Zn="(?:"+ii+"(?:d|ll|m|re|s|t|ve))?",Qn="(?:"+ii+"(?:D|LL|M|RE|S|T|VE))?",ui=$f+"?",li="["+kf+"]?",zf="(?:"+Vf+"(?:"+[Wf,pi,fi].join("|")+")"+li+ui+")*",Hf="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Yf="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Kf=li+ui+zf,Jf="(?:"+[jf,pi,fi].join("|")+")"+Kf,Zf=RegExp([Ue+"?"+ai+"+"+Zn+"(?="+[Kn,Ue,"$"].join("|")+")",Gf+"+"+Qn+"(?="+[Kn,Ue+Jn,"$"].join("|")+")",Ue+"?"+Jn+"+"+Zn,Ue+"+"+Qn,Yf,Hf,oi,Jf].join("|"),"g");function Qf(r){return r.match(Zf)||[]}var ci=Qf;function Xf(r,t,e){return r=pe(r),t=e?void 0:t,t===void 0?Yn(r)?ci(r):Hn(r):r.match(t)||[]}var mi=Xf;var eu="['\u2019]",tu=RegExp(eu,"g");function ru(r){return function(t){return Wn(mi(zn(t).replace(tu,"")),r,"")}}var di=ru;var nu=di(function(r,t,e){return t=t.toLowerCase(),r+(e?$n(t):t)}),xt=nu;o();a();o();a();function iu(){this.__data__=new oe,this.size=0}var hi=iu;o();a();function ou(r){var t=this.__data__,e=t.delete(r);return this.size=t.size,e}var yi=ou;o();a();function au(r){return this.__data__.get(r)}var xi=au;o();a();function su(r){return this.__data__.has(r)}var gi=su;o();a();var pu=200;function fu(r,t){var e=this.__data__;if(e instanceof oe){var n=e.__data__;if(!ae||n.length<pu-1)return n.push([r,t]),this.size=++e.size,this;e=this.__data__=new ht(n)}return e.set(r,t),this.size=e.size,this}var wi=fu;function Oe(r){var t=this.__data__=new oe(r);this.size=t.size}Oe.prototype.clear=hi;Oe.prototype.delete=yi;Oe.prototype.get=xi;Oe.prototype.has=gi;Oe.prototype.set=wi;var gt=Oe;o();a();o();a();function uu(r,t){for(var e=-1,n=r==null?0:r.length,i=0,s=[];++e<n;){var f=r[e];t(f,e,r)&&(s[i++]=f)}return s}var vi=uu;o();a();function lu(){return[]}var Ti=lu;var cu=Object.prototype,mu=cu.propertyIsEnumerable,Ai=Object.getOwnPropertySymbols,du=Ai?function(r){return r==null?[]:(r=Object(r),vi(Ai(r),function(t){return mu.call(r,t)}))}:Ti,bi=du;o();a();o();a();function hu(r,t,e){var n=t(r);return H(r)?n:Sn(n,e(r))}var Ei=hu;function yu(r){return Ei(r,cn,bi)}var Ht=yu;o();a();o();a();var xu=B(C,"DataView"),wt=xu;o();a();var gu=B(C,"Promise"),vt=gu;o();a();var wu=B(C,"Set"),fe=wu;var Ri="[object Map]",vu="[object Object]",Ci="[object Promise]",Ii="[object Set]",Ni="[object WeakMap]",Si="[object DataView]",Tu=Y(wt),Au=Y(ae),bu=Y(vt),Eu=Y(fe),Ru=Y(lt),ge=U;(wt&&ge(new wt(new ArrayBuffer(1)))!=Si||ae&&ge(new ae)!=Ri||vt&&ge(vt.resolve())!=Ci||fe&&ge(new fe)!=Ii||lt&&ge(new lt)!=Ni)&&(ge=function(r){var t=U(r),e=t==vu?r.constructor:void 0,n=e?Y(e):"";if(n)switch(n){case Tu:return Si;case Au:return Ri;case bu:return Ci;case Eu:return Ii;case Ru:return Ni}return t});var Yt=ge;o();a();var Cu=C.Uint8Array,Kt=Cu;o();a();o();a();o();a();o();a();o();a();var Iu="__lodash_hash_undefined__";function Nu(r){return this.__data__.set(r,Iu),this}var Li=Nu;o();a();function Su(r){return this.__data__.has(r)}var Pi=Su;function Tt(r){var t=-1,e=r==null?0:r.length;for(this.__data__=new ht;++t<e;)this.add(r[t])}Tt.prototype.add=Tt.prototype.push=Li;Tt.prototype.has=Pi;var At=Tt;o();a();function Lu(r,t){for(var e=-1,n=r==null?0:r.length;++e<n;)if(t(r[e],e,r))return!0;return!1}var _i=Lu;o();a();function Pu(r,t){return r.has(t)}var bt=Pu;var _u=1,Fu=2;function Bu(r,t,e,n,i,s){var f=e&_u,c=r.length,m=t.length;if(c!=m&&!(f&&m>c))return!1;var d=s.get(r),y=s.get(t);if(d&&y)return d==t&&y==r;var x=-1,w=!0,A=e&Fu?new At:void 0;for(s.set(r,t),s.set(t,r);++x<c;){var b=r[x],L=t[x];if(n)var te=f?n(L,b,x,t,r,s):n(b,L,x,r,t,s);if(te!==void 0){if(te)continue;w=!1;break}if(A){if(!_i(t,function(me,de){if(!bt(A,de)&&(b===me||i(b,me,e,n,s)))return A.push(de)})){w=!1;break}}else if(!(b===L||i(b,L,e,n,s))){w=!1;break}}return s.delete(r),s.delete(t),w}var Et=Bu;o();a();o();a();function Uu(r){var t=-1,e=Array(r.size);return r.forEach(function(n,i){e[++t]=[i,n]}),e}var Fi=Uu;o();a();function Ou(r){var t=-1,e=Array(r.size);return r.forEach(function(n){e[++t]=n}),e}var Me=Ou;var Mu=1,ku=2,Du="[object Boolean]",ju="[object Date]",qu="[object Error]",$u="[object Map]",Wu="[object Number]",Vu="[object RegExp]",Gu="[object Set]",zu="[object String]",Hu="[object Symbol]",Yu="[object ArrayBuffer]",Ku="[object DataView]",Bi=F?F.prototype:void 0,Jt=Bi?Bi.valueOf:void 0;function Ju(r,t,e,n,i,s,f){switch(e){case Ku:if(r.byteLength!=t.byteLength||r.byteOffset!=t.byteOffset)return!1;r=r.buffer,t=t.buffer;case Yu:return!(r.byteLength!=t.byteLength||!s(new Kt(r),new Kt(t)));case Du:case ju:case Wu:return ct(+r,+t);case qu:return r.name==t.name&&r.message==t.message;case Vu:case zu:return r==t+"";case $u:var c=Fi;case Gu:var m=nΜif(c||(c=Me),r.size!=t.size&&!m)return!1;var d=f.get(r);if(d)return d==t;n|=ku,f.set(r,t);var y=Et(c(r),c(t),n,i,s,f);return f.delete(r),y;case Hu:if(Jt)return Jt.call(r)==Jt.call(t)}return!1}var Ui=Ju;o();a();var Zu=1,Qu=Object.prototype,Xu=Qu.hasOwnProperty;function el(r,t,e,n,i,s){var f=e&Zu,c=Ht(r),m=c.length,d=Ht(t),y=d.length;if(m!=y&&!f)return!1;for(var x=m;x--;){var w=c[x];if(!(f?w in t:Xu.call(t,w)))return!1}var A=s.get(r),b=s.get(t);if(A&&b)return A==t&&b==r;var L=!0;s.set(r,t),s.set(t,r);for(var te=f;++x<m;){w=c[x];var me=r[w],de=t[w];if(n)var Xt=f?n(de,me,w,t,r,s):n(me,de,w,r,t,s);if(!(Xt===void 0?me===de||i(me,de,e,n,s):Xt)){L=!1;break}te||(te=w=="constructor")}if(L&&!te){var Je=r.constructor,Ze=t.constructor;Je!=Ze&&"constructor"in r&&"constructor"in t&&!(typeof Je=="function"&&Je instanceof Je&&typeof Ze=="function"&&Ze instanceof Ze)&&(L=!1)}return s.delete(r),s.delete(t),L}var Oi=el;var tl=1,Mi="[object Arguments]",ki="[object Array]",Rt="[object Object]",rl=Object.prototype,Di=rl.hasOwnProperty;function nl(r,t,e,n,i,s){var f=H(r),c=H(t),m=f?ki:Yt(r),d=c?ki:Yt(t);m=m==Mi?Rt:m,d=d==Mi?Rt:d;var y=m==Rt,x=d==Rt,w=m==d;if(w&&je(r)){if(!je(t))return!1;f=!0,y=!1}if(w&&!y)return s||(s=new gt),f||dt(r)?Et(r,t,e,n,i,s):Ui(r,t,m,e,n,i,s);if(!(e&tl)){var A=y&&Di.call(r,"__wrapped__"),b=x&&Di.call(t,"__wrapped__");if(A||b){var L=A?r.value():r,te=b?t.value():t;return s||(s=new gt),i(L,te,e,n,s)}}return w?(s||(s=new gt),Oi(r,t,e,n,i,s)):!1}var ji=nl;function qi(r,t,e,n,i){return r===t?!0:r==null||t==null||!O(r)&&!O(t)?r!==r&&t!==t:ji(r,t,e,n,qi,i)}var $i=qi;o();a();function il(r,t,e){for(var n=-1,i=r==null?0:r.length;++n<i;)if(e(t,r[n]))return!0;return!1}var Wi=il;o();a();function ol(r,t){return $i(r,t)}var Ct=ol;o();a();o();a();var al=1/0,sl=fe&&1/Me(new fe([,-0]))[1]==al?function(r){return new fe(r)}:qr,Vi=sl;var pl=200;function fl(r,t,e){var n=-1,i=zr,s=r.length,f=!0,c=[],m=c;if(e)f=!1,i=Wi;else if(s>=pl){var d=t?null:Vi(r);if(d)return Me(d);f=!1,i=bt,m=new At}else m=t?[]:c;e:for(;++n<s;){var y=r[n],x=t?t(y):y;if(y=e||y!==0?y:0,f&&x===x){for(var w=m.length;w--;)if(m[w]===x)continue e;t&&m.push(x),c.push(y)}else i(m,x,e)||(m!==c&&m.push(x),c.push(y))}return c}var Gi=fl;o();a();function ul(r,t){return t=typeof t=="function"?t:void 0,r&&r.length?Gi(r,void 0,t):[]}var It=ul;o();a();function $e(r){return Object.keys(r)}o();a();o();a();var J=class{};o();a();o();a();var M=class extends J{constructor(e){super();l(this,"value");this.value=e}write(e){typeof this.value=="string"?e.write(this.value):typeof this.value=="function"?this.value(e):this.value.write(e)}};var ll=4,We=class{constructor(){l(this,"buffer","");l(this,"indentLevel",0);l(this,"hasWrittenAnything",!1);l(this,"lastCharacterIsSemicolon",!1);l(this,"lastCharacterIsNewline",!1)}write(t){let e=t.length>0&&t.endsWith(`
|
|
2
|
+
`),n=e?t.substring(0,t.length-1):t,i=this.getIndentString(),s=n.replaceAll(`
|
|
3
3
|
`,`
|
|
4
|
-
${i}`);this.isAtStartOfLine()&&(
|
|
5
|
-
`),this.writeInternal(
|
|
6
|
-
`)}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
|
|
7
|
-
`)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:t,delimiter:e,writeFunction:
|
|
8
|
-
`)),this.buffer+=t}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*Bo)}};u();p();function Qe(n){return(n==null?void 0:n.name)!=null}u();p();var we=class extends ${constructor({condition:e,true_:r,false_:i}){super();f(this,"condition");f(this,"true_");f(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();p();u();p();u();p();var ve=class{constructor(){f(this,"reporter");f(this,"snippet");f(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:t,snippet:e}){(this.reporter==null||this.reporter.size()>t.errors.size())&&(this.reporter=t.errors.clone(),this.snippet=e)}getResponseOrThrow({endpoint:t}){var e;if(this.snippet!=null&&this.reporter!=null)return{snippet:this.snippet,errors:this.reporter.toDynamicSnippetErrors()};throw(e=this.err)!=null?e:new Error(`Failed to generate snippet for endpoint "${t.method} ${t.path}"`)}};var Te=class{constructor(t){f(this,"context");this.context=t}async generate(t){let e=this.context.resolveEndpointLocationOrThrow(t.endpoint);if(e.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let r=new ve;for(let i of e){let o=this.context.clone(),a=this.createSnippetGenerator(o);try{let l=await a.generateSnippet({endpoint:i,request:t});if(o.errors.empty())return{snippet:l,errors:void 0};r.update({context:o,snippet:l})}catch(l){r.err==null&&(r.err=l)}}return r.getResponseOrThrow({endpoint:t.endpoint})}generateSync(t){let e=this.context.resolveEndpointLocationOrThrow(t.endpoint);if(e.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let r=new ve;for(let i of e){let o=this.context.clone(),a=this.createSnippetGenerator(o);try{let l=a.generateSnippetSync({endpoint:i,request:t});if(o.errors.empty())return{snippet:l,errors:void 0};r.update({context:o,snippet:l})}catch(l){r.err==null&&(r.err=l)}}return r.getResponseOrThrow({endpoint:t.endpoint})}};u();p();u();p();u();p();var Ae=class{constructor(){f(this,"REFERENCE_REGEX",/^(GET|POST|PUT|DELETE|PATCH)\s(\/[a-zA-Z0-9\/{}_-]*)$/)}validate(t){return this.REFERENCE_REGEX.test(t)?{type:"valid"}:{type:"invalid"}}tryParse(t){if(this.validate(t).type==="invalid")return;let r=t.match(this.REFERENCE_REGEX);if(!(r==null||r[1]==null||r[2]==null))return{method:r[1],path:r[2]}}};u();p();var w={Critical:"CRITICAL",Warning:"WARNING"},Re=class n{constructor(){f(this,"errors");f(this,"path");this.errors=[],this.path=[]}add(t){this.errors.push(fe(pe({},t),{path:[...this.path]}))}scope(t){this.path.push(t)}unscope(){this.path.pop()}getBySeverity(t){return this.errors.filter(e=>e.severity===t)}empty(){return this.errors.length===0}size(){return this.errors.length}clone(){let t=new n;return t.errors=[...this.errors],t.path=[...this.path],t}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(t=>({severity:t.severity,path:t.path!=null?this.pathToStringArray(t.path):void 0,message:t.message}))}pathToStringArray(t){let e=[];for(let r of t){if(typeof r=="string"){e.push(r);continue}e[e.length-1]+=`[${r.index}]`}return e}};var Ee=class{constructor({ir:t,config:e}){f(this,"config");f(this,"errors");f(this,"_ir");f(this,"httpEndpointReferenceParser");this._ir=t,this.config=e,this.errors=new Re,this.httpEndpointReferenceParser=new Ae}associateQueryParametersByWireValue({parameters:t,values:e}){let r=[];for(let[i,o]of Object.entries(e)){this.errors.scope(i);try{let a=t.find(m=>m.name.wireValue===i);if(a==null)throw this.newParameterNotRecognizedError(i);let l=this.isListTypeReference(a.typeReference)&&!Array.isArray(o)?[o]:o;r.push({name:a.name,typeReference:a.typeReference,value:l})}finally{this.errors.unscope()}}return r}associateByWireValue({parameters:t,values:e,ignoreMissingParameters:r}){let i=[];for(let[o,a]of Object.entries(e)){this.errors.scope(o);try{let l=t.find(m=>m.name.wireValue===o);if(l==null){if(r)continue;this.errors.add({severity:w.Critical,message:this.newParameterNotRecognizedError(o).message});continue}i.push({name:l.name,typeReference:l.typeReference,value:a})}finally{this.errors.unscope()}}return i}getSingleFileValue({property:t,record:e}){let r=e[t.wireValue];if(r!=null){if(typeof r!="string"){this.errors.add({severity:w.Critical,message:`Expected file value to be a string, got ${typeof r}`});return}return r}}getFileArrayValues({property:t,record:e}){let r=e[t.wireValue];if(r==null)return;if(!Array.isArray(r)){this.errors.add({severity:w.Critical,message:`Expected file array value to be an array of strings, got ${typeof r}`});return}let i=[];for(let o of r){if(typeof o!="string"){this.errors.add({severity:w.Critical,message:`Expected file array value to be an array of strings, got ${typeof o}`});return}i.push(o)}return i}getRecord(t){if(typeof t!="object"||Array.isArray(t)){this.errors.add({severity:w.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(t)?"array":typeof t}`});return}return t==null?{}:t}resolveNamedType({typeId:t}){let e=this._ir.types[t];if(e==null){this.errors.add({severity:w.Critical,message:`Type identified by "${t}" could not be found`});return}return e}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e}){let r=this.getRecord(e);if(r==null)return;let i=t.discriminant.wireValue,o=r[i];if(o==null){this.errors.add({severity:w.Critical,message:this.newParameterNotRecognizedError(i).message});return}if(typeof o!="string"){this.errors.add({severity:w.Critical,message:`Expected discriminant value to be a string but got: ${typeof o}`});return}let a=t.types[o];if(a==null){this.errors.add({severity:w.Critical,message:`No type found for discriminant value "${o}"`});return}let h=r,{[i]:l}=h,m=rt(h,[tt(i)]);return{singleDiscriminatedUnionType:a,discriminantValue:a.discriminantValue,value:m}}resolveEndpointOrThrow(t){let e=this.httpEndpointReferenceParser.tryParse(t);if(e==null)throw new Error(`Failed to parse endpoint reference "${t}"`);return this.resolveEndpointLocationOrThrow(e)}resolveEndpointLocationOrThrow(t){let e=[];for(let r of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:r,parsedEndpoint:t})&&e.push(r);if(e.length===0)throw new Error(`Failed to find endpoint identified by "${t.method} ${t.path}"`);return e}needsRequestParameter({request:t,inlinePathParameters:e,inlineFileProperties:r}){var i;return this.includePathParametersInWrappedRequest({request:t,inlinePathParameters:e})||t.queryParameters!=null&&t.queryParameters.length>0||t.headers!=null&&t.headers.length>0?!0:t.body!=null?this.includeRequestBodyInWrappedRequest({body:t.body,inlineFileProperties:r}):!((i=t.metadata)!=null&&i.onlyPathParameters)}includePathParametersInWrappedRequest({request:t,inlinePathParameters:e}){var r,i;return e&&((i=(r=t.metadata)==null?void 0:r.includePathParameters)!=null?i:!1)}isFileUploadRequestBody(t){switch(t.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:v(t)}}resolveEnvironmentName(t){if(this._ir.environments==null)return;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":{let r=e.environments.find(i=>i.id===t);return r==null?void 0:r.name}case"multipleBaseUrls":{let r=e.environments.find(i=>i.id===t);return r==null?void 0:r.name}default:v(e)}}isSingleEnvironmentID(t){return typeof t=="string"}isMultiEnvironmentValues(t){return typeof t=="object"}validateMultiEnvironmentUrlValues(t){if(this._ir.environments==null)return this.errors.add({severity:w.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":return this.errors.add({severity:w.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let r=e.environments[0];if(r==null)return this.errors.add({severity:w.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let i=new Set(ye(r.urls));for(let o of ye(t))i.has(o)&&i.delete(o);return i.size>0?(this.errors.add({severity:w.Critical,message:`The provided environments are invalid; got: [${Object.keys(t).join(", ")}], expected: [${ye(r.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:t}){if(typeof t!="number"){this.errors.add({severity:w.Critical,message:this.newTypeMismatchError({expected:"number",value:t}).message});return}return t}getValueAsBoolean({value:t}){if(typeof t!="boolean"){this.errors.add({severity:w.Critical,message:this.newTypeMismatchError({expected:"boolean",value:t}).message});return}return t}getValueAsString({value:t}){if(typeof t!="string"){this.errors.add({severity:w.Critical,message:this.newTypeMismatchError({expected:"string",value:t}).message});return}return t}isOptional(t){switch(t.type){case"nullable":return this.isOptional(t.value);case"optional":return!0;case"named":{let e=this.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}isNullable(t){switch(t.type){case"nullable":return!0;case"optional":return this.isNullable(t.value);case"named":{let e=this.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}newAuthMismatchError({auth:t,values:e}){return new Error(`Expected auth type ${t.type}, got ${e.type}`)}newParameterNotRecognizedError(t){return new Error(`"${t}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:t,value:e}){return new Error(`Expected ${t}, got ${typeof e}`)}includeRequestBodyInWrappedRequest({body:t,inlineFileProperties:e}){switch(t.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:t,inlineFileProperties:e});default:v(t)}}includeFileUploadBodyInWrappedRequest({fileUpload:t,inlineFileProperties:e}){return this.fileUploadHasBodyProperties({fileUpload:t})||e&&this.fileUploadHasFileProperties({fileUpload:t})}fileUploadHasBodyProperties({fileUpload:t}){return t.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:v(e)}})}fileUploadHasFileProperties({fileUpload:t}){return t.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:v(e)}})}isListTypeReference(t){return t.type==="optional"?this.isListTypeReference(t.value):t.type==="list"||t.type==="set"}parsedEndpointMatches({endpoint:t,parsedEndpoint:e}){return t.location.method===e.method&&t.location.path===e.path}};u();p();var k={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};u();p();u();p();u();p();var be="",Cr="self",Ir="static";var d={};nt(d,{Access:()=>H,Array:()=>te,AstNode:()=>x,Attribute:()=>re,Class:()=>V,ClassInstantiation:()=>M,ClassReference:()=>A,CodeBlock:()=>E,DataClass:()=>ie,Enum:()=>oe,Field:()=>ae,Map:()=>se,Method:()=>W,MethodInvocation:()=>j,Parameter:()=>q,Trait:()=>ne,Type:()=>S,TypeLiteral:()=>K,Writer:()=>U,array:()=>Vo,assignVariable:()=>ta,attribute:()=>qo,classReference:()=>zo,class_:()=>Wo,codeblock:()=>ue,dataClass:()=>Yo,enum_:()=>Go,field:()=>Ho,instantiateClass:()=>kr,invokeMethod:()=>Zo,map:()=>Ko,mergeArrays:()=>ia,method:()=>Qo,parameter:()=>Xo,string:()=>na,ternary:()=>ea,this_:()=>oa,throwException:()=>Jo,trait:()=>jo,variable:()=>ra});u();p();u();p();u();p();var H={Public:"public",PublicReadonly:"public readonly",Protected:"protected",Private:"private"};u();p();u();p();u();p();function Lr(n){return{namespace:n.substring(0,n.lastIndexOf("\\")),name:n.substring(n.lastIndexOf("\\")+1)}}var U=class extends ge{constructor({namespace:e,rootNamespace:r,customConfig:i}){super();f(this,"namespace");f(this,"rootNamespace");f(this,"customConfig");f(this,"references",{});this.namespace=e,this.rootNamespace=r,this.customConfig=i}addReference(e){var a,l;if(e.namespace==null)return;if(Object.keys(this.references).filter(m=>{let h=Lr(m);return h.namespace!==e.namespace&&h.name===e.name}).length>0){e.requireFullyQualified();return}let i=e.namespace===be?e.name:`${e.namespace}\\${e.name}`;((l=(a=this.references)[i])!=null?l:a[i]=[]).push(e)}toString(){let e=`namespace ${this.namespace};`,r=this.stringifyImports();return r.length>0?`${e}
|
|
4
|
+
${i}`);this.isAtStartOfLine()&&(s=i+s),e&&(s+=`
|
|
5
|
+
`),this.writeInternal(s)}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 M(t).write(this),this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(t,e){new M(t).write(this),this.write(" ("),this.writeNode(e),this.write(") {"),this.writeNewLineIfLastLineNot(),this.indent()}controlFlowWithoutStatement(t){new M(t).write(this),this.write(" {"),this.writeNewLineIfLastLineNot(),this.indent()}endControlFlow(){this.dedent(),this.writeLine("}")}contiguousControlFlow(t,e){this.dedent(),this.write("} "),new M(t).write(this),this.write(" ("),this.writeNode(e),this.write(") {"),this.writeNewLineIfLastLineNot(),this.indent()}alternativeControlFlow(t){this.dedent(),this.write("} "),new M(t).write(this),this.write(" {"),this.writeNewLineIfLastLineNot(),this.indent()}writeLine(t=""){this.write(t),this.writeNewLineIfLastLineNot()}newLine(){this.writeInternal(`
|
|
6
|
+
`)}writeSemicolonIfLastCharacterIsNot(){this.lastCharacterIsSemicolon||this.writeInternal(";")}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
|
|
7
|
+
`)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:t,delimiter:e,writeFunction:n}){if(t.length>0){let i=t[0];i!=null&&n(i);for(let s=1;s<t.length;s++){this.write(e);let f=t[s];f!=null&&n(f)}}}toString(){return this.buffer}writeInternal(t){return t.length>0&&(this.hasWrittenAnything=!0,this.lastCharacterIsNewline=t.endsWith(`
|
|
8
|
+
`),this.lastCharacterIsSemicolon=t.endsWith(";")),this.buffer+=t}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*this.getTabSize())}getTabSize(){return ll}};o();a();function Zt(r){return(r==null?void 0:r.name)!=null}o();a();var Ve=class extends J{constructor({condition:e,true_:n,false_:i}){super();l(this,"condition");l(this,"true_");l(this,"false_");this.condition=e,this.true_=n,this.false_=i}write(e){e.writeNode(this.condition),e.write(" ? "),e.writeNode(this.true_),e.write(" : "),e.writeNode(this.false_)}};o();a();o();a();o();a();var Ge=class{constructor(){l(this,"reporter");l(this,"snippet");l(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:t,snippet:e}){this.shouldUpdate({snippet:e,reporter:t.errors})&&(this.reporter=t.errors.clone(),this.snippet=e)}getResponseOrThrow({endpoint:t}){var e;if(this.snippet!=null&&this.reporter!=null)return{snippet:this.snippet,errors:this.reporter.toDynamicSnippetErrors()};throw(e=this.err)!=null?e:new Error(`Failed to generate snippet for endpoint "${t.method} ${t.path}"`)}shouldUpdate({snippet:t,reporter:e}){var n,i;return this.reporter==null||this.reporter.size()>0&&e.size()===0?!0:t.length>((i=(n=this.snippet)==null?void 0:n.length)!=null?i:0)}};var ze=class{constructor(t){l(this,"context");this.context=t}async generate(t,e={}){let n=this.context.resolveEndpointLocationOrThrow(t.endpoint);if(n.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let i=new Ge;for(let s of n){let f=this.context.clone(),c=this.createSnippetGenerator(f);try{let m=await c.generateSnippet({endpoint:s,request:t,options:e});if(f.errors.empty())return{snippet:m,errors:void 0};i.update({context:f,snippet:m})}catch(m){i.err==null&&(i.err=m)}}return i.getResponseOrThrow({endpoint:t.endpoint})}generateSync(t,e={}){let n=this.context.resolveEndpointLocationOrThrow(t.endpoint);if(n.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let i=new Ge;for(let s of n){let f=this.context.clone(),c=this.createSnippetGenerator(f);try{let m=c.generateSnippetSync({endpoint:s,request:t,options:e});if(f.errors.empty())return{snippet:m,errors:void 0};i.update({context:f,snippet:m})}catch(m){i.err==null&&(i.err=m)}}return i.getResponseOrThrow({endpoint:t.endpoint})}};o();a();o();a();o();a();var He=class{constructor(){l(this,"REFERENCE_REGEX",/^(GET|POST|PUT|DELETE|PATCH|HEAD)\s(\/\S*)$/)}validate(t){return this.REFERENCE_REGEX.test(t)?{type:"valid"}:{type:"invalid"}}tryParse(t){if(this.validate(t).type==="invalid")return;let n=t.match(this.REFERENCE_REGEX);if(!(n==null||n[1]==null||n[2]==null))return{method:n[1],path:n[2]}}};o();a();var v={Critical:"CRITICAL",Warning:"WARNING"},Ye=class r{constructor(){l(this,"errors");l(this,"path");this.errors=[],this.path=[]}add(t){this.errors.push(Ne(Ie({},t),{path:[...this.path]}))}scope(t){this.path.push(t)}unscope(){this.path.pop()}getBySeverity(t){return this.errors.filter(e=>e.severity===t)}empty(){return this.errors.length===0}size(){return this.errors.length}clone(){let t=new r;return t.errors=[...this.errors],t.path=[...this.path],t}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(t=>({severity:t.severity,path:t.path!=null?this.pathToStringArray(t.path):void 0,message:t.message}))}pathToStringArray(t){let e=[];for(let n of t){if(typeof n=="string"){e.push(n);continue}e[e.length-1]+=`[${n.index}]`}return e}};var Ke=class{constructor({ir:t,config:e,options:n={}}){l(this,"config");l(this,"options");l(this,"errors");l(this,"_ir");l(this,"httpEndpointReferenceParser");this._ir=t,this.config=e,this.options=n,this.errors=new Ye,this.httpEndpointReferenceParser=new He}associateQueryParametersByWireValue({parameters:t,values:e}){let n=[];for(let[i,s]of Object.entries(e)){this.errors.scope(i);try{let f=t.find(m=>m.name.wireValue===i);if(f==null)throw this.newParameterNotRecognizedError(i);let c=this.isListTypeReference(f.typeReference)&&!Array.isArray(s)?[s]:s;n.push({name:f.name,typeReference:f.typeReference,value:c})}finally{this.errors.unscope()}}return n}associateByWireValue({parameters:t,values:e,ignoreMissingParameters:n}){let i=[];for(let[s,f]of Object.entries(e)){this.errors.scope(s);try{let c=t.find(m=>m.name.wireValue===s);if(c==null){if(n)continue;this.errors.add({severity:v.Critical,message:this.newParameterNotRecognizedError(s).message});continue}i.push({name:c.name,typeReference:c.typeReference,value:f})}finally{this.errors.unscope()}}return i}getSingleFileValue({property:t,record:e}){let n=e[t.wireValue];if(n!=null){if(typeof n!="string"){this.errors.add({severity:v.Critical,message:`Expected file value to be a string, got ${typeof n}`});return}return n}}getFileArrayValues({property:t,record:e}){let n=e[t.wireValue];if(n==null)return;if(!Array.isArray(n)){this.errors.add({severity:v.Critical,message:`Expected file array value to be an array of strings, got ${typeof n}`});return}let i=[];for(let s of n){if(typeof s!="string"){this.errors.add({severity:v.Critical,message:`Expected file array value to be an array of strings, got ${typeof s}`});return}i.push(s)}return i}getRecord(t){if(typeof t!="object"||Array.isArray(t)){this.errors.add({severity:v.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(t)?"array":typeof t}`});return}return t==null?{}:t}resolveNamedType({typeId:t}){let e=this._ir.types[t];if(e==null){this.errors.add({severity:v.Critical,message:`Type identified by "${t}" could not be found`});return}return e}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e}){let n=this.getRecord(e);if(n==null)return;let i=t.discriminant.wireValue,s=n[i];if(s==null){this.errors.add({severity:v.Critical,message:this.newParameterNotRecognizedError(i).message});return}if(typeof s!="string"){this.errors.add({severity:v.Critical,message:`Expected discriminant value to be a string but got: ${typeof s}`});return}let f=t.types[s];if(f==null){this.errors.add({severity:v.Critical,message:`No type found for discriminant value "${s}"`});return}let d=n,{[i]:c}=d,m=rr(d,[tr(i)]);return{singleDiscriminatedUnionType:f,discriminantValue:f.discriminantValue,value:m}}resolveEndpointOrThrow(t){let e=this.httpEndpointReferenceParser.tryParse(t);if(e==null)throw new Error(`Failed to parse endpoint reference "${t}"`);return this.resolveEndpointLocationOrThrow(e)}resolveEndpointLocationOrThrow(t){let e=[];for(let n of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:n,parsedEndpoint:t})&&e.push(n);if(e.length===0)throw new Error(`Failed to find endpoint identified by "${t.method} ${t.path}"`);return e}needsRequestParameter({request:t,inlinePathParameters:e,inlineFileProperties:n}){var i;return this.includePathParametersInWrappedRequest({request:t,inlinePathParameters:e})||t.queryParameters!=null&&t.queryParameters.length>0||t.headers!=null&&t.headers.length>0?!0:t.body!=null?this.includeRequestBodyInWrappedRequest({body:t.body,inlineFileProperties:n}):!((i=t.metadata)!=null&&i.onlyPathParameters)}includePathParametersInWrappedRequest({request:t,inlinePathParameters:e}){var n,i;return e&&((i=(n=t.metadata)==null?void 0:n.includePathParameters)!=null?i:!1)}isFileUploadRequestBody(t){switch(t.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:T(t)}}resolveEnvironmentName(t){if(this._ir.environments==null)return;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":{let n=e.environments.find(i=>i.id===t);return n==null?void 0:n.name}case"multipleBaseUrls":{let n=e.environments.find(i=>i.id===t);return n==null?void 0:n.name}default:T(e)}}isSingleEnvironmentID(t){return typeof t=="string"}isMultiEnvironmentValues(t){return typeof t=="object"}validateMultiEnvironmentUrlValues(t){if(this._ir.environments==null)return this.errors.add({severity:v.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":return this.errors.add({severity:v.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let n=e.environments[0];if(n==null)return this.errors.add({severity:v.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let i=new Set($e(n.urls));for(let s of $e(t))i.has(s)&&i.delete(s);return i.size>0?(this.errors.add({severity:v.Critical,message:`The provided environments are invalid; got: [${Object.keys(t).join(", ")}], expected: [${$e(n.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:t}){if(typeof t!="number"){this.errors.add({severity:v.Critical,message:this.newTypeMismatchError({expected:"number",value:t}).message});return}return t}getValueAsBoolean({value:t}){if(typeof t!="boolean"){this.errors.add({severity:v.Critical,message:this.newTypeMismatchError({expected:"boolean",value:t}).message});return}return t}getValueAsString({value:t}){if(typeof t!="string"){this.errors.add({severity:v.Critical,message:this.newTypeMismatchError({expected:"string",value:t}).message});return}return t}isOptional(t){switch(t.type){case"nullable":return this.isOptional(t.value);case"optional":return!0;case"named":{let e=this.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}isNullable(t){switch(t.type){case"nullable":return!0;case"optional":return this.isNullable(t.value);case"named":{let e=this.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}newAuthMismatchError({auth:t,values:e}){return new Error(`Expected auth type ${t.type}, got ${e.type}`)}newParameterNotRecognizedError(t){return new Error(`"${t}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:t,value:e}){return new Error(`Expected ${t}, got ${typeof e}`)}includeRequestBodyInWrappedRequest({body:t,inlineFileProperties:e}){switch(t.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:t,inlineFileProperties:e});default:T(t)}}includeFileUploadBodyInWrappedRequest({fileUpload:t,inlineFileProperties:e}){return this.fileUploadHasBodyProperties({fileUpload:t})||e&&this.fileUploadHasFileProperties({fileUpload:t})}fileUploadHasBodyProperties({fileUpload:t}){return t.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:T(e)}})}fileUploadHasFileProperties({fileUpload:t}){return t.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:T(e)}})}isListTypeReference(t){return t.type==="optional"?this.isListTypeReference(t.value):t.type==="list"||t.type==="set"}parsedEndpointMatches({endpoint:t,parsedEndpoint:e}){return t.location.method===e.method&&t.location.path===e.path}};o();a();var $={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};o();a();o();a();o();a();var zi="self",Hi="static";var h={};nr(h,{Access:()=>ue,Array:()=>we,AstNode:()=>g,Attribute:()=>ve,Class:()=>Z,ClassInstantiation:()=>V,ClassReference:()=>I,CodeBlock:()=>N,DataClass:()=>Te,Enum:()=>Ae,Field:()=>be,Map:()=>Ee,Method:()=>ee,MethodInvocation:()=>X,Parameter:()=>Q,Trait:()=>Re,Type:()=>D,TypeLiteral:()=>k,Writer:()=>W,array:()=>wl,assignVariable:()=>Fl,attribute:()=>vl,classReference:()=>bl,class_:()=>Tl,codeblock:()=>Ce,dataClass:()=>El,enum_:()=>Rl,field:()=>Cl,instantiateClass:()=>eo,invokeMethod:()=>Il,map:()=>Sl,mergeArrays:()=>Ol,method:()=>Ll,parameter:()=>Pl,string:()=>Ul,ternary:()=>_l,this_:()=>Ml,throwException:()=>Nl,trait:()=>Al,variable:()=>Bl});o();a();o();a();o();a();var ue={Public:"public",PublicReadonly:"public readonly",Protected:"protected",Private:"private"};o();a();o();a();o();a();function Yi(r){return{namespace:r.substring(0,r.lastIndexOf("\\")),name:r.substring(r.lastIndexOf("\\")+1)}}var W=class extends We{constructor({namespace:e,rootNamespace:n,customConfig:i}){super();l(this,"namespace");l(this,"rootNamespace");l(this,"customConfig");l(this,"references",{});this.namespace=e,this.rootNamespace=n,this.customConfig=i}addReference(e){var f,c;if(e.namespace==null)return;if(Object.keys(this.references).filter(m=>{let d=Yi(m);return d.namespace!==e.namespace&&d.name===e.name}).length>0){e.requireFullyQualified();return}let i=e.namespace===""?e.name:`${e.namespace}\\${e.name}`;((c=(f=this.references)[i])!=null?c:f[i]=[]).push(e)}toString(e=!1){if(e)return this.buffer;let n=`namespace ${this.namespace};`,i=this.stringifyImports();return i.length>0?`${n}
|
|
9
9
|
|
|
10
|
-
${
|
|
10
|
+
${i}
|
|
11
11
|
|
|
12
|
-
${this.buffer}`:
|
|
12
|
+
${this.buffer}`:n+`
|
|
13
13
|
|
|
14
|
-
`+this.buffer}stringifyImports(){let e=Object.keys(this.references);return e.length===0?"":e.filter(
|
|
15
|
-
`)}};var
|
|
16
|
-
`).forEach(
|
|
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();p();function J(n){return ko(n,[H.Public,H.PublicReadonly,H.Protected,H.Private])}function ko(n,t){return t.reduce((e,r)=>[...e,...n.filter(i=>i.access===r)],[])}var V=class extends x{constructor({name:e,namespace:r,abstract:i,docs:o,parentClassReference:a,traits:l}){super();f(this,"name");f(this,"namespace");f(this,"abstract");f(this,"docs");f(this,"parentClassReference");f(this,"traits");f(this,"fields",[]);f(this,"methods",[]);f(this,"constructor_");this.name=e,this.namespace=r,this.abstract=i!=null?i:!1,this.docs=o,this.parentClassReference=a,this.traits=l!=null?l:[]}addConstructor(e){this.constructor_=e}addField(e){this.fields.push(e)}addMethod(e){this.methods.push(e)}addMethods(e){this.methods.push(...e)}addTrait(e){this.traits.push(e)}write(e){e.addReference(new A({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 C({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,a)=>{a===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 C;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();p();var ne=class extends x{constructor({name:e,namespace:r,docs:i,traits:o}){super();f(this,"name");f(this,"namespace");f(this,"docs");f(this,"traits");f(this,"fields",[]);f(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 C({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();p();u();p();function he({writer:n,arguments_:t,multiline:e}){if(t.length===0){n.write("()");return}if(e){Uo({writer:n,arguments_:t});return}Mo({writer:n,arguments_:t})}function Uo({writer:n,arguments_:t}){n.writeLine("("),n.indent();for(let e of t)Sr({writer:n,argument:e,writeCompact:!1}),n.writeLine(",");n.dedent(),n.write(")")}function Mo({writer:n,arguments_:t}){n.write("("),t.forEach((e,r)=>{r>0&&n.write(", "),Sr({writer:n,argument:e,writeCompact:!0})}),n.write(")")}function Sr({writer:n,argument:t,writeCompact:e}){Qe(t)?(t.docs&&(e?n.write(`/* ${t.docs} */ `):n.writeLine(`/* ${t.docs} */`)),n.write(`${t.name}: `),n.writeNodeOrString(t.assignment)):t.write(n)}var M=class extends x{constructor({classReference:e,arguments_:r,multiline:i}){super();f(this,"classReference");f(this,"arguments_");f(this,"multiline");this.classReference=e,this.arguments_=r,this.multiline=i!=null?i:!1}write(e){e.write("new "),e.writeNode(this.classReference),he({writer:e,arguments_:this.arguments_,multiline:this.multiline})}};u();p();var E=class extends x{constructor(e){super();f(this,"arg");this.arg=e}write(e){return new B(this.arg).write(e)}};u();p();u();p();var q=class extends x{constructor({name:e,type:r,docs:i,initializer:o,access:a,readonly_:l}){super();f(this,"name");f(this,"type");f(this,"docs");f(this,"initializer");f(this,"access");f(this,"readonly_");this.name=Z(e),this.type=r,this.docs=i,this.initializer=o,this.access=a,this.readonly_=l!=null?l:!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();p();var S=class n extends x{constructor(e){super();f(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(Pr),e.write("DateTime");break;case"dateTime":e.addReference(Pr),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{");let i=this.internalType.entries.filter(l=>!l.valueType.isOptional()),o=this.internalType.entries.filter(l=>l.valueType.isOptional()),a=[...i,...o];for(let l of a)e.write(" * "),this.writeTypeDictEntry({writer:e,entry:l,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":{let i=this.getUniqueTypes({types:this.internalType.types,comment:r,writer:e}),o=i.filter(a=>a.underlyingType().internalType.type==="mixed").length>0;if(o&&!r){e.write("mixed");break}i.length>0&&r?(e.writeLine("("),i.forEach((a,l)=>{l>0?e.write(" * |"):e.write(" * "),o&&(a=a.underlyingType()),a.write(e,{comment:r}),e.writeLine(),l++}),e.write(" * )")):i.forEach((a,l)=>{l>0&&e.write("|"),o&&(a=a.underlyingType()),a.write(e,{comment:r}),l++});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":if(r){e.writeNode(this.internalType.value);let i=this.internalType.value.generics;i&&i.length>0&&(e.write("<"),i.forEach((o,a)=>{a>0&&e.write(", "),o.write(e,{comment:r})}),e.write(">"))}else 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:v(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"}getClassReference(){switch(this.internalType.type){case"date":case"dateTime":return new A({name:"DateTime",namespace:be});case"enumString":case"reference":return this.internalType.value;case"int":case"string":case"bool":case"float":case"object":case"map":case"array":case"null":case"mixed":case"optional":case"typeDict":case"union":throw new Error("Cannot get class reference for "+this.internalType.type);default:v(this.internalType)}}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(a=>{let l=a.toString({namespace:e.namespace,rootNamespace:e.rootNamespace,customConfig:e.customConfig,comment:i});return o.has(l)?!1:(o.add(l),!0)})}toString({namespace:e,rootNamespace:r,customConfig:i,comment:o}){let a=new U({namespace:e,rootNamespace:r,customConfig:i});return this.write(a,{comment:o!=null?o:!1}),a.toString()}},Pr=new A({namespace:be,name:"DateTime"});u();p();function Fr(n){return n.startsWith("$")?n.slice(1):n}var Br="values",ie=class extends x{constructor({name:e,namespace:r,abstract:i,docs:o,parentClassReference:a,traits:l}){super();f(this,"name");f(this,"namespace");f(this,"class_");this.name=e,this.namespace=r,this.class_=new V({name:e,namespace:r,abstract:i,docs:o,parentClassReference:a,traits:l})}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(pe({},i),{name:Fr(i.name)}));r.length>0&&this.class_.addConstructor({access:"public",parameters:this.getConstructorParameters({orderedFields:r}),body:d.codeblock(i=>{for(let o of r)i.write(`$this->${o.name} = $${Br}['${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 q({name:Br,type:S.typeDict(e.map(r=>({key:r.name,valueType:r.type,optional:r.type.isOptional()})),{multiline:!0}),initializer:this.allFieldsAreOptional()?new E("[]"):void 0})]}};u();p();u();p();var W=class extends x{constructor({name:e,access:r,parameters:i,throws:o,return_:a,body:l,docs:m,classReference:h,static_:y}){super();f(this,"name");f(this,"access");f(this,"parameters");f(this,"throws");f(this,"return_");f(this,"body");f(this,"docs");f(this,"classReference");f(this,"static_");this.name=e,this.access=r,this.parameters=i,this.throws=o!=null?o:[],this.return_=a,this.body=l,this.docs=m,this.classReference=h,this.static_=y!=null?y:!1}write(e){var a;this.writeComment(e),e.write(`${this.access}${this.static_?" static":""} function ${this.name}(`);let r=this.parameters.filter(l=>!l.type.isOptional()),i=this.parameters.filter(l=>l.type.isOptional());[...r,...i].forEach((l,m)=>{m>0&&e.write(", "),l.write(e)}),e.write("): "),this.return_!=null?e.writeNodeOrString(this.return_):e.write("void"),e.writeLine(" {"),e.indent(),(a=this.body)==null||a.write(e),e.dedent(),e.writeLine("}")}writeComment(e){let r=new C({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_!==Cr&&this.return_!==Ir&&r.addTag({tagType:"return",type:this.return_});for(let i of this.throws)r.addTag({tagType:"throws",type:S.reference(i)});e.writeNode(r)}};var oe=class extends x{constructor({name:e,namespace:r,backing:i,docs:o,serializable:a}){super();f(this,"name");f(this,"namespace");f(this,"backing");f(this,"docs");f(this,"members",[]);f(this,"serializable");this.name=e,this.namespace=r,this.backing=i,this.docs=o,this.serializable=a!=null?a:!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 A({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 W({name:"jsonSerialize",return_:S.string(),access:"public",parameters:[],body:new E("return $this->value;")}))),e.writeNewLineIfLastLineNot(),e.dedent(),e.writeLine("}")}writeComment(e){if(this.docs==null)return;new C({docs:this.docs}).write(e)}};u();p();var ae=class extends x{constructor({name:e,type:r,access:i,readonly_:o,initializer:a,docs:l,inlineDocs:m,attributes:h,inherited:y}){super();f(this,"name");f(this,"type");f(this,"access");f(this,"readonly_");f(this,"initializer");f(this,"docs");f(this,"inlineDocs");f(this,"attributes");f(this,"inherited");this.name=Z(e),this.type=r,this.access=i,this.readonly_=o!=null?o:!1,this.initializer=a,this.docs=l,this.inlineDocs=m,this.attributes=h!=null?h:[],this.inherited=y!=null?y:!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 C;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();p();var se=class extends x{constructor({entries:e,multiline:r}){super();f(this,"entries");f(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();p();var j=class extends x{constructor({method:e,arguments_:r,static_:i,multiline:o,on:a}){super();f(this,"method");f(this,"arguments_");f(this,"multiline");f(this,"static_");f(this,"on");this.method=e,this.arguments_=r,this.static_=i!=null?i:!1,this.multiline=o!=null?o:!1,this.on=a}write(e){this.on!=null&&(this.on.write(e),e.write(this.getMethodAccessor())),e.write(this.method),he({writer:e,arguments_:this.arguments_,multiline:this.multiline})}getMethodAccessor(){return this.static_?"::":"->"}};u();p();u();p();var K=class n extends x{constructor(e){super();f(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(Do({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(_o({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:v(this.internalType)}}isClass(){return this.internalType.type==="class"}asClassOrThrow(){if(this.isClass())return this.internalType;throw new Error("Internal error; ts.TypeLiteral is not a class")}writeStringWithHeredoc({writer:e,value:r}){e.writeLine("<<<EOT"),e.writeNoIndent(r),e.newLine(),e.writeNoIndent("EOT")}writeClass({writer:e,class_:r}){e.writeNode(new M({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=$o({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=Oo({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,a]of i)e.write(`'${o}' => `),e.writeNode(n.unknown(a)),e.writeLine(",");e.dedent(),e.write("]")}};function _o({writer:n,value:t}){return new M({classReference:new A({name:"DateTime",namespace:""}),arguments_:[new E(`'${t}'`)]})}function Do({writer:n,value:t}){return new j({on:new A({name:"File",namespace:`${n.rootNamespace}\\Utils`}),method:"createFromString",arguments_:[new E(`"${t}"`)]})}function Oo({entries:n}){return n.filter(t=>!K.isNop(t.key)&&!K.isNop(t.value))}function $o({values:n}){return n.filter(t=>!K.isNop(t))}u();p();var _e=class extends x{constructor(e){super();f(this,"arrays");this.arrays=e}write(e){e.write("array_merge"),he({writer:e,arguments_:this.arrays.map(r=>ue(i=>{if(typeof r=="string"||r instanceof x){i.writeNodeOrString(r);return}i.writeNodeOrString(r.ref),r.fallback&&(i.write(" ?? "),i.writeNodeOrString(r.fallback))}))})}};function Vo(n){return new te(n)}function qo(n){return new re(n)}function Wo(n){return new V(n)}function jo(n){return new ne(n)}function zo(n){return new A(n)}function ue(n){return new E(n)}function Yo(n){return new ie(n)}function Go(n){return new oe(n)}function Ho(n){return new ae(n)}function kr(n){return new M(n)}function Zo(n){return new j(n)}function Jo(n){return ue(t=>{t.write("throw "),t.writeNode(kr(n))})}function Ko(n){return new se(n)}function Qo(n){return new W(n)}function Xo(n){return new q(n)}function ea(n){return new we(n)}function ta(n,t){return ue(e=>{e.writeNodeOrString(n),e.write(" = "),e.writeNodeOrString(t)})}function ra(n){return ue(Z(n))}function na(n){return ue(`"${n}"`)}function ia(...n){return new _e(n)}function oa(){return new E(n=>{n.write("$this")})}var Ur="$client",De="Example",Mr=`<?php
|
|
14
|
+
`+this.buffer}stringifyImports(){let e=Object.keys(this.references);return e.length===0?"":e.filter(n=>Yi(n).namespace!==this.namespace).map(n=>`use ${n};`).join(`
|
|
15
|
+
`)}};var g=class extends J{toString(t){if(t==null)throw new Error("Internal error; AstNode.toString method called incorrectly.");let{namespace:e,rootNamespace:n,customConfig:i,skipImports:s=!1}=t,f=new W({namespace:e,rootNamespace:n,customConfig:i});return this.write(f),f.toString(s)}async toStringAsync({namespace:t,rootNamespace:e,customConfig:n}){let i=new W({namespace:t,rootNamespace:e,customConfig:n});return this.write(i),i.toString()}};var we=class extends g{constructor({entries:e}){super();l(this,"entries");this.entries=e!=null?e:[]}write(e){e.write("["),this.entries.forEach((n,i)=>{i>0&&e.write(", "),n.write(e)}),e.write("]")}};o();a();var ve=class extends g{constructor(e){var n;super();l(this,"reference");l(this,"arguments");this.reference=e.reference,this.arguments=(n=e.arguments)!=null?n:[]}write(e){e.addReference(this.reference),e.write(`${this.reference.name}`),this.arguments.length>0&&(e.write("("),this.arguments.forEach((n,i)=>{i>0&&e.write(","),typeof n=="string"?e.write(n):n.write(e)}),e.write(")"))}};o();a();o();a();var I=class extends g{constructor({name:e,namespace:n,generics:i}){super();l(this,"name");l(this,"namespace");l(this,"generics");l(this,"fullyQualified");this.name=e,this.namespace=n,this.generics=i,this.fullyQualified=!1}requireFullyQualified(){this.fullyQualified=!0}write(e){e.addReference(this);let n=this.fullyQualified?`\\${this.namespace}\\${this.name}`:this.name;e.write(`${n}`)}};o();a();o();a();function le(r){return r.startsWith("$")?r:`$${r}`}var P=class extends g{constructor({docs:e}={}){super();l(this,"docs");l(this,"tags",[]);this.docs=e}addTag(e){this.tags.push(Ne(Ie({},e),{name:e.name!=null?le(e.name):void 0}))}write(e){e.writeLine("/**"),this.docs!=null&&(this.docs.split(`
|
|
16
|
+
`).forEach(n=>{e.writeLine(` * ${n}`)}),this.tags.length>0&&e.writeLine(" *"));for(let n of this.tags)this.writeTag({writer:e,tag:n});e.writeLine(" */")}writeTag({writer:e,tag:n}){let i=n.docs!=null?n.docs.split(`
|
|
17
|
+
`):void 0;i!=null&&i.length>1&&(i.forEach(s=>{e.writeLine(` * ${s}`)}),e.writeLine(" *")),e.write(` * @${n.tagType} `),n.type.write(e,{comment:!0}),n.name!=null&&e.write(` ${n.name}`),i!=null&&i.length===1&&e.write(` ${i[0]}`),e.newLine()}};o();a();function ce(r){return cl(r,[ue.Public,ue.PublicReadonly,ue.Protected,ue.Private])}function cl(r,t){return t.reduce((e,n)=>[...e,...r.filter(i=>i.access===n)],[])}var Z=class extends g{constructor({name:e,namespace:n,abstract:i,docs:s,parentClassReference:f,traits:c}){super();l(this,"name");l(this,"namespace");l(this,"abstract");l(this,"docs");l(this,"parentClassReference");l(this,"traits");l(this,"fields",[]);l(this,"methods",[]);l(this,"constructor_");this.name=e,this.namespace=n,this.abstract=i!=null?i:!1,this.docs=s,this.parentClassReference=f,this.traits=c!=null?c:[]}addConstructor(e){this.constructor_=e}addField(e){this.fields.push(e)}addMethod(e){this.methods.push(e)}addMethods(e){this.methods.push(...e)}addTrait(e){this.traits.push(e)}write(e){e.addReference(new I({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((n,i)=>{i>0&&e.write(","),e.writeNode(n)}),e.writeTextStatement(""),e.newLine()),this.writeFields({writer:e,fields:ce(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:ce(this.methods)}),e.dedent(),e.writeLine("}")}writeComment(e){if(this.docs==null)return;new P({docs:this.docs}).write(e)}writeConstructor({writer:e,constructor:n}){var i;this.writeConstructorComment({writer:e,constructor:n}),n.access!=null&&e.write(`${n.access} `),e.write("function __construct("),e.indent(),n.parameters.forEach((s,f)=>{f===0&&e.newLine(),s.write(e),e.writeLine(",")}),e.dedent(),e.writeLine(")"),e.writeLine("{"),e.indent(),(i=n.body)==null||i.write(e),e.writeNewLineIfLastLineNot(),e.dedent(),e.writeLine("}")}writeConstructorComment({writer:e,constructor:n}){if(n.parameters.length===0)return;let i=new P;for(let s of n.parameters)i.addTag(s.getCommentTag());i.write(e)}writeFields({writer:e,fields:n}){n.filter(i=>!i.inherited).forEach((i,s)=>{s>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}writeMethods({writer:e,methods:n}){n.forEach((i,s)=>{s>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}};o();a();o();a();function ke({writer:r,arguments_:t,multiline:e}){if(t.length===0){r.write("()");return}if(e){ml({writer:r,arguments_:t});return}dl({writer:r,arguments_:t})}function ml({writer:r,arguments_:t}){r.writeLine("("),r.indent();for(let e of t)Ji({writer:r,argument:e,writeCompact:!1}),r.writeLine(",");r.dedent(),r.write(")")}function dl({writer:r,arguments_:t}){r.write("("),t.forEach((e,n)=>{n>0&&r.write(", "),Ji({writer:r,argument:e,writeCompact:!0})}),r.write(")")}function Ji({writer:r,argument:t,writeCompact:e}){Zt(t)?(t.docs&&(e?r.write(`/* ${t.docs} */ `):r.writeLine(`/* ${t.docs} */`)),r.write(`${t.name}: `),r.writeNodeOrString(t.assignment)):t.write(r)}var V=class extends g{constructor({classReference:e,arguments_:n,multiline:i}){super();l(this,"classReference");l(this,"arguments_");l(this,"multiline");this.classReference=e,this.arguments_=n,this.multiline=i!=null?i:!1}write(e){e.write("new "),e.writeNode(this.classReference),ke({writer:e,arguments_:this.arguments_,multiline:this.multiline})}};o();a();var N=class extends g{constructor(e){super();l(this,"arg");this.arg=e}write(e){return new M(this.arg).write(e)}};o();a();o();a();var Q=class extends g{constructor({name:e,type:n,docs:i,initializer:s,access:f,readonly_:c}){super();l(this,"name");l(this,"type");l(this,"docs");l(this,"initializer");l(this,"access");l(this,"readonly_");this.name=le(e),this.type=n,this.docs=i,this.initializer=s,this.access=f,this.readonly_=c!=null?c:!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")}};o();a();o();a();o();a();o();a();var X=class extends g{constructor({method:e,arguments_:n,static_:i,multiline:s,on:f}){super();l(this,"method");l(this,"arguments_");l(this,"multiline");l(this,"static_");l(this,"on");this.method=e,this.arguments_=n,this.static_=i!=null?i:!1,this.multiline=s!=null?s:!1,this.on=f}write(e){this.on!=null&&(this.on.write(e),e.write(this.getMethodAccessor())),e.write(this.method),ke({writer:e,arguments_:this.arguments_,multiline:this.multiline})}getMethodAccessor(){return this.static_?"::":"->"}};var k=class r extends g{constructor(e){super();l(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(yl({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(hl({writer:e,value:this.internalType.value}));break}case"string":{if(this.internalType.value.includes(`
|
|
18
|
+
`)){this.writeStringWithHeredoc({writer:e,value:this.internalType.value});break}if(this.internalType.value.includes("'")){e.write(`"${this.internalType.value.replaceAll('"','\\"')}"`);break}e.write(`'${this.internalType.value}'`);break}case"unknown":{this.writeUnknown({writer:e,value:this.internalType.value});break}case"null":{e.write("null");break}case"nop":break;default:T(this.internalType)}}isClass(){return this.internalType.type==="class"}asClassOrThrow(){if(this.isClass())return this.internalType;throw new Error("Internal error; ts.TypeLiteral is not a class")}writeStringWithHeredoc({writer:e,value:n}){e.writeLine("<<<EOT"),e.writeNoIndent(n),e.newLine(),e.writeNoIndent("EOT")}writeClass({writer:e,class_:n}){e.writeNode(new V({classReference:n.reference,arguments_:[r.map({entries:n.fields.map(i=>({key:r.string(i.name),value:i.value}))})]}))}writeList({writer:e,list:n}){let i=gl({values:n.values});if(i.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let s of i)s.write(e),e.writeLine(",");e.dedent(),e.write("]")}writeMap({writer:e,map:n}){let i=xl({entries:n.entries});if(i.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let s of i)s.key.write(e),e.write(" => "),s.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:n}){return new this({type:"class",reference:e,fields:n})}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:n}){switch(typeof n){case"boolean":e.write(n.toString());return;case"string":e.write(n.includes('"')?`\`${n}\``:`"${n}"`);return;case"number":e.write(n.toString());return;case"object":if(n==null){e.write("null");return}if(Array.isArray(n)){this.writeUnknownArray({writer:e,value:n});return}this.writeUnknownMap({writer:e,value:n});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof n}`)}}writeUnknownArray({writer:e,value:n}){if(n.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let i of n)e.writeNode(r.unknown(i)),e.writeLine(",");e.dedent(),e.write("]")}writeUnknownMap({writer:e,value:n}){let i=Object.entries(n);if(i.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let[s,f]of i)e.write(`'${s}' => `),e.writeNode(r.unknown(f)),e.writeLine(",");e.dedent(),e.write("]")}};function hl({writer:r,value:t}){return new V({classReference:new I({name:"DateTime",namespace:""}),arguments_:[new N(`'${t}'`)]})}function yl({writer:r,value:t}){return new X({on:new I({name:"File",namespace:`${r.rootNamespace}\\Utils`}),method:"createFromString",arguments_:[new N(`"${t}"`)]})}function xl({entries:r}){return r.filter(t=>!k.isNop(t.key)&&!k.isNop(t.value))}function gl({values:r}){return r.filter(t=>!k.isNop(t))}var D=class r extends g{constructor(e){super();l(this,"internalType");this.internalType=e}write(e,{comment:n}={}){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(Zi),e.write("DateTime");break;case"dateTime":e.addReference(Zi),e.write("DateTime");break;case"mixed":e.write("mixed");break;case"object":e.write("object");break;case"array":if(!n){e.write("array");break}e.write("array<"),this.internalType.value.write(e,{comment:n}),e.write(">");break;case"map":{if(!n){e.write("array");break}e.write("array<"),this.internalType.keyType.write(e,{comment:n}),e.write(", "),this.internalType.valueType.write(e,{comment:n}),e.write(">");break}case"null":{e.write("null");break}case"typeDict":{if(!n){e.write("array");break}if(this.internalType.multiline){e.writeLine("array{");let i=this.internalType.entries.filter(c=>!c.valueType.isOptional()),s=this.internalType.entries.filter(c=>c.valueType.isOptional()),f=[...i,...s];for(let c of f)e.write(" * "),this.writeTypeDictEntry({writer:e,entry:c,comment:n}),e.writeLine(",");e.write(" * }");break}e.write("array{"),this.internalType.entries.forEach((i,s)=>{s>0&&e.write(", "),this.writeTypeDictEntry({writer:e,entry:i,comment:n})}),e.write("}");break}case"union":{this.writeUnion({writer:e,unionTypes:this.internalType.types,comment:n});break}case"optional":{let i=this.internalType.value.internalType,s=i.type==="mixed",f=i.type==="union";!f&&!s&&e.write("?"),this.internalType.value.write(e,{comment:n}),f&&!this.unionHasOptional(i.types)&&(e.write("|"),e.writeNode(r.null()));break}case"reference":if(n){e.writeNode(this.internalType.value);let i=this.internalType.value.generics;i&&i.length>0&&(e.write("<"),i.forEach((s,f)=>{f>0&&e.write(", "),s.write(e,{comment:n})}),e.write(">"))}else e.writeNode(this.internalType.value);break;case"enumString":n?(e.write("value-of<"),e.writeNode(this.internalType.value),e.write(">")):e.write("string");break;case"literal":if(n)e.writeNode(this.internalType.value);else switch(this.internalType.value.internalType.type){case"string":e.write("string");break;case"boolean":e.write("bool");break;default:T(this.internalType.value.internalType)}break;default:T(this.internalType)}}toOptionalIfNotAlready(){return this.internalType.type==="optional"?this:r.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"}getClassReference(){switch(this.internalType.type){case"date":case"dateTime":return new I({name:"DateTime",namespace:""});case"enumString":case"reference":return this.internalType.value;case"int":case"string":case"bool":case"float":case"object":case"map":case"array":case"null":case"mixed":case"optional":case"typeDict":case"union":case"literal":throw new Error("Cannot get class reference for "+this.internalType.type);default:T(this.internalType)}}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,n){return new this({type:"map",keyType:e,valueType:n})}static typeDict(e,{multiline:n}={}){return new this({type:"typeDict",entries:e,multiline:n})}static union(e){let n=this.flattenUnionTypes(e),i=It(n,Ct);return new this({type:"union",types:i})}static flattenUnionTypes(e){let n=[];for(let i of e)i.internalType.type==="union"?n.push(...this.flattenUnionTypes(i.internalType.types)):n.push(i);return n}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 literalString(e){return new this({type:"literal",value:k.string(e)})}static literalBoolean(e){return new this({type:"literal",value:k.boolean(e)})}static isAlreadyOptional(e){return e.internalType.type==="optional"}writeUnion({writer:e,unionTypes:n,comment:i}){let s=this.getUniqueTypes({types:n,comment:i,writer:e}),f=this.unwrapOptionalTypes(s),c=f.filter(m=>m.underlyingType().internalType.type==="mixed").length>0;if(c&&!i){e.write("mixed");return}if(f.length>0&&i){e.writeLine("("),f.forEach((m,d)=>{d>0?e.write(" * |"):e.write(" * "),c&&(m=m.underlyingType()),m.write(e,{comment:i}),e.writeLine(),d++}),e.write(" * )");return}f.forEach((m,d)=>{d>0&&e.write("|"),c&&(m=m.underlyingType()),m.write(e,{comment:i}),d++})}writeTypeDictEntry({writer:e,entry:n,comment:i}){e.write(n.key),n.optional&&e.write("?"),e.write(": "),n.valueType.write(e,{comment:i})}getUniqueTypes({writer:e,types:n,comment:i}){let s=It(n,Ct),f=new Set;return s.filter(c=>{let m=c.toString({namespace:e.namespace,rootNamespace:e.rootNamespace,customConfig:e.customConfig,comment:i});return f.has(m)?!1:(f.add(m),!0)})}unwrapOptionalTypes(e){let n=!1,i=e.map(s=>s.internalType.type==="optional"?(n=!0,s.internalType.value):s);return n&&i.push(r.null()),i}unionHasOptional(e){return e.filter(n=>n.internalType.type==="optional").length>0}toString({namespace:e,rootNamespace:n,customConfig:i,comment:s}){let f=new W({namespace:e,rootNamespace:n,customConfig:i});return this.write(f,{comment:s!=null?s:!1}),f.toString()}},Zi=new I({namespace:"",name:"DateTime"});o();a();function Qi(r){return r.startsWith("$")?r.slice(1):r}var Xi="values",Te=class extends g{constructor({name:e,namespace:n,abstract:i,docs:s,parentClassReference:f,traits:c,constructorAccess:m}){super();l(this,"name");l(this,"namespace");l(this,"constructorAccess");l(this,"class_");this.name=e,this.namespace=n,this.constructorAccess=m!=null?m:"public",this.class_=new Z({name:e,namespace:n,abstract:i,docs:s,parentClassReference:f,traits:c})}addField(e){this.class_.addField(e)}addMethod(e){this.class_.addMethod(e)}addTrait(e){this.class_.addTrait(e)}write(e){let n=ce(this.class_.fields).map(i=>Ne(Ie({},i),{name:Qi(i.name)}));n.length>0&&this.class_.addConstructor({access:this.constructorAccess,parameters:this.getConstructorParameters({orderedFields:n}),body:h.codeblock(i=>{for(let s of n)i.write(`$this->${s.name} = $${Xi}['${s.name}']`),s.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 Q({name:Xi,type:D.typeDict(e.map(n=>({key:n.name,valueType:n.type,optional:n.type.isOptional()})),{multiline:!0}),initializer:this.allFieldsAreOptional()?new N("[]"):void 0})]}};o();a();o();a();var ee=class extends g{constructor({name:e,access:n,parameters:i,throws:s,return_:f,body:c,docs:m,classReference:d,static_:y}){super();l(this,"name");l(this,"access");l(this,"parameters");l(this,"throws");l(this,"return_");l(this,"body");l(this,"docs");l(this,"classReference");l(this,"static_");this.name=e,this.access=n,this.parameters=i,this.throws=s!=null?s:[],this.return_=f,this.body=c,this.docs=m,this.classReference=d,this.static_=y!=null?y:!1}write(e){var f;this.writeComment(e),e.write(`${this.access}${this.static_?" static":""} function ${this.name}(`);let n=this.parameters.filter(c=>!c.type.isOptional()),i=this.parameters.filter(c=>c.type.isOptional());[...n,...i].forEach((c,m)=>{m>0&&e.write(", "),c.write(e)}),e.write("): "),this.return_!=null?e.writeNodeOrString(this.return_):e.write("void"),e.writeLine(" {"),e.indent(),(f=this.body)==null||f.write(e),e.dedent(),e.writeLine("}")}writeComment(e){let n=new P({docs:this.docs});for(let i of this.parameters)n.addTag({tagType:"param",type:i.type,name:i.name,docs:i.docs});this.return_!=null&&this.return_!==zi&&this.return_!==Hi&&n.addTag({tagType:"return",type:this.return_});for(let i of this.throws)n.addTag({tagType:"throws",type:D.reference(i)});e.writeNode(n)}};var Ae=class extends g{constructor({name:e,namespace:n,backing:i,docs:s,serializable:f}){super();l(this,"name");l(this,"namespace");l(this,"backing");l(this,"docs");l(this,"members",[]);l(this,"serializable");this.name=e,this.namespace=n,this.backing=i,this.docs=s,this.serializable=f!=null?f:!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 I({name:"JsonSerializable",namespace:""})),e.writeLine(" implements JsonSerializable")),e.writeLine(" {"),e.indent();for(let n of this.members)e.write(`case ${n.name}`),n.value!=null&&(typeof n.value=="string"?e.write(` = "${n.value}"`):e.write(` = ${n.value}`)),e.writeTextStatement("");this.serializable&&(e.newLine(),e.writeNode(new ee({name:"jsonSerialize",return_:D.string(),access:"public",parameters:[],body:new N("return $this->value;")}))),e.writeNewLineIfLastLineNot(),e.dedent(),e.writeLine("}")}writeComment(e){if(this.docs==null)return;new P({docs:this.docs}).write(e)}};o();a();var be=class extends g{constructor({name:e,type:n,access:i,readonly_:s,initializer:f,docs:c,inlineDocs:m,attributes:d,inherited:y}){super();l(this,"name");l(this,"type");l(this,"access");l(this,"readonly_");l(this,"initializer");l(this,"docs");l(this,"inlineDocs");l(this,"attributes");l(this,"inherited");this.name=le(e),this.type=n,this.access=i,this.readonly_=s!=null?s:!1,this.initializer=f,this.docs=c,this.inlineDocs=m,this.attributes=d!=null?d:[],this.inherited=y!=null?y:!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 n=new P;n.addTag({tagType:"var",type:this.type,name:this.name,docs:this.docs}),n.write(e)}writeAttributesIfPresent(e){this.attributes.length>0&&(e.write("#["),this.attributes.forEach((n,i)=>{i>0&&e.write(", "),n.write(e)}),e.writeLine("]"))}};o();a();var Ee=class extends g{constructor({entries:e,multiline:n}){super();l(this,"entries");l(this,"multiline");this.entries=e!=null?e:[],this.multiline=n!=null?n:!1}write(e){if(this.multiline){this.writeMultiline(e);return}this.writeCompact(e)}writeMultiline(e){e.writeLine("["),e.indent();for(let{key:n,value:i}of this.entries)n.write(e),e.write(" => "),i.write(e),e.writeLine(",");e.dedent(),e.write("]")}writeCompact(e){e.write("[");for(let[n,{key:i,value:s}]of this.entries.entries())n>0&&e.write(", "),i.write(e),e.write(" => "),s.write(e);e.write("]")}};o();a();var Re=class extends g{constructor({name:e,namespace:n,docs:i,traits:s}){super();l(this,"name");l(this,"namespace");l(this,"docs");l(this,"traits");l(this,"fields",[]);l(this,"methods",[]);this.name=e,this.namespace=n,this.docs=i,this.traits=s!=null?s:[]}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((n,i)=>{i>0&&e.write(","),e.writeNode(n)}),e.writeTextStatement(""),e.newLine()),this.writeFields({writer:e,fields:ce(this.fields)}),this.fields.length>0&&this.methods.length>0&&e.newLine(),this.writeMethods({writer:e,methods:ce(this.methods)}),e.dedent(),e.writeLine("}")}writeComment(e){let n=new P({docs:this.docs});for(let i of this.fields)n.addTag({tagType:"property",type:i.type,name:i.name});n.write(e)}writeFields({writer:e,fields:n}){n.forEach((i,s)=>{s>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}writeMethods({writer:e,methods:n}){n.forEach((i,s)=>{s>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}};o();a();var Nt=class extends g{constructor(e){super();l(this,"arrays");this.arrays=e}write(e){e.write("array_merge"),ke({writer:e,arguments_:this.arrays.map(n=>Ce(i=>{if(typeof n=="string"||n instanceof g){i.writeNodeOrString(n);return}i.writeNodeOrString(n.ref),n.fallback&&(i.write(" ?? "),i.writeNodeOrString(n.fallback))}))})}};function wl(r){return new we(r)}function vl(r){return new ve(r)}function Tl(r){return new Z(r)}function Al(r){return new Re(r)}function bl(r){return new I(r)}function Ce(r){return new N(r)}function El(r){return new Te(r)}function Rl(r){return new Ae(r)}function Cl(r){return new be(r)}function eo(r){return new V(r)}function Il(r){return new X(r)}function Nl(r){return Ce(t=>{t.write("throw "),t.writeNode(eo(r))})}function Sl(r){return new Ee(r)}function Ll(r){return new ee(r)}function Pl(r){return new Q(r)}function _l(r){return new Ve(r)}function Fl(r,t){return Ce(e=>{e.writeNodeOrString(r),e.write(" = "),e.writeNodeOrString(t)})}function Bl(r){return Ce(le(r))}function Ul(r){return Ce(`"${r}"`)}function Ol(...r){return new Nt(r)}function Ml(){return new N(r=>{r.write("$this")})}o();a();var St=class{constructor({context:t}){l(this,"context");this.context=t}convert(t){if(t.value===null)return this.context.isNullable(t.typeReference)?h.TypeLiteral.null():(this.context.errors.add({severity:v.Critical,message:"Expected non-null value, but got null"}),h.TypeLiteral.nop());if(t.value===void 0)return h.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?h.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(t.typeReference)}}convertLiteral({literalType:t,value:e}){switch(t.type){case"boolean":{let n=this.context.getValueAsBoolean({value:e});return n==null?h.TypeLiteral.nop():h.TypeLiteral.boolean(n)}case"string":{let n=this.context.getValueAsString({value:e});return n==null?h.TypeLiteral.nop():h.TypeLiteral.string(n)}default:T(t)}}convertList({list:t,value:e}){return Array.isArray(e)?h.TypeLiteral.list({values:e.map((n,i)=>{this.context.errors.scope({index:i});try{return this.convert({typeReference:t,value:n})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:v.Critical,message:`Expected array but got: ${typeof e}`}),h.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}`}),h.TypeLiteral.nop()):h.TypeLiteral.map({entries:Object.entries(e).map(([n,i])=>{this.context.errors.scope(n);try{return{key:this.convert({typeReference:t.key,value:n,as:"key"}),value:this.convert({typeReference:t.value,value:i})}}finally{this.context.errors.unscope()}})})}convertNamed({named:t,value:e,as:n}){switch(t.type){case"alias":return this.convert({typeReference:t.typeReference,value:e,as:n});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(t)}}convertDiscriminatedUnion({discriminatedUnion:t,value:e}){let n=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e});if(n==null)return h.TypeLiteral.nop();let i=n.singleDiscriminatedUnionType,s=this.convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:n,unionVariant:i});return s==null?h.TypeLiteral.nop():h.TypeLiteral.reference(h.codeblock(f=>{f.writeNode(h.invokeMethod({on:h.classReference({name:this.context.getClassName(t.declaration.name),namespace:this.context.getTypesNamespace(t.declaration.fernFilepath)}),method:this.context.getMethodName(i.discriminantValue.name),arguments_:this.convertDiscriminatedUnionVariantArgs({discriminatedUnionTypeInstance:n,unionVariant:i,unionProperties:s}),static_:!0}))}))}convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:t,unionVariant:e}){switch(e.type){case"samePropertiesAsObject":{let n=this.context.resolveNamedType({typeId:e.typeId});if(n==null)return;let i=this.convertNamed({named:n,value:t.value});if(!i.isClass()){this.context.errors.add({severity:v.Critical,message:"Internal error; expected union value to be an object"});return}return i.asClassOrThrow().fields}case"singleProperty":try{this.context.errors.scope(e.discriminantValue.wireValue);let n=this.context.getRecord(t.value);return n==null?[{name:this.context.getPropertyName(e.discriminantValue.name),value:this.convert({typeReference:e.typeReference,value:t.value})}]:[{name:this.context.getPropertyName(e.discriminantValue.name),value:this.convert({typeReference:e.typeReference,value:n[e.discriminantValue.wireValue]})}]}finally{this.context.errors.unscope()}case"noProperties":return[];default:T(e)}}convertDiscriminatedUnionVariantArgs({discriminatedUnionTypeInstance:t,unionVariant:e,unionProperties:n}){let i=this.getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:e});if(e.type==="singleProperty"&&this.context.getRecord(t.value)==null&&n.length===1)return[...i,this.convert({typeReference:e.typeReference,value:t.value})];if(e.type==="samePropertiesAsObject"){let s=this.context.resolveNamedType({typeId:e.typeId});return s==null?[]:[...i,h.TypeLiteral.class_({reference:h.classReference({name:this.context.getClassName(s.declaration.name),namespace:this.context.getTypesNamespace(s.declaration.fernFilepath)}),fields:n})]}return i}getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:e}){var i,s;return this.context.associateByWireValue({parameters:(i=e.properties)!=null?i:[],values:(s=this.context.getRecord(t.value))!=null?s:{},ignoreMissingParameters:!0}).map(f=>{this.context.errors.scope(f.name.wireValue);try{return this.convert(f)}finally{this.context.errors.unscope()}})}convertObject({object_:t,value:e}){var i;let n=this.context.associateByWireValue({parameters:t.properties,values:(i=this.context.getRecord(e))!=null?i:{}});return h.TypeLiteral.class_({reference:h.classReference({name:this.context.getClassName(t.declaration.name),namespace:this.context.getTypesNamespace(t.declaration.fernFilepath)}),fields:n.map(s=>{this.context.errors.scope(s.name.wireValue);try{return{name:this.context.getPropertyName(s.name.name),value:this.convert(s)}}finally{this.context.errors.unscope()}})})}convertEnum({enum_:t,value:e}){let n=this.getEnumValueName({enum_:t,value:e});return n==null?h.TypeLiteral.nop():h.TypeLiteral.reference(h.codeblock(i=>{i.writeNode(h.classReference({name:this.context.getClassName(t.declaration.name),namespace:this.context.getTypesNamespace(t.declaration.fernFilepath)})),i.write("::"),i.write(n),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 n=t.values.find(i=>i.wireValue===e);if(n==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(n.name)}convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e}){let n=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e});return n==null?h.TypeLiteral.nop():n}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e}){for(let n of t.types)try{return this.convert({typeReference:n,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 h.TypeLiteral.unknown(t)}convertPrimitive({primitive:t,value:e,as:n}){switch(t){case"INTEGER":case"LONG":case"UINT":case"UINT_64":{let i=this.getValueAsNumber({value:e,as:n});return i==null?h.TypeLiteral.nop():h.TypeLiteral.number(i)}case"FLOAT":case"DOUBLE":{let i=this.getValueAsNumber({value:e});return i==null?h.TypeLiteral.nop():h.TypeLiteral.float(i)}case"BOOLEAN":{let i=this.getValueAsBoolean({value:e,as:n});return i==null?h.TypeLiteral.nop():h.TypeLiteral.boolean(i)}case"DATE":case"DATE_TIME":{let i=this.context.getValueAsString({value:e});return i==null?h.TypeLiteral.nop():h.TypeLiteral.datetime(i)}case"BASE_64":case"UUID":case"BIG_INTEGER":case"STRING":{let i=this.context.getValueAsString({value:e});return i==null?h.TypeLiteral.nop():h.TypeLiteral.string(i)}default:T(t)}}getValueAsNumber({value:t,as:e}){let n=e==="key"&&typeof t=="string"?Number(t):t;return this.context.getValueAsNumber({value:n})}getValueAsBoolean({value:t,as:e}){let n=e==="key"?typeof t=="string"?t==="true":t==="false"?!1:t:t;return this.context.getValueAsBoolean({value:n})}};o();a();var Lt=class{constructor({context:t}){l(this,"context");this.context=t}getFilePropertyInfo({body:t,value:e}){var s;let n={fileFields:[],bodyPropertyFields:[]},i=(s=this.context.getRecord(e))!=null?s:{};for(let f of t.properties)switch(f.type){case"file":n.fileFields.push({name:this.context.getPropertyName(f.name),value:this.getSingleFileProperty({property:f,record:i})});break;case"fileArray":n.fileFields.push({name:this.context.getPropertyName(f.name),value:this.getArrayFileProperty({property:f,record:i})});break;case"bodyProperty":n.bodyPropertyFields.push({name:this.context.getPropertyName(f.name.name),value:this.getBodyProperty({property:f,record:i})});break;default:T(f)}return n}getSingleFileProperty({property:t,record:e}){let n=this.context.getSingleFileValue({property:t,record:e});return n==null?h.TypeLiteral.nop():h.TypeLiteral.file(n)}getArrayFileProperty({property:t,record:e}){let n=this.context.getFileArrayValues({property:t,record:e});return n==null?h.TypeLiteral.nop():h.TypeLiteral.list({values:n.map(i=>h.TypeLiteral.file(i))})}getBodyProperty({property:t,record:e}){let n=e[t.name.wireValue];return n==null?h.TypeLiteral.nop():this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:n})}};var kl=["use","clone","list"],Dl="Requests",jl="Types",Pt=class r extends Ke{constructor({ir:e,config:n}){var i;super({ir:e,config:n});l(this,"ir");l(this,"customConfig");l(this,"dynamicTypeLiteralMapper");l(this,"filePropertyMapper");l(this,"rootNamespace");this.ir=e,this.customConfig=n.customConfig!=null?n.customConfig:void 0,this.dynamicTypeLiteralMapper=new St({context:this}),this.filePropertyMapper=new Lt({context:this}),this.rootNamespace=ql({organization:n.organization,namespaceOverride:(i=this.customConfig)==null?void 0:i.namespace})}clone(){return new r({ir:this.ir,config:this.config})}getParameterName(e){return this.prependUnderscoreIfNeeded(e.camelCase.unsafeName)}getPropertyName(e){return this.prependUnderscoreIfNeeded(e.camelCase.unsafeName)}getMethodName(e){let n=e.camelCase.unsafeName;return kl.includes(n)?n:e.camelCase.safeName}getClassName(e){return e.pascalCase.safeName}getRootClientClassName(){var e,n,i;return((e=this.customConfig)==null?void 0:e.clientName)!=null?this.customConfig.clientName:((n=this.customConfig)==null?void 0:n["client-class-name"])!=null?(i=this.customConfig)==null?void 0:i["client-class-name"]:this.getComputedClientName()}getEnvironmentsClassReference(){return h.classReference({name:"Environments",namespace:this.rootNamespace})}getRequestNamespace(e){return this.getNamespace(e,Dl)}getTypesNamespace(e){return this.getNamespace(e,jl)}getNamespace(e,n){let i=e.allParts.map(s=>s.pascalCase.safeName);return i=n!=null?[...i,n]:i,[this.rootNamespace,...i].join("\\")}getEnvironmentClassAccessFromID(e){let n=this.resolveEnvironmentName(e);if(n!=null)return h.codeblock(i=>{i.writeNode(this.getEnvironmentClassReference(n)),i.write("::"),i.write(this.getClassName(n))})}getEnvironmentClassReference(e){return h.classReference({name:"Environments",namespace:this.rootNamespace})}prependUnderscoreIfNeeded(e){return/^[a-zA-Z_]/.test(e)?e:`_${e}`}getComputedClientName(){return`${this.getOrganizationPascalCase()}Client`}getOrganizationPascalCase(){return`${Be(xt(this.config.organization))}`}};function ql({organization:r,namespaceOverride:t}){return t!=null?t:`${Be(xt(r))}`}o();a();var to="$client",_t="Example",ro=`<?php
|
|
19
19
|
|
|
20
|
-
`,Oe=class{constructor({context:t}){f(this,"context");this.context=t}async generateSnippet({endpoint:t,request:e}){var i;let r=this.buildCodeBlock({endpoint:t,snippet:e});return Mr+await r.toStringAsync({namespace:De,rootNamespace:De,customConfig:(i=this.context.customConfig)!=null?i:{}})}generateSnippetSync({endpoint:t,request:e}){var i;let r=this.buildCodeBlock({endpoint:t,snippet:e});return Mr+r.toString({namespace:De,rootNamespace:De,customConfig:(i=this.context.customConfig)!=null?i:{}})}buildCodeBlock({endpoint:t,snippet:e}){return d.codeblock(r=>{r.writeNodeStatement(this.constructClient({endpoint:t,snippet:e})),r.writeNodeStatement(this.callMethod({endpoint:t,snippet:e}))})}constructClient({endpoint:t,snippet:e}){return d.codeblock(r=>{r.write(`${Ur} = `),r.writeNode(this.getRootClientClassInstantiation(this.getConstructorArgs({endpoint:t,snippet:e})))})}callMethod({endpoint:t,snippet:e}){return d.invokeMethod({on:d.codeblock(Ur),method:this.getMethod({endpoint:t}),arguments_:this.getMethodArgs({endpoint:t,snippet:e}),multiline:!0})}getConstructorArgs({endpoint:t,snippet:e}){let r=[];t.auth!=null&&(e.auth!=null?r.push(...this.getConstructorAuthArgs({auth:t.auth,values:e.auth})):this.context.errors.add({severity:w.Warning,message:`Auth with ${t.auth.type} configuration is required for this endpoint`}));let i=[],o=this.getConstructorBaseUrlArgs({baseUrl:e.baseURL,environment:e.environment});return o.length>0&&i.push(...o),this.context.errors.scope(k.Headers),this.context.ir.headers!=null&&e.headers!=null&&i.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:e.headers})),this.context.errors.unscope(),i.length===0?r:[...r,{name:"options",assignment:d.TypeLiteral.map({entries:i.map(a=>({key:d.TypeLiteral.string(a.name),value:a.value}))})}]}getConstructorAuthArgs({auth:t,values:e}){switch(t.type){case"basic":return e.type!=="basic"?(this.context.errors.add({severity:w.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message}),[]):this.getConstructorBasicAuthArgs({auth:t,values:e});case"bearer":return e.type!=="bearer"?(this.context.errors.add({severity:w.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message}),[]):this.getConstructorBearerAuthArgs({auth:t,values:e});case"header":return e.type!=="header"?(this.context.errors.add({severity:w.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message}),[]):this.getConstructorHeaderAuthArgs({auth:t,values:e});default:v(t)}}getConstructorBasicAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.username),assignment:d.TypeLiteral.string(e.username)},{name:this.context.getPropertyName(t.password),assignment:d.TypeLiteral.string(e.password)}]}getConstructorBaseUrlArgs({baseUrl:t,environment:e}){let r=this.getBaseUrlArg({baseUrl:t,environment:e});return d.TypeLiteral.isNop(r)?[]:[{name:"baseUrl",value:r}]}getBaseUrlArg({baseUrl:t,environment:e}){if(t!=null&&e!=null)return this.context.errors.add({severity:w.Critical,message:"Cannot specify both baseUrl and environment options"}),d.TypeLiteral.nop();if(t!=null)return d.TypeLiteral.string(t);if(e!=null){if(this.context.isSingleEnvironmentID(e)){let r=this.context.getEnvironmentClassAccessFromID(e);return r==null?(this.context.errors.add({severity:w.Warning,message:`Environment ${JSON.stringify(e)} was not found`}),d.TypeLiteral.nop()):d.TypeLiteral.reference(d.codeblock(i=>{i.writeNode(r),i.write("->value")}))}this.context.isMultiEnvironmentValues(e)&&this.context.errors.add({severity:w.Warning,message:"The PHP SDK doesn't support a multi-environment client option yet; use the baseUrl option instead"})}return d.TypeLiteral.nop()}getConstructorBearerAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.token),assignment:d.TypeLiteral.string(e.token)}]}getConstructorHeaderAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.header.name.name),assignment:this.context.dynamicTypeLiteralMapper.convert({typeReference:t.header.typeReference,value:e.value})}]}getConstructorHeaderArgs({headers:t,values:e}){let r=[];for(let i of t){let o=this.getConstructorHeaderArg({header:i,value:e.value});o!=null&&r.push({name:this.context.getPropertyName(i.name.name),value:o})}return r}getConstructorHeaderArg({header:t,value:e}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:e});if(!d.TypeLiteral.isNop(r))return r}getMethodArgs({endpoint:t,snippet:e}){switch(t.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:t.request,snippet:e});case"body":return this.getMethodArgsForBodyRequest({request:t.request,snippet:e});default:v(t.request)}}getMethodArgsForBodyRequest({request:t,snippet:e}){let r=[];if(this.context.errors.scope(k.PathParameters),t.pathParameters!=null){let i=this.getPathParameters({namedParameters:t.pathParameters,snippet:e});r.push(...i.map(o=>o.value))}return this.context.errors.unscope(),this.context.errors.scope(k.RequestBody),t.body!=null&&r.push(this.getBodyRequestArg({body:t.body,value:e.requestBody})),this.context.errors.unscope(),r}getBodyRequestArg({body:t,value:e}){switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:t.value,value:e});default:v(t)}}getBytesBodyRequestArg({value:t}){return this.context.errors.add({severity:w.Critical,message:"The PHP SDK doesn't support bytes requests yet"}),d.TypeLiteral.nop()}getMethodArgsForInlinedRequest({request:t,snippet:e}){var l,m;let r=[],i=(m=(l=this.context.customConfig)==null?void 0:l.inlinePathParameters)!=null?m:!1;this.context.errors.scope(k.PathParameters);let o=[];t.pathParameters!=null&&o.push(...this.getPathParameters({namedParameters:t.pathParameters,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(k.RequestBody);let a=this.getFilePropertyInfo({request:t,snippet:e});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})||r.push(...o.map(h=>h.value)),this.context.needsRequestParameter({request:t,inlinePathParameters:i,inlineFileProperties:!0})&&r.push(this.getInlinedRequestArg({request:t,snippet:e,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})?o:[],filePropertyInfo:a})),r}getFilePropertyInfo({request:t,snippet:e}){return t.body==null||!this.context.isFileUploadRequestBody(t.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:t.body,value:e.requestBody})}getInlinedRequestArg({request:t,snippet:e,pathParameterFields:r,filePropertyInfo:i}){var y,g,b,R;this.context.errors.scope(k.QueryParameters);let a=this.context.associateQueryParametersByWireValue({parameters:(y=t.queryParameters)!=null?y:[],values:(g=e.queryParameters)!=null?g:{}}).map(I=>({name:this.context.getPropertyName(I.name.name),value:this.context.dynamicTypeLiteralMapper.convert(I)}));this.context.errors.unscope(),this.context.errors.scope(k.Headers);let m=this.context.associateByWireValue({parameters:(b=t.headers)!=null?b:[],values:(R=e.headers)!=null?R:{}}).map(I=>({name:this.context.getPropertyName(I.name.name),value:this.context.dynamicTypeLiteralMapper.convert(I)}));this.context.errors.unscope(),this.context.errors.scope(k.RequestBody);let h=t.body!=null?this.getInlinedRequestBodyConstructorFields({body:t.body,value:e.requestBody,filePropertyInfo:i}):[];return this.context.errors.unscope(),d.TypeLiteral.class_({reference:d.classReference({name:this.context.getClassName(t.declaration.name),namespace:this.context.getRequestNamespace(t.declaration.fernFilepath)}),fields:[...r,...a,...m,...h]})}getInlinedRequestBodyConstructorFields({body:t,value:e,filePropertyInfo:r}){switch(t.type){case"properties":return this.getInlinedRequestBodyPropertyConstructorFields({parameters:t.value,value:e});case"referenced":return[this.getReferencedRequestBodyPropertyConstructorField({body:t,value:e})];case"fileUpload":return this.getFileUploadRequestBodyConstructorFields({filePropertyInfo:r});default:v(t)}}getFileUploadRequestBodyConstructorFields({filePropertyInfo:t}){return[...t.fileFields,...t.bodyPropertyFields]}getReferencedRequestBodyPropertyConstructorField({body:t,value:e}){return{name:this.context.getPropertyName(t.bodyKey),value:this.getReferencedRequestBodyPropertyTypeLiteral({body:t.bodyType,value:e})}}getReferencedRequestBodyPropertyTypeLiteral({body:t,value:e}){switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:t.value,value:e});default:v(t)}}getInlinedRequestBodyPropertyConstructorFields({parameters:t,value:e}){var o;let r=[],i=this.context.associateByWireValue({parameters:t,values:(o=this.context.getRecord(e))!=null?o:{}});for(let a of i)r.push({name:this.context.getPropertyName(a.name.name),value:this.context.dynamicTypeLiteralMapper.convert(a)});return r}getPathParameters({namedParameters:t,snippet:e}){var o;let r=[],i=this.context.associateByWireValue({parameters:t,values:(o=e.pathParameters)!=null?o:{}});for(let a of i)r.push({name:this.context.getPropertyName(a.name.name),value:this.context.dynamicTypeLiteralMapper.convert(a)});return r}getMethod({endpoint:t}){return t.declaration.fernFilepath.allParts.length>0?`${t.declaration.fernFilepath.allParts.map(e=>this.context.getPropertyName(e)).join("->")}->${this.context.getMethodName(t.declaration.name)}`:this.context.getMethodName(t.declaration.name)}getRootClientClassInstantiation(t){return d.instantiateClass({classReference:d.classReference({name:this.context.getRootClientClassName(),namespace:this.context.rootNamespace}),arguments_:t,multiline:!0})}};u();p();u();p();var $e=class{constructor({context:t}){f(this,"context");this.context=t}convert(t){if(t.value===null)return this.context.isNullable(t.typeReference)?d.TypeLiteral.null():(this.context.errors.add({severity:w.Critical,message:"Expected non-null value, but got null"}),d.TypeLiteral.nop());if(t.value===void 0)return d.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?d.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:v(t.typeReference)}}convertLiteral({literalType:t,value:e}){switch(t.type){case"boolean":{let r=this.context.getValueAsBoolean({value:e});return r==null?d.TypeLiteral.nop():d.TypeLiteral.boolean(r)}case"string":{let r=this.context.getValueAsString({value:e});return r==null?d.TypeLiteral.nop():d.TypeLiteral.string(r)}default:v(t)}}convertList({list:t,value:e}){return Array.isArray(e)?d.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:w.Critical,message:`Expected array but got: ${typeof e}`}),d.TypeLiteral.nop())}convertMap({map:t,value:e}){return typeof e!="object"||e==null?(this.context.errors.add({severity:w.Critical,message:`Expected object but got: ${e==null?"null":typeof e}`}),d.TypeLiteral.nop()):d.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:v(t)}}convertDiscriminatedUnion({discriminatedUnion:t,value:e}){let r=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e});if(r==null)return d.TypeLiteral.nop();let i=r.singleDiscriminatedUnionType,o=this.convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:r,unionVariant:i});return o==null?d.TypeLiteral.nop():d.TypeLiteral.reference(d.codeblock(a=>{a.writeNode(d.invokeMethod({on:d.classReference({name:this.context.getClassName(t.declaration.name),namespace:this.context.getTypesNamespace(t.declaration.fernFilepath)}),method:this.context.getMethodName(i.discriminantValue.name),arguments_:this.convertDiscriminatedUnionVariantArgs({discriminatedUnionTypeInstance:r,unionVariant:i,unionProperties:o}),static_:!0}))}))}convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:t,unionVariant:e}){switch(e.type){case"samePropertiesAsObject":{let r=this.context.resolveNamedType({typeId:e.typeId});if(r==null)return;let i=this.convertNamed({named:r,value:t.value});if(!i.isClass()){this.context.errors.add({severity:w.Critical,message:"Internal error; expected union value to be an object"});return}return i.asClassOrThrow().fields}case"singleProperty":try{this.context.errors.scope(e.discriminantValue.wireValue);let r=this.context.getRecord(t.value);return r==null?[{name:this.context.getPropertyName(e.discriminantValue.name),value:this.convert({typeReference:e.typeReference,value:t.value})}]:[{name:this.context.getPropertyName(e.discriminantValue.name),value:this.convert({typeReference:e.typeReference,value:r[e.discriminantValue.wireValue]})}]}finally{this.context.errors.unscope()}case"noProperties":return[];default:v(e)}}convertDiscriminatedUnionVariantArgs({discriminatedUnionTypeInstance:t,unionVariant:e,unionProperties:r}){let i=this.getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:e});if(e.type==="singleProperty"&&this.context.getRecord(t.value)==null&&r.length===1)return[...i,this.convert({typeReference:e.typeReference,value:t.value})];if(e.type==="samePropertiesAsObject"){let o=this.context.resolveNamedType({typeId:e.typeId});return o==null?[]:[...i,d.TypeLiteral.class_({reference:d.classReference({name:this.context.getClassName(o.declaration.name),namespace:this.context.getTypesNamespace(o.declaration.fernFilepath)}),fields:r})]}return i}getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:e}){var i,o;return this.context.associateByWireValue({parameters:(i=e.properties)!=null?i:[],values:(o=this.context.getRecord(t.value))!=null?o:{},ignoreMissingParameters:!0}).map(a=>{this.context.errors.scope(a.name.wireValue);try{return this.convert(a)}finally{this.context.errors.unscope()}})}convertObject({object_:t,value:e}){var i;let r=this.context.associateByWireValue({parameters:t.properties,values:(i=this.context.getRecord(e))!=null?i:{}});return d.TypeLiteral.class_({reference:d.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?d.TypeLiteral.nop():d.TypeLiteral.reference(d.codeblock(i=>{i.writeNode(d.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:w.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:w.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?d.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:w.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof e}" value`})}convertUnknown({value:t}){return d.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?d.TypeLiteral.nop():d.TypeLiteral.number(i)}case"FLOAT":case"DOUBLE":{let i=this.getValueAsNumber({value:e});return i==null?d.TypeLiteral.nop():d.TypeLiteral.float(i)}case"BOOLEAN":{let i=this.getValueAsBoolean({value:e,as:r});return i==null?d.TypeLiteral.nop():d.TypeLiteral.boolean(i)}case"DATE":case"DATE_TIME":{let i=this.context.getValueAsString({value:e});return i==null?d.TypeLiteral.nop():d.TypeLiteral.datetime(i)}case"BASE_64":case"UUID":case"BIG_INTEGER":case"STRING":{let i=this.context.getValueAsString({value:e});return i==null?d.TypeLiteral.nop():d.TypeLiteral.string(i)}default:v(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})}};u();p();var Ve=class{constructor({context:t}){f(this,"context");this.context=t}getFilePropertyInfo({body:t,value:e}){var o;let r={fileFields:[],bodyPropertyFields:[]},i=(o=this.context.getRecord(e))!=null?o:{};for(let a of t.properties)switch(a.type){case"file":r.fileFields.push({name:this.context.getPropertyName(a.name),value:this.getSingleFileProperty({property:a,record:i})});break;case"fileArray":r.fileFields.push({name:this.context.getPropertyName(a.name),value:this.getArrayFileProperty({property:a,record:i})});break;case"bodyProperty":r.bodyPropertyFields.push({name:this.context.getPropertyName(a.name.name),value:this.getBodyProperty({property:a,record:i})});break;default:v(a)}return r}getSingleFileProperty({property:t,record:e}){let r=this.context.getSingleFileValue({property:t,record:e});return r==null?d.TypeLiteral.nop():d.TypeLiteral.file(r)}getArrayFileProperty({property:t,record:e}){let r=this.context.getFileArrayValues({property:t,record:e});return r==null?d.TypeLiteral.nop():d.TypeLiteral.list({values:r.map(i=>d.TypeLiteral.file(i))})}getBodyProperty({property:t,record:e}){let r=e[t.name.wireValue];return r==null?d.TypeLiteral.nop():this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:r})}};var aa=["use","clone","list"],sa="Requests",ua="Types",qe=class n extends Ee{constructor({ir:e,config:r}){var i;super({ir:e,config:r});f(this,"ir");f(this,"customConfig");f(this,"dynamicTypeLiteralMapper");f(this,"filePropertyMapper");f(this,"rootNamespace");this.ir=e,this.customConfig=r.customConfig!=null?r.customConfig:void 0,this.dynamicTypeLiteralMapper=new $e({context:this}),this.filePropertyMapper=new Ve({context:this}),this.rootNamespace=pa({organization:r.organization,namespaceOverride:(i=this.customConfig)==null?void 0:i.namespace})}clone(){return new n({ir:this.ir,config:this.config})}getParameterName(e){return this.prependUnderscoreIfNeeded(e.camelCase.unsafeName)}getPropertyName(e){return this.prependUnderscoreIfNeeded(e.camelCase.unsafeName)}getMethodName(e){let r=e.camelCase.unsafeName;return aa.includes(r)?r:e.camelCase.safeName}getClassName(e){return e.pascalCase.safeName}getRootClientClassName(){var e,r,i;return((e=this.customConfig)==null?void 0:e.clientName)!=null?this.customConfig.clientName:((r=this.customConfig)==null?void 0:r["client-class-name"])!=null?(i=this.customConfig)==null?void 0:i["client-class-name"]:this.getComputedClientName()}getEnvironmentsClassReference(){return d.classReference({name:"Environments",namespace:this.rootNamespace})}getRequestNamespace(e){return this.getNamespace(e,sa)}getTypesNamespace(e){return this.getNamespace(e,ua)}getNamespace(e,r){let i=e.allParts.map(o=>o.pascalCase.safeName);return i=r!=null?[...i,r]:i,[this.rootNamespace,...i].join("\\")}getEnvironmentClassAccessFromID(e){let r=this.resolveEnvironmentName(e);if(r!=null)return d.codeblock(i=>{i.writeNode(this.getEnvironmentClassReference(r)),i.write("::"),i.write(this.getClassName(r))})}getEnvironmentClassReference(e){return d.classReference({name:"Environments",namespace:this.rootNamespace})}prependUnderscoreIfNeeded(e){return/^[a-zA-Z_]/.test(e)?e:`_${e}`}getComputedClientName(){return`${this.getOrganizationPascalCase()}Client`}getOrganizationPascalCase(){return`${de(Me(this.config.organization))}`}};function pa({organization:n,namespaceOverride:t}){return t!=null?t:`${de(Me(n))}`}var Xe=class extends Te{constructor({ir:t,config:e}){super(new qe({ir:t,config:e}))}async generate(t){return super.generate(t)}generateSync(t){return super.generateSync(t)}createSnippetGenerator(t){return new Oe({context:t})}};0&&(module.exports={DynamicSnippetsGenerator});
|
|
20
|
+
`,Ft=class{constructor({context:t}){l(this,"context");this.context=t}async generateSnippet({endpoint:t,request:e}){var i;let n=this.buildCodeBlock({endpoint:t,snippet:e});return ro+await n.toStringAsync({namespace:_t,rootNamespace:_t,customConfig:(i=this.context.customConfig)!=null?i:{}})}generateSnippetSync({endpoint:t,request:e}){var i;let n=this.buildCodeBlock({endpoint:t,snippet:e});return ro+n.toString({namespace:_t,rootNamespace:_t,customConfig:(i=this.context.customConfig)!=null?i:{}})}buildCodeBlock({endpoint:t,snippet:e}){return h.codeblock(n=>{n.writeNodeStatement(this.constructClient({endpoint:t,snippet:e})),n.writeNodeStatement(this.callMethod({endpoint:t,snippet:e}))})}constructClient({endpoint:t,snippet:e}){return h.codeblock(n=>{n.write(`${to} = `),n.writeNode(this.getRootClientClassInstantiation(this.getConstructorArgs({endpoint:t,snippet:e})))})}callMethod({endpoint:t,snippet:e}){return h.invokeMethod({on:h.codeblock(to),method:this.getMethod({endpoint:t}),arguments_:this.getMethodArgs({endpoint:t,snippet:e}),multiline:!0})}getConstructorArgs({endpoint:t,snippet:e}){let n=[];t.auth!=null&&(e.auth!=null?n.push(...this.getConstructorAuthArgs({auth:t.auth,values:e.auth})):this.context.errors.add({severity:v.Warning,message:`Auth with ${t.auth.type} configuration is required for this endpoint`}));let i=[],s=this.getConstructorBaseUrlArgs({baseUrl:e.baseURL,environment:e.environment});return s.length>0&&i.push(...s),this.context.errors.scope($.Headers),this.context.ir.headers!=null&&e.headers!=null&&i.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:e.headers})),this.context.errors.unscope(),i.length===0?n:[...n,{name:"options",assignment:h.TypeLiteral.map({entries:i.map(f=>({key:h.TypeLiteral.string(f.name),value:f.value}))})}]}getConstructorAuthArgs({auth:t,values:e}){if(e.type!==t.type)return this.addError(this.context.newAuthMismatchError({auth:t,values:e}).message),[];switch(t.type){case"basic":return e.type==="basic"?this.getConstructorBasicAuthArgs({auth:t,values:e}):[];case"bearer":return e.type==="bearer"?this.getConstructorBearerAuthArgs({auth:t,values:e}):[];case"header":return e.type==="header"?this.getConstructorHeaderAuthArgs({auth:t,values:e}):[];case"oauth":return this.addWarning("The PHP SDK doesn't support OAuth client credentials yet"),[];case"inferred":return this.addWarning("The PHP SDK Generator does not support Inferred auth scheme yet"),[];default:T(t)}}addError(t){this.context.errors.add({severity:v.Critical,message:t})}addWarning(t){this.context.errors.add({severity:v.Warning,message:t})}getConstructorBasicAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.username),assignment:h.TypeLiteral.string(e.username)},{name:this.context.getPropertyName(t.password),assignment:h.TypeLiteral.string(e.password)}]}getConstructorBaseUrlArgs({baseUrl:t,environment:e}){let n=this.getBaseUrlArg({baseUrl:t,environment:e});return h.TypeLiteral.isNop(n)?[]:[{name:"baseUrl",value:n}]}getBaseUrlArg({baseUrl:t,environment:e}){if(t!=null&&e!=null)return this.context.errors.add({severity:v.Critical,message:"Cannot specify both baseUrl and environment options"}),h.TypeLiteral.nop();if(t!=null)return h.TypeLiteral.string(t);if(e!=null){if(this.context.isSingleEnvironmentID(e)){let n=this.context.getEnvironmentClassAccessFromID(e);return n==null?(this.context.errors.add({severity:v.Warning,message:`Environment ${JSON.stringify(e)} was not found`}),h.TypeLiteral.nop()):h.TypeLiteral.reference(h.codeblock(i=>{i.writeNode(n),i.write("->value")}))}this.context.isMultiEnvironmentValues(e)&&this.context.errors.add({severity:v.Warning,message:"The PHP SDK doesn't support a multi-environment client option yet; use the baseUrl option instead"})}return h.TypeLiteral.nop()}getConstructorBearerAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.token),assignment:h.TypeLiteral.string(e.token)}]}getConstructorHeaderAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.header.name.name),assignment:this.context.dynamicTypeLiteralMapper.convert({typeReference:t.header.typeReference,value:e.value})}]}getConstructorHeaderArgs({headers:t,values:e}){let n=[];for(let i of t){let s=this.getConstructorHeaderArg({header:i,value:e.value});s!=null&&n.push({name:this.context.getPropertyName(i.name.name),value:s})}return n}getConstructorHeaderArg({header:t,value:e}){let n=this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:e});if(!h.TypeLiteral.isNop(n))return n}getMethodArgs({endpoint:t,snippet:e}){switch(t.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:t.request,snippet:e});case"body":return this.getMethodArgsForBodyRequest({request:t.request,snippet:e});default:T(t.request)}}getMethodArgsForBodyRequest({request:t,snippet:e}){var s,f;let n=[];this.context.errors.scope($.PathParameters);let i=[...(s=this.context.ir.pathParameters)!=null?s:[],...(f=t.pathParameters)!=null?f:[]];return i.length>0&&n.push(...this.getPathParameters({namedParameters:i,snippet:e}).map(c=>c.value)),this.context.errors.unscope(),this.context.errors.scope($.RequestBody),t.body!=null&&n.push(this.getBodyRequestArg({body:t.body,value:e.requestBody})),this.context.errors.unscope(),n}getBodyRequestArg({body:t,value:e}){switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:t.value,value:e});default:T(t)}}getBytesBodyRequestArg({value:t}){return this.context.errors.add({severity:v.Critical,message:"The PHP SDK doesn't support bytes requests yet"}),h.TypeLiteral.nop()}getMethodArgsForInlinedRequest({request:t,snippet:e}){var m,d,y,x;let n=[],i=(d=(m=this.context.customConfig)==null?void 0:m.inlinePathParameters)!=null?d:!1;this.context.errors.scope($.PathParameters);let s=[],f=[...(y=this.context.ir.pathParameters)!=null?y:[],...(x=t.pathParameters)!=null?x:[]];f.length>0&&s.push(...this.getPathParameters({namedParameters:f,snippet:e})),this.context.errors.unscope(),this.context.errors.scope($.RequestBody);let c=this.getFilePropertyInfo({request:t,snippet:e});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})||n.push(...s.map(w=>w.value)),this.context.needsRequestParameter({request:t,inlinePathParameters:i,inlineFileProperties:!0})&&n.push(this.getInlinedRequestArg({request:t,snippet:e,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})?s:[],filePropertyInfo:c})),n}getFilePropertyInfo({request:t,snippet:e}){return t.body==null||!this.context.isFileUploadRequestBody(t.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:t.body,value:e.requestBody})}getInlinedRequestArg({request:t,snippet:e,pathParameterFields:n,filePropertyInfo:i}){var y,x,w,A;this.context.errors.scope($.QueryParameters);let f=this.context.associateQueryParametersByWireValue({parameters:(y=t.queryParameters)!=null?y:[],values:(x=e.queryParameters)!=null?x:{}}).map(b=>({name:this.context.getPropertyName(b.name.name),value:this.context.dynamicTypeLiteralMapper.convert(b)}));this.context.errors.unscope(),this.context.errors.scope($.Headers);let m=this.context.associateByWireValue({parameters:(w=t.headers)!=null?w:[],values:(A=e.headers)!=null?A:{}}).map(b=>({name:this.context.getPropertyName(b.name.name),value:this.context.dynamicTypeLiteralMapper.convert(b)}));this.context.errors.unscope(),this.context.errors.scope($.RequestBody);let d=t.body!=null?this.getInlinedRequestBodyConstructorFields({body:t.body,value:e.requestBody,filePropertyInfo:i}):[];return this.context.errors.unscope(),h.TypeLiteral.class_({reference:h.classReference({name:this.context.getClassName(t.declaration.name),namespace:this.context.getRequestNamespace(t.declaration.fernFilepath)}),fields:[...n,...f,...m,...d]})}getInlinedRequestBodyConstructorFields({body:t,value:e,filePropertyInfo:n}){switch(t.type){case"properties":return this.getInlinedRequestBodyPropertyConstructorFields({parameters:t.value,value:e});case"referenced":return[this.getReferencedRequestBodyPropertyConstructorField({body:t,value:e})];case"fileUpload":return this.getFileUploadRequestBodyConstructorFields({filePropertyInfo:n});default:T(t)}}getFileUploadRequestBodyConstructorFields({filePropertyInfo:t}){return[...t.fileFields,...t.bodyPropertyFields]}getReferencedRequestBodyPropertyConstructorField({body:t,value:e}){return{name:this.context.getPropertyName(t.bodyKey),value:this.getReferencedRequestBodyPropertyTypeLiteral({body:t.bodyType,value:e})}}getReferencedRequestBodyPropertyTypeLiteral({body:t,value:e}){switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:t.value,value:e});default:T(t)}}getInlinedRequestBodyPropertyConstructorFields({parameters:t,value:e}){var s;let n=[],i=this.context.associateByWireValue({parameters:t,values:(s=this.context.getRecord(e))!=null?s:{}});for(let f of i)n.push({name:this.context.getPropertyName(f.name.name),value:this.context.dynamicTypeLiteralMapper.convert(f)});return n}getPathParameters({namedParameters:t,snippet:e}){var s;let n=[],i=this.context.associateByWireValue({parameters:t,values:(s=e.pathParameters)!=null?s:{}});for(let f of i)n.push({name:this.context.getPropertyName(f.name.name),value:this.context.dynamicTypeLiteralMapper.convert(f)});return n}getMethod({endpoint:t}){return t.declaration.fernFilepath.allParts.length>0?`${t.declaration.fernFilepath.allParts.map(e=>this.context.getPropertyName(e)).join("->")}->${this.context.getMethodName(t.declaration.name)}`:this.context.getMethodName(t.declaration.name)}getRootClientClassInstantiation(t){return h.instantiateClass({classReference:h.classReference({name:this.context.getRootClientClassName(),namespace:this.context.rootNamespace}),arguments_:t,multiline:!0})}};var Qt=class extends ze{constructor({ir:t,config:e}){super(new Pt({ir:t,config:e}))}async generate(t){return super.generate(t)}generateSync(t){return super.generateSync(t)}createSnippetGenerator(t){return new Ft({context:t})}};0&&(module.exports={DynamicSnippetsGenerator});
|
|
21
21
|
/*! Bundled license information:
|
|
22
22
|
|
|
23
23
|
@esbuild-plugins/node-globals-polyfill/Buffer.js:
|
|
@@ -39,3 +39,4 @@ lodash-es/lodash.js:
|
|
|
39
39
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
40
40
|
*)
|
|
41
41
|
*/
|
|
42
|
+
//# sourceMappingURL=DynamicSnippetsGenerator.cjs.map
|