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

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
package/cjs/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { DynamicSnippetsGenerator } from './DynamicSnippetsGenerator.cjs';
2
2
  import '@fern-api/browser-compatible-base-generator';
3
3
  import '@fern-api/dynamic-ir-sdk';
4
- import './EndpointSnippetGenerator.cjs';
5
4
  import './DynamicSnippetsGeneratorContext-4_I0JAlU.cjs';
6
5
  import '@fern-api/python-ast';
7
6
  import '@fern-api/python-browser-compatible-base';
7
+ import './EndpointSnippetGenerator.cjs';
@@ -1,7 +1,7 @@
1
1
  import { AbstractDynamicSnippetsGenerator, FernGeneratorExec } from '@fern-api/browser-compatible-base-generator';
2
2
  import { FernIr } from '@fern-api/dynamic-ir-sdk';
3
- import { EndpointSnippetGenerator } from './EndpointSnippetGenerator.js';
4
3
  import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-4_I0JAlU.js';
4
+ import { EndpointSnippetGenerator } from './EndpointSnippetGenerator.js';
5
5
  import '@fern-api/python-ast';
6
6
  import '@fern-api/python-browser-compatible-base';
7
7
 
@@ -1 +1,2 @@
1
- import{a}from"./chunk-LZ7Y5YRK.js";import"./chunk-IM4ZUKD4.js";import"./chunk-EBPBFF5C.js";import"./chunk-BVS32MTY.js";import"./chunk-EX7EKKG4.js";import"./chunk-LKHXBDU2.js";import"./chunk-NPWTXI2T.js";export{a as DynamicSnippetsGenerator};
1
+ import{a}from"./chunk-UU6KFSXM.js";import"./chunk-VDFQDR2Q.js";import"./chunk-A2A6Z7VZ.js";import"./chunk-3LXSVXLG.js";import"./chunk-RZQMRQM5.js";import"./chunk-QZ6H2KCF.js";import"./chunk-7DC5LAKR.js";export{a as DynamicSnippetsGenerator};
2
+ //# sourceMappingURL=DynamicSnippetsGenerator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -23,6 +23,8 @@ declare class EndpointSnippetGenerator {
23
23
  private getConstructorEnvironmentArgs;
24
24
  private getEnvironmentValue;
25
25
  private getConstructorAuthArgs;
26
+ private addAuthMismatchError;
27
+ private addWarning;
26
28
  private getConstructorBasicAuthArg;
27
29
  private getConstructorBearerAuthArgs;
28
30
  private getConstructorHeaderAuthArgs;
@@ -1 +1,2 @@
1
- import{a}from"./chunk-IM4ZUKD4.js";import"./chunk-EX7EKKG4.js";import"./chunk-NPWTXI2T.js";export{a as EndpointSnippetGenerator};
1
+ import{a}from"./chunk-VDFQDR2Q.js";import"./chunk-RZQMRQM5.js";import"./chunk-7DC5LAKR.js";export{a as EndpointSnippetGenerator};
2
+ //# sourceMappingURL=EndpointSnippetGenerator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1 +1,2 @@
1
- import{b as s}from"./chunk-EX7EKKG4.js";import{j as p,k as u,m as l,n as c,p as r}from"./chunk-NPWTXI2T.js";u();l();var d="value",y=class{constructor({context:e}){p(this,"context");this.context=e}convert(e){if(e.value===null)return this.context.isNullable(e.typeReference)?r.TypeInstantiation.none():(this.context.errors.add({severity:s.Critical,message:"Expected non-null value, but got null"}),r.TypeInstantiation.nop());if(e.value===void 0)return r.TypeInstantiation.nop();switch(e.typeReference.type){case"list":return this.convertList({list:e.typeReference.value,value:e.value});case"literal":return this.convertLiteral({literalType:e.typeReference.value,value:e.value});case"map":return this.convertMap({map:e.typeReference,value:e.value});case"named":{let t=this.context.resolveNamedType({typeId:e.typeReference.value});return t==null?r.TypeInstantiation.nop():this.convertNamed({named:t,value:e.value,as:e.as})}case"optional":return this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as});case"nullable":return this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as});case"primitive":return this.convertPrimitive({primitive:e.typeReference.value,value:e.value,as:e.as});case"set":return this.convertSet({set:e.typeReference.value,value:e.value});case"unknown":return r.TypeInstantiation.unknown(e.value);default:c(e.typeReference)}}convertLiteral({literalType:e,value:t}){switch(e.type){case"boolean":{let i=this.context.getValueAsBoolean({value:t});return i==null?r.TypeInstantiation.nop():r.TypeInstantiation.bool(i)}case"string":{let i=this.context.getValueAsString({value:t});return i==null?r.TypeInstantiation.nop():r.TypeInstantiation.str(i)}default:c(e)}}convertList({list:e,value:t}){return Array.isArray(t)?r.TypeInstantiation.list(t.map((i,n)=>{this.context.errors.scope({index:n});try{return this.convert({typeReference:e,value:i})}finally{this.context.errors.unscope()}}),{multiline:!0}):(this.context.errors.add({severity:s.Critical,message:`Expected array but got: ${typeof t}`}),r.TypeInstantiation.nop())}convertSet({set:e,value:t}){return Array.isArray(t)?r.TypeInstantiation.set(t.map((i,n)=>{this.context.errors.scope({index:n});try{return this.convert({typeReference:e,value:i})}finally{this.context.errors.unscope()}}),{multiline:!0}):(this.context.errors.add({severity:s.Critical,message:`Expected array but got: ${typeof t}`}),r.TypeInstantiation.nop())}convertMap({map:e,value:t}){return typeof t!="object"||t==null?(this.context.errors.add({severity:s.Critical,message:`Expected object but got: ${t==null?"null":typeof t}`}),r.TypeInstantiation.nop()):r.TypeInstantiation.dict(Object.entries(t).map(([i,n])=>{this.context.errors.scope(i);try{return{key:this.convert({typeReference:e.key,value:i,as:"key"}),value:this.convert({typeReference:e.value,value:n})}}finally{this.context.errors.unscope()}}),{multiline:!0})}convertNamed({named:e,value:t,as:i}){switch(e.type){case"alias":return this.convert({typeReference:e.typeReference,value:t,as:i});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:e,value:t});case"enum":return this.convertEnum({enum_:e,value:t});case"object":return this.convertObject({object_:e,value:t});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t});default:c(e)}}convertDiscriminatedUnion({discriminatedUnion:e,value:t}){let i=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:t});if(i==null)return r.TypeInstantiation.nop();let n=i.singleDiscriminatedUnionType,a=this.convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:i,unionVariant:n});if(a==null)return r.TypeInstantiation.nop();let o={name:this.context.getPropertyName(e.discriminant.name),value:r.TypeInstantiation.str(n.discriminantValue.wireValue)};return r.TypeInstantiation.typedDict([o,...a],{multiline:!0})}convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:e,unionVariant:t}){let i=this.getBaseFields({discriminatedUnionTypeInstance:e,singleDiscriminatedUnionType:t});switch(t.type){case"samePropertiesAsObject":{let n=this.context.resolveNamedType({typeId:t.typeId});if(n==null)return;let a=this.convertNamed({named:n,value:e.value});if(!a.isTypedDict()){this.context.errors.add({severity:s.Critical,message:"Internal error; expected union value to be an object"});return}let o=a.asTypedDictOrThrow();return[...i,...o.entries]}case"singleProperty":try{this.context.errors.scope(t.discriminantValue.wireValue);let n=this.context.getRecord(e.value);return n==null?[...i,{name:d,value:this.convert({typeReference:t.typeReference,value:e.value})}]:[...i,{name:this.context.getPropertyName(t.discriminantValue.name),value:this.convert({typeReference:t.typeReference,value:n[t.discriminantValue.wireValue]})}]}finally{this.context.errors.unscope()}case"noProperties":return i;default:c(t)}}getBaseFields({discriminatedUnionTypeInstance:e,singleDiscriminatedUnionType:t}){var n,a;return this.context.associateByWireValue({parameters:(n=t.properties)!=null?n:[],values:(a=this.context.getRecord(e.value))!=null?a:{},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_:e,value:t}){var n;let i=this.context.associateByWireValue({parameters:e.properties,values:(n=this.context.getRecord(t))!=null?n:{}});return r.TypeInstantiation.typedDict(i.map(a=>{this.context.errors.scope(a.name.wireValue);try{return{name:this.context.getPropertyName(a.name.name),value:this.convert(a)}}finally{this.context.errors.unscope()}}),{multiline:!0})}convertEnum({enum_:e,value:t}){let i=this.getEnumValue({enum_:e,value:t});return i==null?r.TypeInstantiation.nop():r.TypeInstantiation.str(i)}getEnumValue({enum_:e,value:t}){if(typeof t!="string"){this.context.errors.add({severity:s.Critical,message:`Expected enum value string, got: ${typeof t}`});return}if(e.values.find(n=>n.wireValue===t)==null){this.context.errors.add({severity:s.Critical,message:`An enum value named "${t}" does not exist in this context`});return}return t}convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t}){let i=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t});return i==null?r.TypeInstantiation.nop():i}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t}){for(let i of e.types)try{return this.convert({typeReference:i,value:t})}catch(n){continue}this.context.errors.add({severity:s.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof t}" value`})}convertPrimitive({primitive:e,value:t,as:i}){switch(e){case"INTEGER":case"LONG":case"UINT":case"UINT_64":{let n=this.getValueAsNumber({value:t,as:i});return n==null?r.TypeInstantiation.nop():r.TypeInstantiation.int(n)}case"FLOAT":case"DOUBLE":{let n=this.getValueAsNumber({value:t});return n==null?r.TypeInstantiation.nop():r.TypeInstantiation.float(n)}case"BOOLEAN":{let n=this.getValueAsBoolean({value:t,as:i});return n==null?r.TypeInstantiation.nop():r.TypeInstantiation.bool(n)}case"BASE_64":case"BIG_INTEGER":case"STRING":{let n=this.context.getValueAsString({value:t});return n==null?r.TypeInstantiation.nop():r.TypeInstantiation.str(n)}case"UUID":{let n=this.context.getValueAsString({value:t});return n==null?r.TypeInstantiation.nop():r.TypeInstantiation.uuid(n)}case"DATE":{let n=this.context.getValueAsString({value:t});return n==null?r.TypeInstantiation.nop():r.TypeInstantiation.date(n)}case"DATE_TIME":{let n=this.context.getValueAsString({value:t});return n==null?r.TypeInstantiation.nop():r.TypeInstantiation.datetime(n)}default:c(e)}}getValueAsNumber({value:e,as:t}){let i=t==="key"&&typeof e=="string"?Number(e):e;return this.context.getValueAsNumber({value:i})}getValueAsBoolean({value:e,as:t}){let i=t==="key"?typeof e=="string"?e==="true":e==="false"?!1:e:e;return this.context.getValueAsBoolean({value:i})}};export{y as a};
1
+ import{b as s}from"./chunk-RZQMRQM5.js";import{j as p,k as u,m as l,n as c,p as r}from"./chunk-7DC5LAKR.js";u();l();var d="value",y=class{constructor({context:e}){p(this,"context");this.context=e}convert(e){if(e.value===null)return this.context.isNullable(e.typeReference)?r.TypeInstantiation.none():(this.context.errors.add({severity:s.Critical,message:"Expected non-null value, but got null"}),r.TypeInstantiation.nop());if(e.value===void 0)return r.TypeInstantiation.nop();switch(e.typeReference.type){case"list":return this.convertList({list:e.typeReference.value,value:e.value});case"literal":return this.convertLiteral({literalType:e.typeReference.value,value:e.value});case"map":return this.convertMap({map:e.typeReference,value:e.value});case"named":{let t=this.context.resolveNamedType({typeId:e.typeReference.value});return t==null?r.TypeInstantiation.nop():this.convertNamed({named:t,value:e.value,as:e.as})}case"optional":return this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as});case"nullable":return this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as});case"primitive":return this.convertPrimitive({primitive:e.typeReference.value,value:e.value,as:e.as});case"set":return this.convertSet({set:e.typeReference.value,value:e.value});case"unknown":return r.TypeInstantiation.unknown(e.value);default:c(e.typeReference)}}convertLiteral({literalType:e,value:t}){switch(e.type){case"boolean":{let i=this.context.getValueAsBoolean({value:t});return i==null?r.TypeInstantiation.nop():r.TypeInstantiation.bool(i)}case"string":{let i=this.context.getValueAsString({value:t});return i==null?r.TypeInstantiation.nop():r.TypeInstantiation.str(i)}default:c(e)}}convertList({list:e,value:t}){return Array.isArray(t)?r.TypeInstantiation.list(t.map((i,n)=>{this.context.errors.scope({index:n});try{return this.convert({typeReference:e,value:i})}finally{this.context.errors.unscope()}}),{multiline:!0}):(this.context.errors.add({severity:s.Critical,message:`Expected array but got: ${typeof t}`}),r.TypeInstantiation.nop())}convertSet({set:e,value:t}){return Array.isArray(t)?r.TypeInstantiation.set(t.map((i,n)=>{this.context.errors.scope({index:n});try{return this.convert({typeReference:e,value:i})}finally{this.context.errors.unscope()}}),{multiline:!0}):(this.context.errors.add({severity:s.Critical,message:`Expected array but got: ${typeof t}`}),r.TypeInstantiation.nop())}convertMap({map:e,value:t}){return typeof t!="object"||t==null?(this.context.errors.add({severity:s.Critical,message:`Expected object but got: ${t==null?"null":typeof t}`}),r.TypeInstantiation.nop()):r.TypeInstantiation.dict(Object.entries(t).map(([i,n])=>{this.context.errors.scope(i);try{return{key:this.convert({typeReference:e.key,value:i,as:"key"}),value:this.convert({typeReference:e.value,value:n})}}finally{this.context.errors.unscope()}}),{multiline:!0})}convertNamed({named:e,value:t,as:i}){switch(e.type){case"alias":return this.convert({typeReference:e.typeReference,value:t,as:i});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:e,value:t});case"enum":return this.convertEnum({enum_:e,value:t});case"object":return this.convertObject({object_:e,value:t});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t});default:c(e)}}convertDiscriminatedUnion({discriminatedUnion:e,value:t}){let i=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:t});if(i==null)return r.TypeInstantiation.nop();let n=i.singleDiscriminatedUnionType,a=this.convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:i,unionVariant:n});if(a==null)return r.TypeInstantiation.nop();let o={name:this.context.getPropertyName(e.discriminant.name),value:r.TypeInstantiation.str(n.discriminantValue.wireValue)};return r.TypeInstantiation.typedDict([o,...a],{multiline:!0})}convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:e,unionVariant:t}){let i=this.getBaseFields({discriminatedUnionTypeInstance:e,singleDiscriminatedUnionType:t});switch(t.type){case"samePropertiesAsObject":{let n=this.context.resolveNamedType({typeId:t.typeId});if(n==null)return;let a=this.convertNamed({named:n,value:e.value});if(!a.isTypedDict()){this.context.errors.add({severity:s.Critical,message:"Internal error; expected union value to be an object"});return}let o=a.asTypedDictOrThrow();return[...i,...o.entries]}case"singleProperty":try{this.context.errors.scope(t.discriminantValue.wireValue);let n=this.context.getRecord(e.value);return n==null?[...i,{name:d,value:this.convert({typeReference:t.typeReference,value:e.value})}]:[...i,{name:this.context.getPropertyName(t.discriminantValue.name),value:this.convert({typeReference:t.typeReference,value:n[t.discriminantValue.wireValue]})}]}finally{this.context.errors.unscope()}case"noProperties":return i;default:c(t)}}getBaseFields({discriminatedUnionTypeInstance:e,singleDiscriminatedUnionType:t}){var n,a;return this.context.associateByWireValue({parameters:(n=t.properties)!=null?n:[],values:(a=this.context.getRecord(e.value))!=null?a:{},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_:e,value:t}){var n;let i=this.context.associateByWireValue({parameters:e.properties,values:(n=this.context.getRecord(t))!=null?n:{}});return r.TypeInstantiation.typedDict(i.map(a=>{this.context.errors.scope(a.name.wireValue);try{return{name:this.context.getPropertyName(a.name.name),value:this.convert(a)}}finally{this.context.errors.unscope()}}),{multiline:!0})}convertEnum({enum_:e,value:t}){let i=this.getEnumValue({enum_:e,value:t});return i==null?r.TypeInstantiation.nop():r.TypeInstantiation.str(i)}getEnumValue({enum_:e,value:t}){if(typeof t!="string"){this.context.errors.add({severity:s.Critical,message:`Expected enum value string, got: ${typeof t}`});return}if(e.values.find(n=>n.wireValue===t)==null){this.context.errors.add({severity:s.Critical,message:`An enum value named "${t}" does not exist in this context`});return}return t}convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t}){let i=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t});return i==null?r.TypeInstantiation.nop():i}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t}){for(let i of e.types)try{return this.convert({typeReference:i,value:t})}catch(n){continue}this.context.errors.add({severity:s.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof t}" value`})}convertPrimitive({primitive:e,value:t,as:i}){switch(e){case"INTEGER":case"LONG":case"UINT":case"UINT_64":{let n=this.getValueAsNumber({value:t,as:i});return n==null?r.TypeInstantiation.nop():r.TypeInstantiation.int(n)}case"FLOAT":case"DOUBLE":{let n=this.getValueAsNumber({value:t});return n==null?r.TypeInstantiation.nop():r.TypeInstantiation.float(n)}case"BOOLEAN":{let n=this.getValueAsBoolean({value:t,as:i});return n==null?r.TypeInstantiation.nop():r.TypeInstantiation.bool(n)}case"BASE_64":case"BIG_INTEGER":case"STRING":{let n=this.context.getValueAsString({value:t});return n==null?r.TypeInstantiation.nop():r.TypeInstantiation.str(n)}case"UUID":{let n=this.context.getValueAsString({value:t});return n==null?r.TypeInstantiation.nop():r.TypeInstantiation.uuid(n)}case"DATE":{let n=this.context.getValueAsString({value:t});return n==null?r.TypeInstantiation.nop():r.TypeInstantiation.date(n)}case"DATE_TIME":{let n=this.context.getValueAsString({value:t});return n==null?r.TypeInstantiation.nop():r.TypeInstantiation.datetime(n)}default:c(e)}}getValueAsNumber({value:e,as:t}){let i=t==="key"&&typeof e=="string"?Number(e):e;return this.context.getValueAsNumber({value:i})}getValueAsBoolean({value:e,as:t}){let i=t==="key"?typeof e=="string"?e==="true":e==="false"?!1:e:e;return this.context.getValueAsBoolean({value:i})}};export{y as a};
2
+ //# sourceMappingURL=chunk-3LXSVXLG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/context/DynamicTypeLiteralMapper.ts"],"sourcesContent":["import { DiscriminatedUnionTypeInstance, Severity } from \"@fern-api/browser-compatible-base-generator\";\nimport { assertNever } from \"@fern-api/core-utils\";\nimport { FernIr } from \"@fern-api/dynamic-ir-sdk\";\nimport { python } from \"@fern-api/python-ast\";\n\nimport { DynamicSnippetsGeneratorContext } from \"./DynamicSnippetsGeneratorContext\";\n\nconst UNION_VALUE_KEY = \"value\";\n\nexport declare namespace DynamicTypeLiteralMapper {\n interface Args {\n typeReference: FernIr.dynamic.TypeReference;\n value: unknown;\n as?: ConvertedAs;\n }\n\n // Identifies what the type is being converted as, which sometimes influences how\n // the type is instantiated.\n type ConvertedAs = \"key\";\n}\n\nexport class DynamicTypeLiteralMapper {\n private context: DynamicSnippetsGeneratorContext;\n\n constructor({ context }: { context: DynamicSnippetsGeneratorContext }) {\n this.context = context;\n }\n\n public convert(args: DynamicTypeLiteralMapper.Args): python.TypeInstantiation {\n // eslint-disable-next-line eqeqeq\n if (args.value === null) {\n if (this.context.isNullable(args.typeReference)) {\n return python.TypeInstantiation.none();\n }\n this.context.errors.add({\n severity: Severity.Critical,\n message: \"Expected non-null value, but got null\"\n });\n return python.TypeInstantiation.nop();\n }\n if (args.value === undefined) {\n return python.TypeInstantiation.nop();\n }\n switch (args.typeReference.type) {\n case \"list\":\n return this.convertList({ list: args.typeReference.value, value: args.value });\n case \"literal\":\n return this.convertLiteral({ literalType: args.typeReference.value, value: args.value });\n case \"map\":\n return this.convertMap({ map: args.typeReference, value: args.value });\n case \"named\": {\n const named = this.context.resolveNamedType({ typeId: args.typeReference.value });\n if (named == null) {\n return python.TypeInstantiation.nop();\n }\n return this.convertNamed({ named, value: args.value, as: args.as });\n }\n case \"optional\":\n return this.convert({ typeReference: args.typeReference.value, value: args.value, as: args.as });\n case \"nullable\":\n return this.convert({ typeReference: args.typeReference.value, value: args.value, as: args.as });\n case \"primitive\":\n return this.convertPrimitive({ primitive: args.typeReference.value, value: args.value, as: args.as });\n case \"set\":\n return this.convertSet({ set: args.typeReference.value, value: args.value });\n case \"unknown\":\n return python.TypeInstantiation.unknown(args.value);\n default:\n assertNever(args.typeReference);\n }\n }\n\n private convertLiteral({\n literalType,\n value\n }: {\n literalType: FernIr.dynamic.LiteralType;\n value: unknown;\n }): python.TypeInstantiation {\n switch (literalType.type) {\n case \"boolean\": {\n const bool = this.context.getValueAsBoolean({ value });\n if (bool == null) {\n return python.TypeInstantiation.nop();\n }\n return python.TypeInstantiation.bool(bool);\n }\n case \"string\": {\n const str = this.context.getValueAsString({ value });\n if (str == null) {\n return python.TypeInstantiation.nop();\n }\n return python.TypeInstantiation.str(str);\n }\n default:\n assertNever(literalType);\n }\n }\n\n private convertList({\n list,\n value\n }: {\n list: FernIr.dynamic.TypeReference;\n value: unknown;\n }): python.TypeInstantiation {\n if (!Array.isArray(value)) {\n this.context.errors.add({\n severity: Severity.Critical,\n message: `Expected array but got: ${typeof value}`\n });\n return python.TypeInstantiation.nop();\n }\n return python.TypeInstantiation.list(\n value.map((v, index) => {\n this.context.errors.scope({ index });\n try {\n return this.convert({ typeReference: list, value: v });\n } finally {\n this.context.errors.unscope();\n }\n }),\n { multiline: true }\n );\n }\n\n private convertSet({\n set,\n value\n }: {\n set: FernIr.dynamic.TypeReference;\n value: unknown;\n }): python.TypeInstantiation {\n if (!Array.isArray(value)) {\n this.context.errors.add({\n severity: Severity.Critical,\n message: `Expected array but got: ${typeof value}`\n });\n return python.TypeInstantiation.nop();\n }\n return python.TypeInstantiation.set(\n value.map((v, index) => {\n this.context.errors.scope({ index });\n try {\n return this.convert({ typeReference: set, value: v });\n } finally {\n this.context.errors.unscope();\n }\n }),\n { multiline: true }\n );\n }\n\n private convertMap({ map, value }: { map: FernIr.dynamic.MapType; value: unknown }): python.TypeInstantiation {\n if (typeof value !== \"object\" || value == null) {\n this.context.errors.add({\n severity: Severity.Critical,\n message: `Expected object but got: ${value == null ? \"null\" : typeof value}`\n });\n return python.TypeInstantiation.nop();\n }\n return python.TypeInstantiation.dict(\n Object.entries(value).map(([key, value]) => {\n this.context.errors.scope(key);\n try {\n return {\n key: this.convert({ typeReference: map.key, value: key, as: \"key\" }),\n value: this.convert({ typeReference: map.value, value })\n };\n } finally {\n this.context.errors.unscope();\n }\n }),\n { multiline: true }\n );\n }\n\n private convertNamed({\n named,\n value,\n as\n }: {\n named: FernIr.dynamic.NamedType;\n value: unknown;\n as?: DynamicTypeLiteralMapper.ConvertedAs;\n }): python.TypeInstantiation {\n switch (named.type) {\n case \"alias\": {\n return this.convert({ typeReference: named.typeReference, value, as });\n }\n case \"discriminatedUnion\":\n return this.convertDiscriminatedUnion({ discriminatedUnion: named, value });\n case \"enum\":\n return this.convertEnum({ enum_: named, value });\n case \"object\":\n return this.convertObject({ object_: named, value });\n case \"undiscriminatedUnion\":\n return this.convertUndiscriminatedUnion({ undiscriminatedUnion: named, value });\n default:\n assertNever(named);\n }\n }\n\n private convertDiscriminatedUnion({\n discriminatedUnion,\n value\n }: {\n discriminatedUnion: FernIr.dynamic.DiscriminatedUnionType;\n value: unknown;\n }): python.TypeInstantiation {\n const discriminatedUnionTypeInstance = this.context.resolveDiscriminatedUnionTypeInstance({\n discriminatedUnion,\n value\n });\n if (discriminatedUnionTypeInstance == null) {\n return python.TypeInstantiation.nop();\n }\n const unionVariant = discriminatedUnionTypeInstance.singleDiscriminatedUnionType;\n const unionProperties = this.convertDiscriminatedUnionProperties({\n discriminatedUnionTypeInstance,\n unionVariant\n });\n if (unionProperties == null) {\n return python.TypeInstantiation.nop();\n }\n const discriminantProperty = {\n name: this.context.getPropertyName(discriminatedUnion.discriminant.name),\n value: python.TypeInstantiation.str(unionVariant.discriminantValue.wireValue)\n };\n return python.TypeInstantiation.typedDict([discriminantProperty, ...unionProperties], { multiline: true });\n }\n\n private convertDiscriminatedUnionProperties({\n discriminatedUnionTypeInstance,\n unionVariant\n }: {\n discriminatedUnionTypeInstance: DiscriminatedUnionTypeInstance;\n unionVariant: FernIr.dynamic.SingleDiscriminatedUnionType;\n }): python.NamedValue[] | undefined {\n const baseFields = this.getBaseFields({\n discriminatedUnionTypeInstance,\n singleDiscriminatedUnionType: unionVariant\n });\n switch (unionVariant.type) {\n case \"samePropertiesAsObject\": {\n const named = this.context.resolveNamedType({\n typeId: unionVariant.typeId\n });\n if (named == null) {\n return undefined;\n }\n const converted = this.convertNamed({ named, value: discriminatedUnionTypeInstance.value });\n if (!converted.isTypedDict()) {\n this.context.errors.add({\n severity: Severity.Critical,\n message: \"Internal error; expected union value to be an object\"\n });\n return undefined;\n }\n const typedDict = converted.asTypedDictOrThrow();\n return [...baseFields, ...typedDict.entries];\n }\n case \"singleProperty\": {\n try {\n this.context.errors.scope(unionVariant.discriminantValue.wireValue);\n const record = this.context.getRecord(discriminatedUnionTypeInstance.value);\n if (record == null) {\n return [\n ...baseFields,\n {\n name: UNION_VALUE_KEY,\n value: this.convert({\n typeReference: unionVariant.typeReference,\n value: discriminatedUnionTypeInstance.value\n })\n }\n ];\n }\n return [\n ...baseFields,\n {\n name: this.context.getPropertyName(unionVariant.discriminantValue.name),\n value: this.convert({\n typeReference: unionVariant.typeReference,\n value: record[unionVariant.discriminantValue.wireValue]\n })\n }\n ];\n } finally {\n this.context.errors.unscope();\n }\n }\n case \"noProperties\":\n return baseFields;\n default:\n assertNever(unionVariant);\n }\n }\n\n private getBaseFields({\n discriminatedUnionTypeInstance,\n singleDiscriminatedUnionType\n }: {\n discriminatedUnionTypeInstance: DiscriminatedUnionTypeInstance;\n singleDiscriminatedUnionType: FernIr.dynamic.SingleDiscriminatedUnionType;\n }): python.NamedValue[] {\n const properties = this.context.associateByWireValue({\n parameters: singleDiscriminatedUnionType.properties ?? [],\n values: this.context.getRecord(discriminatedUnionTypeInstance.value) ?? {},\n\n // We're only selecting the base properties here. The rest of the properties\n // are handled by the union variant.\n ignoreMissingParameters: true\n });\n return properties.map((property) => {\n this.context.errors.scope(property.name.wireValue);\n try {\n return {\n name: this.context.getPropertyName(property.name.name),\n value: this.convert(property)\n };\n } finally {\n this.context.errors.unscope();\n }\n });\n }\n\n private convertObject({\n object_,\n value\n }: {\n object_: FernIr.dynamic.ObjectType;\n value: unknown;\n }): python.TypeInstantiation {\n const properties = this.context.associateByWireValue({\n parameters: object_.properties,\n values: this.context.getRecord(value) ?? {}\n });\n return python.TypeInstantiation.typedDict(\n properties.map((property) => {\n this.context.errors.scope(property.name.wireValue);\n try {\n return {\n name: this.context.getPropertyName(property.name.name),\n value: this.convert(property)\n };\n } finally {\n this.context.errors.unscope();\n }\n }),\n { multiline: true }\n );\n }\n\n private convertEnum({\n enum_,\n value\n }: {\n enum_: FernIr.dynamic.EnumType;\n value: unknown;\n }): python.TypeInstantiation {\n const enumValue = this.getEnumValue({ enum_, value });\n if (enumValue == null) {\n return python.TypeInstantiation.nop();\n }\n return python.TypeInstantiation.str(enumValue);\n }\n\n private getEnumValue({ enum_, value }: { enum_: FernIr.dynamic.EnumType; value: unknown }): string | undefined {\n if (typeof value !== \"string\") {\n this.context.errors.add({\n severity: Severity.Critical,\n message: `Expected enum value string, got: ${typeof value}`\n });\n return undefined;\n }\n const enumValue = enum_.values.find((v) => v.wireValue === value);\n if (enumValue == null) {\n this.context.errors.add({\n severity: Severity.Critical,\n message: `An enum value named \"${value}\" does not exist in this context`\n });\n return undefined;\n }\n return value;\n }\n\n private convertUndiscriminatedUnion({\n undiscriminatedUnion,\n value\n }: {\n undiscriminatedUnion: FernIr.dynamic.UndiscriminatedUnionType;\n value: unknown;\n }): python.TypeInstantiation {\n const result = this.findMatchingUndiscriminatedUnionType({\n undiscriminatedUnion,\n value\n });\n if (result == null) {\n return python.TypeInstantiation.nop();\n }\n return result;\n }\n\n private findMatchingUndiscriminatedUnionType({\n undiscriminatedUnion,\n value\n }: {\n undiscriminatedUnion: FernIr.dynamic.UndiscriminatedUnionType;\n value: unknown;\n }): python.TypeInstantiation | undefined {\n for (const typeReference of undiscriminatedUnion.types) {\n try {\n return this.convert({ typeReference, value });\n } catch (e) {\n continue;\n }\n }\n this.context.errors.add({\n severity: Severity.Critical,\n message: `None of the types in the undiscriminated union matched the given \"${typeof value}\" value`\n });\n return undefined;\n }\n\n private convertPrimitive({\n primitive,\n value,\n as\n }: {\n primitive: FernIr.PrimitiveTypeV1;\n value: unknown;\n as?: DynamicTypeLiteralMapper.ConvertedAs;\n }): python.TypeInstantiation {\n switch (primitive) {\n case \"INTEGER\":\n case \"LONG\":\n case \"UINT\":\n case \"UINT_64\": {\n const num = this.getValueAsNumber({ value, as });\n if (num == null) {\n return python.TypeInstantiation.nop();\n }\n return python.TypeInstantiation.int(num);\n }\n case \"FLOAT\":\n case \"DOUBLE\": {\n const num = this.getValueAsNumber({ value });\n if (num == null) {\n return python.TypeInstantiation.nop();\n }\n return python.TypeInstantiation.float(num);\n }\n case \"BOOLEAN\": {\n const bool = this.getValueAsBoolean({ value, as });\n if (bool == null) {\n return python.TypeInstantiation.nop();\n }\n return python.TypeInstantiation.bool(bool);\n }\n case \"BASE_64\":\n case \"BIG_INTEGER\":\n case \"STRING\": {\n const str = this.context.getValueAsString({ value });\n if (str == null) {\n return python.TypeInstantiation.nop();\n }\n return python.TypeInstantiation.str(str);\n }\n case \"UUID\": {\n const str = this.context.getValueAsString({ value });\n if (str == null) {\n return python.TypeInstantiation.nop();\n }\n return python.TypeInstantiation.uuid(str);\n }\n case \"DATE\": {\n const str = this.context.getValueAsString({ value });\n if (str == null) {\n return python.TypeInstantiation.nop();\n }\n return python.TypeInstantiation.date(str);\n }\n case \"DATE_TIME\": {\n const str = this.context.getValueAsString({ value });\n if (str == null) {\n return python.TypeInstantiation.nop();\n }\n return python.TypeInstantiation.datetime(str);\n }\n default:\n assertNever(primitive);\n }\n }\n\n private getValueAsNumber({\n value,\n as\n }: {\n value: unknown;\n as?: DynamicTypeLiteralMapper.ConvertedAs;\n }): number | undefined {\n const num = as === \"key\" ? (typeof value === \"string\" ? Number(value) : value) : value;\n return this.context.getValueAsNumber({ value: num });\n }\n\n private getValueAsBoolean({\n value,\n as\n }: {\n value: unknown;\n as?: DynamicTypeLiteralMapper.ConvertedAs;\n }): boolean | undefined {\n const bool =\n as === \"key\" ? (typeof value === \"string\" ? value === \"true\" : value === \"false\" ? false : value) : value;\n return this.context.getValueAsBoolean({ value: bool });\n }\n}\n"],"mappings":"4GAAAA,IAAAC,IAOA,IAAMC,EAAkB,QAcXC,EAAN,KAA+B,CAGlC,YAAY,CAAE,QAAAC,CAAQ,EAAiD,CAFvEC,EAAA,KAAQ,WAGJ,KAAK,QAAUD,CACnB,CAEO,QAAQE,EAA+D,CAE1E,GAAIA,EAAK,QAAU,KACf,OAAI,KAAK,QAAQ,WAAWA,EAAK,aAAa,EACnCC,EAAO,kBAAkB,KAAK,GAEzC,KAAK,QAAQ,OAAO,IAAI,CACpB,SAAUC,EAAS,SACnB,QAAS,uCACb,CAAC,EACMD,EAAO,kBAAkB,IAAI,GAExC,GAAID,EAAK,QAAU,OACf,OAAOC,EAAO,kBAAkB,IAAI,EAExC,OAAQD,EAAK,cAAc,KAAM,CAC7B,IAAK,OACD,OAAO,KAAK,YAAY,CAAE,KAAMA,EAAK,cAAc,MAAO,MAAOA,EAAK,KAAM,CAAC,EACjF,IAAK,UACD,OAAO,KAAK,eAAe,CAAE,YAAaA,EAAK,cAAc,MAAO,MAAOA,EAAK,KAAM,CAAC,EAC3F,IAAK,MACD,OAAO,KAAK,WAAW,CAAE,IAAKA,EAAK,cAAe,MAAOA,EAAK,KAAM,CAAC,EACzE,IAAK,QAAS,CACV,IAAMG,EAAQ,KAAK,QAAQ,iBAAiB,CAAE,OAAQH,EAAK,cAAc,KAAM,CAAC,EAChF,OAAIG,GAAS,KACFF,EAAO,kBAAkB,IAAI,EAEjC,KAAK,aAAa,CAAE,MAAAE,E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W,OAAOA,CAAK,EAAaA,EACjF,OAAO,KAAK,QAAQ,iBAAiB,CAAE,MAAOgC,CAAI,CAAC,CACvD,CAEQ,kBAAkB,CACtB,MAAAhC,EACA,GAAAS,CACJ,EAGwB,CACpB,IAAMR,EACFQ,IAAO,MAAS,OAAOT,GAAU,SAAWA,IAAU,OAASA,IAAU,QAAU,GAAQA,EAASA,EACxG,OAAO,KAAK,QAAQ,kBAAkB,CAAE,MAAOC,CAAK,CAAC,CACzD,CACJ","names":["init_process","init_buffer","UNION_VALUE_KEY","DynamicTypeLiteralMapper","context","__publicField","args","python_exports","Severity","named","assertNever","literalType","value","bool","str","list","v","index","set","map","key","as","discriminatedUnion","discriminatedUnionTypeInstance","unionVariant","unionProperties","discriminantProperty","baseFields","converted","typedDict","record","singleDiscriminatedUnionType","_a","_b","property","object_","properties","enum_","enumValue","undiscriminatedUnion","result","typeReference","e","primitive","num"]}
@@ -0,0 +1,28 @@
1
+ var at=Object.create;var ue=Object.defineProperty,ft=Object.defineProperties,ht=Object.getOwnPropertyDescriptor,ct=Object.getOwnPropertyDescriptors,ut=Object.getOwnPropertyNames,me=Object.getOwnPropertySymbols,lt=Object.getPrototypeOf,Ne=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable;var ve=(i,t,e)=>t in i?ue(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ce=(i,t)=>{for(var e in t||(t={}))Ne.call(t,e)&&ve(i,e,t[e]);if(me)for(var e of me(t))Pe.call(t,e)&&ve(i,e,t[e]);return i},Yr=(i,t)=>ft(i,ct(t));var Fr=i=>typeof i=="symbol"?i:i+"",_e=(i,t)=>{var e={};for(var r in i)Ne.call(i,r)&&t.indexOf(r)<0&&(e[r]=i[r]);if(i!=null&&me)for(var r of me(i))t.indexOf(r)<0&&Pe.call(i,r)&&(e[r]=i[r]);return e};var Ie=(i,t)=>()=>(i&&(t=i(i=0)),t);var Wr=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),pt=(i,t)=>{for(var e in t)ue(i,e,{get:t[e],enumerable:!0})},Be=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ut(t))!Ne.call(i,n)&&n!==e&&ue(i,n,{get:()=>t[n],enumerable:!(r=ht(t,n))||r.enumerable});return i};var $r=(i,t,e)=>(e=i!=null?at(lt(i)):{},Be(t||!i||!i.__esModule?ue(e,"default",{value:i,enumerable:!0}):e,i)),Qr=i=>Be(ue({},"__esModule",{value:!0}),i);var h=(i,t,e)=>ve(i,typeof t!="symbol"?t+"":t,e);function De(){throw new Error("setTimeout has not been defined")}function Oe(){throw new Error("clearTimeout has not been defined")}function Ye(i){if(O===setTimeout)return setTimeout(i,0);if((O===De||!O)&&setTimeout)return O=setTimeout,setTimeout(i,0);try{return O(i,0)}catch(t){try{return O.call(null,i,0)}catch(e){return O.call(this,i,0)}}}function mt(i){if(Y===clearTimeout)return clearTimeout(i);if((Y===Oe||!Y)&&clearTimeout)return Y=clearTimeout,clearTimeout(i);try{return Y(i)}catch(t){try{return Y.call(null,i)}catch(e){return Y.call(this,i)}}}function dt(){!X||!V||(X=!1,V.length?B=V.concat(B):de=-1,B.length&&Fe())}function Fe(){if(!X){var i=Ye(dt);X=!0;for(var t=B.length;t;){for(V=B,B=[];++de<t;)V&&V[de].run();de=-1,t=B.length}V=null,X=!1,mt(i)}}function wt(i){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];B.push(new We(i,t)),B.length===1&&!X&&Ye(Fe)}function We(i,t){this.fun=i,this.array=t}function Z(){}function Ct(i){throw new Error("process.binding is not supported")}function _t(){return"/"}function Bt(i){throw new Error("process.chdir is not supported")}function Mt(){return 0}function Ot(i){var t=Dt.call(K)*.001,e=Math.floor(t),r=Math.floor(t%1*1e9);return i&&(e=e-i[0],r=r-i[1],r<0&&(e--,r+=1e9)),[e,r]}function Ft(){var i=new Date,t=i-Yt;return t/1e3}var O,Y,B,X,V,de,xt,yt,gt,Tt,Et,At,Rt,vt,Nt,It,Lt,St,kt,bt,Ut,Pt,K,Dt,Yt,y,Me,u=Ie(()=>{"use strict";O=De,Y=Oe;typeof globalThis.setTimeout=="function"&&(O=setTimeout);typeof globalThis.clearTimeout=="function"&&(Y=clearTimeout);B=[],X=!1,de=-1;We.prototype.run=function(){this.fun.apply(null,this.array)};xt="browser",yt="browser",gt=!0,Tt={},Et=[],At="",Rt={},vt={},Nt={};It=Z,Lt=Z,St=Z,kt=Z,bt=Z,Ut=Z,Pt=Z;K=globalThis.performance||{},Dt=K.now||K.mozNow||K.msNow||K.oNow||K.webkitNow||function(){return new Date().getTime()};Yt=new Date;y={nextTick:wt,title:xt,browser:gt,env:Tt,argv:Et,version:At,versions:Rt,on:It,addListener:Lt,once:St,off:kt,removeListener:bt,removeAllListeners:Ut,emit:Pt,binding:Ct,cwd:_t,chdir:Bt,umask:Mt,hrtime:Ot,platform:yt,release:vt,config:Nt,uptime:Ft},Me={};Object.keys(Me).forEach(i=>{let t=i.split("."),e=y;for(let r=0;r<t.length;r++){let n=t[r];r===t.length-1?e[n]=Me[i]:e=e[n]||(e[n]={})}})});function je(){Se=!0;for(var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=i.length;t<e;++t)P[t]=i[t],S[i.charCodeAt(t)]=t;S[45]=62,S[95]=63}function $t(i){Se||je();var t,e,r,n,s,o,f=i.length;if(f%4>0)throw new Error("Invalid string. Length must be a multiple of 4");s=i[f-2]==="="?2:i[f-1]==="="?1:0,o=new Wt(f*3/4-s),r=s>0?f-4:f;var c=0;for(t=0,e=0;t<r;t+=4,e+=3)n=S[i.charCodeAt(t)]<<18|S[i.charCodeAt(t+1)]<<12|S[i.charCodeAt(t+2)]<<6|S[i.charCodeAt(t+3)],o[c++]=n>>16&255,o[c++]=n>>8&255,o[c++]=n&255;return s===2?(n=S[i.charCodeAt(t)]<<2|S[i.charCodeAt(t+1)]>>4,o[c++]=n&255):s===1&&(n=S[i.charCodeAt(t)]<<10|S[i.charCodeAt(t+1)]<<4|S[i.charCodeAt(t+2)]>>2,o[c++]=n>>8&255,o[c++]=n&255),o}function Qt(i){return P[i>>18&63]+P[i>>12&63]+P[i>>6&63]+P[i&63]}function zt(i,t,e){for(var r,n=[],s=t;s<e;s+=3)r=(i[s]<<16)+(i[s+1]<<8)+i[s+2],n.push(Qt(r));return n.join("")}function $e(i){Se||je();for(var t,e=i.length,r=e%3,n="",s=[],o=16383,f=0,c=e-r;f<c;f+=o)s.push(zt(i,f,f+o>c?c:f+o));return r===1?(t=i[e-1],n+=P[t>>2],n+=P[t<<4&63],n+="=="):r===2&&(t=(i[e-2]<<8)+i[e-1],n+=P[t>>10],n+=P[t>>4&63],n+=P[t<<2&63],n+="="),s.push(n),s.join("")}function we(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function M(i,t){if(we()<t)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(i=new Uint8Array(t),i.__proto__=a.prototype):(i===null&&(i=new a(t)),i.length=t),i}function a(i,t,e){if(!a.TYPED_ARRAY_SUPPORT&&!(this instanceof a))return new a(i,t,e);if(typeof i=="number"){if(typeof t=="string")throw new Error("If encoding is specified then the first argument must be a string");return ke(this,i)}return Ve(this,i,t,e)}function Ve(i,t,e,r){if(typeof t=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer!="undefined"&&t instanceof ArrayBuffer?Zt(i,t,e,r):typeof t=="string"?Vt(i,t,e):Jt(i,t)}function Ze(i){if(typeof i!="number")throw new TypeError('"size" argument must be a number');if(i<0)throw new RangeError('"size" argument must not be negative')}function jt(i,t,e,r){return Ze(t),t<=0?M(i,t):e!==void 0?typeof r=="string"?M(i,t).fill(e,r):M(i,t).fill(e):M(i,t)}function ke(i,t){if(Ze(t),i=M(i,t<0?0:be(t)|0),!a.TYPED_ARRAY_SUPPORT)for(var e=0;e<t;++e)i[e]=0;return i}function Vt(i,t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!a.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=Je(t,e)|0;i=M(i,r);var n=i.write(t,e);return n!==r&&(i=i.slice(0,n)),i}function Le(i,t){var e=t.length<0?0:be(t.length)|0;i=M(i,e);for(var r=0;r<e;r+=1)i[r]=t[r]&255;return i}function Zt(i,t,e,r){if(t.byteLength,e<0||t.byteLength<e)throw new RangeError("'offset' is out of bounds");if(t.byteLength<e+(r||0))throw new RangeError("'length' is out of bounds");return e===void 0&&r===void 0?t=new Uint8Array(t):r===void 0?t=new Uint8Array(t,e):t=new Uint8Array(t,e,r),a.TYPED_ARRAY_SUPPORT?(i=t,i.__proto__=a.prototype):i=Le(i,t),i}function Jt(i,t){if(C(t)){var e=be(t.length)|0;return i=M(i,e),i.length===0||t.copy(i,0,0,e),i}if(t){if(typeof ArrayBuffer!="undefined"&&t.buffer instanceof ArrayBuffer||"length"in t)return typeof t.length!="number"||pr(t.length)?M(i,0):Le(i,t);if(t.type==="Buffer"&&Array.isArray(t.data))return Le(i,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function be(i){if(i>=we())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+we().toString(16)+" bytes");return i|0}function C(i){return!!(i!=null&&i._isBuffer)}function Je(i,t){if(C(i))return i.length;if(typeof ArrayBuffer!="undefined"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(i)||i instanceof ArrayBuffer))return i.byteLength;typeof i!="string"&&(i=""+i);var e=i.length;if(e===0)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return xe(i).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return tt(i).length;default:if(r)return xe(i).length;t=(""+t).toLowerCase(),r=!0}}function Ht(i,t,e){var r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,t>>>=0,e<=t))return"";for(i||(i="utf8");;)switch(i){case"hex":return sr(this,t,e);case"utf8":case"utf-8":return Ke(this,t,e);case"ascii":return ir(this,t,e);case"latin1":case"binary":return nr(this,t,e);case"base64":return tr(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return or(this,t,e);default:if(r)throw new TypeError("Unknown encoding: "+i);i=(i+"").toLowerCase(),r=!0}}function J(i,t,e){var r=i[t];i[t]=i[e],i[e]=r}function He(i,t,e,r,n){if(i.length===0)return-1;if(typeof e=="string"?(r=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=n?0:i.length-1),e<0&&(e=i.length+e),e>=i.length){if(n)return-1;e=i.length-1}else if(e<0)if(n)e=0;else return-1;if(typeof t=="string"&&(t=a.from(t,r)),C(t))return t.length===0?-1:Qe(i,t,e,r,n);if(typeof t=="number")return t=t&255,a.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(i,t,e):Uint8Array.prototype.lastIndexOf.call(i,t,e):Qe(i,[t],e,r,n);throw new TypeError("val must be string, number or Buffer")}function Qe(i,t,e,r,n){var s=1,o=i.length,f=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(i.length<2||t.length<2)return-1;s=2,o/=2,f/=2,e/=2}function c(g,w){return s===1?g[w]:g.readUInt16BE(w*s)}var m;if(n){var p=-1;for(m=e;m<o;m++)if(c(i,m)===c(t,p===-1?0:m-p)){if(p===-1&&(p=m),m-p+1===f)return p*s}else p!==-1&&(m-=m-p),p=-1}else for(e+f>o&&(e=o-f),m=e;m>=0;m--){for(var d=!0,A=0;A<f;A++)if(c(i,m+A)!==c(t,A)){d=!1;break}if(d)return m}return-1}function Gt(i,t,e,r){e=Number(e)||0;var n=i.length-e;r?(r=Number(r),r>n&&(r=n)):r=n;var s=t.length;if(s%2!==0)throw new TypeError("Invalid hex string");r>s/2&&(r=s/2);for(var o=0;o<r;++o){var f=parseInt(t.substr(o*2,2),16);if(isNaN(f))return o;i[e+o]=f}return o}function Kt(i,t,e,r){return Te(xe(t,i.length-e),i,e,r)}function Ge(i,t,e,r){return Te(ur(t),i,e,r)}function Xt(i,t,e,r){return Ge(i,t,e,r)}function qt(i,t,e,r){return Te(tt(t),i,e,r)}function er(i,t,e,r){return Te(lr(t,i.length-e),i,e,r)}function tr(i,t,e){return t===0&&e===i.length?$e(i):$e(i.slice(t,e))}function Ke(i,t,e){e=Math.min(i.length,e);for(var r=[],n=t;n<e;){var s=i[n],o=null,f=s>239?4:s>223?3:s>191?2:1;if(n+f<=e){var c,m,p,d;switch(f){case 1:s<128&&(o=s);break;case 2:c=i[n+1],(c&192)===128&&(d=(s&31)<<6|c&63,d>127&&(o=d));break;case 3:c=i[n+1],m=i[n+2],(c&192)===128&&(m&192)===128&&(d=(s&15)<<12|(c&63)<<6|m&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:c=i[n+1],m=i[n+2],p=i[n+3],(c&192)===128&&(m&192)===128&&(p&192)===128&&(d=(s&15)<<18|(c&63)<<12|(m&63)<<6|p&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,f=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|o&1023),r.push(o),n+=f}return rr(r)}function rr(i){var t=i.length;if(t<=ze)return String.fromCharCode.apply(String,i);for(var e="",r=0;r<t;)e+=String.fromCharCode.apply(String,i.slice(r,r+=ze));return e}function ir(i,t,e){var r="";e=Math.min(i.length,e);for(var n=t;n<e;++n)r+=String.fromCharCode(i[n]&127);return r}function nr(i,t,e){var r="";e=Math.min(i.length,e);for(var n=t;n<e;++n)r+=String.fromCharCode(i[n]);return r}function sr(i,t,e){var r=i.length;(!t||t<0)&&(t=0),(!e||e<0||e>r)&&(e=r);for(var n="",s=t;s<e;++s)n+=cr(i[s]);return n}function or(i,t,e){for(var r=i.slice(t,e),n="",s=0;s<r.length;s+=2)n+=String.fromCharCode(r[s]+r[s+1]*256);return n}function R(i,t,e){if(i%1!==0||i<0)throw new RangeError("offset is not uint");if(i+t>e)throw new RangeError("Trying to access beyond buffer length")}function L(i,t,e,r,n,s){if(!C(i))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<s)throw new RangeError('"value" argument is out of bounds');if(e+r>i.length)throw new RangeError("Index out of range")}function ye(i,t,e,r){t<0&&(t=65535+t+1);for(var n=0,s=Math.min(i.length-e,2);n<s;++n)i[e+n]=(t&255<<8*(r?n:1-n))>>>(r?n:1-n)*8}function ge(i,t,e,r){t<0&&(t=4294967295+t+1);for(var n=0,s=Math.min(i.length-e,4);n<s;++n)i[e+n]=t>>>(r?n:3-n)*8&255}function Xe(i,t,e,r,n,s){if(e+r>i.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function qe(i,t,e,r,n){return n||Xe(i,t,e,4,34028234663852886e22,-34028234663852886e22),it(i,t,e,r,23,4),e+4}function et(i,t,e,r,n){return n||Xe(i,t,e,8,17976931348623157e292,-17976931348623157e292),it(i,t,e,r,52,8),e+8}function fr(i){if(i=hr(i).replace(ar,""),i.length<2)return"";for(;i.length%4!==0;)i=i+"=";return i}function hr(i){return i.trim?i.trim():i.replace(/^\s+|\s+$/g,"")}function cr(i){return i<16?"0"+i.toString(16):i.toString(16)}function xe(i,t){t=t||1/0;for(var e,r=i.length,n=null,s=[],o=0;o<r;++o){if(e=i.charCodeAt(o),e>55295&&e<57344){if(!n){if(e>56319){(t-=3)>-1&&s.push(239,191,189);continue}else if(o+1===r){(t-=3)>-1&&s.push(239,191,189);continue}n=e;continue}if(e<56320){(t-=3)>-1&&s.push(239,191,189),n=e;continue}e=(n-55296<<10|e-56320)+65536}else n&&(t-=3)>-1&&s.push(239,191,189);if(n=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 ur(i){for(var t=[],e=0;e<i.length;++e)t.push(i.charCodeAt(e)&255);return t}function lr(i,t){for(var e,r,n,s=[],o=0;o<i.length&&!((t-=2)<0);++o)e=i.charCodeAt(o),r=e>>8,n=e%256,s.push(n),s.push(r);return s}function tt(i){return $t(fr(i))}function Te(i,t,e,r){for(var n=0;n<r&&!(n+e>=t.length||n>=i.length);++n)t[n+e]=i[n];return n}function pr(i){return i!==i}function mr(i){return i!=null&&(!!i._isBuffer||rt(i)||dr(i))}function rt(i){return!!i.constructor&&typeof i.constructor.isBuffer=="function"&&i.constructor.isBuffer(i)}function dr(i){return typeof i.readFloatLE=="function"&&typeof i.slice=="function"&&rt(i.slice(0,0))}function Ee(i,t,e,r,n){var s,o,f=n*8-r-1,c=(1<<f)-1,m=c>>1,p=-7,d=e?n-1:0,A=e?-1:1,g=i[t+d];for(d+=A,s=g&(1<<-p)-1,g>>=-p,p+=f;p>0;s=s*256+i[t+d],d+=A,p-=8);for(o=s&(1<<-p)-1,s>>=-p,p+=r;p>0;o=o*256+i[t+d],d+=A,p-=8);if(s===0)s=1-m;else{if(s===c)return o?NaN:(g?-1:1)*(1/0);o=o+Math.pow(2,r),s=s-m}return(g?-1:1)*o*Math.pow(2,s-r)}function it(i,t,e,r,n,s){var o,f,c,m=s*8-n-1,p=(1<<m)-1,d=p>>1,A=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=r?0:s-1,w=r?1:-1,T=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=p):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+d>=1?t+=A/c:t+=A*Math.pow(2,1-d),t*c>=2&&(o++,c/=2),o+d>=p?(f=0,o=p):o+d>=1?(f=(t*c-1)*Math.pow(2,n),o=o+d):(f=t*Math.pow(2,d-1)*Math.pow(2,n),o=0));n>=8;i[e+g]=f&255,g+=w,f/=256,n-=8);for(o=o<<n|f,m+=n;m>0;i[e+g]=o&255,g+=w,o/=256,m-=8);i[e+g-w]|=T*128}var P,S,Wt,Se,ze,ar,nt=Ie(()=>{"use strict";u();l();P=[],S=[],Wt=typeof Uint8Array!="undefined"?Uint8Array:Array,Se=!1;a.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;a.poolSize=8192;a._augment=function(i){return i.__proto__=a.prototype,i};a.from=function(i,t,e){return Ve(null,i,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(i,t,e){return jt(null,i,t,e)};a.allocUnsafe=function(i){return ke(null,i)};a.allocUnsafeSlow=function(i){return ke(null,i)};a.isBuffer=mr;a.compare=function(t,e){if(!C(t)||!C(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,s=0,o=Math.min(r,n);s<o;++s)if(t[s]!==e[s]){r=t[s],n=e[s];break}return r<n?-1:n<r?1:0};a.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};a.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return a.alloc(0);var r;if(e===void 0)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=a.allocUnsafe(e),s=0;for(r=0;r<t.length;++r){var o=t[r];if(!C(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,s),s+=o.length}return n};a.byteLength=Je;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)J(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)J(this,e,e+3),J(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)J(this,e,e+7),J(this,e+1,e+6),J(this,e+2,e+5),J(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):Ht.apply(this,arguments)};a.prototype.equals=function(t){if(!C(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:a.compare(this,t)===0};a.prototype.compare=function(t,e,r,n,s){if(!C(t))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),r===void 0&&(r=t?t.length:0),n===void 0&&(n=0),s===void 0&&(s=this.length),e<0||r>t.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&e>=r)return 0;if(n>=s)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,s>>>=0,this===t)return 0;for(var o=s-n,f=r-e,c=Math.min(o,f),m=this.slice(n,s),p=t.slice(e,r),d=0;d<c;++d)if(m[d]!==p[d]){o=m[d],f=p[d];break}return o<f?-1:f<o?1:0};a.prototype.includes=function(t,e,r){return this.indexOf(t,e,r)!==-1};a.prototype.indexOf=function(t,e,r){return He(this,t,e,r,!0)};a.prototype.lastIndexOf=function(t,e,r){return He(this,t,e,r,!1)};a.prototype.write=function(t,e,r,n){if(e===void 0)n="utf8",r=this.length,e=0;else if(r===void 0&&typeof e=="string")n=e,r=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(r)?(r=r|0,n===void 0&&(n="utf8")):(n=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-e;if((r===void 0||r>s)&&(r=s),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return Gt(this,t,e,r);case"utf8":case"utf-8":return Kt(this,t,e,r);case"ascii":return Ge(this,t,e,r);case"latin1":case"binary":return Xt(this,t,e,r);case"base64":return qt(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return er(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).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 r=this.length;t=~~t,e=e===void 0?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e<t&&(e=t);var n;if(a.TYPED_ARRAY_SUPPORT)n=this.subarray(t,e),n.__proto__=a.prototype;else{var s=e-t;n=new a(s,void 0);for(var o=0;o<s;++o)n[o]=this[o+t]}return n};a.prototype.readUIntLE=function(t,e,r){t=t|0,e=e|0,r||R(t,e,this.length);for(var n=this[t],s=1,o=0;++o<e&&(s*=256);)n+=this[t+o]*s;return n};a.prototype.readUIntBE=function(t,e,r){t=t|0,e=e|0,r||R(t,e,this.length);for(var n=this[t+--e],s=1;e>0&&(s*=256);)n+=this[t+--e]*s;return n};a.prototype.readUInt8=function(t,e){return e||R(t,1,this.length),this[t]};a.prototype.readUInt16LE=function(t,e){return e||R(t,2,this.length),this[t]|this[t+1]<<8};a.prototype.readUInt16BE=function(t,e){return e||R(t,2,this.length),this[t]<<8|this[t+1]};a.prototype.readUInt32LE=function(t,e){return e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};a.prototype.readUInt32BE=function(t,e){return e||R(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};a.prototype.readIntLE=function(t,e,r){t=t|0,e=e|0,r||R(t,e,this.length);for(var n=this[t],s=1,o=0;++o<e&&(s*=256);)n+=this[t+o]*s;return s*=128,n>=s&&(n-=Math.pow(2,8*e)),n};a.prototype.readIntBE=function(t,e,r){t=t|0,e=e|0,r||R(t,e,this.length);for(var n=e,s=1,o=this[t+--n];n>0&&(s*=256);)o+=this[t+--n]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*e)),o};a.prototype.readInt8=function(t,e){return e||R(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};a.prototype.readInt16LE=function(t,e){e||R(t,2,this.length);var r=this[t]|this[t+1]<<8;return r&32768?r|4294901760:r};a.prototype.readInt16BE=function(t,e){e||R(t,2,this.length);var r=this[t+1]|this[t]<<8;return r&32768?r|4294901760:r};a.prototype.readInt32LE=function(t,e){return e||R(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||R(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||R(t,4,this.length),Ee(this,t,!0,23,4)};a.prototype.readFloatBE=function(t,e){return e||R(t,4,this.length),Ee(this,t,!1,23,4)};a.prototype.readDoubleLE=function(t,e){return e||R(t,8,this.length),Ee(this,t,!0,52,8)};a.prototype.readDoubleBE=function(t,e){return e||R(t,8,this.length),Ee(this,t,!1,52,8)};a.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e=e|0,r=r|0,!n){var s=Math.pow(2,8*r)-1;L(this,t,e,r,s,0)}var o=1,f=0;for(this[e]=t&255;++f<r&&(o*=256);)this[e+f]=t/o&255;return e+r};a.prototype.writeUIntBE=function(t,e,r,n){if(t=+t,e=e|0,r=r|0,!n){var s=Math.pow(2,8*r)-1;L(this,t,e,r,s,0)}var o=r-1,f=1;for(this[e+o]=t&255;--o>=0&&(f*=256);)this[e+o]=t/f&255;return e+r};a.prototype.writeUInt8=function(t,e,r){return t=+t,e=e|0,r||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,r){return t=+t,e=e|0,r||L(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):ye(this,t,e,!0),e+2};a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=e|0,r||L(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):ye(this,t,e,!1),e+2};a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=e|0,r||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):ge(this,t,e,!0),e+4};a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=e|0,r||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):ge(this,t,e,!1),e+4};a.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e=e|0,!n){var s=Math.pow(2,8*r-1);L(this,t,e,r,s-1,-s)}var o=0,f=1,c=0;for(this[e]=t&255;++o<r&&(f*=256);)t<0&&c===0&&this[e+o-1]!==0&&(c=1),this[e+o]=(t/f>>0)-c&255;return e+r};a.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e=e|0,!n){var s=Math.pow(2,8*r-1);L(this,t,e,r,s-1,-s)}var o=r-1,f=1,c=0;for(this[e+o]=t&255;--o>=0&&(f*=256);)t<0&&c===0&&this[e+o+1]!==0&&(c=1),this[e+o]=(t/f>>0)-c&255;return e+r};a.prototype.writeInt8=function(t,e,r){return t=+t,e=e|0,r||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,r){return t=+t,e=e|0,r||L(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):ye(this,t,e,!0),e+2};a.prototype.writeInt16BE=function(t,e,r){return t=+t,e=e|0,r||L(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):ye(this,t,e,!1),e+2};a.prototype.writeInt32LE=function(t,e,r){return t=+t,e=e|0,r||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):ge(this,t,e,!0),e+4};a.prototype.writeInt32BE=function(t,e,r){return t=+t,e=e|0,r||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):ge(this,t,e,!1),e+4};a.prototype.writeFloatLE=function(t,e,r){return qe(this,t,e,!0,r)};a.prototype.writeFloatBE=function(t,e,r){return qe(this,t,e,!1,r)};a.prototype.writeDoubleLE=function(t,e,r){return et(this,t,e,!0,r)};a.prototype.writeDoubleBE=function(t,e,r){return et(this,t,e,!1,r)};a.prototype.copy=function(t,e,r,n){if(r||(r=0),!n&&n!==0&&(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var s=n-r,o;if(this===t&&r<e&&e<n)for(o=s-1;o>=0;--o)t[o+e]=this[o+r];else if(s<1e3||!a.TYPED_ARRAY_SUPPORT)for(o=0;o<s;++o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+s),e);return s};a.prototype.fill=function(t,e,r,n){if(typeof t=="string"){if(typeof e=="string"?(n=e,e=0,r=this.length):typeof r=="string"&&(n=r,r=this.length),t.length===1){var s=t.charCodeAt(0);s<256&&(t=s)}if(n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!a.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else typeof t=="number"&&(t=t&255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;e=e>>>0,r=r===void 0?this.length:r>>>0,t||(t=0);var o;if(typeof t=="number")for(o=e;o<r;++o)this[o]=t;else{var f=C(t)?t:xe(new a(t,n).toString()),c=f.length;for(o=0;o<r-e;++o)this[o+e]=f[o%c]}return this};ar=/[^+\/0-9A-Za-z-_]/g});var l=Ie(()=>{"use strict";nt()});u();l();function H(i){throw new Error("Unexpected value: "+JSON.stringify(i))}u();l();u();l();function wr(i){return Object.keys(i)}var E={};pt(E,{AccessAttribute:()=>q,AstNode:()=>x,Class:()=>F,ClassInstantiation:()=>te,CodeBlock:()=>D,Comment:()=>re,Decorator:()=>ie,Field:()=>W,Lambda:()=>ne,LambdaParameter:()=>se,Method:()=>Q,MethodArgument:()=>ae,MethodInvocation:()=>fe,Operator:()=>he,Parameter:()=>$,PythonFile:()=>ce,Reference:()=>k,StarImport:()=>z,Type:()=>Re,TypeInstantiation:()=>j,accessAttribute:()=>Tr,assign:()=>Er,class_:()=>Rr,codeBlock:()=>kr,comment:()=>br,decorator:()=>Nr,field:()=>Sr,file:()=>Ar,instantiateClass:()=>vr,invokeFunction:()=>_r,invokeMethod:()=>Br,lambda:()=>Ur,lambdaParameter:()=>Pr,method:()=>Cr,methodArgument:()=>Dr,operator:()=>Or,parameter:()=>Mr,reference:()=>Ir,starImport:()=>Lr});u();l();u();l();u();l();u();l();u();l();var G=class{};u();l();u();l();var U=class extends G{constructor(e){super();h(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 xr=4,st=!!y.env.FERN_STACK_TRACK;st&&(Error.stackTraceLimit=50);var le=class{constructor(){h(this,"buffer","");h(this,"indentLevel",0);h(this,"hasWrittenAnything",!1);h(this,"lastCharacterIsSemicolon",!1);h(this,"lastCharacterIsNewline",!1)}write(...t){for(let e of t)if(e!=null)if(typeof e=="string"){let r=e.length>0&&e.endsWith(`
2
+ `),n=r?e.substring(0,e.length-1):e,s=this.getIndentString(),o=n.replaceAll(`
3
+ `,`
4
+ ${s}`);this.isAtStartOfLine()&&(o=s+o),r&&(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 U(t).write(this),t.endsWith(";")||this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(t,e){new U(t).write(this),this.write(" (",e,")"),this.pushScope()}controlFlowWithoutStatement(t){new U(t).write(this),this.pushScope()}endControlFlow(){this.popScope()}contiguousControlFlow(t,e){this.dedent(),this.write("} "),new U(t).write(this),this.write(" (",e,")"),this.pushScope()}alternativeControlFlow(t){this.dedent(),this.write("} "),new U(t).write(this),this.pushScope()}pushScope(){this.writeLine("{"),this.indent()}popScope(t=!0){this.dedent(),this.writeNewLineIfLastLineNot(),t?this.writeLine("}"):this.write("}")}writeLine(t=""){this.write(t),this.writeNewLineIfLastLineNot()}newLine(){this.writeInternal(`
6
+ `)}writeSemicolonIfLastCharacterIsNot(){this.lastCharacterIsSemicolon||this.writeInternal(";")}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
7
+ `)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:t,delimiter:e,writeFunction:r}){if(t.length>0){let n=t[0];n!=null&&r(n);for(let s=1;s<t.length;s++){this.write(e);let o=t[s];o!=null&&r(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,st&&this.buffer.endsWith(`
9
+ `)&&!this.buffer.endsWith(`"""
10
+ `)){let e=this.stacktrace(15).map(r=>`${r.fn} - ${r.path}:${r.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 xr}stacktrace(t=50){var r;let e=!1;return((r=new Error().stack)!=null?r:"").split(`
12
+ `).map(n=>{var o;let s=n.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(s&&s.length===5){let[,f,c,m,p]=s;if(e||f!=null&&f.includes("runInteractiveTask")){e=!0;return}switch(f){case"Object.<anonymous>":f="";break;case"Object.object":case"Object.alias":case"Object.union":case"Object.enum":case"Object.undiscriminatedUnion":f=`${f.substring(f.indexOf(".")+1)}()=> { ... }`;break}return{fn:f,path:(o=c==null?void 0:c.replace(/^.*?fern.*?\//,""))!=null?o:"",position:`${m}:${p}`}}}).filter(n=>{var s,o,f,c,m,p,d;return n&&!((s=n.path)!=null&&s.startsWith("node:"))&&!((o=n.path)!=null&&o.endsWith(".js"))&&!((f=n.path)!=null&&f.includes("AbstractWriter"))&&!((c=n.fn)!=null&&c.includes("stacktrace"))&&!((m=n.fn)!=null&&m.includes("stackLine"))&&!((p=n.fn)!=null&&p.includes("SdkGeneratorCLI"))&&!((d=n.fn)!=null&&d.includes("runCli"))}).slice(0,t)}};u();l();var pe=class extends le{constructor(){super(...arguments);h(this,"fullyQualifiedModulePathsToImportedNames",{})}setRefNameOverrides(e){this.fullyQualifiedModulePathsToImportedNames=e}unsetRefNameOverrides(){this.fullyQualifiedModulePathsToImportedNames={}}getRefNameOverride(e){var n;let r=this.fullyQualifiedModulePathsToImportedNames[e.getFullyQualifiedModulePath()];return r||{name:(n=e.alias)!=null?n:e.name,isAlias:!!e.alias}}toString(){return this.buffer}async toStringFormatted(e){return e.format(this.buffer)}};var x=class extends G{constructor(){super(...arguments);h(this,"references",[])}addReference(e){this.references.push(e)}inheritReferences(e){e!==void 0&&e.references.forEach(r=>{this.references.includes(r)||this.addReference(r)})}getReferences(){return this.references}toString(){let e=new pe;return this.write(e),e.toString()}async toStringFormatted(e){let r=new pe;return this.write(r),r.toStringFormatted(e)}};var q=class extends x{constructor({lhs:e,rhs:r}){super();h(this,"lhs");h(this,"rhs");this.lhs=e,this.inheritReferences(e),this.rhs=r,this.inheritReferences(r)}write(e){this.lhs.write(e),e.write("."),this.rhs.write(e)}};u();l();var Ae=class extends x{constructor({lhs:e,rhs:r}){super();h(this,"lhs");h(this,"rhs");this.lhs=e,this.inheritReferences(e),this.rhs=r,this.inheritReferences(r)}write(e){this.lhs.write(e),e.write(" = "),this.rhs.write(e)}};u();l();var ee=class extends x{constructor({reference:e,arguments_:r,multiline:n}){super();h(this,"reference");h(this,"arguments");h(this,"multiline");this.reference=e,this.arguments=r,this.multiline=n!=null?n:!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((r,n)=>{r.write(e),n<this.arguments.length-1&&(e.write(","),this.multiline?e.newLine():e.write(" "))}),this.multiline&&(e.newLine(),e.dedent()),e.write(")")}};u();l();var F=class extends x{constructor({docs:e,name:r,extends_:n,decorators:s}){super();h(this,"name");h(this,"extends_");h(this,"decorators");h(this,"fields",[]);h(this,"docs");h(this,"statements",[]);this.name=r,this.extends_=n!=null?n:[],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(r=>{r.write(e)}),e.write(`class ${this.name}`),this.extends_.length>0&&(e.write("("),this.extends_.forEach((r,n)=>{n>0&&e.write(", "),r.write(e)}),e.write(")")),e.write(":"),e.newLine(),e.indent(),this.docs!=null&&(e.write('"""'),e.write(this.docs),e.write('"""')),e.writeNewLineIfLastLineNot(),this.fields.forEach(r=>{r.write(e),e.writeNewLineIfLastLineNot()}),e.dedent(),e.indent(),this.statements.length?this.writeStatements({writer:e}):e.write("pass"),e.dedent()}add(e){this.statements.push(e),this.inheritReferences(e)}writeStatements({writer:e}){this.statements.forEach((r,n)=>{r.write(e),e.writeNewLineIfLastLineNot()})}addField(e){this.add(e)}};u();l();var te=class extends ee{constructor(r){var n=r,{classReference:t}=n,e=_e(n,["classReference"]);super(Ce({reference:t},e))}};u();l();var D=class extends x{constructor(e){super();h(this,"arg");this.arg=e}write(e){return new U(this.arg).write(e)}};u();l();var re=class extends x{constructor({docs:e}){super();h(this,"docs");this.docs=e}write(e){this.docs!=null&&this.docs.split(`
13
+ `).forEach(r=>{e.writeLine(`# ${r}`)})}};u();l();var ie=class extends x{constructor({callable:e}){super();h(this,"callable");this.callable=e,this.inheritReferences(e)}write(e){e.write("@"),this.callable.write(e),e.newLine()}};u();l();var W=class extends x{constructor({name:e,type:r,initializer:n,docs:s}){super();h(this,"name");h(this,"type");h(this,"initializer");h(this,"docs");this.name=e,this.type=r,this.initializer=n,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();l();var ne=class extends x{constructor({parameters:e,body:r}){super();h(this,"parameters");h(this,"body");this.parameters=e!=null?e:[],this.body=r,this.inheritReferences(r)}write(e){e.write("lambda"),this.parameters&&this.parameters.length&&(e.write(" "),this.parameters.forEach((r,n)=>{r.write(e),n<this.parameters.length-1&&e.write(", ")})),e.write(": "),this.body.write(e)}};u();l();u();l();var $=class extends x{constructor({name:e,type:r,initializer:n}){super();h(this,"name");h(this,"initializer");h(this,"type");this.name=e,this.type=r,this.initializer=n}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 se=class extends ${constructor({name:t,initializer:e}){super({name:t,initializer:e,type:void 0})}};u();l();u();l();var oe;(function(i){i[i.STATIC=0]="STATIC",i[i.INSTANCE=1]="INSTANCE",i[i.CLASS=2]="CLASS"})(oe||(oe={}));var Q=class extends x{constructor({static_:e,name:r,parameters:n,return_:s,docstring:o,type:f,decorators:c}){super();h(this,"name");h(this,"return");h(this,"docstring");h(this,"type");h(this,"parameters");h(this,"decorators");h(this,"statements",[]);h(this,"static_");this.name=r,this.parameters=n!=null?n:[],this.return=s,this.docstring=o,this.type=f,this.decorators=c!=null?c:[],this.static_=e!=null?e:!1,this.parameters.forEach(m=>{this.inheritReferences(m)}),this.inheritReferences(this.return),this.decorators.forEach(m=>{this.inheritReferences(m)}),this.statements.forEach(m=>{this.inheritReferences(m)})}addStatement(e){this.statements.push(e),this.inheritReferences(e)}write(e){this.static_&&this.decorators.push(E.decorator({callable:E.codeBlock("staticmethod")})),this.decorators.forEach(s=>{s.write(e)}),this.type===oe.CLASS?E.decorator({callable:new D("classmethod")}).write(e):this.type===oe.STATIC&&E.decorator({callable:new D("staticmethod")}).write(e),e.write(`def ${this.name}(`);let n=this.parameters.length>3;n&&(e.newLine(),e.indent()),this.type===oe.INSTANCE?(e.write("self"),this.parameters.length>0&&(e.write(n?",":", "),n&&e.newLine())):this.type===oe.CLASS&&(e.write("cls"),this.parameters.length>0&&(e.write(n?",":", "),n&&e.newLine())),this.parameters.forEach((s,o)=>{s.write(e),o<this.parameters.length-1&&(e.write(n?",":", "),n&&e.newLine())}),n&&(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()}};u();l();var ae=class extends x{constructor({name:e,value:r}){super();h(this,"name");h(this,"value");this.name=e,this.value=r,this.inheritReferences(this.value)}write(e){this.name!==void 0&&(e.write(this.name),e.write("=")),this.value.write(e)}};u();l();var fe=class extends x{constructor({on:e,method:r,arguments_:n,multiline:s}){super();h(this,"on");h(this,"method");h(this,"arguments");h(this,"multiline");this.on=e,this.method=r,this.arguments=n,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((r,n)=>{r.write(e),n<this.arguments.length-1&&(e.write(","),this.multiline?e.newLine():e.write(" "))}),this.multiline&&(e.newLine(),e.dedent()),e.write(")")}};u();l();u();l();var _={Or:"or",And:"and",Add:"add",Subtract:"subtract",Multiply:"multiple",Divide:"divide",Modulo:"modulo",LeftShift:"leftShift",RightShift:"rightShift"};var he=class extends x{constructor({operator:e,lhs:r,rhs:n}){super();h(this,"operator");h(this,"lhs");h(this,"rhs");this.operator=e,this.lhs=r,this.inheritReferences(r),this.rhs=n,this.inheritReferences(n)}getOperatorString(){switch(this.operator){case _.Or:return"or";case _.And:return"and";case _.Add:return"+";case _.Subtract:return"-";case _.Multiply:return"*";case _.Divide:return"/";case _.Modulo:return"%";case _.LeftShift:return"<<";case _.RightShift:return">>";default:H(this.operator)}}write(e){this.lhs.write(e),e.write(" "),e.write(this.getOperatorString()),e.write(" "),this.rhs.write(e)}};u();l();u();l();function ot(i){if(!i)return"Class";let t=i.replace(/[^a-zA-Z0-9\s_-]/g," ").replace(/[-_\s]+/g," ").trim();return!t||/^\d+$/.test(t)?"Class"+(t||""):(/^\d/.test(t)&&(t="Class"+t),t.split(/(?=[A-Z])|[-_\s]+/).filter(r=>r.length>0).map(r=>r.split(new RegExp("(?<=\\d)(?=[a-zA-Z])|(?<=[a-zA-Z])(?=\\d)")).filter(n=>n.length>0)).flat().map((r,n)=>n===0&&/^\d/.test(r)?"Class"+r.charAt(0).toUpperCase()+r.slice(1).toLowerCase():r.length>1&&r===r.toUpperCase()&&!/^\d+$/.test(r)?r:r.charAt(0).toUpperCase()+r.slice(1).toLowerCase()).join(""))}u();l();u();l();var k=class extends x{constructor({name:e,modulePath:r,genericTypes:n,alias:s,attribute:o}){super();h(this,"name");h(this,"modulePath");h(this,"genericTypes");h(this,"alias");h(this,"attribute");this.name=e,this.modulePath=r!=null?r:[],this.genericTypes=n!=null?n:[],this.alias=s,this.attribute=o!=null?o:[],this.references.push(this),this.genericTypes.forEach(f=>{this.inheritReferences(f)})}write(e){let r=e.getRefNameOverride(this);e.write(r.name),this.genericTypes.length>0&&(e.write("["),this.genericTypes.forEach((n,s)=>{s>0&&e.write(", "),n.write(e)}),e.write("]")),this.attribute.length>0&&(e.write("."),this.attribute.forEach((n,s)=>{s>0&&e.write("."),e.write(n)}))}getFullyQualifiedPath(){return this.modulePath.join(".")}getFullyQualifiedModulePath(){return`${this.getFullyQualifiedPath()}.${this.name}`}};var z=class extends k{constructor({modulePath:e}){super({name:"*",modulePath:e});h(this,"docs")}write(e){throw new Error("Not intended to be written outside the context of a PythonFile.")}};var ce=class extends x{constructor({path:e,statements:r,isInitFile:n=!1,comments:s,imports:o}){super();h(this,"path");h(this,"isInitFile");h(this,"statements",[]);h(this,"comments");this.path=e,this.isInitFile=n,r==null||r.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 r=this.deduplicateReferences();this.updateWriterRefNameOverrides({writer:e,uniqueReferences:r}),this.writeComments(e),this.writeImports({writer:e,uniqueReferences:r}),this.statements.forEach((n,s)=>{n.write(e),e.newLine(),s<this.statements.length-1&&e.newLine()}),e.unsetRefNameOverrides()}updateWriterRefNameOverrides({writer:e,uniqueReferences:r}){let n=new Map(r),s={},o=this.getInitialUsedNames(),f=this.path.join("."),c=r.get(f);if(c){let{references:p}=c;p.forEach(d=>{let A=d.getFullyQualifiedModulePath(),g=d.name;s[A]={name:g,isAlias:!1},o.add(d.name)}),n.delete(f)}Array.from(n.values()).flatMap(({references:p})=>p).forEach(p=>{var N;if(p instanceof z)return;let d=(N=p.alias)!=null?N:p.name,A=p.getFullyQualifiedModulePath(),g=d,w=p.modulePath.length-1,T=!!p.alias;for(;o.has(g);){T=!0;let v=p.modulePath[w];w<0||!v?g=`_${g}`:g=`${ot(v)}${g}`,w--}o.add(g),s[A]={name:g,isAlias:T}}),e.setRefNameOverrides(s)}getInitialUsedNames(){let e=new Set;return this.statements.forEach(r=>{(r instanceof F||r instanceof Q||r instanceof W)&&e.add(r.name)}),e}deduplicateReferences(){let e=new Map;for(let r of this.references){let n=r.name,s=r.getFullyQualifiedPath();if(s==="")continue;let o=e.get(s);o?o.referenceNames.has(n)||(o.references.push(r),o.referenceNames.add(n)):e.set(s,{modulePath:r.modulePath,references:[r],referenceNames:new Set([n])})}return e}writeComments(e){this.comments.forEach(r=>{r.write(e)}),this.comments.length>0&&e.newLine()}getImportName({writer:e,reference:r}){let n=e.getRefNameOverride(r),s=r.name,o=n.isAlias?n.name:void 0;return`${s}${o?` as ${o}`:""}`}writeImports({writer:e,uniqueReferences:r}){if(r.size!==0){for(let[n,{modulePath:s,references:o}]of r){let f=s;if(!this.isDefinedInFile(f)){if(f[0]===this.path[0]){let c=0;for(;c<this.path.length&&c<f.length&&this.path[c]===f[c];)c++;let m=this.path.length-c;this.isInitFile&&m++;let p=m>0?".".repeat(m):".";p+=f.slice(c).join("."),e.write(`from ${p} import ${o.map(d=>this.getImportName({writer:e,reference:d})).join(", ")}`)}else e.write(`from ${n} import ${o.map(c=>this.getImportName({writer:e,reference:c})).join(", ")}`);e.newLine()}}e.newLine()}}isDefinedInFile(e){return e.length===this.path.length&&e.every((r,n)=>r===this.path[n])}};u();l();var Re=class extends x{constructor(e){super();h(this,"internalType");this.internalType=e}write(e){switch(this.internalType.type){case"int":e.write("int");break;case"float":e.write("float");break;case"bool":e.write("bool");break;case"str":e.write("str");break;case"bytes":e.write("bytes");break;case"list":e.write("List["),this.internalType.value.write(e),e.write("]");break;case"set":e.write("Set["),this.internalType.value.write(e),e.write("]");break;case"tuple":e.write("Tuple["),this.internalType.values.forEach((r,n)=>{n>0&&e.write(", "),r.write(e)}),e.write("]");break;case"dict":e.write("Dict["),this.internalType.keyType.write(e),e.write(", "),this.internalType.valueType.write(e),e.write("]");break;case"none":e.write("None");break;case"uuid":e.write("UUID");break;case"optional":e.write("Optional["),this.internalType.value.write(e),e.write("]");break;case"union":e.write("Union["),this.internalType.values.forEach((r,n)=>{n>0&&e.write(", "),r.write(e)}),e.write("]");break;case"any":e.write("Any");break;case"reference":this.internalType.value.write(e);break;case"datetime":e.write("datetime");break;case"literal":typeof this.internalType.value=="string"?e.write(`Literal["${this.internalType.value}"]`):e.write(`Literal[${this.internalType.value}]`);break;default:H(this.internalType)}}static int(){return new this({type:"int"})}static float(){return new this({type:"float"})}static bool(){return new this({type:"bool"})}static str(){return new this({type:"str"})}static bytes(){return new this({type:"bytes"})}static list(e){let r=new this({type:"list",value:e});return r.addReference(E.reference({name:"List",modulePath:["typing"]})),r.inheritReferences(e),r}static set(e){let r=new this({type:"set",value:e});return r.addReference(E.reference({name:"Set",modulePath:["typing"]})),r.inheritReferences(e),r}static tuple(e){let r=new this({type:"tuple",values:e});return r.addReference(E.reference({name:"Tuple",modulePath:["typing"]})),e.forEach(n=>r.inheritReferences(n)),r}static dict(e,r){let n=new this({type:"dict",keyType:e,valueType:r});return n.addReference(E.reference({name:"Dict",modulePath:["typing"]})),n.inheritReferences(e),n.inheritReferences(r),n}static none(){return new this({type:"none"})}static uuid(){let e=new this({type:"uuid"});return e.addReference(E.reference({name:"UUID",modulePath:["uuid"]})),e}static optional(e){if(this.isAlreadyOptional(e))return e;let r=new this({type:"optional",value:e});return r.addReference(E.reference({name:"Optional",modulePath:["typing"]})),r.inheritReferences(e),r}static union(e){let r=new this({type:"union",values:e});return r.addReference(E.reference({name:"Union",modulePath:["typing"]})),e.forEach(n=>r.inheritReferences(n)),r}static any(){let e=new this({type:"any"});return e.addReference(E.reference({name:"Any",modulePath:["typing"]})),e}static datetime(){let e=new this({type:"datetime"});return e.addReference(E.reference({name:"datetime",modulePath:["datetime"]})),e}static reference(e){let r=new this({type:"reference",value:e});return r.addReference(e),r}static literal(e){let r=new this({type:"literal",value:e});return r.addReference(E.reference({name:"Literal",modulePath:["typing"]})),r}static isAlreadyOptional(e){return e.internalType.type==="optional"}};u();l();var j=class i extends x{constructor(e){super();h(this,"internalType");this.internalType=e}static int(e){return new this({type:"int",value:e})}static float(e){return new this({type:"float",value:e})}static bool(e){return new this({type:"bool",value:e})}static str(e,r={multiline:!1,startOnNewLine:!1,endWithNewLine:!1}){return new this({type:"str",value:e,config:r})}static bytes(e){return new this({type:"bytes",value:e})}static list(e,r={endWithComma:!1}){let n=new this({type:"list",values:e,config:r});return e.forEach(s=>n.inheritReferences(s)),n}static set(e,r={endWithComma:!1}){let n=new this({type:"set",values:e,config:r});return e.forEach(s=>n.inheritReferences(s)),n}static tuple(e,r={endWithComma:!1}){let n=new this({type:"tuple",values:e,config:r});return e.forEach(s=>n.inheritReferences(s)),n}static typedDict(e,r={endWithComma:!1}){let n=new this({type:"typedDict",entries:e,config:r});return e.forEach(s=>n.inheritReferences(s.value)),n}static date(e){let r=new this({type:"date",value:e});return r.addReference(new k({name:"date",modulePath:["datetime"]})),r}static datetime(e){let r=new this({type:"datetime",value:e});return r.addReference(new k({name:"datetime",modulePath:["datetime"]})),r}static dict(e,r={endWithComma:!1}){let n=new this({type:"dict",entries:e,config:r});return e.forEach(s=>{n.inheritReferences(s.key),n.inheritReferences(s.value)}),n}static reference(e){let r=new this({type:"reference",value:e});return r.inheritReferences(e),r}static none(){return new this({type:"none"})}static unknown(e){return new this({type:"unknown",value:e})}static uuid(e){let r=new this({type:"uuid",value:e});return r.addReference(new k({name:"UUID",modulePath:["uuid"]})),r}static nop(){return new this({type:"nop"})}static isNop(e){return e instanceof i&&e.internalType.type==="nop"}isTypedDict(){return this.internalType.type==="typedDict"}asTypedDictOrThrow(){if(this.isTypedDict())return this.internalType;throw new Error("Internal error; python.TypeInstantiation is not a TypedDict")}write(e){var r,n,s,o,f,c,m,p,d,A,g;switch(this.internalType.type){case"int":e.write(this.internalType.value.toString());break;case"float":e.write(this.internalType.value.toString());break;case"bool":this.internalType.value?e.write("True"):e.write("False");break;case"str":if((r=this.internalType.config)!=null&&r.multiline){let{startOnNewLine:w,endWithNewLine:T}=this.internalType.config;this.writeStringWithTripleQuotes({writer:e,value:this.internalType.value,startOnNewLine:w,endWithNewLine:T})}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,T=Ue({values:w.values});if(T.length===0){e.write("[]");break}e.write("["),(n=w.config)!=null&&n.multiline&&(e.newLine(),e.indent()),T.forEach((N,v)=>{var I,b;v>0&&(e.write(","),(I=w.config)!=null&&I.multiline?e.newLine():e.write(" ")),N.write(e),v===T.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,T=Ue({values:w.values});if(T.length===0){e.write("{}");break}e.write("{"),(o=w.config)!=null&&o.multiline&&(e.newLine(),e.indent()),T.forEach((N,v)=>{var I,b;v>0&&(e.write(","),(I=w.config)!=null&&I.multiline?e.newLine():e.write(" ")),N.write(e),v===T.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,T=Ue({values:w.values});if(T.length===0){e.write("()");break}e.write("("),(c=w.config)!=null&&c.multiline&&(e.newLine(),e.indent()),T.forEach((N,v)=>{var I,b;v>0&&(e.write(","),(I=w.config)!=null&&I.multiline?e.newLine():e.write(" ")),N.write(e),(T.length===1||v===T.length-1&&((b=w.config)!=null&&b.endWithComma))&&e.write(",")}),(m=w.config)!=null&&m.multiline&&(e.newLine(),e.dedent()),e.write(")");break}case"dict":{let w=this.internalType,T=yr({entries:w.entries});if(T.length===0){e.write("{}");break}e.write("{"),(p=w.config)!=null&&p.multiline&&(e.newLine(),e.indent()),T.forEach((N,v)=>{var I,b;v>0&&(e.write(","),(I=w.config)!=null&&I.multiline?e.newLine():e.write(" ")),N.key.write(e),e.write(": "),N.value.write(e),v===T.length-1&&((b=w.config)!=null&&b.endWithComma)&&e.write(",")}),(d=w.config)!=null&&d.multiline&&(e.newLine(),e.dedent()),e.write("}");break}case"typedDict":{let w=this.internalType,T=gr({entries:w.entries});if(T.length===0){e.write("{}");break}e.write("{"),(A=w.config)!=null&&A.multiline&&(e.writeLine(),e.indent()),T.forEach((N,v)=>{var I;v>0&&(e.write(","),(I=w.config)!=null&&I.multiline?e.newLine():e.write(" ")),e.write(`"${N.name}": `),N.value.write(e)}),(g=w.config)!=null&&g.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:H(this.internalType)}}writeStringWithTripleQuotes({writer:e,value:r,startOnNewLine:n,endWithNewLine:s}){var f;e.write('"""');let o=r.split(`
14
+ `);if(o.length<=1){e.write(this.escapeString((f=o[0])!=null?f:"")),e.write('"""');return}n&&e.writeNoIndent(`\\
15
+ `),o.forEach((c,m)=>{e.writeNoIndent(this.escapeString(c)),m===o.length-1?s&&e.writeNoIndent(`\\
16
+ `):e.writeNoIndent(`
17
+ `)}),e.writeNoIndent('"""')}escapeString(e){let r=new RegExp(`(?<!\\\\)(["'\\\\\\t\\n\\r])`,"g"),n={'"':'\\"',"'":"\\'","\\":"\\\\"," ":"\\t","\n":"\\n","\r":"\\r"};return e.replace(r,s=>{var o;return(o=n[s])!=null?o:s})}writeUnknown({writer:e,value:r}){switch(typeof r){case"boolean":e.write(r?"True":"False");return;case"string":e.write(`"${this.escapeString(r)}"`);return;case"number":e.write(r.toString());return;case"object":if(r==null){e.write("None");return}if(Array.isArray(r)){this.writeUnknownArray({writer:e,value:r});return}this.writeUnknownObject({writer:e,value:r});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof r}`)}}writeUnknownArray({writer:e,value:r}){if(r.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let n of r)e.writeNode(i.unknown(n)),e.writeLine(",");e.dedent(),e.write("]")}writeUnknownObject({writer:e,value:r}){let n=Object.entries(r);if(n.length===0){e.write("{}");return}e.writeLine("{"),e.indent();for(let[s,o]of n)e.write(`"${s}": `),e.writeNode(i.unknown(o)),e.writeLine(",");e.dedent(),e.write("}")}};function yr({entries:i}){return i.filter(t=>!j.isNop(t.key)&&!j.isNop(t.value))}function gr({entries:i}){return i.filter(t=>!j.isNop(t.value))}function Ue({values:i}){return i.filter(t=>!j.isNop(t))}function Tr(i){return new q(i)}function Er(i){return new Ae(i)}function Ar(i){return new ce(i)}function Rr(i){return new F(i)}function vr(i){return new te(i)}function Nr(i){return new ie(i)}function Ir(i){return new k(i)}function Lr(i){return new z(i)}function Sr(i){return new W(i)}function kr(i){return new D(i)}function br(i){return new re(i)}function Ur(i){return new ne(i)}function Pr(i){return new se(i)}function Cr(i){return new Q(i)}function _r(i){return new ee(i)}function Br(i){return new fe(i)}function Mr(i){return new $(i)}function Dr(i){return new ae(i)}function Or(i){return new he(i)}export{Ce as a,Yr as b,Fr as c,_e as d,Ie as e,Wr as f,pt as g,$r as h,Qr as i,h as j,u as k,a as l,l as m,H as n,wr as o,E as p};
18
+ /*! Bundled license information:
19
+
20
+ @esbuild-plugins/node-globals-polyfill/Buffer.js:
21
+ (*!
22
+ * The buffer module from node.js, for the browser.
23
+ *
24
+ * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
25
+ * @license MIT
26
+ *)
27
+ */
28
+ //# sourceMappingURL=chunk-7DC5LAKR.js.map