@fern-api/python-dynamic-snippets 0.0.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.
Files changed (34) hide show
  1. package/cjs/DynamicSnippetsGenerator.cjs +34 -0
  2. package/cjs/DynamicSnippetsGenerator.d.cts +18 -0
  3. package/cjs/DynamicSnippetsGeneratorContext-aXWxVpwD.d.cts +86 -0
  4. package/cjs/EndpointSnippetGenerator.cjs +23 -0
  5. package/cjs/EndpointSnippetGenerator.d.cts +52 -0
  6. package/cjs/context/DynamicSnippetsGeneratorContext.cjs +34 -0
  7. package/cjs/context/DynamicSnippetsGeneratorContext.d.cts +5 -0
  8. package/cjs/context/DynamicTypeLiteralMapper.cjs +23 -0
  9. package/cjs/context/DynamicTypeLiteralMapper.d.cts +5 -0
  10. package/cjs/context/FilePropertyMapper.cjs +23 -0
  11. package/cjs/context/FilePropertyMapper.d.cts +5 -0
  12. package/cjs/index.cjs +46 -0
  13. package/cjs/index.d.cts +7 -0
  14. package/esm/DynamicSnippetsGenerator.d.ts +18 -0
  15. package/esm/DynamicSnippetsGenerator.js +1 -0
  16. package/esm/DynamicSnippetsGeneratorContext-aXWxVpwD.d.ts +86 -0
  17. package/esm/EndpointSnippetGenerator.d.ts +52 -0
  18. package/esm/EndpointSnippetGenerator.js +1 -0
  19. package/esm/chunk-BVS32MTY.js +1 -0
  20. package/esm/chunk-EX7EKKG4.js +1 -0
  21. package/esm/chunk-IM4ZUKD4.js +1 -0
  22. package/esm/chunk-LKHXBDU2.js +1 -0
  23. package/esm/chunk-NPWTXI2T.js +23 -0
  24. package/esm/chunk-OCJMJMBV.js +14 -0
  25. package/esm/chunk-ZMJ4WKFB.js +1 -0
  26. package/esm/context/DynamicSnippetsGeneratorContext.d.ts +5 -0
  27. package/esm/context/DynamicSnippetsGeneratorContext.js +1 -0
  28. package/esm/context/DynamicTypeLiteralMapper.d.ts +5 -0
  29. package/esm/context/DynamicTypeLiteralMapper.js +1 -0
  30. package/esm/context/FilePropertyMapper.d.ts +5 -0
  31. package/esm/context/FilePropertyMapper.js +1 -0
  32. package/esm/index.d.ts +7 -0
  33. package/esm/index.js +13 -0
  34. package/package.json +27 -0
@@ -0,0 +1,52 @@
1
+ import { FernIr } from '@fern-api/dynamic-ir-sdk';
2
+ import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-aXWxVpwD.cjs';
3
+ import '@fern-api/browser-compatible-base-generator';
4
+ import '@fern-api/python-ast';
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
+ private buildPythonFile;
21
+ private constructClient;
22
+ private getConstructorArgs;
23
+ private getConstructorEnvironmentArgs;
24
+ private getEnvironmentValue;
25
+ private getConstructorAuthArgs;
26
+ private getConstructorBasicAuthArg;
27
+ private getConstructorBearerAuthArgs;
28
+ private getConstructorHeaderAuthArgs;
29
+ private getConstructorOAuthArgs;
30
+ private getConstructorHeaderArgs;
31
+ private getConstructorHeaderArg;
32
+ private callMethod;
33
+ private getMethodArgs;
34
+ private getMethodArgsForBodyRequest;
35
+ private getBodyRequestArgs;
36
+ private getBodyRequestArgsForTypeReference;
37
+ private getBodyRequestArgsForNamedTypeReference;
38
+ private getBodyRequestArgsForBytes;
39
+ private getBytesBodyRequestTypeInstantiation;
40
+ private getMethodArgsForInlinedRequest;
41
+ private getFilePropertyInfo;
42
+ private getInlinedRequestArgs;
43
+ private getInlinedRequestBodyObjectFields;
44
+ private getFileUploadRequestBodyObjectFields;
45
+ private getReferencedRequestBodyPropertyTypeInstantiation;
46
+ private getInlinedRequestBodyPropertyObjectFields;
47
+ private getPathParameters;
48
+ private getMethod;
49
+ private getEnvironmentOptionName;
50
+ }
51
+
52
+ export { EndpointSnippetGenerator };
@@ -0,0 +1,34 @@
1
+ "use strict";var Ee=Object.defineProperty,Ir=Object.defineProperties,Nr=Object.getOwnPropertyDescriptor,Sr=Object.getOwnPropertyDescriptors,Cr=Object.getOwnPropertyNames,Re=Object.getOwnPropertySymbols;var We=Object.prototype.hasOwnProperty,Ke=Object.prototype.propertyIsEnumerable;var Oe=(n,t,e)=>t in n?Ee(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,be=(n,t)=>{for(var e in t||(t={}))We.call(t,e)&&Oe(n,e,t[e]);if(Re)for(var e of Re(t))Ke.call(t,e)&&Oe(n,e,t[e]);return n},Xe=(n,t)=>Ir(n,Sr(t));var et=n=>typeof n=="symbol"?n:n+"",Ae=(n,t)=>{var e={};for(var r in n)We.call(n,r)&&t.indexOf(r)<0&&(e[r]=n[r]);if(n!=null&&Re)for(var r of Re(n))t.indexOf(r)<0&&Ke.call(n,r)&&(e[r]=n[r]);return e};var Ve=(n,t)=>()=>(n&&(t=n(n=0)),t);var tt=(n,t)=>{for(var e in t)Ee(n,e,{get:t[e],enumerable:!0})},Pr=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Cr(t))!We.call(n,i)&&i!==e&&Ee(n,i,{get:()=>t[i],enumerable:!(r=Nr(t,i))||r.enumerable});return n};var Ur=n=>Pr(Ee({},"__esModule",{value:!0}),n);var l=(n,t,e)=>Oe(n,typeof t!="symbol"?t+"":t,e);function nt(){throw new Error("setTimeout has not been defined")}function it(){throw new Error("clearTimeout has not been defined")}function ot(n){if(V===setTimeout)return setTimeout(n,0);if((V===nt||!V)&&setTimeout)return V=setTimeout,setTimeout(n,0);try{return V(n,0)}catch(t){try{return V.call(null,n,0)}catch(e){return V.call(this,n,0)}}}function kr(n){if(j===clearTimeout)return clearTimeout(n);if((j===it||!j)&&clearTimeout)return j=clearTimeout,clearTimeout(n);try{return j(n)}catch(t){try{return j.call(null,n)}catch(e){return j.call(this,n)}}}function Lr(){!te||!Q||(te=!1,Q.length?D=Q.concat(D):Ie=-1,D.length&&at())}function at(){if(!te){var n=ot(Lr);te=!0;for(var t=D.length;t;){for(Q=D,D=[];++Ie<t;)Q&&Q[Ie].run();Ie=-1,t=D.length}Q=null,te=!1,kr(n)}}function Br(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];D.push(new st(n,t)),D.length===1&&!te&&ot(at)}function st(n,t){this.fun=n,this.array=t}function J(){}function Jr(n){throw new Error("process.binding is not supported")}function Kr(){return"/"}function Xr(n){throw new Error("process.chdir is not supported")}function en(){return 0}function rn(n){var t=tn.call(ee)*.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 on(){var n=new Date,t=n-nn;return t/1e3}var V,j,D,te,Q,Ie,Fr,_r,Dr,Mr,Or,Wr,Vr,jr,$r,Yr,zr,Gr,qr,Hr,Zr,Qr,ee,tn,nn,c,rt,f=Ve(()=>{"use strict";V=nt,j=it;typeof globalThis.setTimeout=="function"&&(V=setTimeout);typeof globalThis.clearTimeout=="function"&&(j=clearTimeout);D=[],te=!1,Ie=-1;st.prototype.run=function(){this.fun.apply(null,this.array)};Fr="browser",_r="browser",Dr=!0,Mr={},Or=[],Wr="",Vr={},jr={},$r={};Yr=J,zr=J,Gr=J,qr=J,Hr=J,Zr=J,Qr=J;ee=globalThis.performance||{},tn=ee.now||ee.mozNow||ee.msNow||ee.oNow||ee.webkitNow||function(){return new Date().getTime()};nn=new Date;c={nextTick:Br,title:Fr,browser:Dr,env:Mr,argv:Or,version:Wr,versions:Vr,on:Yr,addListener:zr,once:Gr,off:qr,removeListener:Hr,removeAllListeners:Zr,emit:Qr,binding:Jr,cwd:Kr,chdir:Xr,umask:en,hrtime:rn,platform:_r,release:jr,config:$r,uptime:on},rt={};Object.keys(rt).forEach(n=>{let t=n.split("."),e=c;for(let r=0;r<t.length;r++){let i=t[r];r===t.length-1?e[i]=rt[n]:e=e[i]||(e[i]={})}})});function pt(){$e=!0;for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=n.length;t<e;++t)B[t]=n[t],P[n.charCodeAt(t)]=t;P[45]=62,P[95]=63}function sn(n){$e||pt();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 an(p*3/4-o),r=o>0?p-4:p;var m=0;for(t=0,e=0;t<r;t+=4,e+=3)i=P[n.charCodeAt(t)]<<18|P[n.charCodeAt(t+1)]<<12|P[n.charCodeAt(t+2)]<<6|P[n.charCodeAt(t+3)],a[m++]=i>>16&255,a[m++]=i>>8&255,a[m++]=i&255;return o===2?(i=P[n.charCodeAt(t)]<<2|P[n.charCodeAt(t+1)]>>4,a[m++]=i&255):o===1&&(i=P[n.charCodeAt(t)]<<10|P[n.charCodeAt(t+1)]<<4|P[n.charCodeAt(t+2)]>>2,a[m++]=i>>8&255,a[m++]=i&255),a}function fn(n){return B[n>>18&63]+B[n>>12&63]+B[n>>6&63]+B[n&63]}function un(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(fn(r));return i.join("")}function ft(n){$e||pt();for(var t,e=n.length,r=e%3,i="",o=[],a=16383,p=0,m=e-r;p<m;p+=a)o.push(un(n,p,p+a>m?m:p+a));return r===1?(t=n[e-1],i+=B[t>>2],i+=B[t<<4&63],i+="=="):r===2&&(t=(n[e-2]<<8)+n[e-1],i+=B[t>>10],i+=B[t>>4&63],i+=B[t<<2&63],i+="="),o.push(i),o.join("")}function Ne(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function M(n,t){if(Ne()<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 Ye(this,n)}return ct(this,n,t,e)}function ct(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?cn(n,t,e,r):typeof t=="string"?pn(n,t,e):mn(n,t)}function mt(n){if(typeof n!="number")throw new TypeError('"size" argument must be a number');if(n<0)throw new RangeError('"size" argument must not be negative')}function ln(n,t,e,r){return mt(t),t<=0?M(n,t):e!==void 0?typeof r=="string"?M(n,t).fill(e,r):M(n,t).fill(e):M(n,t)}function Ye(n,t){if(mt(t),n=M(n,t<0?0:ze(t)|0),!s.TYPED_ARRAY_SUPPORT)for(var e=0;e<t;++e)n[e]=0;return n}function pn(n,t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!s.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=dt(t,e)|0;n=M(n,r);var i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function je(n,t){var e=t.length<0?0:ze(t.length)|0;n=M(n,e);for(var r=0;r<e;r+=1)n[r]=t[r]&255;return n}function cn(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=je(n,t),n}function mn(n,t){if(F(t)){var e=ze(t.length)|0;return n=M(n,e),n.length===0||t.copy(n,0,0,e),n}if(t){if(typeof ArrayBuffer!="undefined"&&t.buffer instanceof ArrayBuffer||"length"in t)return typeof t.length!="number"||kn(t.length)?M(n,0):je(n,t);if(t.type==="Buffer"&&Array.isArray(t.data))return je(n,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function ze(n){if(n>=Ne())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Ne().toString(16)+" bytes");return n|0}function F(n){return!!(n!=null&&n._isBuffer)}function dt(n,t){if(F(n))return n.length;if(typeof ArrayBuffer!="undefined"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(n)||n instanceof ArrayBuffer))return n.byteLength;typeof n!="string"&&(n=""+n);var e=n.length;if(e===0)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return Se(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return Tt(n).length;default:if(r)return Se(n).length;t=(""+t).toLowerCase(),r=!0}}function dn(n,t,e){var r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,t>>>=0,e<=t))return"";for(n||(n="utf8");;)switch(n){case"hex":return bn(this,t,e);case"utf8":case"utf-8":return yt(this,t,e);case"ascii":return Rn(this,t,e);case"latin1":case"binary":return En(this,t,e);case"base64":return vn(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return An(this,t,e);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),r=!0}}function K(n,t,e){var r=n[t];n[t]=n[e],n[e]=r}function ht(n,t,e,r,i){if(n.length===0)return-1;if(typeof e=="string"?(r=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:n.length-1),e<0&&(e=n.length+e),e>=n.length){if(i)return-1;e=n.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof t=="string"&&(t=s.from(t,r)),F(t))return t.length===0?-1:ut(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):ut(n,[t],e,r,i);throw new TypeError("val must be string, number or Buffer")}function ut(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 m(T,g){return o===1?T[g]:T.readUInt16BE(g*o)}var h;if(i){var x=-1;for(h=e;h<a;h++)if(m(n,h)===m(t,x===-1?0:h-x)){if(x===-1&&(x=h),h-x+1===p)return x*o}else x!==-1&&(h-=h-x),x=-1}else for(e+p>a&&(e=a-p),h=e;h>=0;h--){for(var y=!0,b=0;b<p;b++)if(m(n,h+b)!==m(t,b)){y=!1;break}if(y)return h}return-1}function hn(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 xn(n,t,e,r){return Ue(Se(t,n.length-e),n,e,r)}function xt(n,t,e,r){return Ue(Pn(t),n,e,r)}function yn(n,t,e,r){return xt(n,t,e,r)}function gn(n,t,e,r){return Ue(Tt(t),n,e,r)}function wn(n,t,e,r){return Ue(Un(t,n.length-e),n,e,r)}function vn(n,t,e){return t===0&&e===n.length?ft(n):ft(n.slice(t,e))}function yt(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 m,h,x,y;switch(p){case 1:o<128&&(a=o);break;case 2:m=n[i+1],(m&192)===128&&(y=(o&31)<<6|m&63,y>127&&(a=y));break;case 3:m=n[i+1],h=n[i+2],(m&192)===128&&(h&192)===128&&(y=(o&15)<<12|(m&63)<<6|h&63,y>2047&&(y<55296||y>57343)&&(a=y));break;case 4:m=n[i+1],h=n[i+2],x=n[i+3],(m&192)===128&&(h&192)===128&&(x&192)===128&&(y=(o&15)<<18|(m&63)<<12|(h&63)<<6|x&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 Tn(r)}function Tn(n){var t=n.length;if(t<=lt)return String.fromCharCode.apply(String,n);for(var e="",r=0;r<t;)e+=String.fromCharCode.apply(String,n.slice(r,r+=lt));return e}function Rn(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 En(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+=Cn(n[o]);return i}function An(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 C(n,t,e,r,i,o){if(!F(n))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(e+r>n.length)throw new RangeError("Index out of range")}function Ce(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 Pe(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 gt(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 wt(n,t,e,r,i){return i||gt(n,t,e,4,34028234663852886e22,-34028234663852886e22),Et(n,t,e,r,23,4),e+4}function vt(n,t,e,r,i){return i||gt(n,t,e,8,17976931348623157e292,-17976931348623157e292),Et(n,t,e,r,52,8),e+8}function Nn(n){if(n=Sn(n).replace(In,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}function Sn(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}function Cn(n){return n<16?"0"+n.toString(16):n.toString(16)}function Se(n,t){t=t||1/0;for(var e,r=n.length,i=null,o=[],a=0;a<r;++a){if(e=n.charCodeAt(a),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&o.push(239,191,189);continue}else if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&o.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;o.push(e)}else if(e<2048){if((t-=2)<0)break;o.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;o.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return o}function Pn(n){for(var t=[],e=0;e<n.length;++e)t.push(n.charCodeAt(e)&255);return t}function Un(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 Tt(n){return sn(Nn(n))}function Ue(n,t,e,r){for(var i=0;i<r&&!(i+e>=t.length||i>=n.length);++i)t[i+e]=n[i];return i}function kn(n){return n!==n}function Ln(n){return n!=null&&(!!n._isBuffer||Rt(n)||Bn(n))}function Rt(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function Bn(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&Rt(n.slice(0,0))}function ke(n,t,e,r,i){var o,a,p=i*8-r-1,m=(1<<p)-1,h=m>>1,x=-7,y=e?i-1:0,b=e?-1:1,T=n[t+y];for(y+=b,o=T&(1<<-x)-1,T>>=-x,x+=p;x>0;o=o*256+n[t+y],y+=b,x-=8);for(a=o&(1<<-x)-1,o>>=-x,x+=r;x>0;a=a*256+n[t+y],y+=b,x-=8);if(o===0)o=1-h;else{if(o===m)return a?NaN:(T?-1:1)*(1/0);a=a+Math.pow(2,r),o=o-h}return(T?-1:1)*a*Math.pow(2,o-r)}function Et(n,t,e,r,i,o){var a,p,m,h=o*8-i-1,x=(1<<h)-1,y=x>>1,b=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,T=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=x):(a=Math.floor(Math.log(t)/Math.LN2),t*(m=Math.pow(2,-a))<1&&(a--,m*=2),a+y>=1?t+=b/m:t+=b*Math.pow(2,1-y),t*m>=2&&(a++,m/=2),a+y>=x?(p=0,a=x):a+y>=1?(p=(t*m-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+T]=p&255,T+=g,p/=256,i-=8);for(a=a<<i|p,h+=i;h>0;n[e+T]=a&255,T+=g,a/=256,h-=8);n[e+T-g]|=R*128}var B,P,an,$e,lt,In,bt=Ve(()=>{"use strict";f();u();B=[],P=[],an=typeof Uint8Array!="undefined"?Uint8Array:Array,$e=!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 ct(null,n,t,e)};s.kMaxLength=Ne();s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&s[Symbol.species]);s.alloc=function(n,t,e){return ln(null,n,t,e)};s.allocUnsafe=function(n){return Ye(null,n)};s.allocUnsafeSlow=function(n){return Ye(null,n)};s.isBuffer=Ln;s.compare=function(t,e){if(!F(t)||!F(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,i=e.length,o=0,a=Math.min(r,i);o<a;++o)if(t[o]!==e[o]){r=t[o],i=e[o];break}return r<i?-1:i<r?1:0};s.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};s.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return s.alloc(0);var r;if(e===void 0)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var i=s.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var a=t[r];if(!F(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(i,o),o+=a.length}return i};s.byteLength=dt;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)K(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)K(this,e,e+3),K(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)K(this,e,e+7),K(this,e+1,e+6),K(this,e+2,e+5),K(this,e+3,e+4);return this};s.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?yt(this,0,t):dn.apply(this,arguments)};s.prototype.equals=function(t){if(!F(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:s.compare(this,t)===0};s.prototype.compare=function(t,e,r,i,o){if(!F(t))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),r===void 0&&(r=t?t.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),e<0||r>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&e>=r)return 0;if(i>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,i>>>=0,o>>>=0,this===t)return 0;for(var a=o-i,p=r-e,m=Math.min(a,p),h=this.slice(i,o),x=t.slice(e,r),y=0;y<m;++y)if(h[y]!==x[y]){a=h[y],p=x[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 ht(this,t,e,r,!0)};s.prototype.lastIndexOf=function(t,e,r){return ht(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 hn(this,t,e,r);case"utf8":case"utf-8":return xn(this,t,e,r);case"ascii":return xt(this,t,e,r);case"latin1":case"binary":return yn(this,t,e,r);case"base64":return gn(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return wn(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)}};lt=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),ke(this,t,!0,23,4)};s.prototype.readFloatBE=function(t,e){return e||A(t,4,this.length),ke(this,t,!1,23,4)};s.prototype.readDoubleLE=function(t,e){return e||A(t,8,this.length),ke(this,t,!0,52,8)};s.prototype.readDoubleBE=function(t,e){return e||A(t,8,this.length),ke(this,t,!1,52,8)};s.prototype.writeUIntLE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var o=Math.pow(2,8*r)-1;C(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;C(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||C(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||C(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):Ce(this,t,e,!0),e+2};s.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=e|0,r||C(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):Ce(this,t,e,!1),e+2};s.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=e|0,r||C(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):Pe(this,t,e,!0),e+4};s.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=e|0,r||C(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):Pe(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);C(this,t,e,r,o-1,-o)}var a=0,p=1,m=0;for(this[e]=t&255;++a<r&&(p*=256);)t<0&&m===0&&this[e+a-1]!==0&&(m=1),this[e+a]=(t/p>>0)-m&255;return e+r};s.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e=e|0,!i){var o=Math.pow(2,8*r-1);C(this,t,e,r,o-1,-o)}var a=r-1,p=1,m=0;for(this[e+a]=t&255;--a>=0&&(p*=256);)t<0&&m===0&&this[e+a+1]!==0&&(m=1),this[e+a]=(t/p>>0)-m&255;return e+r};s.prototype.writeInt8=function(t,e,r){return t=+t,e=e|0,r||C(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||C(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):Ce(this,t,e,!0),e+2};s.prototype.writeInt16BE=function(t,e,r){return t=+t,e=e|0,r||C(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):Ce(this,t,e,!1),e+2};s.prototype.writeInt32LE=function(t,e,r){return t=+t,e=e|0,r||C(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):Pe(this,t,e,!0),e+4};s.prototype.writeInt32BE=function(t,e,r){return t=+t,e=e|0,r||C(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):Pe(this,t,e,!1),e+4};s.prototype.writeFloatLE=function(t,e,r){return wt(this,t,e,!0,r)};s.prototype.writeFloatBE=function(t,e,r){return wt(this,t,e,!1,r)};s.prototype.writeDoubleLE=function(t,e,r){return vt(this,t,e,!0,r)};s.prototype.writeDoubleBE=function(t,e,r){return vt(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=F(t)?t:Se(new s(t,i).toString()),m=p.length;for(a=0;a<r-e;++a)this[a+e]=p[a%m]}return this};In=/[^+\/0-9A-Za-z-_]/g});var u=Ve(()=>{"use strict";bt()});var Go={};tt(Go,{DynamicSnippetsGeneratorContext:()=>Je});module.exports=Ur(Go);f();u();f();u();f();u();f();u();f();u();f();u();f();u();var Fn=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis,At=Fn;var _n=typeof self=="object"&&self&&self.Object===Object&&self,Dn=At||_n||Function("return this")(),It=Dn;var Mn=It.Symbol,O=Mn;f();u();var Nt=Object.prototype,On=Nt.hasOwnProperty,Wn=Nt.toString,he=O?O.toStringTag:void 0;function Vn(n){var t=On.call(n,he),e=n[he];try{n[he]=void 0;var r=!0}catch(o){}var i=Wn.call(n);return r&&(t?n[he]=e:delete n[he]),i}var St=Vn;f();u();var jn=Object.prototype,$n=jn.toString;function Yn(n){return $n.call(n)}var Ct=Yn;var zn="[object Null]",Gn="[object Undefined]",Pt=O?O.toStringTag:void 0;function qn(n){return n==null?n===void 0?Gn:zn:Pt&&Pt in Object(n)?St(n):Ct(n)}var Ut=qn;f();u();function Hn(n){return n!=null&&typeof n=="object"}var kt=Hn;var Zn="[object Symbol]";function Qn(n){return typeof n=="symbol"||kt(n)&&Ut(n)==Zn}var Lt=Qn;f();u();f();u();function Jn(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 Bt=Jn;f();u();var Kn=Array.isArray,Ft=Kn;var Xn=1/0,_t=O?O.prototype:void 0,Dt=_t?_t.toString:void 0;function Mt(n){if(typeof n=="string")return n;if(Ft(n))return Bt(n,Mt)+"";if(Lt(n))return Dt?Dt.call(n):"";var t=n+"";return t=="0"&&1/n==-Xn?"-0":t}var Ot=Mt;f();u();function ei(n){return n==null?"":Ot(n)}var $=ei;f();u();f();u();f();u();f();u();f();u();f();u();function ti(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 Wt=ti;function ri(n,t,e){var r=n.length;return e=e===void 0?r:e,!t&&e>=r?n:Wt(n,t,e)}var Vt=ri;f();u();var ni="\\ud800-\\udfff",ii="\\u0300-\\u036f",oi="\\ufe20-\\ufe2f",ai="\\u20d0-\\u20ff",si=ii+oi+ai,fi="\\ufe0e\\ufe0f",ui="\\u200d",li=RegExp("["+ui+ni+si+fi+"]");function pi(n){return li.test(n)}var Le=pi;f();u();f();u();function ci(n){return n.split("")}var jt=ci;f();u();var $t="\\ud800-\\udfff",mi="\\u0300-\\u036f",di="\\ufe20-\\ufe2f",hi="\\u20d0-\\u20ff",xi=mi+di+hi,yi="\\ufe0e\\ufe0f",gi="["+$t+"]",Ge="["+xi+"]",qe="\\ud83c[\\udffb-\\udfff]",wi="(?:"+Ge+"|"+qe+")",Yt="[^"+$t+"]",zt="(?:\\ud83c[\\udde6-\\uddff]){2}",Gt="[\\ud800-\\udbff][\\udc00-\\udfff]",vi="\\u200d",qt=wi+"?",Ht="["+yi+"]?",Ti="(?:"+vi+"(?:"+[Yt,zt,Gt].join("|")+")"+Ht+qt+")*",Ri=Ht+qt+Ti,Ei="(?:"+[Yt+Ge+"?",Ge,zt,Gt,gi].join("|")+")",bi=RegExp(qe+"(?="+qe+")|"+Ei+Ri,"g");function Ai(n){return n.match(bi)||[]}var Zt=Ai;function Ii(n){return Le(n)?Zt(n):jt(n)}var Qt=Ii;function Ni(n){return function(t){t=$(t);var e=Le(t)?Qt(t):void 0,r=e?e[0]:t.charAt(0),i=e?Vt(e,1).join(""):t.slice(1);return r[n]()+i}}var Jt=Ni;var Si=Jt("toUpperCase"),Kt=Si;function Ci(n){return Kt($(n).toLowerCase())}var Xt=Ci;f();u();f();u();function Pi(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 er=Pi;f();u();f();u();f();u();function Ui(n){return function(t){return n==null?void 0:n[t]}}var tr=Ui;var ki={\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"},Li=tr(ki),rr=Li;var Bi=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Fi="\\u0300-\\u036f",_i="\\ufe20-\\ufe2f",Di="\\u20d0-\\u20ff",Mi=Fi+_i+Di,Oi="["+Mi+"]",Wi=RegExp(Oi,"g");function Vi(n){return n=$(n),n&&n.replace(Bi,rr).replace(Wi,"")}var nr=Vi;f();u();f();u();var ji=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function $i(n){return n.match(ji)||[]}var ir=$i;f();u();var Yi=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function zi(n){return Yi.test(n)}var or=zi;f();u();var lr="\\ud800-\\udfff",Gi="\\u0300-\\u036f",qi="\\ufe20-\\ufe2f",Hi="\\u20d0-\\u20ff",Zi=Gi+qi+Hi,pr="\\u2700-\\u27bf",cr="a-z\\xdf-\\xf6\\xf8-\\xff",Qi="\\xac\\xb1\\xd7\\xf7",Ji="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ki="\\u2000-\\u206f",Xi=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",mr="A-Z\\xc0-\\xd6\\xd8-\\xde",eo="\\ufe0e\\ufe0f",dr=Qi+Ji+Ki+Xi,hr="['\u2019]",ar="["+dr+"]",to="["+Zi+"]",xr="\\d+",ro="["+pr+"]",yr="["+cr+"]",gr="[^"+lr+dr+xr+pr+cr+mr+"]",no="\\ud83c[\\udffb-\\udfff]",io="(?:"+to+"|"+no+")",oo="[^"+lr+"]",wr="(?:\\ud83c[\\udde6-\\uddff]){2}",vr="[\\ud800-\\udbff][\\udc00-\\udfff]",re="["+mr+"]",ao="\\u200d",sr="(?:"+yr+"|"+gr+")",so="(?:"+re+"|"+gr+")",fr="(?:"+hr+"(?:d|ll|m|re|s|t|ve))?",ur="(?:"+hr+"(?:D|LL|M|RE|S|T|VE))?",Tr=io+"?",Rr="["+eo+"]?",fo="(?:"+ao+"(?:"+[oo,wr,vr].join("|")+")"+Rr+Tr+")*",uo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",lo="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",po=Rr+Tr+fo,co="(?:"+[ro,wr,vr].join("|")+")"+po,mo=RegExp([re+"?"+yr+"+"+fr+"(?="+[ar,re,"$"].join("|")+")",so+"+"+ur+"(?="+[ar,re+sr,"$"].join("|")+")",re+"?"+sr+"+"+fr,re+"+"+ur,lo,uo,xr,co].join("|"),"g");function ho(n){return n.match(mo)||[]}var Er=ho;function xo(n,t,e){return n=$(n),t=e?void 0:t,t===void 0?or(n)?Er(n):ir(n):n.match(t)||[]}var br=xo;var yo="['\u2019]",go=RegExp(yo,"g");function wo(n){return function(t){return er(br(nr(t).replace(go,"")),n,"")}}var Be=wo;var vo=Be(function(n,t,e){return t=t.toLowerCase(),n+(e?Xt(t):t)}),He=vo;f();u();var To=Be(function(n,t,e){return n+(e?"_":"")+t.toLowerCase()}),Ze=To;f();u();f();u();function E(n){throw new Error("Unexpected value: "+JSON.stringify(n))}f();u();function xe(n){return Object.keys(n)}f();u();f();u();var X=class{};f();u();f();u();var L=class extends X{constructor(e){super();l(this,"value");this.value=e}write(e){typeof this.value=="string"?e.write(this.value):this.value(e)}};var Ro=4,ye=class{constructor(){l(this,"buffer","");l(this,"indentLevel",0);l(this,"hasWrittenAnything",!1);l(this,"lastCharacterIsSemicolon",!1);l(this,"lastCharacterIsNewline",!1)}write(t){let e=t.length>0&&t.endsWith(`
2
+ `),r=e?t.substring(0,t.length-1):t,i=this.getIndentString(),o=r.replaceAll(`
3
+ `,`
4
+ ${i}`);this.isAtStartOfLine()&&(o=i+o),e&&(o+=`
5
+ `),this.writeInternal(o)}writeNoIndent(t){let e=this.indentLevel;this.indentLevel=0,this.write(t),this.indentLevel=e}writeNode(t){t.write(this)}writeNodeOrString(t){if(typeof t=="string"){this.write(t);return}this.writeNode(t)}writeNodeStatement(t){t.write(this),this.write(";"),this.writeNewLineIfLastLineNot()}writeTextStatement(t){new L(t).write(this),this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(t,e){new L(t).write(this),this.write(" ("),this.writeNode(e),this.write(") {"),this.writeNewLineIfLastLineNot(),this.indent()}controlFlowWithoutStatement(t){new L(t).write(this),this.write(" {"),this.writeNewLineIfLastLineNot(),this.indent()}endControlFlow(){this.dedent(),this.writeLine("}")}contiguousControlFlow(t,e){this.dedent(),this.write("} "),new L(t).write(this),this.write(" ("),this.writeNode(e),this.write(") {"),this.writeNewLineIfLastLineNot(),this.indent()}alternativeControlFlow(t){this.dedent(),this.write("} "),new L(t).write(this),this.write(" {"),this.writeNewLineIfLastLineNot(),this.indent()}openBlock(t,e="{",r,i="}"){let o=t.filter(a=>a!==void 0).join(" ");o?this.write(`${o} ${e!=null?e:""}`):this.write(e!=null?e:"");try{this.indent(),r(),this.dedent()}finally{this.write(i!=null?i:"")}}writeLine(t=""){this.write(t),this.writeNewLineIfLastLineNot()}newLine(){this.writeInternal(`
6
+ `)}writeSemicolonIfLastCharacterIsNot(){this.lastCharacterIsSemicolon||this.writeInternal(";")}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
7
+ `)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:t,delimiter:e,writeFunction:r}){if(t.length>0){let i=t[0];i!=null&&r(i);for(let o=1;o<t.length;o++){this.write(e);let a=t[o];a!=null&&r(a)}}}toString(){return this.buffer}writeInternal(t){return t.length>0&&(this.hasWrittenAnything=!0,this.lastCharacterIsNewline=t.endsWith(`
8
+ `),this.lastCharacterIsSemicolon=t.endsWith(";")),this.buffer+=t}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*Ro)}};f();u();f();u();f();u();f();u();var ge=class{constructor(){l(this,"REFERENCE_REGEX",/^(GET|POST|PUT|DELETE|PATCH)\s(\/[a-zA-Z0-9\/{}_-]*)$/)}validate(t){return this.REFERENCE_REGEX.test(t)?{type:"valid"}:{type:"invalid"}}tryParse(t){if(this.validate(t).type==="invalid")return;let r=t.match(this.REFERENCE_REGEX);if(!(r==null||r[1]==null||r[2]==null))return{method:r[1],path:r[2]}}};f();u();var v={Critical:"CRITICAL",Warning:"WARNING"},we=class n{constructor(){l(this,"errors");l(this,"path");this.errors=[],this.path=[]}add(t){this.errors.push(Xe(be({},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 ve=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 we,this.httpEndpointReferenceParser=new ge}associateQueryParametersByWireValue({parameters:t,values:e}){let r=[];for(let[i,o]of Object.entries(e)){this.errors.scope(i);try{let a=t.find(m=>m.name.wireValue===i);if(a==null)throw this.newParameterNotRecognizedError(i);let 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}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(m=>m.name.wireValue===o);if(p==null){if(r)continue;this.errors.add({severity:v.Critical,message:this.newParameterNotRecognizedError(o).message});continue}i.push({name:p.name,typeReference:p.typeReference,value:a})}finally{this.errors.unscope()}}return i}getSingleFileValue({property:t,record:e}){let r=e[t.wireValue];if(r!=null){if(typeof r!="string"){this.errors.add({severity:v.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:v.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:v.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:v.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(t)?"array":typeof t}`});return}return t==null?{}:t}resolveNamedType({typeId:t}){let e=this._ir.types[t];if(e==null){this.errors.add({severity:v.Critical,message:`Type identified by "${t}" could not be found`});return}return e}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e}){let r=this.getRecord(e);if(r==null)return;let i=t.discriminant.wireValue,o=r[i];if(o==null){this.errors.add({severity:v.Critical,message:this.newParameterNotRecognizedError(i).message});return}if(typeof o!="string"){this.errors.add({severity:v.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:v.Critical,message:`No type found for discriminant value "${o}"`});return}let h=r,{[i]:p}=h,m=Ae(h,[et(i)]);return{singleDiscriminatedUnionType:a,discriminantValue:a.discriminantValue,value:m}}resolveEndpointOrThrow(t){let e=this.httpEndpointReferenceParser.tryParse(t);if(e==null)throw new Error(`Failed to parse endpoint reference "${t}"`);return this.resolveEndpointLocationOrThrow(e)}resolveEndpointLocationOrThrow(t){let e=[];for(let r of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:r,parsedEndpoint:t})&&e.push(r);if(e.length===0)throw new Error(`Failed to find endpoint identified by "${t.method} ${t.path}"`);return e}needsRequestParameter({request:t,inlinePathParameters:e,inlineFileProperties:r}){var i;return this.includePathParametersInWrappedRequest({request:t,inlinePathParameters:e})||t.queryParameters!=null&&t.queryParameters.length>0||t.headers!=null&&t.headers.length>0?!0:t.body!=null?this.includeRequestBodyInWrappedRequest({body:t.body,inlineFileProperties:r}):!((i=t.metadata)!=null&&i.onlyPathParameters)}includePathParametersInWrappedRequest({request:t,inlinePathParameters:e}){var r,i;return e&&((i=(r=t.metadata)==null?void 0:r.includePathParameters)!=null?i:!1)}isFileUploadRequestBody(t){switch(t.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default: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:v.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":return this.errors.add({severity:v.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let r=e.environments[0];if(r==null)return this.errors.add({severity:v.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let i=new Set(xe(r.urls));for(let o of xe(t))i.has(o)&&i.delete(o);return i.size>0?(this.errors.add({severity:v.Critical,message:`The provided environments are invalid; got: [${Object.keys(t).join(", ")}], expected: [${xe(r.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:t}){if(typeof t!="number"){this.errors.add({severity:v.Critical,message:this.newTypeMismatchError({expected:"number",value:t}).message});return}return t}getValueAsBoolean({value:t}){if(typeof t!="boolean"){this.errors.add({severity:v.Critical,message:this.newTypeMismatchError({expected:"boolean",value:t}).message});return}return t}getValueAsString({value:t}){if(typeof t!="string"){this.errors.add({severity:v.Critical,message:this.newTypeMismatchError({expected:"string",value:t}).message});return}return t}isOptional(t){switch(t.type){case"nullable":return this.isOptional(t.value);case"optional":return!0;case"named":{let e=this.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}isNullable(t){switch(t.type){case"nullable":return!0;case"optional":return this.isNullable(t.value);case"named":{let e=this.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}newAuthMismatchError({auth:t,values:e}){return new Error(`Expected auth type ${t.type}, got ${e.type}`)}newParameterNotRecognizedError(t){return new Error(`"${t}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:t,value:e}){return new Error(`Expected ${t}, got ${typeof e}`)}includeRequestBodyInWrappedRequest({body:t,inlineFileProperties:e}){switch(t.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:t,inlineFileProperties:e});default: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={};tt(d,{AccessAttribute:()=>ne,AstNode:()=>w,Class:()=>Y,ClassInstantiation:()=>oe,CodeBlock:()=>W,Comment:()=>ae,Decorator:()=>se,Field:()=>z,Lambda:()=>fe,LambdaParameter:()=>ue,Method:()=>q,MethodArgument:()=>pe,MethodInvocation:()=>ce,Operator:()=>me,Parameter:()=>G,PythonFile:()=>de,Reference:()=>U,StarImport:()=>H,Type:()=>_e,TypeInstantiation:()=>Z,accessAttribute:()=>Ao,assign:()=>Io,class_:()=>So,codeBlock:()=>Bo,comment:()=>Fo,decorator:()=>Po,field:()=>Lo,file:()=>No,instantiateClass:()=>Co,invokeFunction:()=>Oo,invokeMethod:()=>Wo,lambda:()=>_o,lambdaParameter:()=>Do,method:()=>Mo,methodArgument:()=>jo,operator:()=>$o,parameter:()=>Vo,reference:()=>Uo,starImport:()=>ko});f();u();f();u();f();u();f();u();var Te=class extends ye{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 X{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 Te;return this.write(e),e.toString()}async toStringFormatted(e){let r=new Te;return this.write(r),r.toStringFormatted(e)}};var ne=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 Fe=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 ie=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 Y=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 oe=class extends ie{constructor(r){var i=r,{classReference:t}=i,e=Ae(i,["classReference"]);super(be({reference:t},e))}};f();u();var W=class extends w{constructor(e){super();l(this,"arg");this.arg=e}write(e){return new L(this.arg).write(e)}};f();u();var ae=class extends w{constructor({docs:e}){super();l(this,"docs");this.docs=e}write(e){this.docs!=null&&this.docs.split(`
9
+ `).forEach(r=>{e.writeLine(`# ${r}`)})}};f();u();var se=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 z=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 fe=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 G=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 ue=class extends G{constructor({name:t,initializer:e}){super({name:t,initializer:e,type:void 0})}};f();u();var le;(function(n){n[n.STATIC=0]="STATIC",n[n.INSTANCE=1]="INSTANCE",n[n.CLASS=2]="CLASS"})(le||(le={}));var q=class extends w{constructor({static_:e,name:r,parameters:i,return_:o,docstring:a,type:p,decorators:m}){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=m!=null?m:[],this.static_=e!=null?e:!1,this.parameters.forEach(h=>{this.inheritReferences(h)}),this.inheritReferences(this.return),this.decorators.forEach(h=>{this.inheritReferences(h)}),this.statements.forEach(h=>{this.inheritReferences(h)})}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(r=>{r.write(e)}),this.type===le.CLASS?d.decorator({callable:new W("classmethod")}).write(e):this.type===le.STATIC&&d.decorator({callable:new W("staticmethod")}).write(e),e.write(`def ${this.name}(`),this.type===le.INSTANCE?(e.write("self"),this.parameters.length>0&&e.write(", ")):this.type===le.CLASS&&(e.write("cls"),this.parameters.length>0&&e.write(", ")),this.parameters.forEach((r,i)=>{r.write(e),i<this.parameters.length-1&&e.write(", ")}),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((r,i)=>{r.write(e),i<this.statements.length-1&&e.newLine()}),e.dedent()):(e.indent(),e.write("pass"),e.dedent()),e.newLine()}};f();u();var pe=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 ce=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 me=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();f();u();var U=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 H=class extends U{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.")}};f();u();function Ar(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(""))}var de=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("."),m=r.get(p);if(m){let{references:x}=m;x.forEach(y=>{let b=y.getFullyQualifiedModulePath(),T=y.name;o[b]={name:T,isAlias:!1},a.add(y.name)}),i.delete(p)}Array.from(i.values()).flatMap(({references:x})=>x).forEach(x=>{var N;if(x instanceof H)return;let y=(N=x.alias)!=null?N:x.name,b=x.getFullyQualifiedModulePath(),T=y,g=x.modulePath.length-1,R=!!x.alias;for(;a.has(T);){R=!0;let I=x.modulePath[g];g<0||!I?T=`_${T}`:T=`${Ar(I)}${T}`,g--}a.add(T),o[b]={name:T,isAlias:R}}),e.setRefNameOverrides(o)}getInitialUsedNames(){let e=new Set;return this.statements.forEach(r=>{(r instanceof Y||r instanceof q||r instanceof z)&&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 m=0;for(;m<this.path.length&&m<p.length&&this.path[m]===p[m];)m++;let h=this.path.length-m;this.isInitFile&&h++;let x=h>0?".".repeat(h):".";x+=p.slice(m).join("."),e.write(`from ${x} import ${a.map(y=>this.getImportName({writer:e,reference:y})).join(", ")}`)}else e.write(`from ${i} import ${a.map(m=>this.getImportName({writer:e,reference:m})).join(", ")}`);e.newLine()}}e.newLine()}}isDefinedInFile(e){return e.length===this.path.length&&e.every((r,i)=>r===this.path[i])}};f();u();var _e=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 Z=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 U({name:"date",modulePath:["datetime"]})),r}static datetime(e){let r=new this({type:"datetime",value:e});return r.addReference(new U({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 U({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,m,h,x,y,b,T;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=Qe({values:g.values});if(R.length===0){e.write("[]");break}e.write("["),(i=g.config)!=null&&i.multiline&&(e.newLine(),e.indent()),R.forEach((N,I)=>{var S,k;I>0&&(e.write(","),(S=g.config)!=null&&S.multiline?e.newLine():e.write(" ")),N.write(e),I===R.length-1&&((k=g.config)!=null&&k.endWithComma)&&e.write(",")}),(o=g.config)!=null&&o.multiline&&(e.newLine(),e.dedent()),e.write("]");break}case"set":{let g=this.internalType,R=Qe({values:g.values});if(R.length===0){e.write("{}");break}e.write("{"),(a=g.config)!=null&&a.multiline&&(e.newLine(),e.indent()),R.forEach((N,I)=>{var S,k;I>0&&(e.write(","),(S=g.config)!=null&&S.multiline?e.newLine():e.write(" ")),N.write(e),I===R.length-1&&((k=g.config)!=null&&k.endWithComma)&&e.write(",")}),(p=g.config)!=null&&p.multiline&&(e.newLine(),e.dedent()),e.write("}");break}case"tuple":{let g=this.internalType,R=Qe({values:g.values});if(R.length===0){e.write("()");break}e.write("("),(m=g.config)!=null&&m.multiline&&(e.newLine(),e.indent()),R.forEach((N,I)=>{var S,k;I>0&&(e.write(","),(S=g.config)!=null&&S.multiline?e.newLine():e.write(" ")),N.write(e),(R.length===1||I===R.length-1&&((k=g.config)!=null&&k.endWithComma))&&e.write(",")}),(h=g.config)!=null&&h.multiline&&(e.newLine(),e.dedent()),e.write(")");break}case"dict":{let g=this.internalType,R=Eo({entries:g.entries});if(R.length===0){e.write("{}");break}e.write("{"),(x=g.config)!=null&&x.multiline&&(e.newLine(),e.indent()),R.forEach((N,I)=>{var S,k;I>0&&(e.write(","),(S=g.config)!=null&&S.multiline?e.newLine():e.write(" ")),N.key.write(e),e.write(": "),N.value.write(e),I===R.length-1&&((k=g.config)!=null&&k.endWithComma)&&e.write(",")}),(y=g.config)!=null&&y.multiline&&(e.newLine(),e.dedent()),e.write("}");break}case"typedDict":{let g=this.internalType,R=bo({entries:g.entries});if(R.length===0){e.write("{}");break}e.write("{"),(b=g.config)!=null&&b.multiline&&(e.writeLine(),e.indent()),R.forEach((N,I)=>{var S;I>0&&(e.write(","),(S=g.config)!=null&&S.multiline?e.newLine():e.write(" ")),e.write(`"${N.name}": `),N.value.write(e)}),(T=g.config)!=null&&T.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(`
10
+ `);if(a.length<=1){e.write(this.escapeString((p=a[0])!=null?p:"")),e.write('"""');return}i&&e.writeNoIndent(`\\
11
+ `),a.forEach((m,h)=>{e.writeNoIndent(this.escapeString(m)),h===a.length-1?o&&e.writeNoIndent(`\\
12
+ `):e.writeNoIndent(`
13
+ `)}),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 Eo({entries:n}){return n.filter(t=>!Z.isNop(t.key)&&!Z.isNop(t.value))}function bo({entries:n}){return n.filter(t=>!Z.isNop(t.value))}function Qe({values:n}){return n.filter(t=>!Z.isNop(t))}function Ao(n){return new ne(n)}function Io(n){return new Fe(n)}function No(n){return new de(n)}function So(n){return new Y(n)}function Co(n){return new oe(n)}function Po(n){return new se(n)}function Uo(n){return new U(n)}function ko(n){return new H(n)}function Lo(n){return new z(n)}function Bo(n){return new W(n)}function Fo(n){return new ae(n)}function _o(n){return new fe(n)}function Do(n){return new ue(n)}function Mo(n){return new q(n)}function Oo(n){return new ie(n)}function Wo(n){return new ce(n)}function Vo(n){return new G(n)}function jo(n){return new pe(n)}function $o(n){return new me(n)}f();u();var Yo="value",De=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:v.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:v.Critical,message:`Expected array but got: ${typeof e}`}),d.TypeInstantiation.nop())}convertSet({set:t,value:e}){return Array.isArray(e)?d.TypeInstantiation.set(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:v.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:v.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:v.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:Yo,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:v.Critical,message:`Expected enum value string, got: ${typeof e}`});return}if(t.values.find(i=>i.wireValue===e)==null){this.context.errors.add({severity:v.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:v.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 Me=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}){let r=this.context.getSingleFileValue({property:t,record:e});return r==null?d.TypeInstantiation.nop():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 zo=["list","set"],Je=class n extends ve{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 De({context:this}),this.filePropertyMapper=new Me({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 zo.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.getRootModulePath()})}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")}shouldInlinePathParameters(){return!0}cleanOrganizationName(){return this.config.organization.replace(/[^a-zA-Z0-9]/g,"_")}getApiName(){return Ze(this.config.workspaceName)}pascalCase(e){let r=He(e);return r.charAt(0).toUpperCase()+r.slice(1)}};0&&(module.exports={DynamicSnippetsGeneratorContext});
14
+ /*! Bundled license information:
15
+
16
+ @esbuild-plugins/node-globals-polyfill/Buffer.js:
17
+ (*!
18
+ * The buffer module from node.js, for the browser.
19
+ *
20
+ * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
21
+ * @license MIT
22
+ *)
23
+
24
+ lodash-es/lodash.js:
25
+ (**
26
+ * @license
27
+ * Lodash (Custom Build) <https://lodash.com/>
28
+ * Build: `lodash modularize exports="es" -o ./`
29
+ * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
30
+ * Released under MIT license <https://lodash.com/license>
31
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
32
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
33
+ *)
34
+ */
@@ -0,0 +1,5 @@
1
+ import '@fern-api/browser-compatible-base-generator';
2
+ import '@fern-api/dynamic-ir-sdk';
3
+ import '@fern-api/python-ast';
4
+ import '@fern-api/python-browser-compatible-base';
5
+ export { D as DynamicSnippetsGeneratorContext } from '../DynamicSnippetsGeneratorContext-aXWxVpwD.cjs';
@@ -0,0 +1,23 @@
1
+ "use strict";var de=Object.defineProperty;var ct=Object.getOwnPropertyDescriptor;var ft=Object.getOwnPropertyNames,me=Object.getOwnPropertySymbols;var Ne=Object.prototype.hasOwnProperty,Ce=Object.prototype.propertyIsEnumerable;var Re=(r,t,e)=>t in r?de(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Le=(r,t)=>{for(var e in t||(t={}))Ne.call(t,e)&&Re(r,e,t[e]);if(me)for(var e of me(t))Ce.call(t,e)&&Re(r,e,t[e]);return r};var De=(r,t)=>{var e={};for(var n in r)Ne.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&me)for(var n of me(r))t.indexOf(n)<0&&Ce.call(r,n)&&(e[n]=r[n]);return e};var Se=(r,t)=>()=>(r&&(t=r(r=0)),t);var Me=(r,t)=>{for(var e in t)de(r,e,{get:t[e],enumerable:!0})},ut=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ft(t))!Ne.call(r,i)&&i!==e&&de(r,i,{get:()=>t[i],enumerable:!(n=ct(t,i))||n.enumerable});return r};var ht=r=>ut(de({},"__esModule",{value:!0}),r);var c=(r,t,e)=>Re(r,typeof t!="symbol"?t+"":t,e);function Oe(){throw new Error("setTimeout has not been defined")}function Ye(){throw new Error("clearTimeout has not been defined")}function $e(r){if(Y===setTimeout)return setTimeout(r,0);if((Y===Oe||!Y)&&setTimeout)return Y=setTimeout,setTimeout(r,0);try{return Y(r,0)}catch(t){try{return Y.call(null,r,0)}catch(e){return Y.call(this,r,0)}}}function lt(r){if($===clearTimeout)return clearTimeout(r);if(($===Ye||!$)&&clearTimeout)return $=clearTimeout,clearTimeout(r);try{return $(r)}catch(t){try{return $.call(null,r)}catch(e){return $.call(this,r)}}}function pt(){!K||!Z||(K=!1,Z.length?M=Z.concat(M):ye=-1,M.length&&We())}function We(){if(!K){var r=$e(pt);K=!0;for(var t=M.length;t;){for(Z=M,M=[];++ye<t;)Z&&Z[ye].run();ye=-1,t=M.length}Z=null,K=!1,lt(r)}}function mt(r){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];M.push(new Ve(r,t)),M.length===1&&!K&&$e(We)}function Ve(r,t){this.fun=r,this.array=t}function J(){}function bt(r){throw new Error("process.binding is not supported")}function Pt(){return"/"}function Bt(r){throw new Error("process.chdir is not supported")}function _t(){return 0}function Dt(r){var t=Ct.call(q)*.001,e=Math.floor(t),n=Math.floor(t%1*1e9);return r&&(e=e-r[0],n=n-r[1],n<0&&(e--,n+=1e9)),[e,n]}function Ft(){var r=new Date,t=r-Mt;return t/1e3}var Y,$,M,K,Z,ye,dt,yt,wt,xt,gt,Tt,vt,It,At,Et,Rt,Nt,Lt,St,Ut,kt,q,Ct,Mt,g,Fe,u=Se(()=>{"use strict";Y=Oe,$=Ye;typeof globalThis.setTimeout=="function"&&(Y=setTimeout);typeof globalThis.clearTimeout=="function"&&($=clearTimeout);M=[],K=!1,ye=-1;Ve.prototype.run=function(){this.fun.apply(null,this.array)};dt="browser",yt="browser",wt=!0,xt={},gt=[],Tt="",vt={},It={},At={};Et=J,Rt=J,Nt=J,Lt=J,St=J,Ut=J,kt=J;q=globalThis.performance||{},Ct=q.now||q.mozNow||q.msNow||q.oNow||q.webkitNow||function(){return new Date().getTime()};Mt=new Date;g={nextTick:mt,title:dt,browser:wt,env:xt,argv:gt,version:Tt,versions:vt,on:Et,addListener:Rt,once:Nt,off:Lt,removeListener:St,removeAllListeners:Ut,emit:kt,binding:bt,cwd:Pt,chdir:Bt,umask:_t,hrtime:Dt,platform:yt,release:It,config:At,uptime:Ft},Fe={};Object.keys(Fe).forEach(r=>{let t=r.split("."),e=g;for(let n=0;n<t.length;n++){let i=t[n];n===t.length-1?e[i]=Fe[r]:e=e[i]||(e[i]={})}})});function je(){ke=!0;for(var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=r.length;t<e;++t)B[t]=r[t],U[r.charCodeAt(t)]=t;U[45]=62,U[95]=63}function Yt(r){ke||je();var t,e,n,i,s,o,f=r.length;if(f%4>0)throw new Error("Invalid string. Length must be a multiple of 4");s=r[f-2]==="="?2:r[f-1]==="="?1:0,o=new Ot(f*3/4-s),n=s>0?f-4:f;var l=0;for(t=0,e=0;t<n;t+=4,e+=3)i=U[r.charCodeAt(t)]<<18|U[r.charCodeAt(t+1)]<<12|U[r.charCodeAt(t+2)]<<6|U[r.charCodeAt(t+3)],o[l++]=i>>16&255,o[l++]=i>>8&255,o[l++]=i&255;return s===2?(i=U[r.charCodeAt(t)]<<2|U[r.charCodeAt(t+1)]>>4,o[l++]=i&255):s===1&&(i=U[r.charCodeAt(t)]<<10|U[r.charCodeAt(t+1)]<<4|U[r.charCodeAt(t+2)]>>2,o[l++]=i>>8&255,o[l++]=i&255),o}function $t(r){return B[r>>18&63]+B[r>>12&63]+B[r>>6&63]+B[r&63]}function Wt(r,t,e){for(var n,i=[],s=t;s<e;s+=3)n=(r[s]<<16)+(r[s+1]<<8)+r[s+2],i.push($t(n));return i.join("")}function Qe(r){ke||je();for(var t,e=r.length,n=e%3,i="",s=[],o=16383,f=0,l=e-n;f<l;f+=o)s.push(Wt(r,f,f+o>l?l:f+o));return n===1?(t=r[e-1],i+=B[t>>2],i+=B[t<<4&63],i+="=="):n===2&&(t=(r[e-2]<<8)+r[e-1],i+=B[t>>10],i+=B[t>>4&63],i+=B[t<<2&63],i+="="),s.push(i),s.join("")}function we(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function F(r,t){if(we()<t)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(r=new Uint8Array(t),r.__proto__=a.prototype):(r===null&&(r=new a(t)),r.length=t),r}function a(r,t,e){if(!a.TYPED_ARRAY_SUPPORT&&!(this instanceof a))return new a(r,t,e);if(typeof r=="number"){if(typeof t=="string")throw new Error("If encoding is specified then the first argument must be a string");return be(this,r)}return Ze(this,r,t,e)}function Ze(r,t,e,n){if(typeof t=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer!="undefined"&&t instanceof ArrayBuffer?zt(r,t,e,n):typeof t=="string"?Qt(r,t,e):Gt(r,t)}function Je(r){if(typeof r!="number")throw new TypeError('"size" argument must be a number');if(r<0)throw new RangeError('"size" argument must not be negative')}function Vt(r,t,e,n){return Je(t),t<=0?F(r,t):e!==void 0?typeof n=="string"?F(r,t).fill(e,n):F(r,t).fill(e):F(r,t)}function be(r,t){if(Je(t),r=F(r,t<0?0:Pe(t)|0),!a.TYPED_ARRAY_SUPPORT)for(var e=0;e<t;++e)r[e]=0;return r}function Qt(r,t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!a.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=He(t,e)|0;r=F(r,n);var i=r.write(t,e);return i!==n&&(r=r.slice(0,i)),r}function Ue(r,t){var e=t.length<0?0:Pe(t.length)|0;r=F(r,e);for(var n=0;n<e;n+=1)r[n]=t[n]&255;return r}function zt(r,t,e,n){if(t.byteLength,e<0||t.byteLength<e)throw new RangeError("'offset' is out of bounds");if(t.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");return e===void 0&&n===void 0?t=new Uint8Array(t):n===void 0?t=new Uint8Array(t,e):t=new Uint8Array(t,e,n),a.TYPED_ARRAY_SUPPORT?(r=t,r.__proto__=a.prototype):r=Ue(r,t),r}function Gt(r,t){if(_(t)){var e=Pe(t.length)|0;return r=F(r,e),r.length===0||t.copy(r,0,0,e),r}if(t){if(typeof ArrayBuffer!="undefined"&&t.buffer instanceof ArrayBuffer||"length"in t)return typeof t.length!="number"||ln(t.length)?F(r,0):Ue(r,t);if(t.type==="Buffer"&&Array.isArray(t.data))return Ue(r,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function Pe(r){if(r>=we())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+we().toString(16)+" bytes");return r|0}function _(r){return!!(r!=null&&r._isBuffer)}function He(r,t){if(_(r))return r.length;if(typeof ArrayBuffer!="undefined"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(r)||r instanceof ArrayBuffer))return r.byteLength;typeof r!="string"&&(r=""+r);var e=r.length;if(e===0)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return xe(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return rt(r).length;default:if(n)return xe(r).length;t=(""+t).toLowerCase(),n=!0}}function jt(r,t,e){var n=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,t>>>=0,e<=t))return"";for(r||(r="utf8");;)switch(r){case"hex":return rn(this,t,e);case"utf8":case"utf-8":return Ke(this,t,e);case"ascii":return tn(this,t,e);case"latin1":case"binary":return nn(this,t,e);case"base64":return Kt(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return sn(this,t,e);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}function H(r,t,e){var n=r[t];r[t]=r[e],r[e]=n}function Xe(r,t,e,n,i){if(r.length===0)return-1;if(typeof e=="string"?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:r.length-1),e<0&&(e=r.length+e),e>=r.length){if(i)return-1;e=r.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof t=="string"&&(t=a.from(t,n)),_(t))return t.length===0?-1:ze(r,t,e,n,i);if(typeof t=="number")return t=t&255,a.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(r,t,e):Uint8Array.prototype.lastIndexOf.call(r,t,e):ze(r,[t],e,n,i);throw new TypeError("val must be string, number or Buffer")}function ze(r,t,e,n,i){var s=1,o=r.length,f=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||t.length<2)return-1;s=2,o/=2,f/=2,e/=2}function l(T,w){return s===1?T[w]:T.readUInt16BE(w*s)}var d;if(i){var m=-1;for(d=e;d<o;d++)if(l(r,d)===l(t,m===-1?0:d-m)){if(m===-1&&(m=d),d-m+1===f)return m*s}else m!==-1&&(d-=d-m),m=-1}else for(e+f>o&&(e=o-f),d=e;d>=0;d--){for(var y=!0,I=0;I<f;I++)if(l(r,d+I)!==l(t,I)){y=!1;break}if(y)return d}return-1}function Zt(r,t,e,n){e=Number(e)||0;var i=r.length-e;n?(n=Number(n),n>i&&(n=i)):n=i;var s=t.length;if(s%2!==0)throw new TypeError("Invalid hex string");n>s/2&&(n=s/2);for(var o=0;o<n;++o){var f=parseInt(t.substr(o*2,2),16);if(isNaN(f))return o;r[e+o]=f}return o}function Jt(r,t,e,n){return ve(xe(t,r.length-e),r,e,n)}function qe(r,t,e,n){return ve(un(t),r,e,n)}function Ht(r,t,e,n){return qe(r,t,e,n)}function Xt(r,t,e,n){return ve(rt(t),r,e,n)}function qt(r,t,e,n){return ve(hn(t,r.length-e),r,e,n)}function Kt(r,t,e){return t===0&&e===r.length?Qe(r):Qe(r.slice(t,e))}function Ke(r,t,e){e=Math.min(r.length,e);for(var n=[],i=t;i<e;){var s=r[i],o=null,f=s>239?4:s>223?3:s>191?2:1;if(i+f<=e){var l,d,m,y;switch(f){case 1:s<128&&(o=s);break;case 2:l=r[i+1],(l&192)===128&&(y=(s&31)<<6|l&63,y>127&&(o=y));break;case 3:l=r[i+1],d=r[i+2],(l&192)===128&&(d&192)===128&&(y=(s&15)<<12|(l&63)<<6|d&63,y>2047&&(y<55296||y>57343)&&(o=y));break;case 4:l=r[i+1],d=r[i+2],m=r[i+3],(l&192)===128&&(d&192)===128&&(m&192)===128&&(y=(s&15)<<18|(l&63)<<12|(d&63)<<6|m&63,y>65535&&y<1114112&&(o=y))}}o===null?(o=65533,f=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=f}return en(n)}function en(r){var t=r.length;if(t<=Ge)return String.fromCharCode.apply(String,r);for(var e="",n=0;n<t;)e+=String.fromCharCode.apply(String,r.slice(n,n+=Ge));return e}function tn(r,t,e){var n="";e=Math.min(r.length,e);for(var i=t;i<e;++i)n+=String.fromCharCode(r[i]&127);return n}function nn(r,t,e){var n="";e=Math.min(r.length,e);for(var i=t;i<e;++i)n+=String.fromCharCode(r[i]);return n}function rn(r,t,e){var n=r.length;(!t||t<0)&&(t=0),(!e||e<0||e>n)&&(e=n);for(var i="",s=t;s<e;++s)i+=fn(r[s]);return i}function sn(r,t,e){for(var n=r.slice(t,e),i="",s=0;s<n.length;s+=2)i+=String.fromCharCode(n[s]+n[s+1]*256);return i}function A(r,t,e){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+t>e)throw new RangeError("Trying to access beyond buffer length")}function L(r,t,e,n,i,s){if(!_(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(e+n>r.length)throw new RangeError("Index out of range")}function ge(r,t,e,n){t<0&&(t=65535+t+1);for(var i=0,s=Math.min(r.length-e,2);i<s;++i)r[e+i]=(t&255<<8*(n?i:1-i))>>>(n?i:1-i)*8}function Te(r,t,e,n){t<0&&(t=4294967295+t+1);for(var i=0,s=Math.min(r.length-e,4);i<s;++i)r[e+i]=t>>>(n?i:3-i)*8&255}function et(r,t,e,n,i,s){if(e+n>r.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function tt(r,t,e,n,i){return i||et(r,t,e,4,34028234663852886e22,-34028234663852886e22),st(r,t,e,n,23,4),e+4}function nt(r,t,e,n,i){return i||et(r,t,e,8,17976931348623157e292,-17976931348623157e292),st(r,t,e,n,52,8),e+8}function an(r){if(r=cn(r).replace(on,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function cn(r){return r.trim?r.trim():r.replace(/^\s+|\s+$/g,"")}function fn(r){return r<16?"0"+r.toString(16):r.toString(16)}function xe(r,t){t=t||1/0;for(var e,n=r.length,i=null,s=[],o=0;o<n;++o){if(e=r.charCodeAt(o),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&s.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;s.push(e)}else if(e<2048){if((t-=2)<0)break;s.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;s.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;s.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return s}function un(r){for(var t=[],e=0;e<r.length;++e)t.push(r.charCodeAt(e)&255);return t}function hn(r,t){for(var e,n,i,s=[],o=0;o<r.length&&!((t-=2)<0);++o)e=r.charCodeAt(o),n=e>>8,i=e%256,s.push(i),s.push(n);return s}function rt(r){return Yt(an(r))}function ve(r,t,e,n){for(var i=0;i<n&&!(i+e>=t.length||i>=r.length);++i)t[i+e]=r[i];return i}function ln(r){return r!==r}function pn(r){return r!=null&&(!!r._isBuffer||it(r)||mn(r))}function it(r){return!!r.constructor&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function mn(r){return typeof r.readFloatLE=="function"&&typeof r.slice=="function"&&it(r.slice(0,0))}function Ie(r,t,e,n,i){var s,o,f=i*8-n-1,l=(1<<f)-1,d=l>>1,m=-7,y=e?i-1:0,I=e?-1:1,T=r[t+y];for(y+=I,s=T&(1<<-m)-1,T>>=-m,m+=f;m>0;s=s*256+r[t+y],y+=I,m-=8);for(o=s&(1<<-m)-1,s>>=-m,m+=n;m>0;o=o*256+r[t+y],y+=I,m-=8);if(s===0)s=1-d;else{if(s===l)return o?NaN:(T?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-d}return(T?-1:1)*o*Math.pow(2,s-n)}function st(r,t,e,n,i,s){var o,f,l,d=s*8-i-1,m=(1<<d)-1,y=m>>1,I=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,T=n?0:s-1,w=n?1:-1,v=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(f=isNaN(t)?1:0,o=m):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+y>=1?t+=I/l:t+=I*Math.pow(2,1-y),t*l>=2&&(o++,l/=2),o+y>=m?(f=0,o=m):o+y>=1?(f=(t*l-1)*Math.pow(2,i),o=o+y):(f=t*Math.pow(2,y-1)*Math.pow(2,i),o=0));i>=8;r[e+T]=f&255,T+=w,f/=256,i-=8);for(o=o<<i|f,d+=i;d>0;r[e+T]=o&255,T+=w,o/=256,d-=8);r[e+T-w]|=v*128}var B,U,Ot,ke,Ge,on,ot=Se(()=>{"use strict";u();h();B=[],U=[],Ot=typeof Uint8Array!="undefined"?Uint8Array:Array,ke=!1;a.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;a.poolSize=8192;a._augment=function(r){return r.__proto__=a.prototype,r};a.from=function(r,t,e){return Ze(null,r,t,e)};a.kMaxLength=we();a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&a[Symbol.species]);a.alloc=function(r,t,e){return Vt(null,r,t,e)};a.allocUnsafe=function(r){return be(null,r)};a.allocUnsafeSlow=function(r){return be(null,r)};a.isBuffer=pn;a.compare=function(t,e){if(!_(t)||!_(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,i=e.length,s=0,o=Math.min(n,i);s<o;++s)if(t[s]!==e[s]){n=t[s],i=e[s];break}return n<i?-1:i<n?1:0};a.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};a.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return a.alloc(0);var n;if(e===void 0)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var i=a.allocUnsafe(e),s=0;for(n=0;n<t.length;++n){var o=t[n];if(!_(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(i,s),s+=o.length}return i};a.byteLength=He;a.prototype._isBuffer=!0;a.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)H(this,e,e+1);return this};a.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)H(this,e,e+3),H(this,e+1,e+2);return this};a.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)H(this,e,e+7),H(this,e+1,e+6),H(this,e+2,e+5),H(this,e+3,e+4);return this};a.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?Ke(this,0,t):jt.apply(this,arguments)};a.prototype.equals=function(t){if(!_(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:a.compare(this,t)===0};a.prototype.compare=function(t,e,n,i,s){if(!_(t))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),n===void 0&&(n=t?t.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),e<0||n>t.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&e>=n)return 0;if(i>=s)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,i>>>=0,s>>>=0,this===t)return 0;for(var o=s-i,f=n-e,l=Math.min(o,f),d=this.slice(i,s),m=t.slice(e,n),y=0;y<l;++y)if(d[y]!==m[y]){o=d[y],f=m[y];break}return o<f?-1:f<o?1:0};a.prototype.includes=function(t,e,n){return this.indexOf(t,e,n)!==-1};a.prototype.indexOf=function(t,e,n){return Xe(this,t,e,n,!0)};a.prototype.lastIndexOf=function(t,e,n){return Xe(this,t,e,n,!1)};a.prototype.write=function(t,e,n,i){if(e===void 0)i="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")i=e,n=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(n)?(n=n|0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-e;if((n===void 0||n>s)&&(n=s),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return Zt(this,t,e,n);case"utf8":case"utf-8":return Jt(this,t,e,n);case"ascii":return qe(this,t,e,n);case"latin1":case"binary":return Ht(this,t,e,n);case"base64":return Xt(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return qt(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};Ge=4096;a.prototype.slice=function(t,e){var n=this.length;t=~~t,e=e===void 0?n:~~e,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<t&&(e=t);var i;if(a.TYPED_ARRAY_SUPPORT)i=this.subarray(t,e),i.__proto__=a.prototype;else{var s=e-t;i=new a(s,void 0);for(var o=0;o<s;++o)i[o]=this[o+t]}return i};a.prototype.readUIntLE=function(t,e,n){t=t|0,e=e|0,n||A(t,e,this.length);for(var i=this[t],s=1,o=0;++o<e&&(s*=256);)i+=this[t+o]*s;return i};a.prototype.readUIntBE=function(t,e,n){t=t|0,e=e|0,n||A(t,e,this.length);for(var i=this[t+--e],s=1;e>0&&(s*=256);)i+=this[t+--e]*s;return i};a.prototype.readUInt8=function(t,e){return e||A(t,1,this.length),this[t]};a.prototype.readUInt16LE=function(t,e){return e||A(t,2,this.length),this[t]|this[t+1]<<8};a.prototype.readUInt16BE=function(t,e){return e||A(t,2,this.length),this[t]<<8|this[t+1]};a.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};a.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])};a.prototype.readIntLE=function(t,e,n){t=t|0,e=e|0,n||A(t,e,this.length);for(var i=this[t],s=1,o=0;++o<e&&(s*=256);)i+=this[t+o]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*e)),i};a.prototype.readIntBE=function(t,e,n){t=t|0,e=e|0,n||A(t,e,this.length);for(var i=e,s=1,o=this[t+--i];i>0&&(s*=256);)o+=this[t+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*e)),o};a.prototype.readInt8=function(t,e){return e||A(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};a.prototype.readInt16LE=function(t,e){e||A(t,2,this.length);var n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n};a.prototype.readInt16BE=function(t,e){e||A(t,2,this.length);var n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n};a.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};a.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]};a.prototype.readFloatLE=function(t,e){return e||A(t,4,this.length),Ie(this,t,!0,23,4)};a.prototype.readFloatBE=function(t,e){return e||A(t,4,this.length),Ie(this,t,!1,23,4)};a.prototype.readDoubleLE=function(t,e){return e||A(t,8,this.length),Ie(this,t,!0,52,8)};a.prototype.readDoubleBE=function(t,e){return e||A(t,8,this.length),Ie(this,t,!1,52,8)};a.prototype.writeUIntLE=function(t,e,n,i){if(t=+t,e=e|0,n=n|0,!i){var s=Math.pow(2,8*n)-1;L(this,t,e,n,s,0)}var o=1,f=0;for(this[e]=t&255;++f<n&&(o*=256);)this[e+f]=t/o&255;return e+n};a.prototype.writeUIntBE=function(t,e,n,i){if(t=+t,e=e|0,n=n|0,!i){var s=Math.pow(2,8*n)-1;L(this,t,e,n,s,0)}var o=n-1,f=1;for(this[e+o]=t&255;--o>=0&&(f*=256);)this[e+o]=t/f&255;return e+n};a.prototype.writeUInt8=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,1,255,0),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=t&255,e+1};a.prototype.writeUInt16LE=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):ge(this,t,e,!0),e+2};a.prototype.writeUInt16BE=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):ge(this,t,e,!1),e+2};a.prototype.writeUInt32LE=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255):Te(this,t,e,!0),e+4};a.prototype.writeUInt32BE=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):Te(this,t,e,!1),e+4};a.prototype.writeIntLE=function(t,e,n,i){if(t=+t,e=e|0,!i){var s=Math.pow(2,8*n-1);L(this,t,e,n,s-1,-s)}var o=0,f=1,l=0;for(this[e]=t&255;++o<n&&(f*=256);)t<0&&l===0&&this[e+o-1]!==0&&(l=1),this[e+o]=(t/f>>0)-l&255;return e+n};a.prototype.writeIntBE=function(t,e,n,i){if(t=+t,e=e|0,!i){var s=Math.pow(2,8*n-1);L(this,t,e,n,s-1,-s)}var o=n-1,f=1,l=0;for(this[e+o]=t&255;--o>=0&&(f*=256);)t<0&&l===0&&this[e+o+1]!==0&&(l=1),this[e+o]=(t/f>>0)-l&255;return e+n};a.prototype.writeInt8=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,1,127,-128),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=t&255,e+1};a.prototype.writeInt16LE=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):ge(this,t,e,!0),e+2};a.prototype.writeInt16BE=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):ge(this,t,e,!1),e+2};a.prototype.writeInt32LE=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):Te(this,t,e,!0),e+4};a.prototype.writeInt32BE=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):Te(this,t,e,!1),e+4};a.prototype.writeFloatLE=function(t,e,n){return tt(this,t,e,!0,n)};a.prototype.writeFloatBE=function(t,e,n){return tt(this,t,e,!1,n)};a.prototype.writeDoubleLE=function(t,e,n){return nt(this,t,e,!0,n)};a.prototype.writeDoubleBE=function(t,e,n){return nt(this,t,e,!1,n)};a.prototype.copy=function(t,e,n,i){if(n||(n=0),!i&&i!==0&&(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<n&&(i=n),i===n||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-n&&(i=t.length-e+n);var s=i-n,o;if(this===t&&n<e&&e<i)for(o=s-1;o>=0;--o)t[o+e]=this[o+n];else if(s<1e3||!a.TYPED_ARRAY_SUPPORT)for(o=0;o<s;++o)t[o+e]=this[o+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+s),e);return s};a.prototype.fill=function(t,e,n,i){if(typeof t=="string"){if(typeof e=="string"?(i=e,e=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),t.length===1){var s=t.charCodeAt(0);s<256&&(t=s)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!a.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof t=="number"&&(t=t&255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e=e>>>0,n=n===void 0?this.length:n>>>0,t||(t=0);var o;if(typeof t=="number")for(o=e;o<n;++o)this[o]=t;else{var f=_(t)?t:xe(new a(t,i).toString()),l=f.length;for(o=0;o<n-e;++o)this[o+e]=f[o%l]}return this};on=/[^+\/0-9A-Za-z-_]/g});var h=Se(()=>{"use strict";ot()});var Fn={};Me(Fn,{DynamicTypeLiteralMapper:()=>_e});module.exports=ht(Fn);u();h();u();h();u();h();function S(r){throw new Error("Unexpected value: "+JSON.stringify(r))}u();h();u();h();var X=class{};u();h();u();h();var P=class extends X{constructor(e){super();c(this,"value");this.value=e}write(e){typeof this.value=="string"?e.write(this.value):this.value(e)}};var dn=4,le=class{constructor(){c(this,"buffer","");c(this,"indentLevel",0);c(this,"hasWrittenAnything",!1);c(this,"lastCharacterIsSemicolon",!1);c(this,"lastCharacterIsNewline",!1)}write(t){let e=t.length>0&&t.endsWith(`
2
+ `),n=e?t.substring(0,t.length-1):t,i=this.getIndentString(),s=n.replaceAll(`
3
+ `,`
4
+ ${i}`);this.isAtStartOfLine()&&(s=i+s),e&&(s+=`
5
+ `),this.writeInternal(s)}writeNoIndent(t){let e=this.indentLevel;this.indentLevel=0,this.write(t),this.indentLevel=e}writeNode(t){t.write(this)}writeNodeOrString(t){if(typeof t=="string"){this.write(t);return}this.writeNode(t)}writeNodeStatement(t){t.write(this),this.write(";"),this.writeNewLineIfLastLineNot()}writeTextStatement(t){new P(t).write(this),this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(t,e){new P(t).write(this),this.write(" ("),this.writeNode(e),this.write(") {"),this.writeNewLineIfLastLineNot(),this.indent()}controlFlowWithoutStatement(t){new P(t).write(this),this.write(" {"),this.writeNewLineIfLastLineNot(),this.indent()}endControlFlow(){this.dedent(),this.writeLine("}")}contiguousControlFlow(t,e){this.dedent(),this.write("} "),new P(t).write(this),this.write(" ("),this.writeNode(e),this.write(") {"),this.writeNewLineIfLastLineNot(),this.indent()}alternativeControlFlow(t){this.dedent(),this.write("} "),new P(t).write(this),this.write(" {"),this.writeNewLineIfLastLineNot(),this.indent()}openBlock(t,e="{",n,i="}"){let s=t.filter(o=>o!==void 0).join(" ");s?this.write(`${s} ${e!=null?e:""}`):this.write(e!=null?e:"");try{this.indent(),n(),this.dedent()}finally{this.write(i!=null?i:"")}}writeLine(t=""){this.write(t),this.writeNewLineIfLastLineNot()}newLine(){this.writeInternal(`
6
+ `)}writeSemicolonIfLastCharacterIsNot(){this.lastCharacterIsSemicolon||this.writeInternal(";")}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
7
+ `)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:t,delimiter:e,writeFunction:n}){if(t.length>0){let i=t[0];i!=null&&n(i);for(let s=1;s<t.length;s++){this.write(e);let o=t[s];o!=null&&n(o)}}}toString(){return this.buffer}writeInternal(t){return t.length>0&&(this.hasWrittenAnything=!0,this.lastCharacterIsNewline=t.endsWith(`
8
+ `),this.lastCharacterIsSemicolon=t.endsWith(";")),this.buffer+=t}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*dn)}};u();h();u();h();var C={Critical:"CRITICAL",Warning:"WARNING"};u();h();var p={};Me(p,{AccessAttribute:()=>ee,AstNode:()=>x,Class:()=>W,ClassInstantiation:()=>ne,CodeBlock:()=>O,Comment:()=>re,Decorator:()=>ie,Field:()=>V,Lambda:()=>se,LambdaParameter:()=>oe,Method:()=>z,MethodArgument:()=>ce,MethodInvocation:()=>fe,Operator:()=>ue,Parameter:()=>Q,PythonFile:()=>he,Reference:()=>k,StarImport:()=>G,Type:()=>Ee,TypeInstantiation:()=>j,accessAttribute:()=>xn,assign:()=>gn,class_:()=>vn,codeBlock:()=>Ln,comment:()=>Sn,decorator:()=>An,field:()=>Nn,file:()=>Tn,instantiateClass:()=>In,invokeFunction:()=>Pn,invokeMethod:()=>Bn,lambda:()=>Un,lambdaParameter:()=>kn,method:()=>bn,methodArgument:()=>Cn,operator:()=>Dn,parameter:()=>_n,reference:()=>En,starImport:()=>Rn});u();h();u();h();u();h();u();h();var pe=class extends le{constructor(){super(...arguments);c(this,"fullyQualifiedModulePathsToImportedNames",{})}setRefNameOverrides(e){this.fullyQualifiedModulePathsToImportedNames=e}unsetRefNameOverrides(){this.fullyQualifiedModulePathsToImportedNames={}}getRefNameOverride(e){var i;let n=this.fullyQualifiedModulePathsToImportedNames[e.getFullyQualifiedModulePath()];return n||{name:(i=e.alias)!=null?i:e.name,isAlias:!!e.alias}}toString(){return this.buffer}async toStringFormatted(e){return e.format(this.buffer)}};var x=class extends X{constructor(){super(...arguments);c(this,"references",[])}addReference(e){this.references.push(e)}inheritReferences(e){e!==void 0&&e.references.forEach(n=>{this.references.includes(n)||this.addReference(n)})}getReferences(){return this.references}toString(){let e=new pe;return this.write(e),e.toString()}async toStringFormatted(e){let n=new pe;return this.write(n),n.toStringFormatted(e)}};var ee=class extends x{constructor({lhs:e,rhs:n}){super();c(this,"lhs");c(this,"rhs");this.lhs=e,this.inheritReferences(e),this.rhs=n,this.inheritReferences(n)}write(e){this.lhs.write(e),e.write("."),this.rhs.write(e)}};u();h();var Ae=class extends x{constructor({lhs:e,rhs:n}){super();c(this,"lhs");c(this,"rhs");this.lhs=e,this.inheritReferences(e),this.rhs=n,this.inheritReferences(n)}write(e){this.lhs.write(e),e.write(" = "),this.rhs.write(e)}};u();h();var te=class extends x{constructor({reference:e,arguments_:n,multiline:i}){super();c(this,"reference");c(this,"arguments");c(this,"multiline");this.reference=e,this.arguments=n,this.multiline=i!=null?i:!1,this.inheritReferences(e),this.arguments.forEach(s=>{this.inheritReferences(s)})}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((n,i)=>{n.write(e),i<this.arguments.length-1&&(e.write(","),this.multiline?e.newLine():e.write(" "))}),this.multiline&&(e.newLine(),e.dedent()),e.write(")")}};u();h();var W=class extends x{constructor({docs:e,name:n,extends_:i,decorators:s}){super();c(this,"name");c(this,"extends_");c(this,"decorators");c(this,"fields",[]);c(this,"docs");c(this,"statements",[]);this.name=n,this.extends_=i!=null?i:[],this.decorators=s!=null?s:[],this.docs=e,this.extends_.forEach(o=>{this.inheritReferences(o)}),this.decorators.forEach(o=>{this.inheritReferences(o)})}write(e){this.decorators.forEach(n=>{n.write(e)}),e.write(`class ${this.name}`),this.extends_.length>0&&(e.write("("),this.extends_.forEach((n,i)=>{i>0&&e.write(", "),n.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(n=>{n.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((n,i)=>{n.write(e),e.writeNewLineIfLastLineNot()})}addField(e){this.add(e)}};u();h();var ne=class extends te{constructor(n){var i=n,{classReference:t}=i,e=De(i,["classReference"]);super(Le({reference:t},e))}};u();h();var O=class extends x{constructor(e){super();c(this,"arg");this.arg=e}write(e){return new P(this.arg).write(e)}};u();h();var re=class extends x{constructor({docs:e}){super();c(this,"docs");this.docs=e}write(e){this.docs!=null&&this.docs.split(`
9
+ `).forEach(n=>{e.writeLine(`# ${n}`)})}};u();h();var ie=class extends x{constructor({callable:e}){super();c(this,"callable");this.callable=e,this.inheritReferences(e)}write(e){e.write("@"),this.callable.write(e),e.newLine()}};u();h();var V=class extends x{constructor({name:e,type:n,initializer:i,docs:s}){super();c(this,"name");c(this,"type");c(this,"initializer");c(this,"docs");this.name=e,this.type=n,this.initializer=i,this.docs=s,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('"""'))}};u();h();var se=class extends x{constructor({parameters:e,body:n}){super();c(this,"parameters");c(this,"body");this.parameters=e!=null?e:[],this.body=n,this.inheritReferences(n)}write(e){e.write("lambda"),this.parameters&&this.parameters.length&&(e.write(" "),this.parameters.forEach((n,i)=>{n.write(e),i<this.parameters.length-1&&e.write(", ")})),e.write(": "),this.body.write(e)}};u();h();u();h();var Q=class extends x{constructor({name:e,type:n,initializer:i}){super();c(this,"name");c(this,"initializer");c(this,"type");this.name=e,this.type=n,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 oe=class extends Q{constructor({name:t,initializer:e}){super({name:t,initializer:e,type:void 0})}};u();h();var ae;(function(r){r[r.STATIC=0]="STATIC",r[r.INSTANCE=1]="INSTANCE",r[r.CLASS=2]="CLASS"})(ae||(ae={}));var z=class extends x{constructor({static_:e,name:n,parameters:i,return_:s,docstring:o,type:f,decorators:l}){super();c(this,"name");c(this,"return");c(this,"docstring");c(this,"type");c(this,"parameters");c(this,"decorators");c(this,"statements",[]);c(this,"static_");this.name=n,this.parameters=i!=null?i:[],this.return=s,this.docstring=o,this.type=f,this.decorators=l!=null?l:[],this.static_=e!=null?e:!1,this.parameters.forEach(d=>{this.inheritReferences(d)}),this.inheritReferences(this.return),this.decorators.forEach(d=>{this.inheritReferences(d)}),this.statements.forEach(d=>{this.inheritReferences(d)})}addStatement(e){this.statements.push(e),this.inheritReferences(e)}write(e){this.static_&&this.decorators.push(p.decorator({callable:p.codeBlock("staticmethod")})),this.decorators.forEach(n=>{n.write(e)}),this.type===ae.CLASS?p.decorator({callable:new O("classmethod")}).write(e):this.type===ae.STATIC&&p.decorator({callable:new O("staticmethod")}).write(e),e.write(`def ${this.name}(`),this.type===ae.INSTANCE?(e.write("self"),this.parameters.length>0&&e.write(", ")):this.type===ae.CLASS&&(e.write("cls"),this.parameters.length>0&&e.write(", ")),this.parameters.forEach((n,i)=>{n.write(e),i<this.parameters.length-1&&e.write(", ")}),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((n,i)=>{n.write(e),i<this.statements.length-1&&e.newLine()}),e.dedent()):(e.indent(),e.write("pass"),e.dedent()),e.newLine()}};u();h();var ce=class extends x{constructor({name:e,value:n}){super();c(this,"name");c(this,"value");this.name=e,this.value=n,this.inheritReferences(this.value)}write(e){this.name!==void 0&&(e.write(this.name),e.write("=")),this.value.write(e)}};u();h();var fe=class extends x{constructor({on:e,method:n,arguments_:i,multiline:s}){super();c(this,"on");c(this,"method");c(this,"arguments");c(this,"multiline");this.on=e,this.method=n,this.arguments=i,this.multiline=s!=null?s:!1,this.inheritReferences(e),this.arguments.forEach(o=>{this.inheritReferences(o)})}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((n,i)=>{n.write(e),i<this.arguments.length-1&&(e.write(","),this.multiline?e.newLine():e.write(" "))}),this.multiline&&(e.newLine(),e.dedent()),e.write(")")}};u();h();u();h();var D={Or:"or",And:"and",Add:"add",Subtract:"subtract",Multiply:"multiple",Divide:"divide",Modulo:"modulo",LeftShift:"leftShift",RightShift:"rightShift"};var ue=class extends x{constructor({operator:e,lhs:n,rhs:i}){super();c(this,"operator");c(this,"lhs");c(this,"rhs");this.operator=e,this.lhs=n,this.inheritReferences(n),this.rhs=i,this.inheritReferences(i)}getOperatorString(){switch(this.operator){case D.Or:return"or";case D.And:return"and";case D.Add:return"+";case D.Subtract:return"-";case D.Multiply:return"*";case D.Divide:return"/";case D.Modulo:return"%";case D.LeftShift:return"<<";case D.RightShift:return">>";default:S(this.operator)}}write(e){this.lhs.write(e),e.write(" "),e.write(this.getOperatorString()),e.write(" "),this.rhs.write(e)}};u();h();u();h();u();h();var k=class extends x{constructor({name:e,modulePath:n,genericTypes:i,alias:s,attribute:o}){super();c(this,"name");c(this,"modulePath");c(this,"genericTypes");c(this,"alias");c(this,"attribute");this.name=e,this.modulePath=n!=null?n:[],this.genericTypes=i!=null?i:[],this.alias=s,this.attribute=o!=null?o:[],this.references.push(this),this.genericTypes.forEach(f=>{this.inheritReferences(f)})}write(e){let n=e.getRefNameOverride(this);e.write(n.name),this.genericTypes.length>0&&(e.write("["),this.genericTypes.forEach((i,s)=>{s>0&&e.write(", "),i.write(e)}),e.write("]")),this.attribute.length>0&&(e.write("."),this.attribute.forEach((i,s)=>{s>0&&e.write("."),e.write(i)}))}getFullyQualifiedPath(){return this.modulePath.join(".")}getFullyQualifiedModulePath(){return`${this.getFullyQualifiedPath()}.${this.name}`}};var G=class extends k{constructor({modulePath:e}){super({name:"*",modulePath:e});c(this,"docs")}write(e){throw new Error("Not intended to be written outside the context of a PythonFile.")}};u();h();function at(r){if(!r)return"Class";let t=r.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(n=>n.length>0).map(n=>n.split(new RegExp("(?<=\\d)(?=[a-zA-Z])|(?<=[a-zA-Z])(?=\\d)")).filter(i=>i.length>0)).flat().map((n,i)=>i===0&&/^\d/.test(n)?"Class"+n.charAt(0).toUpperCase()+n.slice(1).toLowerCase():n.length>1&&n===n.toUpperCase()&&!/^\d+$/.test(n)?n:n.charAt(0).toUpperCase()+n.slice(1).toLowerCase()).join(""))}var he=class extends x{constructor({path:e,statements:n,isInitFile:i=!1,comments:s,imports:o}){super();c(this,"path");c(this,"isInitFile");c(this,"statements",[]);c(this,"comments");this.path=e,this.isInitFile=i,n==null||n.forEach(f=>this.addStatement(f)),this.comments=s!=null?s:[],o==null||o.forEach(f=>this.addReference(f))}addStatement(e){this.statements.push(e),this.inheritReferences(e)}write(e){let n=this.deduplicateReferences();this.updateWriterRefNameOverrides({writer:e,uniqueReferences:n}),this.writeComments(e),this.writeImports({writer:e,uniqueReferences:n}),this.statements.forEach((i,s)=>{i.write(e),e.newLine(),s<this.statements.length-1&&e.newLine()}),e.unsetRefNameOverrides()}updateWriterRefNameOverrides({writer:e,uniqueReferences:n}){let i=new Map(n),s={},o=this.getInitialUsedNames(),f=this.path.join("."),l=n.get(f);if(l){let{references:m}=l;m.forEach(y=>{let I=y.getFullyQualifiedModulePath(),T=y.name;s[I]={name:T,isAlias:!1},o.add(y.name)}),i.delete(f)}Array.from(i.values()).flatMap(({references:m})=>m).forEach(m=>{var R;if(m instanceof G)return;let y=(R=m.alias)!=null?R:m.name,I=m.getFullyQualifiedModulePath(),T=y,w=m.modulePath.length-1,v=!!m.alias;for(;o.has(T);){v=!0;let E=m.modulePath[w];w<0||!E?T=`_${T}`:T=`${at(E)}${T}`,w--}o.add(T),s[I]={name:T,isAlias:v}}),e.setRefNameOverrides(s)}getInitialUsedNames(){let e=new Set;return this.statements.forEach(n=>{(n instanceof W||n instanceof z||n instanceof V)&&e.add(n.name)}),e}deduplicateReferences(){let e=new Map;for(let n of this.references){let i=n.name,s=n.getFullyQualifiedPath();if(s==="")continue;let o=e.get(s);o?o.referenceNames.has(i)||(o.references.push(n),o.referenceNames.add(i)):e.set(s,{modulePath:n.modulePath,references:[n],referenceNames:new Set([i])})}return e}writeComments(e){this.comments.forEach(n=>{n.write(e)}),this.comments.length>0&&e.newLine()}getImportName({writer:e,reference:n}){let i=e.getRefNameOverride(n),s=n.name,o=i.isAlias?i.name:void 0;return`${s}${o?` as ${o}`:""}`}writeImports({writer:e,uniqueReferences:n}){if(n.size!==0){for(let[i,{modulePath:s,references:o}]of n){let f=s;if(!this.isDefinedInFile(f)){if(f[0]===this.path[0]){let l=0;for(;l<this.path.length&&l<f.length&&this.path[l]===f[l];)l++;let d=this.path.length-l;this.isInitFile&&d++;let m=d>0?".".repeat(d):".";m+=f.slice(l).join("."),e.write(`from ${m} import ${o.map(y=>this.getImportName({writer:e,reference:y})).join(", ")}`)}else e.write(`from ${i} import ${o.map(l=>this.getImportName({writer:e,reference:l})).join(", ")}`);e.newLine()}}e.newLine()}}isDefinedInFile(e){return e.length===this.path.length&&e.every((n,i)=>n===this.path[i])}};u();h();var Ee=class extends x{constructor(e){super();c(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((n,i)=>{i>0&&e.write(", "),n.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((n,i)=>{i>0&&e.write(", "),n.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:S(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 n=new this({type:"list",value:e});return n.addReference(p.reference({name:"List",modulePath:["typing"]})),n.inheritReferences(e),n}static set(e){let n=new this({type:"set",value:e});return n.addReference(p.reference({name:"Set",modulePath:["typing"]})),n.inheritReferences(e),n}static tuple(e){let n=new this({type:"tuple",values:e});return n.addReference(p.reference({name:"Tuple",modulePath:["typing"]})),e.forEach(i=>n.inheritReferences(i)),n}static dict(e,n){let i=new this({type:"dict",keyType:e,valueType:n});return i.addReference(p.reference({name:"Dict",modulePath:["typing"]})),i.inheritReferences(e),i.inheritReferences(n),i}static none(){return new this({type:"none"})}static uuid(){let e=new this({type:"uuid"});return e.addReference(p.reference({name:"UUID",modulePath:["uuid"]})),e}static optional(e){if(this.isAlreadyOptional(e))return e;let n=new this({type:"optional",value:e});return n.addReference(p.reference({name:"Optional",modulePath:["typing"]})),n.inheritReferences(e),n}static union(e){let n=new this({type:"union",values:e});return n.addReference(p.reference({name:"Union",modulePath:["typing"]})),e.forEach(i=>n.inheritReferences(i)),n}static any(){let e=new this({type:"any"});return e.addReference(p.reference({name:"Any",modulePath:["typing"]})),e}static datetime(){let e=new this({type:"datetime"});return e.addReference(p.reference({name:"datetime",modulePath:["datetime"]})),e}static reference(e){let n=new this({type:"reference",value:e});return n.addReference(e),n}static literal(e){let n=new this({type:"literal",value:e});return n.addReference(p.reference({name:"Literal",modulePath:["typing"]})),n}static isAlreadyOptional(e){return e.internalType.type==="optional"}};u();h();var j=class r extends x{constructor(e){super();c(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,n={multiline:!1,startOnNewLine:!1,endWithNewLine:!1}){return new this({type:"str",value:e,config:n})}static bytes(e){return new this({type:"bytes",value:e})}static list(e,n={endWithComma:!1}){let i=new this({type:"list",values:e,config:n});return e.forEach(s=>i.inheritReferences(s)),i}static set(e,n={endWithComma:!1}){let i=new this({type:"set",values:e,config:n});return e.forEach(s=>i.inheritReferences(s)),i}static tuple(e,n={endWithComma:!1}){let i=new this({type:"tuple",values:e,config:n});return e.forEach(s=>i.inheritReferences(s)),i}static typedDict(e,n={endWithComma:!1}){let i=new this({type:"typedDict",entries:e,config:n});return e.forEach(s=>i.inheritReferences(s.value)),i}static date(e){let n=new this({type:"date",value:e});return n.addReference(new k({name:"date",modulePath:["datetime"]})),n}static datetime(e){let n=new this({type:"datetime",value:e});return n.addReference(new k({name:"datetime",modulePath:["datetime"]})),n}static dict(e,n={endWithComma:!1}){let i=new this({type:"dict",entries:e,config:n});return e.forEach(s=>{i.inheritReferences(s.key),i.inheritReferences(s.value)}),i}static reference(e){let n=new this({type:"reference",value:e});return n.inheritReferences(e),n}static none(){return new this({type:"none"})}static unknown(e){return new this({type:"unknown",value:e})}static uuid(e){let n=new this({type:"uuid",value:e});return n.addReference(new k({name:"UUID",modulePath:["uuid"]})),n}static nop(){return new this({type:"nop"})}static isNop(e){return e instanceof r&&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 n,i,s,o,f,l,d,m,y,I,T;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((n=this.internalType.config)!=null&&n.multiline){let{startOnNewLine:w,endWithNewLine:v}=this.internalType.config;this.writeStringWithTripleQuotes({writer:e,value:this.internalType.value,startOnNewLine:w,endWithNewLine:v})}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 w=this.internalType,v=Be({values:w.values});if(v.length===0){e.write("[]");break}e.write("["),(i=w.config)!=null&&i.multiline&&(e.newLine(),e.indent()),v.forEach((R,E)=>{var N,b;E>0&&(e.write(","),(N=w.config)!=null&&N.multiline?e.newLine():e.write(" ")),R.write(e),E===v.length-1&&((b=w.config)!=null&&b.endWithComma)&&e.write(",")}),(s=w.config)!=null&&s.multiline&&(e.newLine(),e.dedent()),e.write("]");break}case"set":{let w=this.internalType,v=Be({values:w.values});if(v.length===0){e.write("{}");break}e.write("{"),(o=w.config)!=null&&o.multiline&&(e.newLine(),e.indent()),v.forEach((R,E)=>{var N,b;E>0&&(e.write(","),(N=w.config)!=null&&N.multiline?e.newLine():e.write(" ")),R.write(e),E===v.length-1&&((b=w.config)!=null&&b.endWithComma)&&e.write(",")}),(f=w.config)!=null&&f.multiline&&(e.newLine(),e.dedent()),e.write("}");break}case"tuple":{let w=this.internalType,v=Be({values:w.values});if(v.length===0){e.write("()");break}e.write("("),(l=w.config)!=null&&l.multiline&&(e.newLine(),e.indent()),v.forEach((R,E)=>{var N,b;E>0&&(e.write(","),(N=w.config)!=null&&N.multiline?e.newLine():e.write(" ")),R.write(e),(v.length===1||E===v.length-1&&((b=w.config)!=null&&b.endWithComma))&&e.write(",")}),(d=w.config)!=null&&d.multiline&&(e.newLine(),e.dedent()),e.write(")");break}case"dict":{let w=this.internalType,v=yn({entries:w.entries});if(v.length===0){e.write("{}");break}e.write("{"),(m=w.config)!=null&&m.multiline&&(e.newLine(),e.indent()),v.forEach((R,E)=>{var N,b;E>0&&(e.write(","),(N=w.config)!=null&&N.multiline?e.newLine():e.write(" ")),R.key.write(e),e.write(": "),R.value.write(e),E===v.length-1&&((b=w.config)!=null&&b.endWithComma)&&e.write(",")}),(y=w.config)!=null&&y.multiline&&(e.newLine(),e.dedent()),e.write("}");break}case"typedDict":{let w=this.internalType,v=wn({entries:w.entries});if(v.length===0){e.write("{}");break}e.write("{"),(I=w.config)!=null&&I.multiline&&(e.writeLine(),e.indent()),v.forEach((R,E)=>{var N;E>0&&(e.write(","),(N=w.config)!=null&&N.multiline?e.newLine():e.write(" ")),e.write(`"${R.name}": `),R.value.write(e)}),(T=w.config)!=null&&T.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:S(this.internalType)}}writeStringWithTripleQuotes({writer:e,value:n,startOnNewLine:i,endWithNewLine:s}){var f;e.write('"""');let o=n.split(`
10
+ `);if(o.length<=1){e.write(this.escapeString((f=o[0])!=null?f:"")),e.write('"""');return}i&&e.writeNoIndent(`\\
11
+ `),o.forEach((l,d)=>{e.writeNoIndent(this.escapeString(l)),d===o.length-1?s&&e.writeNoIndent(`\\
12
+ `):e.writeNoIndent(`
13
+ `)}),e.writeNoIndent('"""')}escapeString(e){let n=new RegExp(`(?<!\\\\)(["'\\\\\\t\\n\\r])`,"g"),i={'"':'\\"',"'":"\\'","\\":"\\\\"," ":"\\t","\n":"\\n","\r":"\\r"};return e.replace(n,s=>{var o;return(o=i[s])!=null?o:s})}writeUnknown({writer:e,value:n}){switch(typeof n){case"boolean":e.write(n?"True":"False");return;case"string":e.write(`"${this.escapeString(n)}"`);return;case"number":e.write(n.toString());return;case"object":if(n==null){e.write("None");return}if(Array.isArray(n)){this.writeUnknownArray({writer:e,value:n});return}this.writeUnknownObject({writer:e,value:n});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof n}`)}}writeUnknownArray({writer:e,value:n}){if(n.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let i of n)e.writeNode(r.unknown(i)),e.writeLine(",");e.dedent(),e.write("]")}writeUnknownObject({writer:e,value:n}){let i=Object.entries(n);if(i.length===0){e.write("{}");return}e.writeLine("{"),e.indent();for(let[s,o]of i)e.write(`"${s}": `),e.writeNode(r.unknown(o)),e.writeLine(",");e.dedent(),e.write("}")}};function yn({entries:r}){return r.filter(t=>!j.isNop(t.key)&&!j.isNop(t.value))}function wn({entries:r}){return r.filter(t=>!j.isNop(t.value))}function Be({values:r}){return r.filter(t=>!j.isNop(t))}function xn(r){return new ee(r)}function gn(r){return new Ae(r)}function Tn(r){return new he(r)}function vn(r){return new W(r)}function In(r){return new ne(r)}function An(r){return new ie(r)}function En(r){return new k(r)}function Rn(r){return new G(r)}function Nn(r){return new V(r)}function Ln(r){return new O(r)}function Sn(r){return new re(r)}function Un(r){return new se(r)}function kn(r){return new oe(r)}function bn(r){return new z(r)}function Pn(r){return new te(r)}function Bn(r){return new fe(r)}function _n(r){return new Q(r)}function Cn(r){return new ce(r)}function Dn(r){return new ue(r)}var Mn="value",_e=class{constructor({context:t}){c(this,"context");this.context=t}convert(t){if(t.value===null)return this.context.isNullable(t.typeReference)?p.TypeInstantiation.none():(this.context.errors.add({severity:C.Critical,message:"Expected non-null value, but got null"}),p.TypeInstantiation.nop());if(t.value===void 0)return p.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?p.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 p.TypeInstantiation.unknown(t.value);default:S(t.typeReference)}}convertLiteral({literalType:t,value:e}){switch(t.type){case"boolean":{let n=this.context.getValueAsBoolean({value:e});return n==null?p.TypeInstantiation.nop():p.TypeInstantiation.bool(n)}case"string":{let n=this.context.getValueAsString({value:e});return n==null?p.TypeInstantiation.nop():p.TypeInstantiation.str(n)}default:S(t)}}convertList({list:t,value:e}){return Array.isArray(e)?p.TypeInstantiation.list(e.map((n,i)=>{this.context.errors.scope({index:i});try{return this.convert({typeReference:t,value:n})}finally{this.context.errors.unscope()}}),{multiline:!0}):(this.context.errors.add({severity:C.Critical,message:`Expected array but got: ${typeof e}`}),p.TypeInstantiation.nop())}convertSet({set:t,value:e}){return Array.isArray(e)?p.TypeInstantiation.set(e.map((n,i)=>{this.context.errors.scope({index:i});try{return this.convert({typeReference:t,value:n})}finally{this.context.errors.unscope()}}),{multiline:!0}):(this.context.errors.add({severity:C.Critical,message:`Expected array but got: ${typeof e}`}),p.TypeInstantiation.nop())}convertMap({map:t,value:e}){return typeof e!="object"||e==null?(this.context.errors.add({severity:C.Critical,message:`Expected object but got: ${e==null?"null":typeof e}`}),p.TypeInstantiation.nop()):p.TypeInstantiation.dict(Object.entries(e).map(([n,i])=>{this.context.errors.scope(n);try{return{key:this.convert({typeReference:t.key,value:n,as:"key"}),value:this.convert({typeReference:t.value,value:i})}}finally{this.context.errors.unscope()}}),{multiline:!0})}convertNamed({named:t,value:e,as:n}){switch(t.type){case"alias":return this.convert({typeReference:t.typeReference,value:e,as:n});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:t,value:e});case"enum":return this.convertEnum({enum_:t,value:e});case"object":return this.convertObject({object_:t,value:e});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e});default:S(t)}}convertDiscriminatedUnion({discriminatedUnion:t,value:e}){let n=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e});if(n==null)return p.TypeInstantiation.nop();let i=n.singleDiscriminatedUnionType,s=this.convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:n,unionVariant:i});if(s==null)return p.TypeInstantiation.nop();let o={name:this.context.getPropertyName(t.discriminant.name),value:p.TypeInstantiation.str(i.discriminantValue.wireValue)};return p.TypeInstantiation.typedDict([o,...s],{multiline:!0})}convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:t,unionVariant:e}){let n=this.getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:e});switch(e.type){case"samePropertiesAsObject":{let i=this.context.resolveNamedType({typeId:e.typeId});if(i==null)return;let s=this.convertNamed({named:i,value:t.value});if(!s.isTypedDict()){this.context.errors.add({severity:C.Critical,message:"Internal error; expected union value to be an object"});return}let o=s.asTypedDictOrThrow();return[...n,...o.entries]}case"singleProperty":try{this.context.errors.scope(e.discriminantValue.wireValue);let i=this.context.getRecord(t.value);return i==null?[...n,{name:Mn,value:this.convert({typeReference:e.typeReference,value:t.value})}]:[...n,{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 n;default:S(e)}}getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:e}){var i,s;return this.context.associateByWireValue({parameters:(i=e.properties)!=null?i:[],values:(s=this.context.getRecord(t.value))!=null?s:{},ignoreMissingParameters:!0}).map(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()}})}convertObject({object_:t,value:e}){var i;let n=this.context.associateByWireValue({parameters:t.properties,values:(i=this.context.getRecord(e))!=null?i:{}});return p.TypeInstantiation.typedDict(n.map(s=>{this.context.errors.scope(s.name.wireValue);try{return{name:this.context.getPropertyName(s.name.name),value:this.convert(s)}}finally{this.context.errors.unscope()}}),{multiline:!0})}convertEnum({enum_:t,value:e}){let n=this.getEnumValue({enum_:t,value:e});return n==null?p.TypeInstantiation.nop():p.TypeInstantiation.str(n)}getEnumValue({enum_:t,value:e}){if(typeof e!="string"){this.context.errors.add({severity:C.Critical,message:`Expected enum value string, got: ${typeof e}`});return}if(t.values.find(i=>i.wireValue===e)==null){this.context.errors.add({severity:C.Critical,message:`An enum value named "${e}" does not exist in this context`});return}return e}convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e}){let n=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e});return n==null?p.TypeInstantiation.nop():n}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e}){for(let n of t.types)try{return this.convert({typeReference:n,value:e})}catch(i){continue}this.context.errors.add({severity:C.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof e}" value`})}convertPrimitive({primitive:t,value:e,as:n}){switch(t){case"INTEGER":case"LONG":case"UINT":case"UINT_64":{let i=this.getValueAsNumber({value:e,as:n});return i==null?p.TypeInstantiation.nop():p.TypeInstantiation.int(i)}case"FLOAT":case"DOUBLE":{let i=this.getValueAsNumber({value:e});return i==null?p.TypeInstantiation.nop():p.TypeInstantiation.float(i)}case"BOOLEAN":{let i=this.getValueAsBoolean({value:e,as:n});return i==null?p.TypeInstantiation.nop():p.TypeInstantiation.bool(i)}case"BASE_64":case"BIG_INTEGER":case"STRING":{let i=this.context.getValueAsString({value:e});return i==null?p.TypeInstantiation.nop():p.TypeInstantiation.str(i)}case"UUID":{let i=this.context.getValueAsString({value:e});return i==null?p.TypeInstantiation.nop():p.TypeInstantiation.uuid(i)}case"DATE":{let i=this.context.getValueAsString({value:e});return i==null?p.TypeInstantiation.nop():p.TypeInstantiation.date(i)}case"DATE_TIME":{let i=this.context.getValueAsString({value:e});return i==null?p.TypeInstantiation.nop():p.TypeInstantiation.datetime(i)}default:S(t)}}getValueAsNumber({value:t,as:e}){let n=e==="key"&&typeof t=="string"?Number(t):t;return this.context.getValueAsNumber({value:n})}getValueAsBoolean({value:t,as:e}){let n=e==="key"?typeof t=="string"?t==="true":t==="false"?!1:t:t;return this.context.getValueAsBoolean({value:n})}};0&&(module.exports={DynamicTypeLiteralMapper});
14
+ /*! Bundled license information:
15
+
16
+ @esbuild-plugins/node-globals-polyfill/Buffer.js:
17
+ (*!
18
+ * The buffer module from node.js, for the browser.
19
+ *
20
+ * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
21
+ * @license MIT
22
+ *)
23
+ */
@@ -0,0 +1,5 @@
1
+ import '@fern-api/dynamic-ir-sdk';
2
+ import '@fern-api/python-ast';
3
+ export { a as DynamicTypeLiteralMapper } from '../DynamicSnippetsGeneratorContext-aXWxVpwD.cjs';
4
+ import '@fern-api/browser-compatible-base-generator';
5
+ import '@fern-api/python-browser-compatible-base';