@fern-api/typescript-dynamic-snippets 0.0.8 → 0.0.10

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 (59) hide show
  1. package/cjs/DynamicSnippetsGenerator.cjs +22 -14
  2. package/cjs/DynamicSnippetsGenerator.cjs.map +1 -0
  3. package/cjs/DynamicSnippetsGenerator.d.cts +3 -2
  4. package/cjs/{DynamicSnippetsGeneratorContext-CmDa2k9n.d.cts → DynamicSnippetsGeneratorContext-ql0RJeI9.d.cts} +6 -0
  5. package/cjs/EndpointSnippetGenerator.cjs +19 -11
  6. package/cjs/EndpointSnippetGenerator.cjs.map +1 -0
  7. package/cjs/EndpointSnippetGenerator.d.cts +9 -2
  8. package/cjs/context/DynamicSnippetsGeneratorContext.cjs +22 -14
  9. package/cjs/context/DynamicSnippetsGeneratorContext.cjs.map +1 -0
  10. package/cjs/context/DynamicSnippetsGeneratorContext.d.cts +1 -1
  11. package/cjs/context/DynamicTypeLiteralMapper.cjs +22 -14
  12. package/cjs/context/DynamicTypeLiteralMapper.cjs.map +1 -0
  13. package/cjs/context/DynamicTypeLiteralMapper.d.cts +1 -1
  14. package/cjs/context/FilePropertyMapper.cjs +22 -14
  15. package/cjs/context/FilePropertyMapper.cjs.map +1 -0
  16. package/cjs/context/FilePropertyMapper.d.cts +1 -1
  17. package/cjs/index.cjs +24 -28
  18. package/cjs/index.cjs.map +1 -0
  19. package/cjs/index.d.cts +2 -2
  20. package/esm/DynamicSnippetsGenerator.d.ts +3 -2
  21. package/esm/DynamicSnippetsGenerator.js +2 -1
  22. package/esm/DynamicSnippetsGenerator.js.map +1 -0
  23. package/esm/{DynamicSnippetsGeneratorContext-CmDa2k9n.d.ts → DynamicSnippetsGeneratorContext-ql0RJeI9.d.ts} +6 -0
  24. package/esm/EndpointSnippetGenerator.d.ts +9 -2
  25. package/esm/EndpointSnippetGenerator.js +2 -1
  26. package/esm/EndpointSnippetGenerator.js.map +1 -0
  27. package/esm/chunk-5NPELJVJ.js +2 -0
  28. package/esm/chunk-5NPELJVJ.js.map +1 -0
  29. package/esm/chunk-6XSGLZSQ.js +15 -0
  30. package/esm/chunk-6XSGLZSQ.js.map +1 -0
  31. package/esm/chunk-BNKHNYGA.js +2 -0
  32. package/esm/chunk-BNKHNYGA.js.map +1 -0
  33. package/esm/chunk-EBBQY3NK.js +2 -0
  34. package/esm/chunk-EBBQY3NK.js.map +1 -0
  35. package/esm/{chunk-XC2QAVJY.js → chunk-FHTEY42V.js} +2 -1
  36. package/esm/chunk-FHTEY42V.js.map +1 -0
  37. package/esm/chunk-JWWD2UKR.js +2 -0
  38. package/esm/chunk-JWWD2UKR.js.map +1 -0
  39. package/esm/chunk-XCBZNNLA.js +35 -0
  40. package/esm/chunk-XCBZNNLA.js.map +1 -0
  41. package/esm/context/DynamicSnippetsGeneratorContext.d.ts +1 -1
  42. package/esm/context/DynamicSnippetsGeneratorContext.js +2 -1
  43. package/esm/context/DynamicSnippetsGeneratorContext.js.map +1 -0
  44. package/esm/context/DynamicTypeLiteralMapper.d.ts +1 -1
  45. package/esm/context/DynamicTypeLiteralMapper.js +2 -1
  46. package/esm/context/DynamicTypeLiteralMapper.js.map +1 -0
  47. package/esm/context/FilePropertyMapper.d.ts +1 -1
  48. package/esm/context/FilePropertyMapper.js +2 -1
  49. package/esm/context/FilePropertyMapper.js.map +1 -0
  50. package/esm/index.d.ts +2 -2
  51. package/esm/index.js +2 -13
  52. package/esm/index.js.map +1 -0
  53. package/package.json +1 -1
  54. package/esm/chunk-3SA25SVX.js +0 -1
  55. package/esm/chunk-D7ZDXIQ6.js +0 -1
  56. package/esm/chunk-DJQMPRPJ.js +0 -1
  57. package/esm/chunk-JGNWFXNM.js +0 -1
  58. package/esm/chunk-RL2XA35J.js +0 -27
  59. package/esm/chunk-T2HPPEKP.js +0 -14
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/context/FilePropertyMapper.ts"],"sourcesContent":["import { assertNever } from \"@fern-api/core-utils\";\nimport { FernIr } from \"@fern-api/dynamic-ir-sdk\";\nimport { ts } from \"@fern-api/typescript-ast\";\n\nimport { DynamicSnippetsGeneratorContext } from \"./DynamicSnippetsGeneratorContext\";\n\nexport interface FilePropertyInfo {\n fileFields: ts.ObjectField[];\n bodyPropertyFields: ts.ObjectField[];\n}\n\nexport class FilePropertyMapper {\n private context: DynamicSnippetsGeneratorContext;\n\n constructor({ context }: { context: DynamicSnippetsGeneratorContext }) {\n this.context = context;\n }\n\n public getFilePropertyInfo({\n body,\n value\n }: {\n body: FernIr.dynamic.FileUploadRequestBody;\n value: unknown;\n }): FilePropertyInfo {\n const result: FilePropertyInfo = {\n fileFields: [],\n bodyPropertyFields: []\n };\n const record = this.context.getRecord(value) ?? {};\n for (const property of body.properties) {\n switch (property.type) {\n case \"file\":\n result.fileFields.push({\n name: this.context.getPropertyName(property.name),\n value: this.getSingleFileProperty({ property, record })\n });\n break;\n case \"fileArray\":\n result.fileFields.push({\n name: this.context.getPropertyName(property.name),\n value: this.getArrayFileProperty({ property, record })\n });\n break;\n case \"bodyProperty\":\n result.bodyPropertyFields.push({\n name: this.context.getPropertyName(property.name.name),\n value: this.getBodyProperty({ property, record })\n });\n break;\n default:\n assertNever(property);\n }\n }\n return result;\n }\n\n private getSingleFileProperty({\n property,\n record\n }: {\n property: FernIr.dynamic.FileUploadRequestBodyProperty.File_;\n record: Record<string, unknown>;\n }): ts.TypeLiteral {\n const fileValue = this.context.getSingleFileValue({ property, record });\n if (fileValue == null) {\n return ts.TypeLiteral.nop();\n }\n return ts.TypeLiteral.blob(fileValue);\n }\n\n private getArrayFileProperty({\n property,\n record\n }: {\n property: FernIr.dynamic.FileUploadRequestBodyProperty.FileArray;\n record: Record<string, unknown>;\n }): ts.TypeLiteral {\n const fileValues = this.context.getFileArrayValues({ property, record });\n if (fileValues == null) {\n return ts.TypeLiteral.nop();\n }\n return ts.TypeLiteral.array({ values: fileValues.map((value) => ts.TypeLiteral.blob(value)) });\n }\n\n private getBodyProperty({\n property,\n record\n }: {\n property: FernIr.dynamic.NamedParameter;\n record: Record<string, unknown>;\n }): ts.TypeLiteral {\n const bodyPropertyValue = record[property.name.wireValue];\n if (bodyPropertyValue == null) {\n return ts.TypeLiteral.nop();\n }\n return this.context.dynamicTypeLiteralMapper.convert({\n typeReference: property.typeReference,\n value: bodyPropertyValue\n });\n }\n}\n"],"mappings":"oEAAAA,IAAAC,IAWO,IAAMC,EAAN,KAAyB,CAG5B,YAAY,CAAE,QAAAC,CAAQ,EAAiD,CAFvEC,EAAA,KAAQ,WAGJ,KAAK,QAAUD,CACnB,CAEO,oBAAoB,CACvB,KAAAE,EACA,MAAAC,CACJ,EAGqB,CAxBzB,IAAAC,EAyBQ,IAAMC,EAA2B,CAC7B,WAAY,CAAC,EACb,mBAAoB,CAAC,CACzB,EACMC,GAASF,EAAA,KAAK,QAAQ,UAAUD,CAAK,IAA5B,KAAAC,EAAiC,CAAC,EACjD,QAAWG,KAAYL,EAAK,WACxB,OAAQK,EAAS,KAAM,CACnB,IAAK,OACDF,EAAO,WAAW,KAAK,CACnB,KAAM,KAAK,QAAQ,gBAAgBE,EAAS,IAAI,EAChD,MAAO,KAAK,sBAAsB,CAAE,SAAAA,EAAU,OAAAD,CAAO,CAAC,CAC1D,CAAC,EACD,MACJ,IAAK,YACDD,EAAO,WAAW,KAAK,CACnB,KAAM,KAAK,QAAQ,gBAAgBE,EAAS,IAAI,EAChD,MAAO,KAAK,qBAAqB,CAAE,SAAAA,EAAU,OAAAD,CAAO,CAAC,CACzD,CAAC,EACD,MACJ,IAAK,eACDD,EAAO,mBAAmB,KAAK,CAC3B,KAAM,KAAK,QAAQ,gBAAgBE,EAAS,KAAK,IAAI,EACrD,MAAO,KAAK,gBAAgB,CAAE,SAAAA,EAAU,OAAAD,CAAO,CAAC,CACpD,CAAC,EACD,MACJ,QACIE,EAAYD,CAAQ,CAC5B,CAEJ,OAAOF,CACX,CAEQ,sBAAsB,CAC1B,SAAAE,EACA,OAAAD,CACJ,EAGmB,CACf,IAAMG,EAAY,KAAK,QAAQ,mBAAmB,CAAE,SAAAF,EAAU,OAAAD,CAAO,CAAC,EACtE,OAAIG,GAAa,KACNC,EAAG,YAAY,IAAI,EAEvBA,EAAG,YAAY,KAAKD,CAAS,CACxC,CAEQ,qBAAqB,CACzB,SAAAF,EACA,OAAAD,CACJ,EAGmB,CACf,IAAMK,EAAa,KAAK,QAAQ,mBAAmB,CAAE,SAAAJ,EAAU,OAAAD,CAAO,CAAC,EACvE,OAAIK,GAAc,KACPD,EAAG,YAAY,IAAI,EAEvBA,EAAG,YAAY,MAAM,CAAE,OAAQC,EAAW,IAAKR,GAAUO,EAAG,YAAY,KAAKP,CAAK,CAAC,CAAE,CAAC,CACjG,CAEQ,gBAAgB,CACpB,SAAAI,EACA,OAAAD,CACJ,EAGmB,CACf,IAAMM,EAAoBN,EAAOC,EAAS,KAAK,SAAS,EACxD,OAAIK,GAAqB,KACdF,EAAG,YAAY,IAAI,EAEvB,KAAK,QAAQ,yBAAyB,QAAQ,CACjD,cAAeH,EAAS,cACxB,MAAOK,CACX,CAAC,CACL,CACJ","names":["init_process","init_buffer","FilePropertyMapper","context","__publicField","body","value","_a","result","record","property","assertNever","fileValue","typescript_exports","fileValues","bodyPropertyValue"]}
@@ -0,0 +1,2 @@
1
+ import{b as c,d as o}from"./chunk-5NPELJVJ.js";import{a as h,b as g,g as P,h as I,i as x,j as u,l as n}from"./chunk-XCBZNNLA.js";I();x();var R="client",A="main",q={type:"primitive",value:"STRING"},b=class{constructor({context:e}){P(this,"context");this.context=e}async generateSnippet({endpoint:e,request:t}){return await this.buildCodeBlock({endpoint:e,snippet:t}).toStringAsync({customConfig:this.context.customConfig})}generateSnippetSync({endpoint:e,request:t}){return this.buildCodeBlock({endpoint:e,snippet:t}).toString({customConfig:this.context.customConfig})}async generateSnippetAst({endpoint:e,request:t}){return this.buildCodeBlock({endpoint:e,snippet:t})}buildCodeBlock({endpoint:e,snippet:t}){return n.codeblock(r=>{r.writeNode(n.function_({name:A,async:!0,parameters:[],body:n.codeblock(i=>{i.writeNodeStatement(this.constructClient({endpoint:e,snippet:t})),i.writeNodeStatement(this.callMethod({endpoint:e,snippet:t}))})})),r.writeNodeStatement(n.invokeFunction({function_:n.reference({name:A}),arguments_:[]}))})}constructClient({endpoint:e,snippet:t}){return n.variable({name:R,const:!0,initializer:n.instantiateClass({class_:n.reference({name:this.context.getRootClientName(),importFrom:this.context.getModuleImport()}),arguments_:[this.getConstructorArgs({endpoint:e,snippet:t})]})})}getConstructorArgs({endpoint:e,snippet:t}){let r=[],i=this.getConstructorEnvironmentArgs({baseUrl:t.baseURL,environment:t.environment});return i.length>0&&r.push(...i),e.auth!=null&&(t.auth!=null?r.push(...this.getConstructorAuthArgs({auth:e.auth,values:t.auth})):this.context.errors.add({severity:c.Warning,message:`Auth with ${e.auth.type} configuration is required for this endpoint`})),this.context.errors.scope(o.PathParameters),this.context.ir.pathParameters!=null&&r.push(...this.getPathParameters({namedParameters:this.context.ir.pathParameters,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(o.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.length===0?n.TypeLiteral.nop():n.TypeLiteral.object({fields:r})}getConstructorEnvironmentArgs({baseUrl:e,environment:t}){let r=this.getEnvironmentValue({baseUrl:e,environment:t});return r==null?[]:[{name:"environment",value:r}]}getEnvironmentValue({baseUrl:e,environment:t}){if(e!=null&&t!=null){this.context.errors.add({severity:c.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(e!=null)return n.TypeLiteral.string(e);if(t!=null){if(this.context.isSingleEnvironmentID(t)){let r=this.context.getEnvironmentTypeReferenceFromID(t);if(r==null){this.context.errors.add({severity:c.Warning,message:`Environment ${JSON.stringify(t)} was not found`});return}return n.TypeLiteral.reference(r)}if(this.context.isMultiEnvironmentValues(t))return this.context.validateMultiEnvironmentUrlValues(t)?n.TypeLiteral.object({fields:Object.entries(t).map(([r,i])=>({name:r,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:q,value:i})}))}):void 0}}getConstructorAuthArgs({auth:e,values:t}){switch(e.type){case"basic":return t.type!=="basic"?(this.addAuthMismatchError(e,t),[]):this.getConstructorBasicAuthArg({auth:e,values:t});case"bearer":return t.type!=="bearer"?(this.addAuthMismatchError(e,t),[]):this.getConstructorBearerAuthArgs({auth:e,values:t});case"header":return t.type!=="header"?(this.addAuthMismatchError(e,t),[]):this.getConstructorHeaderAuthArgs({auth:e,values:t});case"oauth":return t.type!=="oauth"?(this.addAuthMismatchError(e,t),[]):this.getConstructorOAuthArgs({auth:e,values:t});case"inferred":return t.type!=="inferred"?(this.addAuthMismatchError(e,t),[]):(this.addWarning("The TypeScript SDK v2 Generator does not support Inferred auth scheme yet"),[]);default:u(e)}}addAuthMismatchError(e,t){this.context.errors.add({severity:c.Critical,message:this.context.newAuthMismatchError({auth:e,values:t}).message})}addWarning(e){this.context.errors.add({severity:c.Warning,message:e})}getConstructorBasicAuthArg({auth:e,values:t}){return[{name:this.context.getPropertyName(e.username),value:n.TypeLiteral.string(t.username)},{name:this.context.getPropertyName(e.password),value:n.TypeLiteral.string(t.password)}]}getConstructorBearerAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.token),value:n.TypeLiteral.string(t.token)}]}getConstructorHeaderAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.header.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:e.header.typeReference,value:t.value})}]}getConstructorOAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.clientId),value:n.TypeLiteral.string(t.clientId)},{name:this.context.getPropertyName(e.clientSecret),value:n.TypeLiteral.string(t.clientSecret)}]}getConstructorHeaderArgs({headers:e,values:t}){let r=[];for(let i of e){let s=this.getConstructorHeaderArg({header:i,value:t.value});s!=null&&r.push(s)}return r}getConstructorHeaderArg({header:e,value:t}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:e.typeReference,value:t});if(!n.TypeLiteral.isNop(r))return{name:this.context.getPropertyName(e.name.name),value:r}}callMethod({endpoint:e,snippet:t}){return n.invokeMethod({on:n.reference({name:R}),method:this.getMethod({endpoint:e}),async:!0,arguments_:this.getMethodArgs({endpoint:e,snippet:t})})}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:u(e.request)}}getMethodArgsForBodyRequest({request:e,snippet:t}){var s,a;let r=[];this.context.errors.scope(o.PathParameters);let i=[...(s=this.context.ir.pathParameters)!=null?s:[],...(a=e.pathParameters)!=null?a:[]];return i.length>0&&r.push(...this.getPathParameters({namedParameters:i,snippet:t}).map(p=>p.value)),this.context.errors.unscope(),this.context.errors.scope(o.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.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t,convertOpts:{isForRequest:!0}});default:u(e)}}getBytesBodyRequestArg({value:e}){return typeof e!="string"?(this.context.errors.add({severity:c.Critical,message:`Expected bytes value to be a string, got ${typeof e}`}),n.TypeLiteral.nop()):n.TypeLiteral.blob(e)}getMethodArgsForInlinedRequest({request:e,snippet:t}){var f,F,l,m;let r=[],{inlinePathParameters:i,inlineFileProperties:s}={inlinePathParameters:(F=(f=this.context.customConfig)==null?void 0:f.inlinePathParameters)!=null?F:!1,inlineFileProperties:(m=(l=this.context.customConfig)==null?void 0:l.inlineFileProperties)!=null?m:!1};this.context.errors.scope(o.PathParameters);let a=[];e.pathParameters!=null&&a.push(...this.getPathParameters({namedParameters:e.pathParameters,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(o.RequestBody);let p=this.getFilePropertyInfo({request:e,snippet:t});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:i})||r.push(...a.map(d=>d.value)),s||r.push(...p.fileFields.map(d=>d.value)),this.context.needsRequestParameter({request:e,inlinePathParameters:i,inlineFileProperties:s})&&r.push(this.getInlinedRequestArg({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:i})?a:[],filePropertyInfo:p})),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:i}){var l,m,d,v;this.context.errors.scope(o.QueryParameters);let a=this.context.associateQueryParametersByWireValue({parameters:(l=e.queryParameters)!=null?l:[],values:(m=t.queryParameters)!=null?m:{}}).map(y=>({name:this.context.getPropertyName(y.name.name),value:this.context.dynamicTypeLiteralMapper.convert(g(h({},y),{convertOpts:{isForRequest:!0}}))}));this.context.errors.unscope(),this.context.errors.scope(o.Headers);let f=this.context.associateByWireValue({parameters:(d=e.headers)!=null?d:[],values:(v=t.headers)!=null?v:{}}).map(y=>({name:this.context.getPropertyName(y.name.name),value:this.context.dynamicTypeLiteralMapper.convert(g(h({},y),{convertOpts:{isForRequest:!0}}))}));this.context.errors.unscope(),this.context.errors.scope(o.RequestBody);let F=e.body!=null?this.getInlinedRequestBodyObjectFields({body:e.body,value:t.requestBody,filePropertyInfo:i}):[];return this.context.errors.unscope(),n.TypeLiteral.object({fields:[...r,...a,...f,...F]})}getInlinedRequestBodyObjectFields({body:e,value:t,filePropertyInfo:r}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyObjectFields({parameters:e.value,value:t});case"referenced":return[this.getReferencedRequestBodyPropertyObjectField({body:e,value:t})];case"fileUpload":return this.getFileUploadRequestBodyObjectFields({filePropertyInfo:r});default:u(e)}}getFileUploadRequestBodyObjectFields({filePropertyInfo:e}){var t;return(t=this.context.customConfig)!=null&&t.inlineFileProperties?[...e.fileFields,...e.bodyPropertyFields]:e.bodyPropertyFields}getReferencedRequestBodyPropertyObjectField({body:e,value:t}){return{name:this.context.getPropertyName(e.bodyKey),value:this.getReferencedRequestBodyPropertyTypeLiteral({body:e.bodyType,value:t})}}getReferencedRequestBodyPropertyTypeLiteral({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t,convertOpts:{isForRequest:!0}});default:u(e)}}getInlinedRequestBodyPropertyObjectFields({parameters:e,value:t}){var s;let r=[],i=this.context.associateByWireValue({parameters:e,values:(s=this.context.getRecord(t))!=null?s:{}});for(let a of i)r.push({name:this.context.getPropertyName(a.name.name),value:this.context.dynamicTypeLiteralMapper.convert(g(h({},a),{convertOpts:{isForRequest:!0}}))});return r}getPathParameters({namedParameters:e,snippet:t}){var s;let r=[],i=this.context.associateByWireValue({parameters:e,values:(s=t.pathParameters)!=null?s:{},ignoreMissingParameters:!0});for(let a of i)r.push({name:this.context.getPropertyName(a.name.name),value:this.context.dynamicTypeLiteralMapper.convert(g(h({},a),{convertOpts:{isForRequest:!0}}))});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)}};export{b as a};
2
+ //# sourceMappingURL=chunk-JWWD2UKR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/EndpointSnippetGenerator.ts"],"sourcesContent":["import { Scope, Severity } from \"@fern-api/browser-compatible-base-generator\";\nimport { assertNever } from \"@fern-api/core-utils\";\nimport { FernIr } from \"@fern-api/dynamic-ir-sdk\";\nimport { AstNode, ts } from \"@fern-api/typescript-ast\";\n\nimport { DynamicSnippetsGeneratorContext } from \"./context/DynamicSnippetsGeneratorContext\";\nimport { FilePropertyInfo } from \"./context/FilePropertyMapper\";\n\nconst CLIENT_VAR_NAME = \"client\";\nconst MAIN_FUNCTION_NAME = \"main\";\nconst STRING_TYPE_REFERENCE: FernIr.dynamic.TypeReference = {\n type: \"primitive\",\n value: \"STRING\"\n};\n\nexport class EndpointSnippetGenerator {\n private context: DynamicSnippetsGeneratorContext;\n\n constructor({ context }: { context: DynamicSnippetsGeneratorContext }) {\n this.context = context;\n }\n\n public async generateSnippet({\n endpoint,\n request\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n request: FernIr.dynamic.EndpointSnippetRequest;\n }): Promise<string> {\n const code = this.buildCodeBlock({ endpoint, snippet: request });\n return await code.toStringAsync({ customConfig: this.context.customConfig });\n }\n\n public generateSnippetSync({\n endpoint,\n request\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n request: FernIr.dynamic.EndpointSnippetRequest;\n }): string {\n const code = this.buildCodeBlock({ endpoint, snippet: request });\n return code.toString({ customConfig: this.context.customConfig });\n }\n\n public async generateSnippetAst({\n endpoint,\n request\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n request: FernIr.dynamic.EndpointSnippetRequest;\n }): Promise<AstNode> {\n return this.buildCodeBlock({ endpoint, snippet: request });\n }\n\n private buildCodeBlock({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): ts.AstNode {\n return ts.codeblock((writer) => {\n writer.writeNode(\n ts.function_({\n name: MAIN_FUNCTION_NAME,\n async: true,\n parameters: [],\n body: ts.codeblock((writer) => {\n writer.writeNodeStatement(this.constructClient({ endpoint, snippet }));\n writer.writeNodeStatement(this.callMethod({ endpoint, snippet }));\n })\n })\n );\n writer.writeNodeStatement(\n ts.invokeFunction({\n function_: ts.reference({\n name: MAIN_FUNCTION_NAME\n }),\n arguments_: []\n })\n );\n });\n }\n\n private constructClient({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): ts.AstNode {\n return ts.variable({\n name: CLIENT_VAR_NAME,\n const: true,\n initializer: ts.instantiateClass({\n class_: ts.reference({\n name: this.context.getRootClientName(),\n importFrom: this.context.getModuleImport()\n }),\n arguments_: [this.getConstructorArgs({ endpoint, snippet })]\n })\n });\n }\n\n private getConstructorArgs({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): ts.AstNode {\n const fields: ts.ObjectField[] = [];\n const environmentArgs = this.getConstructorEnvironmentArgs({\n baseUrl: snippet.baseURL,\n environment: snippet.environment\n });\n if (environmentArgs.length > 0) {\n fields.push(...environmentArgs);\n }\n if (endpoint.auth != null) {\n if (snippet.auth != null) {\n fields.push(...this.getConstructorAuthArgs({ auth: endpoint.auth, values: snippet.auth }));\n } else {\n this.context.errors.add({\n severity: Severity.Warning,\n message: `Auth with ${endpoint.auth.type} configuration is required for this endpoint`\n });\n }\n }\n\n this.context.errors.scope(Scope.PathParameters);\n if (this.context.ir.pathParameters != null) {\n fields.push(...this.getPathParameters({ namedParameters: this.context.ir.pathParameters, snippet }));\n }\n this.context.errors.unscope();\n\n this.context.errors.scope(Scope.Headers);\n if (this.context.ir.headers != null && snippet.headers != null) {\n fields.push(\n ...this.getConstructorHeaderArgs({ headers: this.context.ir.headers, values: snippet.headers })\n );\n }\n this.context.errors.unscope();\n if (fields.length === 0) {\n return ts.TypeLiteral.nop();\n }\n return ts.TypeLiteral.object({ fields });\n }\n\n private getConstructorEnvironmentArgs({\n baseUrl,\n environment\n }: {\n baseUrl: string | undefined;\n environment: FernIr.dynamic.EnvironmentValues | undefined;\n }): ts.ObjectField[] {\n const environmentValue = this.getEnvironmentValue({ baseUrl, environment });\n if (environmentValue == null) {\n return [];\n }\n return [\n {\n name: \"environment\",\n value: environmentValue\n }\n ];\n }\n\n private getEnvironmentValue({\n baseUrl,\n environment\n }: {\n baseUrl: string | undefined;\n environment: FernIr.dynamic.EnvironmentValues | undefined;\n }): ts.TypeLiteral | undefined {\n if (baseUrl != null && environment != null) {\n this.context.errors.add({\n severity: Severity.Critical,\n message: \"Cannot specify both baseUrl and environment options\"\n });\n return undefined;\n }\n if (baseUrl != null) {\n return ts.TypeLiteral.string(baseUrl);\n }\n if (environment != null) {\n if (this.context.isSingleEnvironmentID(environment)) {\n const environmentTypeReference = this.context.getEnvironmentTypeReferenceFromID(environment);\n if (environmentTypeReference == null) {\n this.context.errors.add({\n severity: Severity.Warning,\n message: `Environment ${JSON.stringify(environment)} was not found`\n });\n return undefined;\n }\n return ts.TypeLiteral.reference(environmentTypeReference);\n }\n if (this.context.isMultiEnvironmentValues(environment)) {\n if (!this.context.validateMultiEnvironmentUrlValues(environment)) {\n return undefined;\n }\n return ts.TypeLiteral.object({\n fields: Object.entries(environment).map(([key, value]) => ({\n name: key,\n value: this.context.dynamicTypeLiteralMapper.convert({\n typeReference: STRING_TYPE_REFERENCE,\n value\n })\n }))\n });\n }\n }\n return undefined;\n }\n\n private getConstructorAuthArgs({\n auth,\n values\n }: {\n auth: FernIr.dynamic.Auth;\n values: FernIr.dynamic.AuthValues;\n }): ts.ObjectField[] {\n switch (auth.type) {\n case \"basic\":\n if (values.type !== \"basic\") {\n this.addAuthMismatchError(auth, values);\n return [];\n }\n return this.getConstructorBasicAuthArg({ auth, values });\n case \"bearer\":\n if (values.type !== \"bearer\") {\n this.addAuthMismatchError(auth, values);\n return [];\n }\n return this.getConstructorBearerAuthArgs({ auth, values });\n case \"header\":\n if (values.type !== \"header\") {\n this.addAuthMismatchError(auth, values);\n return [];\n }\n return this.getConstructorHeaderAuthArgs({ auth, values });\n case \"oauth\":\n if (values.type !== \"oauth\") {\n this.addAuthMismatchError(auth, values);\n return [];\n }\n return this.getConstructorOAuthArgs({ auth, values });\n case \"inferred\":\n if (values.type !== \"inferred\") {\n this.addAuthMismatchError(auth, values);\n return [];\n }\n this.addWarning(\"The TypeScript SDK v2 Generator does not support Inferred auth scheme yet\");\n return [];\n default:\n assertNever(auth);\n }\n }\n\n private addAuthMismatchError(auth: FernIr.dynamic.Auth, values: FernIr.dynamic.AuthValues): void {\n this.context.errors.add({\n severity: Severity.Critical,\n message: this.context.newAuthMismatchError({ auth, values }).message\n });\n }\n\n private addWarning(message: string): void {\n this.context.errors.add({ severity: Severity.Warning, message });\n }\n\n private getConstructorBasicAuthArg({\n auth,\n values\n }: {\n auth: FernIr.dynamic.BasicAuth;\n values: FernIr.dynamic.BasicAuthValues;\n }): ts.ObjectField[] {\n return [\n {\n name: this.context.getPropertyName(auth.username),\n value: ts.TypeLiteral.string(values.username)\n },\n {\n name: this.context.getPropertyName(auth.password),\n value: ts.TypeLiteral.string(values.password)\n }\n ];\n }\n\n private getConstructorBearerAuthArgs({\n auth,\n values\n }: {\n auth: FernIr.dynamic.BearerAuth;\n values: FernIr.dynamic.BearerAuthValues;\n }): ts.ObjectField[] {\n return [\n {\n name: this.context.getPropertyName(auth.token),\n value: ts.TypeLiteral.string(values.token)\n }\n ];\n }\n\n private getConstructorHeaderAuthArgs({\n auth,\n values\n }: {\n auth: FernIr.dynamic.HeaderAuth;\n values: FernIr.dynamic.HeaderAuthValues;\n }): ts.ObjectField[] {\n return [\n {\n name: this.context.getPropertyName(auth.header.name.name),\n value: this.context.dynamicTypeLiteralMapper.convert({\n typeReference: auth.header.typeReference,\n value: values.value\n })\n }\n ];\n }\n\n private getConstructorOAuthArgs({\n auth,\n values\n }: {\n auth: FernIr.dynamic.OAuth;\n values: FernIr.dynamic.OAuthValues;\n }): ts.ObjectField[] {\n return [\n {\n name: this.context.getPropertyName(auth.clientId),\n value: ts.TypeLiteral.string(values.clientId)\n },\n {\n name: this.context.getPropertyName(auth.clientSecret),\n value: ts.TypeLiteral.string(values.clientSecret)\n }\n ];\n }\n\n private getConstructorHeaderArgs({\n headers,\n values\n }: {\n headers: FernIr.dynamic.NamedParameter[];\n values: FernIr.dynamic.Values;\n }): ts.ObjectField[] {\n const fields: ts.ObjectField[] = [];\n for (const header of headers) {\n const field = this.getConstructorHeaderArg({ header, value: values.value });\n if (field != null) {\n fields.push(field);\n }\n }\n return fields;\n }\n\n private getConstructorHeaderArg({\n header,\n value\n }: {\n header: FernIr.dynamic.NamedParameter;\n value: unknown;\n }): ts.ObjectField | undefined {\n const typeLiteral = this.context.dynamicTypeLiteralMapper.convert({\n typeReference: header.typeReference,\n value\n });\n if (ts.TypeLiteral.isNop(typeLiteral)) {\n // Literal header values (e.g. \"X-API-Version\") should not be included in the\n // client constructor.\n return undefined;\n }\n return {\n name: this.context.getPropertyName(header.name.name),\n value: typeLiteral\n };\n }\n\n private callMethod({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): ts.AstNode {\n return ts.invokeMethod({\n on: ts.reference({ name: CLIENT_VAR_NAME }),\n method: this.getMethod({ endpoint }),\n async: true,\n arguments_: this.getMethodArgs({ endpoint, snippet })\n });\n }\n\n private getMethodArgs({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): ts.AstNode[] {\n switch (endpoint.request.type) {\n case \"inlined\":\n return this.getMethodArgsForInlinedRequest({ request: endpoint.request, snippet });\n case \"body\":\n return this.getMethodArgsForBodyRequest({ request: endpoint.request, snippet });\n default:\n assertNever(endpoint.request);\n }\n }\n\n private getMethodArgsForBodyRequest({\n request,\n snippet\n }: {\n request: FernIr.dynamic.BodyRequest;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): ts.TypeLiteral[] {\n const args: ts.TypeLiteral[] = [];\n\n this.context.errors.scope(Scope.PathParameters);\n const pathParameters = [...(this.context.ir.pathParameters ?? []), ...(request.pathParameters ?? [])];\n if (pathParameters.length > 0) {\n args.push(\n ...this.getPathParameters({ namedParameters: pathParameters, snippet }).map((field) => field.value)\n );\n }\n this.context.errors.unscope();\n\n this.context.errors.scope(Scope.RequestBody);\n if (request.body != null) {\n args.push(this.getBodyRequestArg({ body: request.body, value: snippet.requestBody }));\n }\n this.context.errors.unscope();\n\n return args;\n }\n\n private getBodyRequestArg({\n body,\n value\n }: {\n body: FernIr.dynamic.ReferencedRequestBodyType;\n value: unknown;\n }): ts.TypeLiteral {\n switch (body.type) {\n case \"bytes\":\n return this.getBytesBodyRequestArg({ value });\n case \"typeReference\":\n return this.context.dynamicTypeLiteralMapper.convert({\n typeReference: body.value,\n value,\n convertOpts: {\n isForRequest: true\n }\n });\n default:\n assertNever(body);\n }\n }\n\n private getBytesBodyRequestArg({ value }: { value: unknown }): ts.TypeLiteral {\n if (typeof value !== \"string\") {\n this.context.errors.add({\n severity: Severity.Critical,\n message: `Expected bytes value to be a string, got ${typeof value}`\n });\n return ts.TypeLiteral.nop();\n }\n return ts.TypeLiteral.blob(value);\n }\n\n private getMethodArgsForInlinedRequest({\n request,\n snippet\n }: {\n request: FernIr.dynamic.InlinedRequest;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): ts.TypeLiteral[] {\n const args: ts.TypeLiteral[] = [];\n\n const { inlinePathParameters, inlineFileProperties } = {\n inlinePathParameters: this.context.customConfig?.inlinePathParameters ?? false,\n inlineFileProperties: this.context.customConfig?.inlineFileProperties ?? false\n };\n\n this.context.errors.scope(Scope.PathParameters);\n const pathParameterFields: ts.ObjectField[] = [];\n if (request.pathParameters != null) {\n pathParameterFields.push(...this.getPathParameters({ namedParameters: request.pathParameters, snippet }));\n }\n this.context.errors.unscope();\n\n this.context.errors.scope(Scope.RequestBody);\n const filePropertyInfo = this.getFilePropertyInfo({ request, snippet });\n this.context.errors.unscope();\n\n if (\n !this.context.includePathParametersInWrappedRequest({\n request,\n inlinePathParameters\n })\n ) {\n args.push(...pathParameterFields.map((field) => field.value));\n }\n\n if (!inlineFileProperties) {\n args.push(...filePropertyInfo.fileFields.map((field) => field.value));\n }\n\n if (\n this.context.needsRequestParameter({\n request,\n inlinePathParameters,\n inlineFileProperties\n })\n ) {\n args.push(\n this.getInlinedRequestArg({\n request,\n snippet,\n pathParameterFields: this.context.includePathParametersInWrappedRequest({\n request,\n inlinePathParameters\n })\n ? pathParameterFields\n : [],\n filePropertyInfo\n })\n );\n }\n return args;\n }\n\n private getFilePropertyInfo({\n request,\n snippet\n }: {\n request: FernIr.dynamic.InlinedRequest;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): FilePropertyInfo {\n if (request.body == null || !this.context.isFileUploadRequestBody(request.body)) {\n return {\n fileFields: [],\n bodyPropertyFields: []\n };\n }\n return this.context.filePropertyMapper.getFilePropertyInfo({\n body: request.body,\n value: snippet.requestBody\n });\n }\n\n private getInlinedRequestArg({\n request,\n snippet,\n pathParameterFields,\n filePropertyInfo\n }: {\n request: FernIr.dynamic.InlinedRequest;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n pathParameterFields: ts.ObjectField[];\n filePropertyInfo: FilePropertyInfo;\n }): ts.TypeLiteral {\n this.context.errors.scope(Scope.QueryParameters);\n const queryParameters = this.context.associateQueryParametersByWireValue({\n parameters: request.queryParameters ?? [],\n values: snippet.queryParameters ?? {}\n });\n const queryParameterFields = queryParameters.map((queryParameter) => ({\n name: this.context.getPropertyName(queryParameter.name.name),\n value: this.context.dynamicTypeLiteralMapper.convert({\n ...queryParameter,\n convertOpts: { isForRequest: true }\n })\n }));\n this.context.errors.unscope();\n\n this.context.errors.scope(Scope.Headers);\n const headers = this.context.associateByWireValue({\n parameters: request.headers ?? [],\n values: snippet.headers ?? {}\n });\n const headerFields = headers.map((header) => ({\n name: this.context.getPropertyName(header.name.name),\n value: this.context.dynamicTypeLiteralMapper.convert({ ...header, convertOpts: { isForRequest: true } })\n }));\n this.context.errors.unscope();\n\n this.context.errors.scope(Scope.RequestBody);\n const requestBodyFields =\n request.body != null\n ? this.getInlinedRequestBodyObjectFields({\n body: request.body,\n value: snippet.requestBody,\n filePropertyInfo\n })\n : [];\n this.context.errors.unscope();\n\n return ts.TypeLiteral.object({\n fields: [...pathParameterFields, ...queryParameterFields, ...headerFields, ...requestBodyFields]\n });\n }\n\n private getInlinedRequestBodyObjectFields({\n body,\n value,\n filePropertyInfo\n }: {\n body: FernIr.dynamic.InlinedRequestBody;\n value: unknown;\n filePropertyInfo: FilePropertyInfo;\n }): ts.ObjectField[] {\n switch (body.type) {\n case \"properties\":\n return this.getInlinedRequestBodyPropertyObjectFields({ parameters: body.value, value });\n case \"referenced\":\n return [this.getReferencedRequestBodyPropertyObjectField({ body, value })];\n case \"fileUpload\":\n return this.getFileUploadRequestBodyObjectFields({ filePropertyInfo });\n default:\n assertNever(body);\n }\n }\n\n private getFileUploadRequestBodyObjectFields({\n filePropertyInfo\n }: {\n filePropertyInfo: FilePropertyInfo;\n }): ts.ObjectField[] {\n if (this.context.customConfig?.inlineFileProperties) {\n return [...filePropertyInfo.fileFields, ...filePropertyInfo.bodyPropertyFields];\n }\n return filePropertyInfo.bodyPropertyFields;\n }\n\n private getReferencedRequestBodyPropertyObjectField({\n body,\n value\n }: {\n body: FernIr.dynamic.ReferencedRequestBody;\n value: unknown;\n }): ts.ObjectField {\n return {\n name: this.context.getPropertyName(body.bodyKey),\n value: this.getReferencedRequestBodyPropertyTypeLiteral({ body: body.bodyType, value })\n };\n }\n\n private getReferencedRequestBodyPropertyTypeLiteral({\n body,\n value\n }: {\n body: FernIr.dynamic.ReferencedRequestBodyType;\n value: unknown;\n }): ts.TypeLiteral {\n switch (body.type) {\n case \"bytes\":\n return this.getBytesBodyRequestArg({ value });\n case \"typeReference\":\n return this.context.dynamicTypeLiteralMapper.convert({\n typeReference: body.value,\n value,\n convertOpts: { isForRequest: true }\n });\n default:\n assertNever(body);\n }\n }\n\n private getInlinedRequestBodyPropertyObjectFields({\n parameters,\n value\n }: {\n parameters: FernIr.dynamic.NamedParameter[];\n value: unknown;\n }): ts.ObjectField[] {\n const fields: ts.ObjectField[] = [];\n\n const bodyProperties = this.context.associateByWireValue({\n parameters,\n values: this.context.getRecord(value) ?? {}\n });\n for (const parameter of bodyProperties) {\n fields.push({\n name: this.context.getPropertyName(parameter.name.name),\n value: this.context.dynamicTypeLiteralMapper.convert({\n ...parameter,\n convertOpts: { isForRequest: true }\n })\n });\n }\n\n return fields;\n }\n\n private getPathParameters({\n namedParameters,\n snippet\n }: {\n namedParameters: FernIr.dynamic.NamedParameter[];\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): ts.ObjectField[] {\n const args: ts.ObjectField[] = [];\n\n const pathParameters = this.context.associateByWireValue({\n parameters: namedParameters,\n values: snippet.pathParameters ?? {},\n\n // Path parameters are distributed across the client constructor\n // and the request method, so we ignore missing parameters here.\n ignoreMissingParameters: true\n });\n for (const parameter of pathParameters) {\n args.push({\n name: this.context.getPropertyName(parameter.name.name),\n value: this.context.dynamicTypeLiteralMapper.convert({\n ...parameter,\n convertOpts: { isForRequest: true }\n })\n });\n }\n\n return args;\n }\n\n private getMethod({ endpoint }: { endpoint: FernIr.dynamic.Endpoint }): string {\n if (endpoint.declaration.fernFilepath.allParts.length > 0) {\n return `${endpoint.declaration.fernFilepath.allParts\n .map((val) => this.context.getMethodName(val))\n .join(\".\")}.${this.context.getMethodName(endpoint.declaration.name)}`;\n }\n return this.context.getMethodName(endpoint.declaration.name);\n }\n}\n"],"mappings":"iIAAAA,IAAAC,IAQA,IAAMC,EAAkB,SAClBC,EAAqB,OACrBC,EAAsD,CACxD,KAAM,YACN,MAAO,QACX,EAEaC,EAAN,KAA+B,CAGlC,YAAY,CAAE,QAAAC,CAAQ,EAAiD,CAFvEC,EAAA,KAAQ,WAGJ,KAAK,QAAUD,CACnB,CAEA,MAAa,gBAAgB,CACzB,SAAAE,EACA,QAAAC,CACJ,EAGoB,CAEhB,OAAO,MADM,KAAK,eAAe,CAAE,SAAAD,EAAU,QAASC,CAAQ,CAAC,EAC7C,cAAc,CAAE,aAAc,KAAK,QAAQ,YAAa,CAAC,CAC/E,CAEO,oBAAoB,CACvB,SAAAD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EAAK,KAAK,CACN,KAAM,KAAK,QAAQ,gBAAgBiB,EAAU,KAAK,IAAI,EACtD,MAAO,KAAK,QAAQ,yBAAyB,QAAQN,EAAAC,EAAA,GAC9CK,GAD8C,CAEjD,YAAa,CAAE,aAAc,EAAK,CACtC,EAAC,CACL,CAAC,EAGL,OAAOjB,CACX,CAEQ,UAAU,CAAE,SAAAzB,CAAS,EAAkD,CAC3E,OAAIA,EAAS,YAAY,aAAa,SAAS,OAAS,EAC7C,GAAGA,EAAS,YAAY,aAAa,SACvC,IAAK4C,GAAQ,KAAK,QAAQ,cAAcA,CAAG,CAAC,EAC5C,KAAK,GAAG,CAAC,IAAI,KAAK,QAAQ,cAAc5C,EAAS,YAAY,IAAI,CAAC,GAEpE,KAAK,QAAQ,cAAcA,EAAS,YAAY,IAAI,CAC/D,CACJ","names":["init_process","init_buffer","CLIENT_VAR_NAME","MAIN_FUNCTION_NAME","STRING_TYPE_REFERENCE","EndpointSnippetGenerator","context","__publicField","endpoint","request","snippet","typescript_exports","writer","fields","environmentArgs","Severity","Scope","baseUrl","environment","environmentValue","environmentTypeReference","key","value","auth","values","assertNever","message","headers","header","field","typeLiteral","_a","_b","args","pathParameters","body","_c","_d","inlinePathParameters","inlineFileProperties","pathParameterFields","filePropertyInfo","queryParameterFields","queryParameter","__spreadProps","__spreadValues","headerFields","requestBodyFields","parameters","bodyProperties","parameter","namedParameters","val"]}
@@ -0,0 +1,35 @@
1
+ var te=Object.create;var nt=Object.defineProperty,ee=Object.defineProperties,re=Object.getOwnPropertyDescriptor,ie=Object.getOwnPropertyDescriptors,ne=Object.getOwnPropertyNames,it=Object.getOwnPropertySymbols,oe=Object.getPrototypeOf,dt=Object.prototype.hasOwnProperty,It=Object.prototype.propertyIsEnumerable;var wt=(r,e,t)=>e in r?nt(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,br=(r,e)=>{for(var t in e||(e={}))dt.call(e,t)&&wt(r,t,e[t]);if(it)for(var t of it(e))It.call(e,t)&&wt(r,t,e[t]);return r},Sr=(r,e)=>ee(r,ie(e));var Nr=r=>typeof r=="symbol"?r:r+"",Rr=(r,e)=>{var t={};for(var i in r)dt.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&it)for(var i of it(r))e.indexOf(i)<0&&It.call(r,i)&&(t[i]=r[i]);return t};var xt=(r,e)=>()=>(r&&(e=r(r=0)),e);var _r=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),se=(r,e)=>{for(var t in e)nt(r,t,{get:e[t],enumerable:!0})},ae=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ne(e))!dt.call(r,n)&&n!==t&&nt(r,n,{get:()=>e[n],enumerable:!(i=re(e,n))||i.enumerable});return r};var Br=(r,e,t)=>(t=r!=null?te(oe(r)):{},ae(e||!r||!r.__esModule?nt(t,"default",{value:r,enumerable:!0}):t,r));var l=(r,e,t)=>wt(r,typeof e!="symbol"?e+"":e,t);function St(){throw new Error("setTimeout has not been defined")}function Nt(){throw new Error("clearTimeout has not been defined")}function Rt(r){if(L===setTimeout)return setTimeout(r,0);if((L===St||!L)&&setTimeout)return L=setTimeout,setTimeout(r,0);try{return L(r,0)}catch(e){try{return L.call(null,r,0)}catch(t){return L.call(this,r,0)}}}function ue(r){if(F===clearTimeout)return clearTimeout(r);if((F===Nt||!F)&&clearTimeout)return F=clearTimeout,clearTimeout(r);try{return F(r)}catch(e){try{return F.call(null,r)}catch(t){return F.call(this,r)}}}function fe(){!W||!U||(W=!1,U.length?N=U.concat(N):ot=-1,N.length&&_t())}function _t(){if(!W){var r=Rt(fe);W=!0;for(var e=N.length;e;){for(U=N,N=[];++ot<e;)U&&U[ot].run();ot=-1,e=N.length}U=null,W=!1,ue(r)}}function le(r){var e=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)e[t-1]=arguments[t];N.push(new Bt(r,e)),N.length===1&&!W&&Rt(_t)}function Bt(r,e){this.fun=r,this.array=e}function $(){}function Se(r){throw new Error("process.binding is not supported")}function Ne(){return"/"}function Re(r){throw new Error("process.chdir is not supported")}function _e(){return 0}function Le(r){var e=Be.call(j)*.001,t=Math.floor(e),i=Math.floor(e%1*1e9);return r&&(t=t-r[0],i=i-r[1],i<0&&(t--,i+=1e9)),[t,i]}function Ce(){var r=new Date,e=r-Fe;return e/1e3}var L,F,N,W,U,ot,ce,he,pe,me,we,de,xe,ye,ge,Te,Ae,Ee,ke,ve,Ie,be,j,Be,Fe,x,bt,c=xt(()=>{"use strict";L=St,F=Nt;typeof globalThis.setTimeout=="function"&&(L=setTimeout);typeof globalThis.clearTimeout=="function"&&(F=clearTimeout);N=[],W=!1,ot=-1;Bt.prototype.run=function(){this.fun.apply(null,this.array)};ce="browser",he="browser",pe=!0,me={},we=[],de="",xe={},ye={},ge={};Te=$,Ae=$,Ee=$,ke=$,ve=$,Ie=$,be=$;j=globalThis.performance||{},Be=j.now||j.mozNow||j.msNow||j.oNow||j.webkitNow||function(){return new Date().getTime()};Fe=new Date;x={nextTick:le,title:ce,browser:pe,env:me,argv:we,version:de,versions:xe,on:Te,addListener:Ae,once:Ee,off:ke,removeListener:ve,removeAllListeners:Ie,emit:be,binding:Se,cwd:Ne,chdir:Re,umask:_e,hrtime:Le,platform:he,release:ye,config:ge,uptime:Ce},bt={};Object.keys(bt).forEach(r=>{let e=r.split("."),t=x;for(let i=0;i<e.length;i++){let n=e[i];i===e.length-1?t[n]=bt[r]:t=t[n]||(t[n]={})}})});function Ut(){gt=!0;for(var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,t=r.length;e<t;++e)v[e]=r[e],E[r.charCodeAt(e)]=e;E[45]=62,E[95]=63}function $e(r){gt||Ut();var e,t,i,n,o,s,u=r.length;if(u%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=r[u-2]==="="?2:r[u-1]==="="?1:0,s=new Ue(u*3/4-o),i=o>0?u-4:u;var f=0;for(e=0,t=0;e<i;e+=4,t+=3)n=E[r.charCodeAt(e)]<<18|E[r.charCodeAt(e+1)]<<12|E[r.charCodeAt(e+2)]<<6|E[r.charCodeAt(e+3)],s[f++]=n>>16&255,s[f++]=n>>8&255,s[f++]=n&255;return o===2?(n=E[r.charCodeAt(e)]<<2|E[r.charCodeAt(e+1)]>>4,s[f++]=n&255):o===1&&(n=E[r.charCodeAt(e)]<<10|E[r.charCodeAt(e+1)]<<4|E[r.charCodeAt(e+2)]>>2,s[f++]=n>>8&255,s[f++]=n&255),s}function Pe(r){return v[r>>18&63]+v[r>>12&63]+v[r>>6&63]+v[r&63]}function Me(r,e,t){for(var i,n=[],o=e;o<t;o+=3)i=(r[o]<<16)+(r[o+1]<<8)+r[o+2],n.push(Pe(i));return n.join("")}function Lt(r){gt||Ut();for(var e,t=r.length,i=t%3,n="",o=[],s=16383,u=0,f=t-i;u<f;u+=s)o.push(Me(r,u,u+s>f?f:u+s));return i===1?(e=r[t-1],n+=v[e>>2],n+=v[e<<4&63],n+="=="):i===2&&(e=(r[t-2]<<8)+r[t-1],n+=v[e>>10],n+=v[e>>4&63],n+=v[e<<2&63],n+="="),o.push(n),o.join("")}function st(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function R(r,e){if(st()<e)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(r=new Uint8Array(e),r.__proto__=a.prototype):(r===null&&(r=new a(e)),r.length=e),r}function a(r,e,t){if(!a.TYPED_ARRAY_SUPPORT&&!(this instanceof a))return new a(r,e,t);if(typeof r=="number"){if(typeof e=="string")throw new Error("If encoding is specified then the first argument must be a string");return Tt(this,r)}return $t(this,r,e,t)}function $t(r,e,t,i){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer!="undefined"&&e instanceof ArrayBuffer?De(r,e,t,i):typeof e=="string"?Oe(r,e,t):je(r,e)}function Pt(r){if(typeof r!="number")throw new TypeError('"size" argument must be a number');if(r<0)throw new RangeError('"size" argument must not be negative')}function Ye(r,e,t,i){return Pt(e),e<=0?R(r,e):t!==void 0?typeof i=="string"?R(r,e).fill(t,i):R(r,e).fill(t):R(r,e)}function Tt(r,e){if(Pt(e),r=R(r,e<0?0:At(e)|0),!a.TYPED_ARRAY_SUPPORT)for(var t=0;t<e;++t)r[t]=0;return r}function Oe(r,e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!a.isEncoding(t))throw new TypeError('"encoding" must be a valid string encoding');var i=Mt(e,t)|0;r=R(r,i);var n=r.write(e,t);return n!==i&&(r=r.slice(0,n)),r}function yt(r,e){var t=e.length<0?0:At(e.length)|0;r=R(r,t);for(var i=0;i<t;i+=1)r[i]=e[i]&255;return r}function De(r,e,t,i){if(e.byteLength,t<0||e.byteLength<t)throw new RangeError("'offset' is out of bounds");if(e.byteLength<t+(i||0))throw new RangeError("'length' is out of bounds");return t===void 0&&i===void 0?e=new Uint8Array(e):i===void 0?e=new Uint8Array(e,t):e=new Uint8Array(e,t,i),a.TYPED_ARRAY_SUPPORT?(r=e,r.__proto__=a.prototype):r=yt(r,e),r}function je(r,e){if(I(e)){var t=At(e.length)|0;return r=R(r,t),r.length===0||e.copy(r,0,0,t),r}if(e){if(typeof ArrayBuffer!="undefined"&&e.buffer instanceof ArrayBuffer||"length"in e)return typeof e.length!="number"||ar(e.length)?R(r,0):yt(r,e);if(e.type==="Buffer"&&Array.isArray(e.data))return yt(r,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function At(r){if(r>=st())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+st().toString(16)+" bytes");return r|0}function I(r){return!!(r!=null&&r._isBuffer)}function Mt(r,e){if(I(r))return r.length;if(typeof ArrayBuffer!="undefined"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(r)||r instanceof ArrayBuffer))return r.byteLength;typeof r!="string"&&(r=""+r);var t=r.length;if(t===0)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":case void 0:return at(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return Jt(r).length;default:if(i)return at(r).length;e=(""+e).toLowerCase(),i=!0}}function We(r,e,t){var i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return qe(this,e,t);case"utf8":case"utf-8":return Dt(this,e,t);case"ascii":return Xe(this,e,t);case"latin1":case"binary":return Ze(this,e,t);case"base64":return Ke(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return tr(this,e,t);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),i=!0}}function P(r,e,t){var i=r[e];r[e]=r[t],r[t]=i}function Yt(r,e,t,i,n){if(r.length===0)return-1;if(typeof t=="string"?(i=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,isNaN(t)&&(t=n?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(n)return-1;t=r.length-1}else if(t<0)if(n)t=0;else return-1;if(typeof e=="string"&&(e=a.from(e,i)),I(e))return e.length===0?-1:Ft(r,e,t,i,n);if(typeof e=="number")return e=e&255,a.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):Ft(r,[e],t,i,n);throw new TypeError("val must be string, number or Buffer")}function Ft(r,e,t,i,n){var o=1,s=r.length,u=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(r.length<2||e.length<2)return-1;o=2,s/=2,u/=2,t/=2}function f(g,S){return o===1?g[S]:g.readUInt16BE(S*o)}var m;if(n){var w=-1;for(m=t;m<s;m++)if(f(r,m)===f(e,w===-1?0:m-w)){if(w===-1&&(w=m),m-w+1===u)return w*o}else w!==-1&&(m-=m-w),w=-1}else for(t+u>s&&(t=s-u),m=t;m>=0;m--){for(var p=!0,d=0;d<u;d++)if(f(r,m+d)!==f(e,d)){p=!1;break}if(p)return m}return-1}function Ve(r,e,t,i){t=Number(t)||0;var n=r.length-t;i?(i=Number(i),i>n&&(i=n)):i=n;var o=e.length;if(o%2!==0)throw new TypeError("Invalid hex string");i>o/2&&(i=o/2);for(var s=0;s<i;++s){var u=parseInt(e.substr(s*2,2),16);if(isNaN(u))return s;r[t+s]=u}return s}function Je(r,e,t,i){return lt(at(e,r.length-t),r,t,i)}function Ot(r,e,t,i){return lt(or(e),r,t,i)}function Ge(r,e,t,i){return Ot(r,e,t,i)}function ze(r,e,t,i){return lt(Jt(e),r,t,i)}function He(r,e,t,i){return lt(sr(e,r.length-t),r,t,i)}function Ke(r,e,t){return e===0&&t===r.length?Lt(r):Lt(r.slice(e,t))}function Dt(r,e,t){t=Math.min(r.length,t);for(var i=[],n=e;n<t;){var o=r[n],s=null,u=o>239?4:o>223?3:o>191?2:1;if(n+u<=t){var f,m,w,p;switch(u){case 1:o<128&&(s=o);break;case 2:f=r[n+1],(f&192)===128&&(p=(o&31)<<6|f&63,p>127&&(s=p));break;case 3:f=r[n+1],m=r[n+2],(f&192)===128&&(m&192)===128&&(p=(o&15)<<12|(f&63)<<6|m&63,p>2047&&(p<55296||p>57343)&&(s=p));break;case 4:f=r[n+1],m=r[n+2],w=r[n+3],(f&192)===128&&(m&192)===128&&(w&192)===128&&(p=(o&15)<<18|(f&63)<<12|(m&63)<<6|w&63,p>65535&&p<1114112&&(s=p))}}s===null?(s=65533,u=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|s&1023),i.push(s),n+=u}return Qe(i)}function Qe(r){var e=r.length;if(e<=Ct)return String.fromCharCode.apply(String,r);for(var t="",i=0;i<e;)t+=String.fromCharCode.apply(String,r.slice(i,i+=Ct));return t}function Xe(r,e,t){var i="";t=Math.min(r.length,t);for(var n=e;n<t;++n)i+=String.fromCharCode(r[n]&127);return i}function Ze(r,e,t){var i="";t=Math.min(r.length,t);for(var n=e;n<t;++n)i+=String.fromCharCode(r[n]);return i}function qe(r,e,t){var i=r.length;(!e||e<0)&&(e=0),(!t||t<0||t>i)&&(t=i);for(var n="",o=e;o<t;++o)n+=nr(r[o]);return n}function tr(r,e,t){for(var i=r.slice(e,t),n="",o=0;o<i.length;o+=2)n+=String.fromCharCode(i[o]+i[o+1]*256);return n}function T(r,e,t){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+e>t)throw new RangeError("Trying to access beyond buffer length")}function A(r,e,t,i,n,o){if(!I(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<o)throw new RangeError('"value" argument is out of bounds');if(t+i>r.length)throw new RangeError("Index out of range")}function ut(r,e,t,i){e<0&&(e=65535+e+1);for(var n=0,o=Math.min(r.length-t,2);n<o;++n)r[t+n]=(e&255<<8*(i?n:1-n))>>>(i?n:1-n)*8}function ft(r,e,t,i){e<0&&(e=4294967295+e+1);for(var n=0,o=Math.min(r.length-t,4);n<o;++n)r[t+n]=e>>>(i?n:3-n)*8&255}function jt(r,e,t,i,n,o){if(t+i>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function Wt(r,e,t,i,n){return n||jt(r,e,t,4,34028234663852886e22,-34028234663852886e22),zt(r,e,t,i,23,4),t+4}function Vt(r,e,t,i,n){return n||jt(r,e,t,8,17976931348623157e292,-17976931348623157e292),zt(r,e,t,i,52,8),t+8}function rr(r){if(r=ir(r).replace(er,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function ir(r){return r.trim?r.trim():r.replace(/^\s+|\s+$/g,"")}function nr(r){return r<16?"0"+r.toString(16):r.toString(16)}function at(r,e){e=e||1/0;for(var t,i=r.length,n=null,o=[],s=0;s<i;++s){if(t=r.charCodeAt(s),t>55295&&t<57344){if(!n){if(t>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(s+1===i){(e-=3)>-1&&o.push(239,191,189);continue}n=t;continue}if(t<56320){(e-=3)>-1&&o.push(239,191,189),n=t;continue}t=(n-55296<<10|t-56320)+65536}else n&&(e-=3)>-1&&o.push(239,191,189);if(n=null,t<128){if((e-=1)<0)break;o.push(t)}else if(t<2048){if((e-=2)<0)break;o.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;o.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;o.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return o}function or(r){for(var e=[],t=0;t<r.length;++t)e.push(r.charCodeAt(t)&255);return e}function sr(r,e){for(var t,i,n,o=[],s=0;s<r.length&&!((e-=2)<0);++s)t=r.charCodeAt(s),i=t>>8,n=t%256,o.push(n),o.push(i);return o}function Jt(r){return $e(rr(r))}function lt(r,e,t,i){for(var n=0;n<i&&!(n+t>=e.length||n>=r.length);++n)e[n+t]=r[n];return n}function ar(r){return r!==r}function ur(r){return r!=null&&(!!r._isBuffer||Gt(r)||fr(r))}function Gt(r){return!!r.constructor&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function fr(r){return typeof r.readFloatLE=="function"&&typeof r.slice=="function"&&Gt(r.slice(0,0))}function ct(r,e,t,i,n){var o,s,u=n*8-i-1,f=(1<<u)-1,m=f>>1,w=-7,p=t?n-1:0,d=t?-1:1,g=r[e+p];for(p+=d,o=g&(1<<-w)-1,g>>=-w,w+=u;w>0;o=o*256+r[e+p],p+=d,w-=8);for(s=o&(1<<-w)-1,o>>=-w,w+=i;w>0;s=s*256+r[e+p],p+=d,w-=8);if(o===0)o=1-m;else{if(o===f)return s?NaN:(g?-1:1)*(1/0);s=s+Math.pow(2,i),o=o-m}return(g?-1:1)*s*Math.pow(2,o-i)}function zt(r,e,t,i,n,o){var s,u,f,m=o*8-n-1,w=(1<<m)-1,p=w>>1,d=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=i?0:o-1,S=i?1:-1,rt=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,s=w):(s=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-s))<1&&(s--,f*=2),s+p>=1?e+=d/f:e+=d*Math.pow(2,1-p),e*f>=2&&(s++,f/=2),s+p>=w?(u=0,s=w):s+p>=1?(u=(e*f-1)*Math.pow(2,n),s=s+p):(u=e*Math.pow(2,p-1)*Math.pow(2,n),s=0));n>=8;r[t+g]=u&255,g+=S,u/=256,n-=8);for(s=s<<n|u,m+=n;m>0;r[t+g]=s&255,g+=S,s/=256,m-=8);r[t+g-S]|=rt*128}var v,E,Ue,gt,Ct,er,Ht=xt(()=>{"use strict";c();h();v=[],E=[],Ue=typeof Uint8Array!="undefined"?Uint8Array:Array,gt=!1;a.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;a.poolSize=8192;a._augment=function(r){return r.__proto__=a.prototype,r};a.from=function(r,e,t){return $t(null,r,e,t)};a.kMaxLength=st();a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&a[Symbol.species]);a.alloc=function(r,e,t){return Ye(null,r,e,t)};a.allocUnsafe=function(r){return Tt(null,r)};a.allocUnsafeSlow=function(r){return Tt(null,r)};a.isBuffer=ur;a.compare=function(e,t){if(!I(e)||!I(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var i=e.length,n=t.length,o=0,s=Math.min(i,n);o<s;++o)if(e[o]!==t[o]){i=e[o],n=t[o];break}return i<n?-1:n<i?1:0};a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};a.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return a.alloc(0);var i;if(t===void 0)for(t=0,i=0;i<e.length;++i)t+=e[i].length;var n=a.allocUnsafe(t),o=0;for(i=0;i<e.length;++i){var s=e[i];if(!I(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,o),o+=s.length}return n};a.byteLength=Mt;a.prototype._isBuffer=!0;a.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)P(this,t,t+1);return this};a.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)P(this,t,t+3),P(this,t+1,t+2);return this};a.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)P(this,t,t+7),P(this,t+1,t+6),P(this,t+2,t+5),P(this,t+3,t+4);return this};a.prototype.toString=function(){var e=this.length|0;return e===0?"":arguments.length===0?Dt(this,0,e):We.apply(this,arguments)};a.prototype.equals=function(e){if(!I(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:a.compare(this,e)===0};a.prototype.compare=function(e,t,i,n,o){if(!I(e))throw new TypeError("Argument must be a Buffer");if(t===void 0&&(t=0),i===void 0&&(i=e?e.length:0),n===void 0&&(n=0),o===void 0&&(o=this.length),t<0||i>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=i)return 0;if(n>=o)return-1;if(t>=i)return 1;if(t>>>=0,i>>>=0,n>>>=0,o>>>=0,this===e)return 0;for(var s=o-n,u=i-t,f=Math.min(s,u),m=this.slice(n,o),w=e.slice(t,i),p=0;p<f;++p)if(m[p]!==w[p]){s=m[p],u=w[p];break}return s<u?-1:u<s?1:0};a.prototype.includes=function(e,t,i){return this.indexOf(e,t,i)!==-1};a.prototype.indexOf=function(e,t,i){return Yt(this,e,t,i,!0)};a.prototype.lastIndexOf=function(e,t,i){return Yt(this,e,t,i,!1)};a.prototype.write=function(e,t,i,n){if(t===void 0)n="utf8",i=this.length,t=0;else if(i===void 0&&typeof t=="string")n=t,i=this.length,t=0;else if(isFinite(t))t=t|0,isFinite(i)?(i=i|0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-t;if((i===void 0||i>o)&&(i=o),e.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var s=!1;;)switch(n){case"hex":return Ve(this,e,t,i);case"utf8":case"utf-8":return Je(this,e,t,i);case"ascii":return Ot(this,e,t,i);case"latin1":case"binary":return Ge(this,e,t,i);case"base64":return ze(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return He(this,e,t,i);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}};a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};Ct=4096;a.prototype.slice=function(e,t){var i=this.length;e=~~e,t=t===void 0?i:~~t,e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),t<e&&(t=e);var n;if(a.TYPED_ARRAY_SUPPORT)n=this.subarray(e,t),n.__proto__=a.prototype;else{var o=t-e;n=new a(o,void 0);for(var s=0;s<o;++s)n[s]=this[s+e]}return n};a.prototype.readUIntLE=function(e,t,i){e=e|0,t=t|0,i||T(e,t,this.length);for(var n=this[e],o=1,s=0;++s<t&&(o*=256);)n+=this[e+s]*o;return n};a.prototype.readUIntBE=function(e,t,i){e=e|0,t=t|0,i||T(e,t,this.length);for(var n=this[e+--t],o=1;t>0&&(o*=256);)n+=this[e+--t]*o;return n};a.prototype.readUInt8=function(e,t){return t||T(e,1,this.length),this[e]};a.prototype.readUInt16LE=function(e,t){return t||T(e,2,this.length),this[e]|this[e+1]<<8};a.prototype.readUInt16BE=function(e,t){return t||T(e,2,this.length),this[e]<<8|this[e+1]};a.prototype.readUInt32LE=function(e,t){return t||T(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};a.prototype.readUInt32BE=function(e,t){return t||T(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};a.prototype.readIntLE=function(e,t,i){e=e|0,t=t|0,i||T(e,t,this.length);for(var n=this[e],o=1,s=0;++s<t&&(o*=256);)n+=this[e+s]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*t)),n};a.prototype.readIntBE=function(e,t,i){e=e|0,t=t|0,i||T(e,t,this.length);for(var n=t,o=1,s=this[e+--n];n>0&&(o*=256);)s+=this[e+--n]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*t)),s};a.prototype.readInt8=function(e,t){return t||T(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};a.prototype.readInt16LE=function(e,t){t||T(e,2,this.length);var i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i};a.prototype.readInt16BE=function(e,t){t||T(e,2,this.length);var i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i};a.prototype.readInt32LE=function(e,t){return t||T(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};a.prototype.readInt32BE=function(e,t){return t||T(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};a.prototype.readFloatLE=function(e,t){return t||T(e,4,this.length),ct(this,e,!0,23,4)};a.prototype.readFloatBE=function(e,t){return t||T(e,4,this.length),ct(this,e,!1,23,4)};a.prototype.readDoubleLE=function(e,t){return t||T(e,8,this.length),ct(this,e,!0,52,8)};a.prototype.readDoubleBE=function(e,t){return t||T(e,8,this.length),ct(this,e,!1,52,8)};a.prototype.writeUIntLE=function(e,t,i,n){if(e=+e,t=t|0,i=i|0,!n){var o=Math.pow(2,8*i)-1;A(this,e,t,i,o,0)}var s=1,u=0;for(this[t]=e&255;++u<i&&(s*=256);)this[t+u]=e/s&255;return t+i};a.prototype.writeUIntBE=function(e,t,i,n){if(e=+e,t=t|0,i=i|0,!n){var o=Math.pow(2,8*i)-1;A(this,e,t,i,o,0)}var s=i-1,u=1;for(this[t+s]=e&255;--s>=0&&(u*=256);)this[t+s]=e/u&255;return t+i};a.prototype.writeUInt8=function(e,t,i){return e=+e,t=t|0,i||A(this,e,t,1,255,0),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=e&255,t+1};a.prototype.writeUInt16LE=function(e,t,i){return e=+e,t=t|0,i||A(this,e,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8):ut(this,e,t,!0),t+2};a.prototype.writeUInt16BE=function(e,t,i){return e=+e,t=t|0,i||A(this,e,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e&255):ut(this,e,t,!1),t+2};a.prototype.writeUInt32LE=function(e,t,i){return e=+e,t=t|0,i||A(this,e,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255):ft(this,e,t,!0),t+4};a.prototype.writeUInt32BE=function(e,t,i){return e=+e,t=t|0,i||A(this,e,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255):ft(this,e,t,!1),t+4};a.prototype.writeIntLE=function(e,t,i,n){if(e=+e,t=t|0,!n){var o=Math.pow(2,8*i-1);A(this,e,t,i,o-1,-o)}var s=0,u=1,f=0;for(this[t]=e&255;++s<i&&(u*=256);)e<0&&f===0&&this[t+s-1]!==0&&(f=1),this[t+s]=(e/u>>0)-f&255;return t+i};a.prototype.writeIntBE=function(e,t,i,n){if(e=+e,t=t|0,!n){var o=Math.pow(2,8*i-1);A(this,e,t,i,o-1,-o)}var s=i-1,u=1,f=0;for(this[t+s]=e&255;--s>=0&&(u*=256);)e<0&&f===0&&this[t+s+1]!==0&&(f=1),this[t+s]=(e/u>>0)-f&255;return t+i};a.prototype.writeInt8=function(e,t,i){return e=+e,t=t|0,i||A(this,e,t,1,127,-128),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=e&255,t+1};a.prototype.writeInt16LE=function(e,t,i){return e=+e,t=t|0,i||A(this,e,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8):ut(this,e,t,!0),t+2};a.prototype.writeInt16BE=function(e,t,i){return e=+e,t=t|0,i||A(this,e,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e&255):ut(this,e,t,!1),t+2};a.prototype.writeInt32LE=function(e,t,i){return e=+e,t=t|0,i||A(this,e,t,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):ft(this,e,t,!0),t+4};a.prototype.writeInt32BE=function(e,t,i){return e=+e,t=t|0,i||A(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255):ft(this,e,t,!1),t+4};a.prototype.writeFloatLE=function(e,t,i){return Wt(this,e,t,!0,i)};a.prototype.writeFloatBE=function(e,t,i){return Wt(this,e,t,!1,i)};a.prototype.writeDoubleLE=function(e,t,i){return Vt(this,e,t,!0,i)};a.prototype.writeDoubleBE=function(e,t,i){return Vt(this,e,t,!1,i)};a.prototype.copy=function(e,t,i,n){if(i||(i=0),!n&&n!==0&&(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<i&&(n=i),n===i||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-i&&(n=e.length-t+i);var o=n-i,s;if(this===e&&i<t&&t<n)for(s=o-1;s>=0;--s)e[s+t]=this[s+i];else if(o<1e3||!a.TYPED_ARRAY_SUPPORT)for(s=0;s<o;++s)e[s+t]=this[s+i];else Uint8Array.prototype.set.call(e,this.subarray(i,i+o),t);return o};a.prototype.fill=function(e,t,i,n){if(typeof e=="string"){if(typeof t=="string"?(n=t,t=0,i=this.length):typeof i=="string"&&(n=i,i=this.length),e.length===1){var o=e.charCodeAt(0);o<256&&(e=o)}if(n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!a.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else typeof e=="number"&&(e=e&255);if(t<0||this.length<t||this.length<i)throw new RangeError("Out of range index");if(i<=t)return this;t=t>>>0,i=i===void 0?this.length:i>>>0,e||(e=0);var s;if(typeof e=="number")for(s=t;s<i;++s)this[s]=e;else{var u=I(e)?e:at(new a(e,n).toString()),f=u.length;for(s=0;s<i-t;++s)this[s+t]=u[s%f]}return this};er=/[^+\/0-9A-Za-z-_]/g});var h=xt(()=>{"use strict";Ht()});c();h();function X(r){throw new Error("Unexpected value: "+JSON.stringify(r))}c();h();c();h();function lr(r){return Object.keys(r)}var vt={};se(vt,{AstNode:()=>y,ClassInstantiation:()=>V,CodeBlock:()=>J,Comment:()=>C,Function:()=>G,FunctionInvocation:()=>z,MethodInvocation:()=>H,Parameter:()=>K,Reference:()=>D,Type:()=>O,TypeLiteral:()=>B,Types:()=>O,Variable:()=>Q,Writer:()=>Y,codeblock:()=>yr,function_:()=>gr,instantiateClass:()=>Tr,invokeFunction:()=>Ar,invokeMethod:()=>Er,parameter:()=>kr,reference:()=>vr,variable:()=>Ir});c();h();c();h();c();h();c();h();c();h();c();h();c();h();var Kt,Qt,Z=(Qt=(Kt=x.env.FERN_STACK_TRACK)==null?void 0:Kt.toLowerCase())!=null?Qt:"",b=Z!==""&&Z!=="0"&&Z!=="false",Et=["single","multiline","box"].includes(Z)?Z:"single";b&&(Error.stackTraceLimit=50);var cr=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),hr=new Set(["stacktrace"]);function pt({maxFrames:r=50,skip:e=0,filterPaths:t=[],filterFunctions:i=[],stopOn:n=[],filterNode:o=!0,filterJs:s=!0,formatFilename:u=f=>f}={}){var m;if(!b)return[];i=[...i,...cr],t=[...t,...hr],n=[...n,"runInteractiveTask"];let f=!1;return((m=new Error().stack)!=null?m:"").split(`
2
+ `).map(w=>{let p=w.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(p&&p.length===5){let[,d,g,S,rt]=p;if(!d||!g||!S||!rt)return;if(f||n.some(qt=>d==null?void 0:d.includes(qt))){f=!0;return}switch(d){case"Object.<anonymous>":d="";break;case"Object.object":case"Object.alias":case"Object.union":case"Object.enum":case"Object.undiscriminatedUnion":d=`${d.substring(d.indexOf(".")+1)}()=> { ... }`;break}return{fn:d,path:u(g),position:`${S}:${rt}`}}}).filter(w=>{var p,d;return w&&!i.some(g=>w.fn.includes(g))&&!(o&&((p=w.path)!=null&&p.startsWith("node:")))&&!(s&&((d=w.path)!=null&&d.endsWith(".js")))&&!t.some(g=>w.path.includes(g))}).slice(e,e+r)}var ht=class{constructor({maxFrames:e=50,skip:t=0,filterPaths:i=[],filterFunctions:n=[],stopOn:o=[],filterNode:s=!0,filterJs:u=!0,multiline:f=!1,formatFilename:m=w=>w}={}){l(this,"maxFrames");l(this,"skip");l(this,"filterPaths");l(this,"filterFunctions");l(this,"stopOn");l(this,"filterNode");l(this,"filterJs");l(this,"multiline");l(this,"formatFilename");l(this,"tracking",new WeakMap);this.maxFrames=e,this.skip=t,this.filterPaths=i,this.filterFunctions=n,this.stopOn=o,this.filterNode=s,this.filterJs=u,this.multiline=f,this.formatFilename=m}tag(e){let t=this.tracking.get(e)||new Set;pt({maxFrames:this.maxFrames,skip:this.skip,filterPaths:this.filterPaths,filterFunctions:this.filterFunctions,stopOn:this.stopOn,filterNode:this.filterNode,filterJs:this.filterJs,formatFilename:this.formatFilename}).forEach(i=>t.add(i)),this.tracking.set(e,t)}trace(e){if(!b)return"";let t=this.tracking.get(e);return t?[...t].map(i=>`${this.multiline?`
3
+ `:""}${i.fn} - ${i.path}:${i.position}`).join(""):""}frames(e){let t=this.tracking.get(e);return t?[...t]:[]}free(e){this.tracking.delete(e)}clear(){this.tracking=new WeakMap}},_;function Xt({maxFrames:r=50,skip:e=0,filterPaths:t=[],filterFunctions:i=[],stopOn:n=[],filterNode:o=!0,filterJs:s=!0,multiline:u=!1,formatFilename:f=m=>m}={}){b&&(_!=null||(_=new ht({maxFrames:r,skip:e,filterPaths:t,filterFunctions:i,stopOn:n,filterNode:o,filterJs:s,multiline:u,formatFilename:f})))}function Zt(r){_==null||_.tag(r)}function kt(r){var e;return(e=_==null?void 0:_.frames(r))!=null?e:[]}var M=class{constructor(){Zt(this)}};c();h();var mt=class{formatMultiple(e){return Promise.all(e.map(t=>this.format(t)))}formatMultipleSync(e){return e.map(t=>this.formatSync(t))}},q=class extends mt{async format(e){return e}formatSync(e){return e}};c();h();c();h();c();h();var k=class extends M{constructor(t){super();l(this,"value");this.value=t}write(t){typeof this.value=="string"?t.write(this.value):typeof this.value=="function"?this.value(t):this.value.write(t)}};var pr=4;Xt({skip:0,maxFrames:15,filterFunctions:["Abstract"]});var tt=class{constructor(){l(this,"lineBuffer",[]);l(this,"indentLevel",0);l(this,"hasWrittenAnything",!1);l(this,"lastCharacterIsSemicolon",!1);l(this,"lastCharacterIsNewline",!1);l(this,"nodeStackFrames",[])}get buffer(){return b&&this.nodeStackFrames.length>0&&this.writeInternal(`
4
+ `),this.lineBuffer.join(`
5
+ `)+(this.lastCharacterIsNewline?`
6
+ `:"")}write(...e){for(let t of e)if(t!=null)if(typeof t=="string"){let i=t.length>0&&t.endsWith(`
7
+ `),n=i?t.substring(0,t.length-1):t,o=this.getIndentString(),s=n.replaceAll(`
8
+ `,`
9
+ ${o}`);this.isAtStartOfLine()&&(s=o+s),i&&(s+=`
10
+ `),this.writeInternal(s)}else this.writeNode(t)}writeStatement(...e){this.write(...e),this.write(";"),this.writeNewLineIfLastLineNot()}writeNoIndent(e){let t=this.indentLevel;this.indentLevel=0,this.write(e),this.indentLevel=t}writeNode(e){b&&this.nodeStackFrames.push(...kt(e)),e.write(this),b&&Et!=="single"&&this.writeInternal(`
11
+ `)}writeNodeOrString(e){if(typeof e=="string"){this.write(e);return}this.writeNode(e)}writeNodeStatement(e){this.writeNode(e),this.write(";"),this.writeNewLineIfLastLineNot()}writeTextStatement(e){new k(e).write(this),e.endsWith(";")||this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(e,t){new k(e).write(this),this.write(" (",t,")"),this.pushScope()}controlFlowWithoutStatement(e){new k(e).write(this),this.pushScope()}endControlFlow(){this.popScope()}contiguousControlFlow(e,t){this.dedent(),this.write("} "),new k(e).write(this),this.write(" (",t,")"),this.pushScope()}alternativeControlFlow(e){this.dedent(),this.write("} "),new k(e).write(this),this.pushScope()}pushScope(){this.writeLine("{"),this.indent()}popScope(e=!0){this.dedent(),this.writeNewLineIfLastLineNot(),e?this.writeLine("}"):this.write("}")}writeLine(...e){this.write(...e.length===0?[""]:e),this.writeNewLineIfLastLineNot()}newLine(){this.writeInternal(`
12
+ `)}writeSemicolonIfLastCharacterIsNot(){this.lastCharacterIsSemicolon||this.writeInternal(";")}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
13
+ `)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:e,delimiter:t,writeFunction:i}){if(e.length>0){let n=e[0];n!=null&&i(n);for(let o=1;o<e.length;o++){this.write(t);let s=e[o];s!=null&&i(s)}}}toString(){return this.buffer}writeInternal(e){if(e.length===0)return;let t=!this.lastCharacterIsNewline;this.hasWrittenAnything=!0,this.lastCharacterIsNewline=e.endsWith(`
14
+ `),this.lastCharacterIsSemicolon=e.endsWith(";");let i=e.split(`
15
+ `),n=b&&!this.shouldSkipTracking(i)&&this.lastCharacterIsNewline;t&&(this.lastLine=`${this.lastLine}${i.shift()||""}`),this.lastCharacterIsNewline&&i.pop(),this.lineBuffer.push(...i),n&&this.appendTrackingComment()}set lastLine(e){this.lineBuffer.length>0?this.lineBuffer[this.lineBuffer.length-1]=e:this.lineBuffer.push(e)}get lastLine(){return this.lineBuffer[this.lineBuffer.length-1]||""}shouldSkipTracking(e){return!1}formatStack(e,t=""){return e.map(i=>`${t?`(${t}) `:""} ${i.fn} - ${i.path} : ${i.position}`)}filterStack(e){return e.filter(t=>!t.fn.startsWith(`${this.constructor.name}.`))}appendTrackingComment(){let e=[...this.formatStack(this.filterStack(pt({maxFrames:15,skip:3}))),...this.formatStack(this.filterStack(this.nodeStackFrames),"node")];switch(this.nodeStackFrames.length=0,Et){case"single":return this.singleLineTrackingComment(e);case"multiline":return this.multiLineTrackingComment(e);case"box":return this.boxTrackingComment(e)}}singleLineTrackingComment(e){this.lastLine=`${this.lastLine} // ${e.join(" ")}`}multiLineTrackingComment(e){this.lineBuffer.push(...e.map(t=>` // ${t}`))}boxTrackingComment(e){this.lineBuffer.push("/*",...e.map(t=>` ${t}`),"*/")}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*this.getTabSize())}getTabSize(){return pr}};c();h();c();h();var Y=class extends tt{constructor({customConfig:t,formatter:i}){super();l(this,"customConfig");l(this,"formatter");l(this,"imports",{});l(this,"defaultImports",{});l(this,"starImportAliases",{});l(this,"starImportAliasesInverse",{});this.customConfig=t,this.formatter=i!=null?i:new q}addImport(t){var i,n,o;if(t.importFrom!=null){switch(t.importFrom.type){case"default":{this.validateDefault(t);break}case"named":{this.validateNamed(t);break}case"star":{this.validateStar(t);break}}let s=(o=(i=this.imports)[n=t.importFrom.moduleName])!=null?o:i[n]=[];s.map(f=>f.name).includes(t.name)||s.push(t)}}validateDefault(t){var n,o,s,u;if(((n=t.importFrom)==null?void 0:n.type)!=="default")return;let i=(u=(o=this.defaultImports)[s=t.importFrom.moduleName])!=null?u:o[s]=t;if(i.name!==t.name)throw new Error(`Cannot have multiple default imports for module ${t.importFrom.moduleName}: got ${t.name} but already had ${i.name}`)}validateNamed(t){var s,u,f,m,w;if(((s=t.importFrom)==null?void 0:s.type)!=="named")return;let n=((u=this.imports[t.importFrom.moduleName])!=null?u:[]).filter(p=>{var d;return((d=p.importFrom)==null?void 0:d.type)==="star"});if(n.length>0)throw new Error(`Cannot add named import ${t.name} because non-named imports ${n.map(p=>p.name)} already exist`);let o=[];for(let p of Object.values(this.imports))for(let d of p)((f=d.importFrom)==null?void 0:f.type)==="named"&&d.importFrom.moduleName!==t.importFrom.moduleName&&d.name===t.name&&o.push(d);if(o.length>0)throw new Error(`Cannot add named import from module ${t.importFrom.moduleName} because it is already imported from ${(w=(m=o[0])==null?void 0:m.importFrom)==null?void 0:w.moduleName}`)}validateStar(t){var o,s,u,f,m,w,p;if(((o=t.importFrom)==null?void 0:o.type)!=="star")return;let i=(f=(s=this.starImportAliases)[u=t.importFrom.moduleName])!=null?f:s[u]=t.importFrom.starImportAlias;if(i!==t.importFrom.starImportAlias)throw new Error(`Cannot have more than one alias for non-named imports from a module: got ${t.importFrom.starImportAlias} but already have ${i}.`);if(((p=(m=this.starImportAliasesInverse)[w=t.importFrom.starImportAlias])!=null?p:m[w]=t.importFrom.moduleName)!==t.importFrom.moduleName)throw new Error(`Attempted to use alias ${t.importFrom.starImportAlias} for more than one module in the same file`)}};var et=class extends Y{constructor({customConfig:e,formatter:t}){super({customConfig:e,formatter:t})}async toStringAsync(){let e=this.getContent();if(this.formatter!=null)try{return this.formatter.format(e)}catch(t){throw new Error(`Failed to format TypeScript file: ${t}
16
+ ${e}`)}return e}toString(){let e=this.getContent();if(this.formatter!=null)try{return this.formatter.formatSync(e)}catch(t){throw new Error(`Failed to format TypeScript file: ${t}
17
+ ${e}`)}return e}getContent(){let e=this.stringifyImports();return e.length>0?e+`
18
+ `+this.buffer:this.buffer}stringifyImports(){let e="";for(let[t,i]of Object.entries(this.imports)){let n=this.defaultImports[t],o="",s=i.filter(f=>{var m;return((m=f.importFrom)==null?void 0:m.type)==="named"}),u=this.starImportAliases[t];if(s.length>0||n!=null||u!=null){if(e+="import",n!=null&&(e+=` ${n.name}`),s.length>0){for(let m of s.slice(0,-1))o+=`${m.name}, `;let f=s[s.length-1];f!=null&&(o+=`${f.name}`),n!=null&&(e+=","),e+=` { ${o} }`}u!=null&&((n!=null||s.length>0)&&(e+=", "),e+=` * as ${u}`),e+=` from "${t}";
19
+ `}}return e}};var y=class extends M{async toStringAsync({customConfig:e,formatter:t}){let i=new et({customConfig:e,formatter:t});return this.write(i),await i.toStringAsync()}toString({customConfig:e,formatter:t}){let i=new et({customConfig:e,formatter:t});return this.write(i),i.toString()}};var V=class extends y{constructor({class_:t,arguments_:i}){super();l(this,"class_");l(this,"arguments_");this.class_=t,this.arguments_=i}write(t){t.write("new "),t.writeNode(this.class_),t.write("("),t.delimit({nodes:this.arguments_,delimiter:", ",writeFunction:i=>i.write(t)}),t.write(")")}};c();h();var J=class extends y{constructor(t){super();l(this,"args");this.args=t}write(t){return new k(this.args).write(t)}};c();h();var C=class extends y{constructor({docs:t}={docs:void 0}){super();l(this,"docs");this.docs=t}write(t){this.docs!=null&&(t.writeLine("/**"),this.docs.split(`
20
+ `).forEach(i=>{t.writeLine(` * ${i}`)}),t.writeLine("*/"))}};c();h();c();h();c();h();var O=class extends y{constructor(t){super();l(this,"internalType");this.internalType=t}write(t){switch(this.internalType.type){case"string":t.write("string");break;case"number":t.write("number");break;case"bigint":t.write("bigint");break;case"boolean":t.write("boolean");break;case"array":this.internalType.valueType.write(t),t.write("[]");break;case"map":t.write("Record<"),this.internalType.keyType.write(t),t.write(", "),this.internalType.valueType.write(t),t.write(">");break;case"object":t.write("{"),t.indent();for(let[i,n]of Object.entries(this.internalType.fields))t.write(`${i}: `),n.write(t),t.writeLine(",");t.dedent(),t.write("}");break;case"enum":t.write("enum");break;case"any":t.write("any");break;case"promise":t.write("Promise<"),this.internalType.value.write(t),t.write(">");break;case"unknown":t.write("unknown");break;case"void":t.write("void");break;case"undefined":t.write("undefined");break;case"null":t.write("null");break;case"never":t.write("never");break;case"nop":break;default:X(this.internalType)}}static string(){return new this({type:"string"})}static number(){return new this({type:"number"})}static bigint(){return new this({type:"bigint"})}static boolean(){return new this({type:"boolean"})}static array(t){return new this({type:"array",valueType:t})}static object(t){return new this({type:"object",fields:t})}static enum(t){return new this({type:"enum",values:t})}static any(){return new this({type:"any"})}static promise(t){return t.internalType.type==="promise"?t:new this({type:"promise",value:t})}static unknown(){return new this({type:"unknown"})}static void(){return new this({type:"void"})}static undefined(){return new this({type:"undefined"})}static null(){return new this({type:"null"})}static never(){return new this({type:"never"})}static nop(){return new this({type:"nop"})}};var G=class extends y{constructor({name:t,parameters:i,async:n,body:o,return_:s,docs:u}){super();l(this,"name");l(this,"parameters");l(this,"async");l(this,"body");l(this,"return_");l(this,"docs");this.name=t,this.parameters=i,this.async=n!=null?n:!1,this.body=o,this.return_=s,this.docs=u}write(t){var i;t.writeNode(new C({docs:this.docs})),this.async&&t.write("async "),t.write("function "),t.write(`${this.name}`),this.writeParameters(t),this.return_!=null&&(t.write(": "),t.writeNode(this.async?O.promise(this.return_):this.return_)),t.writeLine(" {"),t.indent(),(i=this.body)==null||i.write(t),t.dedent(),t.writeNewLineIfLastLineNot(),t.writeLine("}")}writeParameters(t){if(this.parameters.length===0){t.write("()");return}t.indent(),t.writeLine("(");for(let i of this.parameters)t.writeNode(i),t.writeLine(",");t.dedent(),t.write(")")}};c();h();var z=class extends y{constructor({function_:t,arguments_:i}){super();l(this,"function_");l(this,"arguments_");this.function_=t,this.arguments_=i}write(t){t.writeNode(this.function_),t.write("("),t.delimit({nodes:this.arguments_,delimiter:", ",writeFunction:i=>i.write(t)}),t.write(")")}};c();h();var H=class extends y{constructor({on:t,method:i,arguments_:n,async:o}){super();l(this,"on");l(this,"method");l(this,"arguments_");l(this,"async");this.on=t,this.method=i,this.arguments_=n,this.async=o}write(t){this.async&&t.write("await "),this.on.write(t),t.write("."),t.write(this.method),t.write("("),t.delimit({nodes:this.arguments_,delimiter:", ",writeFunction:i=>i.write(t)}),t.write(")")}};c();h();var K=class extends y{constructor({name:t,type:i,docs:n}){super();l(this,"name");l(this,"type");l(this,"docs");this.name=t,this.type=i,this.docs=n}write(t){this.docs!=null&&t.writeNode(new C({docs:this.docs})),t.write(`${this.name}: `),this.type.write(t)}};c();h();var D=class extends y{constructor({name:t,importFrom:i,memberName:n}){super();l(this,"name");l(this,"importFrom");l(this,"memberName");this.name=t,this.importFrom=i,this.memberName=n}write(t){var o;this.importFrom!=null&&t.addImport(this);let i=((o=this.importFrom)==null?void 0:o.type)==="star"?`${this.importFrom.starImportAlias}.`:"",n=this.memberName!=null?`.${this.memberName}`:"";t.write(`${i}${this.name}${n}`)}};c();h();var B=class r extends y{constructor(t){super();l(this,"internalType");this.internalType=t}write(t){var o,s;let i=!!((o=t.customConfig)!=null&&o.noSerdeLayer),n=!!((s=t.customConfig)!=null&&s.useBigInt);switch(this.internalType.type){case"array":{this.writeIterable({writer:t,iterable:this.internalType});break}case"blob":{if(i){t.writeNode(r.string(this.internalType.value));return}t.write("new Blob(["),t.writeNode(r.string(this.internalType.value)),t.write("])");break}case"boolean":{t.write(this.internalType.value.toString());break}case"bigint":{if(n){t.write(`BigInt("${this.internalType.value.toString()}")`);return}t.write(`"${this.internalType.value.toString()}"`);return}case"datetime":{if(i){t.writeNode(r.string(this.internalType.value));return}t.write("new Date("),t.writeNode(r.string(this.internalType.value)),t.write(")");break}case"number":{t.write(this.internalType.value.toString());break}case"object":{this.writeObject({writer:t,object:this.internalType});break}case"record":{this.writeRecord({writer:t,record:this.internalType});break}case"reference":{t.writeNode(this.internalType.value);break}case"set":{if(i||this.isSetOfObjects()){t.writeNode(r.array({values:this.internalType.values}));return}t.write("new Set("),this.writeIterable({writer:t,iterable:this.internalType}),t.write(")");break}case"string":{this.internalType.value.includes(`
21
+ `)?this.writeStringWithBackticks({writer:t,value:this.internalType.value}):t.write(`"${this.internalType.value.replaceAll('"','\\"')}"`);break}case"tuple":{this.writeIterable({writer:t,iterable:this.internalType});break}case"unknown":{this.writeUnknown({writer:t,value:this.internalType.value});break}case"null":{t.write("null");break}case"nop":break;default:X(this.internalType)}}isObject(){return this.internalType.type==="object"}asObjectOrThrow(){if(this.isObject())return this.internalType;throw new Error("Internal error; ts.TypeLiteral is not an object")}isSet(){return this.internalType.type==="set"}asSetOrThrow(){if(this.isSet())return this.internalType;throw new Error("Internal error; ts.TypeLiteral is not a set")}isSetOfObjects(){return this.isSet()&&this.asSetOrThrow().values.every(t=>t.isObject())}writeStringWithBackticks({writer:t,value:i}){t.write("`");let n=i.split(`
22
+ `),o=n[0]+`
23
+ `,s=n.slice(1).join(`
24
+ `);t.write(o.replaceAll("`","\\`")),t.writeNoIndent(s.replaceAll("`","\\`")),t.write("`")}writeIterable({writer:t,iterable:i}){let n=dr({values:i.values});if(n.length===0){t.write("[]");return}t.writeLine("["),t.indent();for(let o of n)o.write(t),t.writeLine(",");t.dedent(),t.write("]")}writeRecord({writer:t,record:i}){let n=wr({entries:i.entries});if(n.length===0){t.write("{}");return}t.writeLine("{"),t.indent();for(let o of n)o.key.write(t),t.write(": "),o.value.write(t),t.writeLine(",");t.dedent(),t.write("}")}writeObject({writer:t,object:i}){let n=mr({fields:i.fields});if(n.length===0){t.write("{}");return}t.writeLine("{"),t.indent();for(let o of n)t.write(`${o.name}: `),o.value.write(t),t.writeLine(",");t.dedent(),t.write("}")}static array({values:t}){return new this({type:"array",values:t})}static bigint(t){return new this({type:"bigint",value:t})}static blob(t){return new this({type:"blob",value:t})}static boolean(t){return new this({type:"boolean",value:t})}static datetime(t){return new this({type:"datetime",value:t})}static number(t){return new this({type:"number",value:t})}static object({fields:t}){return new this({type:"object",fields:t})}static record({entries:t}){return new this({type:"record",entries:t})}static reference(t){return new this({type:"reference",value:t})}static set({values:t}){return new this({type:"set",values:t})}static string(t){return new this({type:"string",value:t})}static tuple({values:t}){return new this({type:"tuple",values:t})}static unknown(t){return new this({type:"unknown",value:t})}static null(){return new this({type:"null"})}static nop(){return new this({type:"nop"})}static isNop(t){return t.internalType.type==="nop"}writeUnknown({writer:t,value:i}){switch(typeof i){case"boolean":t.write(i.toString());return;case"string":t.write(i.includes('"')?`\`${i}\``:`"${i}"`);return;case"number":t.write(i.toString());return;case"object":if(i==null){t.write("null");return}if(Array.isArray(i)){this.writeUnknownArray({writer:t,value:i});return}this.writeUnknownObject({writer:t,value:i});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof i}`)}}writeUnknownArray({writer:t,value:i}){if(i.length===0){t.write("[]");return}t.writeLine("["),t.indent();for(let n of i)t.writeNode(r.unknown(n)),t.writeLine(",");t.dedent(),t.write("]")}writeUnknownObject({writer:t,value:i}){let n=Object.entries(i);if(n.length===0){t.write("{}");return}t.writeLine("{"),t.indent();for(let[o,s]of n)t.write(`${o}: `),t.writeNode(r.unknown(s)),t.writeLine(",");t.dedent(),t.write("}")}};function mr({fields:r}){return r.filter(e=>!B.isNop(e.value))}function wr({entries:r}){return r.filter(e=>!B.isNop(e.key)&&!B.isNop(e.value))}function dr({values:r}){return r.filter(e=>!B.isNop(e))}c();h();var Q=class extends y{constructor(t){super();l(this,"args");this.args=t}write(t){this.args.export&&t.write("export "),this.args.const?t.write("const "):t.write("let "),t.write(`${this.args.name} = `),t.writeNode(this.args.initializer)}};function yr(r){return new J(r)}function gr(r){return new G(r)}function Tr(r){return new V(r)}function Ar(r){return new z(r)}function Er(r){return new H(r)}function kr(r){return new K(r)}function vr(r){return new D(r)}function Ir(r){return new Q(r)}c();h();export{br as a,Sr as b,Nr as c,Rr as d,_r as e,Br as f,l as g,c as h,h as i,X as j,lr as k,vt as l};
25
+ /*! Bundled license information:
26
+
27
+ @esbuild-plugins/node-globals-polyfill/Buffer.js:
28
+ (*!
29
+ * The buffer module from node.js, for the browser.
30
+ *
31
+ * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
32
+ * @license MIT
33
+ *)
34
+ */
35
+ //# sourceMappingURL=chunk-XCBZNNLA.js.map