@fern-api/typescript-dynamic-snippets 0.0.8 → 0.0.9
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 +5 -5
- package/cjs/EndpointSnippetGenerator.cjs +6 -6
- package/cjs/EndpointSnippetGenerator.d.cts +1 -0
- package/cjs/index.cjs +10 -10
- package/esm/DynamicSnippetsGenerator.js +1 -1
- package/esm/EndpointSnippetGenerator.d.ts +1 -0
- package/esm/EndpointSnippetGenerator.js +1 -1
- package/esm/{chunk-3SA25SVX.js → chunk-PXWPOKCJ.js} +1 -1
- package/esm/chunk-XXAPM4QI.js +1 -0
- package/esm/index.js +1 -1
- package/package.json +1 -1
- package/esm/chunk-DJQMPRPJ.js +0 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
"use strict";var re=Object.defineProperty;var We=Object.getOwnPropertyDescriptor;var Ve=Object.getOwnPropertyNames;var He=Object.prototype.hasOwnProperty;var Ge=(n,t,e)=>t in n?re(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var pe=(n,t)=>()=>(n&&(t=n(n=0)),t);var we=(n,t)=>{for(var e in t)re(n,e,{get:t[e],enumerable:!0})},Je=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ve(t))!He.call(n,i)&&i!==e&&re(n,i,{get:()=>t[i],enumerable:!(r=We(t,i))||r.enumerable});return n};var ze=n=>Je(re({},"__esModule",{value:!0}),n);var h=(n,t,e)=>Ge(n,typeof t!="symbol"?t+"":t,e);function ge(){throw new Error("setTimeout has not been defined")}function ve(){throw new Error("clearTimeout has not been defined")}function Ae(n){if(_===setTimeout)return setTimeout(n,0);if((_===ge||!_)&&setTimeout)return _=setTimeout,setTimeout(n,0);try{return _(n,0)}catch(t){try{return _.call(null,n,0)}catch(e){return _.call(this,n,0)}}}function Qe(n){if(C===clearTimeout)return clearTimeout(n);if((C===ve||!C)&&clearTimeout)return C=clearTimeout,clearTimeout(n);try{return C(n)}catch(t){try{return C.call(null,n)}catch(e){return C.call(this,n)}}}function Xe(){!V||!M||(V=!1,M.length?S=M.concat(S):ne=-1,S.length&&Te())}function Te(){if(!V){var n=Ae(Xe);V=!0;for(var t=S.length;t;){for(M=S,S=[];++ne<t;)M&&M[ne].run();ne=-1,t=S.length}M=null,V=!1,Qe(n)}}function Ze(n){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];S.push(new Ie(n,t)),S.length===1&&!V&&Ae(Te)}function Ie(n,t){this.fun=n,this.array=t}function O(){}function dt(n){throw new Error("process.binding is not supported")}function yt(){return"/"}function wt(n){throw new Error("process.chdir is not supported")}function xt(){return 0}function vt(n){var t=gt.call(W)*.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 Tt(){var n=new Date,t=n-At;return t/1e3}var _,C,S,V,M,ne,Ke,et,tt,rt,nt,it,ot,st,at,ut,ct,lt,pt,ht,ft,mt,W,gt,At,y,xe,l=pe(()=>{"use strict";_=ge,C=ve;typeof globalThis.setTimeout=="function"&&(_=setTimeout);typeof globalThis.clearTimeout=="function"&&(C=clearTimeout);S=[],V=!1,ne=-1;Ie.prototype.run=function(){this.fun.apply(null,this.array)};Ke="browser",et="browser",tt=!0,rt={},nt=[],it="",ot={},st={},at={};ut=O,ct=O,lt=O,pt=O,ht=O,ft=O,mt=O;W=globalThis.performance||{},gt=W.now||W.mozNow||W.msNow||W.oNow||W.webkitNow||function(){return new Date().getTime()};At=new Date;y={nextTick:Ze,title:Ke,browser:tt,env:rt,argv:nt,version:it,versions:ot,on:ut,addListener:ct,once:lt,off:pt,removeListener:ht,removeAllListeners:ft,emit:mt,binding:dt,cwd:yt,chdir:wt,umask:xt,hrtime:vt,platform:et,release:st,config:at,uptime:Tt},xe={};Object.keys(xe).forEach(n=>{let t=n.split("."),e=y;for(let r=0;r<t.length;r++){let i=t[r];r===t.length-1?e[i]=xe[n]:e=e[i]||(e[i]={})}})});function Fe(){fe=!0;for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=n.length;t<e;++t)R[t]=n[t],E[n.charCodeAt(t)]=t;E[45]=62,E[95]=63}function Et(n){fe||Fe();var t,e,r,i,o,s,u=n.length;if(u%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=n[u-2]==="="?2:n[u-1]==="="?1:0,s=new It(u*3/4-o),r=o>0?u-4:u;var c=0;for(t=0,e=0;t<r;t+=4,e+=3)i=E[n.charCodeAt(t)]<<18|E[n.charCodeAt(t+1)]<<12|E[n.charCodeAt(t+2)]<<6|E[n.charCodeAt(t+3)],s[c++]=i>>16&255,s[c++]=i>>8&255,s[c++]=i&255;return o===2?(i=E[n.charCodeAt(t)]<<2|E[n.charCodeAt(t+1)]>>4,s[c++]=i&255):o===1&&(i=E[n.charCodeAt(t)]<<10|E[n.charCodeAt(t+1)]<<4|E[n.charCodeAt(t+2)]>>2,s[c++]=i>>8&255,s[c++]=i&255),s}function bt(n){return R[n>>18&63]+R[n>>12&63]+R[n>>6&63]+R[n&63]}function Rt(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(bt(r));return i.join("")}function Ee(n){fe||Fe();for(var t,e=n.length,r=e%3,i="",o=[],s=16383,u=0,c=e-r;u<c;u+=s)o.push(Rt(n,u,u+s>c?c:u+s));return r===1?(t=n[e-1],i+=R[t>>2],i+=R[t<<4&63],i+="=="):r===2&&(t=(n[e-2]<<8)+n[e-1],i+=R[t>>10],i+=R[t>>4&63],i+=R[t<<2&63],i+="="),o.push(i),o.join("")}function ie(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function B(n,t){if(ie()<t)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(t),n.__proto__=a.prototype):(n===null&&(n=new a(t)),n.length=t),n}function a(n,t,e){if(!a.TYPED_ARRAY_SUPPORT&&!(this instanceof a))return new a(n,t,e);if(typeof n=="number"){if(typeof t=="string")throw new Error("If encoding is specified then the first argument must be a string");return me(this,n)}return Ne(this,n,t,e)}function Ne(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?Pt(n,t,e,r):typeof t=="string"?Nt(n,t,e):St(n,t)}function Pe(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 Ft(n,t,e,r){return Pe(t),t<=0?B(n,t):e!==void 0?typeof r=="string"?B(n,t).fill(e,r):B(n,t).fill(e):B(n,t)}function me(n,t){if(Pe(t),n=B(n,t<0?0:de(t)|0),!a.TYPED_ARRAY_SUPPORT)for(var e=0;e<t;++e)n[e]=0;return n}function Nt(n,t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!a.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=Se(t,e)|0;n=B(n,r);var i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function he(n,t){var e=t.length<0?0:de(t.length)|0;n=B(n,e);for(var r=0;r<e;r+=1)n[r]=t[r]&255;return n}function Pt(n,t,e,r){if(t.byteLength,e<0||t.byteLength<e)throw new RangeError("'offset' is out of bounds");if(t.byteLength<e+(r||0))throw new RangeError("'length' is out of bounds");return e===void 0&&r===void 0?t=new Uint8Array(t):r===void 0?t=new Uint8Array(t,e):t=new Uint8Array(t,e,r),a.TYPED_ARRAY_SUPPORT?(n=t,n.__proto__=a.prototype):n=he(n,t),n}function St(n,t){if(F(t)){var e=de(t.length)|0;return n=B(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"||zt(t.length)?B(n,0):he(n,t);if(t.type==="Buffer"&&Array.isArray(t.data))return he(n,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function de(n){if(n>=ie())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ie().toString(16)+" bytes");return n|0}function F(n){return!!(n!=null&&n._isBuffer)}function Se(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 oe(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return Me(n).length;default:if(r)return oe(n).length;t=(""+t).toLowerCase(),r=!0}}function Bt(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 Yt(this,t,e);case"utf8":case"utf-8":return Le(this,t,e);case"ascii":return qt(this,t,e);case"latin1":case"binary":return Dt(this,t,e);case"base64":return Mt(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return jt(this,t,e);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),r=!0}}function q(n,t,e){var r=n[t];n[t]=n[e],n[e]=r}function Be(n,t,e,r,i){if(n.length===0)return-1;if(typeof e=="string"?(r=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:n.length-1),e<0&&(e=n.length+e),e>=n.length){if(i)return-1;e=n.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof t=="string"&&(t=a.from(t,r)),F(t))return t.length===0?-1:be(n,t,e,r,i);if(typeof t=="number")return t=t&255,a.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(n,t,e):Uint8Array.prototype.lastIndexOf.call(n,t,e):be(n,[t],e,r,i);throw new TypeError("val must be string, number or Buffer")}function be(n,t,e,r,i){var o=1,s=n.length,u=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(n.length<2||t.length<2)return-1;o=2,s/=2,u/=2,e/=2}function c(A,I){return o===1?A[I]:A.readUInt16BE(I*o)}var m;if(i){var d=-1;for(m=e;m<s;m++)if(c(n,m)===c(t,d===-1?0:m-d)){if(d===-1&&(d=m),m-d+1===u)return d*o}else d!==-1&&(m-=m-d),d=-1}else for(e+u>s&&(e=s-u),m=e;m>=0;m--){for(var f=!0,x=0;x<u;x++)if(c(n,m+x)!==c(t,x)){f=!1;break}if(f)return m}return-1}function kt(n,t,e,r){e=Number(e)||0;var i=n.length-e;r?(r=Number(r),r>i&&(r=i)):r=i;var o=t.length;if(o%2!==0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s<r;++s){var u=parseInt(t.substr(s*2,2),16);if(isNaN(u))return s;n[e+s]=u}return s}function Lt(n,t,e,r){return ue(oe(t,n.length-e),n,e,r)}function ke(n,t,e,r){return ue(Gt(t),n,e,r)}function _t(n,t,e,r){return ke(n,t,e,r)}function Ct(n,t,e,r){return ue(Me(t),n,e,r)}function Ut(n,t,e,r){return ue(Jt(t,n.length-e),n,e,r)}function Mt(n,t,e){return t===0&&e===n.length?Ee(n):Ee(n.slice(t,e))}function Le(n,t,e){e=Math.min(n.length,e);for(var r=[],i=t;i<e;){var o=n[i],s=null,u=o>239?4:o>223?3:o>191?2:1;if(i+u<=e){var c,m,d,f;switch(u){case 1:o<128&&(s=o);break;case 2:c=n[i+1],(c&192)===128&&(f=(o&31)<<6|c&63,f>127&&(s=f));break;case 3:c=n[i+1],m=n[i+2],(c&192)===128&&(m&192)===128&&(f=(o&15)<<12|(c&63)<<6|m&63,f>2047&&(f<55296||f>57343)&&(s=f));break;case 4:c=n[i+1],m=n[i+2],d=n[i+3],(c&192)===128&&(m&192)===128&&(d&192)===128&&(f=(o&15)<<18|(c&63)<<12|(m&63)<<6|d&63,f>65535&&f<1114112&&(s=f))}}s===null?(s=65533,u=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|s&1023),r.push(s),i+=u}return Ot(r)}function Ot(n){var t=n.length;if(t<=Re)return String.fromCharCode.apply(String,n);for(var e="",r=0;r<t;)e+=String.fromCharCode.apply(String,n.slice(r,r+=Re));return e}function qt(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 Dt(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 Yt(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+=Ht(n[o]);return i}function jt(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 v(n,t,e){if(n%1!==0||n<0)throw new RangeError("offset is not uint");if(n+t>e)throw new RangeError("Trying to access beyond buffer length")}function T(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 se(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 ae(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 _e(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 Ce(n,t,e,r,i){return i||_e(n,t,e,4,34028234663852886e22,-34028234663852886e22),qe(n,t,e,r,23,4),e+4}function Ue(n,t,e,r,i){return i||_e(n,t,e,8,17976931348623157e292,-17976931348623157e292),qe(n,t,e,r,52,8),e+8}function Wt(n){if(n=Vt(n).replace($t,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}function Vt(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}function Ht(n){return n<16?"0"+n.toString(16):n.toString(16)}function oe(n,t){t=t||1/0;for(var e,r=n.length,i=null,o=[],s=0;s<r;++s){if(e=n.charCodeAt(s),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&o.push(239,191,189);continue}else if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&o.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;o.push(e)}else if(e<2048){if((t-=2)<0)break;o.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;o.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return o}function Gt(n){for(var t=[],e=0;e<n.length;++e)t.push(n.charCodeAt(e)&255);return t}function Jt(n,t){for(var e,r,i,o=[],s=0;s<n.length&&!((t-=2)<0);++s)e=n.charCodeAt(s),r=e>>8,i=e%256,o.push(i),o.push(r);return o}function Me(n){return Et(Wt(n))}function ue(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 zt(n){return n!==n}function Qt(n){return n!=null&&(!!n._isBuffer||Oe(n)||Xt(n))}function Oe(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function Xt(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&Oe(n.slice(0,0))}function ce(n,t,e,r,i){var o,s,u=i*8-r-1,c=(1<<u)-1,m=c>>1,d=-7,f=e?i-1:0,x=e?-1:1,A=n[t+f];for(f+=x,o=A&(1<<-d)-1,A>>=-d,d+=u;d>0;o=o*256+n[t+f],f+=x,d-=8);for(s=o&(1<<-d)-1,o>>=-d,d+=r;d>0;s=s*256+n[t+f],f+=x,d-=8);if(o===0)o=1-m;else{if(o===c)return s?NaN:(A?-1:1)*(1/0);s=s+Math.pow(2,r),o=o-m}return(A?-1:1)*s*Math.pow(2,o-r)}function qe(n,t,e,r,i,o){var s,u,c,m=o*8-i-1,d=(1<<m)-1,f=d>>1,x=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=r?0:o-1,I=r?1:-1,$e=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,s=d):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),s+f>=1?t+=x/c:t+=x*Math.pow(2,1-f),t*c>=2&&(s++,c/=2),s+f>=d?(u=0,s=d):s+f>=1?(u=(t*c-1)*Math.pow(2,i),s=s+f):(u=t*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;n[e+A]=u&255,A+=I,u/=256,i-=8);for(s=s<<i|u,m+=i;m>0;n[e+A]=s&255,A+=I,s/=256,m-=8);n[e+A-I]|=$e*128}var R,E,It,fe,Re,$t,De=pe(()=>{"use strict";l();p();R=[],E=[],It=typeof Uint8Array!="undefined"?Uint8Array:Array,fe=!1;a.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;a.poolSize=8192;a._augment=function(n){return n.__proto__=a.prototype,n};a.from=function(n,t,e){return Ne(null,n,t,e)};a.kMaxLength=ie();a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&a[Symbol.species]);a.alloc=function(n,t,e){return Ft(null,n,t,e)};a.allocUnsafe=function(n){return me(null,n)};a.allocUnsafeSlow=function(n){return me(null,n)};a.isBuffer=Qt;a.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,s=Math.min(r,i);o<s;++o)if(t[o]!==e[o]){r=t[o],i=e[o];break}return r<i?-1:i<r?1:0};a.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};a.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return a.alloc(0);var r;if(e===void 0)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var i=a.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var s=t[r];if(!F(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(i,o),o+=s.length}return i};a.byteLength=Se;a.prototype._isBuffer=!0;a.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)q(this,e,e+1);return this};a.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)q(this,e,e+3),q(this,e+1,e+2);return this};a.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)q(this,e,e+7),q(this,e+1,e+6),q(this,e+2,e+5),q(this,e+3,e+4);return this};a.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?Le(this,0,t):Bt.apply(this,arguments)};a.prototype.equals=function(t){if(!F(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:a.compare(this,t)===0};a.prototype.compare=function(t,e,r,i,o){if(!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 s=o-i,u=r-e,c=Math.min(s,u),m=this.slice(i,o),d=t.slice(e,r),f=0;f<c;++f)if(m[f]!==d[f]){s=m[f],u=d[f];break}return s<u?-1:u<s?1:0};a.prototype.includes=function(t,e,r){return this.indexOf(t,e,r)!==-1};a.prototype.indexOf=function(t,e,r){return Be(this,t,e,r,!0)};a.prototype.lastIndexOf=function(t,e,r){return Be(this,t,e,r,!1)};a.prototype.write=function(t,e,r,i){if(e===void 0)i="utf8",r=this.length,e=0;else if(r===void 0&&typeof e=="string")i=e,r=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(r)?(r=r|0,i===void 0&&(i="utf8")):(i=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-e;if((r===void 0||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return kt(this,t,e,r);case"utf8":case"utf-8":return Lt(this,t,e,r);case"ascii":return ke(this,t,e,r);case"latin1":case"binary":return _t(this,t,e,r);case"base64":return Ct(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ut(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};Re=4096;a.prototype.slice=function(t,e){var r=this.length;t=~~t,e=e===void 0?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e<t&&(e=t);var i;if(a.TYPED_ARRAY_SUPPORT)i=this.subarray(t,e),i.__proto__=a.prototype;else{var o=e-t;i=new a(o,void 0);for(var s=0;s<o;++s)i[s]=this[s+t]}return i};a.prototype.readUIntLE=function(t,e,r){t=t|0,e=e|0,r||v(t,e,this.length);for(var i=this[t],o=1,s=0;++s<e&&(o*=256);)i+=this[t+s]*o;return i};a.prototype.readUIntBE=function(t,e,r){t=t|0,e=e|0,r||v(t,e,this.length);for(var i=this[t+--e],o=1;e>0&&(o*=256);)i+=this[t+--e]*o;return i};a.prototype.readUInt8=function(t,e){return e||v(t,1,this.length),this[t]};a.prototype.readUInt16LE=function(t,e){return e||v(t,2,this.length),this[t]|this[t+1]<<8};a.prototype.readUInt16BE=function(t,e){return e||v(t,2,this.length),this[t]<<8|this[t+1]};a.prototype.readUInt32LE=function(t,e){return e||v(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};a.prototype.readUInt32BE=function(t,e){return e||v(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};a.prototype.readIntLE=function(t,e,r){t=t|0,e=e|0,r||v(t,e,this.length);for(var i=this[t],o=1,s=0;++s<e&&(o*=256);)i+=this[t+s]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i};a.prototype.readIntBE=function(t,e,r){t=t|0,e=e|0,r||v(t,e,this.length);for(var i=e,o=1,s=this[t+--i];i>0&&(o*=256);)s+=this[t+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*e)),s};a.prototype.readInt8=function(t,e){return e||v(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};a.prototype.readInt16LE=function(t,e){e||v(t,2,this.length);var r=this[t]|this[t+1]<<8;return r&32768?r|4294901760:r};a.prototype.readInt16BE=function(t,e){e||v(t,2,this.length);var r=this[t+1]|this[t]<<8;return r&32768?r|4294901760:r};a.prototype.readInt32LE=function(t,e){return e||v(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};a.prototype.readInt32BE=function(t,e){return e||v(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};a.prototype.readFloatLE=function(t,e){return e||v(t,4,this.length),ce(this,t,!0,23,4)};a.prototype.readFloatBE=function(t,e){return e||v(t,4,this.length),ce(this,t,!1,23,4)};a.prototype.readDoubleLE=function(t,e){return e||v(t,8,this.length),ce(this,t,!0,52,8)};a.prototype.readDoubleBE=function(t,e){return e||v(t,8,this.length),ce(this,t,!1,52,8)};a.prototype.writeUIntLE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var o=Math.pow(2,8*r)-1;T(this,t,e,r,o,0)}var s=1,u=0;for(this[e]=t&255;++u<r&&(s*=256);)this[e+u]=t/s&255;return e+r};a.prototype.writeUIntBE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var o=Math.pow(2,8*r)-1;T(this,t,e,r,o,0)}var s=r-1,u=1;for(this[e+s]=t&255;--s>=0&&(u*=256);)this[e+s]=t/u&255;return e+r};a.prototype.writeUInt8=function(t,e,r){return t=+t,e=e|0,r||T(this,t,e,1,255,0),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=t&255,e+1};a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=e|0,r||T(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):se(this,t,e,!0),e+2};a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=e|0,r||T(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):se(this,t,e,!1),e+2};a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=e|0,r||T(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255):ae(this,t,e,!0),e+4};a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=e|0,r||T(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):ae(this,t,e,!1),e+4};a.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e=e|0,!i){var o=Math.pow(2,8*r-1);T(this,t,e,r,o-1,-o)}var s=0,u=1,c=0;for(this[e]=t&255;++s<r&&(u*=256);)t<0&&c===0&&this[e+s-1]!==0&&(c=1),this[e+s]=(t/u>>0)-c&255;return e+r};a.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e=e|0,!i){var o=Math.pow(2,8*r-1);T(this,t,e,r,o-1,-o)}var s=r-1,u=1,c=0;for(this[e+s]=t&255;--s>=0&&(u*=256);)t<0&&c===0&&this[e+s+1]!==0&&(c=1),this[e+s]=(t/u>>0)-c&255;return e+r};a.prototype.writeInt8=function(t,e,r){return t=+t,e=e|0,r||T(this,t,e,1,127,-128),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=t&255,e+1};a.prototype.writeInt16LE=function(t,e,r){return t=+t,e=e|0,r||T(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):se(this,t,e,!0),e+2};a.prototype.writeInt16BE=function(t,e,r){return t=+t,e=e|0,r||T(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):se(this,t,e,!1),e+2};a.prototype.writeInt32LE=function(t,e,r){return t=+t,e=e|0,r||T(this,t,e,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):ae(this,t,e,!0),e+4};a.prototype.writeInt32BE=function(t,e,r){return t=+t,e=e|0,r||T(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):ae(this,t,e,!1),e+4};a.prototype.writeFloatLE=function(t,e,r){return Ce(this,t,e,!0,r)};a.prototype.writeFloatBE=function(t,e,r){return Ce(this,t,e,!1,r)};a.prototype.writeDoubleLE=function(t,e,r){return Ue(this,t,e,!0,r)};a.prototype.writeDoubleBE=function(t,e,r){return Ue(this,t,e,!1,r)};a.prototype.copy=function(t,e,r,i){if(r||(r=0),!i&&i!==0&&(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<r&&(i=r),i===r||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);var o=i-r,s;if(this===t&&r<e&&e<i)for(s=o-1;s>=0;--s)t[s+e]=this[s+r];else if(o<1e3||!a.TYPED_ARRAY_SUPPORT)for(s=0;s<o;++s)t[s+e]=this[s+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o};a.prototype.fill=function(t,e,r,i){if(typeof t=="string"){if(typeof e=="string"?(i=e,e=0,r=this.length):typeof r=="string"&&(i=r,r=this.length),t.length===1){var o=t.charCodeAt(0);o<256&&(t=o)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!a.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof t=="number"&&(t=t&255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;e=e>>>0,r=r===void 0?this.length:r>>>0,t||(t=0);var s;if(typeof t=="number")for(s=e;s<r;++s)this[s]=t;else{var u=F(t)?t:oe(new a(t,i).toString()),c=u.length;for(s=0;s<r-e;++s)this[s+e]=u[s%c]}return this};$t=/[^+\/0-9A-Za-z-_]/g});var p=pe(()=>{"use strict";De()});var hr={};we(hr,{EndpointSnippetGenerator:()=>ye});module.exports=ze(hr);l();p();l();p();l();p();function b(n){throw new Error("Unexpected value: "+JSON.stringify(n))}l();p();l();p();var D=class{};l();p();l();p();var N=class extends D{constructor(e){super();h(this,"value");this.value=e}write(e){typeof this.value=="string"?e.write(this.value):this.value(e)}};var Zt=4,K=class{constructor(){h(this,"buffer","");h(this,"indentLevel",0);h(this,"hasWrittenAnything",!1);h(this,"lastCharacterIsNewline",!1)}write(t){let e=t.length>0&&t.endsWith(`
|
|
1
|
+
"use strict";var re=Object.defineProperty;var We=Object.getOwnPropertyDescriptor;var Ve=Object.getOwnPropertyNames;var He=Object.prototype.hasOwnProperty;var Ge=(n,t,e)=>t in n?re(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var le=(n,t)=>()=>(n&&(t=n(n=0)),t);var we=(n,t)=>{for(var e in t)re(n,e,{get:t[e],enumerable:!0})},Je=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ve(t))!He.call(n,i)&&i!==e&&re(n,i,{get:()=>t[i],enumerable:!(r=We(t,i))||r.enumerable});return n};var ze=n=>Je(re({},"__esModule",{value:!0}),n);var h=(n,t,e)=>Ge(n,typeof t!="symbol"?t+"":t,e);function ge(){throw new Error("setTimeout has not been defined")}function ve(){throw new Error("clearTimeout has not been defined")}function Ae(n){if(_===setTimeout)return setTimeout(n,0);if((_===ge||!_)&&setTimeout)return _=setTimeout,setTimeout(n,0);try{return _(n,0)}catch(t){try{return _.call(null,n,0)}catch(e){return _.call(this,n,0)}}}function Qe(n){if(C===clearTimeout)return clearTimeout(n);if((C===ve||!C)&&clearTimeout)return C=clearTimeout,clearTimeout(n);try{return C(n)}catch(t){try{return C.call(null,n)}catch(e){return C.call(this,n)}}}function Xe(){!V||!M||(V=!1,M.length?B=M.concat(B):ne=-1,B.length&&Te())}function Te(){if(!V){var n=Ae(Xe);V=!0;for(var t=B.length;t;){for(M=B,B=[];++ne<t;)M&&M[ne].run();ne=-1,t=B.length}M=null,V=!1,Qe(n)}}function Ze(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];B.push(new Ie(n,t)),B.length===1&&!V&&Ae(Te)}function Ie(n,t){this.fun=n,this.array=t}function O(){}function dt(n){throw new Error("process.binding is not supported")}function yt(){return"/"}function wt(n){throw new Error("process.chdir is not supported")}function xt(){return 0}function vt(n){var t=gt.call(W)*.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 Tt(){var n=new Date,t=n-At;return t/1e3}var _,C,B,V,M,ne,Ke,et,tt,rt,nt,it,ot,st,at,ut,ct,pt,lt,ht,ft,mt,W,gt,At,y,xe,p=le(()=>{"use strict";_=ge,C=ve;typeof globalThis.setTimeout=="function"&&(_=setTimeout);typeof globalThis.clearTimeout=="function"&&(C=clearTimeout);B=[],V=!1,ne=-1;Ie.prototype.run=function(){this.fun.apply(null,this.array)};Ke="browser",et="browser",tt=!0,rt={},nt=[],it="",ot={},st={},at={};ut=O,ct=O,pt=O,lt=O,ht=O,ft=O,mt=O;W=globalThis.performance||{},gt=W.now||W.mozNow||W.msNow||W.oNow||W.webkitNow||function(){return new Date().getTime()};At=new Date;y={nextTick:Ze,title:Ke,browser:tt,env:rt,argv:nt,version:it,versions:ot,on:ut,addListener:ct,once:pt,off:lt,removeListener:ht,removeAllListeners:ft,emit:mt,binding:dt,cwd:yt,chdir:wt,umask:xt,hrtime:vt,platform:et,release:st,config:at,uptime:Tt},xe={};Object.keys(xe).forEach(n=>{let t=n.split("."),e=y;for(let r=0;r<t.length;r++){let i=t[r];r===t.length-1?e[i]=xe[n]:e=e[i]||(e[i]={})}})});function Fe(){fe=!0;for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=n.length;t<e;++t)F[t]=n[t],E[n.charCodeAt(t)]=t;E[45]=62,E[95]=63}function Et(n){fe||Fe();var t,e,r,i,o,s,u=n.length;if(u%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=n[u-2]==="="?2:n[u-1]==="="?1:0,s=new It(u*3/4-o),r=o>0?u-4:u;var c=0;for(t=0,e=0;t<r;t+=4,e+=3)i=E[n.charCodeAt(t)]<<18|E[n.charCodeAt(t+1)]<<12|E[n.charCodeAt(t+2)]<<6|E[n.charCodeAt(t+3)],s[c++]=i>>16&255,s[c++]=i>>8&255,s[c++]=i&255;return o===2?(i=E[n.charCodeAt(t)]<<2|E[n.charCodeAt(t+1)]>>4,s[c++]=i&255):o===1&&(i=E[n.charCodeAt(t)]<<10|E[n.charCodeAt(t+1)]<<4|E[n.charCodeAt(t+2)]>>2,s[c++]=i>>8&255,s[c++]=i&255),s}function bt(n){return F[n>>18&63]+F[n>>12&63]+F[n>>6&63]+F[n&63]}function Rt(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(bt(r));return i.join("")}function Ee(n){fe||Fe();for(var t,e=n.length,r=e%3,i="",o=[],s=16383,u=0,c=e-r;u<c;u+=s)o.push(Rt(n,u,u+s>c?c:u+s));return r===1?(t=n[e-1],i+=F[t>>2],i+=F[t<<4&63],i+="=="):r===2&&(t=(n[e-2]<<8)+n[e-1],i+=F[t>>10],i+=F[t>>4&63],i+=F[t<<2&63],i+="="),o.push(i),o.join("")}function ie(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function k(n,t){if(ie()<t)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(t),n.__proto__=a.prototype):(n===null&&(n=new a(t)),n.length=t),n}function a(n,t,e){if(!a.TYPED_ARRAY_SUPPORT&&!(this instanceof a))return new a(n,t,e);if(typeof n=="number"){if(typeof t=="string")throw new Error("If encoding is specified then the first argument must be a string");return me(this,n)}return Ne(this,n,t,e)}function Ne(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?Pt(n,t,e,r):typeof t=="string"?Nt(n,t,e):St(n,t)}function Pe(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 Ft(n,t,e,r){return Pe(t),t<=0?k(n,t):e!==void 0?typeof r=="string"?k(n,t).fill(e,r):k(n,t).fill(e):k(n,t)}function me(n,t){if(Pe(t),n=k(n,t<0?0:de(t)|0),!a.TYPED_ARRAY_SUPPORT)for(var e=0;e<t;++e)n[e]=0;return n}function Nt(n,t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!a.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=Se(t,e)|0;n=k(n,r);var i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function he(n,t){var e=t.length<0?0:de(t.length)|0;n=k(n,e);for(var r=0;r<e;r+=1)n[r]=t[r]&255;return n}function Pt(n,t,e,r){if(t.byteLength,e<0||t.byteLength<e)throw new RangeError("'offset' is out of bounds");if(t.byteLength<e+(r||0))throw new RangeError("'length' is out of bounds");return e===void 0&&r===void 0?t=new Uint8Array(t):r===void 0?t=new Uint8Array(t,e):t=new Uint8Array(t,e,r),a.TYPED_ARRAY_SUPPORT?(n=t,n.__proto__=a.prototype):n=he(n,t),n}function St(n,t){if(N(t)){var e=de(t.length)|0;return n=k(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"||zt(t.length)?k(n,0):he(n,t);if(t.type==="Buffer"&&Array.isArray(t.data))return he(n,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function de(n){if(n>=ie())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ie().toString(16)+" bytes");return n|0}function N(n){return!!(n!=null&&n._isBuffer)}function Se(n,t){if(N(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 oe(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return Me(n).length;default:if(r)return oe(n).length;t=(""+t).toLowerCase(),r=!0}}function Bt(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 Yt(this,t,e);case"utf8":case"utf-8":return Le(this,t,e);case"ascii":return qt(this,t,e);case"latin1":case"binary":return Dt(this,t,e);case"base64":return Mt(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return jt(this,t,e);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),r=!0}}function q(n,t,e){var r=n[t];n[t]=n[e],n[e]=r}function Be(n,t,e,r,i){if(n.length===0)return-1;if(typeof e=="string"?(r=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:n.length-1),e<0&&(e=n.length+e),e>=n.length){if(i)return-1;e=n.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof t=="string"&&(t=a.from(t,r)),N(t))return t.length===0?-1:be(n,t,e,r,i);if(typeof t=="number")return t=t&255,a.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(n,t,e):Uint8Array.prototype.lastIndexOf.call(n,t,e):be(n,[t],e,r,i);throw new TypeError("val must be string, number or Buffer")}function be(n,t,e,r,i){var o=1,s=n.length,u=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(n.length<2||t.length<2)return-1;o=2,s/=2,u/=2,e/=2}function c(A,I){return o===1?A[I]:A.readUInt16BE(I*o)}var m;if(i){var d=-1;for(m=e;m<s;m++)if(c(n,m)===c(t,d===-1?0:m-d)){if(d===-1&&(d=m),m-d+1===u)return d*o}else d!==-1&&(m-=m-d),d=-1}else for(e+u>s&&(e=s-u),m=e;m>=0;m--){for(var f=!0,g=0;g<u;g++)if(c(n,m+g)!==c(t,g)){f=!1;break}if(f)return m}return-1}function kt(n,t,e,r){e=Number(e)||0;var i=n.length-e;r?(r=Number(r),r>i&&(r=i)):r=i;var o=t.length;if(o%2!==0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s<r;++s){var u=parseInt(t.substr(s*2,2),16);if(isNaN(u))return s;n[e+s]=u}return s}function Lt(n,t,e,r){return ue(oe(t,n.length-e),n,e,r)}function ke(n,t,e,r){return ue(Gt(t),n,e,r)}function _t(n,t,e,r){return ke(n,t,e,r)}function Ct(n,t,e,r){return ue(Me(t),n,e,r)}function Ut(n,t,e,r){return ue(Jt(t,n.length-e),n,e,r)}function Mt(n,t,e){return t===0&&e===n.length?Ee(n):Ee(n.slice(t,e))}function Le(n,t,e){e=Math.min(n.length,e);for(var r=[],i=t;i<e;){var o=n[i],s=null,u=o>239?4:o>223?3:o>191?2:1;if(i+u<=e){var c,m,d,f;switch(u){case 1:o<128&&(s=o);break;case 2:c=n[i+1],(c&192)===128&&(f=(o&31)<<6|c&63,f>127&&(s=f));break;case 3:c=n[i+1],m=n[i+2],(c&192)===128&&(m&192)===128&&(f=(o&15)<<12|(c&63)<<6|m&63,f>2047&&(f<55296||f>57343)&&(s=f));break;case 4:c=n[i+1],m=n[i+2],d=n[i+3],(c&192)===128&&(m&192)===128&&(d&192)===128&&(f=(o&15)<<18|(c&63)<<12|(m&63)<<6|d&63,f>65535&&f<1114112&&(s=f))}}s===null?(s=65533,u=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|s&1023),r.push(s),i+=u}return Ot(r)}function Ot(n){var t=n.length;if(t<=Re)return String.fromCharCode.apply(String,n);for(var e="",r=0;r<t;)e+=String.fromCharCode.apply(String,n.slice(r,r+=Re));return e}function qt(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 Dt(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 Yt(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+=Ht(n[o]);return i}function jt(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 v(n,t,e){if(n%1!==0||n<0)throw new RangeError("offset is not uint");if(n+t>e)throw new RangeError("Trying to access beyond buffer length")}function T(n,t,e,r,i,o){if(!N(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 se(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 ae(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 _e(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 Ce(n,t,e,r,i){return i||_e(n,t,e,4,34028234663852886e22,-34028234663852886e22),qe(n,t,e,r,23,4),e+4}function Ue(n,t,e,r,i){return i||_e(n,t,e,8,17976931348623157e292,-17976931348623157e292),qe(n,t,e,r,52,8),e+8}function Wt(n){if(n=Vt(n).replace($t,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}function Vt(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}function Ht(n){return n<16?"0"+n.toString(16):n.toString(16)}function oe(n,t){t=t||1/0;for(var e,r=n.length,i=null,o=[],s=0;s<r;++s){if(e=n.charCodeAt(s),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&o.push(239,191,189);continue}else if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&o.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;o.push(e)}else if(e<2048){if((t-=2)<0)break;o.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;o.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return o}function Gt(n){for(var t=[],e=0;e<n.length;++e)t.push(n.charCodeAt(e)&255);return t}function Jt(n,t){for(var e,r,i,o=[],s=0;s<n.length&&!((t-=2)<0);++s)e=n.charCodeAt(s),r=e>>8,i=e%256,o.push(i),o.push(r);return o}function Me(n){return Et(Wt(n))}function ue(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 zt(n){return n!==n}function Qt(n){return n!=null&&(!!n._isBuffer||Oe(n)||Xt(n))}function Oe(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function Xt(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&Oe(n.slice(0,0))}function ce(n,t,e,r,i){var o,s,u=i*8-r-1,c=(1<<u)-1,m=c>>1,d=-7,f=e?i-1:0,g=e?-1:1,A=n[t+f];for(f+=g,o=A&(1<<-d)-1,A>>=-d,d+=u;d>0;o=o*256+n[t+f],f+=g,d-=8);for(s=o&(1<<-d)-1,o>>=-d,d+=r;d>0;s=s*256+n[t+f],f+=g,d-=8);if(o===0)o=1-m;else{if(o===c)return s?NaN:(A?-1:1)*(1/0);s=s+Math.pow(2,r),o=o-m}return(A?-1:1)*s*Math.pow(2,o-r)}function qe(n,t,e,r,i,o){var s,u,c,m=o*8-i-1,d=(1<<m)-1,f=d>>1,g=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=r?0:o-1,I=r?1:-1,$e=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,s=d):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),s+f>=1?t+=g/c:t+=g*Math.pow(2,1-f),t*c>=2&&(s++,c/=2),s+f>=d?(u=0,s=d):s+f>=1?(u=(t*c-1)*Math.pow(2,i),s=s+f):(u=t*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;n[e+A]=u&255,A+=I,u/=256,i-=8);for(s=s<<i|u,m+=i;m>0;n[e+A]=s&255,A+=I,s/=256,m-=8);n[e+A-I]|=$e*128}var F,E,It,fe,Re,$t,De=le(()=>{"use strict";p();l();F=[],E=[],It=typeof Uint8Array!="undefined"?Uint8Array:Array,fe=!1;a.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;a.poolSize=8192;a._augment=function(n){return n.__proto__=a.prototype,n};a.from=function(n,t,e){return Ne(null,n,t,e)};a.kMaxLength=ie();a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&a[Symbol.species]);a.alloc=function(n,t,e){return Ft(null,n,t,e)};a.allocUnsafe=function(n){return me(null,n)};a.allocUnsafeSlow=function(n){return me(null,n)};a.isBuffer=Qt;a.compare=function(t,e){if(!N(t)||!N(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,i=e.length,o=0,s=Math.min(r,i);o<s;++o)if(t[o]!==e[o]){r=t[o],i=e[o];break}return r<i?-1:i<r?1:0};a.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};a.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return a.alloc(0);var r;if(e===void 0)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var i=a.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var s=t[r];if(!N(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(i,o),o+=s.length}return i};a.byteLength=Se;a.prototype._isBuffer=!0;a.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)q(this,e,e+1);return this};a.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)q(this,e,e+3),q(this,e+1,e+2);return this};a.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)q(this,e,e+7),q(this,e+1,e+6),q(this,e+2,e+5),q(this,e+3,e+4);return this};a.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?Le(this,0,t):Bt.apply(this,arguments)};a.prototype.equals=function(t){if(!N(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:a.compare(this,t)===0};a.prototype.compare=function(t,e,r,i,o){if(!N(t))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),r===void 0&&(r=t?t.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),e<0||r>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&e>=r)return 0;if(i>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,i>>>=0,o>>>=0,this===t)return 0;for(var s=o-i,u=r-e,c=Math.min(s,u),m=this.slice(i,o),d=t.slice(e,r),f=0;f<c;++f)if(m[f]!==d[f]){s=m[f],u=d[f];break}return s<u?-1:u<s?1:0};a.prototype.includes=function(t,e,r){return this.indexOf(t,e,r)!==-1};a.prototype.indexOf=function(t,e,r){return Be(this,t,e,r,!0)};a.prototype.lastIndexOf=function(t,e,r){return Be(this,t,e,r,!1)};a.prototype.write=function(t,e,r,i){if(e===void 0)i="utf8",r=this.length,e=0;else if(r===void 0&&typeof e=="string")i=e,r=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(r)?(r=r|0,i===void 0&&(i="utf8")):(i=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-e;if((r===void 0||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return kt(this,t,e,r);case"utf8":case"utf-8":return Lt(this,t,e,r);case"ascii":return ke(this,t,e,r);case"latin1":case"binary":return _t(this,t,e,r);case"base64":return Ct(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ut(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};Re=4096;a.prototype.slice=function(t,e){var r=this.length;t=~~t,e=e===void 0?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e<t&&(e=t);var i;if(a.TYPED_ARRAY_SUPPORT)i=this.subarray(t,e),i.__proto__=a.prototype;else{var o=e-t;i=new a(o,void 0);for(var s=0;s<o;++s)i[s]=this[s+t]}return i};a.prototype.readUIntLE=function(t,e,r){t=t|0,e=e|0,r||v(t,e,this.length);for(var i=this[t],o=1,s=0;++s<e&&(o*=256);)i+=this[t+s]*o;return i};a.prototype.readUIntBE=function(t,e,r){t=t|0,e=e|0,r||v(t,e,this.length);for(var i=this[t+--e],o=1;e>0&&(o*=256);)i+=this[t+--e]*o;return i};a.prototype.readUInt8=function(t,e){return e||v(t,1,this.length),this[t]};a.prototype.readUInt16LE=function(t,e){return e||v(t,2,this.length),this[t]|this[t+1]<<8};a.prototype.readUInt16BE=function(t,e){return e||v(t,2,this.length),this[t]<<8|this[t+1]};a.prototype.readUInt32LE=function(t,e){return e||v(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};a.prototype.readUInt32BE=function(t,e){return e||v(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};a.prototype.readIntLE=function(t,e,r){t=t|0,e=e|0,r||v(t,e,this.length);for(var i=this[t],o=1,s=0;++s<e&&(o*=256);)i+=this[t+s]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i};a.prototype.readIntBE=function(t,e,r){t=t|0,e=e|0,r||v(t,e,this.length);for(var i=e,o=1,s=this[t+--i];i>0&&(o*=256);)s+=this[t+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*e)),s};a.prototype.readInt8=function(t,e){return e||v(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};a.prototype.readInt16LE=function(t,e){e||v(t,2,this.length);var r=this[t]|this[t+1]<<8;return r&32768?r|4294901760:r};a.prototype.readInt16BE=function(t,e){e||v(t,2,this.length);var r=this[t+1]|this[t]<<8;return r&32768?r|4294901760:r};a.prototype.readInt32LE=function(t,e){return e||v(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};a.prototype.readInt32BE=function(t,e){return e||v(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};a.prototype.readFloatLE=function(t,e){return e||v(t,4,this.length),ce(this,t,!0,23,4)};a.prototype.readFloatBE=function(t,e){return e||v(t,4,this.length),ce(this,t,!1,23,4)};a.prototype.readDoubleLE=function(t,e){return e||v(t,8,this.length),ce(this,t,!0,52,8)};a.prototype.readDoubleBE=function(t,e){return e||v(t,8,this.length),ce(this,t,!1,52,8)};a.prototype.writeUIntLE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var o=Math.pow(2,8*r)-1;T(this,t,e,r,o,0)}var s=1,u=0;for(this[e]=t&255;++u<r&&(s*=256);)this[e+u]=t/s&255;return e+r};a.prototype.writeUIntBE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var o=Math.pow(2,8*r)-1;T(this,t,e,r,o,0)}var s=r-1,u=1;for(this[e+s]=t&255;--s>=0&&(u*=256);)this[e+s]=t/u&255;return e+r};a.prototype.writeUInt8=function(t,e,r){return t=+t,e=e|0,r||T(this,t,e,1,255,0),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=t&255,e+1};a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=e|0,r||T(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):se(this,t,e,!0),e+2};a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=e|0,r||T(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):se(this,t,e,!1),e+2};a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=e|0,r||T(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255):ae(this,t,e,!0),e+4};a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=e|0,r||T(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):ae(this,t,e,!1),e+4};a.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e=e|0,!i){var o=Math.pow(2,8*r-1);T(this,t,e,r,o-1,-o)}var s=0,u=1,c=0;for(this[e]=t&255;++s<r&&(u*=256);)t<0&&c===0&&this[e+s-1]!==0&&(c=1),this[e+s]=(t/u>>0)-c&255;return e+r};a.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e=e|0,!i){var o=Math.pow(2,8*r-1);T(this,t,e,r,o-1,-o)}var s=r-1,u=1,c=0;for(this[e+s]=t&255;--s>=0&&(u*=256);)t<0&&c===0&&this[e+s+1]!==0&&(c=1),this[e+s]=(t/u>>0)-c&255;return e+r};a.prototype.writeInt8=function(t,e,r){return t=+t,e=e|0,r||T(this,t,e,1,127,-128),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=t&255,e+1};a.prototype.writeInt16LE=function(t,e,r){return t=+t,e=e|0,r||T(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):se(this,t,e,!0),e+2};a.prototype.writeInt16BE=function(t,e,r){return t=+t,e=e|0,r||T(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):se(this,t,e,!1),e+2};a.prototype.writeInt32LE=function(t,e,r){return t=+t,e=e|0,r||T(this,t,e,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):ae(this,t,e,!0),e+4};a.prototype.writeInt32BE=function(t,e,r){return t=+t,e=e|0,r||T(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):ae(this,t,e,!1),e+4};a.prototype.writeFloatLE=function(t,e,r){return Ce(this,t,e,!0,r)};a.prototype.writeFloatBE=function(t,e,r){return Ce(this,t,e,!1,r)};a.prototype.writeDoubleLE=function(t,e,r){return Ue(this,t,e,!0,r)};a.prototype.writeDoubleBE=function(t,e,r){return Ue(this,t,e,!1,r)};a.prototype.copy=function(t,e,r,i){if(r||(r=0),!i&&i!==0&&(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<r&&(i=r),i===r||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);var o=i-r,s;if(this===t&&r<e&&e<i)for(s=o-1;s>=0;--s)t[s+e]=this[s+r];else if(o<1e3||!a.TYPED_ARRAY_SUPPORT)for(s=0;s<o;++s)t[s+e]=this[s+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o};a.prototype.fill=function(t,e,r,i){if(typeof t=="string"){if(typeof e=="string"?(i=e,e=0,r=this.length):typeof r=="string"&&(i=r,r=this.length),t.length===1){var o=t.charCodeAt(0);o<256&&(t=o)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!a.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof t=="number"&&(t=t&255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;e=e>>>0,r=r===void 0?this.length:r>>>0,t||(t=0);var s;if(typeof t=="number")for(s=e;s<r;++s)this[s]=t;else{var u=N(t)?t:oe(new a(t,i).toString()),c=u.length;for(s=0;s<r-e;++s)this[s+e]=u[s%c]}return this};$t=/[^+\/0-9A-Za-z-_]/g});var l=le(()=>{"use strict";De()});var hr={};we(hr,{EndpointSnippetGenerator:()=>ye});module.exports=ze(hr);p();l();p();l();p();l();function b(n){throw new Error("Unexpected value: "+JSON.stringify(n))}p();l();p();l();var D=class{};p();l();p();l();var P=class extends D{constructor(e){super();h(this,"value");this.value=e}write(e){typeof this.value=="string"?e.write(this.value):this.value(e)}};var Zt=4,K=class{constructor(){h(this,"buffer","");h(this,"indentLevel",0);h(this,"hasWrittenAnything",!1);h(this,"lastCharacterIsNewline",!1)}write(t){let e=t.length>0&&t.endsWith(`
|
|
2
2
|
`),r=e?t.substring(0,t.length-1):t,i=this.getIndentString(),o=r.replaceAll(`
|
|
3
3
|
`,`
|
|
4
4
|
${i}`);this.isAtStartOfLine()&&(o=i+o),e&&(o+=`
|
|
5
|
-
`),this.writeInternal(o)}writeNoIndent(t){let e=this.indentLevel;this.indentLevel=0,this.write(t),this.indentLevel=e}writeNode(t){t.write(this)}writeNodeOrString(t){if(typeof t=="string"){this.write(t);return}this.writeNode(t)}writeNodeStatement(t){t.write(this),this.write(";"),this.writeNewLineIfLastLineNot()}writeTextStatement(t){new
|
|
5
|
+
`),this.writeInternal(o)}writeNoIndent(t){let e=this.indentLevel;this.indentLevel=0,this.write(t),this.indentLevel=e}writeNode(t){t.write(this)}writeNodeOrString(t){if(typeof t=="string"){this.write(t);return}this.writeNode(t)}writeNodeStatement(t){t.write(this),this.write(";"),this.writeNewLineIfLastLineNot()}writeTextStatement(t){new P(t).write(this),this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(t,e){new P(t).write(this),this.write(" ("),this.writeNode(e),this.write(") {"),this.writeNewLineIfLastLineNot(),this.indent()}endControlFlow(){this.dedent(),this.writeLine("}")}contiguousControlFlow(t,e){this.dedent(),this.write("} "),new P(t).write(this),this.write(" ("),this.writeNode(e),this.write(") {"),this.writeNewLineIfLastLineNot(),this.indent()}alternativeControlFlow(t){this.dedent(),this.write("} "),new P(t).write(this),this.write(" {"),this.writeNewLineIfLastLineNot(),this.indent()}openBlock(t,e="{",r,i="}"){let o=t.filter(s=>s!==void 0).join(" ");o?this.write(`${o} ${e!=null?e:""}`):this.write(e!=null?e:"");try{this.indent(),r(),this.dedent()}finally{this.write(i!=null?i:"")}}writeLine(t=""){this.write(t),this.writeNewLineIfLastLineNot()}newLine(){this.writeInternal(`
|
|
6
6
|
`)}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
|
|
7
7
|
`)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:t,delimiter:e,writeFunction:r}){if(t.length>0){let i=t[0];i!=null&&r(i);for(let o=1;o<t.length;o++){this.write(e);let s=t[o];s!=null&&r(s)}}}toString(){return this.buffer}writeInternal(t){return t.length>0&&(this.hasWrittenAnything=!0,this.lastCharacterIsNewline=t.endsWith(`
|
|
8
|
-
`)),this.buffer+=t}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*Zt)}};
|
|
8
|
+
`)),this.buffer+=t}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*Zt)}};p();l();var pe=class{},ee=class extends pe{async format(t){return t}formatSync(t){return t}};p();l();p();l();var S={Critical:"CRITICAL",Warning:"WARNING"};p();l();var R={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};p();l();var w={};we(w,{AstNode:()=>x,ClassInstantiation:()=>Z,CodeBlock:()=>H,Comment:()=>U,Function:()=>z,FunctionInvocation:()=>Q,MethodInvocation:()=>X,Parameter:()=>J,Reference:()=>$,Type:()=>j,TypeLiteral:()=>L,Types:()=>j,Variable:()=>G,Writer:()=>Y,codeblock:()=>nr,function_:()=>ir,instantiateClass:()=>or,invokeFunction:()=>sr,invokeMethod:()=>ar,parameter:()=>ur,reference:()=>cr,variable:()=>pr});p();l();p();l();p();l();p();l();p();l();p();l();var Y=class extends K{constructor({customConfig:e,formatter:r}){super();h(this,"customConfig");h(this,"formatter");h(this,"imports",{});h(this,"defaultImports",{});h(this,"starImportAliases",{});h(this,"starImportAliasesInverse",{});this.customConfig=e,this.formatter=r!=null?r:new ee}addImport(e){var r,i,o;if(e.importFrom!=null){switch(e.importFrom.type){case"default":{this.validateDefault(e);break}case"named":{this.validateNamed(e);break}case"star":{this.validateStar(e);break}}let s=(o=(r=this.imports)[i=e.importFrom.moduleName])!=null?o:r[i]=[];s.map(c=>c.name).includes(e.name)||s.push(e)}}validateDefault(e){var i,o,s,u;if(((i=e.importFrom)==null?void 0:i.type)!=="default")return;let r=(u=(o=this.defaultImports)[s=e.importFrom.moduleName])!=null?u:o[s]=e;if(r.name!==e.name)throw new Error(`Cannot have multiple default imports for module ${e.importFrom.moduleName}: got ${e.name} but already had ${r.name}`)}validateNamed(e){var s,u,c,m,d;if(((s=e.importFrom)==null?void 0:s.type)!=="named")return;let i=((u=this.imports[e.importFrom.moduleName])!=null?u:[]).filter(f=>{var g;return((g=f.importFrom)==null?void 0:g.type)==="star"});if(i.length>0)throw new Error(`Cannot add named import ${e.name} because non-named imports ${i.map(f=>f.name)} already exist`);let o=[];for(let f of Object.values(this.imports))for(let g of f)((c=g.importFrom)==null?void 0:c.type)==="named"&&g.importFrom.moduleName!==e.importFrom.moduleName&&g.name===e.name&&o.push(g);if(o.length>0)throw new Error(`Cannot add named import from module ${e.importFrom.moduleName} because it is already imported from ${(d=(m=o[0])==null?void 0:m.importFrom)==null?void 0:d.moduleName}`)}validateStar(e){var o,s,u,c,m,d,f;if(((o=e.importFrom)==null?void 0:o.type)!=="star")return;let r=(c=(s=this.starImportAliases)[u=e.importFrom.moduleName])!=null?c:s[u]=e.importFrom.starImportAlias;if(r!==e.importFrom.starImportAlias)throw new Error(`Cannot have more than one alias for non-named imports from a module: got ${e.importFrom.starImportAlias} but already have ${r}.`);if(((f=(m=this.starImportAliasesInverse)[d=e.importFrom.starImportAlias])!=null?f:m[d]=e.importFrom.moduleName)!==e.importFrom.moduleName)throw new Error(`Attempted to use alias ${e.importFrom.starImportAlias} for more than one module in the same file`)}};var te=class extends Y{constructor({customConfig:t,formatter:e}){super({customConfig:t,formatter:e})}async toStringAsync(){let t=this.getContent();if(this.formatter!=null)try{return this.formatter.format(t)}catch(e){throw new Error(`Failed to format TypeScript file: ${e}
|
|
9
9
|
${t}`)}return t}toString(){let t=this.getContent();if(this.formatter!=null)try{return this.formatter.formatSync(t)}catch(e){throw new Error(`Failed to format TypeScript file: ${e}
|
|
10
10
|
${t}`)}return t}getContent(){let t=this.stringifyImports();return t.length>0?t+`
|
|
11
11
|
`+this.buffer:this.buffer}stringifyImports(){let t="";for(let[e,r]of Object.entries(this.imports)){let i=this.defaultImports[e],o="",s=r.filter(c=>{var m;return((m=c.importFrom)==null?void 0:m.type)==="named"}),u=this.starImportAliases[e];if(s.length>0||i!=null||u!=null){if(t+="import",i!=null&&(t+=` ${i.name}`),s.length>0){for(let m of s.slice(0,-1))o+=`${m.name}, `;let c=s[s.length-1];c!=null&&(o+=`${c.name}`),i!=null&&(t+=","),t+=` { ${o} }`}u!=null&&((i!=null||s.length>0)&&(t+=", "),t+=` * as ${u}`),t+=` from "${e}";
|
|
12
|
-
`}}return t}};var
|
|
12
|
+
`}}return t}};var x=class extends D{async toStringAsync({customConfig:t,formatter:e}){let r=new te({customConfig:t,formatter:e});return this.write(r),await r.toStringAsync()}toString({customConfig:t,formatter:e}){let r=new te({customConfig:t,formatter:e});return this.write(r),r.toString()}};p();l();var H=class extends x{constructor(e){super();h(this,"args");this.args=e}write(e){return new P(this.args).write(e)}};p();l();var j=class extends x{constructor(e){super();h(this,"internalType");this.internalType=e}write(e){switch(this.internalType.type){case"string":e.write("string");break;case"number":e.write("number");break;case"bigint":e.write("bigint");break;case"boolean":e.write("boolean");break;case"array":this.internalType.valueType.write(e),e.write("[]");break;case"map":e.write("Record<"),this.internalType.keyType.write(e),e.write(", "),this.internalType.valueType.write(e),e.write(">");break;case"object":e.write("{"),e.indent();for(let[r,i]of Object.entries(this.internalType.fields))e.write(`${r}: `),i.write(e),e.writeLine(",");e.dedent(),e.write("}");break;case"enum":e.write("enum");break;case"any":e.write("any");break;case"promise":e.write("Promise<"),this.internalType.value.write(e),e.write(">");break;case"unknown":e.write("unknown");break;case"void":e.write("void");break;case"undefined":e.write("undefined");break;case"null":e.write("null");break;case"never":e.write("never");break;case"nop":break;default:b(this.internalType)}}static string(){return new this({type:"string"})}static number(){return new this({type:"number"})}static bigint(){return new this({type:"bigint"})}static boolean(){return new this({type:"boolean"})}static array(e){return new this({type:"array",valueType:e})}static object(e){return new this({type:"object",fields:e})}static enum(e){return new this({type:"enum",values:e})}static any(){return new this({type:"any"})}static promise(e){return e.internalType.type==="promise"?e:new this({type:"promise",value:e})}static unknown(){return new this({type:"unknown"})}static void(){return new this({type:"void"})}static undefined(){return new this({type:"undefined"})}static null(){return new this({type:"null"})}static never(){return new this({type:"never"})}static nop(){return new this({type:"nop"})}};p();l();var L=class n extends x{constructor(e){super();h(this,"internalType");this.internalType=e}write(e){var o,s;let r=!!((o=e.customConfig)!=null&&o.noSerdeLayer),i=!!((s=e.customConfig)!=null&&s.useBigInt);switch(this.internalType.type){case"array":{this.writeIterable({writer:e,iterable:this.internalType});break}case"blob":{if(r){e.writeNode(n.string(this.internalType.value));return}e.write("new Blob(["),e.writeNode(n.string(this.internalType.value)),e.write("])");break}case"boolean":{e.write(this.internalType.value.toString());break}case"bigint":{if(i){e.write(`BigInt("${this.internalType.value.toString()}")`);return}e.write(`"${this.internalType.value.toString()}"`);return}case"datetime":{if(r){e.writeNode(n.string(this.internalType.value));return}e.write("new Date("),e.writeNode(n.string(this.internalType.value)),e.write(")");break}case"number":{e.write(this.internalType.value.toString());break}case"object":{this.writeObject({writer:e,object:this.internalType});break}case"record":{this.writeRecord({writer:e,record:this.internalType});break}case"reference":{e.writeNode(this.internalType.value);break}case"set":{if(r||this.isSetOfObjects()){e.writeNode(n.array({values:this.internalType.values}));return}e.write("new Set("),this.writeIterable({writer:e,iterable:this.internalType}),e.write(")");break}case"string":{this.internalType.value.includes(`
|
|
13
13
|
`)?this.writeStringWithBackticks({writer:e,value:this.internalType.value}):e.write(`"${this.internalType.value.replaceAll('"','\\"')}"`);break}case"tuple":{this.writeIterable({writer:e,iterable:this.internalType});break}case"unknown":{this.writeUnknown({writer:e,value:this.internalType.value});break}case"null":{e.write("null");break}case"nop":break;default:b(this.internalType)}}isObject(){return this.internalType.type==="object"}asObjectOrThrow(){if(this.isObject())return this.internalType;throw new Error("Internal error; ts.TypeLiteral is not an object")}isSet(){return this.internalType.type==="set"}asSetOrThrow(){if(this.isSet())return this.internalType;throw new Error("Internal error; ts.TypeLiteral is not a set")}isSetOfObjects(){return this.isSet()&&this.asSetOrThrow().values.every(e=>e.isObject())}writeStringWithBackticks({writer:e,value:r}){e.write("`");let i=r.split(`
|
|
14
14
|
`),o=i[0]+`
|
|
15
15
|
`,s=i.slice(1).join(`
|
|
16
|
-
`);e.write(o.replaceAll("`","\\`")),e.writeNoIndent(s.replaceAll("`","\\`")),e.write("`")}writeIterable({writer:e,iterable:r}){let i=tr({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("]")}writeRecord({writer:e,record:r}){let i=er({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("}")}writeObject({writer:e,object:r}){let i=Kt({fields:r.fields});if(i.length===0){e.write("{}");return}e.writeLine("{"),e.indent();for(let o of i)e.write(`${o.name}: `),o.value.write(e),e.writeLine(",");e.dedent(),e.write("}")}static array({values:e}){return new this({type:"array",values:e})}static bigint(e){return new this({type:"bigint",value:e})}static blob(e){return new this({type:"blob",value:e})}static boolean(e){return new this({type:"boolean",value:e})}static datetime(e){return new this({type:"datetime",value:e})}static number(e){return new this({type:"number",value:e})}static object({fields:e}){return new this({type:"object",fields:e})}static record({entries:e}){return new this({type:"record",entries:e})}static reference(e){return new this({type:"reference",value:e})}static set({values:e}){return new this({type:"set",values:e})}static string(e){return new this({type:"string",value:e})}static tuple({values:e}){return new this({type:"tuple",values: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.writeUnknownObject({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("]")}writeUnknownObject({writer:e,value:r}){let i=Object.entries(r);if(i.length===0){e.write("{}");return}e.writeLine("{"),e.indent();for(let[o,s]of i)e.write(`${o}: `),e.writeNode(n.unknown(s)),e.writeLine(",");e.dedent(),e.write("}")}};function Kt({fields:n}){return n.filter(t=>!L.isNop(t.value))}function er({entries:n}){return n.filter(t=>!L.isNop(t.key)&&!L.isNop(t.value))}function tr({values:n}){return n.filter(t=>!L.isNop(t))}
|
|
17
|
-
`).forEach(r=>{e.writeLine(` * ${r}`)}),e.writeLine("*/"))}};var J=class extends w{constructor({name:e,type:r,docs:i}){super();h(this,"name");h(this,"type");h(this,"docs");this.name=e,this.type=r,this.docs=i}write(e){this.docs!=null&&e.writeNode(new U({docs:this.docs})),e.write(`${this.name}: `),this.type.write(e)}};l();p();var z=class extends w{constructor({name:e,parameters:r,async:i,body:o,return_:s,docs:u}){super();h(this,"name");h(this,"parameters");h(this,"async");h(this,"body");h(this,"return_");h(this,"docs");this.name=e,this.parameters=r,this.async=i!=null?i:!1,this.body=o,this.return_=s,this.docs=u}write(e){var r;e.writeNode(new U({docs:this.docs})),this.async&&e.write("async "),e.write("function "),e.write(`${this.name}`),this.writeParameters(e),this.return_!=null&&(e.write(": "),e.writeNode(this.async?j.promise(this.return_):this.return_)),e.writeLine(" {"),e.indent(),(r=this.body)==null||r.write(e),e.dedent(),e.writeNewLineIfLastLineNot(),e.writeLine("}")}writeParameters(e){if(this.parameters.length===0){e.write("()");return}e.indent(),e.writeLine("(");for(let r of this.parameters)e.writeNode(r),e.writeLine(",");e.dedent(),e.write(")")}};l();p();var Q=class extends w{constructor({function_:e,arguments_:r}){super();h(this,"function_");h(this,"arguments_");this.function_=e,this.arguments_=r}write(e){e.writeNode(this.function_),e.write("("),e.delimit({nodes:this.arguments_,delimiter:", ",writeFunction:r=>r.write(e)}),e.write(")")}};l();p();var X=class extends w{constructor({on:e,method:r,arguments_:i,async:o}){super();h(this,"on");h(this,"method");h(this,"arguments_");h(this,"async");this.on=e,this.method=r,this.arguments_=i,this.async=o}write(e){this.async&&e.write("await "),this.on.write(e),e.write("."),e.write(this.method),e.write("("),e.delimit({nodes:this.arguments_,delimiter:", ",writeFunction:r=>r.write(e)}),e.write(")")}};l();p();var Z=class extends w{constructor({class_:e,arguments_:r}){super();h(this,"class_");h(this,"arguments_");this.class_=e,this.arguments_=r}write(e){e.write("new "),e.writeNode(this.class_),e.write("("),e.delimit({nodes:this.arguments_,delimiter:", ",writeFunction:r=>r.write(e)}),e.write(")")}};function nr(n){return new H(n)}function ir(n){return new z(n)}function or(n){return new Z(n)}function sr(n){return new Q(n)}function ar(n){return new X(n)}function ur(n){return new J(n)}function cr(n){return new $(n)}function lr(n){return new G(n)}var Ye="client",je="main",pr={type:"primitive",value:"STRING"},ye=class{constructor({context:t}){h(this,"context");this.context=t}async generateSnippet({endpoint:t,request:e}){return await this.buildCodeBlock({endpoint:t,snippet:e}).toStringAsync({customConfig:this.context.customConfig})}generateSnippetSync({endpoint:t,request:e}){return this.buildCodeBlock({endpoint:t,snippet:e}).toString({customConfig:this.context.customConfig})}buildCodeBlock({endpoint:t,snippet:e}){return g.codeblock(r=>{r.writeNode(g.function_({name:je,async:!0,parameters:[],body:g.codeblock(i=>{i.writeNodeStatement(this.constructClient({endpoint:t,snippet:e})),i.writeNodeStatement(this.callMethod({endpoint:t,snippet:e}))})})),r.writeNodeStatement(g.invokeFunction({function_:g.reference({name:je}),arguments_:[]}))})}constructClient({endpoint:t,snippet:e}){return g.variable({name:Ye,const:!0,initializer:g.instantiateClass({class_:g.reference({name:this.context.getRootClientName(),importFrom:this.context.getModuleImport()}),arguments_:[this.getConstructorArgs({endpoint:t,snippet:e})]})})}getConstructorArgs({endpoint:t,snippet:e}){let r=[],i=this.getConstructorEnvironmentArgs({baseUrl:e.baseURL,environment:e.environment});return i.length>0&&r.push(...i),t.auth!=null&&(e.auth!=null?r.push(...this.getConstructorAuthArgs({auth:t.auth,values:e.auth})):this.context.errors.add({severity:k.Warning,message:`Auth with ${t.auth.type} configuration is required for this endpoint`})),this.context.errors.scope(P.Headers),this.context.ir.headers!=null&&e.headers!=null&&r.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:e.headers})),this.context.errors.unscope(),r.length===0?g.TypeLiteral.nop():g.TypeLiteral.object({fields:r})}getConstructorEnvironmentArgs({baseUrl:t,environment:e}){let r=this.getEnvironmentValue({baseUrl:t,environment:e});return r==null?[]:[{name:"environment",value:r}]}getEnvironmentValue({baseUrl:t,environment:e}){if(t!=null&&e!=null){this.context.errors.add({severity:k.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(t!=null)return g.TypeLiteral.string(t);if(e!=null){if(this.context.isSingleEnvironmentID(e)){let r=this.context.getEnvironmentTypeReferenceFromID(e);if(r==null){this.context.errors.add({severity:k.Warning,message:`Environment ${JSON.stringify(e)} was not found`});return}return g.TypeLiteral.reference(r)}if(this.context.isMultiEnvironmentValues(e))return this.context.validateMultiEnvironmentUrlValues(e)?g.TypeLiteral.object({fields:Object.entries(e).map(([r,i])=>({name:r,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:pr,value:i})}))}):void 0}}getConstructorAuthArgs({auth:t,values:e}){switch(t.type){case"basic":return e.type!=="basic"?(this.context.errors.add({severity:k.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message}),[]):this.getConstructorBasicAuthArg({auth:t,values:e});case"bearer":return e.type!=="bearer"?(this.context.errors.add({severity:k.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:k.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message}),[]):this.getConstructorHeaderAuthArgs({auth:t,values:e});default:b(t)}}getConstructorBasicAuthArg({auth:t,values:e}){return[{name:this.context.getPropertyName(t.username),value:g.TypeLiteral.string(e.username)},{name:this.context.getPropertyName(t.password),value:g.TypeLiteral.string(e.password)}]}getConstructorBearerAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.token),value:g.TypeLiteral.string(e.token)}]}getConstructorHeaderAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.header.name.name),value: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(o)}return r}getConstructorHeaderArg({header:t,value:e}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:e});if(!g.TypeLiteral.isNop(r))return{name:this.context.getPropertyName(t.name.name),value:r}}callMethod({endpoint:t,snippet:e}){return g.invokeMethod({on:g.reference({name:Ye}),method:this.getMethod({endpoint:t}),async:!0,arguments_:this.getMethodArgs({endpoint:t,snippet:e})})}getMethodArgs({endpoint:t,snippet:e}){switch(t.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:t.request,snippet:e});case"body":return this.getMethodArgsForBodyRequest({request:t.request,snippet:e});default:b(t.request)}}getMethodArgsForBodyRequest({request:t,snippet:e}){let r=[];if(this.context.errors.scope(P.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(P.RequestBody),t.body!=null&&r.push(this.getBodyRequestArg({body:t.body,value:e.requestBody})),this.context.errors.unscope(),r}getBodyRequestArg({body:t,value:e}){switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:t.value,value:e});default:b(t)}}getBytesBodyRequestArg({value:t}){return typeof t!="string"?(this.context.errors.add({severity:k.Critical,message:`Expected bytes value to be a string, got ${typeof t}`}),g.TypeLiteral.nop()):g.TypeLiteral.blob(t)}getMethodArgsForInlinedRequest({request:t,snippet:e}){var c,m,d,f;let r=[],{inlinePathParameters:i,inlineFileProperties:o}={inlinePathParameters:(m=(c=this.context.customConfig)==null?void 0:c.inlinePathParameters)!=null?m:!1,inlineFileProperties:(f=(d=this.context.customConfig)==null?void 0:d.inlineFileProperties)!=null?f:!1};this.context.errors.scope(P.PathParameters);let s=[];t.pathParameters!=null&&s.push(...this.getPathParameters({namedParameters:t.pathParameters,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(P.RequestBody);let u=this.getFilePropertyInfo({request:t,snippet:e});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})||r.push(...s.map(x=>x.value)),o||r.push(...u.fileFields.map(x=>x.value)),this.context.needsRequestParameter({request:t,inlinePathParameters:i,inlineFileProperties:o})&&r.push(this.getInlinedRequestArg({request:t,snippet:e,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})?s:[],filePropertyInfo:u})),r}getFilePropertyInfo({request:t,snippet:e}){return t.body==null||!this.context.isFileUploadRequestBody(t.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:t.body,value:e.requestBody})}getInlinedRequestArg({request:t,snippet:e,pathParameterFields:r,filePropertyInfo:i}){var d,f,x,A;this.context.errors.scope(P.QueryParameters);let s=this.context.associateQueryParametersByWireValue({parameters:(d=t.queryParameters)!=null?d:[],values:(f=e.queryParameters)!=null?f:{}}).map(I=>({name:this.context.getPropertyName(I.name.name),value:this.context.dynamicTypeLiteralMapper.convert(I)}));this.context.errors.unscope(),this.context.errors.scope(P.Headers);let c=this.context.associateByWireValue({parameters:(x=t.headers)!=null?x:[],values:(A=e.headers)!=null?A:{}}).map(I=>({name:this.context.getPropertyName(I.name.name),value:this.context.dynamicTypeLiteralMapper.convert(I)}));this.context.errors.unscope(),this.context.errors.scope(P.RequestBody);let m=t.body!=null?this.getInlinedRequestBodyObjectFields({body:t.body,value:e.requestBody,filePropertyInfo:i}):[];return this.context.errors.unscope(),g.TypeLiteral.object({fields:[...r,...s,...c,...m]})}getInlinedRequestBodyObjectFields({body:t,value:e,filePropertyInfo:r}){switch(t.type){case"properties":return this.getInlinedRequestBodyPropertyObjectFields({parameters:t.value,value:e});case"referenced":return[this.getReferencedRequestBodyPropertyObjectField({body:t,value:e})];case"fileUpload":return this.getFileUploadRequestBodyObjectFields({filePropertyInfo:r});default:b(t)}}getFileUploadRequestBodyObjectFields({filePropertyInfo:t}){var e;return(e=this.context.customConfig)!=null&&e.inlineFileProperties?[...t.fileFields,...t.bodyPropertyFields]:t.bodyPropertyFields}getReferencedRequestBodyPropertyObjectField({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:b(t)}}getInlinedRequestBodyPropertyObjectFields({parameters:t,value:e}){var o;let r=[],i=this.context.associateByWireValue({parameters:t,values:(o=this.context.getRecord(e))!=null?o:{}});for(let s of i)r.push({name:this.context.getPropertyName(s.name.name),value:this.context.dynamicTypeLiteralMapper.convert(s)});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 s of i)r.push({name:this.context.getPropertyName(s.name.name),value:this.context.dynamicTypeLiteralMapper.convert(s)});return r}getMethod({endpoint:t}){return t.declaration.fernFilepath.allParts.length>0?`${t.declaration.fernFilepath.allParts.map(e=>this.context.getMethodName(e)).join(".")}.${this.context.getMethodName(t.declaration.name)}`:this.context.getMethodName(t.declaration.name)}};0&&(module.exports={EndpointSnippetGenerator});
|
|
16
|
+
`);e.write(o.replaceAll("`","\\`")),e.writeNoIndent(s.replaceAll("`","\\`")),e.write("`")}writeIterable({writer:e,iterable:r}){let i=tr({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("]")}writeRecord({writer:e,record:r}){let i=er({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("}")}writeObject({writer:e,object:r}){let i=Kt({fields:r.fields});if(i.length===0){e.write("{}");return}e.writeLine("{"),e.indent();for(let o of i)e.write(`${o.name}: `),o.value.write(e),e.writeLine(",");e.dedent(),e.write("}")}static array({values:e}){return new this({type:"array",values:e})}static bigint(e){return new this({type:"bigint",value:e})}static blob(e){return new this({type:"blob",value:e})}static boolean(e){return new this({type:"boolean",value:e})}static datetime(e){return new this({type:"datetime",value:e})}static number(e){return new this({type:"number",value:e})}static object({fields:e}){return new this({type:"object",fields:e})}static record({entries:e}){return new this({type:"record",entries:e})}static reference(e){return new this({type:"reference",value:e})}static set({values:e}){return new this({type:"set",values:e})}static string(e){return new this({type:"string",value:e})}static tuple({values:e}){return new this({type:"tuple",values: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.writeUnknownObject({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("]")}writeUnknownObject({writer:e,value:r}){let i=Object.entries(r);if(i.length===0){e.write("{}");return}e.writeLine("{"),e.indent();for(let[o,s]of i)e.write(`${o}: `),e.writeNode(n.unknown(s)),e.writeLine(",");e.dedent(),e.write("}")}};function Kt({fields:n}){return n.filter(t=>!L.isNop(t.value))}function er({entries:n}){return n.filter(t=>!L.isNop(t.key)&&!L.isNop(t.value))}function tr({values:n}){return n.filter(t=>!L.isNop(t))}p();l();var $=class extends x{constructor({name:e,importFrom:r,memberName:i}){super();h(this,"name");h(this,"importFrom");h(this,"memberName");this.name=e,this.importFrom=r,this.memberName=i}write(e){var o;this.importFrom!=null&&e.addImport(this);let r=((o=this.importFrom)==null?void 0:o.type)==="star"?`${this.importFrom.starImportAlias}.`:"",i=this.memberName!=null?`.${this.memberName}`:"";e.write(`${r}${this.name}${i}`)}};p();l();var G=class extends x{constructor(e){super();h(this,"args");this.args=e}write(e){this.args.export&&e.write("export "),this.args.const?e.write("const "):e.write("let "),e.write(`${this.args.name} = `),e.writeNode(this.args.initializer)}};p();l();p();l();var U=class extends x{constructor({docs:e}={docs:void 0}){super();h(this,"docs");this.docs=e}write(e){this.docs!=null&&(e.writeLine("/**"),this.docs.split(`
|
|
17
|
+
`).forEach(r=>{e.writeLine(` * ${r}`)}),e.writeLine("*/"))}};var J=class extends x{constructor({name:e,type:r,docs:i}){super();h(this,"name");h(this,"type");h(this,"docs");this.name=e,this.type=r,this.docs=i}write(e){this.docs!=null&&e.writeNode(new U({docs:this.docs})),e.write(`${this.name}: `),this.type.write(e)}};p();l();var z=class extends x{constructor({name:e,parameters:r,async:i,body:o,return_:s,docs:u}){super();h(this,"name");h(this,"parameters");h(this,"async");h(this,"body");h(this,"return_");h(this,"docs");this.name=e,this.parameters=r,this.async=i!=null?i:!1,this.body=o,this.return_=s,this.docs=u}write(e){var r;e.writeNode(new U({docs:this.docs})),this.async&&e.write("async "),e.write("function "),e.write(`${this.name}`),this.writeParameters(e),this.return_!=null&&(e.write(": "),e.writeNode(this.async?j.promise(this.return_):this.return_)),e.writeLine(" {"),e.indent(),(r=this.body)==null||r.write(e),e.dedent(),e.writeNewLineIfLastLineNot(),e.writeLine("}")}writeParameters(e){if(this.parameters.length===0){e.write("()");return}e.indent(),e.writeLine("(");for(let r of this.parameters)e.writeNode(r),e.writeLine(",");e.dedent(),e.write(")")}};p();l();var Q=class extends x{constructor({function_:e,arguments_:r}){super();h(this,"function_");h(this,"arguments_");this.function_=e,this.arguments_=r}write(e){e.writeNode(this.function_),e.write("("),e.delimit({nodes:this.arguments_,delimiter:", ",writeFunction:r=>r.write(e)}),e.write(")")}};p();l();var X=class extends x{constructor({on:e,method:r,arguments_:i,async:o}){super();h(this,"on");h(this,"method");h(this,"arguments_");h(this,"async");this.on=e,this.method=r,this.arguments_=i,this.async=o}write(e){this.async&&e.write("await "),this.on.write(e),e.write("."),e.write(this.method),e.write("("),e.delimit({nodes:this.arguments_,delimiter:", ",writeFunction:r=>r.write(e)}),e.write(")")}};p();l();var Z=class extends x{constructor({class_:e,arguments_:r}){super();h(this,"class_");h(this,"arguments_");this.class_=e,this.arguments_=r}write(e){e.write("new "),e.writeNode(this.class_),e.write("("),e.delimit({nodes:this.arguments_,delimiter:", ",writeFunction:r=>r.write(e)}),e.write(")")}};function nr(n){return new H(n)}function ir(n){return new z(n)}function or(n){return new Z(n)}function sr(n){return new Q(n)}function ar(n){return new X(n)}function ur(n){return new J(n)}function cr(n){return new $(n)}function pr(n){return new G(n)}var Ye="client",je="main",lr={type:"primitive",value:"STRING"},ye=class{constructor({context:t}){h(this,"context");this.context=t}async generateSnippet({endpoint:t,request:e}){return await this.buildCodeBlock({endpoint:t,snippet:e}).toStringAsync({customConfig:this.context.customConfig})}generateSnippetSync({endpoint:t,request:e}){return this.buildCodeBlock({endpoint:t,snippet:e}).toString({customConfig:this.context.customConfig})}buildCodeBlock({endpoint:t,snippet:e}){return w.codeblock(r=>{r.writeNode(w.function_({name:je,async:!0,parameters:[],body:w.codeblock(i=>{i.writeNodeStatement(this.constructClient({endpoint:t,snippet:e})),i.writeNodeStatement(this.callMethod({endpoint:t,snippet:e}))})})),r.writeNodeStatement(w.invokeFunction({function_:w.reference({name:je}),arguments_:[]}))})}constructClient({endpoint:t,snippet:e}){return w.variable({name:Ye,const:!0,initializer:w.instantiateClass({class_:w.reference({name:this.context.getRootClientName(),importFrom:this.context.getModuleImport()}),arguments_:[this.getConstructorArgs({endpoint:t,snippet:e})]})})}getConstructorArgs({endpoint:t,snippet:e}){let r=[],i=this.getConstructorEnvironmentArgs({baseUrl:e.baseURL,environment:e.environment});return i.length>0&&r.push(...i),t.auth!=null&&(e.auth!=null?r.push(...this.getConstructorAuthArgs({auth:t.auth,values:e.auth})):this.context.errors.add({severity:S.Warning,message:`Auth with ${t.auth.type} configuration is required for this endpoint`})),this.context.errors.scope(R.PathParameters),this.context.ir.pathParameters!=null&&r.push(...this.getPathParameters({namedParameters:this.context.ir.pathParameters,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(R.Headers),this.context.ir.headers!=null&&e.headers!=null&&r.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:e.headers})),this.context.errors.unscope(),r.length===0?w.TypeLiteral.nop():w.TypeLiteral.object({fields:r})}getConstructorEnvironmentArgs({baseUrl:t,environment:e}){let r=this.getEnvironmentValue({baseUrl:t,environment:e});return r==null?[]:[{name:"environment",value:r}]}getEnvironmentValue({baseUrl:t,environment:e}){if(t!=null&&e!=null){this.context.errors.add({severity:S.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(t!=null)return w.TypeLiteral.string(t);if(e!=null){if(this.context.isSingleEnvironmentID(e)){let r=this.context.getEnvironmentTypeReferenceFromID(e);if(r==null){this.context.errors.add({severity:S.Warning,message:`Environment ${JSON.stringify(e)} was not found`});return}return w.TypeLiteral.reference(r)}if(this.context.isMultiEnvironmentValues(e))return this.context.validateMultiEnvironmentUrlValues(e)?w.TypeLiteral.object({fields:Object.entries(e).map(([r,i])=>({name:r,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:lr,value:i})}))}):void 0}}getConstructorAuthArgs({auth:t,values:e}){switch(t.type){case"basic":return e.type!=="basic"?(this.context.errors.add({severity:S.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message}),[]):this.getConstructorBasicAuthArg({auth:t,values:e});case"bearer":return e.type!=="bearer"?(this.context.errors.add({severity:S.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:S.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message}),[]):this.getConstructorHeaderAuthArgs({auth:t,values:e});case"oauth":return e.type!=="oauth"?(this.context.errors.add({severity:S.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message}),[]):this.getConstructorOAuthArgs({auth:t,values:e});default:b(t)}}getConstructorBasicAuthArg({auth:t,values:e}){return[{name:this.context.getPropertyName(t.username),value:w.TypeLiteral.string(e.username)},{name:this.context.getPropertyName(t.password),value:w.TypeLiteral.string(e.password)}]}getConstructorBearerAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.token),value:w.TypeLiteral.string(e.token)}]}getConstructorHeaderAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.header.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:t.header.typeReference,value:e.value})}]}getConstructorOAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.clientId),value:w.TypeLiteral.string(e.clientId)},{name:this.context.getPropertyName(t.clientSecret),value:w.TypeLiteral.string(e.clientSecret)}]}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(o)}return r}getConstructorHeaderArg({header:t,value:e}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:e});if(!w.TypeLiteral.isNop(r))return{name:this.context.getPropertyName(t.name.name),value:r}}callMethod({endpoint:t,snippet:e}){return w.invokeMethod({on:w.reference({name:Ye}),method:this.getMethod({endpoint:t}),async:!0,arguments_:this.getMethodArgs({endpoint:t,snippet:e})})}getMethodArgs({endpoint:t,snippet:e}){switch(t.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:t.request,snippet:e});case"body":return this.getMethodArgsForBodyRequest({request:t.request,snippet:e});default:b(t.request)}}getMethodArgsForBodyRequest({request:t,snippet:e}){var o,s;let r=[];this.context.errors.scope(R.PathParameters);let i=[...(o=this.context.ir.pathParameters)!=null?o:[],...(s=t.pathParameters)!=null?s:[]];return i.length>0&&r.push(...this.getPathParameters({namedParameters:i,snippet:e}).map(u=>u.value)),this.context.errors.unscope(),this.context.errors.scope(R.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:b(t)}}getBytesBodyRequestArg({value:t}){return typeof t!="string"?(this.context.errors.add({severity:S.Critical,message:`Expected bytes value to be a string, got ${typeof t}`}),w.TypeLiteral.nop()):w.TypeLiteral.blob(t)}getMethodArgsForInlinedRequest({request:t,snippet:e}){var c,m,d,f;let r=[],{inlinePathParameters:i,inlineFileProperties:o}={inlinePathParameters:(m=(c=this.context.customConfig)==null?void 0:c.inlinePathParameters)!=null?m:!1,inlineFileProperties:(f=(d=this.context.customConfig)==null?void 0:d.inlineFileProperties)!=null?f:!1};this.context.errors.scope(R.PathParameters);let s=[];t.pathParameters!=null&&s.push(...this.getPathParameters({namedParameters:t.pathParameters,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(R.RequestBody);let u=this.getFilePropertyInfo({request:t,snippet:e});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})||r.push(...s.map(g=>g.value)),o||r.push(...u.fileFields.map(g=>g.value)),this.context.needsRequestParameter({request:t,inlinePathParameters:i,inlineFileProperties:o})&&r.push(this.getInlinedRequestArg({request:t,snippet:e,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})?s:[],filePropertyInfo:u})),r}getFilePropertyInfo({request:t,snippet:e}){return t.body==null||!this.context.isFileUploadRequestBody(t.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:t.body,value:e.requestBody})}getInlinedRequestArg({request:t,snippet:e,pathParameterFields:r,filePropertyInfo:i}){var d,f,g,A;this.context.errors.scope(R.QueryParameters);let s=this.context.associateQueryParametersByWireValue({parameters:(d=t.queryParameters)!=null?d:[],values:(f=e.queryParameters)!=null?f:{}}).map(I=>({name:this.context.getPropertyName(I.name.name),value:this.context.dynamicTypeLiteralMapper.convert(I)}));this.context.errors.unscope(),this.context.errors.scope(R.Headers);let c=this.context.associateByWireValue({parameters:(g=t.headers)!=null?g:[],values:(A=e.headers)!=null?A:{}}).map(I=>({name:this.context.getPropertyName(I.name.name),value:this.context.dynamicTypeLiteralMapper.convert(I)}));this.context.errors.unscope(),this.context.errors.scope(R.RequestBody);let m=t.body!=null?this.getInlinedRequestBodyObjectFields({body:t.body,value:e.requestBody,filePropertyInfo:i}):[];return this.context.errors.unscope(),w.TypeLiteral.object({fields:[...r,...s,...c,...m]})}getInlinedRequestBodyObjectFields({body:t,value:e,filePropertyInfo:r}){switch(t.type){case"properties":return this.getInlinedRequestBodyPropertyObjectFields({parameters:t.value,value:e});case"referenced":return[this.getReferencedRequestBodyPropertyObjectField({body:t,value:e})];case"fileUpload":return this.getFileUploadRequestBodyObjectFields({filePropertyInfo:r});default:b(t)}}getFileUploadRequestBodyObjectFields({filePropertyInfo:t}){var e;return(e=this.context.customConfig)!=null&&e.inlineFileProperties?[...t.fileFields,...t.bodyPropertyFields]:t.bodyPropertyFields}getReferencedRequestBodyPropertyObjectField({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:b(t)}}getInlinedRequestBodyPropertyObjectFields({parameters:t,value:e}){var o;let r=[],i=this.context.associateByWireValue({parameters:t,values:(o=this.context.getRecord(e))!=null?o:{}});for(let s of i)r.push({name:this.context.getPropertyName(s.name.name),value:this.context.dynamicTypeLiteralMapper.convert(s)});return r}getPathParameters({namedParameters:t,snippet:e}){var o;let r=[],i=this.context.associateByWireValue({parameters:t,values:(o=e.pathParameters)!=null?o:{},ignoreMissingParameters:!0});for(let s of i)r.push({name:this.context.getPropertyName(s.name.name),value:this.context.dynamicTypeLiteralMapper.convert(s)});return r}getMethod({endpoint:t}){return t.declaration.fernFilepath.allParts.length>0?`${t.declaration.fernFilepath.allParts.map(e=>this.context.getMethodName(e)).join(".")}.${this.context.getMethodName(t.declaration.name)}`:this.context.getMethodName(t.declaration.name)}};0&&(module.exports={EndpointSnippetGenerator});
|
|
18
18
|
/*! Bundled license information:
|
|
19
19
|
|
|
20
20
|
@esbuild-plugins/node-globals-polyfill/Buffer.js:
|
|
@@ -25,6 +25,7 @@ declare class EndpointSnippetGenerator {
|
|
|
25
25
|
private getConstructorBasicAuthArg;
|
|
26
26
|
private getConstructorBearerAuthArgs;
|
|
27
27
|
private getConstructorHeaderAuthArgs;
|
|
28
|
+
private getConstructorOAuthArgs;
|
|
28
29
|
private getConstructorHeaderArgs;
|
|
29
30
|
private getConstructorHeaderArg;
|
|
30
31
|
private callMethod;
|