@fern-api/python-dynamic-snippets 4.43.0 → 4.45.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +37 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +165 -0
- package/dist/index.d.ts +165 -0
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -0
- package/package.json +9 -10
- package/cjs/DynamicSnippetsGenerator.cjs +0 -42
- package/cjs/DynamicSnippetsGenerator.cjs.map +0 -1
- package/cjs/DynamicSnippetsGenerator.d.cts +0 -25
- package/cjs/DynamicSnippetsGeneratorContext-4_I0JAlU.d.cts +0 -87
- package/cjs/EndpointSnippetGenerator.cjs +0 -31
- package/cjs/EndpointSnippetGenerator.cjs.map +0 -1
- package/cjs/EndpointSnippetGenerator.d.cts +0 -68
- package/cjs/context/DynamicSnippetsGeneratorContext.cjs +0 -42
- package/cjs/context/DynamicSnippetsGeneratorContext.cjs.map +0 -1
- package/cjs/context/DynamicSnippetsGeneratorContext.d.cts +0 -5
- package/cjs/context/DynamicTypeLiteralMapper.cjs +0 -31
- package/cjs/context/DynamicTypeLiteralMapper.cjs.map +0 -1
- package/cjs/context/DynamicTypeLiteralMapper.d.cts +0 -5
- package/cjs/context/FilePropertyMapper.cjs +0 -31
- package/cjs/context/FilePropertyMapper.cjs.map +0 -1
- package/cjs/context/FilePropertyMapper.d.cts +0 -5
- package/cjs/index.cjs +0 -42
- package/cjs/index.cjs.map +0 -1
- package/cjs/index.d.cts +0 -7
- package/esm/DynamicSnippetsGenerator.d.ts +0 -25
- package/esm/DynamicSnippetsGenerator.js +0 -2
- package/esm/DynamicSnippetsGenerator.js.map +0 -1
- package/esm/DynamicSnippetsGeneratorContext-4_I0JAlU.d.ts +0 -87
- package/esm/EndpointSnippetGenerator.d.ts +0 -68
- package/esm/EndpointSnippetGenerator.js +0 -2
- package/esm/EndpointSnippetGenerator.js.map +0 -1
- package/esm/chunk-2KHLQG2A.js +0 -2
- package/esm/chunk-2KHLQG2A.js.map +0 -1
- package/esm/chunk-2SPAKVUZ.js +0 -2
- package/esm/chunk-2SPAKVUZ.js.map +0 -1
- package/esm/chunk-3XEFLXHY.js +0 -2
- package/esm/chunk-3XEFLXHY.js.map +0 -1
- package/esm/chunk-DP6NTUTQ.js +0 -2
- package/esm/chunk-DP6NTUTQ.js.map +0 -1
- package/esm/chunk-HGKGDQ5J.js +0 -15
- package/esm/chunk-HGKGDQ5J.js.map +0 -1
- package/esm/chunk-NHAFJ5OA.js +0 -31
- package/esm/chunk-NHAFJ5OA.js.map +0 -1
- package/esm/chunk-ULECZXWB.js +0 -2
- package/esm/chunk-ULECZXWB.js.map +0 -1
- package/esm/context/DynamicSnippetsGeneratorContext.d.ts +0 -5
- package/esm/context/DynamicSnippetsGeneratorContext.js +0 -2
- package/esm/context/DynamicSnippetsGeneratorContext.js.map +0 -1
- package/esm/context/DynamicTypeLiteralMapper.d.ts +0 -5
- package/esm/context/DynamicTypeLiteralMapper.js +0 -2
- package/esm/context/DynamicTypeLiteralMapper.js.map +0 -1
- package/esm/context/FilePropertyMapper.d.ts +0 -5
- package/esm/context/FilePropertyMapper.js +0 -2
- package/esm/context/FilePropertyMapper.js.map +0 -1
- package/esm/index.d.ts +0 -7
- package/esm/index.js +0 -2
- package/esm/index.js.map +0 -1
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { AbstractAstNode } from '@fern-api/browser-compatible-base-generator';
|
|
2
|
-
import { FernIr } from '@fern-api/dynamic-ir-sdk';
|
|
3
|
-
import { python } from '@fern-api/python-ast';
|
|
4
|
-
import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-4_I0JAlU.cjs';
|
|
5
|
-
import '@fern-api/python-browser-compatible-base';
|
|
6
|
-
|
|
7
|
-
declare class EndpointSnippetGenerator {
|
|
8
|
-
private context;
|
|
9
|
-
constructor({ context }: {
|
|
10
|
-
context: DynamicSnippetsGeneratorContext;
|
|
11
|
-
});
|
|
12
|
-
generateSnippet({ endpoint, request }: {
|
|
13
|
-
endpoint: FernIr.dynamic.Endpoint;
|
|
14
|
-
request: FernIr.dynamic.EndpointSnippetRequest;
|
|
15
|
-
}): Promise<string>;
|
|
16
|
-
generateSnippetSync({ endpoint, request }: {
|
|
17
|
-
endpoint: FernIr.dynamic.Endpoint;
|
|
18
|
-
request: FernIr.dynamic.EndpointSnippetRequest;
|
|
19
|
-
}): string;
|
|
20
|
-
generateSnippetAst({ endpoint, request }: {
|
|
21
|
-
endpoint: FernIr.dynamic.Endpoint;
|
|
22
|
-
request: FernIr.dynamic.EndpointSnippetRequest;
|
|
23
|
-
}): Promise<AbstractAstNode>;
|
|
24
|
-
/**
|
|
25
|
-
* Generates just the method call AST without the client instantiation.
|
|
26
|
-
* This is useful for wire tests where the client is created separately
|
|
27
|
-
* with test-specific configuration.
|
|
28
|
-
*/
|
|
29
|
-
generateMethodCallSnippetAst({ endpoint, request }: {
|
|
30
|
-
endpoint: FernIr.dynamic.Endpoint;
|
|
31
|
-
request: FernIr.dynamic.EndpointSnippetRequest;
|
|
32
|
-
}): python.AstNode;
|
|
33
|
-
private buildPythonFile;
|
|
34
|
-
private constructClient;
|
|
35
|
-
private getConstructorArgs;
|
|
36
|
-
private getConstructorEnvironmentArgs;
|
|
37
|
-
private getEnvironmentValue;
|
|
38
|
-
private getConstructorAuthArgs;
|
|
39
|
-
private addAuthMismatchError;
|
|
40
|
-
private addWarning;
|
|
41
|
-
private getConstructorBasicAuthArg;
|
|
42
|
-
private getConstructorBearerAuthArgs;
|
|
43
|
-
private getConstructorHeaderAuthArgs;
|
|
44
|
-
private getConstructorOAuthArgs;
|
|
45
|
-
private getConstructorHeaderArgs;
|
|
46
|
-
private getConstructorHeaderArg;
|
|
47
|
-
private callMethod;
|
|
48
|
-
private getMethodArgs;
|
|
49
|
-
private getMethodArgsForBodyRequest;
|
|
50
|
-
private getBodyRequestArgs;
|
|
51
|
-
private getBodyRequestArgsForTypeReference;
|
|
52
|
-
private getBodyRequestArgsForNamedTypeReference;
|
|
53
|
-
private resolvesToLiteralType;
|
|
54
|
-
private getBodyRequestArgsForBytes;
|
|
55
|
-
private getBytesBodyRequestTypeInstantiation;
|
|
56
|
-
private getMethodArgsForInlinedRequest;
|
|
57
|
-
private getFilePropertyInfo;
|
|
58
|
-
private getInlinedRequestArgs;
|
|
59
|
-
private getInlinedRequestBodyObjectFields;
|
|
60
|
-
private getFileUploadRequestBodyObjectFields;
|
|
61
|
-
private getReferencedRequestBodyPropertyTypeInstantiation;
|
|
62
|
-
private getInlinedRequestBodyPropertyObjectFields;
|
|
63
|
-
private getPathParameters;
|
|
64
|
-
private getMethod;
|
|
65
|
-
private getEnvironmentOptionName;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export { EndpointSnippetGenerator };
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";var Ie=Object.defineProperty,_r=Object.defineProperties,Mr=Object.getOwnPropertyDescriptor,Dr=Object.getOwnPropertyDescriptors,Wr=Object.getOwnPropertyNames,Ae=Object.getOwnPropertySymbols;var Ye=Object.prototype.hasOwnProperty,ot=Object.prototype.propertyIsEnumerable;var ze=(n,t,e)=>t in n?Ie(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Ne=(n,t)=>{for(var e in t||(t={}))Ye.call(t,e)&&ze(n,e,t[e]);if(Ae)for(var e of Ae(t))ot.call(t,e)&&ze(n,e,t[e]);return n},at=(n,t)=>_r(n,Dr(t));var st=n=>typeof n=="symbol"?n:n+"",Se=(n,t)=>{var e={};for(var r in n)Ye.call(n,r)&&t.indexOf(r)<0&&(e[r]=n[r]);if(n!=null&&Ae)for(var r of Ae(n))t.indexOf(r)<0&&ot.call(n,r)&&(e[r]=n[r]);return e};var Ge=(n,t)=>()=>(n&&(t=n(n=0)),t);var ft=(n,t)=>{for(var e in t)Ie(n,e,{get:t[e],enumerable:!0})},Vr=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Wr(t))!Ye.call(n,i)&&i!==e&&Ie(n,i,{get:()=>t[i],enumerable:!(r=Mr(t,i))||r.enumerable});return n};var $r=n=>Vr(Ie({},"__esModule",{value:!0}),n);var l=(n,t,e)=>ze(n,typeof t!="symbol"?t+"":t,e);function lt(){throw new Error("setTimeout has not been defined")}function pt(){throw new Error("clearTimeout has not been defined")}function ct(n){if(j===setTimeout)return setTimeout(n,0);if((j===lt||!j)&&setTimeout)return j=setTimeout,setTimeout(n,0);try{return j(n,0)}catch(t){try{return j.call(null,n,0)}catch(e){return j.call(this,n,0)}}}function jr(n){if(z===clearTimeout)return clearTimeout(n);if((z===pt||!z)&&clearTimeout)return z=clearTimeout,clearTimeout(n);try{return z(n)}catch(t){try{return z.call(null,n)}catch(e){return z.call(this,n)}}}function zr(){!ne||!K||(ne=!1,K.length?M=K.concat(M):ke=-1,M.length&&mt())}function mt(){if(!ne){var n=ct(zr);ne=!0;for(var t=M.length;t;){for(K=M,M=[];++ke<t;)K&&K[ke].run();ke=-1,t=M.length}K=null,ne=!1,jr(n)}}function Yr(n){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];M.push(new dt(n,t)),M.length===1&&!ne&&ct(mt)}function dt(n,t){this.fun=n,this.array=t}function X(){}function un(n){throw new Error("process.binding is not supported")}function ln(){return"/"}function pn(n){throw new Error("process.chdir is not supported")}function cn(){return 0}function dn(n){var t=mn.call(re)*.001,e=Math.floor(t),r=Math.floor(t%1*1e9);return n&&(e=e-n[0],r=r-n[1],r<0&&(e--,r+=1e9)),[e,r]}function xn(){var n=new Date,t=n-hn;return t/1e3}var j,z,M,ne,K,ke,Gr,qr,Hr,Qr,Zr,Jr,Kr,Xr,en,tn,rn,nn,on,an,sn,fn,re,mn,hn,m,ut,f=Ge(()=>{"use strict";j=lt,z=pt;typeof globalThis.setTimeout=="function"&&(j=setTimeout);typeof globalThis.clearTimeout=="function"&&(z=clearTimeout);M=[],ne=!1,ke=-1;dt.prototype.run=function(){this.fun.apply(null,this.array)};Gr="browser",qr="browser",Hr=!0,Qr={},Zr=[],Jr="",Kr={},Xr={},en={};tn=X,rn=X,nn=X,on=X,an=X,sn=X,fn=X;re=globalThis.performance||{},mn=re.now||re.mozNow||re.msNow||re.oNow||re.webkitNow||function(){return new Date().getTime()};hn=new Date;m={nextTick:Yr,title:Gr,browser:Hr,env:Qr,argv:Zr,version:Jr,versions:Kr,on:tn,addListener:rn,once:nn,off:on,removeListener:an,removeAllListeners:sn,emit:fn,binding:un,cwd:ln,chdir:pn,umask:cn,hrtime:dn,platform:qr,release:Xr,config:en,uptime:xn},ut={};Object.keys(ut).forEach(n=>{let t=n.split("."),e=m;for(let r=0;r<t.length;r++){let i=t[r];r===t.length-1?e[i]=ut[n]:e=e[i]||(e[i]={})}})});function gt(){He=!0;for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=n.length;t<e;++t)F[t]=n[t],C[n.charCodeAt(t)]=t;C[45]=62,C[95]=63}function gn(n){He||gt();var t,e,r,i,o,a,p=n.length;if(p%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=n[p-2]==="="?2:n[p-1]==="="?1:0,a=new yn(p*3/4-o),r=o>0?p-4:p;var c=0;for(t=0,e=0;t<r;t+=4,e+=3)i=C[n.charCodeAt(t)]<<18|C[n.charCodeAt(t+1)]<<12|C[n.charCodeAt(t+2)]<<6|C[n.charCodeAt(t+3)],a[c++]=i>>16&255,a[c++]=i>>8&255,a[c++]=i&255;return o===2?(i=C[n.charCodeAt(t)]<<2|C[n.charCodeAt(t+1)]>>4,a[c++]=i&255):o===1&&(i=C[n.charCodeAt(t)]<<10|C[n.charCodeAt(t+1)]<<4|C[n.charCodeAt(t+2)]>>2,a[c++]=i>>8&255,a[c++]=i&255),a}function wn(n){return F[n>>18&63]+F[n>>12&63]+F[n>>6&63]+F[n&63]}function vn(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(wn(r));return i.join("")}function ht(n){He||gt();for(var t,e=n.length,r=e%3,i="",o=[],a=16383,p=0,c=e-r;p<c;p+=a)o.push(vn(n,p,p+a>c?c:p+a));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 Ce(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function D(n,t){if(Ce()<t)throw new RangeError("Invalid typed array length");return s.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(t),n.__proto__=s.prototype):(n===null&&(n=new s(t)),n.length=t),n}function s(n,t,e){if(!s.TYPED_ARRAY_SUPPORT&&!(this instanceof s))return new s(n,t,e);if(typeof n=="number"){if(typeof t=="string")throw new Error("If encoding is specified then the first argument must be a string");return Qe(this,n)}return wt(this,n,t,e)}function wt(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?bn(n,t,e,r):typeof t=="string"?Rn(n,t,e):En(n,t)}function vt(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 Tn(n,t,e,r){return vt(t),t<=0?D(n,t):e!==void 0?typeof r=="string"?D(n,t).fill(e,r):D(n,t).fill(e):D(n,t)}function Qe(n,t){if(vt(t),n=D(n,t<0?0:Ze(t)|0),!s.TYPED_ARRAY_SUPPORT)for(var e=0;e<t;++e)n[e]=0;return n}function Rn(n,t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!s.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=Tt(t,e)|0;n=D(n,r);var i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function qe(n,t){var e=t.length<0?0:Ze(t.length)|0;n=D(n,e);for(var r=0;r<e;r+=1)n[r]=t[r]&255;return n}function bn(n,t,e,r){if(t.byteLength,e<0||t.byteLength<e)throw new RangeError("'offset' is out of bounds");if(t.byteLength<e+(r||0))throw new RangeError("'length' is out of bounds");return e===void 0&&r===void 0?t=new Uint8Array(t):r===void 0?t=new Uint8Array(t,e):t=new Uint8Array(t,e,r),s.TYPED_ARRAY_SUPPORT?(n=t,n.__proto__=s.prototype):n=qe(n,t),n}function En(n,t){if(B(t)){var e=Ze(t.length)|0;return n=D(n,e),n.length===0||t.copy(n,0,0,e),n}if(t){if(typeof ArrayBuffer!="undefined"&&t.buffer instanceof ArrayBuffer||"length"in t)return typeof t.length!="number"||jn(t.length)?D(n,0):qe(n,t);if(t.type==="Buffer"&&Array.isArray(t.data))return qe(n,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function Ze(n){if(n>=Ce())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Ce().toString(16)+" bytes");return n|0}function B(n){return!!(n!=null&&n._isBuffer)}function Tt(n,t){if(B(n))return n.length;if(typeof ArrayBuffer!="undefined"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(n)||n instanceof ArrayBuffer))return n.byteLength;typeof n!="string"&&(n=""+n);var e=n.length;if(e===0)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return Le(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return St(n).length;default:if(r)return Le(n).length;t=(""+t).toLowerCase(),r=!0}}function An(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 Bn(this,t,e);case"utf8":case"utf-8":return Et(this,t,e);case"ascii":return Un(this,t,e);case"latin1":case"binary":return Fn(this,t,e);case"base64":return Ln(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return On(this,t,e);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),r=!0}}function ee(n,t,e){var r=n[t];n[t]=n[e],n[e]=r}function Rt(n,t,e,r,i){if(n.length===0)return-1;if(typeof e=="string"?(r=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:n.length-1),e<0&&(e=n.length+e),e>=n.length){if(i)return-1;e=n.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof t=="string"&&(t=s.from(t,r)),B(t))return t.length===0?-1:xt(n,t,e,r,i);if(typeof t=="number")return t=t&255,s.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(n,t,e):Uint8Array.prototype.lastIndexOf.call(n,t,e):xt(n,[t],e,r,i);throw new TypeError("val must be string, number or Buffer")}function xt(n,t,e,r,i){var o=1,a=n.length,p=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(n.length<2||t.length<2)return-1;o=2,a/=2,p/=2,e/=2}function c(v,g){return o===1?v[g]:v.readUInt16BE(g*o)}var x;if(i){var h=-1;for(x=e;x<a;x++)if(c(n,x)===c(t,h===-1?0:x-h)){if(h===-1&&(h=x),x-h+1===p)return h*o}else h!==-1&&(x-=x-h),h=-1}else for(e+p>a&&(e=a-p),x=e;x>=0;x--){for(var y=!0,T=0;T<p;T++)if(c(n,x+T)!==c(t,T)){y=!1;break}if(y)return x}return-1}function In(n,t,e,r){e=Number(e)||0;var i=n.length-e;r?(r=Number(r),r>i&&(r=i)):r=i;var o=t.length;if(o%2!==0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a<r;++a){var p=parseInt(t.substr(a*2,2),16);if(isNaN(p))return a;n[e+a]=p}return a}function Nn(n,t,e,r){return Fe(Le(t,n.length-e),n,e,r)}function bt(n,t,e,r){return Fe(Vn(t),n,e,r)}function Sn(n,t,e,r){return bt(n,t,e,r)}function kn(n,t,e,r){return Fe(St(t),n,e,r)}function Cn(n,t,e,r){return Fe($n(t,n.length-e),n,e,r)}function Ln(n,t,e){return t===0&&e===n.length?ht(n):ht(n.slice(t,e))}function Et(n,t,e){e=Math.min(n.length,e);for(var r=[],i=t;i<e;){var o=n[i],a=null,p=o>239?4:o>223?3:o>191?2:1;if(i+p<=e){var c,x,h,y;switch(p){case 1:o<128&&(a=o);break;case 2:c=n[i+1],(c&192)===128&&(y=(o&31)<<6|c&63,y>127&&(a=y));break;case 3:c=n[i+1],x=n[i+2],(c&192)===128&&(x&192)===128&&(y=(o&15)<<12|(c&63)<<6|x&63,y>2047&&(y<55296||y>57343)&&(a=y));break;case 4:c=n[i+1],x=n[i+2],h=n[i+3],(c&192)===128&&(x&192)===128&&(h&192)===128&&(y=(o&15)<<18|(c&63)<<12|(x&63)<<6|h&63,y>65535&&y<1114112&&(a=y))}}a===null?(a=65533,p=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=p}return Pn(r)}function Pn(n){var t=n.length;if(t<=yt)return String.fromCharCode.apply(String,n);for(var e="",r=0;r<t;)e+=String.fromCharCode.apply(String,n.slice(r,r+=yt));return e}function Un(n,t,e){var r="";e=Math.min(n.length,e);for(var i=t;i<e;++i)r+=String.fromCharCode(n[i]&127);return r}function Fn(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 Bn(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+=Wn(n[o]);return i}function On(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 A(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 k(n,t,e,r,i,o){if(!B(n))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(e+r>n.length)throw new RangeError("Index out of range")}function Pe(n,t,e,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(n.length-e,2);i<o;++i)n[e+i]=(t&255<<8*(r?i:1-i))>>>(r?i:1-i)*8}function Ue(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 At(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 It(n,t,e,r,i){return i||At(n,t,e,4,34028234663852886e22,-34028234663852886e22),Ct(n,t,e,r,23,4),e+4}function Nt(n,t,e,r,i){return i||At(n,t,e,8,17976931348623157e292,-17976931348623157e292),Ct(n,t,e,r,52,8),e+8}function Mn(n){if(n=Dn(n).replace(_n,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}function Dn(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}function Wn(n){return n<16?"0"+n.toString(16):n.toString(16)}function Le(n,t){t=t||1/0;for(var e,r=n.length,i=null,o=[],a=0;a<r;++a){if(e=n.charCodeAt(a),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&o.push(239,191,189);continue}else if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&o.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;o.push(e)}else if(e<2048){if((t-=2)<0)break;o.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;o.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return o}function Vn(n){for(var t=[],e=0;e<n.length;++e)t.push(n.charCodeAt(e)&255);return t}function $n(n,t){for(var e,r,i,o=[],a=0;a<n.length&&!((t-=2)<0);++a)e=n.charCodeAt(a),r=e>>8,i=e%256,o.push(i),o.push(r);return o}function St(n){return gn(Mn(n))}function Fe(n,t,e,r){for(var i=0;i<r&&!(i+e>=t.length||i>=n.length);++i)t[i+e]=n[i];return i}function jn(n){return n!==n}function zn(n){return n!=null&&(!!n._isBuffer||kt(n)||Yn(n))}function kt(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function Yn(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&kt(n.slice(0,0))}function Be(n,t,e,r,i){var o,a,p=i*8-r-1,c=(1<<p)-1,x=c>>1,h=-7,y=e?i-1:0,T=e?-1:1,v=n[t+y];for(y+=T,o=v&(1<<-h)-1,v>>=-h,h+=p;h>0;o=o*256+n[t+y],y+=T,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=r;h>0;a=a*256+n[t+y],y+=T,h-=8);if(o===0)o=1-x;else{if(o===c)return a?NaN:(v?-1:1)*(1/0);a=a+Math.pow(2,r),o=o-x}return(v?-1:1)*a*Math.pow(2,o-r)}function Ct(n,t,e,r,i,o){var a,p,c,x=o*8-i-1,h=(1<<x)-1,y=h>>1,T=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,v=r?0:o-1,g=r?1:-1,R=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(p=isNaN(t)?1:0,a=h):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),a+y>=1?t+=T/c:t+=T*Math.pow(2,1-y),t*c>=2&&(a++,c/=2),a+y>=h?(p=0,a=h):a+y>=1?(p=(t*c-1)*Math.pow(2,i),a=a+y):(p=t*Math.pow(2,y-1)*Math.pow(2,i),a=0));i>=8;n[e+v]=p&255,v+=g,p/=256,i-=8);for(a=a<<i|p,x+=i;x>0;n[e+v]=a&255,v+=g,a/=256,x-=8);n[e+v-g]|=R*128}var F,C,yn,He,yt,_n,Lt=Ge(()=>{"use strict";f();u();F=[],C=[],yn=typeof Uint8Array!="undefined"?Uint8Array:Array,He=!1;s.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;s.poolSize=8192;s._augment=function(n){return n.__proto__=s.prototype,n};s.from=function(n,t,e){return wt(null,n,t,e)};s.kMaxLength=Ce();s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&s[Symbol.species]);s.alloc=function(n,t,e){return Tn(null,n,t,e)};s.allocUnsafe=function(n){return Qe(null,n)};s.allocUnsafeSlow=function(n){return Qe(null,n)};s.isBuffer=zn;s.compare=function(t,e){if(!B(t)||!B(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,i=e.length,o=0,a=Math.min(r,i);o<a;++o)if(t[o]!==e[o]){r=t[o],i=e[o];break}return r<i?-1:i<r?1:0};s.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};s.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return s.alloc(0);var r;if(e===void 0)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var i=s.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var a=t[r];if(!B(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(i,o),o+=a.length}return i};s.byteLength=Tt;s.prototype._isBuffer=!0;s.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)ee(this,e,e+1);return this};s.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)ee(this,e,e+3),ee(this,e+1,e+2);return this};s.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)ee(this,e,e+7),ee(this,e+1,e+6),ee(this,e+2,e+5),ee(this,e+3,e+4);return this};s.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?Et(this,0,t):An.apply(this,arguments)};s.prototype.equals=function(t){if(!B(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:s.compare(this,t)===0};s.prototype.compare=function(t,e,r,i,o){if(!B(t))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),r===void 0&&(r=t?t.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),e<0||r>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&e>=r)return 0;if(i>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,i>>>=0,o>>>=0,this===t)return 0;for(var a=o-i,p=r-e,c=Math.min(a,p),x=this.slice(i,o),h=t.slice(e,r),y=0;y<c;++y)if(x[y]!==h[y]){a=x[y],p=h[y];break}return a<p?-1:p<a?1:0};s.prototype.includes=function(t,e,r){return this.indexOf(t,e,r)!==-1};s.prototype.indexOf=function(t,e,r){return Rt(this,t,e,r,!0)};s.prototype.lastIndexOf=function(t,e,r){return Rt(this,t,e,r,!1)};s.prototype.write=function(t,e,r,i){if(e===void 0)i="utf8",r=this.length,e=0;else if(r===void 0&&typeof e=="string")i=e,r=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(r)?(r=r|0,i===void 0&&(i="utf8")):(i=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-e;if((r===void 0||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return In(this,t,e,r);case"utf8":case"utf-8":return Nn(this,t,e,r);case"ascii":return bt(this,t,e,r);case"latin1":case"binary":return Sn(this,t,e,r);case"base64":return kn(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Cn(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}};s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};yt=4096;s.prototype.slice=function(t,e){var r=this.length;t=~~t,e=e===void 0?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e<t&&(e=t);var i;if(s.TYPED_ARRAY_SUPPORT)i=this.subarray(t,e),i.__proto__=s.prototype;else{var o=e-t;i=new s(o,void 0);for(var a=0;a<o;++a)i[a]=this[a+t]}return i};s.prototype.readUIntLE=function(t,e,r){t=t|0,e=e|0,r||A(t,e,this.length);for(var i=this[t],o=1,a=0;++a<e&&(o*=256);)i+=this[t+a]*o;return i};s.prototype.readUIntBE=function(t,e,r){t=t|0,e=e|0,r||A(t,e,this.length);for(var i=this[t+--e],o=1;e>0&&(o*=256);)i+=this[t+--e]*o;return i};s.prototype.readUInt8=function(t,e){return e||A(t,1,this.length),this[t]};s.prototype.readUInt16LE=function(t,e){return e||A(t,2,this.length),this[t]|this[t+1]<<8};s.prototype.readUInt16BE=function(t,e){return e||A(t,2,this.length),this[t]<<8|this[t+1]};s.prototype.readUInt32LE=function(t,e){return e||A(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};s.prototype.readUInt32BE=function(t,e){return e||A(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};s.prototype.readIntLE=function(t,e,r){t=t|0,e=e|0,r||A(t,e,this.length);for(var i=this[t],o=1,a=0;++a<e&&(o*=256);)i+=this[t+a]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i};s.prototype.readIntBE=function(t,e,r){t=t|0,e=e|0,r||A(t,e,this.length);for(var i=e,o=1,a=this[t+--i];i>0&&(o*=256);)a+=this[t+--i]*o;return o*=128,a>=o&&(a-=Math.pow(2,8*e)),a};s.prototype.readInt8=function(t,e){return e||A(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};s.prototype.readInt16LE=function(t,e){e||A(t,2,this.length);var r=this[t]|this[t+1]<<8;return r&32768?r|4294901760:r};s.prototype.readInt16BE=function(t,e){e||A(t,2,this.length);var r=this[t+1]|this[t]<<8;return r&32768?r|4294901760:r};s.prototype.readInt32LE=function(t,e){return e||A(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};s.prototype.readInt32BE=function(t,e){return e||A(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};s.prototype.readFloatLE=function(t,e){return e||A(t,4,this.length),Be(this,t,!0,23,4)};s.prototype.readFloatBE=function(t,e){return e||A(t,4,this.length),Be(this,t,!1,23,4)};s.prototype.readDoubleLE=function(t,e){return e||A(t,8,this.length),Be(this,t,!0,52,8)};s.prototype.readDoubleBE=function(t,e){return e||A(t,8,this.length),Be(this,t,!1,52,8)};s.prototype.writeUIntLE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var o=Math.pow(2,8*r)-1;k(this,t,e,r,o,0)}var a=1,p=0;for(this[e]=t&255;++p<r&&(a*=256);)this[e+p]=t/a&255;return e+r};s.prototype.writeUIntBE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var o=Math.pow(2,8*r)-1;k(this,t,e,r,o,0)}var a=r-1,p=1;for(this[e+a]=t&255;--a>=0&&(p*=256);)this[e+a]=t/p&255;return e+r};s.prototype.writeUInt8=function(t,e,r){return t=+t,e=e|0,r||k(this,t,e,1,255,0),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=t&255,e+1};s.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=e|0,r||k(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):Pe(this,t,e,!0),e+2};s.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=e|0,r||k(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):Pe(this,t,e,!1),e+2};s.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=e|0,r||k(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255):Ue(this,t,e,!0),e+4};s.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=e|0,r||k(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):Ue(this,t,e,!1),e+4};s.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e=e|0,!i){var o=Math.pow(2,8*r-1);k(this,t,e,r,o-1,-o)}var a=0,p=1,c=0;for(this[e]=t&255;++a<r&&(p*=256);)t<0&&c===0&&this[e+a-1]!==0&&(c=1),this[e+a]=(t/p>>0)-c&255;return e+r};s.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e=e|0,!i){var o=Math.pow(2,8*r-1);k(this,t,e,r,o-1,-o)}var a=r-1,p=1,c=0;for(this[e+a]=t&255;--a>=0&&(p*=256);)t<0&&c===0&&this[e+a+1]!==0&&(c=1),this[e+a]=(t/p>>0)-c&255;return e+r};s.prototype.writeInt8=function(t,e,r){return t=+t,e=e|0,r||k(this,t,e,1,127,-128),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=t&255,e+1};s.prototype.writeInt16LE=function(t,e,r){return t=+t,e=e|0,r||k(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):Pe(this,t,e,!0),e+2};s.prototype.writeInt16BE=function(t,e,r){return t=+t,e=e|0,r||k(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):Pe(this,t,e,!1),e+2};s.prototype.writeInt32LE=function(t,e,r){return t=+t,e=e|0,r||k(this,t,e,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):Ue(this,t,e,!0),e+4};s.prototype.writeInt32BE=function(t,e,r){return t=+t,e=e|0,r||k(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):Ue(this,t,e,!1),e+4};s.prototype.writeFloatLE=function(t,e,r){return It(this,t,e,!0,r)};s.prototype.writeFloatBE=function(t,e,r){return It(this,t,e,!1,r)};s.prototype.writeDoubleLE=function(t,e,r){return Nt(this,t,e,!0,r)};s.prototype.writeDoubleBE=function(t,e,r){return Nt(this,t,e,!1,r)};s.prototype.copy=function(t,e,r,i){if(r||(r=0),!i&&i!==0&&(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<r&&(i=r),i===r||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);var o=i-r,a;if(this===t&&r<e&&e<i)for(a=o-1;a>=0;--a)t[a+e]=this[a+r];else if(o<1e3||!s.TYPED_ARRAY_SUPPORT)for(a=0;a<o;++a)t[a+e]=this[a+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o};s.prototype.fill=function(t,e,r,i){if(typeof t=="string"){if(typeof e=="string"?(i=e,e=0,r=this.length):typeof r=="string"&&(i=r,r=this.length),t.length===1){var o=t.charCodeAt(0);o<256&&(t=o)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!s.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof t=="number"&&(t=t&255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;e=e>>>0,r=r===void 0?this.length:r>>>0,t||(t=0);var a;if(typeof t=="number")for(a=e;a<r;++a)this[a]=t;else{var p=B(t)?t:Le(new s(t,i).toString()),c=p.length;for(a=0;a<r-e;++a)this[a+e]=p[a%c]}return this};_n=/[^+\/0-9A-Za-z-_]/g});var u=Ge(()=>{"use strict";Lt()});var oa={};ft(oa,{DynamicSnippetsGeneratorContext:()=>it});module.exports=$r(oa);f();u();f();u();f();u();function E(n){throw new Error("Unexpected value: "+JSON.stringify(n))}f();u();f();u();f();u();f();u();f();u();f();u();var Gn=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis,Pt=Gn;var qn=typeof self=="object"&&self&&self.Object===Object&&self,Hn=Pt||qn||Function("return this")(),Ut=Hn;var Qn=Ut.Symbol,W=Qn;f();u();var Ft=Object.prototype,Zn=Ft.hasOwnProperty,Jn=Ft.toString,ye=W?W.toStringTag:void 0;function Kn(n){var t=Zn.call(n,ye),e=n[ye];try{n[ye]=void 0;var r=!0}catch(o){}var i=Jn.call(n);return r&&(t?n[ye]=e:delete n[ye]),i}var Bt=Kn;f();u();var Xn=Object.prototype,ei=Xn.toString;function ti(n){return ei.call(n)}var Ot=ti;var ri="[object Null]",ni="[object Undefined]",_t=W?W.toStringTag:void 0;function ii(n){return n==null?n===void 0?ni:ri:_t&&_t in Object(n)?Bt(n):Ot(n)}var Mt=ii;f();u();function oi(n){return n!=null&&typeof n=="object"}var Dt=oi;var ai="[object Symbol]";function si(n){return typeof n=="symbol"||Dt(n)&&Mt(n)==ai}var Wt=si;f();u();f();u();function fi(n,t){for(var e=-1,r=n==null?0:n.length,i=Array(r);++e<r;)i[e]=t(n[e],e,n);return i}var Vt=fi;f();u();var ui=Array.isArray,$t=ui;var li=1/0,jt=W?W.prototype:void 0,zt=jt?jt.toString:void 0;function Yt(n){if(typeof n=="string")return n;if($t(n))return Vt(n,Yt)+"";if(Wt(n))return zt?zt.call(n):"";var t=n+"";return t=="0"&&1/n==-li?"-0":t}var Gt=Yt;f();u();function pi(n){return n==null?"":Gt(n)}var Y=pi;f();u();f();u();f();u();f();u();f();u();f();u();function ci(n,t,e){var r=-1,i=n.length;t<0&&(t=-t>i?0:i+t),e=e>i?i:e,e<0&&(e+=i),i=t>e?0:e-t>>>0,t>>>=0;for(var o=Array(i);++r<i;)o[r]=n[r+t];return o}var qt=ci;function mi(n,t,e){var r=n.length;return e=e===void 0?r:e,!t&&e>=r?n:qt(n,t,e)}var Ht=mi;f();u();var di="\\ud800-\\udfff",hi="\\u0300-\\u036f",xi="\\ufe20-\\ufe2f",yi="\\u20d0-\\u20ff",gi=hi+xi+yi,wi="\\ufe0e\\ufe0f",vi="\\u200d",Ti=RegExp("["+vi+di+gi+wi+"]");function Ri(n){return Ti.test(n)}var Oe=Ri;f();u();f();u();function bi(n){return n.split("")}var Qt=bi;f();u();var Zt="\\ud800-\\udfff",Ei="\\u0300-\\u036f",Ai="\\ufe20-\\ufe2f",Ii="\\u20d0-\\u20ff",Ni=Ei+Ai+Ii,Si="\\ufe0e\\ufe0f",ki="["+Zt+"]",Je="["+Ni+"]",Ke="\\ud83c[\\udffb-\\udfff]",Ci="(?:"+Je+"|"+Ke+")",Jt="[^"+Zt+"]",Kt="(?:\\ud83c[\\udde6-\\uddff]){2}",Xt="[\\ud800-\\udbff][\\udc00-\\udfff]",Li="\\u200d",er=Ci+"?",tr="["+Si+"]?",Pi="(?:"+Li+"(?:"+[Jt,Kt,Xt].join("|")+")"+tr+er+")*",Ui=tr+er+Pi,Fi="(?:"+[Jt+Je+"?",Je,Kt,Xt,ki].join("|")+")",Bi=RegExp(Ke+"(?="+Ke+")|"+Fi+Ui,"g");function Oi(n){return n.match(Bi)||[]}var rr=Oi;function _i(n){return Oe(n)?rr(n):Qt(n)}var nr=_i;function Mi(n){return function(t){t=Y(t);var e=Oe(t)?nr(t):void 0,r=e?e[0]:t.charAt(0),i=e?Ht(e,1).join(""):t.slice(1);return r[n]()+i}}var ir=Mi;var Di=ir("toUpperCase"),or=Di;function Wi(n){return or(Y(n).toLowerCase())}var ar=Wi;f();u();f();u();function Vi(n,t,e,r){var i=-1,o=n==null?0:n.length;for(r&&o&&(e=n[++i]);++i<o;)e=t(e,n[i],i,n);return e}var sr=Vi;f();u();f();u();f();u();function $i(n){return function(t){return n==null?void 0:n[t]}}var fr=$i;var ji={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},zi=fr(ji),ur=zi;var Yi=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Gi="\\u0300-\\u036f",qi="\\ufe20-\\ufe2f",Hi="\\u20d0-\\u20ff",Qi=Gi+qi+Hi,Zi="["+Qi+"]",Ji=RegExp(Zi,"g");function Ki(n){return n=Y(n),n&&n.replace(Yi,ur).replace(Ji,"")}var lr=Ki;f();u();f();u();var Xi=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function eo(n){return n.match(Xi)||[]}var pr=eo;f();u();var to=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function ro(n){return to.test(n)}var cr=ro;f();u();var yr="\\ud800-\\udfff",no="\\u0300-\\u036f",io="\\ufe20-\\ufe2f",oo="\\u20d0-\\u20ff",ao=no+io+oo,gr="\\u2700-\\u27bf",wr="a-z\\xdf-\\xf6\\xf8-\\xff",so="\\xac\\xb1\\xd7\\xf7",fo="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",uo="\\u2000-\\u206f",lo=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",vr="A-Z\\xc0-\\xd6\\xd8-\\xde",po="\\ufe0e\\ufe0f",Tr=so+fo+uo+lo,Rr="['\u2019]",mr="["+Tr+"]",co="["+ao+"]",br="\\d+",mo="["+gr+"]",Er="["+wr+"]",Ar="[^"+yr+Tr+br+gr+wr+vr+"]",ho="\\ud83c[\\udffb-\\udfff]",xo="(?:"+co+"|"+ho+")",yo="[^"+yr+"]",Ir="(?:\\ud83c[\\udde6-\\uddff]){2}",Nr="[\\ud800-\\udbff][\\udc00-\\udfff]",ie="["+vr+"]",go="\\u200d",dr="(?:"+Er+"|"+Ar+")",wo="(?:"+ie+"|"+Ar+")",hr="(?:"+Rr+"(?:d|ll|m|re|s|t|ve))?",xr="(?:"+Rr+"(?:D|LL|M|RE|S|T|VE))?",Sr=xo+"?",kr="["+po+"]?",vo="(?:"+go+"(?:"+[yo,Ir,Nr].join("|")+")"+kr+Sr+")*",To="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ro="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",bo=kr+Sr+vo,Eo="(?:"+[mo,Ir,Nr].join("|")+")"+bo,Ao=RegExp([ie+"?"+Er+"+"+hr+"(?="+[mr,ie,"$"].join("|")+")",wo+"+"+xr+"(?="+[mr,ie+dr,"$"].join("|")+")",ie+"?"+dr+"+"+hr,ie+"+"+xr,Ro,To,br,Eo].join("|"),"g");function Io(n){return n.match(Ao)||[]}var Cr=Io;function No(n,t,e){return n=Y(n),t=e?void 0:t,t===void 0?cr(n)?Cr(n):pr(n):n.match(t)||[]}var Lr=No;var So="['\u2019]",ko=RegExp(So,"g");function Co(n){return function(t){return sr(Lr(lr(t).replace(ko,"")),n,"")}}var _e=Co;var Lo=_e(function(n,t,e){return t=t.toLowerCase(),n+(e?ar(t):t)}),Xe=Lo;f();u();var Po=_e(function(n,t,e){return n+(e?"_":"")+t.toLowerCase()}),et=Po;f();u();function ge(n){return Object.keys(n)}f();u();f();u();f();u();var Pr,Ur,we=(Ur=(Pr=m.env.FERN_STACK_TRACK)==null?void 0:Pr.toLowerCase())!=null?Ur:"",O=we!==""&&we!=="0"&&we!=="false",tt=["single","multiline","box"].includes(we)?we:"single";O&&(Error.stackTraceLimit=50);var Uo=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),Fo=new Set(["stacktrace"]);function De({maxFrames:n=50,skip:t=0,filterPaths:e=[],filterFunctions:r=[],stopOn:i=[],filterNode:o=!0,filterJs:a=!0,formatFilename:p=c=>c}={}){var x;if(!O)return[];r=[...r,...Uo],e=[...e,...Fo],i=[...i,"runInteractiveTask"];let c=!1;return((x=new Error().stack)!=null?x:"").split(`
|
|
2
|
-
`).map(h=>{let y=h.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(y&&y.length===5){let[,T,v,g,R]=y;if(!T||!v||!g||!R)return;if(c||i.some(I=>T==null?void 0:T.includes(I))){c=!0;return}switch(T){case"Object.<anonymous>":T="";break;case"Object.object":case"Object.alias":case"Object.union":case"Object.enum":case"Object.undiscriminatedUnion":T=`${T.substring(T.indexOf(".")+1)}()=> { ... }`;break}return{fn:T,path:p(v),position:`${g}:${R}`}}}).filter(h=>{var y,T;return h&&!r.some(v=>h.fn.includes(v))&&!(o&&((y=h.path)!=null&&y.startsWith("node:")))&&!(a&&((T=h.path)!=null&&T.endsWith(".js")))&&!e.some(v=>h.path.includes(v))}).slice(t,t+n)}var Me=class{constructor({maxFrames:t=50,skip:e=0,filterPaths:r=[],filterFunctions:i=[],stopOn:o=[],filterNode:a=!0,filterJs:p=!0,multiline:c=!1,formatFilename:x=h=>h}={}){l(this,"maxFrames");l(this,"skip");l(this,"filterPaths");l(this,"filterFunctions");l(this,"stopOn");l(this,"filterNode");l(this,"filterJs");l(this,"multiline");l(this,"formatFilename");l(this,"tracking",new WeakMap);this.maxFrames=t,this.skip=e,this.filterPaths=r,this.filterFunctions=i,this.stopOn=o,this.filterNode=a,this.filterJs=p,this.multiline=c,this.formatFilename=x}tag(t){let e=this.tracking.get(t)||new Set;De({maxFrames:this.maxFrames,skip:this.skip,filterPaths:this.filterPaths,filterFunctions:this.filterFunctions,stopOn:this.stopOn,filterNode:this.filterNode,filterJs:this.filterJs,formatFilename:this.formatFilename}).forEach(r=>e.add(r)),this.tracking.set(t,e)}trace(t){if(!O)return"";let e=this.tracking.get(t);return e?[...e].map(r=>`${this.multiline?`
|
|
3
|
-
`:""}${r.fn} - ${r.path}:${r.position}`).join(""):""}frames(t){let e=this.tracking.get(t);return e?[...e]:[]}free(t){this.tracking.delete(t)}clear(){this.tracking=new WeakMap}},V;function Fr({maxFrames:n=50,skip:t=0,filterPaths:e=[],filterFunctions:r=[],stopOn:i=[],filterNode:o=!0,filterJs:a=!0,multiline:p=!1,formatFilename:c=x=>x}={}){O&&(V!=null||(V=new Me({maxFrames:n,skip:t,filterPaths:e,filterFunctions:r,stopOn:i,filterNode:o,filterJs:a,multiline:p,formatFilename:c})))}function Br(n){V==null||V.tag(n)}function rt(n){var t;return(t=V==null?void 0:V.frames(n))!=null?t:[]}var te=class{constructor(){Br(this)}};f();u();f();u();f();u();var U=class extends te{constructor(e){super();l(this,"value");this.value=e}write(e){typeof this.value=="string"?e.write(this.value):typeof this.value=="function"?this.value(e):this.value.write(e)}};var Bo=4;Fr({skip:0,maxFrames:15,filterFunctions:["Abstract"]});var ve=class{constructor(){l(this,"lineBuffer",[]);l(this,"indentLevel",0);l(this,"hasWrittenAnything",!1);l(this,"lastCharacterIsSemicolon",!1);l(this,"lastCharacterIsNewline",!1);l(this,"nodeStackFrames",[])}get buffer(){return O&&this.nodeStackFrames.length>0&&this.writeInternal(`
|
|
4
|
-
`),this.lineBuffer.join(`
|
|
5
|
-
`)+(this.lastCharacterIsNewline?`
|
|
6
|
-
`:"")}write(...t){for(let e of t)if(e!=null)if(typeof e=="string"){let r=e.length>0&&e.endsWith(`
|
|
7
|
-
`),i=r?e.substring(0,e.length-1):e,o=this.getIndentString(),a=i.replaceAll(`
|
|
8
|
-
`,`
|
|
9
|
-
${o}`);this.isAtStartOfLine()&&(a=o+a),r&&(a+=`
|
|
10
|
-
`),this.writeInternal(a)}else this.writeNode(e)}writeStatement(...t){this.write(...t),this.write(";"),this.writeNewLineIfLastLineNot()}writeNoIndent(t){let e=this.indentLevel;this.indentLevel=0,this.write(t),this.indentLevel=e}writeNode(t){O&&this.nodeStackFrames.push(...rt(t)),t.write(this),O&&tt!=="single"&&this.writeInternal(`
|
|
11
|
-
`)}writeNodeOrString(t){if(typeof t=="string"){this.write(t);return}this.writeNode(t)}writeNodeStatement(t){this.writeNode(t),this.write(";"),this.writeNewLineIfLastLineNot()}writeTextStatement(t){new U(t).write(this),t.endsWith(";")||this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(t,e){new U(t).write(this),this.write(" (",e,")"),this.pushScope()}controlFlowWithoutStatement(t){new U(t).write(this),this.pushScope()}endControlFlow(){this.popScope()}contiguousControlFlow(t,e){this.dedent(),this.write("} "),new U(t).write(this),this.write(" (",e,")"),this.pushScope()}alternativeControlFlow(t){this.dedent(),this.write("} "),new U(t).write(this),this.pushScope()}pushScope(){this.writeLine("{"),this.indent()}popScope(t=!0){this.dedent(),this.writeNewLineIfLastLineNot(),t?this.writeLine("}"):this.write("}")}writeLine(...t){this.write(...t.length===0?[""]:t),this.writeNewLineIfLastLineNot()}newLine(){this.writeInternal(`
|
|
12
|
-
`)}writeSemicolonIfLastCharacterIsNot(){this.lastCharacterIsSemicolon||this.writeInternal(";")}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
|
|
13
|
-
`)}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 a=t[o];a!=null&&r(a)}}}toString(){return this.buffer}writeInternal(t){if(t.length===0)return;let e=!this.lastCharacterIsNewline;this.hasWrittenAnything=!0,this.lastCharacterIsNewline=t.endsWith(`
|
|
14
|
-
`),this.lastCharacterIsSemicolon=t.endsWith(";");let r=t.split(`
|
|
15
|
-
`),i=O&&!this.shouldSkipTracking(r)&&this.lastCharacterIsNewline;e&&(this.lastLine=`${this.lastLine}${r.shift()||""}`),this.lastCharacterIsNewline&&r.pop(),this.lineBuffer.push(...r),i&&this.appendTrackingComment()}set lastLine(t){this.lineBuffer.length>0?this.lineBuffer[this.lineBuffer.length-1]=t:this.lineBuffer.push(t)}get lastLine(){return this.lineBuffer[this.lineBuffer.length-1]||""}shouldSkipTracking(t){return!1}formatStack(t,e=""){return t.map(r=>`${e?`(${e}) `:""} ${r.fn} - ${r.path} : ${r.position}`)}filterStack(t){return t.filter(e=>!e.fn.startsWith(`${this.constructor.name}.`))}appendTrackingComment(){let t=[...this.formatStack(this.filterStack(De({maxFrames:15,skip:3}))),...this.formatStack(this.filterStack(this.nodeStackFrames),"node")];switch(this.nodeStackFrames.length=0,tt){case"single":return this.singleLineTrackingComment(t);case"multiline":return this.multiLineTrackingComment(t);case"box":return this.boxTrackingComment(t)}}singleLineTrackingComment(t){this.lastLine=`${this.lastLine} // ${t.join(" ")}`}multiLineTrackingComment(t){this.lineBuffer.push(...t.map(e=>` // ${e}`))}boxTrackingComment(t){this.lineBuffer.push("/*",...t.map(e=>` ${e}`),"*/")}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*this.getTabSize())}getTabSize(){return Bo}};f();u();f();u();f();u();f();u();var Te=class{constructor(){l(this,"REFERENCE_REGEX",/^(GET|POST|PUT|DELETE|PATCH|HEAD)\s(\/\S*)$/)}validate(t){return this.REFERENCE_REGEX.test(t)?{type:"valid"}:{type:"invalid"}}tryParse(t){if(this.validate(t).type==="invalid")return;let r=t.match(this.REFERENCE_REGEX);if(!(r==null||r[1]==null||r[2]==null))return{method:r[1],path:r[2]}}};f();u();var b={Critical:"CRITICAL",Warning:"WARNING"},Re=class n{constructor(){l(this,"errors");l(this,"path");this.errors=[],this.path=[]}add(t){this.errors.push(at(Ne({},t),{path:[...this.path]}))}scope(t){this.path.push(t)}unscope(){this.path.pop()}getBySeverity(t){return this.errors.filter(e=>e.severity===t)}empty(){return this.errors.length===0}size(){return this.errors.length}clone(){let t=new n;return t.errors=[...this.errors],t.path=[...this.path],t}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(t=>({severity:t.severity,path:t.path!=null?this.pathToStringArray(t.path):void 0,message:t.message}))}pathToStringArray(t){let e=[];for(let r of t){if(typeof r=="string"){e.push(r);continue}e[e.length-1]+=`[${r.index}]`}return e}};var be=class{constructor({ir:t,config:e,options:r={}}){l(this,"config");l(this,"options");l(this,"errors");l(this,"_ir");l(this,"httpEndpointReferenceParser");this._ir=t,this.config=e,this.options=r,this.errors=new Re,this.httpEndpointReferenceParser=new Te}associateQueryParametersByWireValue({parameters:t,values:e}){let r=[];for(let[i,o]of Object.entries(e)){this.errors.scope(i);try{let a=t.find(c=>c.name.wireValue===i);if(a==null)throw this.newParameterNotRecognizedError(i);let p=this.isListTypeReference(a.typeReference)&&!Array.isArray(o)?[o]:o;r.push({name:a.name,typeReference:a.typeReference,value:p})}finally{this.errors.unscope()}}return r}associateByWireValueOrDefault({parameters:t,values:e}){let r=[];for(let i of t){this.errors.scope(i.name.wireValue);try{let o=e[i.name.wireValue];if(o==null)if(i.typeReference.type==="primitive"&&i.typeReference.value==="STRING")o=`<${i.name.wireValue}>`;else{this.errors.add({severity:b.Critical,message:this.newParameterNotRecognizedError(i.name.wireValue).message});continue}r.push({name:i.name,typeReference:i.typeReference,value:o})}finally{this.errors.unscope()}}return r}associateByWireValue({parameters:t,values:e,ignoreMissingParameters:r}){let i=[];for(let[o,a]of Object.entries(e)){this.errors.scope(o);try{let p=t.find(c=>c.name.wireValue===o);if(p==null){if(r)continue;this.errors.add({severity:b.Critical,message:this.newParameterNotRecognizedError(o).message});continue}i.push({name:p.name,typeReference:p.typeReference,value:a})}finally{this.errors.unscope()}}return i}getExampleObjectProperties({parameters:t,snippetObject:e}){let r=typeof e=="object"&&e!==null&&!Array.isArray(e)?e:{},i=[];for(let o of t){let a=r[o.name.wireValue];a==null?o.typeReference.type==="nullable"&&i.push({name:o.name,typeReference:o.typeReference,value:null}):i.push({name:o.name,typeReference:o.typeReference,value:a})}return i}getSingleFileValue({property:t,record:e}){let r=e[t.wireValue];if(r!=null){if(typeof r!="string"){this.errors.add({severity:b.Critical,message:`Expected file value to be a string, got ${typeof r}`});return}return r}}getFileArrayValues({property:t,record:e}){let r=e[t.wireValue];if(r==null)return;if(!Array.isArray(r)){this.errors.add({severity:b.Critical,message:`Expected file array value to be an array of strings, got ${typeof r}`});return}let i=[];for(let o of r){if(typeof o!="string"){this.errors.add({severity:b.Critical,message:`Expected file array value to be an array of strings, got ${typeof o}`});return}i.push(o)}return i}getRecord(t){if(typeof t!="object"||Array.isArray(t)){this.errors.add({severity:b.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(t)?"array":typeof t}`});return}return t==null?{}:t}resolveNamedType({typeId:t}){let e=this._ir.types[t];if(e==null){this.errors.add({severity:b.Critical,message:`Type identified by "${t}" could not be found`});return}return e}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e}){let r=this.getRecord(e);if(r==null)return;let i=t.discriminant.wireValue,o=r[i];if(o==null){this.errors.add({severity:b.Critical,message:this.newParameterNotRecognizedError(i).message});return}if(typeof o!="string"){this.errors.add({severity:b.Critical,message:`Expected discriminant value to be a string but got: ${typeof o}`});return}let a=t.types[o];if(a==null){this.errors.add({severity:b.Critical,message:`No type found for discriminant value "${o}"`});return}let x=r,{[i]:p}=x,c=Se(x,[st(i)]);return{singleDiscriminatedUnionType:a,discriminantValue:a.discriminantValue,value:c}}resolveEndpointOrThrow(t){let e=this.httpEndpointReferenceParser.tryParse(t);if(e==null)throw new Error(`Failed to parse endpoint reference "${t}"`);return this.resolveEndpointLocationOrThrow(e)}resolveEndpointLocation(t){let e=[];for(let r of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:r,parsedEndpoint:t})&&e.push(r);return e}resolveEndpointLocationOrThrow(t){let e=this.resolveEndpointLocation(t);if(e.length===0)throw new Error(`Failed to find endpoint identified by "${t.method} ${t.path}"`);return e}needsRequestParameter({request:t,inlinePathParameters:e,inlineFileProperties:r}){var i;return this.includePathParametersInWrappedRequest({request:t,inlinePathParameters:e})||t.queryParameters!=null&&t.queryParameters.length>0||t.headers!=null&&t.headers.length>0?!0:t.body!=null?this.includeRequestBodyInWrappedRequest({body:t.body,inlineFileProperties:r}):!((i=t.metadata)!=null&&i.onlyPathParameters)}includePathParametersInWrappedRequest({request:t,inlinePathParameters:e}){var r,i;return e&&((i=(r=t.metadata)==null?void 0:r.includePathParameters)!=null?i:!1)}isFileUploadRequestBody(t){switch(t.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:E(t)}}resolveEnvironmentName(t){if(this._ir.environments==null)return;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":{let r=e.environments.find(i=>i.id===t);return r==null?void 0:r.name}case"multipleBaseUrls":{let r=e.environments.find(i=>i.id===t);return r==null?void 0:r.name}default:E(e)}}isSingleEnvironmentID(t){return typeof t=="string"}isMultiEnvironmentValues(t){return typeof t=="object"}validateMultiEnvironmentUrlValues(t){if(this._ir.environments==null)return this.errors.add({severity:b.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":return this.errors.add({severity:b.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let r=e.environments[0];if(r==null)return this.errors.add({severity:b.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let i=new Set(ge(r.urls));for(let o of ge(t))i.has(o)&&i.delete(o);return i.size>0?(this.errors.add({severity:b.Critical,message:`The provided environments are invalid; got: [${Object.keys(t).join(", ")}], expected: [${ge(r.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:t}){if(typeof t!="number"){this.errors.add({severity:b.Critical,message:this.newTypeMismatchError({expected:"number",value:t}).message});return}return t}getValueAsBoolean({value:t}){if(typeof t!="boolean"){this.errors.add({severity:b.Critical,message:this.newTypeMismatchError({expected:"boolean",value:t}).message});return}return t}getValueAsString({value:t}){if(typeof t!="string"){this.errors.add({severity:b.Critical,message:this.newTypeMismatchError({expected:"string",value:t}).message});return}return t}isOptional(t){switch(t.type){case"nullable":return this.isOptional(t.value);case"optional":return!0;case"named":{let e=this.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}isNullable(t){switch(t.type){case"nullable":return!0;case"optional":return this.isNullable(t.value);case"named":{let e=this.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}newAuthMismatchError({auth:t,values:e}){return new Error(`Expected auth type ${t.type}, got ${e.type}`)}newParameterNotRecognizedError(t){return new Error(`"${t}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:t,value:e}){return new Error(`Expected ${t}, got ${typeof e}`)}includeRequestBodyInWrappedRequest({body:t,inlineFileProperties:e}){switch(t.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:t,inlineFileProperties:e});default:E(t)}}includeFileUploadBodyInWrappedRequest({fileUpload:t,inlineFileProperties:e}){return this.fileUploadHasBodyProperties({fileUpload:t})||e&&this.fileUploadHasFileProperties({fileUpload:t})}fileUploadHasBodyProperties({fileUpload:t}){return t.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:E(e)}})}fileUploadHasFileProperties({fileUpload:t}){return t.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:E(e)}})}isListTypeReference(t){return t.type==="optional"?this.isListTypeReference(t.value):t.type==="list"||t.type==="set"}parsedEndpointMatches({endpoint:t,parsedEndpoint:e}){return t.location.method===e.method&&t.location.path===e.path}};f();u();var d={};ft(d,{AccessAttribute:()=>oe,AstNode:()=>w,Class:()=>G,ClassInstantiation:()=>se,CodeBlock:()=>$,Comment:()=>fe,Decorator:()=>ue,Field:()=>q,Lambda:()=>le,LambdaParameter:()=>pe,Method:()=>Q,MethodArgument:()=>me,MethodInvocation:()=>de,Operator:()=>he,Parameter:()=>H,PythonFile:()=>xe,Reference:()=>L,StarImport:()=>Z,Type:()=>Ve,TypeInstantiation:()=>J,accessAttribute:()=>Mo,assign:()=>Do,class_:()=>Vo,codeBlock:()=>qo,comment:()=>Ho,decorator:()=>jo,field:()=>Go,file:()=>Wo,instantiateClass:()=>$o,invokeFunction:()=>Ko,invokeMethod:()=>Xo,lambda:()=>Qo,lambdaParameter:()=>Zo,method:()=>Jo,methodArgument:()=>ta,operator:()=>ra,parameter:()=>ea,reference:()=>zo,starImport:()=>Yo});f();u();f();u();f();u();f();u();var Ee=class extends ve{constructor(){super(...arguments);l(this,"fullyQualifiedModulePathsToImportedNames",{})}setRefNameOverrides(e){this.fullyQualifiedModulePathsToImportedNames=e}unsetRefNameOverrides(){this.fullyQualifiedModulePathsToImportedNames={}}getRefNameOverride(e){var i;let r=this.fullyQualifiedModulePathsToImportedNames[e.getFullyQualifiedModulePath()];return r||{name:(i=e.alias)!=null?i:e.name,isAlias:!!e.alias}}toString(){return this.buffer}async toStringFormatted(e){return e.format(this.buffer)}};var w=class extends te{constructor(){super(...arguments);l(this,"references",[])}addReference(e){this.references.push(e)}inheritReferences(e){e!==void 0&&e.references.forEach(r=>{this.references.includes(r)||this.addReference(r)})}getReferences(){return this.references}toString(){let e=new Ee;return this.write(e),e.toString()}async toStringFormatted(e){let r=new Ee;return this.write(r),r.toStringFormatted(e)}};var oe=class extends w{constructor({lhs:e,rhs:r}){super();l(this,"lhs");l(this,"rhs");this.lhs=e,this.inheritReferences(e),this.rhs=r,this.inheritReferences(r)}write(e){this.lhs.write(e),e.write("."),this.rhs.write(e)}};f();u();var We=class extends w{constructor({lhs:e,rhs:r}){super();l(this,"lhs");l(this,"rhs");this.lhs=e,this.inheritReferences(e),this.rhs=r,this.inheritReferences(r)}write(e){this.lhs.write(e),e.write(" = "),this.rhs.write(e)}};f();u();var ae=class extends w{constructor({reference:e,arguments_:r,multiline:i}){super();l(this,"reference");l(this,"arguments");l(this,"multiline");this.reference=e,this.arguments=r,this.multiline=i!=null?i:!1,this.inheritReferences(e),this.arguments.forEach(o=>{this.inheritReferences(o)})}write(e){if(this.reference.write(e),this.arguments.length===0){e.write("()");return}e.write("("),this.multiline&&(e.newLine(),e.indent()),this.arguments.forEach((r,i)=>{r.write(e),i<this.arguments.length-1&&(e.write(","),this.multiline?e.newLine():e.write(" "))}),this.multiline&&(e.newLine(),e.dedent()),e.write(")")}};f();u();var G=class extends w{constructor({docs:e,name:r,extends_:i,decorators:o}){super();l(this,"name");l(this,"extends_");l(this,"decorators");l(this,"fields",[]);l(this,"docs");l(this,"statements",[]);this.name=r,this.extends_=i!=null?i:[],this.decorators=o!=null?o:[],this.docs=e,this.extends_.forEach(a=>{this.inheritReferences(a)}),this.decorators.forEach(a=>{this.inheritReferences(a)})}write(e){this.decorators.forEach(r=>{r.write(e)}),e.write(`class ${this.name}`),this.extends_.length>0&&(e.write("("),this.extends_.forEach((r,i)=>{i>0&&e.write(", "),r.write(e)}),e.write(")")),e.write(":"),e.newLine(),e.indent(),this.docs!=null&&(e.write('"""'),e.write(this.docs),e.write('"""')),e.writeNewLineIfLastLineNot(),this.fields.forEach(r=>{r.write(e),e.writeNewLineIfLastLineNot()}),e.dedent(),e.indent(),this.statements.length?this.writeStatements({writer:e}):e.write("pass"),e.dedent()}add(e){this.statements.push(e),this.inheritReferences(e)}writeStatements({writer:e}){this.statements.forEach((r,i)=>{r.write(e),e.writeNewLineIfLastLineNot()})}addField(e){this.add(e)}};f();u();var se=class extends ae{constructor(r){var i=r,{classReference:t}=i,e=Se(i,["classReference"]);super(Ne({reference:t},e))}};f();u();var $=class extends w{constructor(e){super();l(this,"arg");this.arg=e}write(e){return new U(this.arg).write(e)}};f();u();var fe=class extends w{constructor({docs:e}){super();l(this,"docs");this.docs=e}write(e){this.docs!=null&&this.docs.split(`
|
|
16
|
-
`).forEach(r=>{e.writeLine(`# ${r}`)})}};f();u();var ue=class extends w{constructor({callable:e}){super();l(this,"callable");this.callable=e,this.inheritReferences(e)}write(e){e.write("@"),this.callable.write(e),e.newLine()}};f();u();var q=class extends w{constructor({name:e,type:r,initializer:i,docs:o}){super();l(this,"name");l(this,"type");l(this,"initializer");l(this,"docs");this.name=e,this.type=r,this.initializer=i,this.docs=o,this.inheritReferences(this.type),this.inheritReferences(this.initializer)}write(e){e.write(this.name),this.type!==void 0&&(e.write(": "),this.type.write(e)),this.initializer!==void 0&&(e.write(" = "),this.initializer.write(e)),this.docs!=null&&(e.newLine(),e.write('"""'),e.newLine(),e.write(this.docs),e.newLine(),e.write('"""'))}};f();u();var le=class extends w{constructor({parameters:e,body:r}){super();l(this,"parameters");l(this,"body");this.parameters=e!=null?e:[],this.body=r,this.inheritReferences(r)}write(e){e.write("lambda"),this.parameters&&this.parameters.length&&(e.write(" "),this.parameters.forEach((r,i)=>{r.write(e),i<this.parameters.length-1&&e.write(", ")})),e.write(": "),this.body.write(e)}};f();u();f();u();var H=class extends w{constructor({name:e,type:r,initializer:i}){super();l(this,"name");l(this,"initializer");l(this,"type");this.name=e,this.type=r,this.initializer=i}write(e){e.write(this.name),this.type&&(e.write(": "),this.type.write(e)),this.initializer!==void 0&&(e.write(" = "),this.initializer.write(e))}};var pe=class extends H{constructor({name:t,initializer:e}){super({name:t,initializer:e,type:void 0})}};f();u();var ce;(function(n){n[n.STATIC=0]="STATIC",n[n.INSTANCE=1]="INSTANCE",n[n.CLASS=2]="CLASS"})(ce||(ce={}));var Q=class extends w{constructor({static_:e,name:r,parameters:i,return_:o,docstring:a,type:p,decorators:c}){super();l(this,"name");l(this,"return");l(this,"docstring");l(this,"type");l(this,"parameters");l(this,"decorators");l(this,"statements",[]);l(this,"static_");this.name=r,this.parameters=i!=null?i:[],this.return=o,this.docstring=a,this.type=p,this.decorators=c!=null?c:[],this.static_=e!=null?e:!1,this.parameters.forEach(x=>{this.inheritReferences(x)}),this.inheritReferences(this.return),this.decorators.forEach(x=>{this.inheritReferences(x)}),this.statements.forEach(x=>{this.inheritReferences(x)})}addStatement(e){this.statements.push(e),this.inheritReferences(e)}write(e){this.static_&&this.decorators.push(d.decorator({callable:d.codeBlock("staticmethod")})),this.decorators.forEach(o=>{o.write(e)}),this.type===ce.CLASS?d.decorator({callable:new $("classmethod")}).write(e):this.type===ce.STATIC&&d.decorator({callable:new $("staticmethod")}).write(e),e.write(`def ${this.name}(`);let i=this.parameters.length>3;i&&(e.newLine(),e.indent()),this.type===ce.INSTANCE?(e.write("self"),this.parameters.length>0&&(e.write(i?",":", "),i&&e.newLine())):this.type===ce.CLASS&&(e.write("cls"),this.parameters.length>0&&(e.write(i?",":", "),i&&e.newLine())),this.parameters.forEach((o,a)=>{o.write(e),a<this.parameters.length-1&&(e.write(i?",":", "),i&&e.newLine())}),i&&(e.write(","),e.dedent(),e.newLine()),e.write(")"),this.return&&(e.write(" -> "),this.return.write(e)),e.write(":"),e.newLine(),this.docstring&&(e.indent(),e.write('"""'),e.write(this.docstring),e.write('"""'),e.newLine(),e.dedent()),this.statements.length?(e.indent(),this.statements.forEach((o,a)=>{o.write(e),a<this.statements.length-1&&e.newLine()}),e.dedent()):(e.indent(),e.write("pass"),e.dedent()),e.newLine()}};f();u();var me=class extends w{constructor({name:e,value:r}){super();l(this,"name");l(this,"value");this.name=e,this.value=r,this.inheritReferences(this.value)}write(e){this.name!==void 0&&(e.write(this.name),e.write("=")),this.value.write(e)}};f();u();var de=class extends w{constructor({on:e,method:r,arguments_:i,multiline:o}){super();l(this,"on");l(this,"method");l(this,"arguments");l(this,"multiline");this.on=e,this.method=r,this.arguments=i,this.multiline=o!=null?o:!1,this.inheritReferences(e),this.arguments.forEach(a=>{this.inheritReferences(a)})}write(e){if(this.on.write(e),e.write("."),e.write(this.method),this.arguments.length===0){e.write("()");return}e.write("("),this.multiline&&(e.newLine(),e.indent()),this.arguments.forEach((r,i)=>{r.write(e),i<this.arguments.length-1&&(e.write(","),this.multiline?e.newLine():e.write(" "))}),this.multiline&&(e.newLine(),e.dedent()),e.write(")")}};f();u();f();u();var _={Or:"or",And:"and",Add:"add",Subtract:"subtract",Multiply:"multiple",Divide:"divide",Modulo:"modulo",LeftShift:"leftShift",RightShift:"rightShift"};var he=class extends w{constructor({operator:e,lhs:r,rhs:i}){super();l(this,"operator");l(this,"lhs");l(this,"rhs");this.operator=e,this.lhs=r,this.inheritReferences(r),this.rhs=i,this.inheritReferences(i)}getOperatorString(){switch(this.operator){case _.Or:return"or";case _.And:return"and";case _.Add:return"+";case _.Subtract:return"-";case _.Multiply:return"*";case _.Divide:return"/";case _.Modulo:return"%";case _.LeftShift:return"<<";case _.RightShift:return">>";default:E(this.operator)}}write(e){this.lhs.write(e),e.write(" "),e.write(this.getOperatorString()),e.write(" "),this.rhs.write(e)}};f();u();f();u();function Or(n){if(!n)return"Class";let t=n.replace(/[^a-zA-Z0-9\s_-]/g," ").replace(/[-_\s]+/g," ").trim();return!t||/^\d+$/.test(t)?"Class"+(t||""):(/^\d/.test(t)&&(t="Class"+t),t.split(/(?=[A-Z])|[-_\s]+/).filter(r=>r.length>0).map(r=>r.split(new RegExp("(?<=\\d)(?=[a-zA-Z])|(?<=[a-zA-Z])(?=\\d)")).filter(i=>i.length>0)).flat().map((r,i)=>i===0&&/^\d/.test(r)?"Class"+r.charAt(0).toUpperCase()+r.slice(1).toLowerCase():r.length>1&&r===r.toUpperCase()&&!/^\d+$/.test(r)?r:r.charAt(0).toUpperCase()+r.slice(1).toLowerCase()).join(""))}f();u();f();u();var L=class extends w{constructor({name:e,modulePath:r,genericTypes:i,alias:o,attribute:a}){super();l(this,"name");l(this,"modulePath");l(this,"genericTypes");l(this,"alias");l(this,"attribute");this.name=e,this.modulePath=r!=null?r:[],this.genericTypes=i!=null?i:[],this.alias=o,this.attribute=a!=null?a:[],this.references.push(this),this.genericTypes.forEach(p=>{this.inheritReferences(p)})}write(e){let r=e.getRefNameOverride(this);e.write(r.name),this.genericTypes.length>0&&(e.write("["),this.genericTypes.forEach((i,o)=>{o>0&&e.write(", "),i.write(e)}),e.write("]")),this.attribute.length>0&&(e.write("."),this.attribute.forEach((i,o)=>{o>0&&e.write("."),e.write(i)}))}getFullyQualifiedPath(){return this.modulePath.join(".")}getFullyQualifiedModulePath(){return`${this.getFullyQualifiedPath()}.${this.name}`}};var Z=class extends L{constructor({modulePath:e}){super({name:"*",modulePath:e});l(this,"docs")}write(e){throw new Error("Not intended to be written outside the context of a PythonFile.")}};var xe=class extends w{constructor({path:e,statements:r,isInitFile:i=!1,comments:o,imports:a}){super();l(this,"path");l(this,"isInitFile");l(this,"statements",[]);l(this,"comments");this.path=e,this.isInitFile=i,r==null||r.forEach(p=>this.addStatement(p)),this.comments=o!=null?o:[],a==null||a.forEach(p=>this.addReference(p))}addStatement(e){this.statements.push(e),this.inheritReferences(e)}write(e){let r=this.deduplicateReferences();this.updateWriterRefNameOverrides({writer:e,uniqueReferences:r}),this.writeComments(e),this.writeImports({writer:e,uniqueReferences:r}),this.statements.forEach((i,o)=>{i.write(e),e.newLine(),o<this.statements.length-1&&e.newLine()}),e.unsetRefNameOverrides()}updateWriterRefNameOverrides({writer:e,uniqueReferences:r}){let i=new Map(r),o={},a=this.getInitialUsedNames(),p=this.path.join("."),c=r.get(p);if(c){let{references:h}=c;h.forEach(y=>{let T=y.getFullyQualifiedModulePath(),v=y.name;o[T]={name:v,isAlias:!1},a.add(y.name)}),i.delete(p)}Array.from(i.values()).flatMap(({references:h})=>h).forEach(h=>{var I;if(h instanceof Z)return;let y=(I=h.alias)!=null?I:h.name,T=h.getFullyQualifiedModulePath(),v=y,g=h.modulePath.length-1,R=!!h.alias;for(;a.has(v);){R=!0;let N=h.modulePath[g];g<0||!N?v=`_${v}`:v=`${Or(N)}${v}`,g--}a.add(v),o[T]={name:v,isAlias:R}}),e.setRefNameOverrides(o)}getInitialUsedNames(){let e=new Set;return this.statements.forEach(r=>{(r instanceof G||r instanceof Q||r instanceof q)&&e.add(r.name)}),e}deduplicateReferences(){let e=new Map;for(let r of this.references){let i=r.name,o=r.getFullyQualifiedPath();if(o==="")continue;let a=e.get(o);a?a.referenceNames.has(i)||(a.references.push(r),a.referenceNames.add(i)):e.set(o,{modulePath:r.modulePath,references:[r],referenceNames:new Set([i])})}return e}writeComments(e){this.comments.forEach(r=>{r.write(e)}),this.comments.length>0&&e.newLine()}getImportName({writer:e,reference:r}){let i=e.getRefNameOverride(r),o=r.name,a=i.isAlias?i.name:void 0;return`${o}${a?` as ${a}`:""}`}writeImports({writer:e,uniqueReferences:r}){if(r.size!==0){for(let[i,{modulePath:o,references:a}]of r){let p=o;if(!this.isDefinedInFile(p)){if(p[0]===this.path[0]){let c=0;for(;c<this.path.length&&c<p.length&&this.path[c]===p[c];)c++;let x=this.path.length-c;this.isInitFile&&x++;let h=x>0?".".repeat(x):".";h+=p.slice(c).join("."),e.write(`from ${h} import ${a.map(y=>this.getImportName({writer:e,reference:y})).join(", ")}`)}else e.write(`from ${i} import ${a.map(c=>this.getImportName({writer:e,reference:c})).join(", ")}`);e.newLine()}}e.newLine()}}isDefinedInFile(e){return e.length===this.path.length&&e.every((r,i)=>r===this.path[i])}};f();u();var Ve=class extends w{constructor(e){super();l(this,"internalType");this.internalType=e}write(e){switch(this.internalType.type){case"int":e.write("int");break;case"float":e.write("float");break;case"bool":e.write("bool");break;case"str":e.write("str");break;case"bytes":e.write("bytes");break;case"list":e.write("List["),this.internalType.value.write(e),e.write("]");break;case"set":e.write("Set["),this.internalType.value.write(e),e.write("]");break;case"tuple":e.write("Tuple["),this.internalType.values.forEach((r,i)=>{i>0&&e.write(", "),r.write(e)}),e.write("]");break;case"dict":e.write("Dict["),this.internalType.keyType.write(e),e.write(", "),this.internalType.valueType.write(e),e.write("]");break;case"none":e.write("None");break;case"uuid":e.write("UUID");break;case"optional":e.write("Optional["),this.internalType.value.write(e),e.write("]");break;case"union":e.write("Union["),this.internalType.values.forEach((r,i)=>{i>0&&e.write(", "),r.write(e)}),e.write("]");break;case"any":e.write("Any");break;case"reference":this.internalType.value.write(e);break;case"datetime":e.write("datetime");break;case"literal":typeof this.internalType.value=="string"?e.write(`Literal["${this.internalType.value}"]`):e.write(`Literal[${this.internalType.value}]`);break;default:E(this.internalType)}}static int(){return new this({type:"int"})}static float(){return new this({type:"float"})}static bool(){return new this({type:"bool"})}static str(){return new this({type:"str"})}static bytes(){return new this({type:"bytes"})}static list(e){let r=new this({type:"list",value:e});return r.addReference(d.reference({name:"List",modulePath:["typing"]})),r.inheritReferences(e),r}static set(e){let r=new this({type:"set",value:e});return r.addReference(d.reference({name:"Set",modulePath:["typing"]})),r.inheritReferences(e),r}static tuple(e){let r=new this({type:"tuple",values:e});return r.addReference(d.reference({name:"Tuple",modulePath:["typing"]})),e.forEach(i=>r.inheritReferences(i)),r}static dict(e,r){let i=new this({type:"dict",keyType:e,valueType:r});return i.addReference(d.reference({name:"Dict",modulePath:["typing"]})),i.inheritReferences(e),i.inheritReferences(r),i}static none(){return new this({type:"none"})}static uuid(){let e=new this({type:"uuid"});return e.addReference(d.reference({name:"UUID",modulePath:["uuid"]})),e}static optional(e){if(this.isAlreadyOptional(e))return e;let r=new this({type:"optional",value:e});return r.addReference(d.reference({name:"Optional",modulePath:["typing"]})),r.inheritReferences(e),r}static union(e){let r=new this({type:"union",values:e});return r.addReference(d.reference({name:"Union",modulePath:["typing"]})),e.forEach(i=>r.inheritReferences(i)),r}static any(){let e=new this({type:"any"});return e.addReference(d.reference({name:"Any",modulePath:["typing"]})),e}static datetime(){let e=new this({type:"datetime"});return e.addReference(d.reference({name:"datetime",modulePath:["datetime"]})),e}static reference(e){let r=new this({type:"reference",value:e});return r.addReference(e),r}static literal(e){let r=new this({type:"literal",value:e});return r.addReference(d.reference({name:"Literal",modulePath:["typing"]})),r}static isAlreadyOptional(e){return e.internalType.type==="optional"}};f();u();var J=class n extends w{constructor(e){super();l(this,"internalType");this.internalType=e}static int(e){return new this({type:"int",value:e})}static float(e){return new this({type:"float",value:e})}static bool(e){return new this({type:"bool",value:e})}static str(e,r={multiline:!1,startOnNewLine:!1,endWithNewLine:!1}){return new this({type:"str",value:e,config:r})}static bytes(e){return new this({type:"bytes",value:e})}static list(e,r={endWithComma:!1}){let i=new this({type:"list",values:e,config:r});return e.forEach(o=>i.inheritReferences(o)),i}static set(e,r={endWithComma:!1}){let i=new this({type:"set",values:e,config:r});return e.forEach(o=>i.inheritReferences(o)),i}static tuple(e,r={endWithComma:!1}){let i=new this({type:"tuple",values:e,config:r});return e.forEach(o=>i.inheritReferences(o)),i}static typedDict(e,r={endWithComma:!1}){let i=new this({type:"typedDict",entries:e,config:r});return e.forEach(o=>i.inheritReferences(o.value)),i}static date(e){let r=new this({type:"date",value:e});return r.addReference(new L({name:"date",modulePath:["datetime"]})),r}static datetime(e){let r=new this({type:"datetime",value:e});return r.addReference(new L({name:"datetime",modulePath:["datetime"]})),r}static dict(e,r={endWithComma:!1}){let i=new this({type:"dict",entries:e,config:r});return e.forEach(o=>{i.inheritReferences(o.key),i.inheritReferences(o.value)}),i}static reference(e){let r=new this({type:"reference",value:e});return r.inheritReferences(e),r}static none(){return new this({type:"none"})}static unknown(e){return new this({type:"unknown",value:e})}static uuid(e){let r=new this({type:"uuid",value:e});return r.addReference(new L({name:"UUID",modulePath:["uuid"]})),r}static nop(){return new this({type:"nop"})}static isNop(e){return e instanceof n&&e.internalType.type==="nop"}isTypedDict(){return this.internalType.type==="typedDict"}asTypedDictOrThrow(){if(this.isTypedDict())return this.internalType;throw new Error("Internal error; python.TypeInstantiation is not a TypedDict")}write(e){var r,i,o,a,p,c,x,h,y,T,v;switch(this.internalType.type){case"int":e.write(this.internalType.value.toString());break;case"float":e.write(this.internalType.value.toString());break;case"bool":this.internalType.value?e.write("True"):e.write("False");break;case"str":if((r=this.internalType.config)!=null&&r.multiline){let{startOnNewLine:g,endWithNewLine:R}=this.internalType.config;this.writeStringWithTripleQuotes({writer:e,value:this.internalType.value,startOnNewLine:g,endWithNewLine:R})}else e.write(`"${this.escapeString(this.internalType.value)}"`);break;case"date":e.write(`date.fromisoformat("${this.internalType.value}")`);break;case"datetime":e.write(`datetime.fromisoformat("${this.internalType.value}")`);break;case"bytes":e.write(`b"${this.internalType.value}"`);break;case"list":{let g=this.internalType,R=nt({values:g.values});if(R.length===0){e.write("[]");break}e.write("["),(i=g.config)!=null&&i.multiline&&(e.newLine(),e.indent()),R.forEach((I,N)=>{var S,P;N>0&&(e.write(","),(S=g.config)!=null&&S.multiline?e.newLine():e.write(" ")),I.write(e),N===R.length-1&&((P=g.config)!=null&&P.endWithComma)&&e.write(",")}),(o=g.config)!=null&&o.multiline&&(e.newLine(),e.dedent()),e.write("]");break}case"set":{let g=this.internalType,R=nt({values:g.values});if(R.length===0){e.write("{}");break}e.write("{"),(a=g.config)!=null&&a.multiline&&(e.newLine(),e.indent()),R.forEach((I,N)=>{var S,P;N>0&&(e.write(","),(S=g.config)!=null&&S.multiline?e.newLine():e.write(" ")),I.write(e),N===R.length-1&&((P=g.config)!=null&&P.endWithComma)&&e.write(",")}),(p=g.config)!=null&&p.multiline&&(e.newLine(),e.dedent()),e.write("}");break}case"tuple":{let g=this.internalType,R=nt({values:g.values});if(R.length===0){e.write("()");break}e.write("("),(c=g.config)!=null&&c.multiline&&(e.newLine(),e.indent()),R.forEach((I,N)=>{var S,P;N>0&&(e.write(","),(S=g.config)!=null&&S.multiline?e.newLine():e.write(" ")),I.write(e),(R.length===1||N===R.length-1&&((P=g.config)!=null&&P.endWithComma))&&e.write(",")}),(x=g.config)!=null&&x.multiline&&(e.newLine(),e.dedent()),e.write(")");break}case"dict":{let g=this.internalType,R=Oo({entries:g.entries});if(R.length===0){e.write("{}");break}e.write("{"),(h=g.config)!=null&&h.multiline&&(e.newLine(),e.indent()),R.forEach((I,N)=>{var S,P;N>0&&(e.write(","),(S=g.config)!=null&&S.multiline?e.newLine():e.write(" ")),I.key.write(e),e.write(": "),I.value.write(e),N===R.length-1&&((P=g.config)!=null&&P.endWithComma)&&e.write(",")}),(y=g.config)!=null&&y.multiline&&(e.newLine(),e.dedent()),e.write("}");break}case"typedDict":{let g=this.internalType,R=_o({entries:g.entries});if(R.length===0){e.write("{}");break}e.write("{"),(T=g.config)!=null&&T.multiline&&(e.writeLine(),e.indent()),R.forEach((I,N)=>{var S;N>0&&(e.write(","),(S=g.config)!=null&&S.multiline?e.newLine():e.write(" ")),e.write(`"${I.name}": `),I.value.write(e)}),(v=g.config)!=null&&v.multiline&&(e.newLine(),e.dedent()),e.write("}");break}case"reference":{this.internalType.value.write(e);break}case"none":e.write("None");break;case"unknown":this.writeUnknown({writer:e,value:this.internalType.value});break;case"uuid":e.write(`UUID("${this.internalType.value}")`);break;case"nop":break;default:E(this.internalType)}}writeStringWithTripleQuotes({writer:e,value:r,startOnNewLine:i,endWithNewLine:o}){var p;e.write('"""');let a=r.split(`
|
|
17
|
-
`);if(a.length<=1){e.write(this.escapeString((p=a[0])!=null?p:"")),e.write('"""');return}i&&e.writeNoIndent(`\\
|
|
18
|
-
`),a.forEach((c,x)=>{e.writeNoIndent(this.escapeString(c)),x===a.length-1?o&&e.writeNoIndent(`\\
|
|
19
|
-
`):e.writeNoIndent(`
|
|
20
|
-
`)}),e.writeNoIndent('"""')}escapeString(e){let r=new RegExp(`(?<!\\\\)(["'\\\\\\t\\n\\r])`,"g"),i={'"':'\\"',"'":"\\'","\\":"\\\\"," ":"\\t","\n":"\\n","\r":"\\r"};return e.replace(r,o=>{var a;return(a=i[o])!=null?a:o})}writeUnknown({writer:e,value:r}){switch(typeof r){case"boolean":e.write(r?"True":"False");return;case"string":e.write(`"${this.escapeString(r)}"`);return;case"number":e.write(r.toString());return;case"object":if(r==null){e.write("None");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,a]of i)e.write(`"${o}": `),e.writeNode(n.unknown(a)),e.writeLine(",");e.dedent(),e.write("}")}};function Oo({entries:n}){return n.filter(t=>!J.isNop(t.key)&&!J.isNop(t.value))}function _o({entries:n}){return n.filter(t=>!J.isNop(t.value))}function nt({values:n}){return n.filter(t=>!J.isNop(t))}function Mo(n){return new oe(n)}function Do(n){return new We(n)}function Wo(n){return new xe(n)}function Vo(n){return new G(n)}function $o(n){return new se(n)}function jo(n){return new ue(n)}function zo(n){return new L(n)}function Yo(n){return new Z(n)}function Go(n){return new q(n)}function qo(n){return new $(n)}function Ho(n){return new fe(n)}function Qo(n){return new le(n)}function Zo(n){return new pe(n)}function Jo(n){return new Q(n)}function Ko(n){return new ae(n)}function Xo(n){return new de(n)}function ea(n){return new H(n)}function ta(n){return new me(n)}function ra(n){return new he(n)}f();u();var na="value",$e=class{constructor({context:t}){l(this,"context");this.context=t}convert(t){if(t.value===null)return this.context.isNullable(t.typeReference)?d.TypeInstantiation.none():(this.context.errors.add({severity:b.Critical,message:"Expected non-null value, but got null"}),d.TypeInstantiation.nop());if(t.value===void 0)return d.TypeInstantiation.nop();switch(t.typeReference.type){case"list":return this.convertList({list:t.typeReference.value,value:t.value});case"literal":return this.convertLiteral({literalType:t.typeReference.value,value:t.value});case"map":return this.convertMap({map:t.typeReference,value:t.value});case"named":{let e=this.context.resolveNamedType({typeId:t.typeReference.value});return e==null?d.TypeInstantiation.nop():this.convertNamed({named:e,value:t.value,as:t.as})}case"optional":return this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as});case"nullable":return this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as});case"primitive":return this.convertPrimitive({primitive:t.typeReference.value,value:t.value,as:t.as});case"set":return this.convertSet({set:t.typeReference.value,value:t.value});case"unknown":return d.TypeInstantiation.unknown(t.value);default:E(t.typeReference)}}convertLiteral({literalType:t,value:e}){switch(t.type){case"boolean":{let r=this.context.getValueAsBoolean({value:e});return r==null?d.TypeInstantiation.nop():d.TypeInstantiation.bool(r)}case"string":{let r=this.context.getValueAsString({value:e});return r==null?d.TypeInstantiation.nop():d.TypeInstantiation.str(r)}default:E(t)}}convertList({list:t,value:e}){return Array.isArray(e)?d.TypeInstantiation.list(e.map((r,i)=>{this.context.errors.scope({index:i});try{return this.convert({typeReference:t,value:r})}finally{this.context.errors.unscope()}}),{multiline:!0}):(this.context.errors.add({severity:b.Critical,message:`Expected array but got: ${typeof e}`}),d.TypeInstantiation.nop())}convertSet({set:t,value:e}){return Array.isArray(e)?d.TypeInstantiation.list(e.map((r,i)=>{this.context.errors.scope({index:i});try{return this.convert({typeReference:t,value:r})}finally{this.context.errors.unscope()}}),{multiline:!0}):(this.context.errors.add({severity:b.Critical,message:`Expected array but got: ${typeof e}`}),d.TypeInstantiation.nop())}convertMap({map:t,value:e}){return typeof e!="object"||e==null?(this.context.errors.add({severity:b.Critical,message:`Expected object but got: ${e==null?"null":typeof e}`}),d.TypeInstantiation.nop()):d.TypeInstantiation.dict(Object.entries(e).map(([r,i])=>{this.context.errors.scope(r);try{return{key:this.convert({typeReference:t.key,value:r,as:"key"}),value:this.convert({typeReference:t.value,value:i})}}finally{this.context.errors.unscope()}}),{multiline:!0})}convertNamed({named:t,value:e,as:r}){switch(t.type){case"alias":return this.convert({typeReference:t.typeReference,value:e,as:r});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:t,value:e});case"enum":return this.convertEnum({enum_:t,value:e});case"object":return this.convertObject({object_:t,value:e});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e});default:E(t)}}convertDiscriminatedUnion({discriminatedUnion:t,value:e}){let r=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e});if(r==null)return d.TypeInstantiation.nop();let i=r.singleDiscriminatedUnionType,o=this.convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:r,unionVariant:i});if(o==null)return d.TypeInstantiation.nop();let a={name:this.context.getPropertyName(t.discriminant.name),value:d.TypeInstantiation.str(i.discriminantValue.wireValue)};return d.TypeInstantiation.typedDict([a,...o],{multiline:!0})}convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:t,unionVariant:e}){let r=this.getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:e});switch(e.type){case"samePropertiesAsObject":{let i=this.context.resolveNamedType({typeId:e.typeId});if(i==null)return;let o=this.convertNamed({named:i,value:t.value});if(!o.isTypedDict()){this.context.errors.add({severity:b.Critical,message:"Internal error; expected union value to be an object"});return}let a=o.asTypedDictOrThrow();return[...r,...a.entries]}case"singleProperty":try{this.context.errors.scope(e.discriminantValue.wireValue);let i=this.context.getRecord(t.value);return i==null?[...r,{name:na,value:this.convert({typeReference:e.typeReference,value:t.value})}]:[...r,{name:this.context.getPropertyName(e.discriminantValue.name),value:this.convert({typeReference:e.typeReference,value:i[e.discriminantValue.wireValue]})}]}finally{this.context.errors.unscope()}case"noProperties":return r;default:E(e)}}getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:e}){var i,o;return this.context.associateByWireValue({parameters:(i=e.properties)!=null?i:[],values:(o=this.context.getRecord(t.value))!=null?o:{},ignoreMissingParameters:!0}).map(a=>{this.context.errors.scope(a.name.wireValue);try{return{name:this.context.getPropertyName(a.name.name),value:this.convert(a)}}finally{this.context.errors.unscope()}})}convertObject({object_:t,value:e}){var i;let r=this.context.associateByWireValue({parameters:t.properties,values:(i=this.context.getRecord(e))!=null?i:{}});return d.TypeInstantiation.typedDict(r.map(o=>{this.context.errors.scope(o.name.wireValue);try{return{name:this.context.getPropertyName(o.name.name),value:this.convert(o)}}finally{this.context.errors.unscope()}}),{multiline:!0})}convertEnum({enum_:t,value:e}){let r=this.getEnumValue({enum_:t,value:e});return r==null?d.TypeInstantiation.nop():d.TypeInstantiation.str(r)}getEnumValue({enum_:t,value:e}){if(typeof e!="string"){this.context.errors.add({severity:b.Critical,message:`Expected enum value string, got: ${typeof e}`});return}if(t.values.find(i=>i.wireValue===e)==null){this.context.errors.add({severity:b.Critical,message:`An enum value named "${e}" does not exist in this context`});return}return e}convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e}){let r=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e});return r==null?d.TypeInstantiation.nop():r}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e}){for(let r of t.types)try{return this.convert({typeReference:r,value:e})}catch(i){continue}this.context.errors.add({severity:b.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof e}" value`})}convertPrimitive({primitive:t,value:e,as:r}){switch(t){case"INTEGER":case"LONG":case"UINT":case"UINT_64":{let i=this.getValueAsNumber({value:e,as:r});return i==null?d.TypeInstantiation.nop():d.TypeInstantiation.int(i)}case"FLOAT":case"DOUBLE":{let i=this.getValueAsNumber({value:e});return i==null?d.TypeInstantiation.nop():d.TypeInstantiation.float(i)}case"BOOLEAN":{let i=this.getValueAsBoolean({value:e,as:r});return i==null?d.TypeInstantiation.nop():d.TypeInstantiation.bool(i)}case"BASE_64":case"BIG_INTEGER":case"STRING":{let i=this.context.getValueAsString({value:e});return i==null?d.TypeInstantiation.nop():d.TypeInstantiation.str(i)}case"UUID":{let i=this.context.getValueAsString({value:e});return i==null?d.TypeInstantiation.nop():d.TypeInstantiation.uuid(i)}case"DATE":{let i=this.context.getValueAsString({value:e});return i==null?d.TypeInstantiation.nop():d.TypeInstantiation.date(i)}case"DATE_TIME":{let i=this.context.getValueAsString({value:e});return i==null?d.TypeInstantiation.nop():d.TypeInstantiation.datetime(i)}default:E(t)}}getValueAsNumber({value:t,as:e}){let r=e==="key"&&typeof t=="string"?Number(t):t;return this.context.getValueAsNumber({value:r})}getValueAsBoolean({value:t,as:e}){let r=e==="key"?typeof t=="string"?t==="true":t==="false"?!1:t:t;return this.context.getValueAsBoolean({value:r})}};f();u();var je=class{constructor({context:t}){l(this,"context");this.context=t}getFilePropertyInfo({body:t,value:e}){var o;let r={fileFields:[],bodyPropertyFields:[]},i=(o=this.context.getRecord(e))!=null?o:{};for(let a of t.properties)switch(a.type){case"file":{let p=this.getSingleFileProperty({property:a,record:i});if(d.TypeInstantiation.isNop(p))break;r.fileFields.push({name:this.context.getPropertyName(a.name),value:p});break}case"fileArray":{let p=this.getArrayFileProperty({property:a,record:i});if(d.TypeInstantiation.isNop(p))break;r.fileFields.push({name:this.context.getPropertyName(a.name),value:p});break}case"bodyProperty":{let p=this.getBodyProperty({property:a,record:i});if(d.TypeInstantiation.isNop(p))break;r.bodyPropertyFields.push({name:this.context.getPropertyName(a.name.name),value:p});break}default:E(a)}return r}getSingleFileProperty({property:t,record:e}){var i;let r=this.context.getSingleFileValue({property:t,record:e});return r==null&&(r=`example_${(i=t.wireValue)!=null?i:"file"}`),this.context.getFileFromString(r)}getArrayFileProperty({property:t,record:e}){let r=this.context.getFileArrayValues({property:t,record:e});return r==null?d.TypeInstantiation.nop():d.TypeInstantiation.list(r.map(i=>this.context.getFileFromString(i)))}getBodyProperty({property:t,record:e}){let r=e[t.name.wireValue];return r==null?d.TypeInstantiation.nop():this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:r})}};var ia=["list","set"],it=class n extends be{constructor({ir:e,config:r}){var i;super({ir:e,config:r});l(this,"ir");l(this,"customConfig");l(this,"dynamicTypeLiteralMapper");l(this,"filePropertyMapper");this.ir=e,this.customConfig=(i=r.customConfig)!=null?i:{},this.dynamicTypeLiteralMapper=new $e({context:this}),this.filePropertyMapper=new je({context:this})}clone(){return new n({ir:this.ir,config:this.config})}getClassName(e){let r=e.pascalCase.safeName,i=this.getRootClientClassName();return r===i?`${i}Model`:r}getTypedDictClassName(e){return`${this.getClassName(e)}Params`}getPropertyName(e){let r=e.snakeCase.safeName;return r.startsWith("_")?"f_"+r.substring(r.lastIndexOf("_")+1):r}getMethodName(e){return ia.includes(e.snakeCase.unsafeName)?e.snakeCase.unsafeName:e.snakeCase.safeName}getRootClientClassReference(){return d.reference({name:this.getRootClientClassName(),modulePath:this.getRootModulePath()})}getRootClientClassName(){var e,r;return((e=this.customConfig.client)==null?void 0:e.exported_class_name)!=null?this.customConfig.client.exported_class_name:this.customConfig.client_class_name!=null?this.customConfig.client_class_name:((r=this.customConfig.client)==null?void 0:r.class_name)!=null?this.customConfig.client.class_name:this.pascalCase(this.config.organization)+this.pascalCase(this.config.workspaceName)}getEnvironmentClassName(){return`${this.getRootClientClassName()}Environment`}getEnvironmentTypeReferenceFromID(e){let r=this.resolveEnvironmentName(e);if(r!=null)return d.accessAttribute({lhs:this.getEnvironmentClassReference(),rhs:d.codeBlock(this.getEnvironmentEnumName(r))})}getEnvironmentClassReference(){return d.reference({name:this.getEnvironmentClassName(),modulePath:this.getEnvironmentModulePath()})}getEnvironmentEnumName(e){return e.screamingSnakeCase.safeName}isPrimitive(e){switch(e.type){case"primitive":return!0;case"optional":case"nullable":return this.isPrimitive(e.value);case"named":{let r=this.resolveNamedType({typeId:e.value});if(r==null)return!1;switch(r.type){case"alias":return this.isPrimitive(r.typeReference);case"discriminatedUnion":case"undiscriminatedUnion":case"object":case"enum":return!1;default:E(r)}break}case"list":case"set":case"map":case"literal":case"unknown":return!1;default:E(e)}}getFileFromString(e){return d.TypeInstantiation.str(e)}getRootModulePath(){if(this.customConfig.package_name!=null)return[this.customConfig.package_name];let e=this.cleanOrganizationName();return this.customConfig.use_api_name_in_package?[e,this.getApiName()]:[e]}getCoreModulePath(){return this.getRootModulePath().concat("core")}getEnvironmentModulePath(){return this.getRootModulePath().concat("environment")}shouldInlinePathParameters(){return!0}cleanOrganizationName(){return this.config.organization.replace(/[^a-zA-Z0-9]/g,"_")}getApiName(){return et(this.config.workspaceName)}pascalCase(e){let r=Xe(e);return r.charAt(0).toUpperCase()+r.slice(1)}};0&&(module.exports={DynamicSnippetsGeneratorContext});
|
|
21
|
-
/*! Bundled license information:
|
|
22
|
-
|
|
23
|
-
@esbuild-plugins/node-globals-polyfill/Buffer.js:
|
|
24
|
-
(*!
|
|
25
|
-
* The buffer module from node.js, for the browser.
|
|
26
|
-
*
|
|
27
|
-
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|
28
|
-
* @license MIT
|
|
29
|
-
*)
|
|
30
|
-
|
|
31
|
-
lodash-es/lodash.js:
|
|
32
|
-
(**
|
|
33
|
-
* @license
|
|
34
|
-
* Lodash (Custom Build) <https://lodash.com/>
|
|
35
|
-
* Build: `lodash modularize exports="es" -o ./`
|
|
36
|
-
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
37
|
-
* Released under MIT license <https://lodash.com/license>
|
|
38
|
-
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
39
|
-
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
40
|
-
*)
|
|
41
|
-
*/
|
|
42
|
-
//# sourceMappingURL=DynamicSnippetsGeneratorContext.cjs.map
|