@fern-api/typescript-dynamic-snippets 0.0.9 → 3.35.9

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 +8 -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 +8 -2
  25. package/esm/EndpointSnippetGenerator.js +2 -1
  26. package/esm/EndpointSnippetGenerator.js.map +1 -0
  27. package/esm/{chunk-XC2QAVJY.js → chunk-7YNOMYIY.js} +2 -1
  28. package/esm/chunk-7YNOMYIY.js.map +1 -0
  29. package/esm/chunk-GCLEFX73.js +15 -0
  30. package/esm/chunk-GCLEFX73.js.map +1 -0
  31. package/esm/chunk-HXSH7OPV.js +2 -0
  32. package/esm/chunk-HXSH7OPV.js.map +1 -0
  33. package/esm/chunk-NNO323RB.js +2 -0
  34. package/esm/chunk-NNO323RB.js.map +1 -0
  35. package/esm/chunk-R73BYUJU.js +2 -0
  36. package/esm/chunk-R73BYUJU.js.map +1 -0
  37. package/esm/chunk-WFHV7AZS.js +35 -0
  38. package/esm/chunk-WFHV7AZS.js.map +1 -0
  39. package/esm/chunk-X6S2ZXYW.js +2 -0
  40. package/esm/chunk-X6S2ZXYW.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-D7ZDXIQ6.js +0 -1
  55. package/esm/chunk-JGNWFXNM.js +0 -1
  56. package/esm/chunk-PXWPOKCJ.js +0 -1
  57. package/esm/chunk-RL2XA35J.js +0 -27
  58. package/esm/chunk-T2HPPEKP.js +0 -14
  59. package/esm/chunk-XXAPM4QI.js +0 -1
@@ -0,0 +1,2 @@
1
+ import{a as T,b as P,c as S,d as A,g as p,h as l,i as u,j as h,k as R}from"./chunk-WFHV7AZS.js";l();u();l();u();var y=class{constructor(){p(this,"reporter");p(this,"snippet");p(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){p(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 a=await d.generateSnippet({endpoint:i,request:e,options:r});if(s.errors.empty())return{snippet:a,errors:void 0};n.update({context:s,snippet:a})}catch(a){n.err==null&&(n.err=a)}}return n.getResponseOrThrow({endpoint:e.endpoint})}async generateSnippetAst(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;for(let i of t){let s=this.context.clone(),d=this.createSnippetGenerator(s);try{return await d.generateSnippetAst({endpoint:i,request:e,options:r})}catch(a){n=a}}throw n!=null?n:new Error(`Failed to generate snippet AST for endpoint: ${e.endpoint.method} ${e.endpoint.path}`)}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 a=d.generateSnippetSync({endpoint:i,request:e,options:r});if(s.errors.empty())return{snippet:a,errors:void 0};n.update({context:s,snippet:a})}catch(a){n.err==null&&(n.err=a)}}return n.getResponseOrThrow({endpoint:e.endpoint})}};l();u();var o={Critical:"CRITICAL",Warning:"WARNING"},g=class m{constructor(){p(this,"errors");p(this,"path");this.errors=[],this.path=[]}add(e){this.errors.push(P(T({},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}};l();u();l();u();l();u();var v=class{constructor(){p(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={}}){p(this,"config");p(this,"options");p(this,"errors");p(this,"_ir");p(this,"httpEndpointReferenceParser");this._ir=e,this.config=r,this.options=t,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 s=e.find(a=>a.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(a=>a.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,a=A(x,[S(n)]);return{singleDiscriminatedUnionType:s,discriminantValue:s.discriminantValue,value:a}}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}};l();u();var b={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};l();u();export{E as a,o as b,w as c,b as d};
2
+ //# sourceMappingURL=chunk-R73BYUJU.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\";\nimport { AbstractAstNode } from \"../ast\";\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 async generateSnippetAst(\n request: FernIr.dynamic.EndpointSnippetRequest,\n options: Options = {}\n ): Promise<AbstractAstNode> {\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 let lastError: Error | undefined = undefined;\n for (const endpoint of endpoints) {\n const context = this.context.clone() as Context;\n const snippetGenerator = this.createSnippetGenerator(context);\n try {\n const ast = await snippetGenerator.generateSnippetAst({ endpoint, request, options });\n return ast;\n } catch (error) {\n lastError = error as Error;\n }\n }\n if (lastError != null) {\n throw lastError;\n }\n throw new Error(\n `Failed to generate snippet AST for endpoint: ${request.endpoint.method} ${request.endpoint.path}`\n );\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":"gGAKAA,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,uBAAsB,GAGpD,MAAMA,EAAA,KAAK,MAAL,KAAAA,EAAY,IAAI,MA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A,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","lastError","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"]}
@@ -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 He(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 Ke(r,e,t,i){return lt(sr(e,r.length-t),r,t,i)}function He(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,Kt=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 Ke(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";Kt()});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:()=>K,Parameter:()=>H,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 Ht,Qt,Z=(Qt=(Ht=x.env.FERN_STACK_TRACK)==null?void 0:Ht.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 K=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 H=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 K(r)}function kr(r){return new H(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-WFHV7AZS.js.map