@fern-api/python-dynamic-snippets 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/cjs/DynamicSnippetsGenerator.cjs +15 -10
  2. package/cjs/DynamicSnippetsGenerator.cjs.map +1 -0
  3. package/cjs/DynamicSnippetsGenerator.d.cts +1 -1
  4. package/cjs/EndpointSnippetGenerator.cjs +15 -10
  5. package/cjs/EndpointSnippetGenerator.cjs.map +1 -0
  6. package/cjs/EndpointSnippetGenerator.d.cts +2 -0
  7. package/cjs/context/DynamicSnippetsGeneratorContext.cjs +15 -10
  8. package/cjs/context/DynamicSnippetsGeneratorContext.cjs.map +1 -0
  9. package/cjs/context/DynamicTypeLiteralMapper.cjs +15 -10
  10. package/cjs/context/DynamicTypeLiteralMapper.cjs.map +1 -0
  11. package/cjs/context/FilePropertyMapper.cjs +14 -9
  12. package/cjs/context/FilePropertyMapper.cjs.map +1 -0
  13. package/cjs/index.cjs +24 -19
  14. package/cjs/index.cjs.map +1 -0
  15. package/cjs/index.d.cts +1 -1
  16. package/esm/DynamicSnippetsGenerator.d.ts +1 -1
  17. package/esm/DynamicSnippetsGenerator.js +2 -1
  18. package/esm/DynamicSnippetsGenerator.js.map +1 -0
  19. package/esm/EndpointSnippetGenerator.d.ts +2 -0
  20. package/esm/EndpointSnippetGenerator.js +2 -1
  21. package/esm/EndpointSnippetGenerator.js.map +1 -0
  22. package/esm/{chunk-BVS32MTY.js → chunk-3LXSVXLG.js} +2 -1
  23. package/esm/chunk-3LXSVXLG.js.map +1 -0
  24. package/esm/chunk-7DC5LAKR.js +28 -0
  25. package/esm/chunk-7DC5LAKR.js.map +1 -0
  26. package/esm/{chunk-EBPBFF5C.js → chunk-A2A6Z7VZ.js} +2 -1
  27. package/esm/chunk-A2A6Z7VZ.js.map +1 -0
  28. package/esm/{chunk-LKHXBDU2.js → chunk-QZ6H2KCF.js} +2 -1
  29. package/esm/chunk-QZ6H2KCF.js.map +1 -0
  30. package/esm/chunk-RZQMRQM5.js +2 -0
  31. package/esm/chunk-RZQMRQM5.js.map +1 -0
  32. package/esm/chunk-UU6KFSXM.js +2 -0
  33. package/esm/chunk-UU6KFSXM.js.map +1 -0
  34. package/esm/chunk-VDFQDR2Q.js +2 -0
  35. package/esm/chunk-VDFQDR2Q.js.map +1 -0
  36. package/esm/context/DynamicSnippetsGeneratorContext.js +2 -1
  37. package/esm/context/DynamicSnippetsGeneratorContext.js.map +1 -0
  38. package/esm/context/DynamicTypeLiteralMapper.js +2 -1
  39. package/esm/context/DynamicTypeLiteralMapper.js.map +1 -0
  40. package/esm/context/FilePropertyMapper.js +2 -1
  41. package/esm/context/FilePropertyMapper.js.map +1 -0
  42. package/esm/index.d.ts +1 -1
  43. package/esm/index.js +12 -11
  44. package/esm/index.js.map +1 -0
  45. package/package.json +1 -1
  46. package/esm/chunk-EX7EKKG4.js +0 -1
  47. package/esm/chunk-IM4ZUKD4.js +0 -1
  48. package/esm/chunk-LZ7Y5YRK.js +0 -1
  49. package/esm/chunk-NPWTXI2T.js +0 -23
@@ -1,16 +1,20 @@
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(`
1
+ "use strict";var de=Object.defineProperty;var ft=Object.getOwnPropertyDescriptor;var ut=Object.getOwnPropertyNames,me=Object.getOwnPropertySymbols;var Ne=Object.prototype.hasOwnProperty,_e=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,Se=(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))_e.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&&_e.call(r,n)&&(e[n]=r[n]);return e};var Le=(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})},ht=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ut(t))!Ne.call(r,i)&&i!==e&&de(r,i,{get:()=>t[i],enumerable:!(n=ft(t,i))||n.enumerable});return r};var lt=r=>ht(de({},"__esModule",{value:!0}),r);var f=(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 We(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 pt(r){if(W===clearTimeout)return clearTimeout(r);if((W===Ye||!W)&&clearTimeout)return W=clearTimeout,clearTimeout(r);try{return W(r)}catch(t){try{return W.call(null,r)}catch(e){return W.call(this,r)}}}function mt(){!q||!Z||(q=!1,Z.length?M=Z.concat(M):ye=-1,M.length&&$e())}function $e(){if(!q){var r=We(mt);q=!0;for(var t=M.length;t;){for(Z=M,M=[];++ye<t;)Z&&Z[ye].run();ye=-1,t=M.length}Z=null,q=!1,pt(r)}}function dt(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&&!q&&We($e)}function Ve(r,t){this.fun=r,this.array=t}function J(){}function Ct(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 Mt(r){var t=Dt.call(X)*.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 Ot(){var r=new Date,t=r-Ft;return t/1e3}var Y,W,M,q,Z,ye,yt,wt,xt,gt,Tt,vt,It,At,Et,Rt,Nt,St,Lt,kt,bt,Ut,X,Dt,Ft,g,Fe,h=Le(()=>{"use strict";Y=Oe,W=Ye;typeof globalThis.setTimeout=="function"&&(Y=setTimeout);typeof globalThis.clearTimeout=="function"&&(W=clearTimeout);M=[],q=!1,ye=-1;Ve.prototype.run=function(){this.fun.apply(null,this.array)};yt="browser",wt="browser",xt=!0,gt={},Tt=[],vt="",It={},At={},Et={};Rt=J,Nt=J,St=J,Lt=J,kt=J,bt=J,Ut=J;X=globalThis.performance||{},Dt=X.now||X.mozNow||X.msNow||X.oNow||X.webkitNow||function(){return new Date().getTime()};Ft=new Date;g={nextTick:dt,title:yt,browser:xt,env:gt,argv:Tt,version:vt,versions:It,on:Rt,addListener:Nt,once:St,off:Lt,removeListener:kt,removeAllListeners:bt,emit:Ut,binding:Ct,cwd:Pt,chdir:Bt,umask:_t,hrtime:Mt,platform:wt,release:At,config:Et,uptime:Ot},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 Ge(){be=!0;for(var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=r.length;t<e;++t)P[t]=r[t],k[r.charCodeAt(t)]=t;k[45]=62,k[95]=63}function Wt(r){be||Ge();var t,e,n,i,s,o,c=r.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");s=r[c-2]==="="?2:r[c-1]==="="?1:0,o=new Yt(c*3/4-s),n=s>0?c-4:c;var u=0;for(t=0,e=0;t<n;t+=4,e+=3)i=k[r.charCodeAt(t)]<<18|k[r.charCodeAt(t+1)]<<12|k[r.charCodeAt(t+2)]<<6|k[r.charCodeAt(t+3)],o[u++]=i>>16&255,o[u++]=i>>8&255,o[u++]=i&255;return s===2?(i=k[r.charCodeAt(t)]<<2|k[r.charCodeAt(t+1)]>>4,o[u++]=i&255):s===1&&(i=k[r.charCodeAt(t)]<<10|k[r.charCodeAt(t+1)]<<4|k[r.charCodeAt(t+2)]>>2,o[u++]=i>>8&255,o[u++]=i&255),o}function $t(r){return P[r>>18&63]+P[r>>12&63]+P[r>>6&63]+P[r&63]}function Vt(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 je(r){be||Ge();for(var t,e=r.length,n=e%3,i="",s=[],o=16383,c=0,u=e-n;c<u;c+=o)s.push(Vt(r,c,c+o>u?u:c+o));return n===1?(t=r[e-1],i+=P[t>>2],i+=P[t<<4&63],i+="=="):n===2&&(t=(r[e-2]<<8)+r[e-1],i+=P[t>>10],i+=P[t>>4&63],i+=P[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 Ue(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 jt(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 Ue(r,t){if(Je(t),r=F(r,t<0?0:Ce(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 ke(r,t){var e=t.length<0?0:Ce(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=ke(r,t),r}function Gt(r,t){if(B(t)){var e=Ce(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"||pn(t.length)?F(r,0):ke(r,t);if(t.type==="Buffer"&&Array.isArray(t.data))return ke(r,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function Ce(r){if(r>=we())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+we().toString(16)+" bytes");return r|0}function B(r){return!!(r!=null&&r._isBuffer)}function He(r,t){if(B(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 Zt(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 sn(this,t,e);case"utf8":case"utf-8":return qe(this,t,e);case"ascii":return nn(this,t,e);case"latin1":case"binary":return rn(this,t,e);case"base64":return en(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return on(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 Ke(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)),B(t))return t.length===0?-1:Qe(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):Qe(r,[t],e,n,i);throw new TypeError("val must be string, number or Buffer")}function Qe(r,t,e,n,i){var s=1,o=r.length,c=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||t.length<2)return-1;s=2,o/=2,c/=2,e/=2}function u(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(u(r,d)===u(t,m===-1?0:d-m)){if(m===-1&&(m=d),d-m+1===c)return m*s}else m!==-1&&(d-=d-m),m=-1}else for(e+c>o&&(e=o-c),d=e;d>=0;d--){for(var y=!0,I=0;I<c;I++)if(u(r,d+I)!==u(t,I)){y=!1;break}if(y)return d}return-1}function Jt(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 c=parseInt(t.substr(o*2,2),16);if(isNaN(c))return o;r[e+o]=c}return o}function Ht(r,t,e,n){return ve(xe(t,r.length-e),r,e,n)}function Xe(r,t,e,n){return ve(hn(t),r,e,n)}function Kt(r,t,e,n){return Xe(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(ln(t,r.length-e),r,e,n)}function en(r,t,e){return t===0&&e===r.length?je(r):je(r.slice(t,e))}function qe(r,t,e){e=Math.min(r.length,e);for(var n=[],i=t;i<e;){var s=r[i],o=null,c=s>239?4:s>223?3:s>191?2:1;if(i+c<=e){var u,d,m,y;switch(c){case 1:s<128&&(o=s);break;case 2:u=r[i+1],(u&192)===128&&(y=(s&31)<<6|u&63,y>127&&(o=y));break;case 3:u=r[i+1],d=r[i+2],(u&192)===128&&(d&192)===128&&(y=(s&15)<<12|(u&63)<<6|d&63,y>2047&&(y<55296||y>57343)&&(o=y));break;case 4:u=r[i+1],d=r[i+2],m=r[i+3],(u&192)===128&&(d&192)===128&&(m&192)===128&&(y=(s&15)<<18|(u&63)<<12|(d&63)<<6|m&63,y>65535&&y<1114112&&(o=y))}}o===null?(o=65533,c=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=c}return tn(n)}function tn(r){var t=r.length;if(t<=ze)return String.fromCharCode.apply(String,r);for(var e="",n=0;n<t;)e+=String.fromCharCode.apply(String,r.slice(n,n+=ze));return e}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]&127);return n}function rn(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 sn(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+=un(r[s]);return i}function on(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 S(r,t,e,n,i,s){if(!B(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 cn(r){if(r=fn(r).replace(an,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function fn(r){return r.trim?r.trim():r.replace(/^\s+|\s+$/g,"")}function un(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 hn(r){for(var t=[],e=0;e<r.length;++e)t.push(r.charCodeAt(e)&255);return t}function ln(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 Wt(cn(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 pn(r){return r!==r}function mn(r){return r!=null&&(!!r._isBuffer||it(r)||dn(r))}function it(r){return!!r.constructor&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function dn(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,c=i*8-n-1,u=(1<<c)-1,d=u>>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+=c;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===u)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,c,u,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?(c=isNaN(t)?1:0,o=m):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+y>=1?t+=I/u:t+=I*Math.pow(2,1-y),t*u>=2&&(o++,u/=2),o+y>=m?(c=0,o=m):o+y>=1?(c=(t*u-1)*Math.pow(2,i),o=o+y):(c=t*Math.pow(2,y-1)*Math.pow(2,i),o=0));i>=8;r[e+T]=c&255,T+=w,c/=256,i-=8);for(o=o<<i|c,d+=i;d>0;r[e+T]=o&255,T+=w,o/=256,d-=8);r[e+T-w]|=v*128}var P,k,Yt,be,ze,an,ot=Le(()=>{"use strict";h();l();P=[],k=[],Yt=typeof Uint8Array!="undefined"?Uint8Array:Array,be=!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 jt(null,r,t,e)};a.allocUnsafe=function(r){return Ue(null,r)};a.allocUnsafeSlow=function(r){return Ue(null,r)};a.isBuffer=mn;a.compare=function(t,e){if(!B(t)||!B(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(!B(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?qe(this,0,t):Zt.apply(this,arguments)};a.prototype.equals=function(t){if(!B(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:a.compare(this,t)===0};a.prototype.compare=function(t,e,n,i,s){if(!B(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,c=n-e,u=Math.min(o,c),d=this.slice(i,s),m=t.slice(e,n),y=0;y<u;++y)if(d[y]!==m[y]){o=d[y],c=m[y];break}return o<c?-1:c<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 Ke(this,t,e,n,!0)};a.prototype.lastIndexOf=function(t,e,n){return Ke(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 Jt(this,t,e,n);case"utf8":case"utf-8":return Ht(this,t,e,n);case"ascii":return Xe(this,t,e,n);case"latin1":case"binary":return Kt(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)}};ze=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;S(this,t,e,n,s,0)}var o=1,c=0;for(this[e]=t&255;++c<n&&(o*=256);)this[e+c]=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;S(this,t,e,n,s,0)}var o=n-1,c=1;for(this[e+o]=t&255;--o>=0&&(c*=256);)this[e+o]=t/c&255;return e+n};a.prototype.writeUInt8=function(t,e,n){return t=+t,e=e|0,n||S(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||S(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||S(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||S(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||S(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);S(this,t,e,n,s-1,-s)}var o=0,c=1,u=0;for(this[e]=t&255;++o<n&&(c*=256);)t<0&&u===0&&this[e+o-1]!==0&&(u=1),this[e+o]=(t/c>>0)-u&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);S(this,t,e,n,s-1,-s)}var o=n-1,c=1,u=0;for(this[e+o]=t&255;--o>=0&&(c*=256);)t<0&&u===0&&this[e+o+1]!==0&&(u=1),this[e+o]=(t/c>>0)-u&255;return e+n};a.prototype.writeInt8=function(t,e,n){return t=+t,e=e|0,n||S(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||S(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||S(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||S(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||S(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 c=B(t)?t:xe(new a(t,i).toString()),u=c.length;for(o=0;o<n-e;++o)this[o+e]=c[o%u]}return this};an=/[^+\/0-9A-Za-z-_]/g});var l=Le(()=>{"use strict";ot()});var On={};Me(On,{DynamicTypeLiteralMapper:()=>Be});module.exports=lt(On);h();l();h();l();h();l();function L(r){throw new Error("Unexpected value: "+JSON.stringify(r))}h();l();h();l();var K=class{};h();l();h();l();var C=class extends K{constructor(e){super();f(this,"value");this.value=e}write(e){typeof this.value=="string"?e.write(this.value):typeof this.value=="function"?this.value(e):this.value.write(e)}};var yn=4,at=!!g.env.FERN_STACK_TRACK;at&&(Error.stackTraceLimit=50);var le=class{constructor(){f(this,"buffer","");f(this,"indentLevel",0);f(this,"hasWrittenAnything",!1);f(this,"lastCharacterIsSemicolon",!1);f(this,"lastCharacterIsNewline",!1)}write(...t){for(let e of t)if(e!=null)if(typeof e=="string"){let n=e.length>0&&e.endsWith(`
2
+ `),i=n?e.substring(0,e.length-1):e,s=this.getIndentString(),o=i.replaceAll(`
3
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(`
4
+ ${s}`);this.isAtStartOfLine()&&(o=s+o),n&&(o+=`
5
+ `),this.writeInternal(o)}else this.writeNode(e)}writeStatement(...t){this.write(...t),this.write(";"),this.writeNewLineIfLastLineNot()}writeNoIndent(t){let e=this.indentLevel;this.indentLevel=0,this.write(t),this.indentLevel=e}writeNode(t){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 C(t).write(this),t.endsWith(";")||this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(t,e){new C(t).write(this),this.write(" (",e,")"),this.pushScope()}controlFlowWithoutStatement(t){new C(t).write(this),this.pushScope()}endControlFlow(){this.popScope()}contiguousControlFlow(t,e){this.dedent(),this.write("} "),new C(t).write(this),this.write(" (",e,")"),this.pushScope()}alternativeControlFlow(t){this.dedent(),this.write("} "),new C(t).write(this),this.pushScope()}pushScope(){this.writeLine("{"),this.indent()}popScope(t=!0){this.dedent(),this.writeNewLineIfLastLineNot(),t?this.writeLine("}"):this.write("}")}writeLine(t=""){this.write(t),this.writeNewLineIfLastLineNot()}newLine(){this.writeInternal(`
6
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(`\\
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){if(t.length>0&&(this.hasWrittenAnything=!0,this.lastCharacterIsNewline=t.endsWith(`
8
+ `),this.lastCharacterIsSemicolon=t.endsWith(";")),this.buffer+=t,at&&this.buffer.endsWith(`
9
+ `)&&!this.buffer.endsWith(`"""
10
+ `)){let e=this.stacktrace(15).map(n=>`${n.fn} - ${n.path}:${n.position}`).join(" ");e&&(this.buffer=this.buffer.slice(0,-1),this.buffer+=`//@@ ${e}
11
+ `)}return this.buffer}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*this.getTabSize())}getTabSize(){return yn}stacktrace(t=50){var n;let e=!1;return((n=new Error().stack)!=null?n:"").split(`
12
+ `).map(i=>{var o;let s=i.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(s&&s.length===5){let[,c,u,d,m]=s;if(e||c!=null&&c.includes("runInteractiveTask")){e=!0;return}switch(c){case"Object.<anonymous>":c="";break;case"Object.object":case"Object.alias":case"Object.union":case"Object.enum":case"Object.undiscriminatedUnion":c=`${c.substring(c.indexOf(".")+1)}()=> { ... }`;break}return{fn:c,path:(o=u==null?void 0:u.replace(/^.*?fern.*?\//,""))!=null?o:"",position:`${d}:${m}`}}}).filter(i=>{var s,o,c,u,d,m,y;return i&&!((s=i.path)!=null&&s.startsWith("node:"))&&!((o=i.path)!=null&&o.endsWith(".js"))&&!((c=i.path)!=null&&c.includes("AbstractWriter"))&&!((u=i.fn)!=null&&u.includes("stacktrace"))&&!((d=i.fn)!=null&&d.includes("stackLine"))&&!((m=i.fn)!=null&&m.includes("SdkGeneratorCLI"))&&!((y=i.fn)!=null&&y.includes("runCli"))}).slice(0,t)}};h();l();h();l();var _={Critical:"CRITICAL",Warning:"WARNING"};h();l();var p={};Me(p,{AccessAttribute:()=>ee,AstNode:()=>x,Class:()=>$,ClassInstantiation:()=>ne,CodeBlock:()=>O,Comment:()=>re,Decorator:()=>ie,Field:()=>V,Lambda:()=>se,LambdaParameter:()=>oe,Method:()=>Q,MethodArgument:()=>ce,MethodInvocation:()=>fe,Operator:()=>ue,Parameter:()=>j,PythonFile:()=>he,Reference:()=>b,StarImport:()=>z,Type:()=>Ee,TypeInstantiation:()=>G,accessAttribute:()=>gn,assign:()=>Tn,class_:()=>In,codeBlock:()=>Ln,comment:()=>kn,decorator:()=>En,field:()=>Sn,file:()=>vn,instantiateClass:()=>An,invokeFunction:()=>Pn,invokeMethod:()=>Bn,lambda:()=>bn,lambdaParameter:()=>Un,method:()=>Cn,methodArgument:()=>Dn,operator:()=>Mn,parameter:()=>_n,reference:()=>Rn,starImport:()=>Nn});h();l();h();l();h();l();h();l();var pe=class extends le{constructor(){super(...arguments);f(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 K{constructor(){super(...arguments);f(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();f(this,"lhs");f(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)}};h();l();var Ae=class extends x{constructor({lhs:e,rhs:n}){super();f(this,"lhs");f(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)}};h();l();var te=class extends x{constructor({reference:e,arguments_:n,multiline:i}){super();f(this,"reference");f(this,"arguments");f(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(")")}};h();l();var $=class extends x{constructor({docs:e,name:n,extends_:i,decorators:s}){super();f(this,"name");f(this,"extends_");f(this,"decorators");f(this,"fields",[]);f(this,"docs");f(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)}};h();l();var ne=class extends te{constructor(n){var i=n,{classReference:t}=i,e=De(i,["classReference"]);super(Se({reference:t},e))}};h();l();var O=class extends x{constructor(e){super();f(this,"arg");this.arg=e}write(e){return new C(this.arg).write(e)}};h();l();var re=class extends x{constructor({docs:e}){super();f(this,"docs");this.docs=e}write(e){this.docs!=null&&this.docs.split(`
13
+ `).forEach(n=>{e.writeLine(`# ${n}`)})}};h();l();var ie=class extends x{constructor({callable:e}){super();f(this,"callable");this.callable=e,this.inheritReferences(e)}write(e){e.write("@"),this.callable.write(e),e.newLine()}};h();l();var V=class extends x{constructor({name:e,type:n,initializer:i,docs:s}){super();f(this,"name");f(this,"type");f(this,"initializer");f(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('"""'))}};h();l();var se=class extends x{constructor({parameters:e,body:n}){super();f(this,"parameters");f(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)}};h();l();h();l();var j=class extends x{constructor({name:e,type:n,initializer:i}){super();f(this,"name");f(this,"initializer");f(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 j{constructor({name:t,initializer:e}){super({name:t,initializer:e,type:void 0})}};h();l();var ae;(function(r){r[r.STATIC=0]="STATIC",r[r.INSTANCE=1]="INSTANCE",r[r.CLASS=2]="CLASS"})(ae||(ae={}));var Q=class extends x{constructor({static_:e,name:n,parameters:i,return_:s,docstring:o,type:c,decorators:u}){super();f(this,"name");f(this,"return");f(this,"docstring");f(this,"type");f(this,"parameters");f(this,"decorators");f(this,"statements",[]);f(this,"static_");this.name=n,this.parameters=i!=null?i:[],this.return=s,this.docstring=o,this.type=c,this.decorators=u!=null?u:[],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(s=>{s.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}(`);let i=this.parameters.length>3;i&&(e.newLine(),e.indent()),this.type===ae.INSTANCE?(e.write("self"),this.parameters.length>0&&(e.write(i?",":", "),i&&e.newLine())):this.type===ae.CLASS&&(e.write("cls"),this.parameters.length>0&&(e.write(i?",":", "),i&&e.newLine())),this.parameters.forEach((s,o)=>{s.write(e),o<this.parameters.length-1&&(e.write(i?",":", "),i&&e.newLine())}),i&&(e.write(","),e.dedent(),e.newLine()),e.write(")"),this.return&&(e.write(" -> "),this.return.write(e)),e.write(":"),e.newLine(),this.docstring&&(e.indent(),e.write('"""'),e.write(this.docstring),e.write('"""'),e.newLine(),e.dedent()),this.statements.length?(e.indent(),this.statements.forEach((s,o)=>{s.write(e),o<this.statements.length-1&&e.newLine()}),e.dedent()):(e.indent(),e.write("pass"),e.dedent()),e.newLine()}};h();l();var ce=class extends x{constructor({name:e,value:n}){super();f(this,"name");f(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)}};h();l();var fe=class extends x{constructor({on:e,method:n,arguments_:i,multiline:s}){super();f(this,"on");f(this,"method");f(this,"arguments");f(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(")")}};h();l();h();l();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();f(this,"operator");f(this,"lhs");f(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:L(this.operator)}}write(e){this.lhs.write(e),e.write(" "),e.write(this.getOperatorString()),e.write(" "),this.rhs.write(e)}};h();l();h();l();function ct(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(""))}h();l();h();l();var b=class extends x{constructor({name:e,modulePath:n,genericTypes:i,alias:s,attribute:o}){super();f(this,"name");f(this,"modulePath");f(this,"genericTypes");f(this,"alias");f(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(c=>{this.inheritReferences(c)})}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 z=class extends b{constructor({modulePath:e}){super({name:"*",modulePath:e});f(this,"docs")}write(e){throw new Error("Not intended to be written outside the context of a PythonFile.")}};var he=class extends x{constructor({path:e,statements:n,isInitFile:i=!1,comments:s,imports:o}){super();f(this,"path");f(this,"isInitFile");f(this,"statements",[]);f(this,"comments");this.path=e,this.isInitFile=i,n==null||n.forEach(c=>this.addStatement(c)),this.comments=s!=null?s:[],o==null||o.forEach(c=>this.addReference(c))}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(),c=this.path.join("."),u=n.get(c);if(u){let{references:m}=u;m.forEach(y=>{let I=y.getFullyQualifiedModulePath(),T=y.name;s[I]={name:T,isAlias:!1},o.add(y.name)}),i.delete(c)}Array.from(i.values()).flatMap(({references:m})=>m).forEach(m=>{var R;if(m instanceof z)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=`${ct(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 $||n instanceof Q||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 c=s;if(!this.isDefinedInFile(c)){if(c[0]===this.path[0]){let u=0;for(;u<this.path.length&&u<c.length&&this.path[u]===c[u];)u++;let d=this.path.length-u;this.isInitFile&&d++;let m=d>0?".".repeat(d):".";m+=c.slice(u).join("."),e.write(`from ${m} import ${o.map(y=>this.getImportName({writer:e,reference:y})).join(", ")}`)}else e.write(`from ${i} import ${o.map(u=>this.getImportName({writer:e,reference:u})).join(", ")}`);e.newLine()}}e.newLine()}}isDefinedInFile(e){return e.length===this.path.length&&e.every((n,i)=>n===this.path[i])}};h();l();var Ee=class extends x{constructor(e){super();f(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:L(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"}};h();l();var G=class r extends x{constructor(e){super();f(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 b({name:"date",modulePath:["datetime"]})),n}static datetime(e){let n=new this({type:"datetime",value:e});return n.addReference(new b({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 b({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,c,u,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=Pe({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,U;E>0&&(e.write(","),(N=w.config)!=null&&N.multiline?e.newLine():e.write(" ")),R.write(e),E===v.length-1&&((U=w.config)!=null&&U.endWithComma)&&e.write(",")}),(s=w.config)!=null&&s.multiline&&(e.newLine(),e.dedent()),e.write("]");break}case"set":{let w=this.internalType,v=Pe({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,U;E>0&&(e.write(","),(N=w.config)!=null&&N.multiline?e.newLine():e.write(" ")),R.write(e),E===v.length-1&&((U=w.config)!=null&&U.endWithComma)&&e.write(",")}),(c=w.config)!=null&&c.multiline&&(e.newLine(),e.dedent()),e.write("}");break}case"tuple":{let w=this.internalType,v=Pe({values:w.values});if(v.length===0){e.write("()");break}e.write("("),(u=w.config)!=null&&u.multiline&&(e.newLine(),e.indent()),v.forEach((R,E)=>{var N,U;E>0&&(e.write(","),(N=w.config)!=null&&N.multiline?e.newLine():e.write(" ")),R.write(e),(v.length===1||E===v.length-1&&((U=w.config)!=null&&U.endWithComma))&&e.write(",")}),(d=w.config)!=null&&d.multiline&&(e.newLine(),e.dedent()),e.write(")");break}case"dict":{let w=this.internalType,v=wn({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,U;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&&((U=w.config)!=null&&U.endWithComma)&&e.write(",")}),(y=w.config)!=null&&y.multiline&&(e.newLine(),e.dedent()),e.write("}");break}case"typedDict":{let w=this.internalType,v=xn({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:L(this.internalType)}}writeStringWithTripleQuotes({writer:e,value:n,startOnNewLine:i,endWithNewLine:s}){var c;e.write('"""');let o=n.split(`
14
+ `);if(o.length<=1){e.write(this.escapeString((c=o[0])!=null?c:"")),e.write('"""');return}i&&e.writeNoIndent(`\\
15
+ `),o.forEach((u,d)=>{e.writeNoIndent(this.escapeString(u)),d===o.length-1?s&&e.writeNoIndent(`\\
12
16
  `):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});
17
+ `)}),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 wn({entries:r}){return r.filter(t=>!G.isNop(t.key)&&!G.isNop(t.value))}function xn({entries:r}){return r.filter(t=>!G.isNop(t.value))}function Pe({values:r}){return r.filter(t=>!G.isNop(t))}function gn(r){return new ee(r)}function Tn(r){return new Ae(r)}function vn(r){return new he(r)}function In(r){return new $(r)}function An(r){return new ne(r)}function En(r){return new ie(r)}function Rn(r){return new b(r)}function Nn(r){return new z(r)}function Sn(r){return new V(r)}function Ln(r){return new O(r)}function kn(r){return new re(r)}function bn(r){return new se(r)}function Un(r){return new oe(r)}function Cn(r){return new Q(r)}function Pn(r){return new te(r)}function Bn(r){return new fe(r)}function _n(r){return new j(r)}function Dn(r){return new ce(r)}function Mn(r){return new ue(r)}var Fn="value",Be=class{constructor({context:t}){f(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:_.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:L(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:L(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:_.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:_.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:_.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:L(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:_.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:Fn,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:L(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:_.Critical,message:`Expected enum value string, got: ${typeof e}`});return}if(t.values.find(i=>i.wireValue===e)==null){this.context.errors.add({severity:_.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:_.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:L(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
18
  /*! Bundled license information:
15
19
 
16
20
  @esbuild-plugins/node-globals-polyfill/Buffer.js:
@@ -21,3 +25,4 @@ ${i}`);this.isAtStartOfLine()&&(s=i+s),e&&(s+=`
21
25
  * @license MIT
22
26
  *)
23
27
  */
28
+ //# sourceMappingURL=DynamicTypeLiteralMapper.cjs.map