@fern-api/go-dynamic-snippets 0.0.15 → 0.0.16

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 (69) hide show
  1. package/cjs/DynamicSnippetsGenerator.cjs +18 -10
  2. package/cjs/DynamicSnippetsGenerator.cjs.map +1 -0
  3. package/cjs/DynamicSnippetsGenerator.d.cts +4 -4
  4. package/cjs/{DynamicSnippetsGeneratorContext-CpOvS1wA.d.cts → DynamicSnippetsGeneratorContext-BusKoNq4.d.cts} +10 -1
  5. package/cjs/EndpointSnippetGenerator.cjs +19 -11
  6. package/cjs/EndpointSnippetGenerator.cjs.map +1 -0
  7. package/cjs/EndpointSnippetGenerator.d.cts +15 -4
  8. package/cjs/context/DynamicSnippetsGeneratorContext.cjs +18 -10
  9. package/cjs/context/DynamicSnippetsGeneratorContext.cjs.map +1 -0
  10. package/cjs/context/DynamicSnippetsGeneratorContext.d.cts +1 -1
  11. package/cjs/context/DynamicTypeInstantiationMapper.cjs +19 -11
  12. package/cjs/context/DynamicTypeInstantiationMapper.cjs.map +1 -0
  13. package/cjs/context/DynamicTypeInstantiationMapper.d.cts +1 -1
  14. package/cjs/context/DynamicTypeMapper.cjs +18 -10
  15. package/cjs/context/DynamicTypeMapper.cjs.map +1 -0
  16. package/cjs/context/DynamicTypeMapper.d.cts +1 -1
  17. package/cjs/context/FilePropertyMapper.cjs +18 -10
  18. package/cjs/context/FilePropertyMapper.cjs.map +1 -0
  19. package/cjs/context/FilePropertyMapper.d.cts +1 -1
  20. package/cjs/index.cjs +24 -28
  21. package/cjs/index.cjs.map +1 -0
  22. package/cjs/index.d.cts +2 -2
  23. package/esm/DynamicSnippetsGenerator.d.ts +4 -4
  24. package/esm/DynamicSnippetsGenerator.js +2 -1
  25. package/esm/DynamicSnippetsGenerator.js.map +1 -0
  26. package/esm/{DynamicSnippetsGeneratorContext-CpOvS1wA.d.ts → DynamicSnippetsGeneratorContext-BusKoNq4.d.ts} +10 -1
  27. package/esm/EndpointSnippetGenerator.d.ts +15 -4
  28. package/esm/EndpointSnippetGenerator.js +2 -1
  29. package/esm/EndpointSnippetGenerator.js.map +1 -0
  30. package/esm/chunk-2YRGTA73.js +2 -0
  31. package/esm/chunk-2YRGTA73.js.map +1 -0
  32. package/esm/chunk-BI26DLZ5.js +2 -0
  33. package/esm/chunk-BI26DLZ5.js.map +1 -0
  34. package/esm/chunk-D6NMQKNQ.js +2 -0
  35. package/esm/chunk-D6NMQKNQ.js.map +1 -0
  36. package/esm/chunk-FD44EP2P.js +2 -0
  37. package/esm/chunk-FD44EP2P.js.map +1 -0
  38. package/esm/chunk-GUJUKQKZ.js +37 -0
  39. package/esm/chunk-GUJUKQKZ.js.map +1 -0
  40. package/esm/chunk-Q6YO7G6Y.js +2 -0
  41. package/esm/chunk-Q6YO7G6Y.js.map +1 -0
  42. package/esm/chunk-UZEM7EUP.js +2 -0
  43. package/esm/chunk-UZEM7EUP.js.map +1 -0
  44. package/esm/chunk-VCNL2JWU.js +2 -0
  45. package/esm/chunk-VCNL2JWU.js.map +1 -0
  46. package/esm/context/DynamicSnippetsGeneratorContext.d.ts +1 -1
  47. package/esm/context/DynamicSnippetsGeneratorContext.js +2 -1
  48. package/esm/context/DynamicSnippetsGeneratorContext.js.map +1 -0
  49. package/esm/context/DynamicTypeInstantiationMapper.d.ts +1 -1
  50. package/esm/context/DynamicTypeInstantiationMapper.js +2 -1
  51. package/esm/context/DynamicTypeInstantiationMapper.js.map +1 -0
  52. package/esm/context/DynamicTypeMapper.d.ts +1 -1
  53. package/esm/context/DynamicTypeMapper.js +2 -1
  54. package/esm/context/DynamicTypeMapper.js.map +1 -0
  55. package/esm/context/FilePropertyMapper.d.ts +1 -1
  56. package/esm/context/FilePropertyMapper.js +2 -1
  57. package/esm/context/FilePropertyMapper.js.map +1 -0
  58. package/esm/index.d.ts +2 -2
  59. package/esm/index.js +2 -13
  60. package/esm/index.js.map +1 -0
  61. package/package.json +1 -1
  62. package/esm/chunk-55JFNSPF.js +0 -1
  63. package/esm/chunk-EQTG6W6V.js +0 -1
  64. package/esm/chunk-H7X5SHRQ.js +0 -1
  65. package/esm/chunk-IYOA724T.js +0 -1
  66. package/esm/chunk-LZIEHSJ7.js +0 -1
  67. package/esm/chunk-RX5QSNXP.js +0 -1
  68. package/esm/chunk-SX53R7DQ.js +0 -1
  69. package/esm/chunk-XL5OWIY6.js +0 -29
@@ -0,0 +1,2 @@
1
+ import{e as c,f as i,g as p,h as n,j as e}from"./chunk-GUJUKQKZ.js";i();p();var a=class{constructor({context:t}){c(this,"context");this.context=t}convert(t){switch(t.typeReference.type){case"list":return e.Type.slice(this.convert({typeReference:t.typeReference.value}));case"literal":return this.convertLiteral({literal:t.typeReference.value});case"map":return e.Type.map(this.convert({typeReference:t.typeReference.key}),this.convert({typeReference:t.typeReference.value}));case"named":{let r=this.context.resolveNamedType({typeId:t.typeReference.value});return r==null?this.convertUnknown():this.convertNamed({named:r})}case"optional":return e.Type.optional(this.convert({typeReference:t.typeReference.value}));case"nullable":return e.Type.optional(this.convert({typeReference:t.typeReference.value}));case"primitive":return this.convertPrimitive({primitive:t.typeReference.value});case"set":return e.Type.slice(this.convert({typeReference:t.typeReference}));case"unknown":return this.convertUnknown();default:n(t.typeReference)}}convertLiteral({literal:t}){switch(t.type){case"boolean":return e.Type.bool();case"string":return e.Type.string()}}convertNamed({named:t}){let r=e.Type.reference(e.typeReference({name:this.context.getTypeName(t.declaration.name),importPath:this.context.getImportPath(t.declaration.fernFilepath)}));switch(t.type){case"alias":case"enum":return r;case"discriminatedUnion":case"object":case"undiscriminatedUnion":return e.Type.pointer(r);default:n(t)}}convertUnknown(){return e.Type.any()}convertPrimitive({primitive:t}){switch(t){case"INTEGER":return e.Type.int();case"UINT":return e.Type.int();case"LONG":return e.Type.int64();case"UINT_64":return e.Type.int64();case"FLOAT":return e.Type.float64();case"DOUBLE":return e.Type.float64();case"BOOLEAN":return e.Type.bool();case"STRING":return e.Type.string();case"DATE":return e.Type.date();case"DATE_TIME":return e.Type.dateTime();case"UUID":return e.Type.uuid();case"BASE_64":return e.Type.bytes();case"BIG_INTEGER":return e.Type.string();default:n(t)}}};export{a};
2
+ //# sourceMappingURL=chunk-Q6YO7G6Y.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/context/DynamicTypeMapper.ts"],"sourcesContent":["import { assertNever } from \"@fern-api/core-utils\";\nimport { FernIr } from \"@fern-api/dynamic-ir-sdk\";\nimport { go } from \"@fern-api/go-ast\";\n\nimport { DynamicSnippetsGeneratorContext } from \"./DynamicSnippetsGeneratorContext\";\n\nexport declare namespace DynamicTypeMapper {\n interface Args {\n typeReference: FernIr.dynamic.TypeReference;\n }\n}\n\nexport class DynamicTypeMapper {\n private context: DynamicSnippetsGeneratorContext;\n\n constructor({ context }: { context: DynamicSnippetsGeneratorContext }) {\n this.context = context;\n }\n\n public convert(args: DynamicTypeMapper.Args): go.Type {\n switch (args.typeReference.type) {\n case \"list\":\n return go.Type.slice(this.convert({ typeReference: args.typeReference.value }));\n case \"literal\":\n return this.convertLiteral({ literal: args.typeReference.value });\n case \"map\":\n return go.Type.map(\n this.convert({ typeReference: args.typeReference.key }),\n this.convert({ typeReference: args.typeReference.value })\n );\n case \"named\": {\n const named = this.context.resolveNamedType({ typeId: args.typeReference.value });\n if (named == null) {\n return this.convertUnknown();\n }\n return this.convertNamed({ named });\n }\n case \"optional\":\n return go.Type.optional(this.convert({ typeReference: args.typeReference.value }));\n case \"nullable\":\n return go.Type.optional(this.convert({ typeReference: args.typeReference.value }));\n case \"primitive\":\n return this.convertPrimitive({ primitive: args.typeReference.value });\n case \"set\":\n return go.Type.slice(this.convert({ typeReference: args.typeReference }));\n case \"unknown\":\n return this.convertUnknown();\n default:\n assertNever(args.typeReference);\n }\n }\n\n private convertLiteral({ literal }: { literal: FernIr.dynamic.LiteralType }): go.Type {\n switch (literal.type) {\n case \"boolean\":\n return go.Type.bool();\n case \"string\":\n return go.Type.string();\n }\n }\n\n private convertNamed({ named }: { named: FernIr.dynamic.NamedType }): go.Type {\n const goTypeReference = go.Type.reference(\n go.typeReference({\n name: this.context.getTypeName(named.declaration.name),\n importPath: this.context.getImportPath(named.declaration.fernFilepath)\n })\n );\n switch (named.type) {\n case \"alias\":\n case \"enum\":\n return goTypeReference;\n case \"discriminatedUnion\":\n case \"object\":\n case \"undiscriminatedUnion\":\n return go.Type.pointer(goTypeReference);\n default:\n assertNever(named);\n }\n }\n\n private convertUnknown(): go.Type {\n return go.Type.any();\n }\n\n private convertPrimitive({ primitive }: { primitive: FernIr.dynamic.PrimitiveTypeV1 }): go.Type {\n switch (primitive) {\n case \"INTEGER\":\n return go.Type.int();\n case \"UINT\":\n return go.Type.int();\n case \"LONG\":\n return go.Type.int64();\n case \"UINT_64\":\n return go.Type.int64();\n case \"FLOAT\":\n return go.Type.float64();\n case \"DOUBLE\":\n return go.Type.float64();\n case \"BOOLEAN\":\n return go.Type.bool();\n case \"STRING\":\n return go.Type.string();\n case \"DATE\":\n return go.Type.date();\n case \"DATE_TIME\":\n return go.Type.dateTime();\n case \"UUID\":\n return go.Type.uuid();\n case \"BASE_64\":\n return go.Type.bytes();\n case \"BIG_INTEGER\":\n return go.Type.string();\n default:\n assertNever(primitive);\n }\n }\n}\n"],"mappings":"oEAAAA,IAAAC,IAYO,IAAMC,EAAN,KAAwB,CAG3B,YAAY,CAAE,QAAAC,CAAQ,EAAiD,CAFvEC,EAAA,KAAQ,WAGJ,KAAK,QAAUD,CACnB,CAEO,QAAQE,EAAuC,CAClD,OAAQA,EAAK,cAAc,KAAM,CAC7B,IAAK,OACD,OAAOC,EAAG,KAAK,MAAM,KAAK,QAAQ,CAAE,cAAeD,EAAK,cAAc,KAAM,CAAC,CAAC,EAClF,IAAK,UACD,OAAO,KAAK,eAAe,CAAE,QAASA,EAAK,cAAc,KAAM,CAAC,EACpE,IAAK,MACD,OAAOC,EAAG,KAAK,IACX,KAAK,QAAQ,CAAE,cAAeD,EAAK,cAAc,G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AK,CACzB,CACJ,CAEQ,gBAA0B,CAC9B,OAAOD,EAAG,KAAK,IAAI,CACvB,CAEQ,iBAAiB,CAAE,UAAAK,CAAU,EAA2D,CAC5F,OAAQA,EAAW,CACf,IAAK,UACD,OAAOL,EAAG,KAAK,IAAI,EACvB,IAAK,OACD,OAAOA,EAAG,KAAK,IAAI,EACvB,IAAK,OACD,OAAOA,EAAG,KAAK,MAAM,EACzB,IAAK,UACD,OAAOA,EAAG,KAAK,MAAM,EACzB,IAAK,QACD,OAAOA,EAAG,KAAK,QAAQ,EAC3B,IAAK,SACD,OAAOA,EAAG,KAAK,QAAQ,EAC3B,IAAK,UACD,OAAOA,EAAG,KAAK,KAAK,EACxB,IAAK,SACD,OAAOA,EAAG,KAAK,OAAO,EAC1B,IAAK,OACD,OAAOA,EAAG,KAAK,KAAK,EACxB,IAAK,YACD,OAAOA,EAAG,KAAK,SAAS,EAC5B,IAAK,OACD,OAAOA,EAAG,KAAK,KAAK,EACxB,IAAK,UACD,OAAOA,EAAG,KAAK,MAAM,EACzB,IAAK,cACD,OAAOA,EAAG,KAAK,OAAO,EAC1B,QACIE,EAAYG,CAAS,CAC7B,CACJ,CACJ","names":["init_process","init_buffer","DynamicTypeMapper","context","__publicField","args","go_exports","named","assertNever","literal","goTypeReference","primitive"]}
@@ -0,0 +1,2 @@
1
+ import{a as u}from"./chunk-FD44EP2P.js";import{c as p}from"./chunk-VCNL2JWU.js";import{a as l}from"./chunk-Q6YO7G6Y.js";import{a as g}from"./chunk-2YRGTA73.js";import{e as r,f as a,g as s,h as c,j as n,k as m}from"./chunk-GUJUKQKZ.js";a();s();var h=class f extends p{constructor({ir:e,config:t}){super({ir:e,config:t});r(this,"ir");r(this,"customConfig");r(this,"dynamicTypeMapper");r(this,"dynamicTypeInstantiationMapper");r(this,"filePropertyMapper");r(this,"rootImportPath");this.ir=e,this.customConfig=t.customConfig!=null?t.customConfig:void 0,this.dynamicTypeMapper=new l({context:this}),this.dynamicTypeInstantiationMapper=new u({context:this}),this.filePropertyMapper=new g({context:this}),this.rootImportPath=m({config:t,customConfig:this.customConfig})}clone(){return new f({ir:this.ir,config:this.config})}isOptional(e){switch(e.type){case"optional":case"map":return!0;case"nullable":case"list":case"set":return this.isOptional(e.value);case"named":case"literal":case"primitive":case"unknown":return!1;default:c(e)}}getMethodName(e){return e.pascalCase.unsafeName}getTestMethodName(e){return e.declaration.fernFilepath.allParts.map(t=>t.pascalCase.unsafeName).join("")+e.declaration.name.pascalCase.unsafeName}getTypeName(e){return e.pascalCase.unsafeName}getImportPath(e){let t=e.packagePath.map(i=>i.pascalCase.unsafeName.toLowerCase());return[this.rootImportPath,...t].join("/")}getImportPathForRequest(e){var t;return(t=this.customConfig)!=null&&t.exportAllRequestsAtRoot?this.rootImportPath:this.getImportPath(e)}getContextTypeReference(){return n.typeReference({name:"Context",importPath:"context"})}getContextTodoFunctionInvocation(){return n.invokeFunc({func:n.typeReference({name:"TODO",importPath:"context"}),arguments_:[]})}getIoReaderTypeReference(){return n.typeReference({name:"Reader",importPath:"io"})}getTestingTypeReference(){return n.typeReference({name:"T",importPath:"testing"})}getNewStringsReaderFunctionInvocation(e){return n.invokeFunc({func:n.typeReference({name:"NewReader",importPath:"strings"}),arguments_:[n.TypeInstantiation.string(e)]})}getClientConstructorName(){var e,t;return((e=this.customConfig)==null?void 0:e.clientConstructorName)!=null?this.customConfig.clientConstructorName:((t=this.customConfig)==null?void 0:t.exportedClientName)!=null?`New${this.customConfig.exportedClientName}`:`New${this.getClientName()}`}getClientName(){var e;return((e=this.customConfig)==null?void 0:e.clientName)!=null?this.customConfig.clientName:"Client"}getClientImportPath(){return`${this.rootImportPath}/client`}getOptionImportPath(){return`${this.rootImportPath}/option`}getGoTypeReferenceFromDeclaration({declaration:e}){return n.typeReference({name:e.name.pascalCase.unsafeName,importPath:this.getImportPath(e.fernFilepath)})}getEnvironmentTypeReferenceFromID(e){let t=this.resolveEnvironmentName(e);if(t!=null)return this.getEnvironmentTypeReference(t)}getEnvironmentTypeReference(e){return n.typeReference({name:`Environments.${this.getTypeName(e)}`,importPath:this.rootImportPath})}static chainMethods(e,...t){if(t.length===0)throw new Error("Must have methods to chain");let i=e;for(let o of t)i=n.invokeMethod({on:i,method:o.method,arguments_:o.arguments_,multiline:o.multiline});return i}};export{h as a};
2
+ //# sourceMappingURL=chunk-UZEM7EUP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/context/DynamicSnippetsGeneratorContext.ts"],"sourcesContent":["import {\n AbstractDynamicSnippetsGeneratorContext,\n FernGeneratorExec\n} from \"@fern-api/browser-compatible-base-generator\";\nimport { assertNever } from \"@fern-api/core-utils\";\nimport { FernIr } from \"@fern-api/dynamic-ir-sdk\";\nimport { BaseGoCustomConfigSchema, go, resolveRootImportPath } from \"@fern-api/go-ast\";\n\nimport { DynamicTypeInstantiationMapper } from \"./DynamicTypeInstantiationMapper\";\nimport { DynamicTypeMapper } from \"./DynamicTypeMapper\";\nimport { FilePropertyMapper } from \"./FilePropertyMapper\";\n\nexport class DynamicSnippetsGeneratorContext extends AbstractDynamicSnippetsGeneratorContext {\n public ir: FernIr.dynamic.DynamicIntermediateRepresentation;\n public customConfig: BaseGoCustomConfigSchema | undefined;\n public dynamicTypeMapper: DynamicTypeMapper;\n public dynamicTypeInstantiationMapper: DynamicTypeInstantiationMapper;\n public filePropertyMapper: FilePropertyMapper;\n public rootImportPath: string;\n\n constructor({\n ir,\n config\n }: {\n ir: FernIr.dynamic.DynamicIntermediateRepresentation;\n config: FernGeneratorExec.GeneratorConfig;\n }) {\n super({ ir, config });\n this.ir = ir;\n this.customConfig = config.customConfig != null ? (config.customConfig as BaseGoCustomConfigSchema) : undefined;\n this.dynamicTypeMapper = new DynamicTypeMapper({ context: this });\n this.dynamicTypeInstantiationMapper = new DynamicTypeInstantiationMapper({ context: this });\n this.filePropertyMapper = new FilePropertyMapper({ context: this });\n this.rootImportPath = resolveRootImportPath({ config, customConfig: this.customConfig });\n }\n\n public clone(): DynamicSnippetsGeneratorContext {\n return new DynamicSnippetsGeneratorContext({\n ir: this.ir,\n config: this.config\n });\n }\n\n public isOptional(typeReference: FernIr.dynamic.TypeReference): boolean {\n switch (typeReference.type) {\n case \"optional\":\n case \"map\":\n return true;\n case \"nullable\":\n case \"list\":\n case \"set\":\n return this.isOptional(typeReference.value);\n case \"named\":\n case \"literal\":\n case \"primitive\":\n case \"unknown\":\n return false;\n default:\n assertNever(typeReference);\n }\n }\n\n public getMethodName(name: FernIr.Name): string {\n return name.pascalCase.unsafeName;\n }\n\n public getTestMethodName(endpoint: FernIr.dynamic.Endpoint): string {\n return (\n endpoint.declaration.fernFilepath.allParts.map((name) => name.pascalCase.unsafeName).join(\"\") +\n endpoint.declaration.name.pascalCase.unsafeName\n );\n }\n\n public getTypeName(name: FernIr.Name): string {\n return name.pascalCase.unsafeName;\n }\n\n public getImportPath(fernFilepath: FernIr.dynamic.FernFilepath): string {\n const parts = fernFilepath.packagePath.map((path) => path.pascalCase.unsafeName.toLowerCase());\n return [this.rootImportPath, ...parts].join(\"/\");\n }\n\n public getImportPathForRequest(fernFilepath: FernIr.dynamic.FernFilepath): string {\n if (this.customConfig?.exportAllRequestsAtRoot) {\n return this.rootImportPath;\n }\n return this.getImportPath(fernFilepath);\n }\n\n public getContextTypeReference(): go.TypeReference {\n return go.typeReference({\n name: \"Context\",\n importPath: \"context\"\n });\n }\n\n public getContextTodoFunctionInvocation(): go.FuncInvocation {\n return go.invokeFunc({\n func: go.typeReference({\n name: \"TODO\",\n importPath: \"context\"\n }),\n arguments_: []\n });\n }\n\n public getIoReaderTypeReference(): go.TypeReference {\n return go.typeReference({\n name: \"Reader\",\n importPath: \"io\"\n });\n }\n\n public getTestingTypeReference(): go.TypeReference {\n return go.typeReference({\n name: \"T\",\n importPath: \"testing\"\n });\n }\n\n public getNewStringsReaderFunctionInvocation(s: string): go.FuncInvocation {\n return go.invokeFunc({\n func: go.typeReference({\n name: \"NewReader\",\n importPath: \"strings\"\n }),\n arguments_: [go.TypeInstantiation.string(s)]\n });\n }\n\n public getClientConstructorName(): string {\n if (this.customConfig?.clientConstructorName != null) {\n return this.customConfig.clientConstructorName;\n }\n if (this.customConfig?.exportedClientName != null) {\n return `New${this.customConfig.exportedClientName}`;\n }\n return `New${this.getClientName()}`;\n }\n\n public getClientName(): string {\n if (this.customConfig?.clientName != null) {\n return this.customConfig.clientName;\n }\n return \"Client\";\n }\n\n public getClientImportPath(): string {\n return `${this.rootImportPath}/client`;\n }\n\n public getOptionImportPath(): string {\n return `${this.rootImportPath}/option`;\n }\n\n public getGoTypeReferenceFromDeclaration({\n declaration\n }: {\n declaration: FernIr.dynamic.Declaration;\n }): go.TypeReference {\n return go.typeReference({\n name: declaration.name.pascalCase.unsafeName,\n importPath: this.getImportPath(declaration.fernFilepath)\n });\n }\n\n public getEnvironmentTypeReferenceFromID(environmentID: string): go.TypeReference | undefined {\n const environmentName = this.resolveEnvironmentName(environmentID);\n if (environmentName == null) {\n return undefined;\n }\n return this.getEnvironmentTypeReference(environmentName);\n }\n\n private getEnvironmentTypeReference(name: FernIr.Name): go.TypeReference {\n return go.typeReference({\n name: `Environments.${this.getTypeName(name)}`,\n importPath: this.rootImportPath\n });\n }\n\n public static chainMethods(\n baseFunc: go.FuncInvocation,\n ...methods: Omit<go.MethodInvocation.Args, \"on\">[]\n ): go.MethodInvocation {\n if (methods.length === 0) {\n throw new Error(\"Must have methods to chain\");\n }\n\n let current: go.AstNode = baseFunc;\n for (const method of methods) {\n current = go.invokeMethod({\n on: current,\n method: method.method,\n arguments_: method.arguments_,\n multiline: method.multiline\n });\n }\n return current as go.MethodInvocation;\n }\n}\n"],"mappings":"2OAAAA,IAAAC,IAYO,IAAMC,EAAN,MAAMC,UAAwCC,CAAwC,CAQzF,YAAY,CACR,GAAAC,EACA,OAAAC,CACJ,EAGG,CACC,MAAM,CAAE,GAAAD,EAAI,OAAAC,CAAO,CAAC,EAdxBC,EAAA,KAAO,MACPA,EAAA,KAAO,gBACPA,EAAA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AAMC,EAAkB,KAAK,uBAAuBD,CAAa,EACjE,GAAIC,GAAmB,KAGvB,OAAO,KAAK,4BAA4BA,CAAe,CAC3D,CAEQ,4BAA4BX,EAAqC,CACrE,OAAOM,EAAG,cAAc,CACpB,KAAM,gBAAgB,KAAK,YAAYN,CAAI,CAAC,GAC5C,WAAY,KAAK,cACrB,CAAC,CACL,CAEA,OAAc,aACVY,KACGC,EACgB,CACnB,GAAIA,EAAQ,SAAW,EACnB,MAAM,IAAI,MAAM,4BAA4B,EAGhD,IAAIC,EAAsBF,EAC1B,QAAWG,KAAUF,EACjBC,EAAUR,EAAG,aAAa,CACtB,GAAIQ,EACJ,OAAQC,EAAO,OACf,WAAYA,EAAO,WACnB,UAAWA,EAAO,SACtB,CAAC,EAEL,OAAOD,CACX,CACJ","names":["init_process","init_buffer","DynamicSnippetsGeneratorContext","_DynamicSnippetsGeneratorContext","AbstractDynamicSnippetsGeneratorContext","ir","config","__publicField","DynamicTypeMapper","DynamicTypeInstantiationMapper","FilePropertyMapper","resolveRootImportPath","typeReference","assertNever","name","endpoint","fernFilepath","parts","path","_a","go_exports","s","_b","declaration","environmentID","environmentName","baseFunc","methods","current","method"]}
@@ -0,0 +1,2 @@
1
+ import{a as P,b as T,c as S,d as b,e as a,f as p,g as l,h,i as R}from"./chunk-GUJUKQKZ.js";p();l();p();l();var y=class{constructor(){a(this,"reporter");a(this,"snippet");a(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:e,snippet:r}){this.shouldUpdate({snippet:r,reporter:e.errors})&&(this.reporter=e.errors.clone(),this.snippet=r)}getResponseOrThrow({endpoint:e}){var r;if(this.snippet!=null&&this.reporter!=null)return{snippet:this.snippet,errors:this.reporter.toDynamicSnippetErrors()};throw(r=this.err)!=null?r:new Error(`Failed to generate snippet for endpoint "${e.method} ${e.path}"`)}shouldUpdate({snippet:e,reporter:r}){var t,n;return this.reporter==null||this.reporter.size()>0&&r.size()===0?!0:e.length>((n=(t=this.snippet)==null?void 0:t.length)!=null?n:0)}};var E=class{constructor(e){a(this,"context");this.context=e}async generate(e,r={}){let t=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(t.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let n=new y;for(let i of t){let s=this.context.clone(),d=this.createSnippetGenerator(s);try{let u=await d.generateSnippet({endpoint:i,request:e,options:r});if(s.errors.empty())return{snippet:u,errors:void 0};n.update({context:s,snippet:u})}catch(u){n.err==null&&(n.err=u)}}return n.getResponseOrThrow({endpoint:e.endpoint})}generateSync(e,r={}){let t=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(t.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let n=new y;for(let i of t){let s=this.context.clone(),d=this.createSnippetGenerator(s);try{let u=d.generateSnippetSync({endpoint:i,request:e,options:r});if(s.errors.empty())return{snippet:u,errors:void 0};n.update({context:s,snippet:u})}catch(u){n.err==null&&(n.err=u)}}return n.getResponseOrThrow({endpoint:e.endpoint})}};p();l();var o={Critical:"CRITICAL",Warning:"WARNING"},v=class m{constructor(){a(this,"errors");a(this,"path");this.errors=[],this.path=[]}add(e){this.errors.push(T(P({},e),{path:[...this.path]}))}scope(e){this.path.push(e)}unscope(){this.path.pop()}getBySeverity(e){return this.errors.filter(r=>r.severity===e)}empty(){return this.errors.length===0}size(){return this.errors.length}clone(){let e=new m;return e.errors=[...this.errors],e.path=[...this.path],e}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(e=>({severity:e.severity,path:e.path!=null?this.pathToStringArray(e.path):void 0,message:e.message}))}pathToStringArray(e){let r=[];for(let t of e){if(typeof t=="string"){r.push(t);continue}r[r.length-1]+=`[${t.index}]`}return r}};p();l();p();l();p();l();var g=class{constructor(){a(this,"REFERENCE_REGEX",/^(GET|POST|PUT|DELETE|PATCH|HEAD)\s(\/\S*)$/)}validate(e){return this.REFERENCE_REGEX.test(e)?{type:"valid"}:{type:"invalid"}}tryParse(e){if(this.validate(e).type==="invalid")return;let t=e.match(this.REFERENCE_REGEX);if(!(t==null||t[1]==null||t[2]==null))return{method:t[1],path:t[2]}}};var w=class{constructor({ir:e,config:r,options:t={}}){a(this,"config");a(this,"options");a(this,"errors");a(this,"_ir");a(this,"httpEndpointReferenceParser");this._ir=e,this.config=r,this.options=t,this.errors=new v,this.httpEndpointReferenceParser=new g}associateQueryParametersByWireValue({parameters:e,values:r}){let t=[];for(let[n,i]of Object.entries(r)){this.errors.scope(n);try{let s=e.find(u=>u.name.wireValue===n);if(s==null)throw this.newParameterNotRecognizedError(n);let d=this.isListTypeReference(s.typeReference)&&!Array.isArray(i)?[i]:i;t.push({name:s.name,typeReference:s.typeReference,value:d})}finally{this.errors.unscope()}}return t}associateByWireValueOrDefault({parameters:e,values:r}){let t=[];for(let n of e){this.errors.scope(n.name.wireValue);try{let i=r[n.name.wireValue];if(i==null)if(n.typeReference.type==="primitive"&&n.typeReference.value==="STRING")i=`<${n.name.wireValue}>`;else{this.errors.add({severity:o.Critical,message:this.newParameterNotRecognizedError(n.name.wireValue).message});continue}t.push({name:n.name,typeReference:n.typeReference,value:i})}finally{this.errors.unscope()}}return t}associateByWireValue({parameters:e,values:r,ignoreMissingParameters:t}){let n=[];for(let[i,s]of Object.entries(r)){this.errors.scope(i);try{let d=e.find(u=>u.name.wireValue===i);if(d==null){if(t)continue;this.errors.add({severity:o.Critical,message:this.newParameterNotRecognizedError(i).message});continue}n.push({name:d.name,typeReference:d.typeReference,value:s})}finally{this.errors.unscope()}}return n}getExampleObjectProperties({parameters:e,snippetObject:r}){let t=typeof r=="object"&&r!==null&&!Array.isArray(r)?r:{},n=[];for(let i of e){let s=t[i.name.wireValue];s==null?i.typeReference.type==="nullable"&&n.push({name:i.name,typeReference:i.typeReference,value:null}):n.push({name:i.name,typeReference:i.typeReference,value:s})}return n}getSingleFileValue({property:e,record:r}){let t=r[e.wireValue];if(t!=null){if(typeof t!="string"){this.errors.add({severity:o.Critical,message:`Expected file value to be a string, got ${typeof t}`});return}return t}}getFileArrayValues({property:e,record:r}){let t=r[e.wireValue];if(t==null)return;if(!Array.isArray(t)){this.errors.add({severity:o.Critical,message:`Expected file array value to be an array of strings, got ${typeof t}`});return}let n=[];for(let i of t){if(typeof i!="string"){this.errors.add({severity:o.Critical,message:`Expected file array value to be an array of strings, got ${typeof i}`});return}n.push(i)}return n}getRecord(e){if(typeof e!="object"||Array.isArray(e)){this.errors.add({severity:o.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(e)?"array":typeof e}`});return}return e==null?{}:e}resolveNamedType({typeId:e}){let r=this._ir.types[e];if(r==null){this.errors.add({severity:o.Critical,message:`Type identified by "${e}" could not be found`});return}return r}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:r}){let t=this.getRecord(r);if(t==null)return;let n=e.discriminant.wireValue,i=t[n];if(i==null){this.errors.add({severity:o.Critical,message:this.newParameterNotRecognizedError(n).message});return}if(typeof i!="string"){this.errors.add({severity:o.Critical,message:`Expected discriminant value to be a string but got: ${typeof i}`});return}let s=e.types[i];if(s==null){this.errors.add({severity:o.Critical,message:`No type found for discriminant value "${i}"`});return}let x=t,{[n]:d}=x,u=b(x,[S(n)]);return{singleDiscriminatedUnionType:s,discriminantValue:s.discriminantValue,value:u}}resolveEndpointOrThrow(e){let r=this.httpEndpointReferenceParser.tryParse(e);if(r==null)throw new Error(`Failed to parse endpoint reference "${e}"`);return this.resolveEndpointLocationOrThrow(r)}resolveEndpointLocation(e){let r=[];for(let t of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:t,parsedEndpoint:e})&&r.push(t);return r}resolveEndpointLocationOrThrow(e){let r=this.resolveEndpointLocation(e);if(r.length===0)throw new Error(`Failed to find endpoint identified by "${e.method} ${e.path}"`);return r}needsRequestParameter({request:e,inlinePathParameters:r,inlineFileProperties:t}){var n;return this.includePathParametersInWrappedRequest({request:e,inlinePathParameters:r})||e.queryParameters!=null&&e.queryParameters.length>0||e.headers!=null&&e.headers.length>0?!0:e.body!=null?this.includeRequestBodyInWrappedRequest({body:e.body,inlineFileProperties:t}):!((n=e.metadata)!=null&&n.onlyPathParameters)}includePathParametersInWrappedRequest({request:e,inlinePathParameters:r}){var t,n;return r&&((n=(t=e.metadata)==null?void 0:t.includePathParameters)!=null?n:!1)}isFileUploadRequestBody(e){switch(e.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:h(e)}}resolveEnvironmentName(e){if(this._ir.environments==null)return;let r=this._ir.environments.environments;switch(r.type){case"singleBaseUrl":{let t=r.environments.find(n=>n.id===e);return t==null?void 0:t.name}case"multipleBaseUrls":{let t=r.environments.find(n=>n.id===e);return t==null?void 0:t.name}default:h(r)}}isSingleEnvironmentID(e){return typeof e=="string"}isMultiEnvironmentValues(e){return typeof e=="object"}validateMultiEnvironmentUrlValues(e){if(this._ir.environments==null)return this.errors.add({severity:o.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let r=this._ir.environments.environments;switch(r.type){case"singleBaseUrl":return this.errors.add({severity:o.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let t=r.environments[0];if(t==null)return this.errors.add({severity:o.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let n=new Set(R(t.urls));for(let i of R(e))n.has(i)&&n.delete(i);return n.size>0?(this.errors.add({severity:o.Critical,message:`The provided environments are invalid; got: [${Object.keys(e).join(", ")}], expected: [${R(t.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:e}){if(typeof e!="number"){this.errors.add({severity:o.Critical,message:this.newTypeMismatchError({expected:"number",value:e}).message});return}return e}getValueAsBoolean({value:e}){if(typeof e!="boolean"){this.errors.add({severity:o.Critical,message:this.newTypeMismatchError({expected:"boolean",value:e}).message});return}return e}getValueAsString({value:e}){if(typeof e!="string"){this.errors.add({severity:o.Critical,message:this.newTypeMismatchError({expected:"string",value:e}).message});return}return e}isOptional(e){switch(e.type){case"nullable":return this.isOptional(e.value);case"optional":return!0;case"named":{let r=this.resolveNamedType({typeId:e.value});return r==null?!1:r.type==="alias"?this.isNullable(r.typeReference):!1}}return!1}isNullable(e){switch(e.type){case"nullable":return!0;case"optional":return this.isNullable(e.value);case"named":{let r=this.resolveNamedType({typeId:e.value});return r==null?!1:r.type==="alias"?this.isNullable(r.typeReference):!1}}return!1}newAuthMismatchError({auth:e,values:r}){return new Error(`Expected auth type ${e.type}, got ${r.type}`)}newParameterNotRecognizedError(e){return new Error(`"${e}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:e,value:r}){return new Error(`Expected ${e}, got ${typeof r}`)}includeRequestBodyInWrappedRequest({body:e,inlineFileProperties:r}){switch(e.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:r});default:h(e)}}includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:r}){return this.fileUploadHasBodyProperties({fileUpload:e})||r&&this.fileUploadHasFileProperties({fileUpload:e})}fileUploadHasBodyProperties({fileUpload:e}){return e.properties.some(r=>{switch(r.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:h(r)}})}fileUploadHasFileProperties({fileUpload:e}){return e.properties.some(r=>{switch(r.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:h(r)}})}isListTypeReference(e){return e.type==="optional"?this.isListTypeReference(e.value):e.type==="list"||e.type==="set"}parsedEndpointMatches({endpoint:e,parsedEndpoint:r}){return e.location.method===r.method&&e.location.path===r.path}};p();l();var A={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};p();l();export{E as a,o as b,w as c,A as d};
2
+ //# sourceMappingURL=chunk-VCNL2JWU.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../browser-compatible-base/src/dynamic-snippets/AbstractDynamicSnippetsGenerator.ts","../../../../browser-compatible-base/src/dynamic-snippets/Result.ts","../../../../browser-compatible-base/src/dynamic-snippets/ErrorReporter.ts","../../../../browser-compatible-base/src/dynamic-snippets/AbstractDynamicSnippetsGeneratorContext.ts","../../../../../packages/cli/fern-definition/schema/src/index.ts","../../../../../packages/cli/fern-definition/schema/src/utils/HttpEndpointReferenceParser.ts","../../../../browser-compatible-base/src/dynamic-snippets/Scope.ts","../../../../browser-compatible-base/src/dynamic-snippets/index.ts"],"sourcesContent":["import { FernIr } from \"@fern-api/dynamic-ir-sdk\";\n\nimport { AbstractDynamicSnippetsGeneratorContext } from \"./AbstractDynamicSnippetsGeneratorContext\";\nimport { AbstractEndpointSnippetGenerator } from \"./AbstractEndpointSnippetGenerator\";\nimport { Options } from \"./Options\";\nimport { Result } from \"./Result\";\n\nexport abstract class AbstractDynamicSnippetsGenerator<\n Context extends AbstractDynamicSnippetsGeneratorContext,\n EndpointSnippetGenerator extends AbstractEndpointSnippetGenerator<Context>\n> {\n public constructor(public readonly context: Context) {}\n\n protected abstract createSnippetGenerator(context: Context): EndpointSnippetGenerator;\n\n public async generate(\n request: FernIr.dynamic.EndpointSnippetRequest,\n options: Options = {}\n ): Promise<FernIr.dynamic.EndpointSnippetResponse> {\n const endpoints = this.context.resolveEndpointLocationOrThrow(request.endpoint);\n if (endpoints.length === 0) {\n throw new Error(`No endpoints found that match \"${request.endpoint.method} ${request.endpoint.path}\"`);\n }\n const result = new Result();\n for (const endpoint of endpoints) {\n const context = this.context.clone() as Context;\n const snippetGenerator = this.createSnippetGenerator(context);\n try {\n const snippet = await snippetGenerator.generateSnippet({ endpoint, request, options });\n if (context.errors.empty()) {\n return {\n snippet,\n errors: undefined\n };\n }\n result.update({ context, snippet });\n } catch (error) {\n if (result.err == null) {\n result.err = error as Error;\n }\n }\n }\n return result.getResponseOrThrow({ endpoint: request.endpoint });\n }\n\n public generateSync(\n request: FernIr.dynamic.EndpointSnippetRequest,\n options: Options = {}\n ): FernIr.dynamic.EndpointSnippetResponse {\n const endpoints = this.context.resolveEndpointLocationOrThrow(request.endpoint);\n if (endpoints.length === 0) {\n throw new Error(`No endpoints found that match \"${request.endpoint.method} ${request.endpoint.path}\"`);\n }\n const result = new Result();\n for (const endpoint of endpoints) {\n const context = this.context.clone() as Context;\n const snippetGenerator = this.createSnippetGenerator(context);\n try {\n const snippet = snippetGenerator.generateSnippetSync({ endpoint, request, options });\n if (context.errors.empty()) {\n return {\n snippet,\n errors: undefined\n };\n }\n result.update({ context, snippet });\n } catch (error) {\n if (result.err == null) {\n result.err = error as Error;\n }\n }\n }\n return result.getResponseOrThrow({ endpoint: request.endpoint });\n }\n}\n","import { FernIr } from \"@fern-api/dynamic-ir-sdk\";\n\nimport { AbstractDynamicSnippetsGeneratorContext } from \"./AbstractDynamicSnippetsGeneratorContext\";\nimport { ErrorReporter } from \"./ErrorReporter\";\n\nexport class Result {\n public reporter: ErrorReporter | undefined;\n public snippet: string | undefined;\n public err: Error | undefined;\n\n constructor() {\n this.snippet = undefined;\n this.reporter = undefined;\n this.err = undefined;\n }\n\n public update({ context, snippet }: { context: AbstractDynamicSnippetsGeneratorContext; snippet: string }): void {\n if (this.shouldUpdate({ snippet, reporter: context.errors })) {\n this.reporter = context.errors.clone();\n this.snippet = snippet;\n }\n }\n\n public getResponseOrThrow({\n endpoint\n }: {\n endpoint: FernIr.dynamic.EndpointLocation;\n }): FernIr.dynamic.EndpointSnippetResponse {\n if (this.snippet != null && this.reporter != null) {\n return {\n snippet: this.snippet,\n errors: this.reporter.toDynamicSnippetErrors()\n };\n }\n throw this.err ?? new Error(`Failed to generate snippet for endpoint \"${endpoint.method} ${endpoint.path}\"`);\n }\n\n private shouldUpdate({ snippet, reporter }: { snippet: string; reporter: ErrorReporter }): boolean {\n if (this.reporter == null || (this.reporter.size() > 0 && reporter.size() === 0)) {\n return true;\n }\n return snippet.length > (this.snippet?.length ?? 0);\n }\n}\n","export const Severity = {\n Critical: \"CRITICAL\",\n Warning: \"WARNING\"\n} as const;\n\nexport declare namespace ErrorReporter {\n type Path = readonly PathItem[];\n\n type PathItem = string | ArrayPathItem;\n\n type Severity = (typeof Severity)[keyof typeof Severity];\n\n interface ArrayPathItem {\n index: number;\n }\n\n interface Error {\n path?: Path;\n severity: Severity;\n message: string;\n }\n}\n\ninterface Error_ {\n severity: \"CRITICAL\" | \"WARNING\";\n path: string[] | undefined;\n message: string;\n}\n\nexport class ErrorReporter {\n private errors: ErrorReporter.Error[];\n private path: ErrorReporter.PathItem[];\n\n constructor() {\n this.errors = [];\n this.path = [];\n }\n\n public add(err: Omit<ErrorReporter.Error, \"path\">): void {\n this.errors.push({\n ...err,\n path: [...this.path]\n });\n }\n\n public scope(path: ErrorReporter.PathItem): void {\n this.path.push(path);\n }\n\n public unscope(): void {\n this.path.pop();\n }\n\n public getBySeverity(severity: ErrorReporter.Severity): ErrorReporter.Error[] {\n return this.errors.filter((err) => err.severity === severity);\n }\n\n public empty(): boolean {\n return this.errors.length === 0;\n }\n\n public size(): number {\n return this.errors.length;\n }\n\n public clone(): ErrorReporter {\n const clone = new ErrorReporter();\n clone.errors = [...this.errors];\n clone.path = [...this.path];\n return clone;\n }\n\n public reset(): void {\n this.errors = [];\n this.path = [];\n }\n\n public toDynamicSnippetErrors(): Error_[] {\n return this.errors.map((err) => ({\n severity: err.severity,\n path: err.path != null ? this.pathToStringArray(err.path) : undefined,\n message: err.message\n }));\n }\n\n private pathToStringArray(path: ErrorReporter.Path): string[] {\n const result: string[] = [];\n for (const item of path) {\n if (typeof item === \"string\") {\n result.push(item);\n continue;\n }\n result[result.length - 1] += `[${item.index}]`;\n }\n return result;\n }\n}\n","import { assertNever, keys } from \"@fern-api/core-utils\";\nimport { FernIr } from \"@fern-api/dynamic-ir-sdk\";\nimport { HttpEndpointReferenceParser } from \"@fern-api/fern-definition-schema\";\n\nimport { FernGeneratorExec } from \"../GeneratorNotificationService\";\nimport { DiscriminatedUnionTypeInstance } from \"./DiscriminatedUnionTypeInstance\";\nimport { ErrorReporter, Severity } from \"./ErrorReporter\";\nimport { Options } from \"./Options\";\nimport { TypeInstance } from \"./TypeInstance\";\n\nexport abstract class AbstractDynamicSnippetsGeneratorContext {\n public config: FernGeneratorExec.GeneratorConfig;\n public options: Options;\n public errors: ErrorReporter;\n\n private _ir: FernIr.dynamic.DynamicIntermediateRepresentation;\n private httpEndpointReferenceParser: HttpEndpointReferenceParser;\n\n constructor({\n ir,\n config,\n options = {}\n }: {\n ir: FernIr.dynamic.DynamicIntermediateRepresentation;\n config: FernGeneratorExec.GeneratorConfig;\n options?: Options;\n }) {\n this._ir = ir;\n this.config = config;\n this.options = options;\n this.errors = new ErrorReporter();\n this.httpEndpointReferenceParser = new HttpEndpointReferenceParser();\n }\n\n public abstract clone(): AbstractDynamicSnippetsGeneratorContext;\n\n public associateQueryParametersByWireValue({\n parameters,\n values\n }: {\n parameters: FernIr.dynamic.NamedParameter[];\n values: FernIr.dynamic.Values;\n }): TypeInstance[] {\n const instances: TypeInstance[] = [];\n for (const [key, value] of Object.entries(values)) {\n this.errors.scope(key);\n try {\n const parameter = parameters.find((param) => param.name.wireValue === key);\n if (parameter == null) {\n throw this.newParameterNotRecognizedError(key);\n }\n // If this query parameter supports allow-multiple, the user-provided values\n // must be wrapped in an array.\n const typeInstanceValue =\n this.isListTypeReference(parameter.typeReference) && !Array.isArray(value) ? [value] : value;\n instances.push({\n name: parameter.name,\n typeReference: parameter.typeReference,\n value: typeInstanceValue\n });\n } finally {\n this.errors.unscope();\n }\n }\n return instances;\n }\n\n public associateByWireValueOrDefault({\n parameters,\n values\n }: {\n parameters: FernIr.dynamic.NamedParameter[];\n values: FernIr.dynamic.Values;\n }): TypeInstance[] {\n const instances: TypeInstance[] = [];\n for (const parameter of parameters) {\n this.errors.scope(parameter.name.wireValue);\n try {\n let value = values[parameter.name.wireValue];\n\n if (value == null) {\n if (parameter.typeReference.type === \"primitive\" && parameter.typeReference.value === \"STRING\") {\n // synthesize a parameter value for string parameters that are missing data\n value = `<${parameter.name.wireValue}>`;\n } else {\n this.errors.add({\n severity: Severity.Critical,\n message: this.newParameterNotRecognizedError(parameter.name.wireValue).message\n });\n continue;\n }\n }\n\n instances.push({\n name: parameter.name,\n typeReference: parameter.typeReference,\n value\n });\n } finally {\n this.errors.unscope();\n }\n }\n\n return instances;\n }\n\n public associateByWireValue({\n parameters,\n values,\n ignoreMissingParameters\n }: {\n parameters: FernIr.dynamic.NamedParameter[];\n values: FernIr.dynamic.Values;\n ignoreMissingParameters?: boolean;\n }): TypeInstance[] {\n const instances: TypeInstance[] = [];\n for (const [key, value] of Object.entries(values)) {\n this.errors.scope(key);\n try {\n const parameter = parameters.find((param) => param.name.wireValue === key);\n if (parameter == null) {\n if (ignoreMissingParameters) {\n // Required for request payloads that include more information than\n // just the target parameters (e.g. union base properties).\n continue;\n }\n this.errors.add({\n severity: Severity.Critical,\n message: this.newParameterNotRecognizedError(key).message\n });\n continue;\n }\n instances.push({\n name: parameter.name,\n typeReference: parameter.typeReference,\n value\n });\n } finally {\n this.errors.unscope();\n }\n }\n return instances;\n }\n\n /**\n * Similar to `associateByWireValue` but it builds TypeInstance objects by iterating over schema parameters rather\n * than snippet values. Skips non-nullable parameters that are missing from the snippet object.\n */\n public getExampleObjectProperties({\n parameters,\n snippetObject\n }: {\n parameters: FernIr.dynamic.NamedParameter[];\n snippetObject: unknown;\n }): TypeInstance[] {\n const objectRecord = (\n typeof snippetObject === \"object\" && snippetObject !== null && !Array.isArray(snippetObject)\n ? snippetObject\n : {}\n ) as Record<string, unknown>;\n const instances: TypeInstance[] = [];\n for (const parameter of parameters) {\n const value = objectRecord[parameter.name.wireValue];\n if (value == null) {\n if (parameter.typeReference.type === \"nullable\") {\n instances.push({\n name: parameter.name,\n typeReference: parameter.typeReference,\n value: null\n });\n }\n } else {\n instances.push({\n name: parameter.name,\n typeReference: parameter.typeReference,\n value\n });\n }\n }\n return instances;\n }\n\n public getSingleFileValue({\n property,\n record\n }: {\n property: FernIr.dynamic.FileUploadRequestBodyProperty.File_;\n record: Record<string, unknown>;\n }): string | undefined {\n const fileValue = record[property.wireValue];\n if (fileValue == null) {\n return undefined;\n }\n if (typeof fileValue !== \"string\") {\n this.errors.add({\n severity: Severity.Critical,\n message: `Expected file value to be a string, got ${typeof fileValue}`\n });\n return undefined;\n }\n return fileValue;\n }\n\n public getFileArrayValues({\n property,\n record\n }: {\n property: FernIr.dynamic.FileUploadRequestBodyProperty.FileArray;\n record: Record<string, unknown>;\n }): string[] | undefined {\n const fileArrayValue = record[property.wireValue];\n if (fileArrayValue == null) {\n return undefined;\n }\n if (!Array.isArray(fileArrayValue)) {\n this.errors.add({\n severity: Severity.Critical,\n message: `Expected file array value to be an array of strings, got ${typeof fileArrayValue}`\n });\n return undefined;\n }\n const stringValues: string[] = [];\n for (const value of fileArrayValue) {\n if (typeof value !== \"string\") {\n this.errors.add({\n severity: Severity.Critical,\n message: `Expected file array value to be an array of strings, got ${typeof value}`\n });\n return undefined;\n }\n stringValues.push(value);\n }\n return stringValues;\n }\n\n public getRecord(value: unknown): Record<string, unknown> | undefined {\n if (typeof value !== \"object\" || Array.isArray(value)) {\n this.errors.add({\n severity: Severity.Critical,\n message: `Expected object with key, value pairs but got: ${\n Array.isArray(value) ? \"array\" : typeof value\n }`\n });\n return undefined;\n }\n if (value == null) {\n return {};\n }\n return value as Record<string, unknown>;\n }\n\n public resolveNamedType({ typeId }: { typeId: FernIr.dynamic.TypeId }): FernIr.dynamic.NamedType | undefined {\n const namedType = this._ir.types[typeId];\n if (namedType == null) {\n this.errors.add({\n severity: Severity.Critical,\n message: `Type identified by \"${typeId}\" could not be found`\n });\n return undefined;\n }\n return namedType;\n }\n\n public resolveDiscriminatedUnionTypeInstance({\n discriminatedUnion,\n value\n }: {\n discriminatedUnion: FernIr.dynamic.DiscriminatedUnionType;\n value: unknown;\n }): DiscriminatedUnionTypeInstance | undefined {\n const record = this.getRecord(value);\n if (record == null) {\n return undefined;\n }\n\n const discriminantFieldName = discriminatedUnion.discriminant.wireValue;\n const discriminantValue = record[discriminantFieldName];\n if (discriminantValue == null) {\n this.errors.add({\n severity: Severity.Critical,\n message: this.newParameterNotRecognizedError(discriminantFieldName).message\n });\n return undefined;\n }\n if (typeof discriminantValue !== \"string\") {\n this.errors.add({\n severity: Severity.Critical,\n message: `Expected discriminant value to be a string but got: ${typeof discriminantValue}`\n });\n return undefined;\n }\n\n const singleDiscriminatedUnionType = discriminatedUnion.types[discriminantValue];\n if (singleDiscriminatedUnionType == null) {\n this.errors.add({\n severity: Severity.Critical,\n message: `No type found for discriminant value \"${discriminantValue}\"`\n });\n return undefined;\n }\n\n // Remove the discriminant from the record so that the value is valid for the type.\n const { [discriminantFieldName]: _, ...filtered } = record;\n\n return {\n singleDiscriminatedUnionType,\n discriminantValue: singleDiscriminatedUnionType.discriminantValue,\n value: filtered\n };\n }\n\n public resolveEndpointOrThrow(rawEndpoint: string): FernIr.dynamic.Endpoint[] {\n const parsedEndpoint = this.httpEndpointReferenceParser.tryParse(rawEndpoint);\n if (parsedEndpoint == null) {\n throw new Error(`Failed to parse endpoint reference \"${rawEndpoint}\"`);\n }\n return this.resolveEndpointLocationOrThrow(parsedEndpoint);\n }\n\n public resolveEndpointLocation(location: FernIr.dynamic.EndpointLocation): FernIr.dynamic.Endpoint[] {\n const endpoints: FernIr.dynamic.Endpoint[] = [];\n for (const endpoint of Object.values(this._ir.endpoints)) {\n if (this.parsedEndpointMatches({ endpoint, parsedEndpoint: location })) {\n endpoints.push(endpoint);\n }\n }\n\n return endpoints;\n }\n\n public resolveEndpointLocationOrThrow(location: FernIr.dynamic.EndpointLocation): FernIr.dynamic.Endpoint[] {\n const endpoints = this.resolveEndpointLocation(location);\n if (endpoints.length === 0) {\n throw new Error(`Failed to find endpoint identified by \"${location.method} ${location.path}\"`);\n }\n return endpoints;\n }\n\n public needsRequestParameter({\n request,\n inlinePathParameters,\n inlineFileProperties\n }: {\n request: FernIr.dynamic.InlinedRequest;\n inlinePathParameters: boolean;\n inlineFileProperties: boolean;\n }): boolean {\n if (this.includePathParametersInWrappedRequest({ request, inlinePathParameters })) {\n return true;\n }\n if (request.queryParameters != null && request.queryParameters.length > 0) {\n return true;\n }\n if (request.headers != null && request.headers.length > 0) {\n return true;\n }\n if (request.body != null) {\n return this.includeRequestBodyInWrappedRequest({ body: request.body, inlineFileProperties });\n }\n if (request.metadata?.onlyPathParameters) {\n return false;\n }\n return true;\n }\n\n public includePathParametersInWrappedRequest({\n request,\n inlinePathParameters\n }: {\n request: FernIr.dynamic.InlinedRequest;\n inlinePathParameters: boolean;\n }): boolean {\n return inlinePathParameters && (request.metadata?.includePathParameters ?? false);\n }\n\n public isFileUploadRequestBody(\n body: FernIr.dynamic.InlinedRequestBody\n ): body is FernIr.dynamic.InlinedRequestBody.FileUpload {\n switch (body.type) {\n case \"fileUpload\":\n return true;\n case \"properties\":\n case \"referenced\":\n return false;\n default:\n assertNever(body);\n }\n }\n\n public resolveEnvironmentName(environmentID: string): FernIr.Name | undefined {\n if (this._ir.environments == null) {\n return undefined;\n }\n const environments = this._ir.environments.environments;\n switch (environments.type) {\n case \"singleBaseUrl\": {\n const environment = environments.environments.find((env) => env.id === environmentID);\n if (environment == null) {\n return undefined;\n }\n return environment.name;\n }\n case \"multipleBaseUrls\": {\n const environment = environments.environments.find((env) => env.id === environmentID);\n if (environment == null) {\n return undefined;\n }\n return environment.name;\n }\n default:\n assertNever(environments);\n }\n }\n\n public isSingleEnvironmentID(\n environment: FernIr.dynamic.EnvironmentValues\n ): environment is FernIr.dynamic.EnvironmentId {\n return typeof environment === \"string\";\n }\n\n public isMultiEnvironmentValues(\n environment: FernIr.dynamic.EnvironmentValues\n ): environment is FernIr.dynamic.MultipleEnvironmentUrlValues {\n return typeof environment === \"object\";\n }\n\n public validateMultiEnvironmentUrlValues(\n multiEnvironmentUrlValues: FernIr.dynamic.MultipleEnvironmentUrlValues\n ): boolean {\n if (this._ir.environments == null) {\n this.errors.add({\n severity: Severity.Critical,\n message:\n \"Multiple environments are not supported for single base URL environments; use the baseUrl option instead\"\n });\n return false;\n }\n const environments = this._ir.environments.environments;\n switch (environments.type) {\n case \"singleBaseUrl\": {\n this.errors.add({\n severity: Severity.Critical,\n message:\n \"Multiple environments are not supported for single base URL environments; use the baseUrl option instead\"\n });\n return false;\n }\n case \"multipleBaseUrls\": {\n const firstEnvironment = environments.environments[0];\n if (firstEnvironment == null) {\n this.errors.add({\n severity: Severity.Critical,\n message: \"Multiple environments are not supported; use the baseUrl option instead\"\n });\n return false;\n }\n const expectedKeys = new Set(keys(firstEnvironment.urls));\n for (const key of keys(multiEnvironmentUrlValues)) {\n if (expectedKeys.has(key)) {\n expectedKeys.delete(key);\n }\n }\n if (expectedKeys.size > 0) {\n this.errors.add({\n severity: Severity.Critical,\n message: `The provided environments are invalid; got: [${Object.keys(multiEnvironmentUrlValues).join(\", \")}], expected: [${keys(firstEnvironment.urls).join(\", \")}]`\n });\n return false;\n }\n return true;\n }\n }\n }\n\n public getValueAsNumber({ value }: { value: unknown }): number | undefined {\n if (typeof value !== \"number\") {\n this.errors.add({\n severity: Severity.Critical,\n message: this.newTypeMismatchError({ expected: \"number\", value }).message\n });\n return undefined;\n }\n return value;\n }\n\n public getValueAsBoolean({ value }: { value: unknown }): boolean | undefined {\n if (typeof value !== \"boolean\") {\n this.errors.add({\n severity: Severity.Critical,\n message: this.newTypeMismatchError({ expected: \"boolean\", value }).message\n });\n return undefined;\n }\n return value;\n }\n\n public getValueAsString({ value }: { value: unknown }): string | undefined {\n if (typeof value !== \"string\") {\n this.errors.add({\n severity: Severity.Critical,\n message: this.newTypeMismatchError({ expected: \"string\", value }).message\n });\n return undefined;\n }\n return value;\n }\n\n public isOptional(typeReference: FernIr.dynamic.TypeReference): boolean {\n switch (typeReference.type) {\n case \"nullable\":\n return this.isOptional(typeReference.value);\n case \"optional\":\n return true;\n case \"named\": {\n const resolvedType = this.resolveNamedType({ typeId: typeReference.value });\n if (resolvedType == null) {\n return false;\n }\n if (resolvedType.type === \"alias\") {\n return this.isNullable(resolvedType.typeReference);\n }\n return false;\n }\n }\n return false;\n }\n\n public isNullable(typeReference: FernIr.dynamic.TypeReference): boolean {\n switch (typeReference.type) {\n case \"nullable\":\n return true;\n case \"optional\":\n return this.isNullable(typeReference.value);\n case \"named\": {\n const resolvedType = this.resolveNamedType({ typeId: typeReference.value });\n if (resolvedType == null) {\n return false;\n }\n if (resolvedType.type === \"alias\") {\n return this.isNullable(resolvedType.typeReference);\n }\n return false;\n }\n }\n return false;\n }\n\n public newAuthMismatchError({\n auth,\n values\n }: {\n auth: FernIr.dynamic.Auth;\n values: FernIr.dynamic.AuthValues;\n }): Error {\n return new Error(`Expected auth type ${auth.type}, got ${values.type}`);\n }\n\n public newParameterNotRecognizedError(parameterName: string): Error {\n return new Error(`\"${parameterName}\" is not a recognized parameter for this endpoint`);\n }\n\n public newTypeMismatchError({ expected, value }: { expected: string; value: unknown }): Error {\n return new Error(`Expected ${expected}, got ${typeof value}`);\n }\n\n private includeRequestBodyInWrappedRequest({\n body,\n inlineFileProperties\n }: {\n body: FernIr.dynamic.InlinedRequestBody;\n inlineFileProperties: boolean;\n }): boolean {\n switch (body.type) {\n case \"properties\":\n case \"referenced\":\n return true;\n case \"fileUpload\":\n return this.includeFileUploadBodyInWrappedRequest({ fileUpload: body, inlineFileProperties });\n default:\n assertNever(body);\n }\n }\n\n private includeFileUploadBodyInWrappedRequest({\n fileUpload,\n inlineFileProperties\n }: {\n fileUpload: FernIr.dynamic.FileUploadRequestBody;\n inlineFileProperties: boolean;\n }): boolean {\n return (\n this.fileUploadHasBodyProperties({ fileUpload }) ||\n (inlineFileProperties && this.fileUploadHasFileProperties({ fileUpload }))\n );\n }\n\n private fileUploadHasBodyProperties({ fileUpload }: { fileUpload: FernIr.dynamic.FileUploadRequestBody }): boolean {\n return fileUpload.properties.some((property) => {\n switch (property.type) {\n case \"file\":\n case \"fileArray\":\n return false;\n case \"bodyProperty\":\n return true;\n default:\n assertNever(property);\n }\n });\n }\n\n private fileUploadHasFileProperties({ fileUpload }: { fileUpload: FernIr.dynamic.FileUploadRequestBody }): boolean {\n return fileUpload.properties.some((property) => {\n switch (property.type) {\n case \"file\":\n case \"fileArray\":\n return true;\n case \"bodyProperty\":\n return false;\n default:\n assertNever(property);\n }\n });\n }\n\n private isListTypeReference(typeReference: FernIr.dynamic.TypeReference): boolean {\n if (typeReference.type === \"optional\") {\n return this.isListTypeReference(typeReference.value);\n }\n return typeReference.type === \"list\" || typeReference.type === \"set\";\n }\n\n private parsedEndpointMatches({\n endpoint,\n parsedEndpoint\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n parsedEndpoint: HttpEndpointReferenceParser.Parsed;\n }): boolean {\n return endpoint.location.method === parsedEndpoint.method && endpoint.location.path === parsedEndpoint.path;\n }\n}\n","export { EXAMPLE_REFERENCE_PREFIX, YAML_SCHEMA_VERSION } from \"./constants\";\nexport { type NodePath, type NodePathItem } from \"./NodePath\";\nexport * as RawSchemas from \"./schemas\";\nexport { type DefinitionFileSchema, type PackageMarkerFileSchema, type RootApiFileSchema } from \"./schemas\";\nexport * from \"./utils/auth\";\nexport * from \"./utils/generics\";\nexport { getRequestBody } from \"./utils/getRequestBody\";\nexport { getResponseBodyType } from \"./utils/getResponseBodyType\";\nexport { HttpEndpointReferenceParser } from \"./utils/HttpEndpointReferenceParser\";\nexport { isInlineRequestBody } from \"./utils/isInlineRequestBody\";\nexport { isOpenApiSourceSchema } from \"./utils/isOpenApiSourceSchema\";\nexport { isRawProtobufSourceSchema } from \"./utils/isRawProtobufSourceSchema\";\nexport { isRawTextType } from \"./utils/isRawTextType\";\nexport { type BytesRequest, parseBytesRequest } from \"./utils/parseBytesRequest\";\nexport { parseFileUploadRequest, type RawFileUploadRequest } from \"./utils/parseFileUploadRequest\";\nexport { parseRawBytesType, type RawBytesType } from \"./utils/parseRawBytesType\";\nexport { parseRawFileType, type RawFileType } from \"./utils/parseRawFileType\";\nexport { parseRawTextType, type RawTextType } from \"./utils/parseRawTextType\";\nexport { RawPrimitiveType } from \"./utils/RawPrimitiveType\";\nexport { recursivelyVisitRawTypeReference } from \"./utils/recursivelyVisitRawTypeReference\";\nexport { visitExampleCodeSampleSchema } from \"./utils/visitExampleCodeSampleSchema\";\nexport { type ExampleResponseSchemaVisitor, visitExampleResponseSchema } from \"./utils/visitExampleResponseSchema\";\nexport { isAnyAuthSchemes, isSingleAuthScheme, type RawApiAuthVisitor, visitRawApiAuth } from \"./utils/visitRawApiAuth\";\nexport {\n type AuthSchemeDeclarationVisitor,\n isHeaderAuthScheme,\n visitRawAuthSchemeDeclaration\n} from \"./utils/visitRawAuthSchemeDeclaration\";\nexport {\n isRawMultipleBaseUrlsEnvironment,\n isRawSingleBaseUrlEnvironment,\n visitRawEnvironmentDeclaration\n} from \"./utils/visitRawEnvironmentDeclaration\";\nexport {\n isVariablePathParameter,\n type PathParameterDeclarationVisitor,\n visitRawPathParameter\n} from \"./utils/visitRawPathParameter\";\nexport {\n isRawAliasDefinition,\n isRawDiscriminatedUnionDefinition,\n isRawEnumDefinition,\n isRawObjectDefinition,\n isRawUndiscriminatedUnionDefinition,\n type RawTypeDeclarationVisitor,\n visitRawTypeDeclaration\n} from \"./utils/visitRawTypeDeclaration\";\nexport { FernContainerRegex, visitRawTypeReference } from \"./utils/visitRawTypeReference\";\n","export declare namespace HttpEndpointReferenceParser {\n interface Parsed {\n path: string;\n method: Method;\n }\n\n type Method = \"GET\" | \"POST\" | \"PUT\" | \"DELETE\" | \"PATCH\" | \"HEAD\";\n\n export type ValidationResult = Valid | Invalid;\n\n interface Valid {\n type: \"valid\";\n }\n\n interface Invalid {\n type: \"invalid\";\n }\n}\n\n/**\n * Parses an HTTP endpoint reference like `POST /users/get`\n */\nexport class HttpEndpointReferenceParser {\n //eslint-disable-next-line\n private REFERENCE_REGEX = /^(GET|POST|PUT|DELETE|PATCH|HEAD)\\s(\\/\\S*)$/;\n\n public validate(reference: string): HttpEndpointReferenceParser.ValidationResult {\n const validFormat = this.REFERENCE_REGEX.test(reference);\n if (!validFormat) {\n return { type: \"invalid\" };\n }\n return { type: \"valid\" };\n }\n\n public tryParse(reference: string): HttpEndpointReferenceParser.Parsed | undefined {\n const validationResponse = this.validate(reference);\n if (validationResponse.type === \"invalid\") {\n return undefined;\n }\n const match = reference.match(this.REFERENCE_REGEX);\n if (match == null || match[1] == null || match[2] == null) {\n return undefined;\n }\n return {\n method: match[1] as HttpEndpointReferenceParser.Method,\n path: match[2]\n };\n }\n}\n","export const Scope = {\n PathParameters: \"pathParameters\",\n QueryParameters: \"queryParameters\",\n Headers: \"headers\",\n RequestBody: \"requestBody\"\n} as const;\n\nexport type Scope = (typeof Scope)[keyof typeof Scope];\n","export { AbstractDynamicSnippetsGenerator } from \"./AbstractDynamicSnippetsGenerator\";\nexport { AbstractDynamicSnippetsGeneratorContext } from \"./AbstractDynamicSnippetsGeneratorContext\";\nexport { type DiscriminatedUnionTypeInstance } from \"./DiscriminatedUnionTypeInstance\";\nexport { ErrorReporter, Severity } from \"./ErrorReporter\";\nexport { type Options, Style } from \"./Options\";\nexport { Result } from \"./Result\";\nexport { Scope } from \"./Scope\";\nexport { type TypeInstance } from \"./TypeInstance\";\nexport { DynamicSnippetsTestRunner } from \"./test-utils/DynamicSnippetsTestRunner\";\n"],"mappings":"2FAKAA,IAAAC,ICAAC,IAAAC,IAAM,IAAOC,EAAP,KAAa,CAKf,aAAA,CAJOC,EAAA,iBACAA,EAAA,gBACAA,EAAA,YAGH,KAAK,QAAU,OACf,KAAK,SAAW,OAChB,KAAK,IAAM,MACf,CAEO,OAAO,CAAE,QAAAC,EAAS,QAAAC,CAAO,EAAyE,CACjG,KAAK,aAAa,CAAE,QAAAA,EAAS,SAAUD,EAAQ,MAAM,CAAE,IACvD,KAAK,SAAWA,EAAQ,OAAO,MAAK,EACpC,KAAK,QAAUC,EAEvB,CAEO,mBAAmB,CACtB,SAAAC,CAAQ,EAGX,CAtBL,IAAAC,EAuBQ,GAAI,KAAK,SAAW,MAAQ,KAAK,UAAY,KACzC,MAAO,CACH,QAAS,KAAK,QACd,OAAQ,KAAK,SAAS,uBAA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EAAYD,CAAI,CACxB,CACJ,CAEQ,sCAAsC,CAC1C,WAAAe,EACA,qBAAAjB,CAAoB,EAIvB,CACG,OACI,KAAK,4BAA4B,CAAE,WAAAiB,CAAU,CAAE,GAC9CjB,GAAwB,KAAK,4BAA4B,CAAE,WAAAiB,CAAU,CAAE,CAEhF,CAEQ,4BAA4B,CAAE,WAAAA,CAAU,EAAwD,CACpG,OAAOA,EAAW,WAAW,KAAMxC,GAAY,CAC3C,OAAQA,EAAS,KAAM,CACnB,IAAK,OACL,IAAK,YACD,MAAO,GACX,IAAK,eACD,MAAO,GACX,QACI0B,EAAY1B,CAAQ,CAC5B,CACJ,CAAC,CACL,CAEQ,4BAA4B,CAAE,WAAAwC,CAAU,EAAwD,CACpG,OAAOA,EAAW,WAAW,KAAMxC,GAAY,CAC3C,OAAQA,EAAS,KAAM,CACnB,IAAK,OACL,IAAK,YACD,MAAO,GACX,IAAK,eACD,MAAO,GACX,QACI0B,EAAY1B,CAAQ,CAC5B,CACJ,CAAC,CACL,CAEQ,oBAAoBmC,EAA2C,CACnE,OAAIA,EAAc,OAAS,WAChB,KAAK,oBAAoBA,EAAc,KAAK,EAEhDA,EAAc,OAAS,QAAUA,EAAc,OAAS,KACnE,CAEQ,sBAAsB,CAC1B,SAAAf,EACA,eAAAH,CAAc,EAIjB,CACG,OAAOG,EAAS,SAAS,SAAWH,EAAe,QAAUG,EAAS,SAAS,OAASH,EAAe,IAC3G,GG/nBJwB,IAAAC,IAAO,IAAMC,EAAQ,CACjB,eAAgB,iBAChB,gBAAiB,kBACjB,QAAS,UACT,YAAa,eCJjBC,IAAAC","names":["init_process","init_buffer","init_process","init_buffer","Result","__publicField","context","snippet","endpoint","_a","reporter","_b","AbstractDynamicSnippetsGenerator","context","__publicField","request","options","endpoints","result","Result","endpoint","snippetGenerator","snippet","error","init_process","init_buffer","Severity","ErrorReporter","_ErrorReporter","__publicField","err","__spreadProps","__spreadValues","path","severity","clone","result","item","init_process","init_buffer","init_process","init_buffer","init_process","init_buffer","HttpEndpointReferenceParser","__publicField","reference","match","AbstractDynamicSnippetsGeneratorContext","ir","config","options","__publicField","ErrorReporter","HttpEndpointReferenceParser","parameters","values","instances","key","value","parameter","param","typeInstanceValue","Severity","ignoreMissingParameters","snippetObject","objectRecord","property","record","fileValue","fileArrayValue","stringValues","typeId","namedType","discriminatedUnion","discriminantFieldName","discriminantValue","singleDiscriminatedUnionType","_a","_","filtered","__objRest","__restKey","rawEndpoint","parsedEndpoint","location","endpoints","endpoint","request","inlinePathParameters","inlineFileProperties","_b","body","assertNever","environmentID","environments","environment","env","multiEnvironmentUrlValues","firstEnvironment","expectedKeys","keys","typeReference","resolvedType","auth","parameterName","expected","fileUpload","init_process","init_buffer","Scope","init_process","init_buffer"]}
@@ -1,4 +1,4 @@
1
1
  import '@fern-api/browser-compatible-base-generator';
2
2
  import '@fern-api/dynamic-ir-sdk';
3
3
  import '@fern-api/go-ast';
4
- export { D as DynamicSnippetsGeneratorContext } from '../DynamicSnippetsGeneratorContext-CpOvS1wA.js';
4
+ export { D as DynamicSnippetsGeneratorContext } from '../DynamicSnippetsGeneratorContext-BusKoNq4.js';
@@ -1 +1,2 @@
1
- import{a}from"../chunk-LZIEHSJ7.js";import"../chunk-IYOA724T.js";import"../chunk-EQTG6W6V.js";import"../chunk-RX5QSNXP.js";import"../chunk-55JFNSPF.js";import"../chunk-XL5OWIY6.js";export{a as DynamicSnippetsGeneratorContext};
1
+ import{a}from"../chunk-UZEM7EUP.js";import"../chunk-FD44EP2P.js";import"../chunk-VCNL2JWU.js";import"../chunk-Q6YO7G6Y.js";import"../chunk-2YRGTA73.js";import"../chunk-GUJUKQKZ.js";export{a as DynamicSnippetsGeneratorContext};
2
+ //# sourceMappingURL=DynamicSnippetsGeneratorContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,4 +1,4 @@
1
1
  import '@fern-api/dynamic-ir-sdk';
2
2
  import '@fern-api/go-ast';
3
- export { a as DynamicTypeInstantiationMapper } from '../DynamicSnippetsGeneratorContext-CpOvS1wA.js';
3
+ export { a as DynamicTypeInstantiationMapper } from '../DynamicSnippetsGeneratorContext-BusKoNq4.js';
4
4
  import '@fern-api/browser-compatible-base-generator';
@@ -1 +1,2 @@
1
- import{a}from"../chunk-IYOA724T.js";import"../chunk-EQTG6W6V.js";import"../chunk-XL5OWIY6.js";export{a as DynamicTypeInstantiationMapper};
1
+ import{a}from"../chunk-FD44EP2P.js";import"../chunk-VCNL2JWU.js";import"../chunk-GUJUKQKZ.js";export{a as DynamicTypeInstantiationMapper};
2
+ //# sourceMappingURL=DynamicTypeInstantiationMapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,4 +1,4 @@
1
1
  import '@fern-api/dynamic-ir-sdk';
2
2
  import '@fern-api/go-ast';
3
- export { b as DynamicTypeMapper } from '../DynamicSnippetsGeneratorContext-CpOvS1wA.js';
3
+ export { b as DynamicTypeMapper } from '../DynamicSnippetsGeneratorContext-BusKoNq4.js';
4
4
  import '@fern-api/browser-compatible-base-generator';
@@ -1 +1,2 @@
1
- import{a}from"../chunk-RX5QSNXP.js";import"../chunk-XL5OWIY6.js";export{a as DynamicTypeMapper};
1
+ import{a}from"../chunk-Q6YO7G6Y.js";import"../chunk-GUJUKQKZ.js";export{a as DynamicTypeMapper};
2
+ //# sourceMappingURL=DynamicTypeMapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,4 +1,4 @@
1
1
  import '@fern-api/dynamic-ir-sdk';
2
2
  import '@fern-api/go-ast';
3
- export { F as FilePropertyInfo, c as FilePropertyMapper } from '../DynamicSnippetsGeneratorContext-CpOvS1wA.js';
3
+ export { F as FilePropertyInfo, c as FilePropertyMapper } from '../DynamicSnippetsGeneratorContext-BusKoNq4.js';
4
4
  import '@fern-api/browser-compatible-base-generator';
@@ -1 +1,2 @@
1
- import{a}from"../chunk-55JFNSPF.js";import"../chunk-XL5OWIY6.js";export{a as FilePropertyMapper};
1
+ import{a}from"../chunk-2YRGTA73.js";import"../chunk-GUJUKQKZ.js";export{a as FilePropertyMapper};
2
+ //# sourceMappingURL=FilePropertyMapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/esm/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { DynamicSnippetsGenerator } from './DynamicSnippetsGenerator.js';
2
2
  import '@fern-api/browser-compatible-base-generator';
3
3
  import '@fern-api/dynamic-ir-sdk';
4
- import './EndpointSnippetGenerator.js';
5
- import './DynamicSnippetsGeneratorContext-CpOvS1wA.js';
4
+ import './DynamicSnippetsGeneratorContext-BusKoNq4.js';
6
5
  import '@fern-api/go-ast';
6
+ import './EndpointSnippetGenerator.js';
package/esm/index.js CHANGED
@@ -1,13 +1,2 @@
1
- import{a as yu}from"./chunk-SX53R7DQ.js";import"./chunk-H7X5SHRQ.js";import"./chunk-LZIEHSJ7.js";import"./chunk-IYOA724T.js";import"./chunk-EQTG6W6V.js";import"./chunk-RX5QSNXP.js";import"./chunk-55JFNSPF.js";import{e as be,f as l,g as su,h as lu,i as cu,k as o,l as p,m as i}from"./chunk-XL5OWIY6.js";var Lt=l((Ql,kt)=>{"use strict";o();i();var vu="Function.prototype.bind called on incompatible ",gu=Object.prototype.toString,du=Math.max,hu="[object Function]",Wt=function(r,t){for(var n=[],a=0;a<r.length;a+=1)n[a]=r[a];for(var u=0;u<t.length;u+=1)n[u+r.length]=t[u];return n},mu=function(r,t){for(var n=[],a=t||0,u=0;a<r.length;a+=1,u+=1)n[u]=r[a];return n},bu=function(e,r){for(var t="",n=0;n<e.length;n+=1)t+=e[n],n+1<e.length&&(t+=r);return t};kt.exports=function(r){var t=this;if(typeof t!="function"||gu.apply(t)!==hu)throw new TypeError(vu+t);for(var n=mu(arguments,1),a,u=function(){if(this instanceof a){var g=t.apply(this,Wt(n,arguments));return Object(g)===g?g:this}return t.apply(r,Wt(n,arguments))},f=du(0,t.length-n.length),c=[],y=0;y<f;y++)c[y]="$"+y;if(a=Function("binder","return function ("+bu(c,",")+"){ return binder.apply(this,arguments); }")(u),t.prototype){var h=function(){};h.prototype=t.prototype,a.prototype=new h,h.prototype=null}return a}});var L=l((rc,zt)=>{"use strict";o();i();var Su=Lt();zt.exports=Function.prototype.bind||Su});var Se=l((nc,Jt)=>{"use strict";o();i();Jt.exports=Error});var Ae=l((ac,Ht)=>{"use strict";o();i();Ht.exports=EvalError});var we=l((pc,Kt)=>{"use strict";o();i();Kt.exports=RangeError});var Pe=l((cc,Vt)=>{"use strict";o();i();Vt.exports=ReferenceError});var Ur=l((gc,Yt)=>{"use strict";o();i();Yt.exports=SyntaxError});var w=l((mc,Qt)=>{"use strict";o();i();Qt.exports=TypeError});var Oe=l((Ac,Xt)=>{"use strict";o();i();Xt.exports=URIError});var rn=l((Oc,Zt)=>{"use strict";o();i();Zt.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var r={},t=Symbol("test"),n=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var a=42;r[t]=a;for(t in r)return!1;if(typeof Object.keys=="function"&&Object.keys(r).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(r).length!==0)return!1;var u=Object.getOwnPropertySymbols(r);if(u.length!==1||u[0]!==t||!Object.prototype.propertyIsEnumerable.call(r,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var f=Object.getOwnPropertyDescriptor(r,t);if(f.value!==a||f.enumerable!==!0)return!1}return!0}});var Ee=l((xc,tn)=>{"use strict";o();i();var en=typeof Symbol!="undefined"&&Symbol,Au=rn();tn.exports=function(){return typeof en!="function"||typeof Symbol!="function"||typeof en("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Au()}});var on=l((Fc,nn)=>{"use strict";o();i();var qe={__proto__:null,foo:{}},wu=Object;nn.exports=function(){return{__proto__:qe}.foo===qe.foo&&!(qe instanceof wu)}});var xe=l((Nc,an)=>{"use strict";o();i();var Pu=Function.prototype.call,Ou=Object.prototype.hasOwnProperty,Eu=L();an.exports=Eu.call(Pu,Ou)});var F=l((Dc,ln)=>{"use strict";o();i();var m,qu=Se(),xu=Ae(),$u=we(),Iu=Pe(),tr=Ur(),er=w(),Fu=Oe(),sn=Function,$e=function(e){try{return sn('"use strict"; return ('+e+").constructor;")()}catch(r){}},z=Object.getOwnPropertyDescriptor;if(z)try{z({},"")}catch(e){z=null}var Ie=function(){throw new er},Tu=z?function(){try{return arguments.callee,Ie}catch(e){try{return z(arguments,"callee").get}catch(r){return Ie}}}():Ie,Z=Ee()(),Ru=on()(),O=Object.getPrototypeOf||(Ru?function(e){return e.__proto__}:null),rr={},Nu=typeof Uint8Array=="undefined"||!O?m:O(Uint8Array),J={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?m:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?m:ArrayBuffer,"%ArrayIteratorPrototype%":Z&&O?O([][Symbol.iterator]()):m,"%AsyncFromSyncIteratorPrototype%":m,"%AsyncFunction%":rr,"%AsyncGenerator%":rr,"%AsyncGeneratorFunction%":rr,"%AsyncIteratorPrototype%":rr,"%Atomics%":typeof Atomics=="undefined"?m:Atomics,"%BigInt%":typeof BigInt=="undefined"?m:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?m:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?m:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?m:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":qu,"%eval%":eval,"%EvalError%":xu,"%Float32Array%":typeof Float32Array=="undefined"?m:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?m:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?m:FinalizationRegistry,"%Function%":sn,"%GeneratorFunction%":rr,"%Int8Array%":typeof Int8Array=="undefined"?m:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?m:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?m:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Z&&O?O(O([][Symbol.iterator]())):m,"%JSON%":typeof JSON=="object"?JSON:m,"%Map%":typeof Map=="undefined"?m:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!Z||!O?m:O(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?m:Promise,"%Proxy%":typeof Proxy=="undefined"?m:Proxy,"%RangeError%":$u,"%ReferenceError%":Iu,"%Reflect%":typeof Reflect=="undefined"?m:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?m:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!Z||!O?m:O(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?m:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Z&&O?O(""[Symbol.iterator]()):m,"%Symbol%":Z?Symbol:m,"%SyntaxError%":tr,"%ThrowTypeError%":Tu,"%TypedArray%":Nu,"%TypeError%":er,"%Uint8Array%":typeof Uint8Array=="undefined"?m:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?m:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?m:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?m:Uint32Array,"%URIError%":Fu,"%WeakMap%":typeof WeakMap=="undefined"?m:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?m:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?m:WeakSet};if(O)try{null.error}catch(e){un=O(O(e)),J["%Error.prototype%"]=un}var un,_u=function e(r){var t;if(r==="%AsyncFunction%")t=$e("async function () {}");else if(r==="%GeneratorFunction%")t=$e("function* () {}");else if(r==="%AsyncGeneratorFunction%")t=$e("async function* () {}");else if(r==="%AsyncGenerator%"){var n=e("%AsyncGeneratorFunction%");n&&(t=n.prototype)}else if(r==="%AsyncIteratorPrototype%"){var a=e("%AsyncGenerator%");a&&O&&(t=O(a.prototype))}return J[r]=t,t},fn={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},vr=L(),Dr=xe(),Uu=vr.call(Function.call,Array.prototype.concat),Du=vr.call(Function.apply,Array.prototype.splice),pn=vr.call(Function.call,String.prototype.replace),Br=vr.call(Function.call,String.prototype.slice),Bu=vr.call(Function.call,RegExp.prototype.exec),Mu=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Cu=/\\(\\)?/g,ju=function(r){var t=Br(r,0,1),n=Br(r,-1);if(t==="%"&&n!=="%")throw new tr("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&t!=="%")throw new tr("invalid intrinsic syntax, expected opening `%`");var a=[];return pn(r,Mu,function(u,f,c,y){a[a.length]=c?pn(y,Cu,"$1"):f||u}),a},Gu=function(r,t){var n=r,a;if(Dr(fn,n)&&(a=fn[n],n="%"+a[0]+"%"),Dr(J,n)){var u=J[n];if(u===rr&&(u=_u(n)),typeof u=="undefined"&&!t)throw new er("intrinsic "+r+" exists, but is not available. Please file an issue!");return{alias:a,name:n,value:u}}throw new tr("intrinsic "+r+" does not exist!")};ln.exports=function(r,t){if(typeof r!="string"||r.length===0)throw new er("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new er('"allowMissing" argument must be a boolean');if(Bu(/^%?[^%]*%?$/,r)===null)throw new tr("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=ju(r),a=n.length>0?n[0]:"",u=Gu("%"+a+"%",t),f=u.name,c=u.value,y=!1,h=u.alias;h&&(a=h[0],Du(n,Uu([0,1],h)));for(var g=1,d=!0;g<n.length;g+=1){var v=n[g],A=Br(v,0,1),P=Br(v,-1);if((A==='"'||A==="'"||A==="`"||P==='"'||P==="'"||P==="`")&&A!==P)throw new tr("property names with quotes must have matching quotes");if((v==="constructor"||!d)&&(y=!0),a+="."+v,f="%"+a+"%",Dr(J,f))c=J[f];else if(c!=null){if(!(v in c)){if(!t)throw new er("base intrinsic for "+r+" exists, but the property is not available.");return}if(z&&g+1>=n.length){var S=z(c,v);d=!!S,d&&"get"in S&&!("originalValue"in S.get)?c=S.get:c=c[v]}else d=Dr(c,v),c=c[v];d&&!y&&(J[f]=c)}}return c}});var Fe=l((Cc,cn)=>{"use strict";o();i();cn.exports=Object});var vn=l((Wc,yn)=>{"use strict";o();i();yn.exports=Math.abs});var dn=l((zc,gn)=>{"use strict";o();i();gn.exports=Math.floor});var mn=l((Kc,hn)=>{"use strict";o();i();hn.exports=Math.max});var Sn=l((Qc,bn)=>{"use strict";o();i();bn.exports=Math.min});var wn=l((ry,An)=>{"use strict";o();i();An.exports=Math.pow});var On=l((ny,Pn)=>{"use strict";o();i();Pn.exports=Math.round});var qn=l((ay,En)=>{"use strict";o();i();En.exports=Number.isNaN||function(r){return r!==r}});var $n=l((py,xn)=>{"use strict";o();i();var Wu=qn();xn.exports=function(r){return Wu(r)||r===0?r:r<0?-1:1}});var Fn=l((cy,In)=>{"use strict";o();i();In.exports=Object.getOwnPropertyDescriptor});var gr=l((gy,Tn)=>{"use strict";o();i();var Mr=Fn();if(Mr)try{Mr([],"length")}catch(e){Mr=null}Tn.exports=Mr});var jr=l((my,Rn)=>{"use strict";o();i();var Cr=Object.defineProperty||!1;if(Cr)try{Cr({},"a",{value:1})}catch(e){Cr=!1}Rn.exports=Cr});var Te=l((Ay,Nn)=>{"use strict";o();i();Nn.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var r={},t=Symbol("test"),n=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var a=42;r[t]=a;for(var u in r)return!1;if(typeof Object.keys=="function"&&Object.keys(r).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(r).length!==0)return!1;var f=Object.getOwnPropertySymbols(r);if(f.length!==1||f[0]!==t||!Object.prototype.propertyIsEnumerable.call(r,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var c=Object.getOwnPropertyDescriptor(r,t);if(c.value!==a||c.enumerable!==!0)return!1}return!0}});var Dn=l((Oy,Un)=>{"use strict";o();i();var _n=typeof Symbol!="undefined"&&Symbol,ku=Te();Un.exports=function(){return typeof _n!="function"||typeof Symbol!="function"||typeof _n("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:ku()}});var Re=l((xy,Bn)=>{"use strict";o();i();Bn.exports=typeof Reflect!="undefined"&&Reflect.getPrototypeOf||null});var Ne=l((Fy,Mn)=>{"use strict";o();i();var Lu=Fe();Mn.exports=Lu.getPrototypeOf||null});var Gr=l((Ny,Cn)=>{"use strict";o();i();Cn.exports=Function.prototype.call});var _e=l((Dy,jn)=>{"use strict";o();i();jn.exports=Function.prototype.apply});var Wn=l((Cy,Gn)=>{"use strict";o();i();Gn.exports=typeof Reflect!="undefined"&&Reflect&&Reflect.apply});var Ln=l((Wy,kn)=>{"use strict";o();i();var zu=L(),Ju=_e(),Hu=Gr(),Ku=Wn();kn.exports=Ku||zu.call(Hu,Ju)});var Jn=l((zy,zn)=>{"use strict";o();i();var Vu=L(),Yu=w(),Qu=Gr(),Xu=Ln();zn.exports=function(r){if(r.length<1||typeof r[0]!="function")throw new Yu("a function is required");return Xu(Vu,Qu,r)}});var Xn=l((Ky,Qn)=>{"use strict";o();i();var Zu=Jn(),Hn=gr(),Vn;try{Vn=[].__proto__===Array.prototype}catch(e){if(!e||typeof e!="object"||!("code"in e)||e.code!=="ERR_PROTO_ACCESS")throw e}var Ue=!!Vn&&Hn&&Hn(Object.prototype,"__proto__"),Yn=Object,Kn=Yn.getPrototypeOf;Qn.exports=Ue&&typeof Ue.get=="function"?Zu([Ue.get]):typeof Kn=="function"?function(r){return Kn(r==null?r:Yn(r))}:!1});var no=l((Qy,to)=>{"use strict";o();i();var Zn=Re(),ro=Ne(),eo=Xn();to.exports=Zn?function(r){return Zn(r)}:ro?function(r){if(!r||typeof r!="object"&&typeof r!="function")throw new TypeError("getProto: not an object");return ro(r)}:eo?function(r){return eo(r)}:null});var Me=l((rv,po)=>{"use strict";o();i();var b,rf=Fe(),ef=Se(),tf=Ae(),nf=we(),of=Pe(),ar=Ur(),ir=w(),af=Oe(),uf=vn(),ff=dn(),pf=mn(),sf=Sn(),lf=wn(),cf=On(),yf=$n(),uo=Function,De=function(e){try{return uo('"use strict"; return ('+e+").constructor;")()}catch(r){}},dr=gr(),vf=jr(),Be=function(){throw new ir},gf=dr?function(){try{return arguments.callee,Be}catch(e){try{return dr(arguments,"callee").get}catch(r){return Be}}}():Be,nr=Dn()(),E=no(),df=Ne(),hf=Re(),fo=_e(),hr=Gr(),or={},mf=typeof Uint8Array=="undefined"||!E?b:E(Uint8Array),H={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?b:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?b:ArrayBuffer,"%ArrayIteratorPrototype%":nr&&E?E([][Symbol.iterator]()):b,"%AsyncFromSyncIteratorPrototype%":b,"%AsyncFunction%":or,"%AsyncGenerator%":or,"%AsyncGeneratorFunction%":or,"%AsyncIteratorPrototype%":or,"%Atomics%":typeof Atomics=="undefined"?b:Atomics,"%BigInt%":typeof BigInt=="undefined"?b:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?b:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?b:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?b:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":ef,"%eval%":eval,"%EvalError%":tf,"%Float32Array%":typeof Float32Array=="undefined"?b:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?b:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?b:FinalizationRegistry,"%Function%":uo,"%GeneratorFunction%":or,"%Int8Array%":typeof Int8Array=="undefined"?b:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?b:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?b:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":nr&&E?E(E([][Symbol.iterator]())):b,"%JSON%":typeof JSON=="object"?JSON:b,"%Map%":typeof Map=="undefined"?b:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!nr||!E?b:E(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":rf,"%Object.getOwnPropertyDescriptor%":dr,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?b:Promise,"%Proxy%":typeof Proxy=="undefined"?b:Proxy,"%RangeError%":nf,"%ReferenceError%":of,"%Reflect%":typeof Reflect=="undefined"?b:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?b:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!nr||!E?b:E(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?b:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":nr&&E?E(""[Symbol.iterator]()):b,"%Symbol%":nr?Symbol:b,"%SyntaxError%":ar,"%ThrowTypeError%":gf,"%TypedArray%":mf,"%TypeError%":ir,"%Uint8Array%":typeof Uint8Array=="undefined"?b:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?b:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?b:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?b:Uint32Array,"%URIError%":af,"%WeakMap%":typeof WeakMap=="undefined"?b:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?b:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?b:WeakSet,"%Function.prototype.call%":hr,"%Function.prototype.apply%":fo,"%Object.defineProperty%":vf,"%Object.getPrototypeOf%":df,"%Math.abs%":uf,"%Math.floor%":ff,"%Math.max%":pf,"%Math.min%":sf,"%Math.pow%":lf,"%Math.round%":cf,"%Math.sign%":yf,"%Reflect.getPrototypeOf%":hf};if(E)try{null.error}catch(e){oo=E(E(e)),H["%Error.prototype%"]=oo}var oo,bf=function e(r){var t;if(r==="%AsyncFunction%")t=De("async function () {}");else if(r==="%GeneratorFunction%")t=De("function* () {}");else if(r==="%AsyncGeneratorFunction%")t=De("async function* () {}");else if(r==="%AsyncGenerator%"){var n=e("%AsyncGeneratorFunction%");n&&(t=n.prototype)}else if(r==="%AsyncIteratorPrototype%"){var a=e("%AsyncGenerator%");a&&E&&(t=E(a.prototype))}return H[r]=t,t},io={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},mr=L(),Wr=xe(),Sf=mr.call(hr,Array.prototype.concat),Af=mr.call(fo,Array.prototype.splice),ao=mr.call(hr,String.prototype.replace),kr=mr.call(hr,String.prototype.slice),wf=mr.call(hr,RegExp.prototype.exec),Pf=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Of=/\\(\\)?/g,Ef=function(r){var t=kr(r,0,1),n=kr(r,-1);if(t==="%"&&n!=="%")throw new ar("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&t!=="%")throw new ar("invalid intrinsic syntax, expected opening `%`");var a=[];return ao(r,Pf,function(u,f,c,y){a[a.length]=c?ao(y,Of,"$1"):f||u}),a},qf=function(r,t){var n=r,a;if(Wr(io,n)&&(a=io[n],n="%"+a[0]+"%"),Wr(H,n)){var u=H[n];if(u===or&&(u=bf(n)),typeof u=="undefined"&&!t)throw new ir("intrinsic "+r+" exists, but is not available. Please file an issue!");return{alias:a,name:n,value:u}}throw new ar("intrinsic "+r+" does not exist!")};po.exports=function(r,t){if(typeof r!="string"||r.length===0)throw new ir("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new ir('"allowMissing" argument must be a boolean');if(wf(/^%?[^%]*%?$/,r)===null)throw new ar("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=Ef(r),a=n.length>0?n[0]:"",u=qf("%"+a+"%",t),f=u.name,c=u.value,y=!1,h=u.alias;h&&(a=h[0],Af(n,Sf([0,1],h)));for(var g=1,d=!0;g<n.length;g+=1){var v=n[g],A=kr(v,0,1),P=kr(v,-1);if((A==='"'||A==="'"||A==="`"||P==='"'||P==="'"||P==="`")&&A!==P)throw new ar("property names with quotes must have matching quotes");if((v==="constructor"||!d)&&(y=!0),a+="."+v,f="%"+a+"%",Wr(H,f))c=H[f];else if(c!=null){if(!(v in c)){if(!t)throw new ir("base intrinsic for "+r+" exists, but the property is not available.");return}if(dr&&g+1>=n.length){var S=dr(c,v);d=!!S,d&&"get"in S&&!("originalValue"in S.get)?c=S.get:c=c[v]}else d=Wr(c,v),c=c[v];d&&!y&&(H[f]=c)}}return c}});var Ce=l((nv,co)=>{"use strict";o();i();var so=jr(),xf=Ur(),ur=w(),lo=gr();co.exports=function(r,t,n){if(!r||typeof r!="object"&&typeof r!="function")throw new ur("`obj` must be an object or a function`");if(typeof t!="string"&&typeof t!="symbol")throw new ur("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new ur("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new ur("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new ur("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new ur("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,u=arguments.length>4?arguments[4]:null,f=arguments.length>5?arguments[5]:null,c=arguments.length>6?arguments[6]:!1,y=!!lo&&lo(r,t);if(so)so(r,t,{configurable:f===null&&y?y.configurable:!f,enumerable:a===null&&y?y.enumerable:!a,value:n,writable:u===null&&y?y.writable:!u});else if(c||!a&&!u&&!f)r[t]=n;else throw new xf("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var Ge=l((av,vo)=>{"use strict";o();i();var je=jr(),yo=function(){return!!je};yo.hasArrayLengthDefineBug=function(){if(!je)return null;try{return je([],"length",{value:1}).length!==1}catch(r){return!0}};vo.exports=yo});var So=l((pv,bo)=>{"use strict";o();i();var $f=Me(),go=Ce(),If=Ge()(),ho=gr(),mo=w(),Ff=$f("%Math.floor%");bo.exports=function(r,t){if(typeof r!="function")throw new mo("`fn` is not a function");if(typeof t!="number"||t<0||t>4294967295||Ff(t)!==t)throw new mo("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],a=!0,u=!0;if("length"in r&&ho){var f=ho(r,"length");f&&!f.configurable&&(a=!1),f&&!f.writable&&(u=!1)}return(a||u||!n)&&(If?go(r,"length",t,!0,!0):go(r,"length",t)),r}});var wo=l((cv,Ao)=>{"use strict";o();i();var Tf=Me(),Lr=Tf("%Object.defineProperty%",!0)||!1;if(Lr)try{Lr({},"a",{value:1})}catch(e){Lr=!1}Ao.exports=Lr});var Hr=l((gv,zr)=>{"use strict";o();i();var We=L(),Jr=F(),Rf=So(),Nf=w(),Eo=Jr("%Function.prototype.apply%"),qo=Jr("%Function.prototype.call%"),xo=Jr("%Reflect.apply%",!0)||We.call(qo,Eo),Po=wo(),_f=Jr("%Math.max%");zr.exports=function(r){if(typeof r!="function")throw new Nf("a function is required");var t=xo(We,qo,arguments);return Rf(t,1+_f(0,r.length-(arguments.length-1)),!0)};var Oo=function(){return xo(We,Eo,arguments)};Po?Po(zr.exports,"apply",{value:Oo}):zr.exports.apply=Oo});var ke=l((mv,Io)=>{"use strict";o();i();var $o=Object.prototype.toString;Io.exports=function(r){var t=$o.call(r),n=t==="[object Arguments]";return n||(n=t!=="[object Array]"&&r!==null&&typeof r=="object"&&typeof r.length=="number"&&r.length>=0&&$o.call(r.callee)==="[object Function]"),n}});var Mo=l((Av,Bo)=>{"use strict";o();i();var Do;Object.keys||(br=Object.prototype.hasOwnProperty,Le=Object.prototype.toString,Fo=ke(),ze=Object.prototype.propertyIsEnumerable,To=!ze.call({toString:null},"toString"),Ro=ze.call(function(){},"prototype"),Sr=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Kr=function(e){var r=e.constructor;return r&&r.prototype===e},No={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},_o=function(){if(typeof window=="undefined")return!1;for(var e in window)try{if(!No["$"+e]&&br.call(window,e)&&window[e]!==null&&typeof window[e]=="object")try{Kr(window[e])}catch(r){return!0}}catch(r){return!0}return!1}(),Uo=function(e){if(typeof window=="undefined"||!_o)return Kr(e);try{return Kr(e)}catch(r){return!1}},Do=function(r){var t=r!==null&&typeof r=="object",n=Le.call(r)==="[object Function]",a=Fo(r),u=t&&Le.call(r)==="[object String]",f=[];if(!t&&!n&&!a)throw new TypeError("Object.keys called on a non-object");var c=Ro&&n;if(u&&r.length>0&&!br.call(r,0))for(var y=0;y<r.length;++y)f.push(String(y));if(a&&r.length>0)for(var h=0;h<r.length;++h)f.push(String(h));else for(var g in r)!(c&&g==="prototype")&&br.call(r,g)&&f.push(String(g));if(To)for(var d=Uo(r),v=0;v<Sr.length;++v)!(d&&Sr[v]==="constructor")&&br.call(r,Sr[v])&&f.push(Sr[v]);return f});var br,Le,Fo,ze,To,Ro,Sr,Kr,No,_o,Uo;Bo.exports=Do});var Wo=l((Ov,Go)=>{"use strict";o();i();var Uf=Array.prototype.slice,Df=ke(),Co=Object.keys,Vr=Co?function(r){return Co(r)}:Mo(),jo=Object.keys;Vr.shim=function(){if(Object.keys){var r=function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2);r||(Object.keys=function(n){return Df(n)?jo(Uf.call(n)):jo(n)})}else Object.keys=Vr;return Object.keys||Vr};Go.exports=Vr});var Ar=l((xv,Jo)=>{"use strict";o();i();var Bf=Wo(),Mf=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",Cf=Object.prototype.toString,jf=Array.prototype.concat,ko=Ce(),Gf=function(e){return typeof e=="function"&&Cf.call(e)==="[object Function]"},Lo=Ge()(),Wf=function(e,r,t,n){if(r in e){if(n===!0){if(e[r]===t)return}else if(!Gf(n)||!n())return}Lo?ko(e,r,t,!0):ko(e,r,t)},zo=function(e,r){var t=arguments.length>2?arguments[2]:{},n=Bf(r);Mf&&(n=jf.call(n,Object.getOwnPropertySymbols(r)));for(var a=0;a<n.length;a+=1)Wf(e,n[a],r[n[a]],t[n[a]])};zo.supportsDescriptors=!!Lo;Jo.exports=zo});var I=l((Fv,Vo)=>{"use strict";o();i();var Ho=F(),Ko=Hr(),kf=Ko(Ho("String.prototype.indexOf"));Vo.exports=function(r,t){var n=Ho(r,!!t);return typeof n=="function"&&kf(r,".prototype.")>-1?Ko(n):n}});var Xo=l((Nv,Qo)=>{"use strict";o();i();var Lf=F(),Yo=Lf("%Array%"),zf=!Yo.isArray&&I()("Object.prototype.toString");Qo.exports=Yo.isArray||function(r){return zf(r)==="[object Array]"}});var Je=l((Dv,Zo)=>{"use strict";o();i();Zo.exports=Xo()});var ei=l((Cv,ri)=>{"use strict";o();i();var Jf=F(),Hf=I(),Kf=w(),Vf=Je(),Yf=Jf("%Reflect.apply%",!0)||Hf("Function.prototype.apply");ri.exports=function(r,t){var n=arguments.length>2?arguments[2]:[];if(!Vf(n))throw new Kf("Assertion failed: optional `argumentsList`, if provided, must be a List");return Yf(r,t,n)}});function ti(){throw new Error("setTimeout has not been defined")}function ni(){throw new Error("clearTimeout has not been defined")}function oi(e){if(C===setTimeout)return setTimeout(e,0);if((C===ti||!C)&&setTimeout)return C=setTimeout,setTimeout(e,0);try{return C(e,0)}catch(r){try{return C.call(null,e,0)}catch(t){return C.call(this,e,0)}}}function Qf(e){if(j===clearTimeout)return clearTimeout(e);if((j===ni||!j)&&clearTimeout)return j=clearTimeout,clearTimeout(e);try{return j(e)}catch(r){try{return j.call(null,e)}catch(t){return j.call(this,e)}}}function Xf(){!pr||!K||(pr=!1,K.length?U=K.concat(U):Yr=-1,U.length&&ii())}function ii(){if(!pr){var e=oi(Xf);pr=!0;for(var r=U.length;r;){for(K=U,U=[];++Yr<r;)K&&K[Yr].run();Yr=-1,r=U.length}K=null,pr=!1,Qf(e)}}function Zf(e){var r=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)r[t-1]=arguments[t];U.push(new ai(e,r)),U.length===1&&!pr&&oi(ii)}function ai(e,r){this.fun=e,this.array=r}function V(){}function dp(e){throw new Error("process.binding is not supported")}function hp(){return"/"}function mp(e){throw new Error("process.chdir is not supported")}function bp(){return 0}function Ap(e){var r=Sp.call(fr)*.001,t=Math.floor(r),n=Math.floor(r%1*1e9);return e&&(t=t-e[0],n=n-e[1],n<0&&(t--,n+=1e9)),[t,n]}function Pp(){var e=new Date,r=e-wp;return r/1e3}var C,j,U,pr,K,Yr,rp,ep,tp,np,op,ip,ap,up,fp,pp,sp,lp,cp,yp,vp,gp,fr,Sp,wp,Op,wr,ui=be(()=>{"use strict";o();i();C=ti,j=ni;typeof globalThis.setTimeout=="function"&&(C=setTimeout);typeof globalThis.clearTimeout=="function"&&(j=clearTimeout);U=[],pr=!1,Yr=-1;ai.prototype.run=function(){this.fun.apply(null,this.array)};rp="browser",ep="browser",tp=!0,np={},op=[],ip="",ap={},up={},fp={};pp=V,sp=V,lp=V,cp=V,yp=V,vp=V,gp=V;fr=globalThis.performance||{},Sp=fr.now||fr.mozNow||fr.msNow||fr.oNow||fr.webkitNow||function(){return new Date().getTime()};wp=new Date;Op={nextTick:Zf,title:rp,browser:tp,env:np,argv:op,version:ip,versions:ap,on:pp,addListener:sp,once:lp,off:cp,removeListener:yp,removeAllListeners:vp,emit:gp,binding:dp,cwd:hp,chdir:mp,umask:bp,hrtime:Ap,platform:ep,release:up,config:fp,uptime:Pp},wr=Op});var He,Ke,fi=be(()=>{"use strict";o();i();typeof Object.create=="function"?He=function(r,t){r.super_=t,r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}})}:He=function(r,t){r.super_=t;var n=function(){};n.prototype=t.prototype,r.prototype=new n,r.prototype.constructor=r};Ke=He});var di={};su(di,{_extend:()=>nt,debuglog:()=>pi,default:()=>_p,deprecate:()=>Ze,format:()=>re,inherits:()=>Ke,inspect:()=>R,isArray:()=>rt,isBoolean:()=>ee,isBuffer:()=>yi,isDate:()=>Zr,isError:()=>Or,isFunction:()=>Er,isNull:()=>qr,isNullOrUndefined:()=>si,isNumber:()=>et,isObject:()=>Y,isPrimitive:()=>ci,isRegExp:()=>Pr,isString:()=>xr,isSymbol:()=>li,isUndefined:()=>T,log:()=>vi});function re(e){if(!xr(e)){for(var r=[],t=0;t<arguments.length;t++)r.push(R(arguments[t]));return r.join(" ")}for(var t=1,n=arguments,a=n.length,u=String(e).replace(Ep,function(c){if(c==="%%")return"%";if(t>=a)return c;switch(c){case"%s":return String(n[t++]);case"%d":return Number(n[t++]);case"%j":try{return JSON.stringify(n[t++])}catch(y){return"[Circular]"}default:return c}}),f=n[t];t<a;f=n[++t])qr(f)||!Y(f)?u+=" "+f:u+=" "+R(f);return u}function Ze(e,r){if(T(globalThis.process))return function(){return Ze(e,r).apply(this,arguments)};if(wr.noDeprecation===!0)return e;var t=!1;function n(){if(!t){if(wr.throwDeprecation)throw new Error(r);wr.traceDeprecation?console.trace(r):console.error(r),t=!0}return e.apply(this,arguments)}return n}function pi(e){if(T(Ve)&&(Ve=wr.env.NODE_DEBUG||""),e=e.toUpperCase(),!Qr[e])if(new RegExp("\\b"+e+"\\b","i").test(Ve)){var r=0;Qr[e]=function(){var t=re.apply(null,arguments);console.error("%s %d: %s",e,r,t)}}else Qr[e]=function(){};return Qr[e]}function R(e,r){var t={seen:[],stylize:xp};return arguments.length>=3&&(t.depth=arguments[2]),arguments.length>=4&&(t.colors=arguments[3]),ee(r)?t.showHidden=r:r&&nt(t,r),T(t.showHidden)&&(t.showHidden=!1),T(t.depth)&&(t.depth=2),T(t.colors)&&(t.colors=!1),T(t.customInspect)&&(t.customInspect=!0),t.colors&&(t.stylize=qp),Xr(t,e,t.depth)}function qp(e,r){var t=R.styles[r];return t?"\x1B["+R.colors[t][0]+"m"+e+"\x1B["+R.colors[t][1]+"m":e}function xp(e,r){return e}function $p(e){var r={};return e.forEach(function(t,n){r[t]=!0}),r}function Xr(e,r,t){if(e.customInspect&&r&&Er(r.inspect)&&r.inspect!==R&&!(r.constructor&&r.constructor.prototype===r)){var n=r.inspect(t,e);return xr(n)||(n=Xr(e,n,t)),n}var a=Ip(e,r);if(a)return a;var u=Object.keys(r),f=$p(u);if(e.showHidden&&(u=Object.getOwnPropertyNames(r)),Or(r)&&(u.indexOf("message")>=0||u.indexOf("description")>=0))return Ye(r);if(u.length===0){if(Er(r)){var c=r.name?": "+r.name:"";return e.stylize("[Function"+c+"]","special")}if(Pr(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(Zr(r))return e.stylize(Date.prototype.toString.call(r),"date");if(Or(r))return Ye(r)}var y="",h=!1,g=["{","}"];if(rt(r)&&(h=!0,g=["[","]"]),Er(r)){var d=r.name?": "+r.name:"";y=" [Function"+d+"]"}if(Pr(r)&&(y=" "+RegExp.prototype.toString.call(r)),Zr(r)&&(y=" "+Date.prototype.toUTCString.call(r)),Or(r)&&(y=" "+Ye(r)),u.length===0&&(!h||r.length==0))return g[0]+y+g[1];if(t<0)return Pr(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special");e.seen.push(r);var v;return h?v=Fp(e,r,t,f,u):v=u.map(function(A){return Xe(e,r,t,f,A,h)}),e.seen.pop(),Tp(v,y,g)}function Ip(e,r){if(T(r))return e.stylize("undefined","undefined");if(xr(r)){var t="'"+JSON.stringify(r).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(t,"string")}if(et(r))return e.stylize(""+r,"number");if(ee(r))return e.stylize(""+r,"boolean");if(qr(r))return e.stylize("null","null")}function Ye(e){return"["+Error.prototype.toString.call(e)+"]"}function Fp(e,r,t,n,a){for(var u=[],f=0,c=r.length;f<c;++f)gi(r,String(f))?u.push(Xe(e,r,t,n,String(f),!0)):u.push("");return a.forEach(function(y){y.match(/^\d+$/)||u.push(Xe(e,r,t,n,y,!0))}),u}function Xe(e,r,t,n,a,u){var f,c,y;if(y=Object.getOwnPropertyDescriptor(r,a)||{value:r[a]},y.get?y.set?c=e.stylize("[Getter/Setter]","special"):c=e.stylize("[Getter]","special"):y.set&&(c=e.stylize("[Setter]","special")),gi(n,a)||(f="["+a+"]"),c||(e.seen.indexOf(y.value)<0?(qr(t)?c=Xr(e,y.value,null):c=Xr(e,y.value,t-1),c.indexOf(`
2
- `)>-1&&(u?c=c.split(`
3
- `).map(function(h){return" "+h}).join(`
4
- `).substr(2):c=`
5
- `+c.split(`
6
- `).map(function(h){return" "+h}).join(`
7
- `))):c=e.stylize("[Circular]","special")),T(f)){if(u&&a.match(/^\d+$/))return c;f=JSON.stringify(""+a),f.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(f=f.substr(1,f.length-2),f=e.stylize(f,"name")):(f=f.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),f=e.stylize(f,"string"))}return f+": "+c}function Tp(e,r,t){var n=0,a=e.reduce(function(u,f){return n++,f.indexOf(`
8
- `)>=0&&n++,u+f.replace(/\u001b\[\d\d?m/g,"").length+1},0);return a>60?t[0]+(r===""?"":r+`
9
- `)+" "+e.join(`,
10
- `)+" "+t[1]:t[0]+r+" "+e.join(", ")+" "+t[1]}function rt(e){return Array.isArray(e)}function ee(e){return typeof e=="boolean"}function qr(e){return e===null}function si(e){return e==null}function et(e){return typeof e=="number"}function xr(e){return typeof e=="string"}function li(e){return typeof e=="symbol"}function T(e){return e===void 0}function Pr(e){return Y(e)&&tt(e)==="[object RegExp]"}function Y(e){return typeof e=="object"&&e!==null}function Zr(e){return Y(e)&&tt(e)==="[object Date]"}function Or(e){return Y(e)&&(tt(e)==="[object Error]"||e instanceof Error)}function Er(e){return typeof e=="function"}function ci(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e=="undefined"}function yi(e){return p.isBuffer(e)}function tt(e){return Object.prototype.toString.call(e)}function Qe(e){return e<10?"0"+e.toString(10):e.toString(10)}function Np(){var e=new Date,r=[Qe(e.getHours()),Qe(e.getMinutes()),Qe(e.getSeconds())].join(":");return[e.getDate(),Rp[e.getMonth()],r].join(" ")}function vi(){console.log("%s - %s",Np(),re.apply(null,arguments))}function nt(e,r){if(!r||!Y(r))return e;for(var t=Object.keys(r),n=t.length;n--;)e[t[n]]=r[t[n]];return e}function gi(e,r){return Object.prototype.hasOwnProperty.call(e,r)}var Ep,Qr,Ve,Rp,_p,hi=be(()=>{"use strict";o();i();ui();fi();Ep=/%[sdj%]/g;Qr={};R.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};R.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};Rp=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];_p={inherits:Ke,_extend:nt,log:vi,isBuffer:yi,isPrimitive:ci,isFunction:Er,isError:Or,isDate:Zr,isObject:Y,isRegExp:Pr,isUndefined:T,isSymbol:li,isString:xr,isNumber:et,isNullOrUndefined:si,isNull:qr,isBoolean:ee,isArray:rt,inspect:R,deprecate:Ze,format:re,debuglog:pi}});var mi=l((Xv,te)=>{"use strict";o();i();var Q=(hi(),cu(di));if(Q&&Q.default){te.exports=Q.default;for(let e in Q)te.exports[e]=Q[e]}else Q&&(te.exports=Q)});var Si=l((eg,bi)=>{"use strict";o();i();bi.exports=mi().inspect});var Tr=l((og,ji)=>{"use strict";o();i();var yt=typeof Map=="function"&&Map.prototype,ot=Object.getOwnPropertyDescriptor&&yt?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,oe=yt&&ot&&typeof ot.get=="function"?ot.get:null,Ai=yt&&Map.prototype.forEach,vt=typeof Set=="function"&&Set.prototype,it=Object.getOwnPropertyDescriptor&&vt?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,ie=vt&&it&&typeof it.get=="function"?it.get:null,wi=vt&&Set.prototype.forEach,Up=typeof WeakMap=="function"&&WeakMap.prototype,Ir=Up?WeakMap.prototype.has:null,Dp=typeof WeakSet=="function"&&WeakSet.prototype,Fr=Dp?WeakSet.prototype.has:null,Bp=typeof WeakRef=="function"&&WeakRef.prototype,Pi=Bp?WeakRef.prototype.deref:null,Mp=Boolean.prototype.valueOf,Cp=Object.prototype.toString,jp=Function.prototype.toString,Gp=String.prototype.match,gt=String.prototype.slice,G=String.prototype.replace,Wp=String.prototype.toUpperCase,Oi=String.prototype.toLowerCase,Ni=RegExp.prototype.test,Ei=Array.prototype.concat,N=Array.prototype.join,kp=Array.prototype.slice,qi=Math.floor,ft=typeof BigInt=="function"?BigInt.prototype.valueOf:null,at=Object.getOwnPropertySymbols,pt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,sr=typeof Symbol=="function"&&typeof Symbol.iterator=="object",q=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===sr||!0)?Symbol.toStringTag:null,_i=Object.prototype.propertyIsEnumerable,xi=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function $i(e,r){if(e===1/0||e===-1/0||e!==e||e&&e>-1e3&&e<1e3||Ni.call(/e/,r))return r;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof e=="number"){var n=e<0?-qi(-e):qi(e);if(n!==e){var a=String(n),u=gt.call(r,a.length+1);return G.call(a,t,"$&_")+"."+G.call(G.call(u,/([0-9]{3})/g,"$&_"),/_$/,"")}}return G.call(r,t,"$&_")}var st=Si(),Ii=st.custom,Fi=Bi(Ii)?Ii:null,Ui={__proto__:null,double:'"',single:"'"},Lp={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};ji.exports=function e(r,t,n,a){var u=t||{};if(D(u,"quoteStyle")&&!D(Ui,u.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(D(u,"maxStringLength")&&(typeof u.maxStringLength=="number"?u.maxStringLength<0&&u.maxStringLength!==1/0:u.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var f=D(u,"customInspect")?u.customInspect:!0;if(typeof f!="boolean"&&f!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(D(u,"indent")&&u.indent!==null&&u.indent!==" "&&!(parseInt(u.indent,10)===u.indent&&u.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(D(u,"numericSeparator")&&typeof u.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var c=u.numericSeparator;if(typeof r=="undefined")return"undefined";if(r===null)return"null";if(typeof r=="boolean")return r?"true":"false";if(typeof r=="string")return Ci(r,u);if(typeof r=="number"){if(r===0)return 1/0/r>0?"0":"-0";var y=String(r);return c?$i(r,y):y}if(typeof r=="bigint"){var h=String(r)+"n";return c?$i(r,h):h}var g=typeof u.depth=="undefined"?5:u.depth;if(typeof n=="undefined"&&(n=0),n>=g&&g>0&&typeof r=="object")return lt(r)?"[Array]":"[Object]";var d=fs(u,n);if(typeof a=="undefined")a=[];else if(Mi(a,r)>=0)return"[Circular]";function v(X,_r,pu){if(_r&&(a=kp.call(a),a.push(_r)),pu){var Gt={depth:u.depth};return D(u,"quoteStyle")&&(Gt.quoteStyle=u.quoteStyle),e(X,Gt,n+1,a)}return e(X,u,n+1,a)}if(typeof r=="function"&&!Ti(r)){var A=Zp(r),P=ne(r,v);return"[Function"+(A?": "+A:" (anonymous)")+"]"+(P.length>0?" { "+N.call(P,", ")+" }":"")}if(Bi(r)){var S=sr?G.call(String(r),/^(Symbol\(.*\))_[^)]*$/,"$1"):pt.call(r);return typeof r=="object"&&!sr?$r(S):S}if(is(r)){for(var x="<"+Oi.call(String(r.nodeName)),$=r.attributes||[],_=0;_<$.length;_++)x+=" "+$[_].name+"="+Di(zp($[_].value),"double",u);return x+=">",r.childNodes&&r.childNodes.length&&(x+="..."),x+="</"+Oi.call(String(r.nodeName))+">",x}if(lt(r)){if(r.length===0)return"[]";var k=ne(r,v);return d&&!us(k)?"["+ct(k,d)+"]":"[ "+N.call(k,", ")+" ]"}if(Hp(r)){var yr=ne(r,v);return!("cause"in Error.prototype)&&"cause"in r&&!_i.call(r,"cause")?"{ ["+String(r)+"] "+N.call(Ei.call("[cause]: "+v(r.cause),yr),", ")+" }":yr.length===0?"["+String(r)+"]":"{ ["+String(r)+"] "+N.call(yr,", ")+" }"}if(typeof r=="object"&&f){if(Fi&&typeof r[Fi]=="function"&&st)return st(r,{depth:g-n});if(f!=="symbol"&&typeof r.inspect=="function")return r.inspect()}if(rs(r)){var Nr=[];return Ai&&Ai.call(r,function(X,_r){Nr.push(v(_r,r,!0)+" => "+v(X,r))}),Ri("Map",oe.call(r),Nr,d)}if(ns(r)){var Mt=[];return wi&&wi.call(r,function(X){Mt.push(v(X,r))}),Ri("Set",ie.call(r),Mt,d)}if(es(r))return ut("WeakMap");if(os(r))return ut("WeakSet");if(ts(r))return ut("WeakRef");if(Vp(r))return $r(v(Number(r)));if(Qp(r))return $r(v(ft.call(r)));if(Yp(r))return $r(Mp.call(r));if(Kp(r))return $r(v(String(r)));if(typeof window!="undefined"&&r===window)return"{ [object Window] }";if(typeof globalThis!="undefined"&&r===globalThis||typeof globalThis!="undefined"&&r===globalThis)return"{ [object globalThis] }";if(!Jp(r)&&!Ti(r)){var de=ne(r,v),Ct=xi?xi(r)===Object.prototype:r instanceof Object||r.constructor===Object,he=r instanceof Object?"":"null prototype",jt=!Ct&&q&&Object(r)===r&&q in r?gt.call(W(r),8,-1):he?"Object":"",fu=Ct||typeof r.constructor!="function"?"":r.constructor.name?r.constructor.name+" ":"",me=fu+(jt||he?"["+N.call(Ei.call([],jt||[],he||[]),": ")+"] ":"");return de.length===0?me+"{}":d?me+"{"+ct(de,d)+"}":me+"{ "+N.call(de,", ")+" }"}return String(r)};function Di(e,r,t){var n=t.quoteStyle||r,a=Ui[n];return a+e+a}function zp(e){return G.call(String(e),/"/g,"&quot;")}function lt(e){return W(e)==="[object Array]"&&(!q||!(typeof e=="object"&&q in e))}function Jp(e){return W(e)==="[object Date]"&&(!q||!(typeof e=="object"&&q in e))}function Ti(e){return W(e)==="[object RegExp]"&&(!q||!(typeof e=="object"&&q in e))}function Hp(e){return W(e)==="[object Error]"&&(!q||!(typeof e=="object"&&q in e))}function Kp(e){return W(e)==="[object String]"&&(!q||!(typeof e=="object"&&q in e))}function Vp(e){return W(e)==="[object Number]"&&(!q||!(typeof e=="object"&&q in e))}function Yp(e){return W(e)==="[object Boolean]"&&(!q||!(typeof e=="object"&&q in e))}function Bi(e){if(sr)return e&&typeof e=="object"&&e instanceof Symbol;if(typeof e=="symbol")return!0;if(!e||typeof e!="object"||!pt)return!1;try{return pt.call(e),!0}catch(r){}return!1}function Qp(e){if(!e||typeof e!="object"||!ft)return!1;try{return ft.call(e),!0}catch(r){}return!1}var Xp=Object.prototype.hasOwnProperty||function(e){return e in this};function D(e,r){return Xp.call(e,r)}function W(e){return Cp.call(e)}function Zp(e){if(e.name)return e.name;var r=Gp.call(jp.call(e),/^function\s*([\w$]+)/);return r?r[1]:null}function Mi(e,r){if(e.indexOf)return e.indexOf(r);for(var t=0,n=e.length;t<n;t++)if(e[t]===r)return t;return-1}function rs(e){if(!oe||!e||typeof e!="object")return!1;try{oe.call(e);try{ie.call(e)}catch(r){return!0}return e instanceof Map}catch(r){}return!1}function es(e){if(!Ir||!e||typeof e!="object")return!1;try{Ir.call(e,Ir);try{Fr.call(e,Fr)}catch(r){return!0}return e instanceof WeakMap}catch(r){}return!1}function ts(e){if(!Pi||!e||typeof e!="object")return!1;try{return Pi.call(e),!0}catch(r){}return!1}function ns(e){if(!ie||!e||typeof e!="object")return!1;try{ie.call(e);try{oe.call(e)}catch(r){return!0}return e instanceof Set}catch(r){}return!1}function os(e){if(!Fr||!e||typeof e!="object")return!1;try{Fr.call(e,Fr);try{Ir.call(e,Ir)}catch(r){return!0}return e instanceof WeakSet}catch(r){}return!1}function is(e){return!e||typeof e!="object"?!1:typeof HTMLElement!="undefined"&&e instanceof HTMLElement?!0:typeof e.nodeName=="string"&&typeof e.getAttribute=="function"}function Ci(e,r){if(e.length>r.maxStringLength){var t=e.length-r.maxStringLength,n="... "+t+" more character"+(t>1?"s":"");return Ci(gt.call(e,0,r.maxStringLength),r)+n}var a=Lp[r.quoteStyle||"single"];a.lastIndex=0;var u=G.call(G.call(e,a,"\\$1"),/[\x00-\x1f]/g,as);return Di(u,"single",r)}function as(e){var r=e.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[r];return t?"\\"+t:"\\x"+(r<16?"0":"")+Wp.call(r.toString(16))}function $r(e){return"Object("+e+")"}function ut(e){return e+" { ? }"}function Ri(e,r,t,n){var a=n?ct(t,n):N.call(t,", ");return e+" ("+r+") {"+a+"}"}function us(e){for(var r=0;r<e.length;r++)if(Mi(e[r],`
11
- `)>=0)return!1;return!0}function fs(e,r){var t;if(e.indent===" ")t=" ";else if(typeof e.indent=="number"&&e.indent>0)t=N.call(Array(e.indent+1)," ");else return null;return{base:t,prev:N.call(Array(r+1),t)}}function ct(e,r){if(e.length===0)return"";var t=`
12
- `+r.prev+r.base;return t+N.call(e,","+t)+`
13
- `+r.prev}function ne(e,r){var t=lt(e),n=[];if(t){n.length=e.length;for(var a=0;a<e.length;a++)n[a]=D(e,a)?r(e[a],e):""}var u=typeof at=="function"?at(e):[],f;if(sr){f={};for(var c=0;c<u.length;c++)f["$"+u[c]]=u[c]}for(var y in e)D(e,y)&&(t&&String(Number(y))===y&&y<e.length||sr&&f["$"+y]instanceof Symbol||(Ni.call(/[^\w$]/,y)?n.push(r(y,e)+": "+r(e[y],e)):n.push(y+": "+r(e[y],e))));if(typeof at=="function")for(var h=0;h<u.length;h++)_i.call(e,u[h])&&n.push("["+r(u[h])+"]: "+r(e[u[h]],e));return n}});var ae=l((ug,Gi)=>{"use strict";o();i();Gi.exports=function(r){return typeof r=="string"||typeof r=="symbol"}});var ki=l((sg,Wi)=>{"use strict";o();i();var ps=w(),ss=Tr(),ls=ae();Wi.exports=function(r,t){if(!ls(t))throw new ps("Assertion failed: IsPropertyKey(P) is not true, got "+ss(t));return r[t]}});var Hi=l((yg,Ji)=>{"use strict";o();i();var zi=Function.prototype.toString,lr=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,ht,ue;if(typeof lr=="function"&&typeof Object.defineProperty=="function")try{ht=Object.defineProperty({},"length",{get:function(){throw ue}}),ue={},lr(function(){throw 42},null,ht)}catch(e){e!==ue&&(lr=null)}else lr=null;var cs=/^\s*class\b/,mt=function(r){try{var t=zi.call(r);return cs.test(t)}catch(n){return!1}},dt=function(r){try{return mt(r)?!1:(zi.call(r),!0)}catch(t){return!1}},fe=Object.prototype.toString,ys="[object Object]",vs="[object Function]",gs="[object GeneratorFunction]",ds="[object HTMLAllCollection]",hs="[object HTML document.all class]",ms="[object HTMLCollection]",bs=typeof Symbol=="function"&&!!Symbol.toStringTag,Ss=!(0 in[,]),bt=function(){return!1};typeof document=="object"&&(Li=document.all,fe.call(Li)===fe.call(document.all)&&(bt=function(r){if((Ss||!r)&&(typeof r=="undefined"||typeof r=="object"))try{var t=fe.call(r);return(t===ds||t===hs||t===ms||t===ys)&&r("")==null}catch(n){}return!1}));var Li;Ji.exports=lr?function(r){if(bt(r))return!0;if(!r||typeof r!="function"&&typeof r!="object")return!1;try{lr(r,null,ht)}catch(t){if(t!==ue)return!1}return!mt(r)&&dt(r)}:function(r){if(bt(r))return!0;if(!r||typeof r!="function"&&typeof r!="object")return!1;if(bs)return dt(r);if(mt(r))return!1;var t=fe.call(r);return t!==vs&&t!==gs&&!/^\[object HTML/.test(t)?!1:dt(r)}});var St=l((dg,Ki)=>{"use strict";o();i();Ki.exports=Hi()});var Xi=l((bg,Qi)=>{"use strict";o();i();var Vi=w(),As=ki(),ws=St(),Ps=ae(),Yi=Tr();Qi.exports=function(r,t){if(!Ps(t))throw new Vi("Assertion failed: IsPropertyKey(P) is not true");var n=As(r,t);if(n!=null){if(!ws(n))throw new Vi(Yi(t)+" is not a function: "+Yi(n));return n}}});var ra=l((wg,Zi)=>{"use strict";o();i();var Os=Te();Zi.exports=function(){return Os()&&!!Symbol.toStringTag}});var Ot=l((Eg,oa)=>{"use strict";o();i();var At=I(),ea=ra()(),ta,na,wt,Pt;ea&&(ta=At("Object.prototype.hasOwnProperty"),na=At("RegExp.prototype.exec"),wt={},pe=function(){throw wt},Pt={toString:pe,valueOf:pe},typeof Symbol.toPrimitive=="symbol"&&(Pt[Symbol.toPrimitive]=pe));var pe,Es=At("Object.prototype.toString"),qs=Object.getOwnPropertyDescriptor,xs="[object RegExp]";oa.exports=ea?function(r){if(!r||typeof r!="object")return!1;var t=qs(r,"lastIndex"),n=t&&ta(t,"value");if(!n)return!1;try{na(r,Pt)}catch(a){return a===wt}}:function(r){return!r||typeof r!="object"&&typeof r!="function"?!1:Es(r)===xs}});var Et=l(($g,ia)=>{"use strict";o();i();var $s=I(),Is=Ot(),Fs=$s("RegExp.prototype.exec"),Ts=w();ia.exports=function(r){if(!Is(r))throw new Ts("`regex` must be a RegExp");return function(n){return Fs(r,n)!==null}}});var ua=l((Tg,aa)=>{"use strict";o();i();aa.exports=function(r,t){for(var n=0;n<r.length;n+=1)if(!t(r[n],n,r))return!1;return!0}});var pa=l((_g,fa)=>{"use strict";o();i();fa.exports=function(r){if(r===null)return"Null";if(typeof r=="undefined")return"Undefined";if(typeof r=="function"||typeof r=="object")return"Object";if(typeof r=="number")return"Number";if(typeof r=="boolean")return"Boolean";if(typeof r=="string")return"String"}});var qt=l((Bg,sa)=>{"use strict";o();i();var Rs=pa();sa.exports=function(r){return typeof r=="symbol"?"Symbol":typeof r=="bigint"?"BigInt":Rs(r)}});var ya=l((jg,ca)=>{"use strict";o();i();var la=w(),Ns=Tr(),_s=ae(),Us=qt();ca.exports=function(r,t){if(Us(r)!=="Object")throw new la("Assertion failed: Type(O) is not Object");if(!_s(t))throw new la("Assertion failed: IsPropertyKey(P) is not true, got "+Ns(t));return r[t]}});var ga=l((kg,va)=>{"use strict";o();i();var Ds=F();va.exports=Ds("%Math.min%")});var xt=l((Jg,da)=>{"use strict";o();i();da.exports=Number.isNaN||function(r){return r!==r}});var ma=l((Vg,ha)=>{"use strict";o();i();var Bs=xt();ha.exports=function(e){return(typeof e=="number"||typeof e=="bigint")&&!Bs(e)&&e!==1/0&&e!==-1/0}});var se=l((Xg,Sa)=>{"use strict";o();i();var ba=F(),Ms=ba("%Math.abs%"),Cs=ba("%Math.floor%"),js=xt(),Gs=ma();Sa.exports=function(r){if(typeof r!="number"||js(r)||!Gs(r))return!1;var t=Ms(r);return Cs(t)===t}});var It=l((ed,Aa)=>{"use strict";o();i();var Ws=I(),$t=w(),ks=se(),Ls=Ws("String.prototype.slice");Aa.exports=function(r,t,n){if(typeof r!="string")throw new $t("Assertion failed: `string` must be a String");if(typeof t!="string")throw new $t("Assertion failed: `searchValue` must be a String");if(!ks(n)||n<0)throw new $t("Assertion failed: `fromIndex` must be a non-negative integer");var a=r.length;if(t===""&&n<=a)return n;for(var u=t.length,f=n;f<=a-u;f+=1){var c=Ls(r,f,f+u);if(c===t)return f}return-1}});var le=l((od,wa)=>{"use strict";o();i();var zs=w();wa.exports=function(r){if(r==null)throw new zs(arguments.length>0&&arguments[1]||"Cannot call method on "+r);return r}});var ce=l((ud,Pa)=>{"use strict";o();i();var Js=F(),Hs=Js("%String%"),Ks=w();Pa.exports=function(r){if(typeof r=="symbol")throw new Ks("Cannot convert a Symbol value to a string");return Hs(r)}});var Ft=l((sd,qa)=>{"use strict";o();i();var Vs=le(),Ys=ce(),Qs=I(),Oa=Qs("String.prototype.replace"),Ea=/^\s$/.test("\u180E"),Xs=Ea?/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/:/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/,Zs=Ea?/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/:/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/;qa.exports=function(){var r=Ys(Vs(this));return Oa(Oa(r,Xs,""),Zs,"")}});var Tt=l((yd,$a)=>{"use strict";o();i();var rl=Ft(),xa="\u200B",cr="\u180E";$a.exports=function(){return String.prototype.trim&&xa.trim()===xa&&cr.trim()===cr&&("_"+cr).trim()==="_"+cr&&(cr+"_").trim()===cr+"_"?String.prototype.trim:rl}});var Fa=l((dd,Ia)=>{"use strict";o();i();var el=Ar(),tl=Tt();Ia.exports=function(){var r=tl();return el(String.prototype,{trim:r},{trim:function(){return String.prototype.trim!==r}}),r}});var _a=l((bd,Na)=>{"use strict";o();i();var nl=Hr(),ol=Ar(),il=le(),al=Ft(),Ta=Tt(),ul=Fa(),fl=nl(Ta()),Ra=function(r){return il(r),fl(r)};ol(Ra,{getPolyfill:Ta,implementation:al,shim:ul});Na.exports=Ra});var Ma=l((wd,Ba)=>{"use strict";o();i();var Nt=F(),Rt=Nt("%Number%"),pl=Nt("%RegExp%"),sl=w(),Ua=Nt("%parseInt%"),ll=I(),ye=Et(),Da=ll("String.prototype.slice"),cl=ye(/^0b[01]+$/i),yl=ye(/^0o[0-7]+$/i),vl=ye(/^[-+]0x[0-9a-f]+$/i),gl=["\x85","\u200B","\uFFFE"].join(""),dl=new pl("["+gl+"]","g"),hl=ye(dl),ml=_a();Ba.exports=function e(r){if(typeof r!="string")throw new sl("Assertion failed: `argument` is not a String");if(cl(r))return Rt(Ua(Da(r,2),2));if(yl(r))return Rt(Ua(Da(r,2),8));if(hl(r)||vl(r))return NaN;var t=ml(r);return t!==r?e(t):Rt(r)}});var Ga=l((Ed,ja)=>{"use strict";o();i();var bl=w(),Ca=se(),Sl=I(),Al=Sl("String.prototype.slice");ja.exports=function(r,t,n){if(typeof r!="string"||!Ca(t)||arguments.length>2&&!Ca(n))throw new bl("`S` must be a String, and `inclusiveStart` and `exclusiveEnd` must be integers");return Al(r,t,arguments.length>2?n:r.length)}});var ka=l(($d,Wa)=>{"use strict";o();i();Wa.exports=function(r){return typeof r=="string"||typeof r=="undefined"}});var za=l((Td,La)=>{"use strict";o();i();var wl=I()("String.prototype.slice");La.exports=function(r,t){return r===t?!0:r.length>t.length?!1:wl(t,0,r.length)===r}});var Ya=l((_d,Va)=>{"use strict";o();i();var B=w(),Ka=Et(),Pl=ua(),_t=Tr(),Ol=ya(),El=Je(),ql=ga(),xl=It(),Ja=Ma(),M=Ga(),$l=ce(),Ha=qt(),Il=se(),Fl=ka(),Rr=za(),Tl=Ka(/^\$[0-9]/),Rl=Ka(/^\$[0-9][0-9]/);Va.exports=function(r,t,n,a,u,f){if(typeof r!="string")throw new B("Assertion failed: `matched` must be a String");if(typeof t!="string")throw new B("Assertion failed: `str` must be a String");if(!Il(n)||n<0)throw new B("Assertion failed: `position` must be a nonnegative integer, got "+_t(n));if(!El(a)||!Pl(a,Fl))throw new B("Assertion failed: `captures` must be a possibly-empty List of Strings or `undefined`, got "+_t(a));if(typeof u!="undefined"&&Ha(u)!=="Object")throw new B("Assertion failed: `namedCaptures` must be `undefined` or an Object");if(typeof f!="string")throw new B("Assertion failed: `replacementTemplate` must be a String");var c=t.length;if(n>c)throw new B("Assertion failed: position > stringLength, got "+_t(n));for(var y=f,h="";y!=="";){var g,d,v;if(Rr("$$",y))g="$$",d="$";else if(Rr("$`",y))g="$`",d=M(t,0,n);else if(Rr("$&",y))g="$&",d=r;else if(Rr("$'",y)){g="$'";var A=r.length,P=n+A;d=M(t,ql(P,c))}else if(Tl(y)){var S=Rl(y)?2:1,x=M(y,1,1+S),$=Ja(x);if($<0||$>99)throw new B("Assertion failed: `index` must be >= 0 and <= 99");var _=a.length;$>_&&S===2&&(S=1,x=M(x,0,1),$=Ja(x)),g=M(y,0,1+S),1<=$&&$<=_?(v=a[$-1],typeof v=="undefined"?d="":d=v):d=g}else if(Rr("$<",y)){var k=xl(y,">",0);if(k===-1||typeof u=="undefined")g="$<",d=g;else{g=M(y,0,k+1);var yr=M(y,2,k);if(Ha(u)!=="Object")throw new B("Assertion failed: Type(namedCaptures) is not Object");v=Ol(u,yr),typeof v=="undefined"?d="":d=$l(v)}}else g=M(y,0,1),d=g;var Nr=g.length;y=M(y,Nr),h+=d}return h}});var Dt=l((Bd,ru)=>{"use strict";o();i();var Qa=ei(),Nl=Xi(),_l=Ya(),Ul=St(),Dl=le(),ve=ce(),Xa=It(),Bl=F(),ge=I(),Ml=Ee()(),Cl=Ot(),jl=Bl("%Math.max%"),Za=w(),Gl=ge("Array.prototype.push"),Ut=ge("String.prototype.slice"),Wl=ge("String.prototype.indexOf"),kl=ge("String.prototype.replace");ru.exports=function(r,t){var n=Dl(this),a=Cl(r);if(a&&Wl(Ut(r,r.source.length+2),"g")===-1)throw new Za("use .replace for a non-global regex. NOTE: this may be allowed in the future.");if(Ml&&Symbol.replace){if(r!=null){var u=Nl(r,Symbol.replace);if(typeof u!="undefined")return Qa(u,r,[n,t])}}else if(a)return kl(n,r,t);var f=ve(n),c=ve(r),y=Ul(t);y||(t=ve(t));for(var h=c.length,g=jl(1,h),d=[],v=Xa(f,c,0);v!==-1;)Gl(d,v),v=Xa(f,c,v+g);for(var A=0,P="",S=0;S<d.length;S+=1){var x;if(y)x=ve(Qa(t,void 0,[c,d[S],f]));else{if(typeof t!="string")throw new Za("Assertion failed: `replaceValue` should be a string at this point");var $=[];x=_l(c,f,d[S],$,void 0,t)}var _=Ut(f,A,d[S]);P+=_+x,A=d[S]+h}return A<f.length&&(P+=Ut(f,A)),P}});var Bt=l((jd,eu)=>{"use strict";o();i();var Ll=Dt();eu.exports=function(){return String.prototype.replaceAll||Ll}});var nu=l((kd,tu)=>{"use strict";o();i();var zl=Ar(),Jl=Bt();tu.exports=function(){var r=Jl();return zl(String.prototype,{replaceAll:r},{replaceAll:function(){return String.prototype.replaceAll!==r}}),r}});var uu=l((Jd,au)=>{"use strict";o();i();var Hl=Hr(),Kl=Ar(),ou=Dt(),Vl=Bt(),Yl=nu(),iu=Hl(ou);Kl(iu,{getPolyfill:Vl,implementation:ou,shim:Yl});au.exports=iu});o();i();var Vd=lu(uu(),1);export{yu as DynamicSnippetsGenerator};
1
+ import{a as n}from"./chunk-BI26DLZ5.js";import"./chunk-D6NMQKNQ.js";import"./chunk-UZEM7EUP.js";import"./chunk-FD44EP2P.js";import"./chunk-VCNL2JWU.js";import"./chunk-Q6YO7G6Y.js";import"./chunk-2YRGTA73.js";import{f as e,g as r}from"./chunk-GUJUKQKZ.js";e();r();export{n as DynamicSnippetsGenerator};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export { DynamicSnippetsGenerator } from \"./DynamicSnippetsGenerator\";\n"],"mappings":"+PAAAA,IAAAC","names":["init_process","init_buffer"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fern-api/go-dynamic-snippets",
3
- "version": "0.0.15",
3
+ "version": "0.0.16",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/fern-api/fern.git",
@@ -1 +0,0 @@
1
- import{j as p,k as s,m as y,n as l,q as n}from"./chunk-XL5OWIY6.js";s();y();var c=class{constructor({context:t}){p(this,"context");this.context=t}getFilePropertyInfo({body:t,value:o}){var a;let e={fileFields:[],bodyPropertyFields:[]},i=(a=this.context.getRecord(o))!=null?a:{};for(let r of t.properties)switch(r.type){case"file":e.fileFields.push({name:this.context.getTypeName(r.name),value:this.getSingleFileProperty({property:r,record:i})});break;case"fileArray":e.fileFields.push({name:this.context.getTypeName(r.name),value:this.getArrayFileProperty({property:r,record:i})});break;case"bodyProperty":e.bodyPropertyFields.push({name:this.context.getTypeName(r.name.name),value:this.getBodyProperty({property:r,record:i})});break;default:l(r)}return e}getSingleFileProperty({property:t,record:o}){let e=this.context.getSingleFileValue({property:t,record:o});return e==null?n.TypeInstantiation.nop():n.TypeInstantiation.reference(this.context.getNewStringsReaderFunctionInvocation(e))}getArrayFileProperty({property:t,record:o}){let e=this.context.getFileArrayValues({property:t,record:o});return e==null?n.TypeInstantiation.nop():n.TypeInstantiation.slice({valueType:n.Type.reference(this.context.getIoReaderTypeReference()),values:e.map(i=>n.TypeInstantiation.reference(this.context.getNewStringsReaderFunctionInvocation(i)))})}getBodyProperty({property:t,record:o}){let e=o[t.name.wireValue];return e==null?n.TypeInstantiation.nop():this.context.dynamicTypeInstantiationMapper.convert({typeReference:t.typeReference,value:e})}};export{c as a};
@@ -1 +0,0 @@
1
- import{a as P,b as T,c as S,d as b,j as a,k as p,m as l,n as f,o as E}from"./chunk-XL5OWIY6.js";p();l();p();l();var y=class{constructor(){a(this,"reporter");a(this,"snippet");a(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:e,snippet:r}){(this.reporter==null||this.reporter.size()>e.errors.size())&&(this.reporter=e.errors.clone(),this.snippet=r)}getResponseOrThrow({endpoint:e}){var r;if(this.snippet!=null&&this.reporter!=null)return{snippet:this.snippet,errors:this.reporter.toDynamicSnippetErrors()};throw(r=this.err)!=null?r:new Error(`Failed to generate snippet for endpoint "${e.method} ${e.path}"`)}};var R=class{constructor(e){a(this,"context");this.context=e}async generate(e){let r=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let t=new y;for(let n of r){let i=this.context.clone(),u=this.createSnippetGenerator(i);try{let o=await u.generateSnippet({endpoint:n,request:e});if(i.errors.empty())return{snippet:o,errors:void 0};t.update({context:i,snippet:o})}catch(o){t.err==null&&(t.err=o)}}return t.getResponseOrThrow({endpoint:e.endpoint})}generateSync(e){let r=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let t=new y;for(let n of r){let i=this.context.clone(),u=this.createSnippetGenerator(i);try{let o=u.generateSnippetSync({endpoint:n,request:e});if(i.errors.empty())return{snippet:o,errors:void 0};t.update({context:i,snippet:o})}catch(o){t.err==null&&(t.err=o)}}return t.getResponseOrThrow({endpoint:e.endpoint})}};p();l();var s={Critical:"CRITICAL",Warning:"WARNING"},g=class h{constructor(){a(this,"errors");a(this,"path");this.errors=[],this.path=[]}add(e){this.errors.push(T(P({},e),{path:[...this.path]}))}scope(e){this.path.push(e)}unscope(){this.path.pop()}getBySeverity(e){return this.errors.filter(r=>r.severity===e)}empty(){return this.errors.length===0}size(){return this.errors.length}clone(){let e=new h;return e.errors=[...this.errors],e.path=[...this.path],e}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(e=>({severity:e.severity,path:e.path!=null?this.pathToStringArray(e.path):void 0,message:e.message}))}pathToStringArray(e){let r=[];for(let t of e){if(typeof t=="string"){r.push(t);continue}r[r.length-1]+=`[${t.index}]`}return r}};p();l();p();l();p();l();var v=class{constructor(){a(this,"REFERENCE_REGEX",/^(GET|POST|PUT|DELETE|PATCH)\s(\/[a-zA-Z0-9\/{}_-]*)$/)}validate(e){return this.REFERENCE_REGEX.test(e)?{type:"valid"}:{type:"invalid"}}tryParse(e){if(this.validate(e).type==="invalid")return;let t=e.match(this.REFERENCE_REGEX);if(!(t==null||t[1]==null||t[2]==null))return{method:t[1],path:t[2]}}};var w=class{constructor({ir:e,config:r}){a(this,"config");a(this,"errors");a(this,"_ir");a(this,"httpEndpointReferenceParser");this._ir=e,this.config=r,this.errors=new g,this.httpEndpointReferenceParser=new v}associateQueryParametersByWireValue({parameters:e,values:r}){let t=[];for(let[n,i]of Object.entries(r)){this.errors.scope(n);try{let u=e.find(m=>m.name.wireValue===n);if(u==null)throw this.newParameterNotRecognizedError(n);let o=this.isListTypeReference(u.typeReference)&&!Array.isArray(i)?[i]:i;t.push({name:u.name,typeReference:u.typeReference,value:o})}finally{this.errors.unscope()}}return t}associateByWireValue({parameters:e,values:r,ignoreMissingParameters:t}){let n=[];for(let[i,u]of Object.entries(r)){this.errors.scope(i);try{let o=e.find(m=>m.name.wireValue===i);if(o==null){if(t)continue;this.errors.add({severity:s.Critical,message:this.newParameterNotRecognizedError(i).message});continue}n.push({name:o.name,typeReference:o.typeReference,value:u})}finally{this.errors.unscope()}}return n}getSingleFileValue({property:e,record:r}){let t=r[e.wireValue];if(t!=null){if(typeof t!="string"){this.errors.add({severity:s.Critical,message:`Expected file value to be a string, got ${typeof t}`});return}return t}}getFileArrayValues({property:e,record:r}){let t=r[e.wireValue];if(t==null)return;if(!Array.isArray(t)){this.errors.add({severity:s.Critical,message:`Expected file array value to be an array of strings, got ${typeof t}`});return}let n=[];for(let i of t){if(typeof i!="string"){this.errors.add({severity:s.Critical,message:`Expected file array value to be an array of strings, got ${typeof i}`});return}n.push(i)}return n}getRecord(e){if(typeof e!="object"||Array.isArray(e)){this.errors.add({severity:s.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(e)?"array":typeof e}`});return}return e==null?{}:e}resolveNamedType({typeId:e}){let r=this._ir.types[e];if(r==null){this.errors.add({severity:s.Critical,message:`Type identified by "${e}" could not be found`});return}return r}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:r}){let t=this.getRecord(r);if(t==null)return;let n=e.discriminant.wireValue,i=t[n];if(i==null){this.errors.add({severity:s.Critical,message:this.newParameterNotRecognizedError(n).message});return}if(typeof i!="string"){this.errors.add({severity:s.Critical,message:`Expected discriminant value to be a string but got: ${typeof i}`});return}let u=e.types[i];if(u==null){this.errors.add({severity:s.Critical,message:`No type found for discriminant value "${i}"`});return}let x=t,{[n]:o}=x,m=b(x,[S(n)]);return{singleDiscriminatedUnionType:u,discriminantValue:u.discriminantValue,value:m}}resolveEndpointOrThrow(e){let r=this.httpEndpointReferenceParser.tryParse(e);if(r==null)throw new Error(`Failed to parse endpoint reference "${e}"`);return this.resolveEndpointLocationOrThrow(r)}resolveEndpointLocationOrThrow(e){let r=[];for(let t of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:t,parsedEndpoint:e})&&r.push(t);if(r.length===0)throw new Error(`Failed to find endpoint identified by "${e.method} ${e.path}"`);return r}needsRequestParameter({request:e,inlinePathParameters:r,inlineFileProperties:t}){var n;return this.includePathParametersInWrappedRequest({request:e,inlinePathParameters:r})||e.queryParameters!=null&&e.queryParameters.length>0||e.headers!=null&&e.headers.length>0?!0:e.body!=null?this.includeRequestBodyInWrappedRequest({body:e.body,inlineFileProperties:t}):!((n=e.metadata)!=null&&n.onlyPathParameters)}includePathParametersInWrappedRequest({request:e,inlinePathParameters:r}){var t,n;return r&&((n=(t=e.metadata)==null?void 0:t.includePathParameters)!=null?n:!1)}isFileUploadRequestBody(e){switch(e.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:f(e)}}resolveEnvironmentName(e){if(this._ir.environments==null)return;let r=this._ir.environments.environments;switch(r.type){case"singleBaseUrl":{let t=r.environments.find(n=>n.id===e);return t==null?void 0:t.name}case"multipleBaseUrls":{let t=r.environments.find(n=>n.id===e);return t==null?void 0:t.name}default:f(r)}}isSingleEnvironmentID(e){return typeof e=="string"}isMultiEnvironmentValues(e){return typeof e=="object"}validateMultiEnvironmentUrlValues(e){if(this._ir.environments==null)return this.errors.add({severity:s.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let r=this._ir.environments.environments;switch(r.type){case"singleBaseUrl":return this.errors.add({severity:s.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let t=r.environments[0];if(t==null)return this.errors.add({severity:s.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let n=new Set(E(t.urls));for(let i of E(e))n.has(i)&&n.delete(i);return n.size>0?(this.errors.add({severity:s.Critical,message:`The provided environments are invalid; got: [${Object.keys(e).join(", ")}], expected: [${E(t.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:e}){if(typeof e!="number"){this.errors.add({severity:s.Critical,message:this.newTypeMismatchError({expected:"number",value:e}).message});return}return e}getValueAsBoolean({value:e}){if(typeof e!="boolean"){this.errors.add({severity:s.Critical,message:this.newTypeMismatchError({expected:"boolean",value:e}).message});return}return e}getValueAsString({value:e}){if(typeof e!="string"){this.errors.add({severity:s.Critical,message:this.newTypeMismatchError({expected:"string",value:e}).message});return}return e}isOptional(e){switch(e.type){case"nullable":return this.isOptional(e.value);case"optional":return!0;case"named":{let r=this.resolveNamedType({typeId:e.value});return r==null?!1:r.type==="alias"?this.isNullable(r.typeReference):!1}}return!1}isNullable(e){switch(e.type){case"nullable":return!0;case"optional":return this.isNullable(e.value);case"named":{let r=this.resolveNamedType({typeId:e.value});return r==null?!1:r.type==="alias"?this.isNullable(r.typeReference):!1}}return!1}newAuthMismatchError({auth:e,values:r}){return new Error(`Expected auth type ${e.type}, got ${r.type}`)}newParameterNotRecognizedError(e){return new Error(`"${e}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:e,value:r}){return new Error(`Expected ${e}, got ${typeof r}`)}includeRequestBodyInWrappedRequest({body:e,inlineFileProperties:r}){switch(e.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:r});default:f(e)}}includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:r}){return this.fileUploadHasBodyProperties({fileUpload:e})||r&&this.fileUploadHasFileProperties({fileUpload:e})}fileUploadHasBodyProperties({fileUpload:e}){return e.properties.some(r=>{switch(r.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:f(r)}})}fileUploadHasFileProperties({fileUpload:e}){return e.properties.some(r=>{switch(r.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:f(r)}})}isListTypeReference(e){return e.type==="optional"?this.isListTypeReference(e.value):e.type==="list"||e.type==="set"}parsedEndpointMatches({endpoint:e,parsedEndpoint:r}){return e.location.method===r.method&&e.location.path===r.path}};p();l();var A={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};p();l();export{R as a,s as b,w as c,A as d};
@@ -1 +0,0 @@
1
- import{b as s,d as c}from"./chunk-EQTG6W6V.js";import{j as F,k as P,m as v,n as p,q as n}from"./chunk-XL5OWIY6.js";P();v();var x="example",A="fern",B="do",R="client",q=class{constructor({context:e,formatter:t}){F(this,"context");F(this,"formatter");this.context=e,this.formatter=t}async generateSnippet({endpoint:e,request:t}){var o;return await this.buildCodeBlock({endpoint:e,snippet:t}).toStringAsync({packageName:x,importPath:A,rootImportPath:this.context.rootImportPath,customConfig:(o=this.context.customConfig)!=null?o:{},formatter:this.formatter})}generateSnippetSync({endpoint:e,request:t}){var o;return this.buildCodeBlock({endpoint:e,snippet:t}).toString({packageName:x,importPath:A,rootImportPath:this.context.rootImportPath,customConfig:(o=this.context.customConfig)!=null?o:{},formatter:this.formatter})}buildCodeBlock({endpoint:e,snippet:t}){return n.func({name:B,parameters:[],return_:[],body:n.codeblock(r=>{r.writeNode(this.constructClient({endpoint:e,snippet:t})),r.writeLine(),r.writeNode(this.callMethod({endpoint:e,snippet:t}))})})}constructClient({endpoint:e,snippet:t}){return n.codeblock(r=>{r.write(`${R} := `),r.writeNode(this.getRootClientFuncInvocation(this.getConstructorArgs({endpoint:e,snippet:t})))})}callMethod({endpoint:e,snippet:t}){return n.invokeMethod({on:n.codeblock(R),method:this.getMethod({endpoint:e}),arguments_:[this.context.getContextTodoFunctionInvocation(),...this.getMethodArgs({endpoint:e,snippet:t})]})}getConstructorArgs({endpoint:e,snippet:t}){let r=[],o=this.getConstructorBaseUrlArg({baseUrl:t.baseURL,environment:t.environment});return o!=null&&r.push(o),e.auth!=null&&(t.auth!=null?r.push(this.getConstructorAuthArg({auth:e.auth,values:t.auth})):this.context.errors.add({severity:s.Warning,message:`Auth with ${e.auth.type} configuration is required for this endpoint`})),this.context.errors.scope(c.Headers),this.context.ir.headers!=null&&t.headers!=null&&r.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:t.headers})),this.context.errors.unscope(),r}getConstructorAuthArg({auth:e,values:t}){switch(e.type){case"basic":return t.type!=="basic"?(this.context.errors.add({severity:s.Critical,message:this.context.newAuthMismatchError({auth:e,values:t}).message}),n.TypeInstantiation.nop()):this.getConstructorBasicAuthArg({auth:e,values:t});case"bearer":return t.type!=="bearer"?(this.context.errors.add({severity:s.Critical,message:this.context.newAuthMismatchError({auth:e,values:t}).message}),n.TypeInstantiation.nop()):this.getConstructorBearerAuthArg({auth:e,values:t});case"header":return t.type!=="header"?(this.context.errors.add({severity:s.Critical,message:this.context.newAuthMismatchError({auth:e,values:t}).message}),n.TypeInstantiation.nop()):this.getConstructorHeaderAuthArg({auth:e,values:t});case"oauth":return t.type!=="oauth"?(this.context.errors.add({severity:s.Critical,message:this.context.newAuthMismatchError({auth:e,values:t}).message}),n.TypeInstantiation.nop()):(this.context.errors.add({severity:s.Warning,message:"The Go SDK doesn't support OAuth client credentials yet"}),n.TypeInstantiation.nop());default:p(e)}}getConstructorBasicAuthArg({auth:e,values:t}){return n.codeblock(r=>{r.writeNode(n.invokeFunc({func:n.typeReference({name:"WithBasicAuth",importPath:this.context.getOptionImportPath()}),arguments_:[n.TypeInstantiation.string(t.username),n.TypeInstantiation.string(t.password)]}))})}getConstructorBaseUrlArg({baseUrl:e,environment:t}){let r=this.getBaseUrlArg({baseUrl:e,environment:t});if(r!=null)return n.codeblock(o=>{o.writeNode(n.invokeFunc({func:n.typeReference({name:"WithBaseURL",importPath:this.context.getOptionImportPath()}),arguments_:[r]}))})}getBaseUrlArg({baseUrl:e,environment:t}){if(e!=null&&t!=null){this.context.errors.add({severity:s.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(e!=null)return n.TypeInstantiation.string(e);if(t!=null){if(this.context.isSingleEnvironmentID(t)){let r=this.context.getEnvironmentTypeReferenceFromID(t);if(r==null){this.context.errors.add({severity:s.Warning,message:`Environment ${JSON.stringify(t)} was not found`});return}return n.TypeInstantiation.reference(r)}this.context.isMultiEnvironmentValues(t)&&this.context.errors.add({severity:s.Warning,message:"The Go SDK doesn't support a multi-environment client option yet; use the baseUrl option instead"})}}getConstructorBearerAuthArg({auth:e,values:t}){return n.codeblock(r=>{r.writeNode(n.invokeFunc({func:n.typeReference({name:`With${e.token.pascalCase.unsafeName}`,importPath:this.context.getOptionImportPath()}),arguments_:[n.TypeInstantiation.string(t.token)]}))})}getConstructorHeaderAuthArg({auth:e,values:t}){return n.codeblock(r=>{r.writeNode(n.invokeFunc({func:n.typeReference({name:`With${e.header.name.name.pascalCase.unsafeName}`,importPath:this.context.getOptionImportPath()}),arguments_:[this.context.dynamicTypeInstantiationMapper.convert({typeReference:e.header.typeReference,value:t.value})]}))})}getConstructorHeaderArgs({headers:e,values:t}){let r=[];for(let o of e){let i=this.getConstructorHeaderArg({header:o,value:t.value});i!=null&&r.push(i)}return r}getConstructorHeaderArg({header:e,value:t}){let r=this.context.dynamicTypeInstantiationMapper.convert({typeReference:e.typeReference,value:t});if(!n.TypeInstantiation.isNop(r))return n.codeblock(o=>{o.writeNode(n.invokeFunc({func:n.typeReference({name:`With${e.name.name.pascalCase.unsafeName}`,importPath:this.context.getOptionImportPath()}),arguments_:[r]}))})}getMethodArgs({endpoint:e,snippet:t}){switch(e.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:e.request,snippet:t});case"body":return this.getMethodArgsForBodyRequest({request:e.request,snippet:t});default:p(e.request)}}getMethodArgsForBodyRequest({request:e,snippet:t}){var i,a;let r=[];this.context.errors.scope(c.PathParameters);let o=[...(i=this.context.ir.pathParameters)!=null?i:[],...(a=e.pathParameters)!=null?a:[]];return o.length>0&&r.push(...this.getPathParameters({namedParameters:o,snippet:t}).map(u=>u.value)),this.context.errors.unscope(),this.context.errors.scope(c.RequestBody),e.body!=null&&r.push(this.getBodyRequestArg({body:e.body,value:t.requestBody})),this.context.errors.unscope(),r}getBodyRequestArg({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicTypeInstantiationMapper.convert({typeReference:e.value,value:t});default:p(e)}}getBytesBodyRequestArg({value:e}){return typeof e!="string"?(this.context.errors.add({severity:s.Critical,message:`Expected bytes value to be a string, got ${typeof e}`}),n.TypeInstantiation.nop()):n.TypeInstantiation.bytes(e)}getMethodArgsForInlinedRequest({request:e,snippet:t}){var f,h,m,y,l,d;let r=[],{inlinePathParameters:o,inlineFileProperties:i}={inlinePathParameters:(h=(f=this.context.customConfig)==null?void 0:f.inlinePathParameters)!=null?h:!1,inlineFileProperties:(y=(m=this.context.customConfig)==null?void 0:m.inlineFileProperties)!=null?y:!1};this.context.errors.scope(c.PathParameters);let a=[],u=[...(l=this.context.ir.pathParameters)!=null?l:[],...(d=e.pathParameters)!=null?d:[]];u.length>0&&a.push(...this.getPathParameters({namedParameters:u,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(c.RequestBody);let g=this.getFilePropertyInfo({request:e,snippet:t});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:o})||r.push(...a.map(I=>I.value)),i||r.push(...g.fileFields.map(I=>I.value)),this.context.needsRequestParameter({request:e,inlinePathParameters:o,inlineFileProperties:i})&&r.push(this.getInlinedRequestArg({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:o})?a:[],filePropertyInfo:g})),r}getFilePropertyInfo({request:e,snippet:t}){return e.body==null||!this.context.isFileUploadRequestBody(e.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:e.body,value:t.requestBody})}getInlinedRequestArg({request:e,snippet:t,pathParameterFields:r,filePropertyInfo:o}){var h,m,y,l;this.context.errors.scope(c.QueryParameters);let a=this.context.associateQueryParametersByWireValue({parameters:(h=e.queryParameters)!=null?h:[],values:(m=t.queryParameters)!=null?m:{}}).map(d=>({name:d.name.name.pascalCase.unsafeName,value:this.context.dynamicTypeInstantiationMapper.convert(d)}));this.context.errors.unscope(),this.context.errors.scope(c.Headers);let g=this.context.associateByWireValue({parameters:(y=e.headers)!=null?y:[],values:(l=t.headers)!=null?l:{}}).map(d=>({name:d.name.name.pascalCase.unsafeName,value:this.context.dynamicTypeInstantiationMapper.convert(d)}));this.context.errors.unscope(),this.context.errors.scope(c.RequestBody);let f=e.body!=null?this.getInlinedRequestBodyStructFields({body:e.body,value:t.requestBody,filePropertyInfo:o}):[];return this.context.errors.unscope(),n.TypeInstantiation.structPointer({typeReference:n.typeReference({name:this.context.getMethodName(e.declaration.name),importPath:this.context.getImportPath(e.declaration.fernFilepath)}),fields:[...r,...a,...g,...f]})}getInlinedRequestBodyStructFields({body:e,value:t,filePropertyInfo:r}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyStructFields({parameters:e.value,value:t});case"referenced":return[this.getReferencedRequestBodyPropertyStructField({body:e,value:t})];case"fileUpload":return this.getFileUploadRequestBodyStructFields({filePropertyInfo:r});default:p(e)}}getFileUploadRequestBodyStructFields({filePropertyInfo:e}){var t;return(t=this.context.customConfig)!=null&&t.inlineFileProperties?[...e.fileFields,...e.bodyPropertyFields]:e.bodyPropertyFields}getReferencedRequestBodyPropertyStructField({body:e,value:t}){return{name:this.context.getTypeName(e.bodyKey),value:this.getReferencedRequestBodyPropertyTypeInstantiation({body:e.bodyType,value:t})}}getReferencedRequestBodyPropertyTypeInstantiation({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicTypeInstantiationMapper.convert({typeReference:e.value,value:t});default:p(e)}}getInlinedRequestBodyPropertyStructFields({parameters:e,value:t}){var i;let r=[],o=this.context.associateByWireValue({parameters:e,values:(i=this.context.getRecord(t))!=null?i:{}});for(let a of o)r.push({name:this.context.getTypeName(a.name.name),value:this.context.dynamicTypeInstantiationMapper.convert(a)});return r}getPathParameters({namedParameters:e,snippet:t}){var i;let r=[],o=this.context.associateByWireValue({parameters:e,values:(i=t.pathParameters)!=null?i:{}});for(let a of o)r.push({name:this.context.getTypeName(a.name.name),value:this.context.dynamicTypeInstantiationMapper.convert(a)});return r}getMethod({endpoint:e}){return e.declaration.fernFilepath.allParts.length>0?`${e.declaration.fernFilepath.allParts.map(t=>this.context.getMethodName(t)).join(".")}.${this.context.getMethodName(e.declaration.name)}`:this.context.getMethodName(e.declaration.name)}getRootClientFuncInvocation(e){return n.invokeFunc({func:n.typeReference({name:this.context.getClientConstructorName(),importPath:this.context.getClientImportPath()}),arguments_:e})}};export{q as a};